/* =========================================================
   viaim Brand OS · 应用样式
   设计语言沿用 PRD：editorial paper tone + Geist mono accents
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  --paper: #f7f5f0;
  --paper-soft: #f4f3ee;
  --card: #ffffff;
  --ink: #18181b;
  --ink-soft: #3f3f46;
  --ink-mid: #52525b;
  --ink-mute: #71717a;
  --hint: #a1a1aa;
  --line: #d4d4d8;
  --line-soft: #e4e4e7;
  --bg-soft: #f4f3ee;
  --bg-softer: #ecebe5;
  --accent: #b8410c;
  --accent-soft: #fef3ec;
  --accent-line: #fed7aa;
  --green: #4d7c0f;
  --green-soft: #f7fee7;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --blue: #1e40af;
  --blue-soft: #eff6ff;
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --shadow-pop: 0 8px 28px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Geist', -apple-system, system-ui, "PingFang SC", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'Geist Mono', monospace; font-feature-settings: "ss01"; letter-spacing: -0.005em; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ========== APP SHELL ========== */
.shell {
  display: grid;
  grid-template-columns: 64px 220px 1fr;
  min-height: 100vh;
}

/* ---- Icon rail (workspace switcher) ---- */
aside.rail {
  background: var(--paper-soft);
  border-right: 1px solid var(--line-soft);
  padding: 18px 0 18px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  position: sticky; top: 0; height: 100vh;
}
.rail-tile {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .14s;
  background: transparent;
}
.rail-tile.placeholder { opacity: .55; }
.rail-tile.active { border-color: transparent; background: transparent; }
.rail-tile.active::before {
  content: ''; position: absolute; left: 0; width: 3px; height: 24px;
  background: var(--ink); border-radius: 0 2px 2px 0;
  transform: translateX(-14px);
}
.rail-tile { position: relative; }
.rail-tile:hover { background: var(--bg-softer); }
.rail-square {
  width: 22px; height: 22px;
  background: var(--ink);
  border-radius: 4px;
}
.rail-square.sm { width: 18px; height: 18px; background: var(--ink-soft); border-radius: 3px; }
.rail-foot { margin-top: auto; }
.rail-add {
  width: 30px; height: 30px;
  border: 1px dashed var(--line);
  background: transparent;
  border-radius: 6px;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 15px;
  font-weight: 300;
}
.rail-add:hover { border-color: var(--ink-mute); color: var(--ink); }

/* ---- Main nav ---- */
aside.nav {
  border-right: 1px solid var(--line-soft);
  padding: 18px 12px 18px;
  background: var(--paper);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}

.nav-head { padding: 8px 8px 16px; }
.nav-eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px; letter-spacing: .08em;
  color: var(--ink-mute); text-transform: uppercase;
}
.nav-eyebrow .badge.red {
  background: #dc2626; color: #fff;
  border-radius: 999px;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0;
}

.nav-section {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-mute);
  padding: 24px 10px 8px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 6px;
  color: var(--ink-soft); font-size: 12px;
  cursor: pointer; user-select: none;
  transition: all .1s; text-decoration: none;
  font-weight: 400;
}
.nav-link .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link .cnt {
  font-size: 10px; color: var(--ink-mute);
  flex-shrink: 0;
}
.nav-link .cnt.red {
  background: #dc2626; color: #fff;
  border-radius: 999px;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600;
}
.nav-link:hover { background: var(--bg-soft); color: var(--ink); }
.nav-link:hover .cnt { color: var(--ink-mid); }
.nav-link.active { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line-soft); }
.nav-link.active .cnt { color: var(--ink-mid); }
.nav-link.sub { padding: 6px 12px; font-size: 11px; color: var(--ink-mute); }
.nav-link.sub .cnt { font-size: 10px; }

.recent-row {
  padding: 6px 12px; font-size: 11px;
  color: var(--ink-mid); cursor: pointer;
  border-radius: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-row:hover { background: var(--bg-soft); color: var(--ink); }

.nav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 2px; }
.cmdk-hint {
  margin-top: 8px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; font-size: 11px; color: var(--ink-mute);
  background: var(--bg-soft); border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line-soft); user-select: none;
}
.cmdk-hint:hover { background: var(--bg-softer); color: var(--ink); }
.cmdk-hint .kbd { font-family: 'Geist Mono', monospace; font-size: 9.5px; padding: 1px 5px; background: var(--card); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); }

/* ========== MAIN ========== */
main.main { padding: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--line-soft);
  background: var(--paper); position: sticky; top: 0; z-index: 50;
  min-height: 64px;
}
.topbar-title {
  font-size: 21px; font-weight: 500; letter-spacing: -.015em;
  color: var(--ink); margin: 0;
}
.topbar-meta {
  font-size: 10.5px; color: var(--ink-mute);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: .02em;
}
.topbar-meta .sep { color: var(--hint); }
.topbar-meta b { color: var(--ink); font-weight: 500; }
.topbar-meta .lock-on { color: var(--green); }
.topbar-meta .lock-off { color: var(--amber); }
.topbar-meta select {
  font-family: 'Geist Mono', monospace; font-size: 10px;
  padding: 3px 6px; background: transparent;
  border: 1px solid var(--line); border-radius: 4px; color: var(--ink);
  cursor: pointer; outline: none;
}
.topbar-meta .lang-toggle {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; letter-spacing: .04em;
  padding: 3px 8px; background: transparent;
  border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink-mute); cursor: pointer; outline: none;
  display: inline-flex; align-items: center; gap: 5px;
}
.topbar-meta .lang-toggle .on { color: var(--ink); font-weight: 600; }
.topbar-meta .lang-toggle .slash { color: var(--hint); }
.topbar-meta .lang-toggle:hover { border-color: var(--ink-mute); }

.page { padding: 30px 40px 76px; max-width: 1280px; width: 100%; }
.page-head { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); position: relative; min-height: 24px; }
.page-head h1 { font-size: 19px; font-weight: 500; letter-spacing: -.015em; line-height: 1.25; margin-bottom: 4px; }
.page-head .lead { font-size: 12px; color: var(--ink-mute); max-width: 720px; line-height: 1.55; padding-right: 220px; }
.page-head .actions { position: absolute; right: 0; top: 0; display:flex; gap: 8px; align-items:center; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 56px 200px 1fr; }
  .page { padding: 22px 22px 80px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  aside.rail { display: none; }
  aside.nav { position: relative; height: auto; padding: 12px; }
  .topbar { padding: 12px 16px; }
  .page { padding: 18px 14px 80px; }
}

