/* ======================================================================
   ترجمان دانش — design system
   Hand-written, no build step. Tokens first, then layout, then components.
   ====================================================================== */

:root {
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1.1rem;
  --radius-xl: 1.6rem;
  --radius-pill: 999px;

  --bg: #eef3fb;
  --bg-elevated: #ffffff;
  --bg-sunken: #f3f6fc;
  --ink: #16233a;
  --ink-soft: #54627a;
  --ink-faint: #8b96ac;
  --border: #e1e8f4;
  --border-strong: #cbd6ea;

  --brand: #2f6fed;
  --brand-strong: #1f56c7;
  --brand-soft: #e8f0ff;
  --teal: #17b5c4;
  --teal-soft: #e2fafc;
  --coral: #d1602f;
  --coral-soft: #fbe8de;
  --gold: #e0932a;
  --gold-soft: #fbeed9;
  --danger: #dc3545;
  --danger-soft: #fce8ea;
  --success: #16a34a;
  --success-soft: #e5f7ec;

  --shadow-sm: 0 1px 2px rgba(22, 35, 58, .06), 0 1px 1px rgba(22, 35, 58, .04);
  --shadow-md: 0 6px 20px -6px rgba(22, 35, 58, .14);
  --shadow-lg: 0 16px 40px -12px rgba(22, 35, 58, .2);

  --font-fa: "Vazirmatn", "Inter", system-ui, sans-serif;
  --font-en: "Inter", "Vazirmatn", system-ui, sans-serif;

  /* ---------- type & spacing scale ----------
     Named reference for all new work — every existing size in this file
     already lands close to one of these steps (checked against the
     design-system skill's primitive scale), so this documents the scale
     rather than forcing a blind rewrite of already-correct values. New
     rules should pick from here instead of a fresh one-off rem number —
     unnamed one-off sizes are how things drift oversized over time. */
  --text-2xs: .68rem;   /* 11px — timestamps, tiny badges */
  --text-xs:  .74rem;   /* 12px — captions, helper text */
  --text-sm:  .82rem;   /* 13px — secondary UI text, small buttons */
  --text-base: .92rem;  /* 15px — body text, default inputs/buttons */
  --text-md:  1rem;     /* 16px — emphasized body */
  --text-lg:  1.05rem;  /* 17px — card/section titles */
  --text-xl:  1.2rem;   /* 19px — page subheadings */
  --text-2xl: 1.5rem;   /* 24px — page headings */

  --space-1: .25rem;
  --space-2: .4rem;
  --space-3: .6rem;
  --space-4: .85rem;
  --space-5: 1.1rem;
  --space-6: 1.5rem;
  --space-7: 2rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420;
    --bg-elevated: #171d2c;
    --bg-sunken: #0b0f18;
    --ink: #e8ecf5;
    --ink-soft: #a7b1c4;
    --ink-faint: #6d7690;
    --border: #262e42;
    --border-strong: #35405a;

    --brand: #6f9cf6;
    --brand-strong: #a7c2fb;
    --brand-soft: #1a2740;
    --teal: #4fd6e3;
    --teal-soft: #0f2f34;
    --coral: #ec8f66;
    --coral-soft: #3a2318;
    --gold: #e0b954;
    --gold-soft: #3a2f13;
    --danger: #f0787f;
    --danger-soft: #3a1c1e;
    --success: #6fcf9a;
    --success-soft: #123424;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, .55);
    --shadow-lg: 0 20px 48px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1420;
  --bg-elevated: #171d2c;
  --bg-sunken: #0b0f18;
  --ink: #e8ecf5;
  --ink-soft: #a7b1c4;
  --ink-faint: #6d7690;
  --border: #262e42;
  --border-strong: #35405a;
  --brand: #6f9cf6;
  --brand-strong: #a7c2fb;
  --brand-soft: #1a2740;
  --teal: #4fd6e3;
  --teal-soft: #0f2f34;
  --coral: #ec8f66;
  --coral-soft: #3a2318;
  --gold: #e0b954;
  --gold-soft: #3a2f13;
  --danger: #f0787f;
  --danger-soft: #3a1c1e;
  --success: #6fcf9a;
  --success-soft: #123424;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 48px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-fa);
  line-height: 1.65;
  font-feature-settings: "ss01", "cv01";
  overflow-x: hidden; /* belt-and-braces: a runaway flex child must never force page-wide horizontal scroll */
}
html[dir="ltr"] body, [dir="ltr"] { font-family: var(--font-en); }
a { color: inherit; }
img { max-width: 100%; }
button { font-family: inherit; }

