/* Trueframe UI. Design tokens first, then layout, then components, then pages.
   New screens should only need the components below; add a token before adding a colour. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  /* Covers Lithuanian (ą č ę ė į š ų ū ž). */
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f7f6f3;
  --bg-subtle: #efede8;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --border: #e7e4dd;
  --border-strong: #d6d1c7;
  --text: #1c1a17;
  --text-2: #5d5850;
  --text-3: #8d877d;

  --accent: #8a5a2b;
  --accent-hover: #74481f;
  --accent-soft: #f4ebe1;
  --accent-text: #ffffff;
  --focus: #c08a52;

  --ok: #217a4b;
  --ok-soft: #e5f3eb;
  --warn: #9a6200;
  --warn-soft: #fbf0d9;
  --bad: #b4342a;
  --bad-soft: #fbe7e4;
  --info: #3a5f9e;
  --info-soft: #e8eef9;

  --checker-a: #ebe8e2;
  --checker-b: #ffffff;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(28 26 23 / 0.05);
  --shadow: 0 1px 2px rgb(28 26 23 / 0.04), 0 4px 16px rgb(28 26 23 / 0.06);
  --shadow-lg: 0 12px 48px rgb(28 26 23 / 0.18);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --sidebar: 248px;
  --content: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #12110f;
    --bg-subtle: #1a1916;
    --surface: #1c1b18;
    --surface-2: #211f1c;
    --border: #2e2b27;
    --border-strong: #3d3934;
    --text: #efebe5;
    --text-2: #b4ada3;
    --text-3: #847d73;
    --accent: #d39a5f;
    --accent-hover: #e2ad74;
    --accent-soft: #2e241a;
    --accent-text: #1a130c;
    --focus: #d39a5f;
    --ok: #5fc48d;
    --ok-soft: #17291f;
    --warn: #e2ac4b;
    --warn-soft: #2d2413;
    --bad: #ef7f72;
    --bad-soft: #321b18;
    --info: #8eb0ec;
    --info-soft: #1b2333;
    --checker-a: #2a2824;
    --checker-b: #34312c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 12px 48px rgb(0 0 0 / 0.5);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 var(--s3); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--bg-subtle); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 20px; height: 20px; }
.icon.xl { width: 28px; height: 28px; stroke-width: 1.5; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s4) var(--s3); background: var(--surface-2); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: var(--text); color: var(--bg);
}
.brand-mark svg { width: 15px; height: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: var(--s3) 10px var(--s1); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.nav a, .nav span.disabled {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); padding: 6px 9px; }
.nav a.on .icon { color: var(--accent); }
.nav span.disabled { color: var(--text-3); cursor: default; }
.nav .tag { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: var(--bg-subtle); color: var(--text-3); }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) 4px 0; border-top: 1px solid var(--border); }
.sidebar-foot form { margin: 0; }
.topbar { display: none; }
.scrim { display: none; }

.content { min-width: 0; }
.page { max-width: var(--content); margin: 0 auto; padding: var(--s8) var(--s8) 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap; }
.page-head .lede { margin: 6px 0 0; color: var(--text-2); max-width: 680px; }
.page-head .head-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-2); }
.crumbs .icon { width: 14px; height: 14px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 50; transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .tabs { gap: var(--s4); }
  .tabs a .icon { display: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / 0.35); z-index: 40; }
  .topbar {
    display: flex; align-items: center; gap: var(--s3); position: sticky; top: 0; z-index: 30;
    padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  }
  .page { padding: var(--s5) 16px 80px; }
  h1 { font-size: 21px; }
}

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.split { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 960px) { .split, .split.wide-left { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: var(--s6); }
@media (max-width: 960px) { .sticky { position: static; } }

/* ---------- Card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.card-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.card-body { padding: var(--s5); }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  font: 500 13.5px/1 var(--font); color: var(--text); white-space: nowrap; cursor: pointer; user-select: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-sm);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--bg-subtle); text-decoration: none; }
.btn:disabled, .btn.is-busy { opacity: 0.55; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-subtle); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.btn-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.linklike:hover { color: var(--text); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field > span:first-child, .field-label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); }
.fields { display: flex; flex-direction: column; gap: var(--s4); }
.fields-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); }
.input, .select, .textarea {
  width: 100%; font: 400 14px/1.4 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 10px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input, .select { height: 36px; }
.select.sm { height: 28px; padding: 0 28px 0 8px; font-size: 12.5px; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238d877d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- Badges, pills, notices ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 550; background: var(--bg-subtle); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.processing, .badge.queued, .badge.running { background: var(--info-soft); color: var(--info); }
.badge.processing::before, .badge.queued::before, .badge.running::before { animation: pulse 1.2s ease-in-out infinite; }
.badge.needs_review { background: var(--warn-soft); color: var(--warn); }
.badge.approved, .badge.succeeded, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.failed, .badge.missing { background: var(--bad-soft); color: var(--bad); }
.badge.rejected { background: var(--bg-subtle); color: var(--text-3); }
@keyframes pulse { 50% { opacity: 0.3; } }

.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); font-size: 13px; border: 1px solid; }
.notice .icon { margin-top: 2px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.notice.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.notice p { margin: 0; }

/* ---------- Tabs and segmented controls ---------- */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--border); margin-bottom: var(--s6); overflow-x: auto; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 2px; margin-bottom: -1px; color: var(--text-2);
  font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--bg-subtle); color: var(--text-2); }
