/* UH Tech Video Studio — design system */
:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f1f1f4;
  --border: #e6e6eb;
  --border-strong: #d7d7df;
  --text: #121218;
  --text-2: #45455a;
  --muted: #7b7b8c;
  --faint: #a7a7b5;

  --accent: #6c3ce6;
  --accent-hover: #5a2ed0;
  --accent-soft: #f2edfe;
  --accent-text: #5527c8;

  --green: #11805a;  --green-soft: #e6f5ee;
  --amber: #9a5a06;  --amber-soft: #fdf3e1;
  --red: #c0360c;    --red-soft: #fdece6;
  --blue: #1d5bd0;   --blue-soft: #e8effd;
  --gray: #5e5e6f;   --gray-soft: #eeeef2;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(18, 18, 24, .05);
  --shadow: 0 1px 3px rgba(18, 18, 24, .07), 0 1px 2px rgba(18, 18, 24, .04);
  --shadow-lg: 0 14px 34px rgba(18, 18, 24, .13), 0 2px 6px rgba(18, 18, 24, .06);
  --ring: 0 0 0 3px rgba(108, 60, 230, .22);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); }
h1, h2, h3, h4 { margin: 0; }
button { font-family: inherit; }
.icon { flex: none; display: block; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.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; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 14px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px; letter-spacing: -.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(85,39,200,.35);
}
.brand-name { font-weight: 650; font-size: 14px; line-height: 1.15; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 12px; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 0 10px; margin: 6px 0 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a .icon { color: var(--muted); }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm); }
.nav a.active .icon { color: var(--accent); }
.nav-count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.nav-count.hot { background: var(--accent-soft); color: var(--accent-text); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
  background: var(--accent-soft); color: var(--accent-text);
}
.me-name { font-weight: 550; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { font-size: 12px; color: var(--muted); line-height: 1.2; }
.me .input { height: 30px; padding: 4px 8px; font-size: 13px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; font-size: 12px; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

.main { min-width: 0; }
.topbar-mobile { display: none; }
.scrim { display: none; }

.page { max-width: 1200px; margin: 0 auto; padding: 28px 32px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .icon { color: var(--faint); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 500 13.5px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: #c8c8d2; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(85,39,200,.3), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #0d6f4d; border-color: #0d6f4d; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #f0c6b8; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-onDark { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; box-shadow: none; }
.btn-onDark:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.26); }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--muted); }
.card-body { padding: 16px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.stack > :not(:first-child) { margin-top: 16px; }

/* ---------------------------------------------------------------- KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { display: block; padding: 16px; text-decoration: none; color: inherit; transition: border-color .12s, box-shadow .12s; }
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-label .icon { color: var(--faint); }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- status pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--gray-soft); color: var(--gray);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.rendering { background: var(--accent-soft); color: var(--accent-text); }
.pill.rendering .dot { animation: pulse 1.4s ease-in-out infinite; }
.pill.ready { background: var(--blue-soft); color: var(--blue); }
.pill.approved { background: var(--green-soft); color: var(--green); }
.pill.failed { background: var(--red-soft); color: var(--red); }
.pill.queued, .pill.cancelled, .pill.archived { background: var(--gray-soft); color: var(--gray); }
.vchip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 650; color: var(--text-2);
  background: var(--surface-3); border-radius: 5px; padding: 2px 6px; line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- thumbnails */
.thumb {
  width: 38px; aspect-ratio: 9 / 16; border-radius: 6px; overflow: hidden; flex: none;
  background: linear-gradient(160deg, #6c3ce6, #2b1676);
  display: grid; place-items: center; color: rgba(255,255,255,.75);
  box-shadow: inset 0 0 0 1px rgba(18,18,24,.06);
}
.thumb.landscape { width: 60px; aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------------------------------------------------------------- request list */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 12px; margin-bottom: -1px;
  color: var(--muted); font-weight: 500; text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tab.active .count { color: var(--accent-text); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.table { overflow: hidden; }
.tr {
  display: grid; align-items: center; gap: 16px;
  grid-template-columns: 60px minmax(0, 1fr) 150px 70px 150px 92px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.tr:last-child { border-bottom: 0; }
a.tr:hover { background: var(--surface-2); }
.th { font-size: 12px; font-weight: 550; color: var(--muted); background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; }
.cell-main { min-width: 0; }
.cell-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.cell-muted { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-time { color: var(--muted); font-size: 12.5px; text-align: right; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.status-cell .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------------------------------------------------------------- overview */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.vcard {
  display: block; text-decoration: none; color: inherit; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.vcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.vcard-media { position: relative; aspect-ratio: 4 / 5; background: linear-gradient(160deg, #6c3ce6, #24125f); display: grid; place-items: center; color: rgba(255,255,255,.7); overflow: hidden; }
.vcard-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vcard-media .pill { position: absolute; left: 8px; top: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.vcard-media .vchip { position: absolute; right: 8px; top: 8px; background: rgba(10,10,15,.6); color: #fff; }
.vcard-body { padding: 10px 12px 12px; }
.vcard-title { font-weight: 600; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.vcard-meta { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; gap: 6px; align-items: center; }

.now { display: flex; gap: 12px; align-items: flex-start; }
.now-title { font-weight: 600; text-decoration: none; color: var(--text); display: block; line-height: 1.35; }
.now-title:hover { color: var(--accent-text); }
.now-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.queue-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.queue-list li:first-child { padding-top: 0; }
.qnum { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; font-size: 11px; font-weight: 650; flex: none; }
.queue-list a { color: var(--text); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.queue-list a:hover { color: var(--accent-text); }

/* light render steps (overview) */
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--faint); }
.step .b { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; color: #fff; }
.step.done { color: var(--text-2); }
.step.done .b { background: var(--green); border-color: var(--green); }
.step.now { color: var(--text); font-weight: 550; }
.step.now .b { border-color: var(--accent); }
.step.now .b::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.steps.dark .step { color: rgba(255,255,255,.42); }
.steps.dark .step .b { border-color: rgba(255,255,255,.25); }
.steps.dark .step.done { color: rgba(255,255,255,.78); }
.steps.dark .step.done .b { background: #3ecf8e; border-color: #3ecf8e; color: #0d0d12; }
.steps.dark .step.now { color: #fff; }
.steps.dark .step.now .b { border-color: #b69cff; }
.steps.dark .step.now .b::after { background: #b69cff; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 22px; }
.label { font-weight: 600; font-size: 13px; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label .opt { font-weight: 400; color: var(--faint); }
.hint { color: var(--muted); font-size: 12.5px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); padding: 9px 11px; color: var(--text);
  font: 14px/1.45 var(--font);
  transition: border-color .12s, box-shadow .12s;
}
.input { height: 38px; }
.select { height: 36px; padding: 0 30px 0 10px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b7b8c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { resize: vertical; min-height: 130px; }
.counter { font-size: 12px; color: var(--faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.search { position: relative; width: 280px; max-width: 100%; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 34px; height: 36px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-3); align-self: flex-start; max-width: 100%; }
.seg button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font: 500 13px var(--font); cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg button.on .icon { color: var(--accent); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.choice {
  text-align: left; padding: 11px 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: inherit; font: inherit;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.choice:hover { border-color: #c2c2cd; }
.choice.on { border-color: var(--accent); box-shadow: var(--ring); background: #fdfcff; }
.choice:focus-visible { outline: none; box-shadow: var(--ring); }
.choice-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.choice-title .icon { color: var(--accent); }
.choice-desc { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 3px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.switch input {
  appearance: none; margin: 1px 0 0; flex: none; cursor: pointer;
  width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .15s;
}
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { outline: none; box-shadow: var(--ring); }
.switch-title { font-weight: 550; font-size: 13px; }
.switch-desc { color: var(--muted); font-size: 12.5px; }

.new-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.form-error { color: var(--red); font-size: 13px; margin-right: auto; }

/* ---------------------------------------------------------------- detail page */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; color: var(--muted); font-size: 13px; }

.stage {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: #0e0e13; padding: 14px 18px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 45% at 50% 35%, rgba(108,60,230,.24), transparent 70%); }
.stage > * { position: relative; }
.vtabs { display: flex; flex-wrap: wrap; gap: 4px; align-self: stretch; align-items: center; }
.vtabs-label { color: rgba(255,255,255,.45); font-size: 12px; margin-right: 6px; }
.vtab {
  height: 28px; padding: 0 10px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.72); font: 600 12px var(--font); font-variant-numeric: tabular-nums;
}
.vtab:hover { background: rgba(255,255,255,.09); color: #fff; }
.vtab.on { background: #fff; color: #121218; border-color: #fff; }
.vtab:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(182,156,255,.45); }
.vdot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.vdot.done { background: #3ecf8e; }
.vdot.running { background: #b69cff; animation: pulse 1.4s infinite; }
.vdot.queued { background: #9ca3af; }
.vdot.error { background: #f87171; }
.vdot.cancelled { background: #6b7280; }
.vtab .icon { color: #3ecf8e; }

.screen { position: relative; width: min(100%, 360px); aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.screen.landscape { width: 100%; aspect-ratio: 16 / 9; }
.screen video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 28px; text-align: center; color: #fff;
  background: #121218 center / cover no-repeat;
}
.overlay::before { content: ''; position: absolute; inset: 0; background: rgba(12,12,18,.62); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.overlay > * { position: relative; }
.overlay-title { font-weight: 600; font-size: 15px; }
.overlay-sub { color: rgba(255,255,255,.66); font-size: 13px; max-width: 280px; }
.overlay .icon.big { color: rgba(255,255,255,.85); }
.overlay.error .icon.big { color: #fca5a5; }
.progress { width: 72%; height: 4px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.progress > i { display: block; height: 100%; background: #fff; border-radius: inherit; transition: width .2s; }
.stage-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; color: rgba(255,255,255,.58); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stage-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.approved-banner { display: inline-flex; align-items: center; gap: 6px; color: #3ecf8e; font-weight: 600; font-size: 12.5px; }

.caption { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; }
.tags { color: var(--accent-text); font-size: 13px; margin-top: 10px; word-break: break-word; }
.change-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.change-note .icon { color: var(--accent); margin-top: 2px; }

.composer .textarea { min-height: 104px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 26px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  font: 500 12px var(--font); color: var(--text-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.base-pick { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.base-pick .select { width: auto; height: 30px; font-size: 12.5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl { position: relative; padding: 0 0 16px 28px; }
.tl::before { content: ''; position: absolute; left: 8px; top: 20px; bottom: 2px; width: 1px; background: var(--border); }
.tl:last-child { padding-bottom: 0; }
.tl:last-child::before { display: none; }
.tl-dot { position: absolute; left: 1px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.tl-dot.done { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 2px #fff; }
.tl-dot.running { border-color: var(--accent); }
.tl-dot.running::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.tl-dot.error { border-color: var(--red); background: var(--red); box-shadow: inset 0 0 0 2px #fff; }
.tl-dot.cancelled { border-color: var(--faint); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-v { font-weight: 650; background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--text); cursor: pointer; }
.tl-v:hover { color: var(--accent-text); }
.tl.selected .tl-v { color: var(--accent-text); }
.tl-meta { color: var(--muted); font-size: 12px; }
.tl-quote { margin-top: 7px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.tl-result { margin-top: 6px; font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; }
.tl-result .icon { color: var(--green); margin-top: 2px; }
.tl-error { margin-top: 6px; font-size: 12.5px; color: var(--red); }

.dl { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 9px 12px; margin: 0; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); word-break: break-word; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); }
.events li + li { border-top: 1px solid var(--border); }
.events time { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; padding-left: 8px; }

/* ---------------------------------------------------------------- menus, callouts, empty, toasts, modal */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 4px;
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border: 0; border-radius: 6px; background: none; color: var(--text); font: 500 13px var(--font); cursor: pointer; text-align: left;
}
.menu button .icon { color: var(--muted); }
.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: var(--red); }
.menu button.danger .icon { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13px; line-height: 1.5; }
.callout .icon { margin-top: 1px; }
.callout.error { background: var(--red-soft); border-color: #f3cdbf; color: #8b2a0b; }
.callout.info { background: var(--blue-soft); border-color: #cddbf8; color: #1a479e; }
.callout.accent { background: var(--accent-soft); border-color: #ddd0fb; color: #45219f; }

.empty { text-align: center; padding: 44px 24px; }
.empty .ico { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty p { color: var(--muted); margin: 0 auto 16px; max-width: 360px; }
.empty.compact { padding: 22px 12px; }
.empty.compact .ico { width: 34px; height: 34px; margin-bottom: 8px; }
.empty.compact p { margin-bottom: 0; font-size: 13px; }

.skel { background: linear-gradient(90deg, #ececf0 25%, #f5f5f7 37%, #ececf0 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: 10px; background: #17171f; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .18s ease-out; max-width: 380px; }
.toast .icon { color: #3ecf8e; }
.toast.error { background: #7d1d12; }
.toast.error .icon { color: #fecaca; }
@keyframes toastIn { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-scrim { position: fixed; inset: 0; z-index: 110; background: rgba(18,18,24,.38); display: grid; place-items: center; padding: 16px; animation: fadeIn .12s ease-out; }
.modal { width: 420px; max-width: 100%; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 20px; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal p { color: var(--text-2); margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- guide */
.prose h2 { font-size: 16px; font-weight: 650; margin-bottom: 8px; letter-spacing: -.01em; }
.prose p { color: var(--text-2); margin: 0 0 12px; }
.prose ul, .prose ol { color: var(--text-2); margin: 0 0 12px; padding-left: 20px; }
.prose li + li { margin-top: 5px; }
.prose strong { color: var(--text); }
.example { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare > div { border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.compare .bad { background: var(--red-soft); color: #8b2a0b; }
.compare .good { background: var(--green-soft); color: #0b5d40; }
.compare .k { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; display: block; }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; font-size: 13px; color: var(--text-2); }
.guide-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }

/* ---------------------------------------------------------------- types, danger, paths */
.type-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 7px 2px 6px; border-radius: 5px; line-height: 1.4; white-space: nowrap; background: var(--gray-soft); color: var(--text-2); }
.type-badge .icon { opacity: .8; }
.type-badge.design { background: #fcecf6; color: #9a2468; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #a02c08; border-color: #a02c08; }
.icon.danger { color: #fca5a5 !important; }
.dl dd.path { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; color: var(--text-2); }
.thumb-cell { display: flex; align-items: center; justify-content: center; }
.create-btn { margin-bottom: 2px; }
.sidebar .menu-wrap { display: block; }
.sidebar .menu { left: 0; right: 0; min-width: 0; }

.voice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }

/* designs on the stage */
.screen.design { background: #fff; }
.screen.design a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.screen.design img { width: 100%; height: 100%; display: block; object-fit: contain; }

/* design format picker */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.format {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: inherit; font: inherit;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.format:hover { border-color: #c2c2cd; }
.format.on { border-color: var(--accent); box-shadow: var(--ring); background: #fdfcff; }
.format:focus-visible { outline: none; box-shadow: var(--ring); }
.format-shape { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--surface-3); border-radius: 7px; }
.format-shape i { display: block; border-radius: 3px; background: linear-gradient(160deg, #8b63f0, #5527c8); }
.format.on .format-shape { background: var(--accent-soft); }
.format-text { display: flex; flex-direction: column; min-width: 0; }
.format-name { font-weight: 600; font-size: 13px; }
.format-size { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* overview: create tiles, storage, image strip */
.create-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.create-tile {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s;
}
.create-tile:hover { border-color: #cfc3f7; box-shadow: var(--shadow); }
.create-ico { width: 36px; height: 36px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.create-title { display: block; font-weight: 600; font-size: 14px; }
.create-text { display: block; color: var(--muted); font-size: 12.5px; }
.create-arrow { margin-left: auto; color: var(--faint); }
.create-tile:hover .create-arrow { color: var(--accent); }
.vcard-meta .type-badge { flex: none; }

.storage-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.storage-bar i { display: block; height: 100%; }
.sb0 { background: #6c3ce6; } .sb1 { background: #d6408f; } .sb2 { background: #2f9ad6; } .sb3 { background: #a7a7b5; }
.storage-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.storage-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.storage-list li .muted { font-size: 12px; }
.storage-list li b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.sdot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.storage-disk { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.storage-path { margin-top: 6px; display: flex; gap: 6px; align-items: center; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.strip-item { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.strip-item:hover img { transform: scale(1.04); }

/* AI images page */
.img-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.img-compose { position: sticky; top: 20px; }
.models { display: flex; flex-direction: column; gap: 6px; }
.model {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; text-align: left; cursor: pointer;
  padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: inherit; font: inherit;
}
.model:hover { border-color: #c2c2cd; }
.model.on { border-color: var(--accent); box-shadow: var(--ring); background: #fdfcff; }
.model:focus-visible { outline: none; box-shadow: var(--ring); }
.model-name { font-weight: 600; font-size: 13px; white-space: nowrap; }
.model-hint { color: var(--muted); font-size: 12px; text-align: right; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.gallery-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gallery { columns: 4 170px; column-gap: 12px; }
.gallery.small { columns: 5 140px; }
.tile {
  position: relative; display: grid; place-items: center; width: 100%; margin: 0 0 12px; break-inside: avoid;
  border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); padding: 0; cursor: pointer; color: var(--muted);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.tile:hover { box-shadow: var(--shadow-lg); }
button.tile:focus-visible { outline: none; box-shadow: var(--ring); }
.tile-meta { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(10,10,15,.55); padding: 2px 7px; border-radius: 5px; opacity: 0; transition: opacity .15s; }
button.tile:hover .tile-meta { opacity: 1; }
.tile-pending, .tile-error { cursor: default; gap: 6px; align-content: center; padding: 12px; text-align: center; }
.tile-error { background: var(--red-soft); color: var(--red); border-color: #f3cdbf; }
.tile-msg { font-size: 12px; max-width: 220px; }

.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(8,8,12,.82); display: grid; place-items: center; padding: 20px; animation: fadeIn .12s ease-out; }
.lightbox-inner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; width: min(1180px, 100%); max-height: calc(100vh - 40px); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); }
.lightbox-media { background: #0e0e13; display: grid; place-items: center; min-height: 320px; }
.lightbox-media img { max-width: 100%; max-height: calc(100vh - 40px); display: block; object-fit: contain; }
.lightbox-side { padding: 16px; display: flex; flex-direction: column; overflow: auto; }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.lightbox-prompt { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.lightbox-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lightbox-path { margin-top: auto; padding-top: 14px; display: flex; gap: 6px; align-items: center; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 11px; color: var(--muted); word-break: break-all; }

/* trash */
.tr.trash-row { grid-template-columns: 60px minmax(0, 1fr) 120px auto; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.trash-tile { break-inside: avoid; margin-bottom: 12px; }
.trash-tile .tile { margin-bottom: 6px; cursor: default; }
.trash-tile-actions { display: flex; gap: 6px; }
.trash-tile-actions .btn:first-child { flex: 1; }

/* ---------------------------------------------------------------- login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 380px; max-width: 100%; padding: 28px; }
.login-card .brand { padding: 0 0 22px; }
.login-card h1 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.login-card p { color: var(--muted); margin: 4px 0 20px; }
.login-card .btn { margin-top: 14px; }
.login-error { margin-top: 12px; }
.login-foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 16px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .detail { grid-template-columns: minmax(0, 1fr) 340px; }
  .ov-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .tr { grid-template-columns: 60px minmax(0, 1fr) 140px 60px 92px; }
  .tr .col-platform { display: none; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(18,18,24,.32); }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar-mobile .brand-name { font-size: 14px; }
  .page { padding: 20px 16px 56px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid, .detail, .new-grid, .guide-grid, .img-grid { grid-template-columns: minmax(0, 1fr); }
  .img-compose { position: static; }
  .search { width: 100%; }
  .create-row { grid-template-columns: minmax(0, 1fr); }
  .lightbox-inner { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .lightbox-media img { max-height: 60vh; }
}
@media (max-width: 640px) {
  .tr { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; }
  .tr .col-platform, .tr .col-versions, .tr .col-time { display: none; }
  .th { display: none; }
  .thumb.landscape { width: 46px; }
  .page-title { font-size: 20px; }
  .compare { grid-template-columns: 1fr; }
  .kpi-value { font-size: 26px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-body { padding: 14px; }
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery { columns: 2 140px; }
  .tr.trash-row { grid-template-columns: 46px minmax(0, 1fr); }
  .tr.trash-row .cell-time { display: none; }
  .tr.trash-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
}
