:root {
  --bg: #09070d;
  --bg-2: #101018;
  --panel: #17131f;
  --panel-2: #1f1b28;
  --line: #34303f;
  --line-strong: #51495f;
  --text: #f7f2fb;
  --muted: #a79fb0;
  --muted-2: #797082;
  --acid: #cbff4a;
  --cyan: #4deeea;
  --pink: #ff4fc8;
  --warning: #ffb347;
  --danger: #ff5d6c;
  --success: #80ff9f;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
  --radius: 8px;
  --sidebar-width: 254px;
  --topbar-height: 68px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(203, 255, 74, .06) 0 1px, transparent 1px 18px),
    linear-gradient(90deg, rgba(77, 238, 234, .04), transparent 48%, rgba(255, 79, 200, .035)),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: inherit; }
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 20px;
  background: rgba(9, 7, 13, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 8px;
  color: #101310;
  background: var(--acid);
  font-size: 12px;
  font-weight: 900;
  transform: skew(-6deg);
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: 0; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  min-width: 172px;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(128, 255, 159, .45);
}

.save-indicator[data-state="saving"] .save-dot,
.save-indicator[data-state="unsaved"] .save-dot { background: var(--warning); }
.save-indicator[data-state="saving"] .save-dot { animation: pulse 1s infinite; }
.save-indicator[data-state="offline"] .save-dot { background: var(--muted-2); }
.save-indicator[data-state="error"] .save-dot { background: var(--danger); }

@keyframes pulse {
  50% { opacity: .35; transform: scale(.72); }
}

.icon-button,
.mini-button,
.text-button,
.close-button,
.filter-chip,
.segmented button,
.nav-item {
  border: 0;
}

.icon-button,
.button,
.mini-button,
.close-button,
.filter-chip,
.segmented button {
  min-height: 38px;
  border-radius: var(--radius);
}

.icon-button {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: #ddd6e5;
  font-size: 12px;
}
.icon-button:hover,
.button.ghost:hover,
.mini-button:hover,
.close-button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .075); }

.menu {
  position: fixed;
  top: 58px;
  right: 18px;
  z-index: 70;
  display: grid;
  min-width: 218px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #17131f;
  box-shadow: var(--shadow);
}
.menu button {
  padding: 11px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.menu button:hover { background: rgba(255, 255, 255, .07); }
.danger-text { color: var(--danger) !important; }

.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: rgba(12, 10, 18, .92);
  overflow-y: auto;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--text);
}

.series-list { display: grid; gap: 7px; }
.series-item {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.series-item:hover { background: rgba(255, 255, 255, .04); }
.series-item.active { border-color: rgba(203, 255, 74, .32); background: rgba(203, 255, 74, .08); color: var(--text); }
.series-thumb {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: #0d0f0b;
  background: var(--acid);
  font-size: 11px;
  font-weight: 900;
}
.series-item strong,
.series-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-item strong { font-size: 12px; }
.series-item small { margin-top: 3px; color: var(--muted-2); font-size: 10px; }
.mini-progress { color: var(--muted); font-size: 10px; }

.sidebar-nav {
  display: grid;
  gap: 4px;
  margin-top: 26px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
}
.nav-item span { color: var(--muted-2); font-size: 10px; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-item.active { color: var(--acid); background: rgba(203, 255, 74, .09); }

.sidebar-footer {
  margin-top: auto;
  padding: 20px 8px 0;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.5;
}
.storage-badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 9px;
  text-transform: uppercase;
}

.workspace {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  padding: 32px clamp(18px, 4vw, 54px) 70px;
}
.workspace-header,
.view {
  max-width: 1500px;
  margin: 0 auto;
}
.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 28px;
}
.kicker,
.panel-label {
  margin: 0;
  color: var(--acid);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.title-input {
  width: min(660px, 62vw);
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(30px, 4vw, 50px);
  font-weight: 850;
  letter-spacing: 0;
}
.series-number {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(203, 255, 74, .34);
  border-radius: var(--radius);
  background: rgba(203, 255, 74, .08);
  color: var(--acid);
  font-size: 10px;
  font-weight: 800;
}
.tagline-input {
  width: min(740px, 78vw);
  margin-top: 9px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  outline: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.tagline-input:focus { border-color: var(--line-strong); color: var(--text); }
.header-controls,
.view-actions {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}
.compact-field {
  display: grid;
  gap: 6px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.compact-field input,
.compact-field select {
  min-width: 132px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  color-scheme: dark;
  font-size: 12px;
  font-weight: 500;
}

.view { display: none; }
.view.active { display: block; }
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 14px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .045), transparent 46%),
    var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.progress-panel,
.countdown-panel,
.metric-panel,
.activity-panel,
.roadmap-panel,
.next-panel,
.editor-panel,
.notes-panel { padding: 22px; }
.progress-layout {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-top: 22px;
}
.progress-ring {
  --progress: 0;
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  background: conic-gradient(var(--acid) calc(var(--progress) * 1%), rgba(255, 255, 255, .08) 0);
  position: relative;
}
.progress-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: inherit;
  background: #14101b;
}
.progress-ring strong,
.progress-ring span { position: relative; z-index: 1; }
.progress-ring strong { font-size: 30px; font-weight: 900; }
.progress-ring span { margin-top: 38px; color: var(--muted); font-size: 10px; }
.progress-stats { display: grid; gap: 14px; }
.progress-stats div,
.metric-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
}
.progress-stats strong,
.metric-grid strong { font-size: 23px; }
.progress-stats span,
.metric-grid span { color: var(--muted); font-size: 11px; }
.progress-info {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.progress-info summary { color: var(--acid); cursor: pointer; }
.countdown-value {
  margin-top: 26px;
  font-size: clamp(42px, 6vw, 70px);
  font-weight: 900;
}
.countdown-label { color: var(--muted); font-size: 12px; }
.milestone-strip,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}
.metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.milestone-strip div {
  padding: 11px 9px;
  border-top: 1px solid var(--line);
}
.milestone-strip span,
.milestone-strip small { display: block; }
.milestone-strip span { font-size: 17px; font-weight: 800; }
.milestone-strip small { color: var(--muted-2); font-size: 9px; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.panel-head h2,
.view-intro h2 {
  margin: 6px 0 0;
  font-size: 20px;
  letter-spacing: 0;
}
.activity-list,
.next-actions {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}
.activity-entry,
.next-action {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.activity-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--pink);
}
.activity-entry strong,
.next-action strong { display: block; font-size: 11px; }
.activity-entry span,
.next-action span,
.activity-entry time { color: var(--muted-2); font-size: 10px; }
.next-panel,
.roadmap-panel { margin-top: 14px; }
.roadmap {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 20px;
}
.roadmap-step {
  min-height: 110px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
  text-align: left;
}
.roadmap-step:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.roadmap-step.done { border-color: rgba(128, 255, 159, .36); background: rgba(128, 255, 159, .05); }
.roadmap-step.blocked { border-color: rgba(255, 93, 108, .4); }
.roadmap-step small { color: var(--muted-2); font-size: 9px; }
.roadmap-step strong {
  display: block;
  margin: 14px 0 10px;
  font-size: 12px;
  line-height: 1.35;
}
.bar {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--acid) var(--pct), rgba(255, 255, 255, .08) 0);
}

