/* Shared (non-color) tokens — apply to every palette */
:root{
  /* status colors that don't depend on the palette */
  --ok: oklch(0.56 0.1 155);
  --ok-soft: oklch(0.95 0.04 155);
  --warn: oklch(0.64 0.12 70);
  --warn-soft: oklch(0.95 0.05 80);
  --danger: oklch(0.55 0.17 27);
  --danger-soft: oklch(0.95 0.05 27);

  /* shape */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px oklch(0.4 0.02 65 / 0.06), 0 1px 1px oklch(0.4 0.02 65 / 0.04);
  --shadow: 0 4px 14px oklch(0.4 0.02 65 / 0.07), 0 1px 3px oklch(0.4 0.02 65 / 0.05);
  --shadow-lg: 0 24px 60px oklch(0.35 0.02 65 / 0.16), 0 6px 18px oklch(0.35 0.02 65 / 0.08);

  /* fonts — default keeps the Newsreader/Hanken Grotesk choice via Google Fonts link */
  --ui: "Hanken Grotesk", system-ui, sans-serif;
  --display: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ----- Font alternatives (no link, no licence required) ----- */
:root[data-font="system"]{
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
:root[data-font="serif"]{
  --ui: Georgia, "Times New Roman", Times, serif;
  --display: Georgia, "Times New Roman", Times, serif;
  --mono: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
:root[data-font="sans"]{
  --ui: Helvetica, Arial, sans-serif;
  --display: Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
:root[data-font="mono"]{
  --ui: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  --display: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  --mono: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}

/* ----- Palettes ----- */
:root,
:root[data-palette="cream"]{
  --bg: oklch(0.984 0.005 85);
  --panel: oklch(0.992 0.004 85);
  --card: oklch(1 0 0);
  --ink: oklch(0.255 0.014 65);
  --ink-2: oklch(0.475 0.012 65);
  --ink-3: oklch(0.635 0.01 65);
  --ink-4: oklch(0.75 0.008 70);
  --line: oklch(0.912 0.006 78);
  --line-2: oklch(0.86 0.008 78);
  --field: oklch(0.978 0.005 85);
  --accent: oklch(0.585 0.125 42);
  --accent-press: oklch(0.52 0.125 42);
  --accent-ink: oklch(0.43 0.11 42);
  --accent-soft: oklch(0.95 0.028 55);
  --accent-line: oklch(0.86 0.06 50);
  --topbar-bg: oklch(0.984 0.005 85 / 0.82);
  --scrollbar-thumb: oklch(0.86 0.008 78);
  --hover-tint: oklch(0.93 0.006 75);
}

/* Ocean */
:root[data-palette="ocean"]{
  --bg: oklch(0.98 0.012 220);
  --panel: oklch(0.99 0.008 220);
  --card: oklch(1 0 0);
  --ink: oklch(0.24 0.04 240);
  --ink-2: oklch(0.46 0.035 235);
  --ink-3: oklch(0.62 0.03 230);
  --ink-4: oklch(0.74 0.025 225);
  --line: oklch(0.9 0.018 220);
  --line-2: oklch(0.84 0.025 220);
  --field: oklch(0.975 0.012 220);
  --accent: oklch(0.58 0.14 230);
  --accent-press: oklch(0.5 0.14 230);
  --accent-ink: oklch(0.4 0.12 230);
  --accent-soft: oklch(0.95 0.04 230);
  --accent-line: oklch(0.84 0.06 230);
  --topbar-bg: oklch(0.98 0.012 220 / 0.82);
  --scrollbar-thumb: oklch(0.84 0.025 220);
  --hover-tint: oklch(0.93 0.018 220);
}

/* Forest */
:root[data-palette="forest"]{
  --bg: oklch(0.98 0.012 145);
  --panel: oklch(0.992 0.008 145);
  --card: oklch(1 0 0);
  --ink: oklch(0.24 0.04 150);
  --ink-2: oklch(0.46 0.03 150);
  --ink-3: oklch(0.62 0.025 150);
  --ink-4: oklch(0.74 0.02 150);
  --line: oklch(0.9 0.018 145);
  --line-2: oklch(0.84 0.025 145);
  --field: oklch(0.975 0.012 145);
  --accent: oklch(0.56 0.13 155);
  --accent-press: oklch(0.48 0.13 155);
  --accent-ink: oklch(0.38 0.1 155);
  --accent-soft: oklch(0.95 0.04 150);
  --accent-line: oklch(0.84 0.06 150);
  --topbar-bg: oklch(0.98 0.012 145 / 0.82);
  --scrollbar-thumb: oklch(0.84 0.025 145);
  --hover-tint: oklch(0.93 0.018 145);
}

/* Dark */
:root[data-palette="dark"]{
  --bg: oklch(0.16 0.012 270);
  --panel: oklch(0.21 0.012 270);
  --card: oklch(0.24 0.012 270);
  /* High-contrast ink for header readability */
  --ink: oklch(0.98 0.005 270);
  --ink-2: oklch(0.88 0.012 270);
  --ink-3: oklch(0.75 0.015 270);
  --ink-4: oklch(0.6 0.014 270);
  --line: oklch(0.32 0.014 270);
  --line-2: oklch(0.4 0.018 270);
  --field: oklch(0.2 0.014 270);
  --accent: oklch(0.78 0.18 290);
  --accent-press: oklch(0.72 0.18 290);
  --accent-ink: oklch(0.86 0.14 290);
  --accent-soft: oklch(0.34 0.08 290);
  --accent-line: oklch(0.48 0.12 290);
  /* Darker topbar so light ink text reads clearly */
  --topbar-bg: oklch(0.14 0.012 270 / 0.88);
  --scrollbar-thumb: oklch(0.36 0.014 270);
  --hover-tint: oklch(0.3 0.018 270);
}
*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }
body{
  font-family: var(--ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
::selection{ background: var(--accent-soft); }
button{ font-family: inherit; }
input, textarea, select{ font-family: inherit; }
::-webkit-scrollbar{ width:12px; height:12px; }
::-webkit-scrollbar-thumb{ background: var(--scrollbar-thumb); border-radius:20px; border:3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover{ background: var(--ink-4); }

.app{ min-height:100vh; display:flex; flex-direction:column; }
.topbar{
  position:sticky; top:0; z-index:40;
  height:60px; display:flex; align-items:center; gap:16px;
  padding: 0 clamp(16px, 3vw, 56px);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--line);
  color: var(--ink);
}
.brand{ display:flex; align-items:center; gap:11px; cursor:pointer; user-select:none; text-decoration:none; color:inherit; }
.brand-mark{
  width:30px; height:30px; border-radius:8px; flex:none;
  background: linear-gradient(150deg, var(--accent), var(--accent-press));
  display:grid; place-items:center; color:#fff; box-shadow: var(--shadow-sm);
}
.brand-name{ font-family: var(--display); font-size:20px; font-weight:600; letter-spacing:-0.01em; }
.brand-name b{ color: var(--accent-ink); font-weight:600; }
.topbar-spacer{ flex:1; }
.crumbs{ display:flex; align-items:center; gap:8px; font-size:13.5px; color:var(--ink-3); flex:none; max-width:48vw; }
.crumbs .c-link{ cursor:pointer; color:var(--ink-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:240px; text-decoration:none; }
.crumbs .c-link:hover{ color:var(--ink); }
.crumbs .c-now{ color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:240px; }
.crumbs .c-sep{ color:var(--ink-4); display:inline-flex; }

.main{ flex:1; width:100%; display:flex; flex-direction:column; }
.page{
  width:100%; max-width:min(1560px, 100% - 32px); margin:0 auto;
  padding:40px clamp(16px, 3vw, 56px) 96px;
  flex:1; min-height: calc(100vh - 60px);
}
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:28px; }
.page-title{ font-family:var(--display); font-size:34px; font-weight:500; letter-spacing:-0.02em; margin:0; line-height:1.1; }
.page-sub{ color:var(--ink-2); font-size:14.5px; margin:7px 0 0; }
.eyebrow{ font-family:var(--mono); font-size:11px; font-weight:500; letter-spacing:0.14em; text-transform:uppercase; color:var(--ink-3); }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:38px; padding:0 16px; border-radius:10px; border:1px solid transparent;
  font-size:14px; font-weight:600; letter-spacing:-0.01em; cursor:pointer;
  white-space:nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  background:transparent; color:var(--ink); text-decoration:none;
}
.btn:active{ transform: translateY(0.5px); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-primary{ background:var(--accent); color:#fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled){ background:var(--accent-press); }
.btn-default{ background:var(--card); border-color:var(--line-2); color:var(--ink); box-shadow:var(--shadow-sm); }
.btn-default:hover:not(:disabled){ border-color:var(--ink-4); background:var(--panel); }
.btn-ghost{ background:transparent; color:var(--ink-2); }
.btn-ghost:hover:not(:disabled){ background: var(--hover-tint); color:var(--ink); }
.btn-danger{ background:transparent; color:var(--danger); border-color:transparent; }
.btn-danger:hover:not(:disabled){ background:var(--danger-soft); }
.btn-sm{ height:32px; padding:0 12px; font-size:13px; border-radius:9px; }
.btn-lg{ height:44px; padding:0 22px; font-size:15px; border-radius:11px; }
.btn-icon{ width:38px; padding:0; }
.btn-icon.btn-sm{ width:32px; }
.icon-btn{
  width:36px; height:36px; border-radius:10px; border:1px solid transparent; background:transparent;
  display:grid; place-items:center; cursor:pointer; color:var(--ink-2); transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover{ background: var(--hover-tint); color:var(--ink); }

.card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
.surface{ background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); }

.grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(286px,1fr)); gap:18px; }
.topic-card{
  position:relative; text-align:left; cursor:pointer; overflow:hidden;
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); transition: box-shadow .18s, border-color .18s, transform .18s;
  display:flex; flex-direction:column; min-height:184px; padding:0; text-decoration:none; color:inherit;
}
.topic-card:hover{ box-shadow:var(--shadow); border-color:var(--line-2); transform:translateY(-2px); }
.topic-band{ height:7px; width:100%; }
.topic-body{ padding:20px 20px 0; flex:1; }
.topic-name{ font-family:var(--display); font-size:21px; font-weight:500; letter-spacing:-0.015em; margin:0 0 7px; line-height:1.18; }
.topic-desc{ color:var(--ink-2); font-size:13.5px; margin:0; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.topic-foot{ display:flex; align-items:center; gap:14px; padding:16px 20px 18px; color:var(--ink-3); font-size:12.5px; }
.topic-foot .dot{ width:3px; height:3px; border-radius:50%; background:var(--ink-4); }
.meta-mono{ font-family:var(--mono); font-size:11.5px; letter-spacing:0.01em; }

.new-card{
  border:1.5px dashed var(--line-2); background:transparent; border-radius:var(--radius);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px;
  min-height:184px; cursor:pointer; color:var(--ink-3); transition: border-color .18s, color .18s, background .18s;
}
.new-card:hover{ border-color:var(--accent-line); color:var(--accent-ink); background:oklch(0.97 0.012 55 / .5); }
.new-card .plus{ width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:var(--card); border:1px solid var(--line-2); box-shadow:var(--shadow-sm); color:var(--ink-2); }
.new-card:hover .plus{ color:var(--accent); border-color:var(--accent-line); }
.new-card span{ font-weight:600; font-size:14px; }

.empty{ text-align:center; padding:64px 24px; color:var(--ink-3); }
.empty-mark{ width:58px; height:58px; border-radius:16px; margin:0 auto 18px; display:grid; place-items:center; background:var(--panel); border:1px solid var(--line); color:var(--ink-3); }
.empty h3{ font-family:var(--display); font-weight:500; font-size:22px; color:var(--ink); margin:0 0 6px; }
.empty p{ margin:0 auto 20px; max-width:380px; font-size:14px; }

.scrim{
  position:fixed; inset:0; z-index:80;
  background: oklch(0.25 0.02 65 / 0.5);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display:flex; align-items:safe center; justify-content:center;
  padding: max(28px, 4vh) max(16px, 3vw);
  overflow:auto;
  animation: fade .18s ease;
}
@keyframes fade{ from{ opacity:0; backdrop-filter: blur(0px); } }
@keyframes pop{ from{ opacity:0; transform:translateY(10px) scale(.985); } }
.modal{
  width:100%;
  max-width: min(94vw, 560px);
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2,.8,.2,1);
  overflow:hidden;
  display:flex; flex-direction:column;
  max-height: calc(100vh - max(56px, 8vh));
}
.modal-lg{ max-width: min(94vw, 760px); }
.modal-xl{ max-width: min(95vw, 1040px); }
.modal-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:28px 32px 4px; flex:none; }
.modal-title{ font-family:var(--display); font-size:24px; font-weight:500; letter-spacing:-0.015em; margin:0; }
.modal-desc{ color:var(--ink-2); font-size:14px; margin:6px 0 0; max-width:62ch; }
.modal-body{ padding:22px 32px 28px; overflow:auto; flex:1 1 auto; }
.modal-foot{ display:flex; align-items:center; justify-content:flex-end; gap:10px; padding:18px 32px; border-top:1px solid var(--line); background:var(--panel); flex:none; }
@media (max-width: 640px){
  .modal-head{ padding:22px 20px 4px; }
  .modal-body{ padding:18px 20px 22px; }
  .modal-foot{ padding:14px 20px; flex-wrap:wrap; }
}

/* ---------- Color swatch ---------- */
.swatch-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; padding-top:2px; }
.swatch{
  width:28px; height:28px; border-radius:8px; padding:0;
  border:none; cursor:pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}
.swatch:hover{ transform: scale(1.08); }
.swatch:focus-visible{ outline:2px solid var(--ink); outline-offset:3px; }
.swatch.on{ outline: 2px solid var(--ink); outline-offset: 3px; }

/* "Pick custom color" swatch: rainbow conic gradient by default, becomes
   the picked color (via inline :style) when the current color is custom. */
.swatch-custom{
  position:relative; cursor:pointer;
  background: conic-gradient(from 45deg,
    oklch(0.65 0.22 0),
    oklch(0.72 0.18 60),
    oklch(0.74 0.2 120),
    oklch(0.66 0.18 180),
    oklch(0.6 0.2 240),
    oklch(0.56 0.22 300),
    oklch(0.65 0.22 0));
  display:grid; place-items:center;
}
.swatch-custom::after{
  content:''; width:11px; height:11px; border-radius:50%;
  background:#fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.swatch-custom.on::after{ display:none; }
.swatch-custom input[type="color"]{
  position:absolute; inset:0; opacity:0; cursor:pointer; padding:0; border:0; background:transparent;
}

.field{ margin-bottom:16px; }
.field:last-child{ margin-bottom:0; }
.label{ display:block; font-size:12.5px; font-weight:600; color:var(--ink-2); margin-bottom:7px; letter-spacing:-0.005em; }
.label .opt{ color:var(--ink-4); font-weight:500; }
.input, .textarea, .select{
  width:100%; background:var(--field); border:1px solid var(--line-2); border-radius:10px;
  padding:10px 12px; font-size:14px; color:var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
  outline:none;
}
.input:focus, .textarea:focus, .select:focus{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); background:var(--card); }
.input::placeholder, .textarea::placeholder{ color:var(--ink-4); }
.textarea{ resize:vertical; min-height:84px; line-height:1.55; }
.select{ appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 11px center; padding-right:34px; cursor:pointer; }
.hint{ font-size:12px; color:var(--ink-3); margin-top:6px; }
.mono-input{ font-family:var(--mono); font-size:13px; letter-spacing:-0.01em; }

.chip{ display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 10px; border-radius:8px; font-size:12px; font-weight:600; background:var(--field); border:1px solid var(--line-2); color:var(--ink-2); }
.badge{ display:inline-flex; align-items:center; gap:6px; height:22px; padding:0 9px; border-radius:7px; font-size:11.5px; font-weight:600; font-family:var(--mono); letter-spacing:0.01em; white-space:nowrap; }
.badge-accent{ background:var(--accent-soft); color:var(--accent-ink); }
.badge-ok{ background:var(--ok-soft); color:var(--ok); }
.badge-warn{ background:var(--warn-soft); color:oklch(0.5 0.1 70); }
.badge-danger{ background:var(--danger-soft); color:var(--danger); }
.badge-neutral{ background:var(--field); color:var(--ink-3); border:1px solid var(--line-2); }
.dotcolor{ width:9px; height:9px; border-radius:50%; flex:none; }

.settings-grid{ display:grid; grid-template-columns:200px 1fr; gap:40px; align-items:start; }
.set-nav{ position:sticky; top:84px; display:flex; flex-direction:column; gap:2px; }
.set-nav a{ text-align:left; background:transparent; border:none; cursor:pointer; padding:9px 12px; border-radius:9px; font-size:14px; font-weight:600; color:var(--ink-2); display:flex; align-items:center; gap:10px; transition:background .12s,color .12s; text-decoration:none; }
.set-nav a:hover{ background: var(--hover-tint); color:var(--ink); }
.set-nav a.on{ background:var(--card); color:var(--ink); box-shadow:var(--shadow-sm); border:1px solid var(--line); }
.section-title{ font-family:var(--display); font-size:24px; font-weight:500; letter-spacing:-0.015em; margin:0 0 4px; }
.section-desc{ color:var(--ink-2); font-size:14px; margin:0 0 22px; max-width:560px; }
.list-row{ display:flex; align-items:center; gap:14px; padding:16px 18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--card); box-shadow:var(--shadow-sm); margin-bottom:12px; }
.row-main{ flex:1; min-width:0; }
.row-title{ font-weight:600; font-size:15px; display:flex; align-items:center; gap:9px; }
.row-sub{ color:var(--ink-3); font-size:12.5px; margin-top:3px; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.row-actions{ display:flex; align-items:center; gap:4px; }
.supplier-ic{ width:40px; height:40px; border-radius:11px; flex:none; display:grid; place-items:center; font-weight:700; font-size:15px; color:#fff; font-family:var(--display); }
.model-pill{ display:inline-flex; align-items:center; gap:6px; height:24px; padding:0 9px; border-radius:7px; background:var(--field); border:1px solid var(--line-2); font-size:11.5px; font-weight:600; color:var(--ink-2); font-family:var(--mono); }
.divider-h{ height:1px; background:var(--line); margin:32px 0; }

.modelrow{ display:flex; align-items:center; gap:10px; margin-bottom:9px; }
.modelrow .input{ flex:1; }
.add-link{ display:inline-flex; align-items:center; gap:7px; background:transparent; border:none; cursor:pointer; color:var(--accent-ink); font-weight:600; font-size:13px; padding:4px 0; }
.add-link:hover{ text-decoration:underline; }

.sub-row{ display:flex; align-items:center; gap:16px; padding:17px 20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--card); box-shadow:var(--shadow-sm); cursor:pointer; transition:box-shadow .16s,border-color .16s,transform .16s; margin-bottom:12px; text-decoration:none; color:inherit; }
.sub-row:hover{ box-shadow:var(--shadow); border-color:var(--line-2); transform:translateY(-1px); }
.sub-idx{ font-family:var(--mono); font-size:12px; color:var(--ink-4); width:28px; flex:none; }
.sub-main{ flex:1; min-width:0; }
.sub-title{ font-weight:600; font-size:15.5px; letter-spacing:-0.01em; }
.sub-snippet{ color:var(--ink-3); font-size:13px; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.editor-wrap{
  width:100%; max-width:min(1560px, 100% - 32px); margin:0 auto;
  padding:30px clamp(16px, 3vw, 56px) 110px;
  flex:1; min-height: calc(100vh - 60px);
}
.editor-head{ margin-bottom:22px; }
.editor-title-input{ font-family:var(--display); font-size:30px; font-weight:500; letter-spacing:-0.02em; border:none; background:transparent; width:100%; color:var(--ink); outline:none; padding:2px 0; }
.editor-meta{ display:flex; align-items:center; gap:10px; margin-top:8px; flex-wrap:wrap; }
.editor-cols{ display:grid; grid-template-columns:1fr 348px; gap:24px; align-items:start; }
@media (max-width:980px){ .editor-cols{ grid-template-columns:1fr; } .settings-grid{ grid-template-columns:1fr; } .set-nav{ position:static; flex-direction:row; flex-wrap:wrap; } }
.doc{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden; }
.doc-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 16px; border-bottom:1px solid var(--line); background:var(--panel); }
.doc-bar .lbl{ font-family:var(--mono); font-size:11px; letter-spacing:0.12em; text-transform:uppercase; color:var(--ink-3); }
.doc-editor{ width:100%; border:none; outline:none; background:transparent; resize:none; padding:24px 26px; font-size:16px; line-height:1.72; color:var(--ink); min-height:420px; font-family:var(--ui); }
.doc-editor::placeholder{ color:var(--ink-4); }

.side{ display:flex; flex-direction:column; gap:16px; position:sticky; top:84px; }
.panel{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden; }
.panel-head{ display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--line); }
.panel-head .ph-ic{ width:30px; height:30px; border-radius:9px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent-ink); flex:none; }
.panel-head h4{ margin:0; font-size:14.5px; font-weight:700; letter-spacing:-0.01em; }
.panel-head p{ margin:1px 0 0; font-size:12px; color:var(--ink-3); }
.panel-body{ padding:14px 16px; }
.minilabel{ font-family:var(--mono); font-size:10.5px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-3); margin-bottom:7px; display:block; }
.select-sm{ height:34px; padding:7px 30px 7px 10px; font-size:13px; border-radius:9px; background-position:right 9px center; }

