/* PPTCraft — "Blueprint & Build"
   Brand concept: a presentation is a building — designed, scaffolded, and
   raised. Cool blueprint paper + a faint graph grid, blueprint-blue structure,
   construction-orange for action/active/AI moments, mono for drafting marks.
   Journey: ① materials → ② blueprint → ③ build → ④ topped-out.
   Fonts: Hanken Grotesk (display/UI) / Courier Prime (drafting numerals). */

:root {
  /* blueprint brand */
  --blueprint: #1d4e89;
  --blueprint-700: #143a6b;
  --blueprint-line: #9db8d8;
  --grid: rgba(29, 78, 137, 0.04);   /* very faint — blueprint as a whisper */
  /* near-white cool paper surface ladder (calm / minimal) */
  --canvas: #fbfcfd;
  --surface-1: #ffffff;
  --surface-2: #f1f4f8;
  --surface-3: #e9eef5;
  /* fine cool hairlines */
  --line: #e8edf3;
  --line-strong: #d2dce8;
  /* soft navy ink */
  --ink: #1a2740;
  --ink-muted: #2b3a52;
  --ink-subtle: #51607a;
  --ink-tertiary: #6b7993;
  /* signature accent — construction / crane orange: CTA, active, focus,
     selection, "under construction" + AI moments. The blueprint blue is the
     structure; the orange is the action. */
  --accent: #ec6a2c;
  --accent-hover: #d65a1f;
  --accent-soft: rgba(236, 106, 44, 0.13);
  --ok: #2e7d55;
  --danger: #c0392b;

  --font-display: "Hanken Grotesk", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-ui: "Hanken Grotesk", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "Courier Prime", ui-monospace, "SF Mono", Menlo, monospace;

  /* unified radius scale */
  --r-xs: 4px;    /* swatches, tags, frame-no */
  --r-sm: 8px;    /* buttons, inputs, tool buttons, small cards */
  --r-md: 10px;   /* panels, toolbars, modals, version cards */
  --r-lg: 16px;   /* large cards, canvas */
  --r-pill: 9999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

::selection { background: var(--accent-soft); }

body {
  /* calm cool paper; the blueprint grid lives only on the stage (drawing board) */
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: -0.05px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ───────────────────────── top bar ───────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 22px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; }

/* top nav (Workspace / History / Assets) */
.top-nav { display: flex; align-items: center; gap: 4px; }
.nav-tab {
  position: relative;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 500;
  color: var(--ink-tertiary);
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}
.nav-tab:hover { color: var(--ink); background: var(--surface-2); }
.nav-tab.on { color: var(--ink); }
.nav-tab.on::after {   /* drafting tab underline in construction orange */
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -10px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.brand-glyph { display: block; }
.topbar-logo { height: 30px; width: auto; display: block; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.4px;
}
.brand-divider { width: 1px; height: 18px; background: var(--line-strong); }
.brand-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-tertiary);
}

.topbar-center { text-align: center; min-width: 0; }
.deck-title {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 4px 14px;
  border-radius: var(--r-sm);
  outline: none;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-title { border: 1px solid transparent; }
.deck-title:hover { background: var(--surface-1); border-color: var(--line); }
.deck-title:focus { background: var(--surface-1); border-color: var(--accent); color: var(--ink); }

.topbar-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.ai-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-subtle);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-1);
}
.ai-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-tertiary); }
.ai-status.ok .dot { background: var(--ok); }
.ai-status.err .dot { background: var(--danger); }
.ai-status.err { color: var(--danger); }

/* ───────────────────────── buttons ───────────────────────── */

.btn {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid rgba(22, 36, 60, 0.4); outline-offset: 1px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; margin-top: 10px; }
.btn-mini { padding: 3px 10px; font-size: 12px; }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--ink-subtle);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }

/* Hand-drawn blueprint SVG icons. Keep them large enough for toolbar legibility. */
.ico { width: 22px; height: 22px; object-fit: contain; vertical-align: -6px; flex-shrink: 0; pointer-events: none; }
.btn > .ico { margin-right: 6px; }
.icon-btn > .ico, .tool-btn > .ico { width: 22px; height: 22px; vertical-align: middle; margin: 0; }
.mode-btn > .ico { width: 22px; height: 22px; }   /* gap handles spacing */

/* ───────────────────────── layout ───────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--left-w, 300px) 7px minmax(0, 1fr) 7px var(--right-w, 300px);
  flex: 1;
  min-height: 0;
}
/* draggable column dividers */
.col-resizer {
  cursor: col-resize;
  background: transparent;
  transition: background 0.12s ease;
}
.col-resizer:hover, .col-resizer.dragging { background: var(--accent-soft); }
body.col-resizing { cursor: col-resize; user-select: none; }

.sidebar {
  background: var(--canvas);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.rightbar {
  background: var(--canvas);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blueprint);
  margin-bottom: 10px;
}
.eyebrow-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.eyebrow-row .eyebrow { margin-bottom: 0; }

.gen-panel { padding: 16px; border-bottom: 1px solid var(--line); }
/* collapsible generate panel — fold the instruction area once slides exist */
.gen-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 0 0 12px;
  background: transparent; border: none; cursor: pointer; font: inherit;
}
.gen-toggle[hidden] { display: none; }
.gen-toggle .eyebrow { margin: 0; }
.gen-toggle .chev { color: var(--ink-tertiary); transition: transform 0.18s ease; }
.gen-panel:not(.collapsed) .gen-toggle .chev { transform: rotate(180deg); }
.gen-panel.collapsed .gen-toggle { padding-bottom: 0; }
.gen-panel.collapsed .gen-body { display: none; }
.panel { padding: 16px; border-bottom: 1px solid var(--line); }
.panel.grow { flex: 1; display: flex; flex-direction: column; min-height: 220px; }
.panel.grow .svg-code { flex: 1; }

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-ui);
  resize: vertical;
  transition: border-color 0.12s ease;
}
textarea::placeholder { color: var(--ink-tertiary); }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.controls-row { display: flex; gap: 10px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.grow { flex: 1; }
.field label { font-size: 11.5px; color: var(--ink-subtle); }
.field input[type="number"] { width: 64px; }

.gen-status {
  font-size: 12px; color: var(--ink-subtle);
  margin-top: 10px; min-height: 16px;
  white-space: pre-wrap; line-height: 1.5;
}

/* M3-11 联网研究 toggle */
.research-row {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm, 8px);
  background: var(--surface-1); cursor: pointer; font-size: 12px;
  color: var(--ink-muted); user-select: none;
}
.research-row:hover { border-color: var(--line-strong); }
.research-row input { accent-color: var(--accent); margin: 0; }
.research-label { flex: 1; }
.research-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .03em;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 1px 7px;
}
.gen-status.err { color: var(--danger); }