/* ========== COMMON COMPONENTS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 12px; font-weight: 500;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-soft);
  transition: all .12s; cursor: pointer;
}
.btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--ink-mute); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; color: #fff; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { background: #9c370a; color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.tag {
  display: inline-block; padding: 2px 7px;
  border: 1px solid var(--line); border-radius: 3px;
  font-family: 'Geist Mono', monospace; font-size: 9px;
  color: var(--ink-mute); background: var(--paper-soft);
}
.tag.p0 { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tag.green { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.tag.amber { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }
.tag.red { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.tag.blue { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.card.flat { box-shadow: none; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 500; color: var(--ink-mid); margin-bottom: 5px; font-family: 'Geist Mono', monospace; text-transform: uppercase; letter-spacing: .04em; }
.field .hint { display: block; font-size: 10.5px; color: var(--ink-mute); margin-top: 4px; line-height: 1.5; }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 10px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--ink); outline: none; transition: border .12s;
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,65,12,.12); }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-row.four { grid-template-columns: repeat(4, 1fr); }

table.spec { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; font-size: 12px; margin: 12px 0 18px; }
table.spec th { background: var(--bg-soft); text-align: left; padding: 9px 14px; font-family: 'Geist Mono', monospace; font-size: 9.5px; text-transform: uppercase; color: var(--ink-mute); letter-spacing: .06em; font-weight: 500; border-bottom: 1px solid var(--line-soft); }
table.spec td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--ink-soft); }
table.spec tr:last-child td { border-bottom: none; }
table.spec td b { color: var(--ink); }

.callout { background: var(--bg-soft); border-left: 3px solid var(--accent); padding: 13px 16px; border-radius: 0 6px 6px 0; margin: 14px 0; font-size: 12px; color: var(--ink-soft); }
.callout.green { border-left-color: var(--green); background: var(--green-soft); }
.callout.amber { border-left-color: var(--amber); background: var(--amber-soft); }
.callout.red { border-left-color: var(--red); background: var(--red-soft); }
.callout.blue { border-left-color: var(--blue); background: var(--blue-soft); }
.callout b { color: var(--ink); }

code.inline { font-family: 'Geist Mono', monospace; font-size: 11px; background: var(--bg-soft); padding: 1px 6px; border-radius: 3px; color: var(--ink); border: 1px solid var(--line-soft); }

.empty {
  border: 1px dashed var(--line); border-radius: 8px;
  padding: 38px 20px; text-align: center; color: var(--ink-mute);
  background: var(--paper-soft);
}
.empty .icon { font-size: 21px; margin-bottom: 8px; opacity: .6; }
.empty .title { font-size: 13px; color: var(--ink); font-weight: 500; margin-bottom: 4px; }

/* ========== BRAND SOURCE ========== */
.section-grid { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.section-grid .left { position: sticky; top: 80px; }
.section-grid .nav-list { display: flex; flex-direction: column; gap: 2px; }
.section-grid .nav-list a { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; font-size: 12px; color: var(--ink-mid); border-radius: 5px; cursor: pointer; }
.section-grid .nav-list a:hover { background: var(--bg-soft); color: var(--ink); }
.section-grid .nav-list a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.section-grid .nav-list a .num { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--hint); width: 22px; }
.section-grid .nav-list a.active .num { color: var(--accent); }