/* ---------- layout shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1.25rem;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.topbar .brand .mark {
  width: 2rem; height: 2rem; border-radius: var(--radius-sm); flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--teal));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem;
}
.topbar .spacer { flex: 1; min-width: .5rem; }
.container { max-width: 1240px; margin-inline: auto; padding-inline: 1.25rem; width: 100%; }

@media (max-width: 560px) {
  .topbar { padding: .6rem .85rem; gap: .5rem; }
  .topbar .brand span:not(.mark) { display: none; } /* keep just the mark badge, drop the wordmark */
  .credit-pill { padding: .3rem .55rem; font-size: .78rem; }
  .topbar .btn-sm { padding: .4rem .6rem; font-size: .78rem; }
}

/* ---------- credit pill ---------- */
.credit-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  padding: .35rem .75rem; border-radius: 999px; font-weight: 700; font-size: .85rem;
  white-space: nowrap;
}
.credit-pill.low { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.credit-pill.is-updated { animation: credit-pulse .9s ease-in-out 2; }
@keyframes credit-pulse {
  0%, 100% { box-shadow: none; }
  30%, 70% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 40%, transparent); }
}

/* ---------- glass confirm modal ---------- */
dialog.modal-glass {
  width: 100%; max-width: 26rem; margin: auto;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  border: 1px solid #ffffffd6;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  padding: 1.5rem;
}
dialog.modal-glass::backdrop {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal-icon {
  width: 2.75rem; height: 2.75rem; border-radius: 999px; font-size: 1.3rem;
  display: grid; place-items: center; margin-bottom: .85rem;
  background: var(--brand-soft); color: var(--brand);
}
.modal-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.gold { background: var(--gold-soft); color: var(--gold); }
.modal-title { font-size: 1.05rem; font-weight: 800; margin-bottom: .4rem; }
.modal-body { color: var(--ink-soft); font-size: var(--text-base); line-height: 1.7; margin-bottom: 1.1rem; }
.modal-cost-row {
  display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .6rem .85rem; margin-bottom: 1.1rem; font-size: var(--text-sm);
}
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; }
@media (max-width: 560px) {
  dialog.modal-glass { max-width: none; width: 100vw; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; position: fixed; inset-inline: 0; bottom: 0; top: auto; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ---------- notification bell ---------- */
.bell-wrap { position: relative; }
.bell-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elevated); display: grid; place-items: center; cursor: pointer;
}
.bell-badge {
  position: absolute; top: -2px; inset-inline-end: -2px;
  background: var(--coral); color: #fff; font-size: .65rem; font-weight: 800;
  min-width: 1.1rem; height: 1.1rem; border-radius: 999px;
  display: grid; place-items: center; padding-inline: 3px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--radius-md); border: 1px solid transparent;
  padding: .65rem 1.15rem; font-weight: 700; font-size: var(--text-base);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, background-color .18s ease, opacity .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: .06s; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 12px -4px color-mix(in srgb, var(--brand) 55%, transparent);
}
.btn-primary:hover { box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 8px 20px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-teal { background: linear-gradient(135deg, var(--teal), color-mix(in srgb, var(--teal) 70%, black)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-teal:hover { box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--bg-sunken); border-color: color-mix(in srgb, var(--border-strong) 70%, var(--ink-faint)); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 15%); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 70%, var(--danger) 15%); }
.btn-sm { padding: .42rem .8rem; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-icon { padding: .5rem; border-radius: 999px; }

/* loading state — driven by app.js on any submit / htmx request */
.btn.is-loading { cursor: wait; opacity: .85; }
.spinner {
  width: 1em; height: 1em; border-radius: 999px; flex-shrink: 0;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.4s; }
  .btn { transition: none; }
}

/* ---------- cards ---------- */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--space-5); }