.view-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}
.view-intro h2 { font-size: 27px; }
.filter-row,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.filter-chip,
.segmented button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  color: var(--muted);
  font-size: 10px;
}
.filter-chip.active,
.segmented button.active {
  border-color: rgba(203, 255, 74, .38);
  background: rgba(203, 255, 74, .1);
  color: var(--acid);
}
.stage-grid,
.chapter-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.stage-card,
.chapter-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.stage-card:hover,
.chapter-card:hover { border-color: var(--line-strong); }
.stage-top,
.chapter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.stage-index,
.chapter-code { color: var(--acid); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.stage-status,
.chapter-state {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}
.stage-card h3,
.chapter-card h3 { margin: 17px 0 8px; font-size: 17px; }
.stage-card p,
.chapter-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.stage-task-preview { display: grid; gap: 7px; margin: 15px 0; }
.preview-task { display: flex; align-items: center; gap: 8px; color: #cbc3d1; font-size: 10px; }
.preview-task i { width: 9px; height: 9px; border: 1px solid var(--muted-2); border-radius: 3px; }
.preview-task.done { color: var(--muted-2); text-decoration: line-through; }
.preview-task.done i { border-color: var(--success); background: var(--success); }
.stage-footer,
.chapter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.text-button,
.stage-open,
.chapter-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--acid);
  font-size: 10px;
}
.chapter-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-top: 16px;
}
.chapter-meta div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
}
.chapter-meta span,
.chapter-meta strong { display: block; }
.chapter-meta span { color: var(--muted-2); font-size: 8px; text-transform: uppercase; }
.chapter-meta strong { margin-top: 5px; font-size: 10px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}
th, td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}
th { color: var(--text); font-size: 10px; text-transform: uppercase; }
td button { color: var(--acid); border: 0; background: transparent; }