/* ── generation pipeline progress (M2-9/M2-10) ─────────────── */
.gen-progress { margin-top: 12px; }
.gp-stages {
  list-style: none; display: flex; align-items: center;
  margin: 0 0 9px; padding: 0;
}
.gp-stage {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  position: relative; font-size: 11px; color: var(--ink-tertiary);
  transition: color .2s;
}
.gp-stage + .gp-stage { margin-left: 9px; padding-left: 16px; }
.gp-stage + .gp-stage::before {              /* connector rail */
  content: ""; position: absolute; left: 0; top: 50%;
  width: 9px; height: 1px; background: var(--line-strong);
}
.gp-dot {                                     /* square = blueprint/brick */
  width: 8px; height: 8px; border-radius: 2px; flex: none;
  background: var(--line-strong); transition: background .2s;
}
.gp-count { font-variant-numeric: tabular-nums; color: var(--ink-subtle); }
.gp-stage.active { color: var(--ink); }
.gp-stage.active .gp-dot { background: var(--accent); animation: gp-pulse 1s ease-in-out infinite; }
.gp-stage.done { color: var(--ink-muted); }
.gp-stage.done .gp-dot { background: var(--accent); }
.gp-stage.error { color: var(--danger); }
.gp-stage.error .gp-dot { background: var(--danger); animation: none; }
@keyframes gp-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

.gp-bar {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
}
.gp-fill {
  height: 100%; width: 0; border-radius: 3px;
  background: repeating-linear-gradient(135deg, var(--accent) 0 7px, var(--accent-hover) 7px 14px);
  background-size: 28px 100%;
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.gen-progress.planning .gp-fill,
.gen-progress.building .gp-fill { animation: gp-march .6s linear infinite; }
.gen-progress.errored .gp-fill { background: var(--danger); animation: none; }
@keyframes gp-march { to { background-position: 28px 0; } }
@media (prefers-reduced-motion: reduce) {
  .gp-stage.active .gp-dot, .gp-fill { animation: none !important; }
}

/* ─────────────────────── film strip ─────────────────────── */

.film-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 16px 8px; }
.film-strip { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; }

.film-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  /* In the column-flex strip, without this the frames shrink to their
     (zero-height) SVG content and aspect-ratio never sets a height. */
  flex: 0 0 auto;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.film-frame:hover { border-color: var(--line-strong); }
.film-frame.active { border-color: var(--accent); }
.film-frame.active::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--r-md);
  box-shadow: inset 0 0 0 1px var(--accent);
  pointer-events: none;
}
.film-frame svg { width: 100%; height: 100%; display: block; background: #fff; }
.film-frame .frame-no {
  position: absolute; top: 6px; left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--blueprint);
  background: rgba(255, 255, 255, 0.82);
  padding: 1px 7px;
  border-radius: var(--r-xs);
  letter-spacing: 0.06em;
}
.film-frame.pending, .film-frame.error {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-tertiary); font-size: 12px;
  background:
    repeating-linear-gradient(-45deg, transparent 0 10px, rgba(22, 36, 60,0.03) 10px 20px),
    var(--surface-2);
}
.film-frame.pending .frame-label { animation: pulse 1.6s ease-in-out infinite; }
.film-frame.error {
  border-color: var(--danger); color: var(--danger);
  flex-direction: column; gap: 8px;
}
.frame-retry { pointer-events: auto; }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.film-tools { display: flex; gap: 4px; }

/* ───────────────────────── stage ───────────────────────── */

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  /* the drawing board: a whisper-faint blueprint grid + soft plot-glow */
  background:
    radial-gradient(ellipse 66% 50% at 50% 42%, rgba(29, 78, 137, 0.04), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 30px 30px,
    #fafcfe;
  overflow: hidden;
}
.canvas-empty { text-align: center; position: relative; z-index: 2; }
.empty-mark { margin-bottom: 16px; opacity: 0.9; }
.empty-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--ink-subtle);
}
.empty-hint { font-size: 12px; color: var(--ink-tertiary); margin-top: 8px; }

.canvas-wrap {
  /* The stage: the editorial artefact, lifted off the warm paper. */
  position: relative; z-index: 2;
  width: min(86%, 1080px);
  aspect-ratio: 16 / 9;
  background: #fff;
  border-radius: var(--r-sm);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 3px rgba(22, 36, 60, 0.05),
    0 18px 44px rgba(22, 36, 60, 0.08);
  overflow: hidden;
  transition: transform 0.15s ease;
  transform-origin: center center;
}
.svg-host, .svg-host svg { width: 100%; height: 100%; display: block; }
/* 拔地而起: the slide rises into place when shown */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.svg-host.rise { animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@media (prefers-reduced-motion: reduce) { .svg-host.rise { animation: none; } }

.svg-host text { cursor: text; }
.svg-host rect, .svg-host circle, .svg-host ellipse,
.svg-host path, .svg-host polygon, .svg-host line,
.svg-host image, .svg-host polyline { cursor: grab; }
.svg-host .sf-dragging { cursor: grabbing; }
.svg-host .sf-selected {
  outline: 1.5px solid var(--accent);
  outline-offset: 1px;
}

/* ─────────────────── stage toolbar / footer ─────────────────── */

.stage-toolbar {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  max-width: calc(100% - 32px); overflow-x: auto;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 0 2px 8px rgba(22, 36, 60, 0.06);
  z-index: 20;
}
.stage-toolbar[hidden] { display: none; }
.stage-toolbar::-webkit-scrollbar { height: 0; }
.tool-group { display: flex; align-items: center; gap: 4px; }
.tool-group[hidden] { display: none; }
.tool-group + .tool-group { border-left: 1px solid var(--line); padding-left: 10px; }

.tool-btn {
  min-width: 28px; height: 28px;
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0 6px;
}
.tool-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.tool-btn.on { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }

.tool-color {
  position: relative;
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  display: inline-block;
}
.tool-color input[type="color"] {
  position: absolute; inset: -4px;
  width: 36px; height: 36px;
  border: none; padding: 0; cursor: pointer; background: none;
}
.tool-color-stroke::after {
  content: "S";
  position: absolute; right: 1px; bottom: -1px;
  font-family: var(--font-mono);
  font-size: 8px; color: #fff;
  text-shadow: 0 0 2px #000;
  pointer-events: none;
}
.tool-hint { font-size: 11px; color: var(--ink-tertiary); padding-right: 2px; }
.tool-btn .material-symbols-outlined { font-size: 18px; }
.tool-btn i { font-style: italic; font-family: Georgia, serif; }
.tool-ico-label { color: var(--ink-tertiary); font-size: 18px !important; display: inline-flex; align-items: center; }
.tool-select {
  height: 28px; width: auto; min-width: 72px;
  padding: 0 6px; font-size: 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-1); color: var(--ink); cursor: pointer;
}
.tool-opacity { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-tertiary); }
.tool-opacity .material-symbols-outlined { font-size: 17px; }
.tool-opacity input[type="range"] {
  width: 66px; height: 4px; cursor: pointer; accent-color: var(--accent);
}
.tool-more-wrap { position: relative; }
.tool-more-pop {
  position: absolute; top: 44px; right: 0;
  display: flex; gap: 4px; padding: 5px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 6px 20px rgba(22, 36, 60, 0.12);
  z-index: 25;
}
.tool-more-pop[hidden] { display: none; }
#el-more.on { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }

/* one bottom row holds both bars as flex siblings so they can never overlap
   and steal each other's clicks (was: two absolute pills colliding mid-canvas) */
.stage-bottombar {
  position: absolute;
  left: 20px; right: 20px; bottom: 16px;
  display: flex; align-items: flex-end; gap: 12px;
  pointer-events: none;   /* empty middle must not block canvas drags */
  z-index: 20;
}
.stage-bottombar > * { pointer-events: auto; }