/* ---------- horizontal top-level tabs (level 1) ---------- */
.tabs-h {
  display: flex; gap: .25rem; overflow-x: auto; padding: .3rem;
  background: var(--bg-sunken); border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  scrollbar-width: thin;
}
.tabs-h .tab {
  flex: 0 0 auto; display: flex; align-items: center; gap: .45rem;
  padding: .65rem 1.25rem; border-radius: var(--radius-pill);
  font-weight: 700; font-size: .88rem; color: var(--ink-soft);
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.tabs-h .tab:hover:not(.active) { color: var(--ink); }
.tabs-h .tab.active {
  background: var(--bg-elevated); color: var(--brand); border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.tabs-h .tab .icn { opacity: .85; }

/* ---------- studio layout: left sidebar (level 2) + content ---------- */
.studio-grid {
  display: grid; grid-template-columns: 220px 1fr; gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .studio-grid { grid-template-columns: 1fr; }
  .tabs-v { display: flex; overflow-x: auto; gap: .4rem; }
  .tabs-v .tab-v { flex: 0 0 auto; }
}
.tabs-v {
  display: flex; flex-direction: column; gap: .3rem;
  position: sticky; top: 4.5rem;
}
.tabs-v .tab-v {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .65rem .85rem; border-radius: var(--radius-md);
  font-weight: 600; font-size: .87rem; color: var(--ink-soft);
  cursor: pointer; border: 1px solid transparent;
}
.tabs-v .tab-v.active {
  background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}
.tabs-v .tab-v .count {
  font-size: .72rem; background: var(--bg-sunken); border-radius: 999px; padding: .05rem .45rem;
}

/* ---------- output card ---------- */
.output-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg-elevated); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.output-card .oc-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .75rem .9rem; border-bottom: 1px solid var(--border);
}
.output-card .oc-title { font-weight: 800; font-size: .88rem; display: flex; align-items: center; gap: .45rem; }
.output-card .oc-body { padding: .9rem; white-space: pre-wrap; font-size: .9rem; flex: 1; }
.output-card .oc-body[dir="ltr"] { text-align: left; }
.output-card .oc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6rem .9rem; border-top: 1px solid var(--border); background: var(--bg-sunken);
  font-size: .78rem; color: var(--ink-faint);
}
.output-card img.oc-image { width: 100%; max-height: 20rem; object-fit: contain; display: block; background: var(--bg-sunken); cursor: zoom-in; }
@media (max-width: 640px) { .output-card img.oc-image { max-height: 14rem; } }

/* ---------- universal image lightbox (click any img.zoomable) ---------- */
.img-lightbox {
  display: none; position: fixed; inset: 0; z-index: 200; background: rgba(10, 14, 24, .88);
  align-items: center; justify-content: center; padding: 2.5rem 1.25rem; cursor: zoom-out;
}
.img-lightbox.open { display: flex; }
.img-lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); cursor: default; }
.img-lightbox-close {
  position: absolute; top: 1rem; inset-inline-end: 1.25rem; width: 2.4rem; height: 2.4rem; border-radius: 999px;
  border: none; background: rgba(255,255,255,.12); color: #fff; font-size: 1.1rem; cursor: pointer;
}
.img-lightbox-close:hover { background: rgba(255,255,255,.22); }
.oc-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; }
.oc-status.queued { color: var(--ink-faint); }
.oc-status.running { color: var(--gold); }
.oc-status.done { color: var(--success); }
.oc-status.failed { color: var(--danger); }
.oc-status .dot { width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }
.oc-status.running .dot { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

/* skeleton placeholder while an output is queued/running */
.skeleton-lines { display: flex; flex-direction: column; gap: .55rem; padding: .2rem 0; }
.skeleton-line {
  height: .7rem; border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-sunken) 25%, color-mix(in srgb, var(--bg-sunken) 40%, var(--border)) 37%, var(--bg-sunken) 63%);
  background-size: 400% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
