:root {
  --ink: #0f172a; --ink-2: #1e293b; --muted: #64748b; --line: #e2e8f0; --bg: #f8fafc; --card: #ffffff;
  --accent: #d97706; --accent-2: #f59e0b; --ok: #15803d; --ok-bg: #dcfce7; --warn: #a16207; --warn-bg: #fef9c3;
  --bad: #b91c1c; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe; --neutral-bg: #f1f5f9;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0; }
h4 { margin: 1rem 0 .4rem; font-size: .95rem; }
code { background: var(--neutral-bg); padding: 1px 5px; border-radius: 5px; font-size: .85em; word-break: break-all; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cbd5e1; border-radius: 8px; padding: .5rem .65rem; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
textarea { min-height: 80px; width: 100%; resize: vertical; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; width: 48px; height: 36px; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .pad { padding: 2rem; }
.text-bad { color: var(--bad); } .text-warn { color: var(--warn); }
.row { display: flex; align-items: center; } .row.space { justify-content: space-between; gap: 1rem; } .gap { gap: .5rem; } .wrap { flex-wrap: wrap; } .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.full { width: 100%; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); border-radius: 8px; padding: .5rem .9rem; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--neutral-bg); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger-ghost { color: var(--bad); border-color: #fecaca; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.link { background: none; border: 0; color: var(--info); cursor: pointer; padding: 0; font: inherit; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; text-transform: lowercase; white-space: nowrap; vertical-align: middle; margin-left: .25rem; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); } .badge-neutral { background: var(--neutral-bg); color: var(--muted); }
.alert { padding: .65rem .85rem; border-radius: 8px; margin: .25rem 0; font-size: .9rem; border: 1px solid; }
.alert ul { margin: .35rem 0 0 1rem; padding: 0; }
.alert-error { background: var(--bad-bg); color: #7f1d1d; border-color: #fecaca; }
.alert-blocked { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.alert-warn { background: var(--warn-bg); color: #713f12; border-color: #fde68a; }
.alert-ok { background: var(--ok-bg); color: #14532d; border-color: #bbf7d0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-link { display: flex; flex-direction: column; gap: .2rem; color: inherit; text-decoration: none !important; }
.card-link:hover { border-color: var(--accent-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.empty { text-align: center; padding: 2.5rem 1rem; border: 1px dashed #cbd5e1; border-radius: var(--radius); margin: 1rem 0; background: #fff; }
.empty-title { font-weight: 600; margin-bottom: .35rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: .75rem; color: var(--muted); }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: .5rem 0; }
.form-row .field { flex: 1 1 180px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: .5rem; }
.table td { border-bottom: 1px solid var(--line); padding: .55rem .5rem; vertical-align: top; }
.table.compact td { padding: .3rem .5rem; }
.clickable { cursor: pointer; } .clickable:hover td { background: #f8fafc; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .65rem; font-size: .85rem; background: #fff; cursor: pointer; }
.tabs { margin: .5rem 0 1rem; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .8rem; cursor: pointer; font: inherit; font-size: .85rem; text-transform: capitalize; }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.checklist { list-style: none; padding: 0; margin: 0; } .checklist li { padding: .3rem 0; color: var(--muted); } .checklist li.done { color: var(--ok); }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: .4rem .8rem; margin: 0; } .dl dt { color: var(--muted); font-size: .85rem; } .dl dd { margin: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #cbd5e1; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { color: #fff; }
.sidebar-top { display: flex; justify-content: space-between; align-items: center; }
.logo { font-weight: 800; letter-spacing: .14em; font-size: 1.05rem; color: var(--ink); text-decoration: none !important; }
.ws-name { font-size: .85rem; color: #fff; padding: .4rem .5rem; background: var(--ink-2); border-radius: 8px; }
.ws-switch { background: var(--ink-2); color: #fff; border-color: #334155; }
.nav-item { display: block; padding: .45rem .6rem; border-radius: 7px; color: #cbd5e1; font-size: .92rem; text-decoration: none !important; }
.nav-item:hover { background: var(--ink-2); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; color: #94a3b8; line-height: 1.6; }
.sidebar-foot .link { color: #fbbf24; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1.5rem; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.brand-pick { display: flex; align-items: center; gap: .5rem; } .brand-pick select { min-width: 200px; }
.bell { position: relative; font-weight: 500; }
.dot { background: var(--bad); color: #fff; font-size: .7rem; border-radius: 999px; padding: 0 .4rem; margin-left: .3rem; }
.content { padding: 1.5rem; max-width: 1280px; }
.hide-desktop { display: none; }

/* studio */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; margin-top: .75rem; }
.variant { margin: 0; padding: .75rem; }
.variant-head { font-weight: 600; font-size: .85rem; margin-bottom: .4rem; display: flex; justify-content: space-between; }
.variant img, .variant video { width: 100%; border-radius: 6px; margin-bottom: .4rem; background: #000; }
.caption { white-space: pre-wrap; font-family: inherit; font-size: .88rem; margin: 0; word-break: break-word; }
.media-strip { display: flex; gap: .5rem; flex-wrap: wrap; margin: .25rem 0 .5rem; }
.media-strip img, .media-strip video { height: 120px; border-radius: 6px; border: 1px solid var(--line); }
.media-strip figure { margin: 0; display: flex; flex-direction: column; gap: .25rem; }
.render-out img { max-width: 360px; width: 100%; border-radius: 6px; border: 1px solid var(--line); }
.picker { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin-top: .5rem; max-height: 420px; overflow: auto; }
.comment { border-bottom: 1px solid var(--line); padding: .4rem 0; } .comment p { margin: .2rem 0; }
.copy { display: block; margin-top: .35rem; user-select: all; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.asset { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.asset-thumb { aspect-ratio: 1; background: var(--neutral-bg); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; } .asset-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal-head { font-size: .75rem; font-weight: 600; color: var(--muted); padding: .4rem; border-bottom: 1px solid var(--line); background: var(--neutral-bg); }
.cal-day { min-height: 110px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem; display: flex; flex-direction: column; gap: .25rem; }
.cal-day.out { background: #fafafa; color: #94a3b8; } .cal-day.today .cal-n { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 .4rem; }
.cal-n { font-size: .78rem; align-self: flex-start; }
.cal-item { font-size: .75rem; background: var(--info-bg); border-radius: 6px; padding: .2rem .35rem; overflow: hidden; }
.cal-item a { color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.tone-PUBLISHED { background: var(--ok-bg); } .cal-item.tone-FAILED, .cal-item.tone-BLOCKED { background: var(--bad-bg); } .cal-item.tone-PAUSED { background: var(--warn-bg); } .cal-item.tone-DRY_RUN_COMPLETE, .cal-item.tone-CANCELED { background: var(--neutral-bg); }

.split { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; align-items: start; }
.split-list { display: flex; flex-direction: column; gap: .4rem; max-height: 75vh; overflow: auto; }
.split-detail { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; min-height: 300px; }
.convo { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; color: inherit; text-decoration: none !important; }
.convo.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thread { display: flex; flex-direction: column; gap: .6rem; }
.msg { max-width: 85%; padding: .55rem .75rem; border-radius: 10px; background: var(--neutral-bg); }
.msg.out { align-self: flex-end; background: #fff7ed; border: 1px solid #fed7aa; }
.msg p { margin: .2rem 0; white-space: pre-wrap; }
.transcript { max-height: 280px; overflow: auto; font-size: .88rem; display: flex; flex-direction: column; gap: .3rem; margin-top: .5rem; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.clip { margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.clip-video { width: 100%; max-height: 360px; background: #000; border-radius: 6px; }
.meter { height: 8px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; margin: .2rem 0 .6rem; }
.meter > div { height: 100%; background: var(--ink); } .meter > .hot { background: var(--bad); }
.usage-row { display: flex; justify-content: space-between; font-size: .9rem; }
.narrative { white-space: pre-wrap; font-family: inherit; margin: 0; }
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; margin: .5rem 0; }
.evidence-card { margin: 0; padding: .6rem .75rem; } .evidence-card blockquote { margin: .3rem 0; padding-left: .6rem; border-left: 3px solid var(--accent-2); color: var(--muted); font-size: .85rem; }
.creator { border-top: 1px solid var(--line); padding: .6rem 0; }
.danger-zone { border-color: #fecaca; }

/* public */
.pub { background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
.pub-nav { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: #fff; }
.pub-nav nav a { color: var(--ink); font-size: .92rem; }
.hero { padding: 5rem 2rem 3.5rem; max-width: 960px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.12; letter-spacing: -0.025em; }
.lead { font-size: 1.15rem; color: #334155; max-width: 720px; margin-bottom: 1.5rem; }
.pub-section { padding: 2.5rem 2rem; max-width: 960px; margin: 0 auto; width: 100%; }
.steps { list-style: none; padding: 0; display: grid; gap: .75rem; }
.steps li { display: flex; gap: 1rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.steps p { margin: .2rem 0 0; color: #475569; }
.step-n { flex: none; width: 2rem; height: 2rem; border-radius: 999px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.prose { max-width: 720px; } .prose p { color: #334155; }
.pub-footer { margin-top: auto; display: flex; justify-content: space-between; padding: 1.5rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: .8rem; }
.review-wrap { min-height: 100vh; background: var(--bg); }
.review-main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; }
.review-main .media-strip img, .review-main .media-strip video { height: auto; max-height: 420px; max-width: 100%; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15,23,42,.35); }
  .hide-desktop { display: inline-flex; }
  .editor, .split { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .topbar { padding: .5rem 1rem; }
  .brand-pick select { min-width: 0; max-width: 46vw; }
  .calendar { grid-template-columns: repeat(7, minmax(44px, 1fr)); font-size: .7rem; overflow-x: auto; }
  .cal-day { min-height: 70px; }
  .cal-item .badge { display: none; }
  .table { display: block; overflow-x: auto; }
  .pub-nav { padding: .8rem 1rem; } .pub-nav nav a:not(.btn) { display: none; }
  .hero { padding: 2.5rem 1rem 2rem; } .pub-section { padding: 1.5rem 1rem; }
  .dl { grid-template-columns: 1fr; }
}