.brand-section { margin-bottom: 36px; }
.brand-section .head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line-soft); }
.brand-section h3 { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.brand-section .sub { font-size: 11px; color: var(--ink-mute); margin-top: 4px; line-height: 1.5; }

.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 8px; }
.color-card { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--card); }
.color-card .swatch { width: 36px; height: 36px; border-radius: 5px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.color-card .meta { flex: 1; min-width: 0; }
.color-card .meta .name { font-size: 11px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.color-card .meta .hex { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--ink-mute); }
.color-card .meta .role { font-size: 9.5px; color: var(--ink-mute); margin-top: 2px; }
.color-card .del { color: var(--ink-mute); border: none; background: transparent; font-size: 11px; padding: 4px; }
.color-card .del:hover { color: var(--red); }

.token-add-row {
  display: grid; grid-template-columns: 1fr 1.2fr 1.4fr auto; gap: 8px;
  margin-top: 10px; padding: 10px; background: var(--bg-soft); border-radius: 6px; border: 1px solid var(--line-soft);
}

.scale-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scale-pill { display:inline-flex; align-items:center; gap:4px; padding: 4px 8px; border: 1px solid var(--line); background: var(--card); border-radius: 4px; font-family: 'Geist Mono', monospace; font-size: 11px; }
.scale-pill button { background: transparent; border: none; color: var(--ink-mute); font-size: 10px; padding: 0; cursor: pointer; }
.scale-pill button:hover { color: var(--red); }

/* ========== BRAND SPEC VIEW · 已发布版本只读 ========== */
.spec-meta {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 18px; margin-bottom: 22px;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 6px 24px;
}
.spec-meta-row { display: flex; gap: 10px; font-size: 11.5px; }
.spec-meta-row .k {
  font-family: 'Geist Mono', monospace; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .04em; font-size: 9.5px;
  width: 76px; flex-shrink: 0; padding-top: 2px;
}
.spec-meta-row .v { color: var(--ink); flex: 1; }

.spec-doc {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 28px 36px 36px;
}

.spec-block {
  padding: 22px 0;
  border-bottom: 1px dashed var(--line-soft);
  position: relative;
}
.spec-block:last-of-type { border-bottom: none; }
.spec-num {
  font-size: 9.5px; color: var(--accent);
  letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 4px;
}
.spec-h {
  font-size: 17px; font-weight: 500; letter-spacing: -.01em;
  color: var(--ink); margin-bottom: 14px;
}
.spec-body { font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; }
.spec-section-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 14px 0 8px;
}
.spec-quote {
  font-size: 14px; line-height: 1.7;
  color: var(--ink); padding: 12px 16px;
  background: var(--bg-soft); border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.spec-kv-row {
  display: flex; flex-wrap: wrap; gap: 18px;
  padding: 8px 0;
}
.spec-kv-row > div { display: inline-flex; align-items: baseline; gap: 8px; }
.spec-kv-row .k {
  font-size: 9.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .04em;
}
.spec-kv-row .v { color: var(--ink); font-size: 12.5px; }
.spec-pre {
  background: var(--bg-soft); padding: 8px 12px;
  border-radius: 4px; font-family: 'Geist Mono', monospace;
  font-size: 10.5px; color: var(--ink); line-height: 1.6;
  white-space: pre-wrap; border: 1px solid var(--line-soft);
}

.spec-color-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.spec-color {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid var(--line-soft); border-radius: 6px;
  background: var(--paper-soft);
}
.spec-color .swatch {
  width: 38px; height: 38px; border-radius: 5px;
  flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.spec-color .meta { min-width: 0; }
.spec-color .name { font-size: 11.5px; font-weight: 500; color: var(--ink); }
.spec-color .hex { font-size: 10px; color: var(--ink-mute); }
.spec-color .role { font-size: 9.5px; color: var(--ink-mute); margin-top: 1px; }
.spec-aliases {
  margin-top: 10px; font-size: 10.5px; color: var(--ink-mute);
}
.spec-aliases .k { color: var(--ink); }

.spec-scale {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 6px 0; align-items: flex-end;
}
.spec-scale-cell { text-align: center; }
.spec-scale-cell .demo { color: var(--ink); line-height: 1; }
.spec-scale-cell .num { font-size: 9.5px; color: var(--ink-mute); margin-top: 4px; }

.spec-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-flat {
  padding: 3px 9px; border: 1px solid var(--line);
  background: var(--card); border-radius: 4px;
  font-size: 11px; color: var(--ink);
}

.spec-spacing-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 0;
}
.spec-spacing-cell {
  display: flex; align-items: center; gap: 12px;
}
.spec-spacing-cell .bar {
  height: 14px; background: var(--accent-soft);
  border-left: 2px solid var(--accent);
}
.spec-spacing-cell .num { font-size: 9.5px; color: var(--ink-mute); }

.spec-comp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.spec-comp {
  padding: 12px 14px; background: var(--paper-soft);
  border: 1px solid var(--line-soft); border-radius: 6px;
}
.spec-comp .name {
  font-size: 11px; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px dashed var(--line-soft);
}
.spec-comp .kv { display: flex; justify-content: space-between; padding: 2px 0; font-size: 10.5px; }
.spec-comp .kv .k { color: var(--ink-mute); }
.spec-comp .kv .v { color: var(--ink); }

.spec-do-dont {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.spec-do-dont .col {
  padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line-soft);
}
.spec-do-dont .col.do { background: var(--green-soft); }
.spec-do-dont .col.dont { background: var(--red-soft); }
.spec-do-dont .head {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 6px;
}
.spec-do-dont .col.do .head { color: var(--green); }
.spec-do-dont .col.dont .head { color: var(--red); }
.spec-do-dont ul { padding-left: 18px; font-size: 12px; line-height: 1.7; color: var(--ink); }
.spec-do-dont ul li.empty { color: var(--hint); list-style: none; padding-left: 0; }

.spec-dont-list { display: flex; flex-direction: column; gap: 8px; }
.spec-dont-row {
  padding: 10px 14px;
  background: var(--red-soft);
  border-left: 2px solid var(--red);
  border-radius: 0 4px 4px 0;
}
.spec-dont-row .rule { color: var(--ink); font-weight: 500; font-size: 12.5px; }
.spec-dont-row .reason { color: var(--ink-mute); font-size: 11px; margin-top: 3px; }

.spec-foot {
  margin-top: 30px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  text-align: center; color: var(--ink-mute);
  font-size: 10px;
}

/* ========== VALUE STEPS · §15 ========== */
.value-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 8px 0;
}
.value-step {
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
}
.value-step-num {
  font-size: 9.5px; color: var(--accent);
  letter-spacing: .08em; margin-bottom: 6px;
}
.value-step-title {
  font-size: 13px; color: var(--ink);
  margin-bottom: 6px; line-height: 1.4;
}
.value-step-detail {
  font-size: 11.5px; color: var(--ink-mute);
  line-height: 1.55;
}

/* ========== USERS · PERSONA EDITOR ========== */
.persona-section-head {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 18px 0 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
}
.persona-section-head:first-child { border-top: none; padding-top: 0; }

.persona-card {
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 14px 16px;
  margin-bottom: 10px;
}
.persona-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.persona-tag {
  font-size: 9px; color: var(--accent);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; background: var(--accent-soft);
  border-radius: 3px; border: 1px solid var(--accent-line);
}

/* ========== USERS · SPEC VIEW ========== */
.spec-persona {
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 16px 18px;
  margin-bottom: 12px;
}
.spec-persona-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-soft);
}
.spec-persona-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.spec-persona-age {
  font-size: 10.5px; color: var(--ink-mute);
  padding: 2px 6px; background: var(--card);
  border-radius: 3px; border: 1px solid var(--line-soft);
}
.spec-persona-desc {
  font-size: 12.5px; color: var(--ink); line-height: 1.6;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.spec-persona-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 18px;
}
.spec-persona-col .head {
  font-size: 9.5px; color: var(--ink-mute);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 5px;
}
.spec-persona-col ul {
  padding-left: 16px; font-size: 11.5px;
  color: var(--ink-soft); line-height: 1.6;
  list-style: disc;
}
.spec-persona-col ul.pills {
  padding-left: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.spec-persona-col ul.pills li {
  font-size: 10.5px; padding: 2px 8px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 12px; color: var(--ink);
}

/* ========== SPEC EXPORT PREVIEW MODAL ========== */
.spec-preview-tabs {
  display: inline-flex; gap: 4px;
  padding: 2px; background: var(--card);
  border: 1px solid var(--line-soft); border-radius: 5px;
}
.spec-tab {
  padding: 5px 12px; font-size: 11px;
  background: transparent; border: none;
  color: var(--ink-mute); cursor: pointer;
  border-radius: 4px; font-family: inherit;
}
.spec-tab:hover { color: var(--ink); }
.spec-tab.active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 500;
}