.fc-item{ display:flex; gap:11px; padding:12px 0; border-top:1px dashed var(--line-2); }
.fc-item:first-child{ border-top:none; }
.fc-ic{ width:20px; height:20px; border-radius:6px; flex:none; display:grid; place-items:center; margin-top:1px; }
.fc-text{ display:flex; flex-direction:column; gap:4px; min-width:0; }
.fc-claim{ font-size:13px; line-height:1.45; color:var(--ink); }
.fc-note{ font-size:12px; line-height:1.45; color:var(--ink-3); }

.skeleton{ background:linear-gradient(100deg, var(--field) 30%, oklch(0.95 0.005 80) 50%, var(--field) 70%); background-size:200% 100%; animation:sh 1.2s infinite; border-radius:6px; }
@keyframes sh{ from{ background-position:200% 0; } to{ background-position:-40% 0; } }
.spin{ animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.gen-empty{ display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; min-height:420px; padding:40px; color:var(--ink-3); }
.gen-empty .gm{ width:52px; height:52px; border-radius:14px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent-ink); margin-bottom:16px; }
.gen-empty h3{ font-family:var(--display); font-weight:500; font-size:21px; color:var(--ink); margin:0 0 6px; }
.gen-empty p{ margin:0 0 20px; max-width:320px; font-size:14px; }