.skeleton-line.w-70 { width: 70%; } .skeleton-line.w-90 { width: 90%; } .skeleton-line.w-50 { width: 50%; } .skeleton-line.w-100 { width: 100%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton-img { aspect-ratio: 4/5; border-radius: var(--radius-md); background: var(--bg-sunken); background-size: 400% 100%;
  background-image: linear-gradient(90deg, var(--bg-sunken) 25%, color-mix(in srgb, var(--bg-sunken) 40%, var(--border)) 37%, var(--bg-sunken) 63%);
  animation: shimmer 1.6s ease-in-out infinite; }

/* freshly-inserted output card entrance */
@keyframes cardIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.output-card { animation: cardIn .25s ease-out; }

.copy-btn { position: relative; }
.copy-btn.copied::after {
  content: "کپی شد!"; position: absolute; inset-inline-end: 0; top: -1.9rem;
  background: var(--ink); color: var(--bg); font-size: .72rem; padding: .25rem .55rem;
  border-radius: var(--radius-sm); white-space: nowrap;
}

/* ---------- badges / chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--bg-sunken); color: var(--ink-soft); border: 1px solid var(--border);
}
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.chip.coral { background: var(--coral-soft); color: var(--coral); border-color: transparent; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { filter: brightness(0.97); }
.chip.selected { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- forms ---------- */
label { font-size: var(--text-sm); font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: .35rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], textarea, select {
  width: 100%; padding: .65rem .8rem; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--ink);
  font-family: inherit; font-size: var(--text-base);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.field { margin-bottom: var(--space-4); }
.help { font-size: var(--text-xs); color: var(--ink-faint); margin-top: .3rem; }

/* Compact variant — the wizard's brief-text section, deliberately smaller
   than the default form scale (see wizard.html). */
.compact-fields label { font-size: var(--text-xs); margin-bottom: .2rem; }
.compact-fields .field { margin-bottom: var(--space-3); }
.compact-fields input[type="text"], .compact-fields textarea {
  padding: .42rem .6rem; font-size: var(--text-sm);
}
.compact-fields textarea { min-height: 2.6rem; }

.density-slider { width: 100%; accent-color: var(--brand); margin-block: .3rem; }
.density-slider-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-faint); }
.error-text { font-size: .78rem; color: var(--danger); margin-top: .3rem; }

/* ---------- wizard steps ---------- */
.wizard-steps { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.wizard-steps .step {
  display: flex; align-items: center; gap: .5rem; font-size: .82rem; font-weight: 700; color: var(--ink-faint);
  text-decoration: none;
}
a.wizard-steps .step, .wizard-steps a.step { cursor: pointer; }
.wizard-steps a.step:hover { color: var(--brand); }
.wizard-steps .step .num {
  width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--bg-sunken);
  display: grid; place-items: center; font-size: .78rem; border: 1px solid var(--border);
}
.wizard-steps .step.active { color: var(--brand); }
.wizard-steps .step.active .num { background: var(--brand); color: #fff; border-color: var(--brand); }
.wizard-steps .step.done .num { background: var(--success); color: #fff; border-color: var(--success); }
.wizard-steps .sep { flex: 1; height: 1px; background: var(--border); }

/* ---------- wizard step 3: image frame + element list ---------- */
.wizard-image-frame {
  position: relative; overflow: hidden; padding: .75rem; display: flex; align-items: center; justify-content: center;
  background: var(--bg-sunken); max-height: min(70vh, 46rem);
}
.wizard-image-frame img { max-width: 100%; max-height: min(70vh, 46rem); width: auto; display: block; border-radius: var(--radius-sm); cursor: zoom-in; }
@media (max-width: 640px) {
  .wizard-image-frame, .wizard-image-frame img { max-height: 50vh; }
}
.wizard-image-hint {
  position: absolute; bottom: .6rem; inset-inline-end: .6rem; background: rgba(10,14,24,.6); color: #fff;
  font-size: .7rem; padding: .25rem .55rem; border-radius: var(--radius-pill); pointer-events: none;
}
.wizard-image-frame img.dimmed { opacity: .35; filter: blur(1px); cursor: default; }
.wizard-image-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; color: #fff; font-size: .85rem; font-weight: 700; text-align: center; padding: 0 1rem;
}
.wizard-image-overlay .spinner { width: 1.6rem; height: 1.6rem; border-width: 3px; }
.element-list { display: flex; flex-direction: column; gap: .4rem; max-height: 32rem; overflow-y: auto; }
.element-item {
  display: flex; align-items: flex-start; gap: .55rem; padding: .55rem .7rem; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-elevated);
}
.element-item.marked-delete { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); }
.element-item-body { min-width: 0; width: 100%; }
.element-item-label { font-size: .84rem; font-weight: 700; line-height: 1.4; }
.element-item-desc { font-size: .76rem; color: var(--ink-faint); margin-top: .15rem; line-height: 1.5; }
.element-edit-input {
  width: 100%; margin-top: .4rem; font-size: .8rem; padding: .4rem .55rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-sunken); resize: vertical; min-height: 2.2rem;
}
.element-delete-btn {
  flex-shrink: 0; width: 1.7rem; height: 1.7rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated); cursor: pointer; font-size: .8rem; display: grid; place-items: center;
}
.element-delete-btn:hover { border-color: var(--danger); }
.custom-edit-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem; margin: 0 .3rem .3rem 0;
  border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 600;
}
.custom-edit-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: .8rem; padding: 0; }
.review-list { display: flex; flex-direction: column; gap: .45rem; max-height: 28rem; overflow-y: auto; }
.review-item { padding: .55rem .7rem; border-radius: var(--radius-md); background: var(--bg-sunken); border: 1px solid var(--border); }
.review-item.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.review-item-label { font-size: .76rem; font-weight: 700; color: var(--ink-faint); margin-bottom: .15rem; }
.review-item-text { font-size: .84rem; line-height: 1.5; }
.review-item.danger .review-item-text { color: var(--danger); font-weight: 600; }