.spec-preview-rendered {
  padding: 28px 36px 36px;
  background: var(--card);
  font-size: 13px; line-height: 1.7;
  color: var(--ink);
  font-family: 'Geist', sans-serif;
}
.spec-preview-rendered h1 { font-size: 22px; font-weight: 500; letter-spacing: -.015em; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.spec-preview-rendered h2 { font-size: 17px; font-weight: 500; margin: 24px 0 10px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.spec-preview-rendered h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.spec-preview-rendered h4 { font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.spec-preview-rendered p { margin: 6px 0; color: var(--ink-soft); }
.spec-preview-rendered ul { padding-left: 20px; margin: 6px 0; }
.spec-preview-rendered li { font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; }
.spec-preview-rendered hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.spec-preview-rendered blockquote {
  border-left: 2px solid var(--accent); padding: 6px 12px;
  background: var(--bg-soft); margin: 8px 0;
  color: var(--ink); border-radius: 0 4px 4px 0;
  font-size: 13px; line-height: 1.6;
}
.spec-preview-rendered code {
  font-family: 'Geist Mono', monospace;
  font-size: 11px; background: var(--bg-soft);
  padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--line-soft);
}
.spec-preview-rendered pre.md-code {
  background: #18181b; color: #e4e4e7;
  border-radius: 6px; padding: 12px 14px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px; line-height: 1.65;
  overflow-x: auto; margin: 10px 0;
}
.spec-preview-rendered pre.md-code code {
  background: transparent; border: none;
  padding: 0; color: inherit;
}
.spec-preview-rendered table.md-table {
  width: 100%; border-collapse: collapse;
  margin: 12px 0; font-size: 12px;
  border: 1px solid var(--line-soft);
}
.spec-preview-rendered table.md-table th {
  background: var(--bg-soft); text-align: left;
  padding: 8px 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-mute);
  border-bottom: 1px solid var(--line-soft);
}
.spec-preview-rendered table.md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft); vertical-align: top;
}
.spec-preview-rendered table.md-table tr:last-child td { border-bottom: none; }
.spec-preview-rendered a { color: var(--accent); text-decoration: none; }
.spec-preview-rendered a:hover { text-decoration: underline; }
.spec-preview-rendered strong { color: var(--ink); font-weight: 600; }
.spec-preview-rendered em { color: var(--ink); font-style: italic; }

.spec-preview-raw {
  margin: 0; padding: 18px 22px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px; line-height: 1.7;
  color: var(--ink); background: var(--bg-soft);
  white-space: pre-wrap; word-break: break-word;
  border: 0;
}

/* ========== ASSETS ========== */
.assets-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.assets-toolbar select, .assets-toolbar input {
  padding: 6px 10px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--card); font-size: 11.5px; outline: none;
}
.assets-toolbar input.search { width: 240px; }
.assets-toolbar .grow { flex: 1; }

.assets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.asset-card { background: var(--card); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; cursor: pointer; transition: all .12s; }
.asset-card:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.asset-card .thumb { width: 100%; aspect-ratio: 1.2/1; background: var(--bg-softer); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-card .thumb .ph { color: var(--hint); font-family: 'Geist Mono', monospace; font-size: 10px; }
.asset-card .meta { padding: 8px 10px; }
.asset-card .meta .name { font-size: 11px; font-weight: 500; color: var(--ink); overflow:hidden; white-space: nowrap; text-overflow: ellipsis; }
.asset-card .meta .tax { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.asset-card .meta .tax .t { font-family: 'Geist Mono', monospace; font-size: 9px; color: var(--ink-mute); padding: 1px 5px; background: var(--bg-soft); border-radius: 3px; }

.upload-area {
  border: 2px dashed var(--line); border-radius: 10px;
  padding: 32px; text-align: center; background: var(--paper-soft);
  cursor: pointer; transition: all .15s;
}
.upload-area.drag { border-color: var(--accent); background: var(--accent-soft); }
.upload-area .big { font-size: 12px; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.upload-area .small { font-size: 11px; color: var(--ink-mute); }

/* ========== STUDIO ========== */
.tab-bar { display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line-soft); margin-bottom: 24px; padding: 0 4px; position: relative; }
.tab-btn {
  padding: 12px 0; font-size: 13px; color: var(--ink-mute);
  background: transparent; border: none; border-bottom: 2px solid transparent;
  font-weight: 400; transition: all .12s; letter-spacing: -.005em;
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: -1px;
}
.tab-btn .lvl { font-family: 'Geist Mono', monospace; font-size: 11px; color: inherit; opacity: .6; letter-spacing: 0; }
.tab-btn .lab-cn {
  font-size: 10.5px;
  color: var(--ink-mute);
  margin-left: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--line-soft);
  font-weight: 400;
  opacity: .85;
}
.tab-btn:hover .lab-cn { color: var(--ink-mid); }
.tab-btn.active .lab-cn { color: var(--ink); border-left-color: var(--accent-line); }

.studio-tab-hint {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 14px;
  margin-bottom: 16px;
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  border-left: 2px solid var(--accent);
  font-size: 11.5px;
  line-height: 1.55;
}
.studio-tab-hint .cn { color: var(--ink); }
.studio-tab-hint .en { color: var(--ink-mute); font-size: 10.5px; font-family: 'Geist', sans-serif; letter-spacing: -.005em; }
@media (max-width: 700px) {
  .tab-btn .lab-cn { display: none; }
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab-btn.active .lvl { opacity: .8; }
.tab-btn .badge {
  background: #dc2626; color: #fff;
  border-radius: 999px;
  min-width: 16px; height: 16px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 9px; font-weight: 600;
  margin-left: 4px;
}

/* grid 列必须用 minmax(0, 1fr)，否则 1fr 会回退到 min-content（=iframe 自然宽度 1080px）撑爆容器 */
.studio-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; min-width: 0; }
.studio-layout > * { min-width: 0; }
@media (max-width: 1000px) { .studio-layout { grid-template-columns: minmax(0, 1fr); } }

.studio-panel {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px 20px;
  min-height: 460px;
  display: flex; flex-direction: column;
  position: relative;
}
.studio-panel .panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px dashed var(--line-soft);
}
.studio-panel .panel-head .title {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; color: var(--ink-mute);
  letter-spacing: .08em; text-transform: uppercase;
}
.studio-panel .panel-head .badge {
  background: #dc2626; color: #fff; border-radius: 999px;
  min-width: 18px; height: 18px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; font-family: 'Geist Mono', monospace;
}

