/* =============================================================================
   AI Film Studio — UI theme
   Redesigned to match the product mockups (docs/04 + UI_SPEC_FROM_MOCKUP).
   Light lavender background, indigo/violet accent, soft cards, cinematic thumbs.
   ========================================================================== */

/* ---- Bundled Inter (offline; renders identically on Windows without a system
   Inter install — fixes the broken/serif fallback users saw). Weights 400/600/700
   cover body/semibold/bold used across the app. ------------------------------ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('./inter-400-BT1H-PT_.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./inter-600-B2Ssfs8e.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./inter-700-C2zfFY7I.woff2') format('woff2');
}

:root {
  /* Palette */
  --bg: #f6f7fc;
  --bg-grad-a: #ffffff;
  --bg-grad-b: #eef0fb;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --border: #e9eaf2;
  --border-strong: #dfe1ee;

  --text: #1b1d29;
  --text-2: #5b5f73;
  --text-3: #8b8fa3;

  --indigo: #4f46e5;
  --indigo-2: #6366f1;
  --violet: #8b5cf6;
  --violet-2: #7c3aed;

  --grad-brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --grad-btn: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  --grad-promo: linear-gradient(160deg, #c7d2fe 0%, #e0e7ff 55%, #ede9fe 100%);
  --grad-bg: linear-gradient(145deg, #fbfbfe 0%, #eef0fb 42%, #e7e9fb 100%);

  /* Status */
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --info: #2563eb;
  --info-bg: #dbeafe;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --busy: #7c3aed;
  --busy-bg: #ede9fe;
  --muted: #6b7280;
  --muted-bg: #f1f2f6;

  /* Shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-xs: 0 1px 3px rgba(20, 22, 44, 0.05);
  --shadow-sm: 0 2px 8px rgba(20, 22, 44, 0.06);
  --shadow: 0 8px 24px rgba(79, 70, 229, 0.10);

  --sidebar-w: 244px;
  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; margin: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--grad-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---- App shell ---------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.app-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(150deg, #f7f7fe 0%, #eef0fb 45%, #eae8fb 100%);
}

.app-main {
  padding: 24px 32px 48px;
  min-width: 0;
}

/* ---- Sidebar ------------------------------------------------------------ */
.sidebar {
  background: #fbfbff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 2px;
}
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.brand-logo svg { width: 16px; height: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -0.2px; }
.brand-tag { font-size: 11px; color: var(--text-3); }

.sidebar-nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s;
}
.sidebar-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-link:hover { background: #f2f3fb; color: var(--text); }
.sidebar-link.is-active {
  background: #eef0ff;
  color: var(--indigo);
  border-left-color: var(--indigo-2);
  font-weight: 600;
}
.sidebar-link.is-active svg { opacity: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: 10px 12px; }

.sidebar-promo {
  margin-top: 14px;
  border-radius: var(--r-lg);
  background: var(--grad-promo);
  padding: 14px 14px 20px;
  position: relative;
  overflow: hidden;
}
.sidebar-promo .promo-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.6);
  display: grid; place-items: center; color: var(--violet-2);
  margin-bottom: 8px;
}
.sidebar-promo h4 { margin: 0 0 3px; font-size: 12.5px; line-height: 1.3; color: #312e81; position: relative; z-index: 1; }
.sidebar-promo p { margin: 0; font-size: 11.5px; color: #4c47a3; position: relative; z-index: 1; }
.sidebar-promo::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14px; z-index: 0;
  background: radial-gradient(ellipse at 30% 100%, rgba(139,92,246,.20), transparent 60%),
              radial-gradient(ellipse at 75% 100%, rgba(99,102,241,.18), transparent 60%);
}

/* ---- Topbar ------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-crumb { font-size: 13px; color: var(--text-3); }
.topbar-crumb b { color: var(--text); font-weight: 600; }
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 8px 14px;
  width: 320px; max-width: 34vw;
  color: var(--text-3);
}
.topbar-search:focus-within { border-color: var(--border-strong); background: #fff; }
.topbar-search input {
  border: 0; background: transparent; outline: 0;
  font-size: 13px; color: var(--text); width: 100%;
}
.topbar-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-2);
  background: transparent; border: 1px solid transparent;
  position: relative;
}
.topbar-icon:hover { background: var(--surface-2); }
.topbar-icon .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid #fff; }

.topbar-user { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
.topbar-user .who { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-user .who .n { font-size: 13px; font-weight: 600; }
.topbar-user .who .r { font-size: 11px; color: var(--text-3); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--busy-bg); color: var(--violet-2);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  flex: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; margin-left: -8px;
  background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}

/* ---- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.page-head .ph-text { flex: 1; min-width: 0; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.5px; }
.page-head .sub { margin: 0; color: var(--text-2); font-size: 14px; }
.page-head .ph-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 15px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  transition: transform .06s, box-shadow .12s, background .12s;
}
.btn:hover { background: #fafaff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.primary:hover { background: #4338ca; }
.btn.gradient { background: var(--grad-btn); border: 0; color: #fff; box-shadow: var(--shadow); }
.btn.gradient:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }

/* ---- Cards -------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}
.card.pad { padding: 18px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h3 { margin: 0; font-size: 17px; letter-spacing: -0.3px; }
.link-more { font-size: 13px; color: var(--indigo); font-weight: 600; }

/* ---- Stat cards --------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.stat-ico.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-ico.violet { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-ico.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-ico.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card .stat-num { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-card .stat-label { color: var(--text-2); font-size: 13px; }
.stat-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.stat-trend.up { color: var(--ok); }
.stat-trend.neutral { color: var(--text-3); }

/* ---- Status badge / dots ----------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .2px;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.busy { background: var(--busy-bg); color: var(--violet-2); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: var(--muted-bg); color: var(--muted); }

.sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.sdot.ok { background: var(--ok); }
.sdot.info { background: var(--info); }
.sdot.busy { background: var(--violet-2); }
.sdot.warn { background: var(--warn); }
.sdot.danger { background: var(--danger); }
.sdot.muted { background: var(--muted); }
.status-line { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }

/* ---- Pills / tags ------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 600;
}
.pill.dashed { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-3); }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---- Progress ----------------------------------------------------------- */
.progress { height: 7px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad-btn); border-radius: inherit; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 34px; text-align: right; }