/* ---------- progress ---------- */
.progressbar { height: .5rem; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.progressbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--brand)); transition: width .4s ease; }
.progress-log { font-size: .82rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; }
.progress-log .ok::before { content: "✓ "; color: var(--success); font-weight: 800; }
.progress-log .pending::before { content: "… "; color: var(--ink-faint); }

/* ---------- toasts (notification pop) ---------- */
/* Same glass-card language as dialog.modal-glass (the cost-confirm modal)
   — one visual pattern for every message surface on the site. */
.toast-stack { position: fixed; bottom: 1.25rem; inset-inline-end: 1.25rem; z-index: 60; display: flex; flex-direction: column; gap: .6rem; }
.toast {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  border: 1px solid #ffffffd6;
  -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg); padding: .7rem .9rem; min-width: 260px; max-width: 340px;
  display: flex; align-items: flex-start; gap: .55rem; font-size: .85rem;
  animation: toast-in .22s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast .icn {
  width: 1.8rem; height: 1.8rem; border-radius: 999px; flex-shrink: 0; margin-top: .05rem;
  display: grid; place-items: center; font-size: .85rem; font-weight: 800;
  background: var(--brand-soft); color: var(--brand);
}
.toast.is-success .icn { background: var(--success-soft); color: var(--success); }
.toast.is-error .icn { background: var(--danger-soft); color: var(--danger); }
.toast-body { flex: 1; min-width: 0; }
.toast-close { border: 0; background: none; color: var(--ink-faint); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; margin-inline-start: auto; }
.toast-close:hover { color: var(--ink); }

/* ---------- element chips (visual abstract editor) ---------- */
.element-grid { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- landing page ---------- */
.hero-section {
  display: flex; align-items: center; gap: 2.5rem;
  padding-block: 2.5rem 1.5rem;
}
.hero-text { flex: 1 1 420px; min-width: 280px; }
.hero-media { flex: 1 1 480px; min-width: 280px; }
.hero-media img {
  /* height must be explicit "auto" — with only width set, the browser
     honors the width/height HTML attributes (added to reserve layout
     space and avoid CLS) as a literal pixel height, squashing the image
     once the flex container shrinks its rendered width below that. */
  width: 100%; height: auto; display: block; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.hero-title {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; line-height: 1.35;
  margin: .75rem 0 1rem;
}
.hero-title .accent {
  background: linear-gradient(90deg, var(--brand), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 1.75rem; max-width: 46ch; }
.hero-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 1.5rem; margin-top: 2rem; }
.hero-stats .stat-num { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.hero-stats .stat-label { font-size: .78rem; color: var(--ink-faint); }
@media (max-width: 860px) {
  .hero-section { flex-direction: column; padding-block: 1.5rem 1rem; }
}
@media (max-width: 480px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
}

.section-head { text-align: center; max-width: 640px; margin: 3rem auto 2rem; }
.section-head h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); font-weight: 800; margin: .5rem 0 .6rem; }
.section-head p { color: var(--ink-soft); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.feature-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-card .fc-media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-sunken); }
.feature-card .fc-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature-card .fc-body { padding: 1.1rem 1.2rem 1.3rem; }
.feature-card .fc-title { font-weight: 800; font-size: 1.02rem; margin-bottom: .4rem; }
.feature-card .fc-desc { color: var(--ink-soft); font-size: .88rem; line-height: 1.7; }

