/* Book Catalogue: one stylesheet for the whole app. */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --stage: linear-gradient(180deg, #f0f0f3 0%, #e7e7eb 100%);
  --sidebar: rgba(242, 242, 245, 0.78);
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #8e8e93;
  --hair: rgba(0, 0, 0, 0.08);
  --hair-strong: rgba(0, 0, 0, 0.14);
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #248a3d;
  --green-fill: #34c759;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #c25e00;
  --orange-fill: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.07);
  --book-shadow: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12)) drop-shadow(0 14px 22px rgba(0, 0, 0, 0.16));
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #1c1c1e;
    --surface-2: #232326;
    --stage: linear-gradient(180deg, #2a2a2e 0%, #222225 100%);
    --sidebar: rgba(28, 28, 31, 0.72);
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #7c7c80;
    --hair: rgba(255, 255, 255, 0.09);
    --hair-strong: rgba(255, 255, 255, 0.16);
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.36);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --green: #30d158;
    --green-fill: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a;
    --orange-fill: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-2: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 40px rgba(0, 0, 0, 0.45);
    --book-shadow: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)) drop-shadow(0 16px 24px rgba(0, 0, 0, 0.5));
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Inter", system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.icon { flex: none; display: block; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 0.92em; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App frame ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 22px 14px 28px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: var(--ink); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: block; flex: none; object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.brand b { display: block; font-size: 15px; letter-spacing: -0.02em; }
.brand span { display: block; font-size: 12px; color: var(--ink-2); }

.nav-group { margin-top: 18px; }
.nav-title { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin: 1px 0;
  border-radius: 8px; color: var(--ink); font-size: 14px; line-height: 20px;
}
.nav-item:hover { background: var(--fill); }
.nav-item.is-active { background: var(--fill-2); font-weight: 600; }
.nav-item .icon { color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-item .code {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; background: var(--fill); color: var(--ink-2);
}

.main { min-width: 0; padding: 34px 44px 80px; }
.page { max-width: 1240px; margin: 0 auto; }

/* ---------- Type & headers ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.large-title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.page-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 44px 0 14px; }
.section-head h2 { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.section-head .aside { font-size: 14px; color: var(--ink-2); }
.section-head a.aside { color: var(--accent); display: inline-flex; align-items: center; gap: 2px; }
.section-head a.aside:hover { text-decoration: underline; }

/* ---------- Controls ---------- */

.toolbar { display: flex; align-items: center; gap: 10px; }
.search {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; width: 260px;
  background: var(--fill); border-radius: 10px; color: var(--ink-3);
}
.search input { border: 0; outline: 0; background: none; font: inherit; color: var(--ink); width: 100%; font-size: 14px; }
.search:focus-within { box-shadow: 0 0 0 3.5px var(--accent-soft); }

.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill); gap: 2px; }
.segmented a {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 7px; color: var(--ink); font-size: 13px; font-weight: 500;
}
.segmented a.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04); }
.segmented a:not(.is-active):hover { background: var(--fill); }