/* ---- Thumbnails --------------------------------------------------------- */
.thumb {
  border-radius: var(--r);
  background: linear-gradient(135deg, #c7cbe8 0%, #a5abd6 100%);
  position: relative; overflow: hidden;
  display: grid; place-items: center; color: rgba(255,255,255,.85);
}
.thumb.wide { aspect-ratio: 16 / 9; }
.thumb.sq { aspect-ratio: 1 / 1; }
.thumb.play::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(0,0,0,.05), rgba(0,0,0,.22));
}
.thumb .thumb-ico { position: relative; z-index: 1; opacity: .9; }
.thumb-a { background: linear-gradient(135deg, #d9c7b0 0%, #b79b78 100%); }
.thumb-b { background: linear-gradient(135deg, #b6c8e8 0%, #7c98c9 100%); }
.thumb-c { background: linear-gradient(135deg, #c9b6e8 0%, #9578c9 100%); }
.thumb-d { background: linear-gradient(135deg, #b0d9c4 0%, #78b79a 100%); }

/* ---- Project cards (dashboard) ----------------------------------------- */
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.proj-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-xs); transition: box-shadow .15s, transform .1s; }
.proj-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.proj-card .pc-thumb { position: relative; }
.proj-card .pc-menu { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.85); display: grid; place-items: center; color: var(--text-2); }
.proj-card .pc-body { padding: 14px 15px 16px; }
.proj-card .pc-name { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.proj-card .pc-desc { color: var(--text-2); font-size: 12.5px; margin: 0 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-card .pc-meta { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin-bottom: 12px; }
.proj-card .pc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.proj-card .pc-updated { font-size: 11.5px; color: var(--text-3); }

.meta-row { display: flex; align-items: center; gap: 14px; color: var(--text-2); font-size: 13px; }
.meta-row .mi { display: inline-flex; align-items: center; gap: 5px; }
.meta-row svg { width: 15px; height: 15px; opacity: .7; }

/* ---- Tables ------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #fafaff; }

/* ---- Two-col layout ----------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2-13 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* ---- Activity list ------------------------------------------------------ */
.act-list { display: flex; flex-direction: column; }
.act-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: 0; }
.act-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.act-item .at { font-size: 13px; }
.act-item .aw { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---- Project detail: tabs + stepper ------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0 20px; }
.tab { padding: 9px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--indigo); border-bottom-color: var(--indigo-2); }
.tab:hover:not(.active) { color: var(--text); }

.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 2px 14px; }
.step { display: flex; flex-direction: column; align-items: center; min-width: 108px; position: relative; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: #fff; border: 2px solid var(--border-strong); color: var(--text-3); z-index: 1; }
.step.done .dot { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.step.active .dot { background: var(--grad-btn); border-color: transparent; color: #fff; box-shadow: var(--shadow); }
.step .lbl { font-size: 11px; color: var(--text-2); margin-top: 7px; text-align: center; max-width: 100px; }
.step .lbl b { display: block; color: var(--text); font-size: 11.5px; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step.done:not(:last-child)::after { background: var(--ok); }

/* ---- Scene cards (project detail grid) --------------------------------- */
.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scene-card { display: flex; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 13px; box-shadow: var(--shadow-xs); cursor: pointer; transition: box-shadow .12s; }
.scene-card:hover { box-shadow: var(--shadow-sm); }
.scene-card .sc-thumb { width: 108px; flex: none; }
.scene-card .sc-thumb .thumb { aspect-ratio: 4/3; }
.scene-card .sc-body { flex: 1; min-width: 0; }
.scene-card .sc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.scene-card .sc-code { font-size: 12px; font-weight: 700; color: var(--text-3); }
.scene-card .sc-title { font-weight: 700; font-size: 14px; margin: 0 0 4px; }
.scene-card .sc-desc { color: var(--text-2); font-size: 12.5px; margin: 0 0 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scene-card .sc-foot { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 11.5px; }
.scene-card .sc-foot .mi { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Scene Detail: 3 columns ------------------------------------------- */
.scene-detail { display: block; width: 100%; }
.sd-col { display: flex; flex-direction: column; gap: 16px; }
.sd-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px; box-shadow: var(--shadow-xs); }
.sd-block h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); }
.mini-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.mini-card:last-child { margin-bottom: 0; }
.mini-card .mc-t { font-size: 13px; font-weight: 600; }
.mini-card .mc-s { font-size: 11.5px; color: var(--text-3); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.field .val { font-size: 13.5px; color: var(--text); }
.field .box { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; font-size: 13px; color: var(--text-2); line-height: 1.5; }

.gen-settings { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.gen-settings .gs { background: var(--surface-2); border-radius: 9px; padding: 9px 10px; }
.gen-settings .gs .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-3); }
.gen-settings .gs .v { font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ---- Reference upload list (numbered, docs/04 §528) -------------------- */
.ref-list { display: flex; flex-direction: column; gap: 8px; counter-reset: refnum; }
.ref-upload-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; position: relative; counter-increment: refnum; }
.ref-upload-item::before { content: counter(refnum); width: 20px; height: 20px; border-radius: 50%; background: var(--busy-bg); color: var(--violet-2); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.ref-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.ref-thumbs .rt { width: 62px; height: 62px; border-radius: 9px; overflow: hidden; }
.ref-thumbs .rt.add { border: 1px dashed var(--border-strong); display: grid; place-items: center; color: var(--text-3); }

/* ---- Accounts ----------------------------------------------------------- */
.acct-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.acct-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-xs); }
.acct-card .ac-top { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.acct-card .ac-name { font-weight: 700; font-size: 14px; }
.acct-card .ac-mail { font-size: 11.5px; color: var(--text-3); }
.acct-card .ac-rows { display: flex; flex-direction: column; gap: 8px; }
.acct-card .ac-r { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.acct-card .ac-r .k { color: var(--text-3); }
.profile-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--text-2); }

/* ---- Empty / loading / mock notice ------------------------------------- */
.empty { text-align: center; padding: 54px 20px; color: var(--text-2); }
.empty .ei { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-3); }
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.empty p { margin: 0 0 16px; font-size: 13.5px; }
.loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.mock-notice {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--warn-bg); color: #92400e;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700;
}

.dash-probe { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-xs); font-size: 12.5px; color: var(--text-2); margin-bottom: 20px; }
.dash-probe code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; }

/* ---- Modal -------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,22,44,.4); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(0,0,0,.25); width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* ---- Responsive niceties ----------------------------------------------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .scene-detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stat-grid, .proj-grid, .scene-grid, .acct-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   LEGACY CLASS BRIDGE
   The 13 existing pages use their own class names (page-header, summary-card,
   badge-green, data-table, scene-col-*, etc). Rather than rewrite every page,
   we map those classes onto the new theme so the whole app inherits the
   redesigned look while staying build-safe. Per-page bespoke upgrades (icons in
   stat cards, stepper, etc.) land in later passes.
   ========================================================================== */

/* Page header (ui.tsx PageHeader) */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-title { margin: 0 0 4px; font-size: 28px; letter-spacing: -0.5px; }
.page-subtitle { margin: 0; color: var(--text-2); font-size: 14px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

.page { min-width: 0; }
.section-title { margin: 0 0 14px; font-size: 17px; letter-spacing: -0.3px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--indigo); font-weight: 600; margin-bottom: 14px; }

/* Buttons (legacy names) */
.btn-primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-accent { background: var(--grad-btn); border: 0; color: #fff; box-shadow: var(--shadow); }
.btn-accent:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-xs { padding: 5px 10px; font-size: 12px; }

/* Summary cards (ui.tsx SummaryCard) → new stat-card look */
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-xs); position: relative; }
.summary-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.summary-label { color: var(--text-2); font-size: 13px; margin-top: 6px; }
.summary-green .summary-value { color: var(--ok); }
.summary-blue .summary-value { color: var(--info); }
.summary-amber .summary-value { color: var(--warn); }
.summary-red .summary-value { color: var(--danger); }
.summary-gray .summary-value { color: var(--text); }
.grid-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* Badge tones (ui.tsx StatusBadge uses badge-<tone>) */
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--muted-bg); color: var(--muted); }