.stage-footer {
  margin-left: auto;   /* stays bottom-right even when the insert bar is hidden */
  display: flex; align-items: center; gap: 16px;
  height: 40px; padding: 0 14px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 0 2px 8px rgba(22, 36, 60, 0.06);
  z-index: 20;
}
.stage-footer[hidden] { display: none; }

/* ─────────────────── floating mode toolbar (Style/Type/Media/Present) ─────────────────── */

.stage-modes {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px;
  box-shadow: 0 4px 16px rgba(22, 36, 60, 0.08);
  z-index: 20;
}
.stage-modes[hidden] { display: none; }
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 500;
  color: var(--ink-subtle);
  background: transparent;
  border: none;
  border-radius: var(--r-pill);
  padding: 7px 14px 7px 12px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.mode-btn:hover { background: var(--surface-2); color: var(--ink); }
.mode-btn .material-symbols-outlined { font-size: 18px; }
.mode-btn.mode-present {
  background: var(--accent);
  color: #fff;
  padding-left: 14px;
}
.mode-btn.mode-present:hover { background: var(--accent-hover); color: #fff; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}
.zoom-ctl, .hist-ctl { display: flex; align-items: center; gap: 4px; }
.mono { font-family: var(--font-mono); font-size: 11px; color: var(--ink-subtle); letter-spacing: 0.04em; }
#zoom-label { min-width: 38px; text-align: center; }

/* ─────────────────── floating pops ─────────────────── */

.float-pop[hidden] { display: none; }
.float-pop {
  position: fixed;
  z-index: 60;
  display: flex; gap: 6px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px;
}
.float-pop input[type="text"] { width: 340px; }

/* ─────────────────── right bar bits ─────────────────── */

.row-btns { display: flex; gap: 8px; margin-top: 8px; }
.row-btns .btn { flex: 1; }

.svg-code {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
  min-height: 140px;
  color: var(--ink-muted);
}

/* ─────────────────── mode tabs ─────────────────── */

.mode-tabs {
  display: flex;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
  margin-bottom: 12px;
}
.mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-subtle);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 0;
  border-radius: var(--r-pill);
  cursor: pointer;
}
.mode-tab.on { background: var(--surface-3); color: var(--ink); }

/* ─────────────────── settings modal ─────────────────── */

.as-btn { cursor: pointer; font-family: var(--font-ui); }
.as-btn:hover { border-color: var(--line-strong); color: var(--ink); }

.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0;
  background: rgba(22, 36, 60, 0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  width: 420px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-family: var(--font-display); font-weight: 500; font-size: 15px; letter-spacing: -0.2px; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-body .field input, .modal-body .field select { width: 100%; }
.label-soft { color: var(--ink-tertiary); font-weight: 400; }
.modal-note { font-size: 11.5px; color: var(--ink-tertiary); line-height: 1.6; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end;
}

/* ─────────────────── style preview wall ─────────────────── */

.style-wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.style-card {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 10;
  background: #fff;
  padding: 0;
}
.style-card:hover { border-color: var(--line-strong); }
.style-card.on { border-color: var(--accent); }
.style-card svg { width: 100%; height: 100%; display: block; }
.style-card .sc-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 9px; line-height: 1;
  padding: 3px 4px;
  color: #fff;
  background: rgba(22, 36, 60, 0.62);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}

/* ─────────────────── resize handles ─────────────────── */

.resize-handles[hidden] { display: none; }
.resize-handles { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.rh {
  position: absolute;
  width: 10px; height: 10px;
  background: #fff;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.rh[data-corner="nw"], .rh[data-corner="se"] { cursor: nwse-resize; }
.rh[data-corner="ne"], .rh[data-corner="sw"] { cursor: nesw-resize; }

/* ─────────────────── play mode ─────────────────── */

.play-overlay[hidden] { display: none; }
.play-overlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.play-host {
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #fff;
}
.play-host svg { width: 100%; height: 100%; display: block; }
.play-hud {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 16px; align-items: center;
  color: #777;
  font-size: 12px;
  opacity: 0.85;
}
.play-hint { font-size: 11px; }
.play-exit {
  position: fixed; top: 20px; right: 22px; z-index: 220;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(20, 28, 44, 0.78);
  color: #fff; border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--r-pill); padding: 8px 16px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.12s ease;
}
.play-exit:hover { background: var(--accent); border-color: var(--accent); }

/* ─────────────────── film drag reorder ─────────────────── */

.film-frame.drag-over { border-color: var(--accent); border-style: dashed; }
.film-frame.dragging { opacity: 0.4; }

/* ─────────────────── Brand Kit (M2) ─────────────────── */

.brand-kit {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  overflow: hidden;
}
.brand-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px;
  cursor: pointer;
  list-style: none;
}
.brand-summary::-webkit-details-marker { display: none; }
.brand-summary .eyebrow { margin-bottom: 0; }
.brand-state {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.04em; color: var(--ink-tertiary);
}
.brand-state.set { color: var(--ok); }
.brand-body {
  padding: 0 13px 13px;
  display: flex; flex-direction: column; gap: 10px;
}
.brand-logo-row { display: flex; gap: 10px; }
.brand-logo {
  width: 64px; height: 64px; flex-shrink: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-tertiary);
  background: var(--surface-2);
  overflow: hidden;
}
.brand-logo:hover { border-color: var(--ink-subtle); color: var(--ink-subtle); }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-palette {
  flex: 1;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px;
}
.swatch {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  border: 1px solid rgba(22, 36, 60, 0.15);
  cursor: pointer; position: relative;
}
.swatch:hover::after {
  content: "✕"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; background: rgba(22, 36, 60, 0.45);
  border-radius: 5px;
}
.swatch-add {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  border: 1px dashed var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-tertiary); cursor: pointer; position: relative; overflow: hidden;
}
.swatch-add:hover { border-color: var(--ink-subtle); color: var(--ink-subtle); }
.swatch-add .material-symbols-outlined { font-size: 16px; }
.swatch-add input[type="color"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; border: none; padding: 0;
}
.brand-foot { display: flex; align-items: center; justify-content: space-between; }
.brand-apply {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-subtle); cursor: pointer;
}
.brand-apply input { width: auto; }

/* ─────────────────── Design Assistant chat (M3) ─────────────────── */