.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--bg-subtle); border-radius: 8px; }
.segmented button, .segmented a {
  border: 0; background: transparent; font: 500 12.5px/1 var(--font); color: var(--text-2); height: 26px; padding: 0 10px;
  border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Menus and dialogs ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg);
}
.menu-list button, .menu-list label {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: none; font: 500 13px/1.2 var(--font); color: var(--text); cursor: pointer; text-align: left;
}
.menu-list button:hover, .menu-list label:hover { background: var(--bg-subtle); }
.menu-list .danger { color: var(--bad); }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

dialog.modal {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgb(20 18 15 / 0.45); backdrop-filter: blur(2px); }
dialog.modal form { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.modal-body { padding: var(--s5); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Empty states, tables, toast ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2);
  padding: 56px var(--s6); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2);
}
.empty .empty-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s2); }
.empty h3 { font-size: 15px; }
.empty p { color: var(--text-2); max-width: 420px; margin: 0 0 var(--s3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th { font-size: 12px; font-weight: 550; color: var(--text-3); background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.error-text { color: var(--bad); font-size: 12.5px; max-width: 420px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.stat { padding: var(--s4); }
.stat .label { font-size: 12px; color: var(--text-3); font-weight: 550; }
.stat .value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 560px); padding: 10px 16px; border-radius: var(--r); font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  transform: translate(-50%, 24px); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.error { background: var(--bad); color: #fff; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Media surfaces ---------- */
.checker {
  background-color: var(--checker-b);
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.bg-white { background: #ffffff; }
.bg-dark { background: #161513; }
.swatches { display: inline-flex; gap: 4px; }
.swatches button { width: 18px; height: 18px; padding: 0; border-radius: 5px; border: 1px solid var(--border-strong); cursor: pointer; }
.swatches button.on { outline: 2px solid var(--focus); outline-offset: 1px; }
.swatches [data-bg=checker] { background: repeating-conic-gradient(#d9d5ce 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.swatches [data-bg=white] { background: #fff; }
.swatches [data-bg=dark] { background: #161513; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s6) 16px; background:
  radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); padding: var(--s8); }
.auth-card .brand { padding: 0; margin-bottom: var(--s6); font-size: 17px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-foot { display: flex; justify-content: center; margin-top: var(--s5); }

/* ---------- Products ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); }
.product-card { display: flex; flex-direction: column; overflow: hidden; color: var(--text); transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.product-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.product-card .cover { aspect-ratio: 4 / 3; display: grid; place-items: center; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.product-card .cover img { width: 100%; height: 100%; object-fit: contain; padding: var(--s4); }
.product-card .cover .icon { color: var(--text-3); }
.product-card .meta { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: 6px; }
.product-card .meta strong { font-weight: 600; font-size: 14.5px; }
.progress { height: 4px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }

/* ---------- Photo review ---------- */
.dropzone {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s5); border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.busy { opacity: 0.6; pointer-events: none; }
.dropzone .drop-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.dropzone .drop-text { flex: 1; min-width: 0; }
.dropzone .drop-text strong { display: block; font-weight: 600; }
.dropzone .drop-opts { display: flex; align-items: center; gap: var(--s2); }
@media (max-width: 640px) { .dropzone { flex-wrap: wrap; } .dropzone .drop-opts { width: 100%; } }

.review-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin: var(--s5) 0 var(--s4); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
@media (max-width: 420px) { .photo-grid { grid-template-columns: 1fr; } }
.photo-card { display: flex; flex-direction: column; overflow: visible; }
.photo-card.status-needs_review { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); box-shadow: 0 0 0 3px var(--warn-soft); }
.photo-card.status-rejected .viewer img { opacity: 0.45; }
.viewer { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; border-bottom: 1px solid var(--border); }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: var(--s4); }
.viewer img.mask { background: #000; }
.viewer .overlay-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 2; }
.viewer .overlay-top .badge { box-shadow: var(--shadow-sm); }
.viewer .overlay-bottom { position: absolute; bottom: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 2; }
.viewer .overlay-bottom .segmented { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); }
.viewer .swatches { padding: 4px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(6px); }
.viewer .center { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: var(--s3); color: var(--text-2); font-size: 13px; }
.photo-body { padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.photo-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); font-size: 12.5px; color: var(--text-3); }
.issues { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.issues li { display: flex; gap: 6px; font-size: 12.5px; color: var(--warn); }
.issues li .icon { width: 14px; height: 14px; margin-top: 2px; }
.photo-actions { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.photo-actions .grow { flex: 1; }
.packshots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.packshots img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); }

/* ---------- Scenes, voiceovers ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.gallery figure { margin: 0; overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery figcaption { padding: var(--s2) var(--s3); font-size: 12.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job-list { display: flex; flex-direction: column; gap: 6px; }
.job-list:empty { display: none; }
.job-row { display: flex; align-items: center; gap: var(--s2); font-size: 12.5px; }
.voice-item { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.voice-item p { margin: 0; }
.voice-item audio { width: 100%; height: 36px; }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s8); align-items: start; }
.settings-nav { position: sticky; top: var(--s6); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 7px 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; }
.settings-nav a:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.settings-nav a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
}
.settings-section { scroll-margin-top: var(--s6); }
.key-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: var(--s4); align-items: start; padding: var(--s4) 0; border-bottom: 1px solid var(--border); }
.key-row:first-child { padding-top: 0; }
.key-row:last-of-type { border-bottom: 0; }
.key-row .who strong { display: block; font-weight: 600; }
.key-row .who span { font-size: 12.5px; color: var(--text-3); }
@media (max-width: 640px) { .key-row { grid-template-columns: 1fr; gap: var(--s2); } }
.prompt-item { border-bottom: 1px solid var(--border); }
.prompt-item:last-child { border-bottom: 0; }
.prompt-item > summary { list-style: none; display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); cursor: pointer; }
.prompt-item > summary::-webkit-details-marker { display: none; }
.prompt-item > summary:hover { background: var(--surface-2); }
.prompt-item > summary .chev { margin-left: auto; transition: transform 0.15s; color: var(--text-3); }
.prompt-item[open] > summary .chev { transform: rotate(90deg); }
.prompt-item .prompt-desc { color: var(--text-3); font-size: 12.5px; }
.prompt-edit { padding: 0 var(--s5) var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.version { border: 1px solid var(--border); border-radius: var(--r); padding: var(--s3); }
.version pre { white-space: pre-wrap; font: 12px/1.5 var(--mono); margin: var(--s2) 0 0; color: var(--text-2); max-height: 220px; overflow: auto; }

/* Card internals that keep footers aligned across a grid row. */
.photo-body { flex: 1; }
.photo-actions .select.sm { max-width: 118px; min-width: 0; text-overflow: ellipsis; }
.photo-actions .btn-group { min-width: 0; }
.product-card .cover { position: relative; overflow: hidden; }
.product-card .cover img { position: absolute; inset: 0; }
.product-card .meta { flex: 1; }
.gallery figcaption { padding: 0; margin: var(--s2) var(--s3) 10px; }
td code { white-space: nowrap; }
.photo-grid > *, .settings-layout > * { min-width: 0; }
@media (max-width: 420px) { .photo-actions { flex-wrap: wrap; } }
.auth-wrap { width: min(400px, 100%); }

/* ---------- Videos ---------- */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.video-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s4); padding: var(--s3); color: var(--text); align-items: center; }
.video-row:hover { border-color: var(--border-strong, var(--accent)); }
.video-thumb { width: 72px; aspect-ratio: 9 / 16; border-radius: var(--r); background: var(--bg-subtle); display: grid; place-items: center; overflow: hidden; color: var(--text-3); }
.video-thumb video { width: 100%; height: 100%; object-fit: cover; }
.engine-list { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.engine-check { align-items: flex-start; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); }
.engine-check input { margin-top: 3px; }
.final-video { display: block; width: 100%; max-height: 72vh; background: #000; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.keyframe-big { display: block; width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.clip-body { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.clip-keyframe img, .clip-keyframe .placeholder { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--r); background: var(--bg-subtle); }
.placeholder { display: grid; place-items: center; align-content: center; gap: 6px; color: var(--text-3); aspect-ratio: 9 / 16; background: var(--bg-subtle); }
.takes { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s3); padding: var(--s4) var(--s5); border-top: 1px solid var(--border); }
.take { margin: 0; display: flex; flex-direction: column; gap: var(--s2); }
.take video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: var(--r); object-fit: contain; }
.take.chosen video { outline: 2px solid var(--ok); outline-offset: 2px; }
.prompt-pre { white-space: pre-wrap; margin: 8px 0 0; }
.badge.planning, .badge.rendering { background: var(--info-soft); color: var(--info); }
.badge.planning::before, .badge.rendering::before { animation: pulse 1.2s ease-in-out infinite; }
.badge.planned { background: var(--warn-soft); color: var(--warn); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 640px) { .clip-body { grid-template-columns: 1fr; } .clip-keyframe { max-width: 200px; } }
