/* Matsorik Studio v8 — the Matsorik app's look on the desktop:
   warm paper with a dot grid, one calm ink blue, Manrope, the sticker kit
   (ink outline + ink ledge) for main actions and lesson-like cards, soft
   tonal chrome everywhere else. Green and red only say right and wrong. */

@font-face { font-family: Manrope; src: url('/assets/fonts/matsorik_display.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: Manrope; src: url('/assets/fonts/matsorik_display_bold.ttf') format('truetype'); font-weight: 700 900; font-display: swap; }

:root {
  --paper: #f8f5ef;
  --paper-low: #f3efe7;
  --paper-mid: #eee9e0;
  --paper-high: #e8e2d7;
  --raised: #fffdfa;
  --ink: #231e1a;
  --text: #2b2722;
  --muted: #6f675c;
  --line: #dfd8cc;
  --line-strong: #c9bfb0;
  --blue: #2b5ca8;
  --blue-soft: #dde7f8;
  --blue-deep: #0f2d57;
  --sky: #8ccbff;
  --sky-tint: #e6f2ff;
  --navy: #16243f;
  --green: #2e9a5e;
  --green-tint: #d0f1df;
  --green-ink: #1e6b44;
  --red: #d9503a;
  --red-tint: #ffded5;
  --red-ink: #8f2a1b;
  --amber: #c98a1c;
  --amber-tint: #fdeccc;
  --radius-card: 26px;
  --radius-tile: 20px;
  --shadow: 0 10px 28px rgba(35, 30, 26, .10), 0 2px 6px rgba(35, 30, 26, .06);
  --shadow-soft: 0 4px 14px rgba(35, 30, 26, .08);
  font-family: Manrope, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 11px 11px, rgba(35, 30, 26, .055) 1.1px, transparent 1.3px),
    linear-gradient(180deg, rgba(221, 231, 248, .7) 0, rgba(221, 231, 248, 0) 32vh);
  background-size: 22px 22px, 100% 100%;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
svg.lucide { width: 18px; height: 18px; flex: none; }

/* ---------- boot / auth ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-mark, .auth-mark, .brand-mark {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 24px;
  border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.boot-mark { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); } }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.auth-card {
  width: min(560px, 100%); padding: 40px 40px 0; border-radius: 32px; background: var(--raised);
  border: 1.5px solid var(--ink); box-shadow: 0 6px 0 var(--ink); display: grid; gap: 16px; overflow: hidden;
}
.auth-card h1 { margin: 0; font-size: 34px; line-height: 1.12; letter-spacing: -.02em; font-weight: 800; }
.auth-card p { margin: 0; font-size: 17px; line-height: 1.55; }
.auth-art { width: 100%; height: auto; margin-top: 8px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--blue); }
.form-error { color: var(--red-ink); font-weight: 600; }
.invite-form { display: flex; gap: 10px; }
.invite-form input { flex: 1; }

/* ---------- sticker buttons ---------- */
.button {
  --body: var(--raised); --fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--ink);
  background: var(--body); color: var(--fg); font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s ease, box-shadow .08s ease, background .2s;
  white-space: nowrap; user-select: none;
}
.button:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.button:disabled { --body: #ece7df; --fg: #a39a90; border-color: #d3cbc0; box-shadow: 0 4px 0 #d3cbc0; cursor: default; }
.button-primary { --body: var(--blue); --fg: #fff; }
.button-good { --body: var(--green); --fg: #fff; }
.button-danger { --body: var(--red); --fg: #fff; }
.button-quiet { border-color: transparent; box-shadow: none; --body: transparent; color: var(--muted); }
.button-quiet:hover { --body: var(--paper-mid); color: var(--text); }
.button-quiet:active:not(:disabled) { transform: none; }
.button-soft { border: none; box-shadow: none; --body: var(--blue-soft); --fg: var(--blue-deep); }
.button-soft:active:not(:disabled) { transform: scale(.98); }
.button-large { min-height: 56px; font-size: 17px; padding: 0 12px 0 24px; justify-content: space-between; }
.button-large svg { width: 36px; height: 36px; padding: 9px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.button kbd, .kbd { font: 700 11px/1 Manrope, sans-serif; padding: 3px 6px; border-radius: 6px; background: rgba(255, 255, 255, .22); }
.button-quiet kbd, .button-soft kbd { background: var(--paper-mid); }
.icon-button {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--paper-mid); color: var(--text);
}
.icon-button:hover { background: var(--paper-high); }
.icon-button.is-on { background: var(--blue); color: #fff; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding: 12px 24px; backdrop-filter: blur(10px); background: rgba(248, 245, 239, .78);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; box-shadow: 0 3px 0 var(--ink); }
.pill-nav { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--raised); box-shadow: var(--shadow); }
.pill-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.pill-tab:hover { color: var(--text); background: var(--paper-low); }
.pill-tab.is-active { background: var(--blue); color: #fff; }
.topbar-side { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.workspace-name, .workspace-select { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--raised); box-shadow: var(--shadow-soft); font-weight: 700; font-size: 14px; }
.workspace-select select { border: none; background: transparent; font-weight: 700; cursor: pointer; outline: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: none; background: var(--raised); box-shadow: var(--shadow-soft); cursor: pointer; color: var(--muted); font-weight: 700; }
.user-chip small { font-size: 12px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-deep); font-weight: 800; flex: none; }
.avatar.is-pending { background: var(--paper-mid); color: var(--muted); }
.crumbs { display: flex; align-items: center; gap: 6px; padding: 2px 32px 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.crumbs strong { color: var(--text); }
.crumbs a:hover { color: var(--blue); }
.content { flex: 1; width: 100%; max-width: 1720px; margin: 0 auto; padding: 12px 32px 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 0 22px; }
.page-head h1, .book-head h1 { margin: 4px 0 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.section-title { margin: 28px 0 12px; font-size: 18px; font-weight: 800; }

/* ---------- books ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.book-card {
  display: flex; gap: 16px; padding: 14px; border-radius: var(--radius-card); background: var(--raised);
  box-shadow: var(--shadow-soft); transition: transform .15s ease, box-shadow .15s ease; align-items: center;
}
.book-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.book-cover { width: 86px; height: 108px; flex: none; }
.book-card-copy { display: grid; gap: 6px; min-width: 0; flex: 1; }
.book-card-copy strong { font-size: 17px; line-height: 1.3; font-weight: 800; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book-facts { font-size: 13px; color: var(--muted); font-weight: 600; }
.state-line { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.is-done { background: var(--green); }
.dot.is-review { background: var(--amber); }
.dot.is-busy { background: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
.dot.is-error { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.progress { position: relative; display: block; height: 12px; border-radius: 999px; background: var(--paper-high); border: 1.5px solid var(--ink); padding: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--blue); transition: width .4s ease; position: relative; }
.progress span::after { content: ""; position: absolute; left: 6px; right: 6px; top: 2px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .35); }
.is-done .progress span { background: var(--green); }
.skeleton-card { height: 136px; border-radius: var(--radius-card); background: linear-gradient(90deg, var(--paper-low), var(--raised), var(--paper-low)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { color: var(--text); font-size: 18px; }
.empty svg { width: 42px; height: 42px; color: var(--blue); }
.empty-large { grid-column: 1 / -1; padding: 80px 24px; background: var(--raised); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); }

/* ---------- book workspace ---------- */
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 14px 0 16px; flex-wrap: wrap; }
.book-head-copy { display: grid; gap: 4px; min-width: 0; }
.book-head h1 { font-size: 28px; }
.book-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { display: grid; justify-items: center; min-width: 76px; padding: 8px 12px; border-radius: 18px; background: var(--raised); box-shadow: var(--shadow-soft); }
.stat strong { font-size: 20px; font-weight: 800; line-height: 1.1; }
.stat small { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.stat.is-done strong { color: var(--green-ink); }
.stat.is-review strong { color: var(--amber); }
.stat.is-error { background: var(--red-tint); }
.stat.is-error strong { color: var(--red-ink); }
.tabs { display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 16px; border-radius: 999px; background: var(--raised); box-shadow: var(--shadow-soft); }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px; font-weight: 700; color: var(--muted); font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--navy); color: #fff; }
.loading-line { height: 4px; border-radius: 4px; background: var(--paper-high); overflow: hidden; }
.loading-line span { display: block; width: 30%; height: 100%; background: var(--blue); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.ingest-progress { display: flex; align-items: center; gap: 22px; padding: 32px; border-radius: var(--radius-card); background: var(--raised); box-shadow: var(--shadow-soft); max-width: 640px; }
.ingest-progress strong { display: block; font-size: 20px; margin-bottom: 4px; }
.ingest-ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--blue) calc(var(--p) * 1%), var(--paper-high) 0); }
.ingest-ring span { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--raised); font-weight: 800; font-size: 18px; }

/* ---------- page review ---------- */
.review { display: grid; grid-template-columns: 148px minmax(0, 1fr) 380px; gap: 16px; height: calc(100dvh - 300px); min-height: 560px; }
.page-rail { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.rail-filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 14px; background: var(--raised); box-shadow: var(--shadow-soft); }
.rail-filter button { border: none; background: transparent; border-radius: 11px; padding: 6px 0; font-weight: 800; font-size: 12px; cursor: pointer; color: var(--muted); display: grid; justify-items: center; gap: 1px; }
.rail-filter button small { font-size: 10px; font-weight: 700; }
.rail-filter button.is-active { background: var(--blue); color: #fff; }
.thumbs { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 10px; padding: 2px 6px 24px 2px; scroll-behavior: smooth; }
.thumb { position: relative; display: block; border-radius: 14px; padding: 5px; background: var(--raised); box-shadow: var(--shadow-soft); cursor: pointer; border: 2px solid transparent; }
.thumb img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 9px; background: var(--paper-low); }
.thumb.is-active { border-color: var(--blue); }
.thumb-number { position: absolute; left: 9px; bottom: 9px; padding: 2px 7px; border-radius: 999px; background: rgba(35, 30, 26, .78); color: #fff; font-size: 11px; font-weight: 800; }
.thumb-badge { position: absolute; right: 7px; top: 7px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; border: 1.5px solid var(--ink); font-size: 11px; font-weight: 800; }
.thumb-badge.is-ok { background: var(--green); color: #fff; }
.thumb-badge.is-open { background: var(--amber-tint); color: var(--ink); }
.thumb-badge.is-bad { background: var(--red); color: #fff; }
.thumb.is-empty img { opacity: .55; }

.page-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: var(--radius-card); background: var(--raised); border: 1.5px solid var(--ink); overflow: hidden; }
.stage-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stage-title { display: grid; gap: 1px; margin-right: auto; min-width: 0; }
.stage-title strong { font-size: 16px; font-weight: 800; }
.stage-title span { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-toggle { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--paper-low); }
.layer-toggle button { border: none; background: transparent; border-radius: 999px; padding: 6px 10px; display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 12px; color: var(--muted); cursor: pointer; }
.layer-toggle button.is-on { background: var(--raised); color: var(--text); box-shadow: var(--shadow-soft); }
.page-viewport { position: relative; flex: 1; overflow: auto; background: var(--paper-mid); display: grid; place-items: start center; padding: 16px; cursor: default; }
.page-viewport.is-drawing { cursor: crosshair; }
.page-frame { position: relative; box-shadow: 0 6px 24px rgba(35, 30, 26, .18); background: #fff; transform-origin: top center; }
.page-frame img { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.page-frame svg.overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.q-box { fill: rgba(127, 217, 194, .14); stroke: var(--green); stroke-width: 3; rx: 10; cursor: pointer; transition: fill .15s; vector-effect: non-scaling-stroke; }
.q-box.is-review { fill: rgba(253, 236, 204, .45); stroke: var(--amber); }
.q-box.is-bad { fill: rgba(255, 222, 213, .45); stroke: var(--red); }
.q-box.is-excluded { fill: rgba(35, 30, 26, .06); stroke: var(--line-strong); stroke-dasharray: 8 6; }
.q-box.is-selected { fill: rgba(140, 203, 255, .22); stroke: var(--blue); stroke-width: 4; }
.q-box:hover { fill: rgba(140, 203, 255, .18); }
.q-tag circle { fill: #fff; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.q-tag text { font: 800 22px Manrope, sans-serif; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.q-tag.is-ok circle { fill: var(--green-tint); }
.q-tag.is-review circle { fill: var(--amber-tint); }
.q-tag.is-bad circle { fill: var(--red-tint); }
.q-tag.is-selected circle { fill: var(--blue); }
.q-tag.is-selected text { fill: #fff; }
.uncovered-box { fill: rgba(43, 92, 168, .05); stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 6; vector-effect: non-scaling-stroke; pointer-events: none; }
.orphan-box { fill: rgba(217, 80, 58, .07); stroke: var(--red); stroke-width: 2.5; stroke-dasharray: 10 6; vector-effect: non-scaling-stroke; cursor: pointer; }
.missing-flag rect { fill: var(--red); stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.missing-flag text { font: 800 20px Manrope, sans-serif; fill: #fff; dominant-baseline: central; }
.draft-box { fill: rgba(43, 92, 168, .12); stroke: var(--blue); stroke-width: 3; stroke-dasharray: 8 5; vector-effect: non-scaling-stroke; }
.handle { fill: #fff; stroke: var(--blue); stroke-width: 3; vector-effect: non-scaling-stroke; cursor: grab; }
.stage-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.stage-foot .hint { margin-right: auto; font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 10px; flex-wrap: wrap; }
.stage-foot .hint kbd { background: var(--paper-mid); font: 700 11px Manrope; padding: 2px 6px; border-radius: 6px; color: var(--text); }
.page-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.inspector { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 4px; }
.card { border-radius: var(--radius-card); background: var(--raised); box-shadow: var(--shadow-soft); padding: 16px; }
.card-ink { border: 1.5px solid var(--ink); box-shadow: none; }
.q-head { display: flex; align-items: center; gap: 12px; }
.q-number { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--ink); background: var(--blue-soft); font-size: 22px; font-weight: 800; flex: none; }
.q-number.is-ok { background: var(--green-tint); }
.q-number.is-review { background: var(--amber-tint); }
.q-number.is-bad { background: var(--red-tint); }
.q-meta { display: grid; gap: 2px; min-width: 0; }
.q-meta strong { font-size: 17px; font-weight: 800; }
.q-meta span { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crop-preview { margin-top: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; min-height: 160px; max-height: 46vh; cursor: zoom-in; }
.crop-preview img { width: 100%; height: auto; max-height: 46vh; object-fit: contain; }
.crop-size { margin-top: 6px; font-size: 11px; color: var(--muted); font-weight: 700; text-align: right; }
.issue-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.issue-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; font-weight: 600; }
.issue-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--amber); }
.issue-list li.is-ok::before { background: var(--green); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .button { width: 100%; }
.actions .span-2 { grid-column: span 2; }
.tool-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-row .button-soft { min-height: 36px; font-size: 13px; padding: 0 12px; }
.number-field { display: flex; align-items: center; gap: 8px; }
.number-field input { width: 90px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--paper-mid); font-size: 12px; font-weight: 800; white-space: nowrap; }
.chip.is-ok { background: var(--green-tint); color: var(--green-ink); }
.chip.is-review { background: var(--amber-tint); color: #6d4a0c; }
.chip.is-bad { background: var(--red-tint); color: var(--red-ink); }
.chip.is-blue { background: var(--blue-soft); color: var(--blue-deep); }
.chip.is-muted { background: var(--paper-low); color: var(--muted); }
.sticker-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--blue-soft); font-weight: 800; font-size: 13px; }
.sticker-chip b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); font-size: 12px; }
.sticker-chip.is-bad { background: var(--red-tint); }
.sticker-chip.is-ok { background: var(--green-tint); }
.page-done { display: grid; justify-items: center; gap: 10px; padding: 26px 16px; text-align: center; }
.verdict { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--ink); background: var(--green); color: #fff; font-size: 26px; font-weight: 800; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
.verdict.is-open { background: var(--amber); }
@keyframes pop { from { transform: scale(.2) rotate(-40deg); } }
.page-summary { display: grid; gap: 8px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--paper-low); font-weight: 700; font-size: 14px; cursor: pointer; border: none; text-align: left; width: 100%; }
.summary-row:hover { background: var(--blue-soft); }
.summary-row span:first-child { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- tests ---------- */
.section-block { margin-bottom: 18px; border-radius: var(--radius-card); background: var(--raised); box-shadow: var(--shadow-soft); overflow: hidden; }
.section-block > header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.section-block > header strong { font-size: 18px; font-weight: 800; }
.section-block > header .chip { margin-left: auto; }
.test-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.test-label { font-weight: 800; font-size: 15px; display: grid; gap: 2px; }
.test-label small { color: var(--muted); font-weight: 700; font-size: 12px; }
.q-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.q-chip { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--ink); font-weight: 800; font-size: 13px; background: var(--green-tint); cursor: pointer; }
.q-chip.is-review { background: var(--amber-tint); }
.q-chip.is-bad { background: var(--red-tint); }
.q-chip.is-missing { background: transparent; border-style: dashed; border-color: var(--red); color: var(--red-ink); cursor: default; }
.q-chip.is-video { box-shadow: inset 0 -4px 0 var(--blue); }
.q-chip.is-excluded { background: var(--paper-low); color: var(--muted); border-color: var(--line-strong); }

/* ---------- videos / delivery ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.video-card { border-radius: var(--radius-tile); background: var(--raised); box-shadow: var(--shadow-soft); overflow: hidden; display: grid; cursor: pointer; }
.video-card .thumbwrap { aspect-ratio: 16 / 9; background: var(--paper-mid); display: grid; place-items: center; overflow: hidden; }
.video-card .thumbwrap img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.video-card .copy { padding: 12px 14px; display: grid; gap: 4px; }
.video-card strong { font-size: 15px; font-weight: 800; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.delivery-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.delivery-hero .card strong { display: block; font-size: 30px; font-weight: 800; }
.delivery-hero .card span { color: var(--muted); font-weight: 700; font-size: 13px; }
video { width: 100%; border-radius: 16px; background: #000; }

/* ---------- forms / dialogs / toast ---------- */
input, select, textarea { border: 1.5px solid var(--line); border-radius: 14px; background: #fff; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(43, 92, 168, .14); }
.field { display: grid; gap: 6px; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drop-zone { display: grid; justify-items: center; gap: 6px; padding: 28px; border: 2px dashed var(--line-strong); border-radius: 20px; background: var(--paper-low); text-align: center; cursor: pointer; }
.drop-zone input { max-width: 100%; }
.drop-zone svg { width: 34px; height: 34px; color: var(--blue); }
.drop-zone span { color: var(--muted); font-size: 13px; }
dialog.sheet { border: 1.5px solid var(--ink); border-radius: 28px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--raised); box-shadow: 0 6px 0 var(--ink), 0 30px 60px rgba(35, 30, 26, .25); color: var(--text); }
dialog.sheet-wide { width: min(980px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(22, 36, 63, .35); backdrop-filter: blur(2px); }
.sheet-body > header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.sheet-body h2 { margin: 0; font-size: 21px; font-weight: 800; }
.sheet-content { padding: 6px 20px 8px; }
.sheet-content p { line-height: 1.5; }
.sheet-body footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 20px; }
.invite-code { font-size: 30px; font-weight: 800; letter-spacing: .08em; padding: 14px; text-align: center; border-radius: 16px; background: var(--blue-soft); user-select: all; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  padding: 12px 20px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 700; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; max-width: min(720px, calc(100vw - 32px)); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { background: var(--red-ink); }
.upload-progress { position: fixed; right: 24px; bottom: 24px; z-index: 90; width: 340px; display: grid; gap: 8px; padding: 16px; border-radius: 20px; background: var(--raised); box-shadow: var(--shadow); }
.card-list { display: grid; gap: 8px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--raised); box-shadow: var(--shadow-soft); }
.member-row strong { display: block; font-weight: 800; }
.member-row small { color: var(--muted); font-weight: 600; }
.member-row.is-muted { opacity: .6; }
.writing-dots { display: inline-flex; gap: 4px; }
.writing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: dots 1s infinite ease-in-out; }
.writing-dots i:nth-child(2) { animation-delay: .15s; }
.writing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { transform: translateY(-4px); opacity: .4; } }
.zoom-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(22, 36, 63, .55); display: grid; place-items: center; padding: 32px; cursor: zoom-out; }
.zoom-overlay img { max-width: min(1200px, 100%); max-height: 100%; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }

@media (max-width: 1280px) {
  .review { grid-template-columns: 120px minmax(0, 1fr) 320px; }
}
@media (max-width: 980px) {
  .review { grid-template-columns: 1fr; height: auto; }
  .page-rail { flex-direction: row; overflow-x: auto; }
  .thumbs { grid-auto-flow: column; grid-auto-columns: 96px; }
  .topbar { grid-template-columns: auto 1fr; }
  .pill-nav { order: 3; grid-column: 1 / -1; justify-self: center; }
  .content { padding: 12px 16px 40px; }
}