.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 320px; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.chat-head .eyebrow { margin-bottom: 0; }
.chat-session {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-tertiary);
}
.chat-session .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px 8px;
  min-height: 80px;
}
.chat-empty {
  font-size: 12.5px; color: var(--ink-tertiary); line-height: 1.7;
  margin: auto 0; text-align: center; padding: 12px;
}
.bubble {
  max-width: 88%;
  font-size: 13px; line-height: 1.55;
  padding: 9px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.bubble.pending { opacity: 0.7; font-style: italic; }
.bubble .b-when {
  display: block; margin-top: 5px;
  font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.04em; opacity: 0.6;
}

.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sugg {
  font-family: var(--font-ui);
  font-size: 11.5px; color: var(--ink-subtle);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 11px;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.sugg:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }

.btn-polish {
  margin-top: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-polish:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-polish .spark { flex-shrink: 0; }
.btn-polish .material-symbols-outlined { font-size: 18px; }

/* ── polish version gallery ── */
.polish-versions[hidden] { display: none; }
.polish-versions { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.polish-gallery { display: flex; flex-direction: column; gap: 8px; }
.pv-card {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 7px; cursor: pointer; background: var(--surface-1);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pv-card:hover { border-color: var(--line-strong); }
.pv-card.sel { border-color: var(--accent); background: var(--surface-2); }
.pv-thumb {
  width: 72px; aspect-ratio: 16/9; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: #fff;
}
.pv-thumb svg { width: 100%; height: 100%; display: block; }
.pv-meta { min-width: 0; flex: 1; }
.pv-title { font-size: 12.5px; font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.pv-score { font-family: var(--font-mono); font-size: 11px; color: var(--ink-subtle); }
.pv-tag { font-size: 9.5px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-subtle); }
.pv-tag.pass { background: rgba(58,125,68,0.14); color: var(--ok); }
.pv-issues { font-size: 11px; color: var(--ink-tertiary); margin-top: 3px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-card.sel .pv-title::after { content: "· 当前"; font-size: 10px; color: var(--accent); font-weight: 400; }

.polish-continue { display: flex; gap: 6px; margin-top: 10px; }
.polish-continue input { flex: 1; font-size: 12px; padding: 6px 10px; }

.chat-input-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-input-row textarea { flex: 1; resize: none; }
.chat-send {
  width: 38px; height: 38px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
}
.chat-send .material-symbols-outlined { font-size: 20px; }

/* restructured assistant: subtitle + big composer on top, log grows below */
.chat-head-text { min-width: 0; }
.assistant-subtitle { font-size: 11.5px; color: var(--ink-tertiary); line-height: 1.5; margin-top: 4px; }
.assistant-composer { position: relative; margin-bottom: 10px; }
.assistant-composer textarea { width: 100%; resize: none; padding-right: 46px; min-height: 104px; }
.assistant-composer .chat-send { position: absolute; right: 8px; bottom: 8px; }
.chat-suggest { margin: 0 0 12px; }

/* scope (本页 / 全部页) — applies to chat revise + polish */
.assistant-scope { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.scope-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-tertiary); margin-right: 2px;
}
.scope-btn {
  font-family: var(--font-ui); font-size: 12px; color: var(--ink-subtle);
  background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 12px; cursor: pointer; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.scope-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.scope-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.polish-standard { width: 100%; font-size: 12px; padding: 7px 10px; margin-bottom: 8px; }

/* canvas insert bar */
.stage-insert { gap: 8px; }
.insert-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-tertiary); padding: 0 4px 0 6px;
}

/* film-tools: page-ops live next to the slides now */
.icon-btn.icon-danger:hover { color: var(--danger); border-color: var(--danger); background: rgba(192, 57, 46, 0.08); }

/* export dropdown */
.export-menu { position: relative; }
.export-menu > summary { list-style: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-trigger { display: inline-flex; align-items: center; gap: 5px; }
.export-trigger[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.export-trigger .caret { font-size: 10px; opacity: 0.8; }
.export-pop {
  position: absolute; top: calc(100% + 8px); right: 0;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: 0 8px 28px rgba(22, 36, 60, 0.14);
  padding: 6px; min-width: 210px; z-index: 80;
}
.export-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: transparent; border: none; border-radius: var(--r-sm);
  padding: 8px 10px; cursor: pointer; text-align: left; font: inherit; width: 100%;
}
.export-option b { font-size: 13px; font-weight: 600; color: var(--ink); }
.export-option span { font-size: 11px; color: var(--ink-tertiary); }
.export-option:hover:not(:disabled) { background: var(--surface-2); }
.export-option:disabled { opacity: 0.4; cursor: not-allowed; }

/* dev mode (SVG source) */
.dev-hint { font-size: 11px; color: var(--ink-tertiary); }
.dev-body { padding: 0 16px 16px; }
.dev-body .svg-code { width: 100%; margin: 0 0 8px; }

.adv { padding: 0; }
.adv .adv-summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}
.adv .adv-summary::-webkit-details-marker { display: none; }
.adv .adv-summary .eyebrow { margin-bottom: 0; }
.adv[open] .adv-summary { border-bottom: 1px solid var(--line); }
.adv .svg-code { margin: 16px; width: calc(100% - 32px); }

/* ─────────────────── views: library + history timeline ─────────────────── */

.view-panel[hidden] { display: none; }
.view-panel {
  position: fixed;
  top: 52px; left: 0; right: 0; bottom: 0;
  background: var(--canvas);
  overflow-y: auto;
  z-index: 50;
}
.view-inner { max-width: 1100px; margin: 0 auto; padding: 56px 48px 80px; }
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 40px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.view-kicker {
  font-family: var(--font-ui);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-tertiary);
  margin-bottom: 8px;
}
.view-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.view-sub { font-size: 13px; color: var(--ink-subtle); }
.view-empty { font-size: 14px; color: var(--ink-tertiary); line-height: 1.7; }
.view-head .btn .material-symbols-outlined { font-size: 18px; margin-right: 4px; }

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}
.deck-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-1);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.deck-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 28px rgba(22, 36, 60, 0.10);
  transform: translateY(-2px);
}
.deck-card.current { border-color: var(--accent); }
.deck-cover { aspect-ratio: 16 / 9; background: #fff; border-bottom: 1px solid var(--line); }
.deck-cover svg { width: 100%; height: 100%; display: block; }
.deck-cover.blank {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-tertiary); font-family: var(--font-display); font-size: 22px;
}
.deck-meta { padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; position: relative; }
.deck-name {
  font-family: var(--font-display); font-size: 18px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.deck-info { font-family: var(--font-mono); font-size: 11px; color: var(--ink-tertiary); letter-spacing: 0.03em; }
.deck-del {
  position: absolute; top: 12px; right: 12px;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--surface-2);
  color: var(--ink-subtle); cursor: pointer;
  display: none; align-items: center; justify-content: center;
}
.deck-card:hover .deck-del { display: inline-flex; }
.deck-del:hover { color: var(--danger); border-color: var(--danger); }
.deck-del .material-symbols-outlined { font-size: 16px; }