/* Generic grids */
.grid { display: grid; gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.grid-cards-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.grid-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.grid-outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.two-col-detail { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.row-gap { display: flex; flex-direction: column; gap: 10px; }

/* Generic card innards used by pages */
.card-body { padding: 16px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-meta { color: var(--text-3); font-size: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-xs); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
/* Panels that place <h3> directly (no .panel-head wrapper) — e.g. Scene
   Description / Narration / Dialogue — otherwise have zero padding, so their
   text sits flush against the border. Give them the same inner padding as
   .panel-head-based panels. */
.panel > h3 { margin: 0; padding: 14px 16px 0; font-size: 15px; font-weight: 700; }
.panel > h3 + .field, .panel > .field { padding: 0 16px; }
.panel > .field:last-child { padding-bottom: 14px; }

/* Data tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-xs); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-3); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); background: #fbfbff; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.data-table tr:last-child td { border-bottom: 0; }
.row-clickable { cursor: pointer; }
.row-clickable:hover { background: #fafaff; }
.row-actions { display: flex; gap: 6px; }
.error-cell { color: var(--danger); }
.error-detail { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* Detail headers / hero */
.detail-header { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.detail-header-info { flex: 1; min-width: 0; }
.detail-hero { width: 160px; flex: none; }
.detail-facts { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-2); font-size: 13px; margin-top: 8px; }
.detail-fields { display: flex; flex-direction: column; gap: 4px; }

/* Attention list (dashboard) */
.attention-list { display: flex; flex-direction: column; }
.attention-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.attention-item:last-child { border-bottom: 0; }

/* Banners */
.banner { padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.banner-amber { background: var(--warn-bg); color: #92400e; }

/* Scene detail 3-col (existing SceneDetailPage) */
.scene-detail { min-width: 0; }
.scene-cols { display: grid; grid-template-columns: 300px 1fr 320px; gap: 18px; align-items: start; }
.scene-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.scene-col-left, .scene-col-center, .scene-col-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.scene-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.scene-header-main { min-width: 0; }
.scene-header-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-2); font-size: 13px; margin-top: 6px; }
.scene-header-actions { display: flex; gap: 10px; }
.preview-large { width: 100%; aspect-ratio: 16/9; border-radius: var(--r); background: linear-gradient(135deg, #c7cbe8, #a5abd6); }

/* Cast cards (scene detail) */
.cast-list { display: flex; flex-direction: column; gap: 10px; }
.cast-card { display: flex; align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.cast-info { flex: 1; min-width: 0; }
.cast-role { font-size: 11px; font-weight: 700; color: var(--violet-2); }
.cast-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cast-actions { display: flex; gap: 6px; }

/* References */
.ref-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.ref-card-body { padding: 8px 10px; }
.ref-actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.ref-upload-list { display: flex; flex-direction: column; gap: 8px; counter-reset: refnum; }
.ref-upload-info { flex: 1; min-width: 0; }

/* Prompt editor / logs */
.prompt-editor { width: 100%; min-height: 90px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 10px 12px; font-family: inherit; font-size: 13px; resize: vertical; }
.log-block { background: #1b1d29; color: #d6d9e8; border-radius: 9px; padding: 12px 14px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; white-space: pre-wrap; overflow: auto; max-height: 240px; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.history-item:last-child { border-bottom: 0; }

/* Outputs */
.output-card { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: #fff; box-shadow: var(--shadow-xs); }
.output-body { padding: 12px 14px; }

/* Environment summary */
.env-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-2); font-size: 13px; }

/* Forms / inputs */
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.input, .input-block { border: 1px solid var(--border-strong); border-radius: 9px; padding: 9px 12px; font-size: 13.5px; font-family: inherit; width: 100%; background: #fff; }
.input:focus, .input-block:focus, .prompt-editor:focus { outline: 0; border-color: var(--indigo-2); }
.input-block { display: block; margin-bottom: 12px; }

/* Field (ui.tsx Field) */
.field-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px; }
.field-value { font-size: 13.5px; color: var(--text); }
.field-multiline .field-value { line-height: 1.55; }

/* Thumb (ui.tsx Thumb) legacy sizes */
.thumb-sm, .thumb-md, .thumb-lg { color: rgba(255,255,255,.9); font-weight: 700; font-size: 20px; }
.thumb-sm span, .thumb-md span, .thumb-lg span { text-shadow: 0 1px 2px rgba(0,0,0,.2); }

/* Empty state (ui.tsx EmptyState) */
.empty-state { text-align: center; padding: 54px 20px; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--busy-bg); color: var(--violet-2); display: grid; place-items: center; margin: 0 auto 14px; font-size: 24px; }
.empty-title { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.empty-message { margin: 0 0 16px; font-size: 13.5px; }

/* Inline state */
.inline-state { padding: 40px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* Probe bar (dashboard) */
.probe-bar { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-xs); font-size: 12.5px; color: var(--text-2); margin-bottom: 20px; }

/* Utilities */
.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; }
.small { font-size: 12px; }
.text-red { color: var(--danger); }
.mt { margin-top: 12px; }
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.compact { font-size: 12.5px; }

@media (max-width: 1180px) {
  .scene-cols { grid-template-columns: 1fr; }
  .dash-cols, .two-col-detail { grid-template-columns: 1fr; }
}

/* ===== Scenes grid — vertical card + view toggle (appended đợt 2) ===== */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.view-toggle button { border: 0; background: transparent; padding: 7px 10px; cursor: pointer; color: var(--text-3); display: grid; place-items: center; }
.view-toggle button.on { background: var(--grad-btn); color: #fff; }
.view-toggle button:not(.on):hover { background: var(--surface-2); color: var(--text-2); }

.scene-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.scene-card { display: flex; flex-direction: column; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 0; overflow: hidden; box-shadow: var(--shadow-xs); cursor: pointer; transition: box-shadow .14s, transform .14s; }
.scene-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.scene-card .sc-thumb { position: relative; width: 100%; }
.scene-card .sc-thumb .thumb { aspect-ratio: 16/10; border-radius: 0; width: 100%; }
.scene-card .sc-badge { position: absolute; top: 10px; left: 10px; }
.scene-card .sc-dur { position: absolute; bottom: 10px; right: 10px; background: rgba(15,18,45,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-pill); backdrop-filter: blur(2px); }
.scene-card .sc-body { padding: 13px 14px 6px; }
.scene-card .sc-code { font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: .3px; }
.scene-card .sc-title { font-weight: 700; font-size: 14.5px; margin: 3px 0 9px; }
.scene-card .sc-meta { display: flex; align-items: center; gap: 10px; }
.scene-card .sc-actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.scene-card .sc-actions .btn { flex: 1; }

@media (max-width: 1100px) { .scene-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .scene-grid { grid-template-columns: 1fr; } }

/* stat unit inline (đợt 2 fix) */
.stat-card .stat-num .stat-unit { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 3px; }

/* ===== Project Detail — hero, tabs, stepper (đợt 2b) ===== */
.back-link .muted { font-weight: 500; }
.proj-hero { display: grid; grid-template-columns: 132px 1fr auto; gap: 20px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-xs); margin-bottom: 20px; }
.proj-hero .thumb { width: 132px; aspect-ratio: 1; }
.proj-hero-info { min-width: 0; }
.proj-hero-info h1 { font-size: 22px; margin: 0; }
.proj-desc { margin: 8px 0 12px; font-size: 13.5px; line-height: 1.55; max-width: 620px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tag-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; border: 1px solid var(--border); }
.tag-pill.tag-add { background: transparent; color: var(--indigo); cursor: pointer; border-style: dashed; }
.tag-pill.tag-add:hover { background: rgba(99,102,241,.14); }
.proj-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--text-3); font-size: 12.5px; margin-bottom: 12px; }
.proj-meta .mi { display: inline-flex; align-items: center; gap: 5px; }
.proj-collab { display: flex; align-items: center; gap: 10px; }
.proj-collab .collab-note { font-size: 11px; }
.proj-hero-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 150px; }
.proj-hero-actions .btn { justify-content: center; }

.proj-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.proj-tab { border: 0; background: transparent; padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.proj-tab:hover { color: var(--text-2); }
.proj-tab.on { color: var(--indigo); border-bottom-color: var(--indigo); }

/* Stepper */
.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 18px; }
.stepper .step { position: relative; display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 110px; text-align: center; }
.stepper .step-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-3); border: 2px solid var(--border); z-index: 1; }
.stepper .step.active .step-dot { background: var(--grad-btn); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px rgba(99,102,241,.14); }
.stepper .step.done .step-dot { background: var(--ok); color: #fff; border-color: transparent; }
.stepper .step-line { position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.stepper .step.done .step-line { background: var(--ok); }
.stepper .step-label { display: flex; flex-direction: column; gap: 1px; margin-top: 7px; }
.stepper .step-label .mono { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.stepper .step-title { font-size: 11.5px; color: var(--text-2); font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper .step.active .step-title { color: var(--indigo); }

/* Production progress panel */
.prod-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow-xs); margin-bottom: 20px; }
.prod-progress .pp-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.prod-progress .pp-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 9px; font-size: 12px; color: var(--text-3); }
.prod-progress .pp-legend span { display: inline-flex; align-items: center; gap: 6px; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty-tab { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r); padding: 40px; text-align: center; }
.detail-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.detail-facts .fact { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; }
.detail-facts .fact-k { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.detail-facts .fact-v { font-weight: 600; font-size: 14px; }

@media (max-width: 900px) {
  .proj-hero { grid-template-columns: 1fr; }
  .proj-hero-actions { flex-direction: row; }
  .detail-facts { grid-template-columns: 1fr; }
}

/* ===== Project Detail fixes (đợt 2b-fix): stepper line, 2-col grid ===== */
/* 2-column scene grid override for ProjectDetail (ScenesPage stays 3-col) */
.scene-grid.scene-grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .scene-grid.scene-grid-2 { grid-template-columns: 1fr; } }

/* Stepper connector line — draw from each step center to the next, behind dots */
.stepper .step-line { display: none; }
.stepper .step::before {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.stepper .step:last-child::before { display: none; }
.stepper .step.done::before { background: var(--ok); }
.stepper .step-dot { position: relative; z-index: 2; }

/* pp-head single line (dedup fix): progress % now only from Progress component */
.prod-progress .pp-head { justify-content: flex-start; }

/* ---- Error boundary screen --------------------------------------------- */
.error-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--grad-bg); z-index: 9999;
}
.error-card {
  max-width: 560px; width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 28px; text-align: center;
}
.error-icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger-bg); color: var(--danger); font-size: 26px;
}
.error-card h2 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.error-message {
  font-size: 13.5px; color: var(--text-2); margin: 0 0 16px; line-height: 1.5;
  word-break: break-word;
}
.error-details { text-align: left; margin: 0 0 18px; }
.error-details summary { cursor: pointer; font-size: 12.5px; color: var(--text-3); }
.error-details pre {
  margin: 8px 0 0; padding: 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 11.5px; color: var(--text-2); overflow: auto; max-height: 200px;
  white-space: pre-wrap; word-break: break-word;
}
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Toasts ------------------------------------------------------------- */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 13px; color: var(--text);
  animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast-icon {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 1px;
}
.toast-success { border-left: 3px solid var(--ok); }
.toast-success .toast-icon { background: var(--ok-bg); color: var(--ok); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { background: var(--info-bg); color: var(--info); }
.toast-msg { flex: 1 1 auto; line-height: 1.45; word-break: break-word; }
.toast-action {
  flex: 0 0 auto; padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--indigo); color: #fff; border: 0; cursor: pointer; white-space: nowrap;
}
.toast-action:hover { background: #4338ca; }
.toast-close {
  flex: 0 0 auto; background: transparent; border: 0; color: var(--text-3);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.toast-close:hover { color: var(--text); }