.story-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.wide-panel { grid-column: 1 / -1; }
.asset-list,
.deliverable-list,
.scene-list,
.comment-timeline,
.checklist { display: grid; gap: 8px; margin-top: 14px; }
.asset-row,
.deliverable-row,
.scene-row,
.task-row,
.comment-card,
.check-row {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
}
.asset-row,
.deliverable-row,
.check-row {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}
.scene-row { grid-template-columns: 1fr auto; }
.asset-row input,
.deliverable-row input,
.check-row input { accent-color: var(--acid); }
.asset-row.checked span,
.deliverable-row.checked span,
.check-row.checked span {
  color: var(--muted-2);
  text-decoration: line-through;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, .62);
}
.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 60;
  width: min(620px, 94vw);
  padding: 24px;
  border-left: 1px solid var(--line-strong);
  background: #110d18;
  box-shadow: -35px 0 80px rgba(0, 0, 0, .4);
  transform: translateX(105%);
  transition: transform .22s ease;
  overflow-y: auto;
}
.detail-drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 6px 0 0; font-size: 25px; }
.drawer-content { padding: 20px 0; }
.drawer-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.drawer-section:first-child { padding-top: 0; }
.drawer-section h3 { margin: 0 0 12px; font-size: 13px; }
.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.task-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}
.task-check {
  width: 20px;
  height: 20px;
  border: 1px solid var(--muted-2);
  border-radius: 5px;
  background: transparent;
}
.task-row.done .task-check { border-color: var(--success); background: var(--success); color: #101411; }
.task-row.blocked { border-color: rgba(255, 93, 108, .42); }
.task-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.task-main small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.status-option {
  padding: 9px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  font-size: 10px;
}
.status-option.active {
  border-color: rgba(203, 255, 74, .4);
  background: rgba(203, 255, 74, .1);
  color: var(--acid);
}

.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea,
.inline-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  color-scheme: dark;
  font-size: 12px;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-input:focus { border-color: rgba(203, 255, 74, .42); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 13px;
}
.field.full { grid-column: 1 / -1; }
.color-inputs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.color-inputs input { height: 42px; padding: 4px; }
.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 750;
}
.button.primary { border-color: var(--acid); background: var(--acid); color: #101310; }
.button.ghost { background: rgba(255, 255, 255, .04); color: var(--text); }
.button.danger { border-color: var(--danger); background: var(--danger); color: white; }
.button.wide { width: 100%; }
.close-button {
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 16px;
}
.modal {
  width: min(700px, calc(100vw - 30px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #15101d;
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(5px); }
.modal form { padding: 23px; }
.small-modal { width: min(510px, calc(100vw - 30px)); }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.modal-head h2 { margin: 6px 0 0; font-size: 24px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.confirm-text { color: var(--muted); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.form-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(203, 255, 74, .08) 0 1px, transparent 1px 18px),
    #09070d;
}
.login-card {
  width: min(430px, 100%);
  padding: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 8px 0; font-size: 30px; letter-spacing: 0; }
.login-copy { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: min(480px, calc(100vw - 30px));
  padding: 11px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #20162a;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11px;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-state {
  padding: 22px 10px;
  color: var(--muted-2);
  text-align: center;
  font-size: 11px;
}
.comment-card {
  grid-template-columns: 38px 1fr auto;
  align-items: start;
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  color: #0f0d13;
  font-size: 10px;
  font-weight: 900;
}
.comment-card strong { display: block; font-size: 11px; }
.comment-card p { margin: 5px 0 0; color: #cec7d5; font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.comment-card time,
.comment-card small { color: var(--muted-2); font-size: 9px; }
.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.comment-actions button,
.row-action {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--acid);
  font-size: 10px;
}

body.focus-mode .stage-card[data-complete="true"],
body.focus-mode .chapter-card[data-complete="true"] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 1180px) {
  .roadmap { grid-template-columns: repeat(3, 1fr); }
  .stage-grid,
  .chapter-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    position: fixed;
    top: auto;
    right: 0;
    width: 100%;
    height: 64px;
    padding: 6px 8px;
    flex-direction: row;
    border-top: 1px solid var(--line);
    border-right: 0;
  }
  .sidebar-section,
  .sidebar-footer { display: none; }
  .sidebar-nav {
    width: 100%;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    margin: 0;
  }
  .nav-item {
    justify-content: center;
    height: 51px;
    padding: 5px;
    text-align: center;
    font-size: 0;
  }
  .nav-item span { font-size: 11px; }
  .workspace {
    width: 100%;
    margin-left: 0;
    padding-bottom: 100px;
  }
  .workspace-header,
  .view-intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .header-controls,
  .view-actions { width: 100%; flex-wrap: wrap; }
  .compact-field { flex: 1; }
  .compact-field input,
  .compact-field select { width: 100%; }
  .dashboard-grid,
  .story-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 11px; }
  .brand small,
  .save-indicator,
  #focusButton { display: none; }
  .workspace { padding: 24px 12px 90px; }
  .title-input { width: min(73vw, 450px); font-size: 31px; }
  .series-number { display: none; }
  .tagline-input { width: 100%; }
  .filter-row { overflow-x: auto; width: 100%; flex-wrap: nowrap; }
  .stage-grid,
  .chapter-board { grid-template-columns: 1fr; }
  .roadmap,
  .milestone-strip,
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .progress-layout { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full,
  .wide-panel { grid-column: auto; }
  .modal form { padding: 18px; }
}

@media print {
  .topbar,
  .sidebar,
  .header-controls,
  .topbar-actions,
  .button,
  .text-button,
  .filter-row,
  .drawer-backdrop,
  .detail-drawer { display: none !important; }
  body { background: white; color: #111; }
  .workspace { width: 100%; margin: 0; padding: 0; }
  .panel,
  .stage-card,
  .chapter-card {
    break-inside: avoid;
    background: white;
    color: #111;
    border-color: #ddd;
    box-shadow: none;
  }
  .view { display: block !important; margin-bottom: 30px; }
  .view:not(#dashboardView):not(#blueprintView):not(#chaptersView) { display: none !important; }
  .title-input,
  .tagline-input { color: #111; }
  .kicker,
  .panel-label { color: #555; }
}