.history-timeline { display: flex; flex-direction: column; gap: 0; }
.hist-node {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 20px; align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hist-thumb {
  width: 120px; aspect-ratio: 16 / 9;
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: #fff;
}
.hist-thumb svg { width: 100%; height: 100%; display: block; }
.hist-body { min-width: 0; }
.hist-label { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.hist-when { font-family: var(--font-mono); font-size: 11px; color: var(--ink-tertiary); letter-spacing: 0.03em; }
.hist-node.is-current .hist-label::after {
  content: "当前"; margin-left: 10px;
  font-family: var(--font-ui); font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; color: var(--ink-subtle);
  background: var(--surface-3); padding: 2px 7px; border-radius: var(--r-pill);
}

/* ─────────────────── toast ─────────────────── */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: #fff;
  padding: 11px 12px 11px 16px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 28px rgba(22, 36, 60, 0.22);
  max-width: 380px;
  animation: toast-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.toast-msg { line-height: 1.4; }
.toast-action {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.12s ease;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.16); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ─────────────────── scrollbars ─────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- login gate (Supabase Auth) ---------------------------------------- */
#auth-overlay{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;
  justify-content:center;background:var(--paper,#fbfcfd)}
#auth-overlay[hidden]{display:none}
.auth-card{width:340px;max-width:90vw;background:#fff;border:1px solid var(--line,#e3e9f1);
  border-radius:16px;padding:32px 28px;box-shadow:0 12px 40px rgba(22,36,60,.10);text-align:center}
.auth-logo{display:flex;align-items:center;justify-content:center;gap:9px;margin-bottom:2px;
  font-weight:800;font-size:20px;letter-spacing:-.4px;color:var(--ink,#16243c)}
.auth-logo-img{width:150px;height:auto;display:block}
.auth-sub{color:var(--faint,#6b7993);font-size:13px;margin:6px 0 22px}
.auth-btn{display:flex;align-items:center;justify-content:center;gap:9px;width:100%;
  font:inherit;font-size:14.5px;font-weight:600;padding:11px 14px;border-radius:10px;
  border:1px solid var(--blueprint,#1d4e89);background:var(--blueprint,#1d4e89);color:#fff;
  cursor:pointer;transition:.12s}
.auth-btn:hover{filter:brightness(1.07)}
.auth-btn:active{transform:translateY(1px)}
.auth-google{background:#fff;color:var(--ink,#16243c);border-color:var(--line2,#d2dce8)}
.auth-google:hover{background:#f6f8fb;filter:none}
.auth-or{display:flex;align-items:center;gap:10px;color:var(--faint,#6b7993);
  font-size:12px;margin:16px 0}
.auth-or::before,.auth-or::after{content:"";flex:1;height:1px;background:var(--line,#e3e9f1)}
.auth-input{width:100%;font:inherit;font-size:14px;padding:10px 12px;margin-bottom:10px;
  border:1px solid var(--line2,#d2dce8);border-radius:10px;background:#fff;color:var(--ink,#16243c)}
.auth-input:focus{outline:2px solid var(--blueprint,#1d4e89);outline-offset:0;border-color:transparent}
.auth-msg{font-size:12.5px;color:var(--faint,#6b7993);margin-top:12px;min-height:16px}
.auth-msg.err{color:#c0392b}
.auth-msg.ok{color:#1f8a55}

/* ---- account / quota panel --------------------------------------------- */
.acct-row{display:flex;justify-content:space-between;align-items:baseline;
  font-size:14px;color:var(--muted,#51607a);margin:14px 0 4px}
.acct-row b{color:var(--ink,#16243c);font-size:15px;font-variant-numeric:tabular-nums}
.acct-meter{height:6px;background:var(--line,#e3e9f1);border-radius:99px;overflow:hidden}
.acct-meter-fill{height:100%;background:var(--blueprint,#1d4e89);border-radius:99px;
  width:0;transition:width .3s}
.acct-meter-fill.low{background:var(--accent,#ec6a2c)}

/* ─────────────────── tactile polish pass ───────────────────
   MOTION 6: every control already has :hover but no press feedback. Give each
   clickable control a physical "push" on :active and tint the accent CTAs with
   a subtle drop shadow (tinted, not a glow — see the no-glow rule). Transform/
   box-shadow only, GPU-cheap. */
.btn, .icon-btn, .tool-btn, .mode-btn, .nav-tab, .sugg, .chat-send,
.export-option, .as-btn, .swatch-add, .toast-action, .play-exit {
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
              box-shadow 0.14s ease,
              transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled):not(.disabled),
.tool-btn:active:not(:disabled):not(.disabled),
.mode-btn:active, .nav-tab:active, .sugg:active,
.chat-send:active:not(:disabled), .export-option:active:not(:disabled),
.as-btn:active, .swatch-add:active, .toast-action:active, .play-exit:active {
  transform: translateY(0.5px) scale(0.975);
}

/* accent CTAs read as elevated, pressable surfaces (tinted to the orange hue) */
.btn-primary, .btn-polish, .chat-send {
  box-shadow: 0 1px 2px rgba(214, 90, 31, 0.20), 0 5px 14px rgba(214, 90, 31, 0.16);
}
.btn-primary:hover:not(:disabled), .btn-polish:hover:not(:disabled),
.chat-send:hover:not(:disabled) {
  box-shadow: 0 2px 4px rgba(214, 90, 31, 0.24), 0 9px 22px rgba(214, 90, 31, 0.20);
}
.btn-primary:disabled, .btn-polish:disabled, .chat-send:disabled { box-shadow: none; }
.export-menu.disabled .export-trigger { box-shadow: none; }

/* subtle hover-lift to match the tactile language (these had border-only hover) */
.film-frame, .pv-card {
  transition: border-color 0.12s ease, box-shadow 0.14s ease,
              transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.film-frame:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22, 36, 60, 0.07); }
.pv-card:hover { transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
  .film-frame:hover, .pv-card:hover,
  .btn:active, .icon-btn:active, .tool-btn:active, .mode-btn:active,
  .nav-tab:active, .sugg:active, .chat-send:active, .export-option:active,
  .as-btn:active, .swatch-add:active, .toast-action:active, .play-exit:active {
    transform: none;
  }
}

/* F1 数据图表 modal */
.chart-modal{width:min(720px,92vw)}
.chart-types{display:flex;gap:8px;margin-bottom:14px}
.chart-type{padding:7px 16px;border:1px solid var(--line);border-radius:8px;background:#fff;cursor:pointer;font-size:14px;color:var(--ink-muted)}
.chart-type.on{border-color:#1d4e89;color:#1d4e89;font-weight:600}
.chart-preview{border:1px solid var(--line);border-radius:8px;background:#fff;min-height:170px;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:6px}
.chart-preview svg{width:100%;height:auto;max-height:340px;display:block}

/* F2b 导入文档按钮 */
.import-link{margin-left:auto;font-size:12px;color:var(--blueprint);background:none;border:none;cursor:pointer;padding:4px 6px;white-space:nowrap}
.import-link:hover{color:var(--accent);text-decoration:underline}
.import-link + .import-link{margin-left:0}
.url-import-row{display:flex;gap:6px;margin:-4px 0 12px}
.url-import-row input{flex:1;min-width:0;font-size:12px;padding:6px 9px;border:1px solid var(--line);border-radius:var(--r-sm,8px);background:var(--surface-1);color:var(--ink)}
.url-import-row input:focus{outline:none;border-color:var(--accent)}

/* ===================================================================== */
/* F4 — 整册修改（Deck-level revise）入口按钮                              */
/* 风格对齐 .btn-polish：accent 描边 + outline 填充，区别于实心主操作。     */
/* ===================================================================== */
.btn-revise-deck {
  margin-top: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.btn-revise-deck:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-revise-deck:disabled { opacity: .55; cursor: not-allowed; }
.btn-revise-deck .material-symbols-outlined { font-size: 18px; }

/* ===== M2-12 演示库列表 · open affordance + keyboard focus ===== */
.deck-cover { position: relative; }
.deck-open {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: #fff;
  background: rgba(22, 36, 60, 0.42);
  opacity: 0; transition: opacity 0.14s ease;
  pointer-events: none;
}
.deck-open .material-symbols-outlined { font-size: 18px; }
.deck-card:hover .deck-open,
.deck-card:focus-visible .deck-open { opacity: 1; }
.deck-card.current .deck-open {
  background: color-mix(in srgb, var(--accent) 38%, transparent);
}
.deck-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
/* ===== /M2-12 演示库列表 ===== */

/* ===== M3-7 并排对比 + M3-9 锁定候选 ===== */

/* 画廊头部按钮组 */
.eyebrow-row .eyebrow-actions {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
}

/* 小卡上的锁定切换 */
.pv-lock {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  color: var(--ink-subtle); cursor: pointer;
  background: #fff; border: 1px solid var(--line, #d9e0ec);
  border-radius: var(--r-pill); padding: 3px 9px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pv-lock:hover { border-color: var(--accent); color: var(--accent); }
.pv-lock.on {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.pv-card.locked { box-shadow: inset 0 0 0 2px var(--accent); }
.pv-tag.locked { background: var(--accent-soft); color: var(--accent); }

/* 全屏并排对比 overlay */
.compare-overlay[hidden] { display: none; }
.compare-overlay {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(10, 14, 24, 0.82);
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column;
}
.compare-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  color: #fff;
}
.compare-title { font-family: var(--font-ui); font-size: 14px; font-weight: 600; }
.compare-exit {
  display: inline-flex; align-items: center; gap: 6px;
/* ===== F6 演讲者备注 + 演示者视图 + 计时 ===== */

/* 画布下方的备注折叠条 */
.notes-bar {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-1);
}
.notes-bar[hidden] { display: none; }
.notes-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  font-size: 12px; font-weight: 600; color: var(--ink-muted);
  cursor: pointer; list-style: none; user-select: none;
}
.notes-summary::-webkit-details-marker { display: none; }
.notes-summary .material-symbols-outlined { font-size: 18px; color: var(--ink-tertiary); }
.notes-hint { margin-left: auto; font-weight: 400; font-size: 11px; color: var(--ink-tertiary); }
.notes-input {
  width: 100%; box-sizing: border-box;
  min-height: 72px; resize: vertical;
  border: none; border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  padding: 10px 12px;
  font-family: var(--font-ui); font-size: 13px; line-height: 1.5;
  color: var(--ink); background: var(--surface-1);
}
.notes-input:focus { outline: none; background: #fff; }

/* 播放页：演示者视图开关按钮 */
.play-presenter-toggle {
  position: fixed; top: 20px; right: 132px; z-index: 220;
  background: rgba(20, 28, 44, 0.78);
  color: #fff; border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--r-pill); padding: 8px 16px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.12s ease;
}
.compare-exit:hover { background: var(--accent); border-color: var(--accent); }
.compare-grid {
  flex: 1 1 auto; overflow: auto;
  display: grid;
  grid-template-columns: repeat(var(--cmp-cols, 2), minmax(0, 1fr));
  gap: 18px; padding: 0 24px 24px;
  align-content: start;
}
.cmp-card {
  background: #fff; border-radius: var(--r-md);
  border: 2px solid transparent;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}
.cmp-card.sel { border-color: var(--accent); }
.cmp-card.locked { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28), inset 0 0 0 2px var(--accent); }
.cmp-preview {
  width: 100%; aspect-ratio: 16 / 9; background: #fff;
  border-bottom: 1px solid var(--line, #e6ebf3);
}
.cmp-preview svg { width: 100%; height: 100%; display: block; }
.cmp-meta { padding: 10px 12px 4px; }
.cmp-title {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  color: var(--ink, #1a2540);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.cmp-issues {
  margin-top: 4px; font-size: 11px; color: var(--ink-subtle);
  line-height: 1.4;
}
.cmp-actions {
  display: flex; gap: 8px; padding: 8px 12px 12px; margin-top: auto;
}
.cmp-actions .cmp-use { flex: 1 1 auto; }
.cmp-lock.on {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
@media (max-width: 760px) {
  .compare-grid { grid-template-columns: 1fr; }
}
/* ===== /M3-7 并排对比 + M3-9 锁定候选 ===== */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: background 0.12s ease;
}
.play-presenter-toggle:hover,
.play-presenter-toggle.on { background: var(--accent); border-color: var(--accent); }

/* 当开启演示者视图，主画布缩到一侧 */
.play-host.dimmed {
  width: min(58vw, calc((100vh - 220px) * 16 / 9));
  position: fixed; left: 3vw; top: 50%; transform: translateY(-50%);
}

/* 演示者面板（同窗右侧） */
.presenter-pane[hidden] { display: none; }
.presenter-pane {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 36vw; min-width: 360px; max-width: 560px;
  z-index: 210;
  display: flex; flex-direction: column; gap: 14px;
  padding: 64px 22px 22px;
  background: #11151d; color: #e7ecf3;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);
  cursor: default;
  overflow-y: auto;
}
.presenter-label {
  display: block;
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  color: #8b97aa; margin-bottom: 6px;
}
.presenter-main { display: flex; flex-direction: column; gap: 14px; }
.presenter-host {
  aspect-ratio: 16 / 9; width: 100%;
  background: #fff; border-radius: 6px; overflow: hidden;
}
.presenter-host svg { width: 100%; height: 100%; display: block; }
.presenter-side { display: flex; gap: 14px; }
.presenter-timer-box { flex: 0 0 auto; }
.presenter-timer {
  font-size: 30px; font-weight: 700; color: #fff; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.presenter-timer-ctl { display: flex; gap: 6px; margin-top: 8px; }
.presenter-timer-ctl .btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e7ecf3;
}
.presenter-timer-ctl .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}
.presenter-next { flex: 1 1 auto; min-width: 0; }
.presenter-next-host {
  aspect-ratio: 16 / 9; width: 100%;
  background: #fff; border-radius: 5px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.presenter-next-host svg { width: 100%; height: 100%; display: block; }
.presenter-end {
  color: #6b7993; font-size: 12px;
}
.presenter-notes { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.presenter-notes-body {
  flex: 1 1 auto; overflow-y: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px; line-height: 1.6; color: #d7deea;
  white-space: pre-wrap;
}
/* ===== /F6 ===== */

/* ===== M8-3: 加量包 / 升级套餐弹窗 ===== */
.topup-section-title {
  font-size: 13px; font-weight: 600; color: #9aa6b8;
  margin: 14px 0 8px; letter-spacing: .02em;
}
.topup-section-title:first-child { margin-top: 0; }
.topup-list { display: flex; flex-direction: column; gap: 8px; }
.topup-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; padding: 12px 14px;
}
.topup-item b { font-size: 15px; }
.topup-item span { font-size: 13px; color: #9aa6b8; }
/* ===== /M8-3 ===== */
/* ===== M3-2/M3-1: editable outline tree (text/tree view + add/del/drag) ===== */
.outline-view-toggle {
  display: inline-flex; gap: 2px; margin: 8px 0 6px;
  padding: 2px; border-radius: 8px;
  background: var(--surface-1); border: 1px solid var(--line);
}
.ov-tab {
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 12px; color: var(--ink-tertiary);
  padding: 4px 12px; border-radius: 6px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ov-tab:hover { color: var(--ink); }
.ov-tab.on { background: var(--surface-0, #fff); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 39, 64, 0.08); }

.outline-tree {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 360px; overflow-y: auto;
  padding: 4px 2px 2px;
}
.ol-page {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-1);
  padding: 8px 8px 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.ol-page.dragging { opacity: 0.5; }
.ol-page.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ol-head { display: flex; align-items: center; gap: 6px; }
.ol-handle { cursor: grab; color: var(--ink-tertiary); font-size: 12px; line-height: 1; user-select: none; padding: 0 2px; }
.ol-handle:active { cursor: grabbing; }
.ol-no {
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--ink-tertiary); min-width: 18px; text-align: right;
}
.ol-title {
  flex: 1 1 auto; min-width: 0;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; padding: 4px 6px;
}
.ol-title:hover { border-color: var(--line); }
.ol-title:focus { border-color: var(--accent); background: var(--surface-0, #fff); outline: none; }
.ol-del-page, .ol-del-bullet {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-tertiary); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 4px 6px; border-radius: 6px;
  opacity: 0.55; transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ol-del-page:hover, .ol-del-bullet:hover { opacity: 1; color: var(--accent); background: var(--accent-soft); }
.ol-bullets { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 0 24px; }
.ol-bullet { display: flex; align-items: center; gap: 6px; }
.ol-dot { color: var(--ink-tertiary); font-size: 12px; user-select: none; }
.ol-bullet-text {
  flex: 1 1 auto; min-width: 0;
  font: inherit; font-size: 12px; color: var(--ink-muted);
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; padding: 3px 6px;
}
.ol-bullet-text:hover { border-color: var(--line); }
.ol-bullet-text:focus { border-color: var(--accent); background: var(--surface-0, #fff); outline: none; }
.ol-add-bullet {
  align-self: flex-start; margin-top: 2px;
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 11px; color: var(--ink-tertiary);
  cursor: pointer; padding: 3px 6px; border-radius: 6px;
}
.ol-add-bullet:hover { color: var(--accent); background: var(--accent-soft); }
.ol-add-page {
  appearance: none; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--ink-subtle);
  border: 1px dashed var(--line-strong); border-radius: 10px;
  background: transparent; padding: 8px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ol-add-page:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* ===== /M3-2 outline tree ===== */
/* ===== M4-12: rich text editor (multi-line + selection styling) ===== */
/* Editor pop becomes a small column: textarea on top, hint + commit below. */
.float-pop-text {
  flex-direction: column;
  gap: 8px;
  width: 380px;
  max-width: calc(100vw - 24px);
}
.text-editor-area {
  width: 100%;
  min-height: 44px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2, #fff);
  color: inherit;
}
.text-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.text-editor-hint {
  font-size: 11px;
  line-height: 1.3;
  color: var(--ink-soft, #6b7993);
}
/* Align toolbar button: keep the material glyph centered like its siblings. */
#t-align .material-symbols-outlined { font-size: 20px; }
/* ===== /M4-12 ===== */
/* ===== M3-12 图库配图 (公共图库检索 + 版权免责确认) ===== */
.imagery-modal { width: min(760px, 94vw); }
.imagery-search { display: flex; gap: 8px; align-items: center; }
.imagery-source {
  flex: 0 0 auto; height: 34px; padding: 0 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: #d7deea; font-size: 13px;
}
.imagery-query {
  flex: 1 1 auto; height: 34px; padding: 0 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: #eef2f8; font-size: 13px;
}
.imagery-query:focus, .imagery-source:focus {
  outline: none; border-color: rgba(120,160,255,0.55);
}
.imagery-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  max-height: 52vh; overflow-y: auto; padding-right: 2px;
}
.imagery-cell {
  position: relative; padding: 0; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; overflow: hidden; cursor: pointer;
  background: rgba(255,255,255,0.03); aspect-ratio: 4 / 3;
}
.imagery-cell:hover { border-color: rgba(120,160,255,0.6); }
.imagery-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imagery-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 4px 6px; font-size: 10px; line-height: 1.3; color: #eef2f8;
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.imagery-status { font-size: 12.5px; color: var(--ink-tertiary); text-align: center; padding: 8px 0; }

.imagery-consent-modal { width: min(440px, 92vw); }
.imagery-consent-source { font-size: 13px; color: #eef2f8; font-weight: 500; }
.imagery-consent-text { font-size: 12.5px; line-height: 1.7; color: #c7d0de; }
.imagery-consent-text strong { color: #ffd9d2; }
.imagery-consent-check, .imagery-consent-remember {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: #d7deea; cursor: pointer;
}
.imagery-consent-check input, .imagery-consent-remember input {
  margin-top: 2px; flex: 0 0 auto;
}
.imagery-consent-check { font-weight: 500; }
/* ===== /M3-12 ===== */

/* ======================================================================== *
 * REDESIGN v1 (DESIGN-FINALIZED) — chrome refinement layer.
 * Implements REDESIGN-PLAN.md "DESIGN FINALIZED" spec ON TOP of the existing
 * frontend (override layer, so existing behaviour/markup is preserved):
 *   1. Color-role: orange = AI/generate + ONE primary per region; navy = ink,
 *      headings, active, secondary; 会员/PRO = navy-outline + glyph (never orange).
 *   2. Warm off-white chrome (#FAFBFD) shared with the slides.
 *   3. 8pt rhythm; tightened right panel; one type ramp + tracked eyebrows.
 *   4. "结构" system: drafting hairlines + faint blueprint texture + FIG./No.
 *   5. Componentised controls: segmented control, +-tag chips, preset cards,
 *      differentiated account meters, blueprint empty states.
 * ======================================================================== */
:root{
  /* warm off-white chrome — shift chrome to the slides' tone */
  --canvas:#fafbfd;
  --navy-line:#9db8d8;
  --warn:#c97a16;
  --warn-soft:rgba(201,122,22,.12);
  /* faint blueprint texture — navy ~3.5% isometric whisper for empty states */
  --blueprint-tex:
    linear-gradient(rgba(29,78,137,.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(29,78,137,.035) 1px, transparent 1px) 0 0 / 24px 24px;
}

/* ---- COLOR-ROLE re-audit: demote competing oranges to navy ----------- */
/* nav active underline: active = NAVY, not orange */
.nav-tab.on::after { background: var(--blueprint); }
/* film-frame active ring: selection/active = navy (orange reserved for AI/primary) */
.film-frame.active { border-color: var(--blueprint); }
.film-frame.active::after { box-shadow: inset 0 0 0 1px var(--blueprint); }
.film-frame.drag-over { border-color: var(--blueprint); }
/* style preset selected = navy */
.style-card.on { border-color: var(--blueprint); }
/* selection/resize handles stay orange (an in-canvas AI/edit affordance) */
/* mode-tabs active = navy ink, on a quieter track */
.deck-title:focus { border-color: var(--blueprint); color: var(--ink); }
textarea:focus, input:focus, select:focus {
  border-color: var(--navy-line);
  box-shadow: 0 0 0 3px rgba(29,78,137,.10);
}

/* ---- account chip (top bar): clickable pill + navy PRO badge + caret ---- */
.account-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 9px 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-1);
  color: var(--ink-muted);
}
.account-chip:hover { border-color: var(--navy-line); color: var(--ink); }
.account-chip .dot { display: none; }   /* old liveness dot — chip uses badge now */
.account-chip.err { color: var(--danger); border-color: rgba(192,57,46,.4); }
.plan-badge {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--blueprint);
  border: 1px solid var(--navy-line);
  border-radius: var(--r-xs);
  padding: 2px 5px; line-height: 1;
  white-space: nowrap;
}
.account-chip .acct-bal { font-size: 12.5px; color: inherit; font-variant-numeric: tabular-nums; }
.account-chip .acct-caret { color: var(--ink-tertiary); flex-shrink: 0; }

/* ---- tracked eyebrow on EVERY panel header (lift to faint, mono FIG.) --- */
.eyebrow { color: var(--ink-tertiary); letter-spacing: .2em; }

/* ---- left CTA: 生成演示 — the region's single orange, breathing room ----- */
.cost-line {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-subtle);
  margin: 12px 0 8px;
}
.cost-line b { color: var(--ink); font-weight: 600; }
.cost-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--navy-line); }
.btn-generate.btn-block { margin-top: 0; }

/* ---- 会员 / PRO badges: navy-outline, never orange --------------------- */
.research-badge {
  color: var(--blueprint);
  border-color: var(--navy-line);
}
.research-row input { accent-color: var(--blueprint); }

/* ---- RIGHT PANEL: tighten to the left's rhythm; segmented scope -------- */
.rightbar .chat-panel { padding: 20px 18px; }
.field-label {
  display: block;
  font-size: 11.5px; font-weight: 600; color: var(--ink-muted);
  margin: 0 0 8px;
}
/* one connected segmented scope control (navy active) */
.assistant-scope.segmented {
  display: flex; gap: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px;
  margin-bottom: 10px;
}
.assistant-scope.segmented .scope-btn {
  flex: 1;
  background: transparent; border: 0;
  border-radius: 6px;
  padding: 8px 0;
  font-size: 12.5px; font-weight: 500; color: var(--ink-subtle);
}
.assistant-scope.segmented .scope-btn:hover { color: var(--ink); background: transparent; }
.assistant-scope.segmented .scope-btn.on {
  background: var(--blueprint); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(29,78,137,.25);
}
/* +-prefixed lighter tag chips (distinct from the segmented control) */
.sugg .plus { color: var(--navy-line); font-weight: 700; margin-right: 3px; }
.scope-cost {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-subtle);
  margin: 2px 0 12px;
}

/* ---- 看图精修 vision card — secondary card pulled into the 8pt rhythm --- */
.vision-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
}
.vision-head { display: flex; align-items: center; gap: 8px; }
.vision-ico {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.vision-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.vision-exp { font-size: 11.5px; line-height: 1.55; color: var(--ink-subtle); margin: 8px 0 10px; }
.vision-card .polish-standard { margin-bottom: 10px; }
/* the single orange primary of THIS region — outline style (one solid orange
   per region; the editor-stage primary is 导出, so refine reads as outline) */
.vision-card .btn-polish {
  margin-top: 0;
  background: var(--surface-1);
  border: 1px solid var(--accent);
  color: var(--accent);
}
.vision-card .btn-polish:not(:disabled) { box-shadow: none; }
.vision-card .btn-polish:hover:not(:disabled) {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent);
  box-shadow: none;
}

/* dev mode (高级 · 源码视图) — demoted, off by default (already <details>) */
.adv.dev-mode .adv-summary .eyebrow { color: var(--ink-tertiary); }

/* ---- ACCOUNT / QUOTA MODAL: differentiated meters, navy bars, warn tint - */
.acct-body { gap: 4px; }
.acct-plan-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 14px; border-bottom: 1px solid var(--line);
}
.acct-k { font-size: 13px; color: var(--ink-subtle); }
#acct-tier.plan-badge { font-size: 11px; letter-spacing: .16em; }
.acct-meter-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.acct-meter-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 9px;
}
.acct-meter-lab { display: flex; align-items: center; gap: 8px; }
.acct-meter-ico {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ico-credit { background: rgba(29,78,137,.10); color: var(--blueprint); }
.ico-deck { background: rgba(29,78,137,.10); color: var(--blueprint); }
.acct-meter-t { font-size: 13px; font-weight: 600; color: var(--ink); display: block; }
.acct-meter-sub {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-tertiary); display: block; margin-top: 1px;
}
.acct-num { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.acct-meter-block .acct-meter { height: 7px; }
.acct-meter-fill { background: var(--blueprint); }
/* warning tint when the deck quota is low (JS toggles .low on the bar) */
.acct-warn-note {
  display: none; align-items: center; gap: 6px;
  font-size: 11px; color: var(--warn); margin-top: 8px;
}
#acct-decks-block:has(.acct-meter-fill.low) .ico-deck { background: var(--warn-soft); color: var(--warn); }
#acct-decks-block:has(.acct-meter-fill.low) .acct-meter-fill.low { background: var(--warn); }
#acct-decks-block:has(.acct-meter-fill.low) .acct-warn-note { display: flex; }
.acct-explain { padding-top: 14px; }

/* ---- EMPTY STATES (History / Assets): centered blueprint block --------- */
.view-panel { background: var(--canvas); }
.view-empty.empty-block {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  max-width: 460px; margin: 8vh auto 0;
  position: relative;
}
.empty-rule {
  width: 100%; max-width: 460px;
  display: flex; align-items: center; gap: 14px; color: var(--ink-tertiary);
}
.empty-rule .l { flex: 1; height: 1px; background: var(--line-strong); }
.empty-rule .lab {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase;
}
.empty-block .iso-illo { margin: 30px 0 26px; }
.empty-block .empty-eh { font-size: 21px; font-weight: 600; letter-spacing: -.3px; color: var(--ink); }
.empty-block .empty-helper { font-size: 13.5px; line-height: 1.7; color: var(--ink-subtle); margin: 12px 0 32px; }

/* ---- STAGE / chrome: warm off-white shared with slides ----------------- */
.canvas-empty .empty-title { color: var(--ink-subtle); }

/* retire the redundant deck-revise button entirely (merged into scope) */
.btn-revise-deck[hidden] { display: none !important; }

/* ---- one-time canvas coachmark ---------------------------------------- */
.canvas-coachmark[hidden] { display: none; }
.canvas-coachmark {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%);
  z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  max-width: min(440px, 86%);
  padding: 12px 18px 14px;
  background: var(--ink); color: #fff;
  border-radius: var(--r-md);
  box-shadow: 0 10px 30px rgba(22,36,60,.28);
  text-align: center;
  animation: toast-in .22s cubic-bezier(.2,.8,.2,1);
}
.canvas-coachmark::after {
  content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--ink); border-radius: 2px;
}
.canvas-coachmark .cm-eyebrow {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--navy-line);
}
.canvas-coachmark .cm-body { font-size: 12.5px; line-height: 1.5; color: #eef2f8; }
.canvas-coachmark .cm-body b { color: #fff; font-weight: 600; }
.canvas-coachmark .cm-dismiss {
  margin-top: 6px;
  font: 600 12px/1 var(--font-ui); color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--r-pill); padding: 5px 14px; cursor: pointer;
  transition: background .12s ease; position: relative; z-index: 1;
}
.canvas-coachmark .cm-dismiss:hover { background: rgba(255,255,255,.24); }
/* ===== /REDESIGN v1 ===== */
