/* Tempo App - styles taken from the "Tempo App - UI" design canvas (Main / Home / Project / Generations).
   Light only, like the canvas. Tokens first; components below reuse them. */
:root {
  --bg: #F5F5F6;
  --surface: #FFFFFF;
  --frame: #FAFAFB;
  --ink: #111113;
  --ink-2: #33343A;
  --muted: #55565D;
  --line: #E3E3E6;
  --line-soft: #EEEEF0;
  --line-strong: #D9D9DE;
  --chip: #F0F0F2;
  --nav-on: #E9E9EC;
  --row-on: #EEEEF1;
  --blue: #3B55C4;
  --violet: #7B5FD0;
  --pink: #D98CB4;
  --red: #D9475A;
  --green: #5F7F45;
  --blue-wash: #F7F8FD;
  --grad: linear-gradient(90deg, #3B55C4, #7B5FD0, #D98CB4, #D9475A, #5F7F45, #3B55C4);
  --grad-oklch: linear-gradient(in oklch 90deg, #3B55C4, #7B5FD0, #D98CB4, #D9475A, #5F7F45, #3B55C4);
  --font: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); }
a:hover { color: var(--blue); }
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- gradient language (canvas: tg-ring / tg-plain / tg-bar / tg-sweep / tg-pill) */
.tg-ring, .tg-plain { padding: 1.5px; border-radius: 13.5px; }
.tg-plain { background: var(--line-strong); }
.tg-ring { background: var(--grad); background: var(--grad-oklch); background-size: 200% 100%; animation: tg-move 4s linear infinite; }
.tg-bar { height: 4px; border-radius: 2px; background: var(--grad); background: var(--grad-oklch); background-size: 200% 100%; animation: tg-move 2.4s linear infinite; }
.tg-sweep { background: linear-gradient(100deg, rgba(255,255,255,0) 30%, rgba(123,95,208,0.10) 42%, rgba(217,140,180,0.14) 50%, rgba(59,85,196,0.10) 58%, rgba(255,255,255,0) 70%); background-size: 250% 100%; background-repeat: no-repeat; animation: tg-sweep 2.2s ease-in-out infinite; }
.tg-pill { display: inline-flex; padding: 1px; border-radius: 5px; background: var(--grad); background: var(--grad-oklch); background-size: 200% 100%; animation: tg-move 3s linear infinite; }
@keyframes tg-move { from { background-position: 0% 0; } to { background-position: -200% 0; } }
@keyframes tg-sweep { from { background-position: 120% 0; } to { background-position: -20% 0; } }
@media (prefers-reduced-motion: reduce) { .tg-ring, .tg-bar, .tg-sweep, .tg-pill { animation: none; } }

/* ---------- shell */
.app { display: flex; height: 100dvh; min-height: 0; }
.side { flex: 0 0 248px; padding: 20px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 24px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.brand span { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.btn-new { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; border: 0; }
.btn-new:hover { color: #fff; background: #26262b; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 8px 8px; display: flex; align-items: center; justify-content: space-between; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 6px; font-size: 14px; text-decoration: none; color: var(--muted); border: 1px solid transparent; }
.nav a span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.strong { color: var(--ink); }
.nav a:hover { background: var(--nav-on); color: var(--ink); }
.nav a.on { color: var(--ink); background: var(--surface); border-color: var(--line); }
.nav a.on-fill { color: var(--ink); background: var(--nav-on); font-weight: 600; }
.nav .empty { padding: 0 8px; font-size: 13px; color: var(--muted); }
.swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ink); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-credits { font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; text-align: left; }
.me-credits:hover { color: var(--blue); }
.icon-btn { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:hover { background: var(--nav-on); color: var(--ink); }
.me .icon-btn { margin-left: auto; }

.topbar { display: none; }
.view { flex: 1 1 auto; min-width: 0; display: flex; min-height: 0; }

/* ---------- shared controls */
.btn { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #26262b; color: #fff; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; border-color: var(--line); border-radius: 6px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.link { border: 0; background: transparent; min-height: 40px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.btn.block { width: 100%; }
.btn.tall { min-height: 48px; font-size: 15px; }

.seg { display: flex; gap: 2px; padding: 3px; background: var(--chip); border-radius: 8px; flex-wrap: wrap; }
.seg.dark { background: var(--nav-on); }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.seg.lg button { min-height: 32px; padding: 0 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 600; }
.seg button .count { margin-left: 6px; opacity: 0.7; font-weight: 500; }

.chip { height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 600; }
.chip.ink { color: var(--ink); }
.chip .sq { width: 8px; height: 8px; border-radius: 2px; background: var(--ink); flex: none; }
.chip-select { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink); }
.chip-select select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-size: 13px; font-weight: 500; padding: 0 18px 0 0; outline: none; cursor: pointer; }
.chip-select svg.chev { position: absolute; right: 10px; pointer-events: none; }
.chip-select:focus-within { border-color: var(--ink); }
.sq-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sq-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.sq-btn.send { border: 0; background: var(--ink); color: #fff; }
.sq-btn.send:hover { background: #26262b; color: #fff; }

.field { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; outline: none; }
.field:focus { border-color: var(--ink); }
textarea.field { padding: 10px 12px; line-height: 1.5; resize: vertical; min-height: 84px; }
select.field { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%2355565D' stroke-width='1.6' 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 12px center; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }

.pill { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--muted); white-space: nowrap; }
.pill.done { background: #EEF3E8; color: #4C6A35; }
.pill.failed { background: #FBECEE; color: #A8323F; }
.pill.queued { background: #F0ECFB; color: #5B3FB8; }
.pill.arch { background: var(--chip); color: var(--muted); }
.tg-pill .pill { padding: 1px 7px; background: #fff; color: #2F48B3; }

.composer-box { background: var(--surface); border-radius: 12px; padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.composer-box textarea { border: 0; outline: none; resize: none; font-size: 15px; line-height: 1.5; background: transparent; width: 100%; max-height: 240px; }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; }
.attach { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 4px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--muted); background: var(--surface); }
.attach img { width: 24px; height: 24px; object-fit: cover; border-radius: 4px; }
.attach button { border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; }
.attach button:hover { background: var(--chip); color: var(--ink); }

/* ---------- sign in */
.signin { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 16px; overflow-y: auto; }
.signin-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.signin-card h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.signin-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--muted); }
.signin-form { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.form-error { margin: 0; font-size: 13px; color: #A8323F; min-height: 0; }
.form-note { font-size: 13px; color: var(--muted); }

/* ---------- home (new video) */
.home { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 48px 32px; overflow-y: auto; }
.home-inner { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 28px; }
.home h1 { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; text-align: center; }
.home .composer-box { padding: 16px 16px 12px; gap: 14px; }
.home .composer-box textarea { font-size: 16px; }
.home .seg { margin-left: auto; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.starters button { min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; }
.starters button:hover { border-color: var(--ink); }

/* ---------- working view */
.work { flex: 1; min-width: 0; display: flex; min-height: 0; }
.chat { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 32px; border-bottom: 1px solid var(--line); min-height: 61px; }
.chat-head h1 { margin: 0; font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn { border: 0; background: transparent; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; font: inherit; text-align: left; min-width: 0; max-width: 100%; }
.title-btn:hover { background: var(--nav-on); }
.title-input { font-size: 16px; font-weight: 600; min-height: 32px; padding: 0 8px; max-width: 360px; }
.head-chip { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; }
.head-chip .sq { width: 8px; height: 8px; border-radius: 2px; background: var(--blue); }
.msgs { flex: 1; overflow-y: auto; min-height: 0; }
.msgs-inner { display: flex; flex-direction: column; gap: 28px; padding: 32px; max-width: 760px; width: 100%; margin: 0 auto; }
.msg-user { align-self: flex-end; max-width: 84%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-ai { display: flex; gap: 14px; }
.msg-ai > svg { flex: none; margin-top: 2px; }
.msg-ai-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; flex: 1; }
.md { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.md p { margin: 0 0 12px; }
.md p:last-child, .md ol:last-child, .md ul:last-child { margin-bottom: 0; }
.md ol, .md ul { margin: 0 0 12px; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.md li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: baseline; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; line-height: 1.45; }
.md li:last-child { border-bottom: 0; }
.md li .n { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.md strong { font-weight: 600; }
.md code { font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.caret::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--ink); border-radius: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.tool-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gen-status { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.gen-status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.gen-status .track { height: 4px; max-width: 320px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.gen-status .fill { height: 4px; background: var(--ink); border-radius: 2px; transition: width 0.4s ease; }
.msg-gens { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-gen { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; max-width: 100%; text-align: left; }
.msg-gen:hover { border-color: var(--ink); }
.msg-gen .mini { width: 48px; height: 32px; border-radius: 4px; background: var(--chip); overflow: hidden; flex: none; position: relative; }
.msg-gen .mini img, .msg-gen .mini video { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-error { padding: 12px 14px; border-radius: 10px; background: #FBECEE; color: #7E2430; font-size: 14px; line-height: 1.5; }
.chat-empty { margin: auto 0; text-align: center; color: var(--muted); font-size: 15px; padding: 48px 0; }
.composer-wrap { padding: 0 32px 28px; max-width: 760px; width: 100%; margin: 0 auto; }
.composer-wrap .tg-ring, .composer-wrap .tg-plain { border-radius: 13px; }
.composer-wrap .composer-box { border-radius: 11.5px; }
.composer-hint { font-size: 12px; color: var(--muted); margin-top: 8px; text-align: center; }

.preview { flex: 1 1 520px; min-width: 0; max-width: 640px; background: var(--surface); border-left: 1px solid var(--line); padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pv-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.stage { background: var(--bg); border-radius: 10px; padding: 16px; display: flex; justify-content: center; }
.frame { position: relative; background: var(--frame); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; }
.frame.r916 { width: auto; height: 340px; aspect-ratio: 9 / 16; }
.frame.r11 { width: auto; height: 300px; aspect-ratio: 1 / 1; }
.frame video, .frame img.media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.frame img.media { background: var(--frame); }
.frame .sweep { position: absolute; inset: 0; }
.frame-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8%; text-align: center; font-size: 14px; color: var(--muted); line-height: 1.5; }
.frame-msg strong { color: var(--ink); font-weight: 600; font-size: 15px; }
.frame-msg .track { width: 60%; max-width: 240px; height: 4px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.player { display: flex; align-items: center; gap: 12px; }
.player .sq-btn svg path { fill: var(--ink); }
.scrub { flex: 1; position: relative; height: 20px; cursor: pointer; display: flex; align-items: center; }
.scrub .rail { position: absolute; left: 0; right: 0; height: 4px; background: var(--line); border-radius: 2px; }
.scrub .done { position: absolute; left: 0; height: 4px; background: var(--ink); border-radius: 2px; }
.scrub .knob { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 6px; background: var(--ink); transform: translate(-50%, -50%); }
.player .time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }
.sel-info { display: flex; flex-direction: column; gap: 10px; }
.sel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sel-top h3 { margin: 0; font-size: 14px; font-weight: 600; }
.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sel-prompt { margin: 0; padding: 12px 14px; background: var(--bg); border-radius: 8px; font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.star[aria-pressed="true"] svg { fill: var(--ink); }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.sec-h span { font-size: 13px; color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.strip-item { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--chip); aspect-ratio: 4 / 3; overflow: hidden; }
.strip-item[aria-pressed="true"] { border: 2px solid var(--ink); }
.strip-item img, .strip-item video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.strip-item .badge { position: absolute; left: 6px; bottom: 6px; }
.strip-item .fav { position: absolute; right: 5px; top: 5px; width: 18px; height: 18px; border-radius: 4px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.strip-item .state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--muted); }
.vid-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 5px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 600; }
.gen-form { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.gen-form .row { display: flex; gap: 8px; }
.gen-form .row > * { flex: 1; min-width: 0; }
.gen-form .estimate { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.empty-note { font-size: 13px; color: var(--muted); padding: 4px 0; }
.mobile-tabs { display: none; }

/* ---------- hub + admin (shared page frame) */
.page { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-wrap: wrap; align-items: stretch; }
.page-main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.page-head .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); }
.badge-dark { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 0 1 280px; min-width: 180px; }
.search input { padding-left: 36px; min-height: 40px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { display: flex; flex-direction: column; padding: 10px; border-radius: 10px; background: var(--surface); font: inherit; color: var(--ink); text-align: left; border: 1px solid var(--line); min-width: 0; }
.card[aria-pressed="true"] { border: 2px solid var(--ink); margin: -1px; }
.card:hover { border-color: var(--line-strong); }
.card[aria-pressed="true"]:hover { border-color: var(--ink); }
.thumb { display: block; position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9; background: var(--frame); border: 1px solid var(--line-soft); border-radius: 6px; }
.thumb.r43 { aspect-ratio: 4 / 3; }
.thumb.big { border-radius: 8px; aspect-ratio: 16 / 10; }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.thumb .ph i { display: block; width: 46%; height: 34%; border-radius: 4px; background: var(--line); }
.thumb .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 22px; background: var(--ink); display: flex; align-items: center; justify-content: center; border: 0; }
.thumb .vid-badge { position: absolute; left: 8px; bottom: 8px; }
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px 2px 2px; min-width: 0; }
.card-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card-prompt { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.panel h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-kind { font-size: 12px; font-weight: 600; color: var(--muted); }
.dl { margin: 0; display: grid; grid-template-columns: 96px 1fr; row-gap: 10px; column-gap: 12px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.empty-card { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 32px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty-card strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.list-rows { display: flex; flex-direction: column; }
.list-rows a, .list-rows .r { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; text-decoration: none; color: var(--ink); }
.list-rows span.when { font-size: 12px; color: var(--muted); flex: none; }

.detail { flex: 1 1 380px; max-width: 460px; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.prov { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--chip); font-size: 13px; font-weight: 600; }
.admin-filter { min-height: 36px; font-size: 13px; max-width: 240px; }

/* ---------- modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(17,17,19,0.32); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.modal h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
.modal p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.buy-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.buy-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.buy-row:last-child { border-bottom: 0; }
.buy-row .sub { font-size: 12px; color: var(--muted); }
.buy-h { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: -10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: none; }
.boot { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* ---------- responsive */
@media (max-width: 1180px) {
  .work { flex-direction: column; }
  .mobile-tabs { display: flex; padding: 10px 16px 0; }
  .mobile-tabs .seg { width: 100%; }
  .mobile-tabs .seg button { flex: 1; }
  .work[data-pane="chat"] .preview { display: none; }
  .work[data-pane="preview"] .chat { display: none; }
  .preview { max-width: none; border-left: 0; flex: 1 1 auto; }
  .work[data-pane="preview"] { overflow-y: auto; }
  .chat-head .head-chip { display: none; }
}
@media (max-width: 900px) {
  .detail { max-width: none; border-left: 0; border-top: 1px solid var(--line); }
  .col-side { position: static; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { display: none; position: fixed; inset: 0; z-index: 40; background: var(--bg); border-right: 0; padding: 16px; }
  .app.nav-open .side { display: flex; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
  .topbar .brand { padding: 0; }
  .topbar .brand span { font-size: 18px; }
  .topbar .right { display: flex; gap: 8px; align-items: center; }
  .side .close-nav { display: inline-flex; }
  .view { min-height: 0; flex: 1; }
  .chat-head { padding: 12px 16px; min-height: 0; }
  .msgs-inner { padding: 20px 16px; gap: 22px; }
  .msg-user { max-width: 92%; }
  .composer-wrap { padding: 0 16px 16px; }
  .composer-hint { display: none; }
  .preview { padding: 16px; }
  .home { padding: 32px 16px; align-items: flex-start; }
  .home h1 { font-size: 30px; }
  .home .seg { margin-left: 0; }
  .page-main { padding: 20px 16px 32px; }
  .page-head h1 { font-size: 26px; }
  .search { flex: 1 1 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .detail { padding: 16px; }
  .stage { padding: 10px; }
  .frame.r916 { height: 300px; }
  .frame.r11 { height: 260px; }
}
.side .close-nav { display: none; }