.button {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px;
  border-radius: 980px; border: 0; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { filter: brightness(1.08); }
.button-secondary { background: var(--fill); color: var(--accent); }
.button-secondary:hover { background: var(--fill-2); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 980px;
  font-size: 12.5px; font-weight: 500; background: var(--fill); color: var(--ink-2); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-live { background: var(--accent-soft); color: var(--accent); }
.pill-published { background: var(--green-soft); color: var(--green); }
.pill-unpublished { background: var(--orange-soft); color: var(--orange); }
.pill-unconfirmed { background: var(--fill); color: var(--ink-2); }
.pill-planned, .pill-in_progress, .pill-stopped { background: var(--fill); color: var(--ink-2); }

/* Language badges: filled = on Amazon, outlined = not yet, blue = campaign live. */
.lang {
  display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; transition: transform .15s ease;
}
a.lang:hover { transform: translateY(-1px); text-decoration: none; }
.lang-published { background: var(--green-soft); color: var(--green); }
.lang-unconfirmed { background: var(--fill); color: var(--ink-2); }
.lang-unpublished { box-shadow: inset 0 0 0 1.25px var(--orange-fill); color: var(--orange); }
.lang-live { background: var(--accent); color: #fff; }

/* Progress ring */
.ring { position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex: none; }
.ring svg { display: block; }
.ring circle { fill: none; }
.ring-track { stroke: var(--fill-2); }
.ring-value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-full .ring-value { stroke: var(--green-fill); }
.ring-label { position: absolute; font-size: calc(var(--size) * 0.28); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---------- Cards & book stages ---------- */

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px 22px; }

.stage {
  position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1;
  background: var(--stage); border-radius: var(--radius-sm); overflow: hidden;
}
.stage img {
  max-width: 76%; max-height: 82%; width: auto; height: auto; filter: var(--book-shadow);
  border-radius: 3px; transition: transform .35s cubic-bezier(.2,.8,.2,1);
  min-width: 1px; min-height: 1px; /* lets lazy loading see the image before it has a size */
}
.stage-empty { color: var(--ink-3); opacity: .6; }

/* ---------- Library: summary ---------- */

.summary { display: grid; grid-template-columns: auto repeat(3, 1fr); align-items: center; padding: 18px 24px; gap: 8px 28px; }
.summary .metric { border-left: 1px solid var(--hair); padding-left: 24px; }
.summary .metric b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.summary .metric span { font-size: 13px; color: var(--ink-2); }
.summary .bar { margin-top: 8px; height: 4px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.summary .bar i { display: block; height: 100%; background: var(--green-fill); border-radius: 4px; }

/* ---------- Library: shelf ---------- */

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 30px 22px; }
.book-card { display: block; color: var(--ink); }
.book-card:hover { text-decoration: none; }
.book-card:hover .stage img { transform: translateY(-4px) scale(1.02); }
.book-card .stage { box-shadow: var(--shadow-1); }
.book-card h3 { margin: 12px 0 2px; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.book-card .meta { font-size: 13px; color: var(--ink-2); }
.book-card-wrap .langs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

/* ---------- Library: overview matrix ---------- */

.matrix { width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix th { font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 12px 8px; border-bottom: 1px solid var(--hair); }
.matrix th:first-child { text-align: left; padding-left: 20px; }
.matrix td { padding: 10px 8px; border-bottom: 1px solid var(--hair); text-align: center; }
.matrix tr:last-child td { border-bottom: 0; }
.matrix td:first-child { text-align: left; padding-left: 16px; }
.matrix .book-cell { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; font-size: 14px; }
.matrix .book-cell .stage { width: 44px; border-radius: 8px; }
.matrix .book-cell .stage img { max-width: 80%; max-height: 84%; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
.matrix .cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 10px; color: var(--ink); }
.matrix .cell:hover { background: var(--fill); text-decoration: none; }
.matrix .cell small { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; }
.matrix .cell small.published { color: var(--green); }
.matrix .cell small.unpublished { color: var(--orange); }
.matrix .cell small.unconfirmed { color: var(--ink-3); }
.matrix .cell small.live { color: var(--accent); }
.matrix .none { color: var(--ink-3); opacity: .5; }
.matrix-wrap { overflow-x: auto; }

/* ---------- Edition page ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; }
.back:hover { text-decoration: underline; }
.segmented .lang-dot { width: 6px; height: 6px; border-radius: 50%; }
.lang-dot.published { background: var(--green-fill); }
.lang-dot.unpublished { background: var(--orange-fill); }
.lang-dot.unconfirmed { background: var(--ink-3); opacity: .5; }
.lang-dot.live { background: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 44px; align-items: center; }
.hero .stage { border-radius: 24px; box-shadow: var(--shadow-2); }
.hero .stage img { max-width: 72%; max-height: 80%; }
.hero-thumbs { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.hero-thumbs button {
  width: 54px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px;
  opacity: .55; transition: opacity .2s;
}
.hero-thumbs button.is-active, .hero-thumbs button:hover { opacity: 1; }
.hero-thumbs .stage { border-radius: 10px; box-shadow: none; }
.hero-thumbs .stage img { filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.hero-thumbs button.is-active .stage { box-shadow: 0 0 0 2px var(--accent); }

.eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow span + span::before { content: "·"; margin-right: 8px; color: var(--ink-3); }
.hero h1 { font-size: 40px; line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; margin: 10px 0 10px; text-wrap: balance; }
.hero .subtitle { font-size: 19px; line-height: 1.4; color: var(--ink-2); margin: 0 0 14px; text-wrap: pretty; }
.hero .byline { font-size: 15px; margin-bottom: 18px; }
.hero .byline .missing { color: var(--orange); font-weight: 500; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.readiness { display: flex; align-items: center; gap: 16px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--hair); }
.readiness b { display: block; font-size: 17px; letter-spacing: -0.015em; }
.readiness span { font-size: 14px; color: var(--ink-2); }

.local-nav {
  position: sticky; top: 0; z-index: 5; margin: 40px -44px 0; padding: 10px 44px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.local-nav a { padding: 6px 13px; border-radius: 980px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.local-nav a:hover { color: var(--ink); background: var(--fill); }
.local-nav a.is-active { color: var(--ink); background: var(--fill-2); }
section[id] { scroll-margin-top: 70px; }

/* Checklist */
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; }
.check-group { padding: 18px 22px; border-left: 1px solid var(--hair); }
.check-group:first-child { border-left: 0; }
.check-group h3 { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.check-group h3 span { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 9px; align-items: flex-start; padding: 4px 0; font-size: 14px; line-height: 20px; }
.check .icon { margin-top: 1px; }
.check.done { color: var(--ink-2); }
.check.done .icon { color: var(--green-fill); }
.check.todo .icon { color: var(--orange-fill); }

/* File tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.tile { margin: 0; min-width: 0; }
.tile-drop {
  aspect-ratio: 3 / 4; border-radius: var(--radius-sm); display: grid; place-items: center; overflow: hidden;
  background: var(--stage); transition: box-shadow .2s, transform .2s, background .2s;
}
.tile.is-empty .tile-drop { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--hair-strong); }
.tile-drop img { min-width: 1px; min-height: 1px; max-width: 84%; max-height: 86%; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); border-radius: 2px; }
.tile-hint { display: grid; justify-items: center; gap: 8px; text-align: center; font-size: 12px; line-height: 1.35; color: var(--ink-3); }
.tile.is-over .tile-drop { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); transform: scale(1.02); }
.tile.is-over .tile-hint { color: var(--accent); }
.tile figcaption { display: grid; gap: 1px; margin-top: 9px; font-size: 13px; }
.tile-label { font-weight: 600; }
.tile-type { justify-self: start; margin: 3px 0 2px; padding: 1px 6px; border-radius: 5px;
  background: var(--fill); color: var(--ink-2); font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; }
.tile-file { color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-need { color: var(--orange); font-size: 12px; font-weight: 500; }
.tile-optional { color: var(--ink-3); font-size: 12px; }
.tile-remove { justify-self: start; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-remove, .tile-remove:focus-visible { opacity: 1; }
@media (hover: none) { .tile-remove { opacity: 1; } }
.tile-status { font-size: 12px; color: var(--ink-2); }
.tile-status.error { color: var(--orange); }
.drop-hint { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; margin: -4px 0 16px; }
.drop-hint .icon { color: var(--accent); }

/* Formats */
.formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 18px; }
.format-card { overflow: hidden; }
.format-info { padding: 20px 22px; }
.format-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.format-title .glyph { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.format-title b { font-size: 16px; letter-spacing: -0.015em; white-space: nowrap; }
.format-title .pill { margin-left: auto; }
.confirm { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
           margin: -2px 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
.confirm > span { font-size: 13.5px; font-weight: 500; }
.segmented button { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border: 0; border-radius: 7px;
                    background: none; color: var(--ink); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.segmented button:not(.is-active):hover { background: var(--fill); }
.segmented button.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04); }
.segmented button.is-yes { color: var(--green); }
.segmented button.is-no { color: var(--orange); }
.format-files { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px 18px; background: var(--surface-2); border-left: 1px solid var(--hair); }
.format-files .tile-drop { aspect-ratio: 3 / 4.2; }

.specs { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; font-size: 14px; }
.specs dt, .specs dd { padding: 7px 0; border-top: 1px solid var(--hair); margin: 0; }
.specs dt { color: var(--ink-2); padding-right: 18px; }
.specs dd { text-align: right; overflow-wrap: anywhere; }
.specs dt:first-of-type, .specs dt:first-of-type + dd { border-top: 0; }
.specs .unset { color: var(--ink-3); }

/* Listing */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 22px 6px; }
.card-title h3 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.card-title span { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.keyword { padding: 10px 22px; border-top: 1px solid var(--hair); }
.keyword:first-of-type { border-top: 0; }
.keyword-row { display: flex; gap: 12px; align-items: baseline; font-size: 14px; }
.keyword-row .n { color: var(--ink-3); font-size: 12px; width: 12px; font-variant-numeric: tabular-nums; }
.keyword-row .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.keyword-row .chars { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter { height: 3px; border-radius: 3px; background: var(--fill); margin: 7px 0 0 24px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); opacity: .7; }
.meter.over i { background: var(--orange-fill); opacity: 1; }
.empty { padding: 14px 22px 20px; color: var(--ink-3); font-size: 14px; }
.ingram-field { margin: 4px 22px 20px; padding: 12px 14px; border-radius: 10px; background: var(--fill); font-size: 12.5px; overflow-wrap: anywhere; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 12px 22px; border-top: 1px solid var(--hair); font-size: 14px; }
.crumbs:first-of-type { border-top: 0; }
.crumbs .icon { color: var(--ink-3); }
.crumbs span:last-child { font-weight: 600; }

/* Description */
.description { position: relative; padding: 26px 30px; font-size: 15px; line-height: 1.6; max-height: 380px; overflow: hidden; }
.description.is-open { max-height: none; }
.description h4, .description h5 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.015em; line-height: 1.35; }
.description p { margin: 0 0 12px; }
.description ul { padding-left: 20px; margin: 0 0 12px; }
.description:not(.is-open)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(180deg, transparent, var(--surface) 80%);
}
.more { display: flex; justify-content: center; margin-top: -26px; position: relative; z-index: 1; }

/* Bonuses */
.bonuses { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.bonus { display: flex; gap: 16px; align-items: center; padding: 14px; color: var(--ink); transition: transform .2s, box-shadow .2s; }
.bonus:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.bonus .stage { width: 84px; border-radius: 10px; flex: none; }
.bonus .stage img { max-width: 80%; filter: drop-shadow(0 3px 6px rgba(0,0,0,.2)); }
.bonus small { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.bonus b { display: block; font-size: 15px; letter-spacing: -0.015em; margin: 2px 0; }
.bonus span { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Campaign stepper */
.stepper { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(96px, 1fr); padding: 24px 22px 20px; overflow-x: auto; }
.step { position: relative; display: grid; justify-items: center; align-content: start; gap: 8px; padding: 0 6px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.step::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 2px; background: var(--fill-2); }
.step:first-child::before { display: none; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-weight: 600; font-size: 12px; color: var(--ink-2); position: relative; }
.step small { display: block; font-size: 10.5px; color: var(--ink-3); opacity: .8; }
.step-done { color: var(--ink); }
.step-done .dot { background: var(--green-fill); color: #fff; }
.step-done::before { background: var(--green-fill); }
.step-running, .step-failed { color: var(--ink); font-weight: 600; }
.step-running .dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.step-failed .dot { background: var(--orange-fill); color: #fff; box-shadow: 0 0 0 5px var(--orange-soft); }
.step-ready { color: var(--ink); font-weight: 600; }
.step-ready .dot { background: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.step-not_built { opacity: .55; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.launch-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 20px 22px; border-bottom: 1px solid var(--hair); }
.launch-head b { display: block; font-size: 16px; letter-spacing: -0.015em; }
.launch-head span { font-size: 14px; color: var(--ink-2); }
.button:disabled { opacity: .55; cursor: default; filter: none; }
.preflight { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 2px 24px; padding: 4px 22px 18px; border-top: 1px solid var(--hair); }
.preflight .check em { display: block; font-style: normal; font-size: 12.5px; color: var(--orange); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1px solid var(--hair); }
.kv div { padding: 14px 22px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); margin: 0 -1px -1px 0; }
.kv dt { font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.kv dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }

details.more-details summary { cursor: pointer; list-style: none; padding: 16px 22px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
details.more-details summary::-webkit-details-marker { display: none; }
details.more-details summary .icon { transition: transform .2s; color: var(--ink-3); }
details.more-details[open] summary .icon { transform: rotate(90deg); }

.empty-state { padding: 60px 20px; text-align: center; color: var(--ink-2); }
.empty-state .icon { margin: 0 auto 12px; color: var(--ink-3); }

/* ---------- Small screens ---------- */

@media (max-width: 1080px) {
  .format-card { grid-template-columns: 1fr; }
  .format-files { border-left: 0; border-top: 1px solid var(--hair); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero .stage { max-width: 380px; margin: 0 auto; width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .summary .metric:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--hair); }
  .sidebar .nav-groups { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .sidebar .nav-group { margin: 0; display: contents; }
  .sidebar .nav-title { display: none; }
  .sidebar .nav-item { flex: none; background: var(--fill); }
  .sidebar .nav-item .count { margin-left: 4px; }
  .brand { padding-bottom: 12px; }
  .main { padding: 24px 16px 60px; }
  .large-title { font-size: 28px; }
  .hero h1 { font-size: 30px; }
  .search { width: 100%; }
  .toolbar { width: 100%; }
  .local-nav { margin: 28px -16px 0; padding: 10px 16px; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .check-group { border-left: 0; border-top: 1px solid var(--hair); }
  .check-group:first-child { border-top: 0; }
  .format-files { grid-template-columns: 1fr 1fr; }
}

.note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 14px 22px; font-size: 14px; color: var(--ink-2); border-top: 1px solid var(--hair); }
.note .icon { margin-top: 2px; color: var(--ink-3); }

/* Templates page */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.template-card { overflow: hidden; }
.template-stage { aspect-ratio: 16 / 10; border-radius: 0; }
.template-stage img { max-width: 88%; max-height: 86%; filter: drop-shadow(0 6px 14px rgba(0,0,0,.14)); }
.template-info { display: grid; gap: 6px; justify-items: start; padding: 16px 18px 18px; }
.template-info b { font-size: 15px; letter-spacing: -0.015em; }
.template-info p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.template-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-top: 1px solid var(--hair); color: var(--ink); }
.template-row:first-child { border-top: 0; }
.template-row:hover { background: var(--fill); text-decoration: none; }
.template-row .icon { color: var(--ink-3); }
.template-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-size: 12px; font-weight: 600; color: var(--ink-2); flex: none; }
.template-text { flex: 1; min-width: 0; display: grid; }
.template-text b { font-size: 14.5px; font-weight: 600; }
.template-text span { font-size: 13px; color: var(--ink-2); }

/* Opening a linked file in Eagle */
.tile-open { display: grid; place-items: center; width: 100%; height: 100%; cursor: pointer; }
.tile-open:hover img { transform: scale(1.03); }
.tile-drop img { transition: transform .2s ease; }
.tile-actions { display: flex; gap: 12px; align-items: baseline; }
.tile-actions a { font-size: 12px; }
.tile-actions .tile-remove { opacity: 0; }
.tile:hover .tile-actions .tile-remove { opacity: 1; }

/* Campaign emails and pages */
.messages { margin-top: 16px; padding: 18px 20px; }
.messages h3 { margin: 0 0 10px; font-size: 15px; }
.messages ol { list-style: none; margin: 0; padding: 0; }
.messages li { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--hair); }
.messages li:first-child { border-top: 0; }
.messages li > a:first-child { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; text-decoration: none; }
.messages li > a:first-child:hover .msg-subject { text-decoration: underline; }
.msg-kind { flex: 0 0 92px; color: var(--secondary, #6b7280); font-size: 13px; }
.msg-subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-en { font-size: 13px; }
@media (max-width: 600px) { .msg-kind { flex-basis: 64px; } }

/* Templates: add and edit */
.tpl-new { margin-bottom: 28px; padding: 16px 18px; }
.tpl-new > summary { list-style: none; width: max-content; }
.tpl-new > summary::-webkit-details-marker { display: none; }
.tpl-new[open] > summary { margin-bottom: 16px; }
.tpl-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px 16px; }
.tpl-form .wide { grid-column: 1 / -1; }
.tpl-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.tpl-form small { font-weight: 400; color: var(--ink-3); }
.tpl-form input, .tpl-form textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--hair-strong);
  border-radius: 9px; padding: 8px 10px; min-width: 0;
}
.tpl-form textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.tpl-form input:focus, .tpl-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.tpl-form fieldset { border: 1px solid var(--hair); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px 16px; }
.tpl-form legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.tpl-actions { display: flex; justify-content: flex-end; }
.template-row { flex-wrap: wrap; }
.template-row .template-text { flex: 1 1 240px; min-width: 0; }
.tpl-edit > summary { cursor: pointer; font-size: 13px; color: var(--accent); list-style: none; }
.tpl-edit > summary::-webkit-details-marker { display: none; }
.template-row .tpl-edit[open] { flex: 1 0 100%; order: 10; padding-top: 12px; }
.tpl-edit[open] > summary { margin-bottom: 12px; }
.tpl-remove { margin-top: 12px; color: var(--orange); }
@media (prefers-color-scheme: dark) { .tpl-form input, .tpl-form textarea { background: var(--surface-2); } }

/* ---------- Sign in (visits through catalogue.cloudberrypress.com) ---------- */

.signin-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, var(--surface-2) 0%, var(--bg) 60%); }
.signin { width: 100%; max-width: 360px; }
.signin-brand { text-align: center; margin-bottom: 28px; }
.signin-brand .brand-mark { width: 64px; height: 64px; border-radius: 15px; margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.signin-brand h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.signin-brand p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.signin-card { display: flex; flex-direction: column; padding: 24px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-2); }
.signin-card label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.signin-card input { font: inherit; color: var(--ink); background: var(--surface-2); height: 44px; padding: 0 14px;
  border: 1px solid var(--hair-strong); border-radius: var(--radius-sm); margin-bottom: 16px; outline: none;
  transition: border-color .15s, box-shadow .15s; }
.signin-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.signin-error { margin: -4px 0 14px; color: #d70015; font-size: 13px; }
.signin-card button { height: 44px; margin-top: 4px; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; transition: filter .15s; }
.signin-card button:hover { filter: brightness(1.08); }
.signin-note { text-align: center; color: var(--ink-3); font-size: 12.5px; margin: 18px 0 0; }
@media (prefers-color-scheme: dark) { .signin-error { color: #ff6961; } }
.nav-signout { padding: 18px 8px 4px; }
.nav-signout button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.nav-signout button:hover { color: var(--ink); }