.studio-pill-group { margin-bottom: 18px; }
.studio-pill-group .group-label {
  font-size: 11px; color: var(--ink-mid);
  margin-bottom: 8px;
}
.pill {
  display: inline-flex; align-items: center; gap: 0;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px; color: var(--ink);
  cursor: pointer; user-select: none;
  margin-right: 8px; margin-bottom: 8px;
  transition: all .12s;
  letter-spacing: -.005em;
}
.pill:hover { border-color: var(--ink-mute); }
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill.full { display: flex; width: 100%; margin-right: 0; }
.pill .k { color: var(--ink-mute); margin-right: 8px; }
.pill .v { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.active .v { color: var(--accent); }
.pill .edit { color: var(--hint); margin-left: 8px; font-size: 10px; }
.pill input.inline {
  background: transparent; border: none; outline: none;
  color: var(--ink); font: inherit; flex: 1;
  padding: 0; min-width: 0;
}
.pill input.inline::placeholder { color: var(--hint); }
.pill.add { color: var(--ink-mute); border-style: dashed; }
.pill.add:hover { color: var(--ink); border-style: solid; }

.studio-preview {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 18px;
  min-height: 460px;
  display: flex; flex-direction: column;
  position: relative;
}
.studio-preview .preview-head {
  position: absolute; top: 14px; right: 14px;
  font-family: 'Geist Mono', monospace; font-size: 9px;
  color: var(--ink-mute); letter-spacing: .04em;
}
.studio-preview .preview-head .badge {
  background: #dc2626; color: #fff; border-radius: 999px;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; font-family: 'Geist Mono', monospace;
}
.studio-preview .preview-frame {
  flex: 1;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--paper-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  min-height: 380px;
  min-width: 0;       /* flex 子元素默认 min-width:auto，会被 iframe 自然宽度撑大 */
}
.studio-preview .preview-frame .ph {
  font-family: 'Geist Mono', monospace; font-size: 11px;
  color: var(--ink-mute); letter-spacing: .04em;
}
.studio-preview .preview-frame iframe {
  border: 0; background: white;
}

/* iframe 缩放 wrapper：把 layout box 收紧为缩放后的尺寸，避免横向溢出 */
.iframe-scale-wrap {
  position: relative;
  overflow: hidden;
  background: white;
  box-shadow: var(--shadow-card);
  border-radius: 4px;
  flex-shrink: 0;
}
.iframe-scale-wrap iframe {
  position: absolute; top: 0; left: 0;
  display: block;
}

/* L4 mode tabs (image / video / audio) */
.l4-modes {
  display: flex; gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}
.l4-mode {
  padding: 6px 14px; font-size: 12px;
  background: transparent; border: 1px solid var(--line-soft);
  border-radius: 5px; color: var(--ink-mid);
  cursor: pointer; font-family: inherit;
}
.l4-mode:hover { background: var(--bg-soft); color: var(--ink); }
.l4-mode.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-line); font-weight: 500;
}

.audio-presets {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 6px;
}
.audio-preset {
  padding: 5px 10px; font-size: 11.5px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; cursor: pointer;
  font-family: inherit; color: var(--ink-soft);
}
.audio-preset:hover {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent);
}

/* L6 mode tabs */
.l6-mode {
  padding: 6px 14px; font-size: 12px;
  background: transparent; border: 1px solid var(--line-soft);
  border-radius: 5px; color: var(--ink-mid);
  cursor: pointer; font-family: inherit;
}
.l6-mode:hover { background: var(--bg-soft); color: var(--ink); }
.l6-mode.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-line); font-weight: 500;
}

/* legacy text-output for L1/L2 */
.studio-output {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 18px; min-height: 460px;
  display: flex; flex-direction: column;
}
.studio-output .head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; padding-bottom:10px; border-bottom: 1px dashed var(--line-soft); }
.studio-output .head .title { font-size: 12px; font-weight: 600; }
.studio-output pre.out {
  flex: 1; background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 12px 14px; font-family: 'Geist Mono', monospace;
  font-size: 11px; line-height: 1.65; color: var(--ink); white-space: pre-wrap;
  word-break: break-word; overflow-y: auto; max-height: 480px;
}
.studio-output .preview-wrap { flex:1; display:flex; align-items:center; justify-content:center; padding: 12px; background: var(--bg-softer); border-radius: 6px; min-height: 280px; }
.studio-output .preview-wrap iframe { background: white; border: 0; box-shadow: var(--shadow-card); }

.l4-empty {
  background: var(--bg-softer); border: 1px dashed var(--line);
  border-radius: 8px; padding: 40px 24px; text-align: center;
}
.l4-empty .ph { font-size: 10px; font-family: 'Geist Mono', monospace; color: var(--accent); margin-bottom: 8px; letter-spacing: .08em; }
.l4-empty .h { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.l4-empty .d { font-size: 11.5px; color: var(--ink-mute); max-width: 420px; margin: 0 auto; line-height: 1.6; }

/* ========== CMDK ========== */
.cmdk-mask {
  position: fixed; inset: 0; background: rgba(20,20,24,.42);
  z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh; backdrop-filter: blur(2px);
  animation: maskIn .15s ease;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.cmdk-box {
  width: 580px; max-width: calc(100% - 32px);
  background: var(--card); border-radius: 10px;
  box-shadow: var(--shadow-pop);
  overflow: hidden; border: 1px solid var(--line);
  animation: boxIn .18s ease;
}
@keyframes boxIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.cmdk-input {
  width: 100%; padding: 16px 18px; font-size: 14px;
  border: none; outline: none; background: transparent; color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
}
.cmdk-input::placeholder { color: var(--hint); }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px 0; }
.cmdk-group { padding: 4px 0; }
.cmdk-group .label { font-family: 'Geist Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); padding: 6px 18px; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; font-size: 12px; color: var(--ink);
  cursor: pointer; user-select: none;
}
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-item .icon { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--ink-mute); width: 18px; text-align: center; }
.cmdk-item.active .icon { color: var(--accent); }
.cmdk-item .name { flex: 1; }
.cmdk-item .hint { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--hint); }
.cmdk-item.active .hint { color: var(--accent); }
.cmdk-foot { padding: 8px 18px; font-size: 10px; color: var(--ink-mute); border-top: 1px solid var(--line-soft); display: flex; gap: 14px; justify-content: flex-end; background: var(--bg-soft); font-family: 'Geist Mono', monospace; }
.cmdk-foot kbd { background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; font-family: inherit; font-size: 9px; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--ink-mute); font-size: 12px; }