.steps-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem;
  margin: 2rem 0;
}
.step-card { text-align: center; padding: 1rem; }
.step-card .step-num {
  width: 2.6rem; height: 2.6rem; border-radius: 999px; margin: 0 auto .75rem;
  background: linear-gradient(135deg, var(--brand), var(--teal)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
}
.step-card .step-title { font-weight: 700; margin-bottom: .35rem; }
.step-card .step-desc { color: var(--ink-soft); font-size: .85rem; }

.cta-band {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-radius: var(--radius-xl); padding: 2.25rem 1.5rem; text-align: center;
  color: #fff; margin: 3rem 0 2rem;
}
.cta-band h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: .6rem; }
.cta-band p { opacity: .9; margin-bottom: 1.5rem; }
.cta-band .btn-primary { background: #fff; color: var(--brand-strong); }

/* ---------- modern data table (report/list pages) ---------- */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-modern { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table-modern thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-sunken); color: var(--ink-soft); font-weight: 700; font-size: .78rem;
  text-align: start; padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .02em;
}
.table-modern tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr { transition: background-color .12s ease; }
.table-modern tbody tr:hover { background: var(--bg-sunken); }
.table-modern .amt-pos { color: var(--success); font-weight: 700; }
.table-modern .amt-neg { color: var(--danger); font-weight: 700; }
.table-empty { padding: 3rem 1rem; text-align: center; color: var(--ink-faint); }
[data-sortable-table] th[data-sort-key] { cursor: pointer; -webkit-user-select: none; user-select: none; white-space: nowrap; }
[data-sortable-table] th[data-sort-key]:hover { color: var(--ink); }
[data-sortable-table] th[data-sort-key]::after { content: "⇅"; margin-inline-start: .35em; opacity: .35; font-size: .85em; }
[data-sortable-table] th[data-sort-key].sort-asc::after { content: "▲"; opacity: 1; color: var(--brand); }
[data-sortable-table] th[data-sort-key].sort-desc::after { content: "▼"; opacity: 1; color: var(--brand); }
.table-modern tr.row-failed { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.task-result-cell { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }

.stat-card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm);
}
.stat-card .sc-label { font-size: .78rem; color: var(--ink-faint); font-weight: 600; margin-bottom: .4rem; }
.stat-card .sc-value { font-size: 1.6rem; font-weight: 800; }
.stat-card .sc-value.brand { color: var(--brand); }
.stat-card .sc-value.success { color: var(--success); }
.stat-card .sc-value.danger { color: var(--danger); }

.kind-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.kind-badge.topup { background: var(--success-soft); color: var(--success); }
.kind-badge.charge { background: var(--danger-soft); color: var(--danger); }
.kind-badge.refund { background: var(--teal-soft); color: var(--teal); }
.kind-badge.adjustment { background: var(--gold-soft); color: var(--gold); }

/* ---------- utility ---------- */
.muted { color: var(--ink-faint); }
.text-sm { font-size: .85rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .6rem; }
.hr { height: 1px; background: var(--border); border: 0; margin: 1.25rem 0; }

/* ======================================================================
   studio flow v2 — intake, progress, findings, output cards
   ====================================================================== */

/* dropzone (intake) */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--bg-sunken); padding: 2.5rem 1.5rem; text-align: center;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon {
  width: 3rem; height: 3rem; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin: 0 auto .75rem; font-size: 1.3rem;
}
.dropzone .dz-title { font-weight: 800; font-size: 1rem; margin-bottom: .3rem; }
.dropzone .dz-sub { font-size: .82rem; color: var(--ink-faint); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.divider-or {
  display: flex; align-items: center; gap: .75rem; color: var(--ink-faint); font-size: .8rem; margin-block: 1.1rem;
}
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* step-pill track (analysis progress) */
.step-track { display: flex; gap: .5rem; overflow-x: auto; padding: .15rem .1rem .5rem; margin-bottom: 1rem; scrollbar-width: thin; }
.step-pill {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; flex-shrink: 0;
  padding: .42rem .9rem; border-radius: var(--radius-pill); background: var(--bg-sunken); color: var(--ink-faint);
  font-size: .78rem; font-weight: 700; border: 1px solid var(--border);
}
.step-pill.active { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.step-pill.done { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* paper meta rows */
.meta-list { display: flex; flex-direction: column; }
.meta-row { display: flex; gap: .5rem; padding-block: .45rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.meta-row:last-child { border-bottom: none; }
.meta-row .k { color: var(--ink-faint); font-weight: 700; flex-shrink: 0; }
.meta-row .v { font-weight: 700; }

/* big rounded pill selector (audience level) */
.style-pill-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.style-pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg-elevated); font-size: .82rem; font-weight: 600; cursor: pointer;
}
.style-pill input { width: auto; margin: 0; accent-color: var(--brand); }
.style-pill:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.style-pill:hover { border-color: var(--border-strong); }

.pill-select-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; }
.pill-select {
  display: flex; align-items: center; justify-content: center; padding: .8rem 1rem;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-elevated);
  font-weight: 700; font-size: .92rem; cursor: pointer; transition: all .15s ease;
}
.pill-select.active { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: var(--shadow-sm); }
.pill-select:hover:not(.active) { border-color: var(--border-strong); background: var(--bg-sunken); }