.toasts{ position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:120; display:flex; flex-direction:column; gap:10px; align-items:center; }
.toast{ display:flex; align-items:center; gap:10px; background:var(--ink); color:oklch(0.97 0.005 85); padding:11px 16px; border-radius:11px; box-shadow:var(--shadow-lg); font-size:13.5px; font-weight:500; animation:pop .2s ease; }
.toast .t-ic{ color:oklch(0.8 0.1 155); display:grid; place-items:center; }

/* opacity-only fade so the page never becomes a containing block for fixed-positioned scrims */
.fadein{ animation: fadein .35s ease both; }
@keyframes fadein{ from{ opacity:0; } }

.ow-suggest{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.ow-chip{ cursor:pointer; background:var(--field); border:1px solid var(--line-2); color:var(--ink-2); height:30px; padding:0 12px; border-radius:8px; font-size:12.5px; font-weight:600; transition:all .12s; }
.ow-chip:hover{ border-color:var(--accent-line); color:var(--accent-ink); background:var(--accent-soft); }

.seg{ display:flex; gap:4px; background:var(--field); border:1px solid var(--line-2); border-radius:11px; padding:4px; }
.seg-btn{ flex:1; position:relative; display:flex; align-items:center; justify-content:center; gap:6px; height:34px; border:none; background:transparent; border-radius:8px; cursor:pointer; font-size:13px; font-weight:600; color:var(--ink-3); transition:background .12s,color .12s,box-shadow .12s; }
.seg-btn:hover{ color:var(--ink-2); }
.seg-btn.on{ background:var(--card); color:var(--ink); box-shadow:var(--shadow-sm); }
.seg-dot{ position:absolute; top:6px; right:8px; width:6px; height:6px; border-radius:50%; background:var(--ok); }

.chan-block{ margin-top:18px; }
.chan-list{ display:flex; flex-direction:column; gap:10px; }
.chan-link{ display:flex; align-items:center; gap:13px; padding:13px 15px; border:1px solid var(--line); border-radius:var(--radius); background:var(--card); box-shadow:var(--shadow-sm); cursor:pointer; transition:box-shadow .15s,border-color .15s,transform .15s; text-align:left; width:100%; text-decoration:none; color:inherit; }
.chan-link:hover{ box-shadow:var(--shadow); border-color:var(--line-2); transform:translateY(-1px); }
.chan-link.disabled{ cursor:not-allowed; opacity:.6; pointer-events:none; }
.chan-ic{ width:36px; height:36px; border-radius:10px; flex:none; display:grid; place-items:center; color:#fff; }
.chan-main{ flex:1; min-width:0; }
.chan-name{ font-weight:600; font-size:14.5px; letter-spacing:-0.01em; }
.chan-meta{ display:flex; align-items:center; gap:7px; margin-top:4px; flex-wrap:wrap; }
.assetdot{ display:inline-flex; align-items:center; gap:4px; font-family:var(--mono); font-size:10.5px; color:var(--ink-3); white-space:nowrap; }
.assetdot b{ color:var(--ink-2); font-weight:600; }

.ch-page{
  width:100%; max-width:min(1440px, 100% - 32px); margin:0 auto;
  padding:30px clamp(16px, 3vw, 56px) 110px;
  flex:1; min-height: calc(100vh - 60px);
}
.ch-hero{ display:flex; align-items:center; gap:16px; margin-bottom:8px; }
.ch-hero .h-ic{ width:52px; height:52px; border-radius:14px; display:grid; place-items:center; color:#fff; flex:none; box-shadow:var(--shadow-sm); }
.ch-hero h1{ font-family:var(--display); font-size:30px; font-weight:500; letter-spacing:-0.02em; margin:0; }
.ref-card{ border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); overflow:hidden; margin:18px 0 26px; }
.ref-head{ display:flex; align-items:center; justify-content:space-between; padding:11px 16px; cursor:pointer; }
.ref-head .lbl{ font-family:var(--mono); font-size:11px; letter-spacing:0.1em; text-transform:uppercase; color:var(--ink-3); display:flex; align-items:center; gap:8px; }
.ref-body{ padding:0 16px 16px; white-space:pre-wrap; font-size:14px; line-height:1.65; color:var(--ink-2); max-height:240px; overflow:auto; border-top:1px solid var(--line); padding-top:14px; }

.asset-sec{ margin-bottom:30px; }
.asset-sec-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.asset-sec-title{ display:flex; align-items:center; gap:10px; }
.asset-sec-title .as-ic{ width:32px; height:32px; border-radius:9px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent-ink); }
.asset-sec-title h3{ font-family:var(--display); font-size:20px; font-weight:500; margin:0; letter-spacing:-0.01em; }
.asset-sec-title .cnt{ font-family:var(--mono); font-size:12px; color:var(--ink-4); }

.asset-card{ border:1px solid var(--line); border-radius:var(--radius); background:var(--card); box-shadow:var(--shadow-sm); overflow:hidden; margin-bottom:12px; }
.asset-prompt-bar{ display:flex; align-items:flex-start; gap:10px; padding:12px 14px; background:var(--panel); border-bottom:1px solid var(--line); }
.asset-prompt-bar .pb-ic{ color:var(--ink-4); margin-top:7px; flex:none; }
.asset-prompt-in{ flex:1; background:var(--card); border:1px solid var(--line-2); border-radius:9px; padding:8px 10px; font-size:13px; line-height:1.5; color:var(--ink); resize:vertical; min-height:38px; outline:none; font-family:var(--ui); transition:border-color .15s, box-shadow .15s; }
.asset-prompt-in:focus{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.asset-body{ padding:14px; }
.asset-foot{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 14px; border-top:1px solid var(--line); white-space:nowrap; }
.text-asset{ width:100%; border:none; outline:none; resize:vertical; min-height:120px; font-size:15px; line-height:1.65; color:var(--ink); font-family:var(--ui); background:transparent; padding:16px; }
.text-asset::placeholder{ color:var(--ink-4); }

.media-thumb{ position:relative; border-radius:11px; overflow:hidden; display:grid; place-items:center; }
.media-thumb.img{ aspect-ratio:4/3; }
.media-thumb.vid{ aspect-ratio:16/9; }
.media-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
.media-grain{ position:absolute; inset:0; opacity:.5; mix-blend-mode:overlay; background-image:radial-gradient(oklch(1 0 0 / .5) 1px, transparent 1.4px); background:7px 7px; }
.media-tag{ position:absolute; top:10px; left:10px; display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 9px; border-radius:7px; background:oklch(0.2 0.02 65 / .55); color:#fff; font-size:11px; font-weight:600; font-family:var(--mono); backdrop-filter:blur(6px); white-space:nowrap; }
.dur-tag{ position:absolute; bottom:10px; right:10px; height:22px; padding:0 8px; border-radius:6px; background:oklch(0.2 0.02 65 / .62); color:#fff; font-size:11.5px; font-weight:600; font-family:var(--mono); display:grid; place-items:center; }
.play-btn{ width:54px; height:54px; border-radius:50%; background:oklch(1 0 0 / .92); display:grid; place-items:center; box-shadow:var(--shadow-lg); color:var(--ink); position:relative; z-index:2; }
.play-tri{ width:0; height:0; border-style:solid; border-width:9px 0 9px 15px; border-color:transparent transparent transparent currentColor; margin-left:3px; }

.audio-asset{ display:flex; align-items:center; gap:14px; padding:16px; }
.audio-asset audio{ flex:1; width:100%; }
.asset-empty{ border:1.5px dashed var(--line-2); border-radius:var(--radius); padding:22px; text-align:center; color:var(--ink-3); font-size:13.5px; }
.gen-pending{ display:flex; align-items:center; gap:10px; color:var(--accent-ink); font-weight:600; font-size:13.5px; padding:18px; }

/* Preferences: palette cards */
.palette-card{
  display:flex; flex-direction:column; gap:8px;
  padding:14px; border-radius:var(--radius);
  background:var(--card); border:1px solid var(--line);
  box-shadow:var(--shadow-sm);
  cursor:pointer; text-align:left;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.palette-card:hover{ border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.palette-card.on{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent), var(--shadow-sm);
}
.palette-swatch{
  height:64px; border-radius:10px; position:relative;
  border:1px solid var(--line-2); overflow:hidden;
}
.palette-swatch span{
  position:absolute; bottom:10px; left:10px; width:28px; height:28px;
  border-radius:8px; box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.palette-name{ font-weight:600; font-size:14px; color:var(--ink); }
.palette-id{ font-family:var(--mono); font-size:11px; color:var(--ink-4); letter-spacing:0.04em; }

/* Preferences: font cards */
.font-card{
  display:flex; flex-direction:column; gap:10px;
  padding:16px; border-radius:var(--radius);
  background:var(--card); border:1px solid var(--line);
  box-shadow:var(--shadow-sm);
  cursor:pointer; text-align:left;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
.font-card:hover{ border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.font-card.on{
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent), var(--shadow-sm);
}
.font-sample{ font-size:24px; line-height:1.1; color:var(--ink); letter-spacing:-0.01em; }
.font-meta{ display:flex; flex-direction:column; gap:2px; }
.font-name{ font-weight:600; font-size:13.5px; color:var(--ink); }
.font-note{ font-size:11.5px; color:var(--ink-3); }

.chan-pick{ display:flex; align-items:center; gap:12px; width:100%; text-align:left; padding:11px 12px; border-radius:11px; cursor:pointer; background:var(--card); border:1px solid var(--line); box-shadow:var(--shadow-sm); transition:background .14s, border-color .14s, box-shadow .14s; }
.chan-pick.on{ background:var(--accent-soft); border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.chan-pick .pick-check{ width:20px; height:20px; border-radius:6px; flex:none; display:grid; place-items:center; background:var(--card); border:1.5px solid var(--line-2); color:#fff; }
.chan-pick.on .pick-check{ background:var(--accent); border-color:var(--accent); }