/* ========== COMPLIANCE / STATUS BAR ========== */
.compliance-bar {
  position: fixed; bottom: 0; left: calc(64px + 220px); right: 0;
  background: var(--card); border-top: 1px solid var(--line-soft);
  padding: 9px 32px; font-size: 11px; color: var(--ink-mid);
  display: flex; align-items: center; gap: 16px; z-index: 30;
  box-shadow: 0 -1px 0 rgba(0,0,0,.02);
  min-height: 38px;
}
@media (max-width: 1100px) { .compliance-bar { left: calc(56px + 200px); padding: 9px 22px; } }
@media (max-width: 820px) { .compliance-bar { left: 0; padding: 9px 14px; } }
.compliance-bar .summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.compliance-bar .check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  color: var(--ink-soft);
}
.compliance-bar .check.pass { color: var(--green); }
.compliance-bar .check.warn { color: var(--amber); }
.compliance-bar .check.fail { color: var(--red); }
.compliance-bar .check .ico { font-family: 'Geist Mono', monospace; font-size: 11px; }
.compliance-bar .actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
}
.compliance-bar .actions .label { color: var(--ink-mute); }
.compliance-bar .actions a {
  color: var(--ink); cursor: pointer;
  text-decoration: none;
  padding: 2px 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
}
.compliance-bar .actions a:hover { color: var(--accent); text-decoration: underline; }
.compliance-bar .actions .sep { color: var(--hint); }

.lint-detail {
  position: fixed; bottom: 38px; left: calc(64px + 220px); right: 0;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 16px 32px; max-height: 260px; overflow-y: auto;
  z-index: 30; box-shadow: 0 -8px 18px rgba(0,0,0,.08);
}
@media (max-width: 1100px) { .lint-detail { left: calc(56px + 200px); padding: 14px 22px; } }
@media (max-width: 820px) { .lint-detail { left: 0; padding: 14px 14px; } }
.lint-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 11.5px; align-items: flex-start; }
.lint-row:last-child { border: none; }
.lint-row .level { font-family: 'Geist Mono', monospace; font-size: 9px; padding: 2px 7px; border-radius: 3px; flex-shrink: 0; }
.lint-row .level.error { background: var(--red); color: white; }
.lint-row .level.warn { background: var(--amber); color: white; }
.lint-row .level.pass { background: var(--green); color: white; }
.lint-row .msg { color: var(--ink); }
.lint-row .fix { color: var(--ink-mute); margin-top: 2px; font-size: 10.5px; }

/* ========== TOAST ========== */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 300; display:flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: white;
  padding: 10px 14px; border-radius: 6px; font-size: 12px;
  box-shadow: var(--shadow-pop); min-width: 200px; max-width: 360px;
  animation: toastIn .2s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
.toast.warn { background: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }

/* ========== LAUNCH PLAN · 上市规划 ========== */
.launch-meta {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.launch-meta .lm-row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.launch-meta .k {
  font-size: 9.5px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .04em;
  font-family: 'Geist Mono', monospace;
  flex-shrink: 0;
  width: 50px;
}
.launch-meta input {
  padding: 4px 8px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card); outline: none;
  flex: 1; min-width: 100px;
}
.launch-meta .lm-tags { display: inline-flex; gap: 4px; }

.view-tabs {
  display: flex; gap: 4px; align-items: center;
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.vtab {
  padding: 5px 12px; font-size: 12px;
  background: transparent; border: 1px solid var(--line-soft);
  border-radius: 5px; color: var(--ink-mid);
  cursor: pointer; font-family: inherit;
}
.vtab:hover { background: var(--bg-soft); color: var(--ink); }
.vtab.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-line); font-weight: 500;
}

/* ===== Gantt ===== */
.gantt {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 16px;
}
.gantt-head, .gantt-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 32px;
}
.gantt-head { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.gantt-row {
  border-bottom: 1px dashed var(--line-soft);
  padding: 6px 0;
  cursor: pointer;
  transition: background .12s;
}
.gantt-row:hover { background: var(--paper-soft); }
.gantt-row:last-of-type { border-bottom: none; }
.gantt-row-label {
  font-size: 11.5px;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden;
}
.gantt-row-label .g-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
.gantt-row-label .g-meta {
  font-size: 9.5px; color: var(--ink-mute);
}
.gantt-row-label .g-reg { font-size: 11px; }

.cat-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.cat-dot.sm { width: 6px; height: 6px; }

.gantt-track {
  position: relative;
  height: 28px;
  background: var(--bg-soft);
  border-radius: 4px;
}
.gantt-axis {
  position: absolute; inset: 0;
  pointer-events: none;
}
.gantt-month {
  position: absolute; top: 0;
  font-family: 'Geist Mono', monospace; font-size: 9px;
  color: var(--ink-mute);
  border-left: 1px dashed var(--line);
  height: 100%;
  padding: 4px 0 0 4px;
  width: 48px;
}
.gantt-today, .gantt-launch {
  position: absolute; top: -4px; bottom: -4px;
  width: 2px;
  z-index: 2;
}
.gantt-today { background: var(--blue); }
.gantt-launch { background: var(--accent); }
.gantt-today-label, .gantt-launch-label {
  position: absolute; top: -16px;
  left: -22px; white-space: nowrap;
  font-family: 'Geist Mono', monospace; font-size: 9.5px;
  padding: 2px 5px;
  border-radius: 3px;
}
.gantt-today-label { color: var(--blue); background: var(--blue-soft); border: 1px solid var(--blue); }
.gantt-launch-label { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); left: auto; right: -22px; }