/* findings grid — compact, 2 columns, finding text and evidence stacked
   with a divider between them inside each card. */
.findings-toolbar { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--ink-faint); }
.findings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.finding-card {
  display: flex; flex-direction: column; align-items: stretch; gap: .4rem;
  padding: .65rem .8rem; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--bg-elevated); cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.finding-card:hover { border-color: var(--border-strong); }
.finding-card.selected { border-color: var(--brand); background: var(--brand-soft); }
.finding-card .fc-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.finding-card .fc-text { font-size: .78rem; line-height: 1.55; text-align: start; }
.finding-card .fc-divider { height: 1px; background: var(--border); margin: 0 -.2rem; }
.finding-card .fc-tag {
  flex-shrink: 0; font-size: .62rem; font-weight: 800; padding: .12rem .5rem; border-radius: var(--radius-pill);
  background: var(--brand-soft); color: var(--brand);
}
.finding-card .fc-tag.numeric { background: var(--gold-soft); color: var(--gold); }
.finding-card .check {
  flex-shrink: 0; width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 2px solid var(--border-strong);
  display: grid; place-items: center; font-size: .6rem; color: transparent;
}
.finding-card.selected .check { background: var(--brand); border-color: var(--brand); color: #fff; }
.finding-card .finding-evidence { font-size: .66rem; text-align: start; }
@media(max-width: 760px) { .findings-grid { grid-template-columns: 1fr; } }
.finding-add-panel { margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--border); }
.finding-add-panel > summary { font-size: .8rem; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: .35rem; list-style: none; }
.finding-add-panel > summary::-webkit-details-marker { display: none; }
.finding-add-panel > summary .icon { width: 15px; }
.finding-add-form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.finding-add-form select { flex: 0 0 auto; min-width: 130px; }
.finding-add-form input[type=text] { flex: 1; min-width: 220px; }

/* platform / target list (inside an output card) */
.platform-list { display: flex; flex-direction: column; gap: .5rem; }
.platform-item {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .65rem .9rem; border-radius: var(--radius-md); border: 1px solid var(--border);
  cursor: pointer; font-size: .85rem; font-weight: 700; background: var(--bg-elevated);
}
.platform-item.active { border-color: var(--brand); background: var(--brand-soft); }
.platform-item .p-label { display: flex; align-items: center; gap: .5rem; }
.platform-item .p-count { color: var(--ink-faint); font-size: .76rem; font-weight: 600; }
.platform-item .p-count.over { color: var(--danger); font-weight: 800; }

/* post preview mock */
.post-preview { border: 1px solid var(--border); border-radius: var(--radius-md); padding: .9rem 1rem; background: var(--bg-elevated); }
.post-preview .pp-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .5rem; }
.post-preview .pp-avatar { width: 2rem; height: 2rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: .82rem; flex-shrink: 0; }
.post-preview .pp-name { font-weight: 800; font-size: .85rem; }
.post-preview .pp-meta { color: var(--ink-faint); font-size: .76rem; }
.post-preview .pp-body { font-size: .88rem; line-height: 1.75; white-space: pre-wrap; }
.post-preview .pp-image { width: 100%; max-height: 22rem; object-fit: contain; background: var(--bg-sunken); border-radius: .75rem; margin-bottom: .75rem; display: block; }
@media (max-width: 640px) { .post-preview .pp-image { max-height: 16rem; } }

/* ---------- social pack composer ---------- */
.social-composer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.social-composer-head .sc-title { font-weight: 800; font-size: 1.05rem; }
.social-composer-head .sc-sub { color: var(--ink-faint); font-size: .82rem; margin-top: .15rem; }
.social-preview-col { position: relative; }
.social-preview-badge {
  position: absolute; top: -.6rem; inset-inline-start: .5rem; z-index: 1;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: .2rem .65rem; font-size: .72rem; color: var(--ink-soft); box-shadow: var(--shadow-sm);
}
.social-preview-badge.warn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.platform-item .p-check {
  width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 2px solid var(--border-strong);
  display: grid; place-items: center; font-size: .62rem; color: transparent; flex-shrink: 0;
}
.platform-item.active .p-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.social-thumbs-row { display: flex; gap: .65rem; flex-wrap: wrap; }
.social-thumb { flex-shrink: 0; width: 6.5rem; }
.social-thumb .thumb-box {
  width: 6.5rem; height: 6.5rem; border-radius: .75rem; overflow: hidden; position: relative;
  cursor: pointer; border: 2px solid transparent;
}
.social-thumb .thumb-box.selected { border-color: var(--brand); }
.social-thumb .thumb-box img { width: 100%; height: 100%; object-fit: contain; background: var(--bg-sunken); display: block; }
.social-thumb .thumb-check {
  position: absolute; top: .3rem; inset-inline-start: .3rem; width: 1.15rem; height: 1.15rem; border-radius: 999px;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-size: .65rem; box-shadow: var(--shadow-sm);
}
.social-thumb .thumb-retry {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; background: color-mix(in srgb, var(--danger-soft) 92%, transparent); color: var(--danger);
  font-size: .68rem; font-weight: 700; border: none; cursor: pointer;
}
.social-thumb .thumb-caption { margin-top: .35rem; font-size: .72rem; color: var(--ink-faint); text-align: center; }
.social-actions-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.social-credit-foot { margin-top: .5rem; font-size: .74rem; color: var(--ink-faint); }

/* ---------- AI provider settings page ---------- */
.provider-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-elevated); overflow: hidden; box-shadow: var(--shadow-sm); font-size: .82rem; }
.provider-card + .provider-card { margin-top: .5rem; }
.provider-card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .55rem .8rem; cursor: pointer; flex-wrap: wrap; }
.provider-card-head .title-wrap { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.provider-card-head .title { font-weight: 800; font-size: .84rem; }
.provider-card-body { padding: 0 .8rem .8rem; border-top: 1px solid var(--border); }
.status-badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: var(--radius-pill); font-size: .62rem; font-weight: 700; }
.status-badge.has-key { background: var(--success-soft); color: var(--success); }
.status-badge.no-key { background: var(--bg-sunken); color: var(--ink-faint); }
.status-badge.system-active { background: var(--brand-soft); color: var(--brand); }
.key-row { display: flex; align-items: center; gap: .4rem; background: var(--bg-sunken); border-radius: var(--radius-sm); padding: .4rem .55rem; margin-block: .5rem; flex-wrap: wrap; }
.key-row input[type="password"], .key-row input[type="text"] { flex: 1; min-width: 10rem; padding: .38rem .55rem; font-size: .76rem; }
.test-result { margin: .35rem 0 .5rem; font-size: .74rem; font-weight: 600; }
.test-result.is-ok { color: var(--success); }
.test-result.is-fail { color: var(--danger); }
.modality-section { padding-block: .55rem; border-top: 1px dashed var(--border); }
.modality-section:first-of-type { border-top: none; }
.modality-section .ms-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.ms-label { font-weight: 700; font-size: .74rem; color: var(--ink-soft); }
.modality-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.modality-row select { flex: 1; min-width: 14rem; padding: .38rem .55rem; font-size: .76rem; }
.provider-card .btn-sm, .final-model-box .btn-sm { padding: .3rem .6rem; font-size: .68rem; }
.provider-card .btn-icon { padding: .3rem; font-size: .76rem; }
.final-model-box { border: 1px solid var(--brand-soft); border-radius: var(--radius-md); background: var(--brand-soft); padding: .7rem .8rem; margin-bottom: .5rem; }
.final-model-box h2 { font-size: .88rem; }
.final-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.final-model-field { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem; font-size: .8rem; }
.final-model-field .ms-head { font-size: .8rem; }
.final-model-field select { padding: .38rem .55rem; font-size: .76rem; }
.final-model-field .modality-row select { min-width: 0; }
.quick-select-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.quick-select-bar .qs-item { display: flex; flex-direction: column; gap: .3rem; }
.quick-select-bar label { font-size: .78rem; color: var(--ink-faint); font-weight: 700; }