.gantt-bar {
  position: absolute; top: 4px; height: 20px;
  border-radius: 4px;
  opacity: .85;
  cursor: pointer;
  z-index: 1;
  transition: all .15s;
}
.gantt-bar:hover { opacity: 1; height: 22px; top: 3px; }
.gantt-bar.done { opacity: .4; }
.gantt-bar.blocked { background: var(--red) !important; }
.gantt-bar.current { box-shadow: 0 0 0 2px rgba(2,119,219,.3); }
.gantt-bar.past { opacity: .55; }
.gantt-bar-label {
  position: absolute;
  font-family: 'Geist Mono', monospace; font-size: 9.5px;
  color: white; transform: translateY(-50%);
  white-space: nowrap; pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  z-index: 1;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}

.gantt-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 12px; margin-top: 10px;
  border-top: 1px dashed var(--line-soft);
}
.gantt-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
  font-size: 10.5px; color: var(--ink-mute);
  font-family: 'Geist Mono', monospace;
}
.gantt-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ===== Reuse ===== */
.reuse-pillars {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.reuse-pillar {
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px 14px;
}
.reuse-pillar-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.reuse-pillar-head b { color: var(--ink); font-size: 13px; }
.reuse-cnt {
  font-size: 10.5px; color: var(--accent);
  background: var(--accent-soft); padding: 1px 8px; border-radius: 3px;
  margin-left: auto;
}
.reuse-pillar-children {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}
.reuse-child {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 8px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--ink-soft);
}

.reuse-matrix .spec td .cat-dot { margin-right: 5px; }

/* ===== Reuse picker (in modal) ===== */
.reuse-picker {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 8px;
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  max-height: 180px; overflow-y: auto;
}
.reuse-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; font-size: 11px;
  color: var(--ink-soft); cursor: pointer;
  transition: all .12s;
}
.reuse-chip input { display: none; }
.reuse-chip:hover { border-color: var(--ink-mute); }
.reuse-chip.on {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent); font-weight: 500;
}

/* ========== SKILLS LIBRARY · 技能库 ========== */
.cat-tabs {
  display: flex; gap: 4px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
}
.cat-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--ink-mid);
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}
.cat-tab:hover { background: var(--bg-soft); color: var(--ink); }
.cat-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 500;
}
.cat-tab .ico { font-size: 11px; opacity: .7; }
.cat-tab .cnt {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  background: var(--card);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-mute);
  margin-left: 2px;
}
.cat-tab.active .cnt { background: var(--card); color: var(--accent); }

.cat-desc {
  font-size: 11.5px; color: var(--ink-mute);
  padding: 6px 10px;
  margin-bottom: 14px;
  background: var(--paper-soft);
  border-radius: 5px;
  font-family: 'Geist Mono', monospace;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all .12s;
  position: relative;
  display: flex; flex-direction: column;
  min-height: 140px;
}
.skill-card:hover {
  border-color: var(--ink-mute);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}
.skill-card.featured {
  border-color: var(--accent-line);
  background: linear-gradient(135deg, var(--card) 0%, var(--accent-soft) 100%);
}
.skill-card .featured-flag {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 11px;
  color: var(--accent);
}
.skill-head {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 8px;
}
.skill-cat-ico {
  font-size: 16px;
  line-height: 1;
  width: 30px; height: 30px;
  background: var(--bg-soft);
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink-mid);
}
.skill-head-meta { flex: 1; min-width: 0; }
.skill-cat {
  font-size: 9.5px;
  color: var(--ink-mute);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.skill-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.35;
}
.skill-card .skill-head .tag { flex-shrink: 0; }
.skill-desc {
  flex: 1;
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 10px;
}
.skill-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line-soft);
  font-size: 10px;
}
.skill-source {
  color: var(--ink-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}

/* ========== INBOX · 灵感池 ========== */
.inbox-add {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0 18px;
  max-height: 0; overflow: hidden;
  margin-bottom: 16px;
  transition: max-height .25s ease, padding .15s, margin-bottom .15s;
}
.inbox-add.open {
  max-height: 1200px;            /* 改成大值，避免裁剪文件区+按钮 */
  padding: 18px;
  margin-bottom: 18px;
  overflow: visible;             /* 不再裁剪，依靠 page 自身滚动 */
}

.inbox-tabs {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 10px;
}
.inbox-tab {
  padding: 5px 12px; font-size: 11.5px;
  background: transparent; border: 1px solid transparent;
  border-radius: 5px; color: var(--ink-mute);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.inbox-tab .cnt {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; color: var(--ink-mute);
  padding: 1px 5px;
  background: var(--bg-soft);
  border-radius: 3px;
}
.inbox-tab:hover { color: var(--ink); background: var(--bg-soft); }
.inbox-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.inbox-tabs .grow { flex: 1; }
.inbox-tabs .search {
  padding: 5px 10px; font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--card); color: var(--ink); outline: none;
  width: 220px;
}

.src-list { display: flex; flex-direction: column; gap: 8px; }
.src-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 14px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 14px 16px;
  cursor: pointer; transition: all .12s;
  align-items: flex-start;
}
.src-row:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-card); }
.src-ico {
  width: 32px; height: 32px;
  background: var(--bg-soft); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-mid);
}
.src-body { min-width: 0; }
.src-title {
  font-size: 12.5px; line-height: 1.5;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.src-title b { color: var(--ink); font-weight: 500; }
.src-url {
  font-size: 10.5px; color: var(--ink-mute);
  margin-top: 3px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.src-desc {
  font-size: 11.5px; color: var(--ink-mid);
  line-height: 1.55; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.src-actions { display: flex; gap: 4px; flex-shrink: 0; }

.src-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0;
  color: var(--ink-mute); font-size: 9.5px;
  font-family: 'Geist Mono', monospace; letter-spacing: .08em; text-transform: uppercase;
}
.src-divider::before, .src-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--line-soft);
}

.src-file-drop {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px 16px; text-align: center;
  background: var(--paper-soft);
  cursor: pointer; transition: all .12s;
}
.src-file-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.src-file-drop:hover { border-color: var(--ink-mute); }
.src-file-drop .big { font-size: 12.5px; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.src-file-drop .small { font-size: 10.5px; color: var(--ink-mute); }
.src-file-preview { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 4px; font-size: 10.5px;
}
.file-chip .name { color: var(--ink); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .size { color: var(--ink-mute); font-size: 9.5px; }
.file-chip .x {
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-mute); font-size: 10px; padding: 0 2px;
}
.file-chip .x:hover { color: var(--red); }

.patch-row {
  display: grid; grid-template-columns: 22px 1fr;
  gap: 10px; padding: 10px 12px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 6px; margin-bottom: 6px;
  align-items: flex-start;
}
.patch-row input[type="checkbox"] { margin-top: 2px; }
.patch-body { min-width: 0; }

/* ========== ARCHIVE ========== */
.archive-list { display: flex; flex-direction: column; gap: 8px; }
.archive-row {
  display: grid; grid-template-columns: 100px 1fr 100px 100px 80px;
  gap: 14px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 6px; align-items: center;
  font-size: 11.5px; cursor: pointer;
}
.archive-row:hover { border-color: var(--ink-mute); }
.archive-row .id { font-family: 'Geist Mono', monospace; color: var(--ink-mute); font-size: 10px; }
.archive-row .title b { color: var(--ink); }
.archive-row .title .sub { color: var(--ink-mute); font-size: 10px; margin-top: 2px; }
.archive-row .when { font-family: 'Geist Mono', monospace; color: var(--ink-mute); font-size: 10px; }

/* ========== SETTINGS ========== */
.settings-grid { display: grid; gap: 24px; }
.settings-block { background: var(--card); border: 1px solid var(--line-soft); border-radius: 8px; padding: 22px 24px; }
.settings-block h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.settings-block .sub { font-size: 11.5px; color: var(--ink-mute); margin-bottom: 16px; }
.settings-block .conn-pill { display: inline-flex; align-items: center; gap: 6px; font-family: 'Geist Mono', monospace; font-size: 10px; padding: 3px 8px; border-radius: 4px; background: var(--bg-soft); border: 1px solid var(--line-soft); }
.settings-block .conn-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hint); }
.settings-block .conn-pill.ok .dot { background: var(--green); }
.settings-block .conn-pill.fail .dot { background: var(--red); }

/* ========== NODE GRAPH PANEL · 节点关系表 ========== */
.node-graph-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  margin-top: 14px;
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px;
}
@media (max-width: 900px) { .node-graph-wrap { grid-template-columns: 1fr; } }

.ng-list-head {
  font-size: 9.5px; color: var(--ink-mute);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 0 8px;
}

.ng-target-list {
  background: var(--card);
  border-radius: 6px;
  padding: 8px;
  max-height: 480px;
  overflow-y: auto;
}
.ng-target-item {
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all .12s;
  border: 1px solid transparent;
}
.ng-target-item:hover { background: var(--bg-soft); }
.ng-target-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.ng-target-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink);
}
.ng-target-id {
  font-size: 9.5px; color: var(--ink-mute);
  margin-top: 3px;
}
.ng-target-count {
  font-size: 9.5px; color: var(--ink-mute);
  margin-top: 2px;
}
.ng-target-item.active .ng-target-count { color: var(--accent); }

.ng-edges-pane {
  background: var(--card);
  border-radius: 6px;
  padding: 14px 16px;
  max-height: 480px;
  overflow-y: auto;
}
.ng-edges-head {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-soft);
  margin-bottom: 12px;
}
.ng-edges-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink);
}
.ng-edges-meta {
  font-size: 9.5px; color: var(--ink-mute);
  margin-top: 3px;
}
.ng-edges-format {
  font-size: 11px; color: var(--ink-mid);
  margin-top: 6px;
}

.ng-threshold-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 12px;
  background: var(--bg-soft); border-radius: 5px;
  font-size: 11px;
}
.ng-threshold-row label { color: var(--ink-mute); flex-shrink: 0; }
.ng-threshold-row input[type=range] { flex: 1; }
.ng-threshold-row .mono { width: 32px; text-align: right; }

.ng-edges-list { display: flex; flex-direction: column; gap: 5px; }
.ng-edge-row {
  display: grid;
  grid-template-columns: 1fr 200px 32px;
  gap: 10px;
  padding: 8px 10px;
  background: var(--paper-soft);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  align-items: center;
  font-size: 11.5px;
  transition: opacity .15s;
}
.ng-edge-row.inactive { opacity: .45; }
.ng-edge-from {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
}
.ng-edge-from b { color: var(--ink); }
.ng-edge-id {
  font-size: 9.5px; color: var(--ink-mute);
  margin-left: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 130px;
}
.ng-edge-weight {
  display: flex; align-items: center; gap: 6px;
}
.ng-edge-weight input[type=range] { flex: 1; }
.ng-w-val { width: 36px; text-align: right; font-size: 10.5px; color: var(--ink); }

.ng-add-row {
  margin-top: 14px; padding: 10px 12px;
  background: var(--bg-soft); border-radius: 5px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.ng-add-row select, .ng-add-row input {
  padding: 4px 8px; font-size: 11.5px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card); outline: none;
}
.ng-add-row select { flex: 1; min-width: 120px; }

/* ========== HOME ========== */
.home-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 28px; }
.home-stat { background: var(--card); border: 1px solid var(--line-soft); border-radius: 8px; padding: 16px 18px; }
.home-stat .v { font-family: 'Geist Mono', monospace; font-size: 23px; font-weight: 500; color: var(--ink); line-height: 1; margin-bottom: 6px; }
.home-stat .k { font-family: 'Geist Mono', monospace; font-size: 9.5px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 760px) { .home-stats { grid-template-columns: 1fr 1fr; } }

.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .home-cards { grid-template-columns: 1fr; } }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
