:root {
  --bg: #080910;
  --surface: #11131d;
  --surface-2: #171a26;
  --surface-3: #202434;
  --line: rgba(214, 223, 255, 0.12);
  --text: #f6f7fb;
  --muted: #a0a7bb;
  --soft: #d5ddf4;
  --accent: #8f7cff;
  --accent-2: #2bd2bd;
  --good: #66d38e;
  --warn: #f2b84b;
  --danger: #ff667d;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(112deg, rgba(143, 124, 255, 0.12), transparent 34%),
    linear-gradient(246deg, rgba(43, 210, 189, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 98px),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  color: #0b0d13;
  background: var(--text);
  border-radius: 8px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(143, 124, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(143, 124, 255, 0.12);
}

select option {
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
  isolation: isolate;
}

.shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(6, 7, 13, 0.92), rgba(6, 7, 13, 0.62), rgba(6, 7, 13, 0.92)),
    url("/assets/login/collage-02.webp") 82% 8% / 250px auto no-repeat,
    url("/assets/login/collage-05.webp") 98% 88% / 230px auto no-repeat,
    url("/assets/login/collage-03.webp") 34% 100% / 220px auto no-repeat;
  opacity: 0.2;
  filter: saturate(0.8) contrast(0.95);
  pointer-events: none;
}

.shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 9, 16, 0.12), rgba(8, 9, 16, 0.86)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 84px);
  pointer-events: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(16, 18, 29, 0.88), rgba(8, 9, 16, 0.92)),
    rgba(9, 10, 18, 0.86);
  backdrop-filter: blur(18px);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand {
  display: grid;
  gap: 12px;
}

.brand-logo {
  width: 136px;
  height: auto;
  display: block;
}

.brand-subtitle, .eyebrow, .muted, .metric-hint {
  color: var(--muted);
}

.brand-subtitle {
  font-size: 13px;
  line-height: 1.6;
}

nav {
  display: grid;
  gap: 8px;
}

.nav {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 700;
  min-height: 44px;
}

.nav.active, .nav:hover {
  background:
    linear-gradient(90deg, rgba(143, 124, 255, 0.17), rgba(255,255,255,0.055));
  border-color: rgba(214, 223, 255, 0.16);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.main {
  position: relative;
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 223, 255, 0.1);
  border-radius: 8px;
  background: rgba(10, 12, 20, 0.54);
  backdrop-filter: blur(18px);
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: 0;
}

h2, h3, p {
  margin-top: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 8px;
}

.content {
  display: grid;
  gap: 18px;
}

.content > * {
  animation: riseIn 0.28s ease both;
}

.page-hero, .studio-hero, .project-hero, .panel, .metric, .story-card, .item, .timeline-body, .empty {
  background: rgba(17, 19, 29, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 52px rgba(0,0,0,0.24);
  backdrop-filter: blur(18px);
}

.page-hero, .studio-hero, .project-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 260px;
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.18), rgba(43, 210, 189, 0.06) 48%, rgba(255, 255, 255, 0.04)),
    rgba(17, 19, 29, 0.9);
}

.page-hero::before, .studio-hero::before, .project-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,0.035), transparent),
    repeating-linear-gradient(110deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 78px);
  opacity: 0.5;
  pointer-events: none;
}

.page-hero > *, .studio-hero > *, .project-hero > * {
  position: relative;
}

.page-hero p, .studio-hero p, .project-hero p, .calm-copy {
  color: var(--soft);
  line-height: 1.8;
  margin-bottom: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary-action {
  min-width: 160px;
}

.ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--text);
}

.hero-orbit, .forge-meter {
  width: 190px;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
    rgba(8, 9, 16, 0.55);
  border: 1px solid rgba(255,255,255,0.1);
}

.hero-orbit strong, .meter-value {
  display: block;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
}

.hero-orbit span, .meter-label {
  display: block;
  color: var(--muted);
  margin: 2px 0 14px;
}

.meter-bar, .progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  overflow: hidden;
}

.meter-bar span, .progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--warn));
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  min-height: 96px;
}

.metric-value {
  min-width: 54px;
  font-size: 34px;
  font-weight: 900;
  color: var(--text);
}

.metric-label {
  font-weight: 800;
}

.metric-hint {
  margin-top: 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(214, 223, 255, 0.1);
  border-radius: 8px;
  background: rgba(10, 12, 20, 0.46);
  backdrop-filter: blur(16px);
}

.flow-step {
  min-height: 138px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.022)),
    rgba(255,255,255,0.035);
}

.flow-step span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 13px;
}

.flow-step strong {
  display: block;
  margin-bottom: 7px;
}

.flow-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.flow-step.current {
  border-color: rgba(242, 184, 75, 0.48);
  background: rgba(242, 184, 75, 0.07);
}

.flow-step.current span {
  background: var(--warn);
  color: #171005;
}

.flow-step.done {
  border-color: rgba(102, 211, 142, 0.42);
  background: rgba(102, 211, 142, 0.06);
}

.flow-step.done span {
  background: var(--good);
  color: #041207;
}

.work-grid, .split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  margin-top: 16px;
}

.command-grid .panel:last-child {
  grid-column: 1 / -1;
}

.onboarding-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.onboarding-list div {
  display: grid;
  grid-template-columns: auto minmax(0, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.onboarding-list div.done {
  border-color: rgba(102, 211, 142, 0.28);
  background: rgba(102, 211, 142, 0.045);
}

.onboarding-list span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--soft);
  font-size: 12px;
  font-weight: 900;
}

.onboarding-list .done span {
  background: var(--good);
  color: #041207;
}

.onboarding-list p {
  margin: 0;
  color: var(--muted);
}

.mission-list {
  display: grid;
  gap: 10px;
}

.mission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.mission-item strong {
  display: block;
  margin: 8px 0 5px;
}

.mission-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.mission-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 122px;
  color: var(--muted);
  font-size: 12px;
}

.mission-meta button {
  min-height: 34px;
  padding: 7px 11px;
}

.work-grid.compact, .split.compact {
  margin-top: 12px;
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

.focus-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.immersive-form, .upload-form, .project-form, .search-form {
  display: grid;
  gap: 12px;
}

.immersive-form input,
.immersive-form textarea,
.immersive-form select {
  min-height: 48px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.065), rgba(255,255,255,0.035));
}

.immersive-form button {
  min-height: 48px;
  background: linear-gradient(135deg, #f6f8ff, #cfd7ff);
}

.file-drop {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 142px;
  place-items: center;
  text-align: center;
  padding: 22px;
  border: 1px dashed rgba(214, 223, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.11), rgba(43, 210, 189, 0.045)),
    rgba(255,255,255,0.035);
  color: var(--soft);
  cursor: pointer;
}

.file-drop:hover,
.file-drop.dragging {
  border-color: rgba(143, 124, 255, 0.52);
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.16), rgba(43, 210, 189, 0.07)),
    rgba(255,255,255,0.045);
}

.file-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-drop strong {
  font-size: 20px;
}

.file-drop span {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.7;
}

.batch-preview {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.empty-preview {
  min-height: 48px;
  place-items: center;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
}

.batch-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.batch-file span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-form {
  grid-template-columns: minmax(0, 1fr) repeat(2, 180px) auto;
}

#novelSearchForm.search-form {
  grid-template-columns: minmax(0, 1fr) 180px auto;
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-prompts button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 13px;
}

.pager button {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12px;
}

.project-starters {
  margin-top: 0;
}

.prompt-card-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.prompt-card {
  display: grid;
  gap: 4px;
  text-align: left;
  min-height: 82px;
  padding: 11px;
  border: 1px solid rgba(143, 124, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.08), rgba(43, 210, 189, 0.035)),
    rgba(255,255,255,0.035);
  color: var(--text);
}

.prompt-card span {
  color: var(--muted);
  font-size: 12px;
}

.prompt-card strong {
  line-height: 1.45;
  font-size: 13px;
}

.item-list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02)),
    rgba(255,255,255,0.035);
}

.project-item {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.novel-item {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.user-item {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.user-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.user-editor {
  max-width: 760px;
}

.user-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.user-edit-form input,
.user-edit-form select {
  min-height: 40px;
  padding: 9px 10px;
}

.user-edit-form button {
  min-height: 40px;
  padding: 9px 12px;
}

.admin-only {
  display: none;
}

.chapter-count {
  min-width: 58px;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
}

.chapter-count span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--soft);
  background: rgba(255,255,255,0.05);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.completed, .badge.approved, .badge.uploaded, .badge.useful, .badge.select, .badge.publish, .badge.published, .badge.full_100_done, .badge.short_done {
  border-color: rgba(102, 211, 142, 0.42);
  color: #b8f4cb;
}

.badge.queued, .badge.running, .badge.current, .badge.planning, .badge.ok, .badge.plan, .badge.outline, .badge.review, .badge.partial {
  border-color: rgba(242, 184, 75, 0.44);
  color: #ffe0a0;
}

.badge.failed, .badge.waste, .badge.chunked_done {
  border-color: rgba(255, 102, 125, 0.5);
  color: #ffc1ca;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.job-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.progress.large {
  height: 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.story-card {
  padding: 18px;
  min-height: 230px;
}

.story-card p {
  color: var(--soft);
  line-height: 1.75;
  margin-bottom: 0;
}

.inspiration-card {
  display: grid;
  gap: 12px;
}

.inspiration-card h3 {
  margin-bottom: 0;
}

.asset-state {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 28px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.asset-field {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(0,0,0,0.14);
}

.asset-field.primary {
  border-color: rgba(143, 124, 255, 0.22);
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.1), rgba(43, 210, 189, 0.035)),
    rgba(0,0,0,0.16);
}

.asset-field span,
.asset-section > span {
  color: var(--muted);
  font-size: 12px;
}

.asset-field strong {
  color: var(--soft);
  line-height: 1.62;
  font-size: 13px;
}

.routine-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.routine-chain span {
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(43, 210, 189, 0.18);
  background: rgba(43, 210, 189, 0.08);
  color: #c9fff5;
  font-size: 12px;
  font-weight: 800;
}

.rhythm-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rhythm-strip div {
  padding: 10px;
  border-left: 2px solid rgba(143, 124, 255, 0.55);
  background: rgba(255,255,255,0.03);
  border-radius: 0 8px 8px 0;
}

.rhythm-strip span {
  color: var(--muted);
  font-size: 12px;
}

.rhythm-strip strong {
  display: block;
  margin: 4px 0;
}

.rhythm-strip p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.asset-section {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.028);
}

.asset-section.warning {
  border: 1px solid rgba(242, 184, 75, 0.22);
  background: rgba(242, 184, 75, 0.05);
}

.asset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.asset-footer button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.rating-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(255,255,255,0.028);
}

.rating-bar button {
  min-height: 32px;
  padding: 7px 8px;
  font-size: 12px;
}

.raw-card {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 8px;
}

.warning-note {
  margin: 0 0 16px;
  border-color: rgba(255, 102, 125, 0.28);
  color: #ffd7dd;
}

.novel-detail-grid {
  display: grid;
  gap: 18px;
}

.compact-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-card-grid .story-card {
  min-height: 0;
}

.chapter-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chapter-preview {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,0.075);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.06), rgba(43, 210, 189, 0.025)),
    rgba(255,255,255,0.028);
  cursor: pointer;
}

.chapter-preview span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-preview strong {
  line-height: 1.45;
}

.chapter-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-preview button {
  justify-self: start;
  min-height: 30px;
  padding: 6px 10px;
}

.chapter-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chapter-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 13, 0.78);
  backdrop-filter: blur(14px);
}

.chapter-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 94vw);
  max-height: 86vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  background: rgba(13, 15, 28, 0.96);
  box-shadow: 0 24px 80px rgba(0,0,0,0.44);
}

.chapter-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.chapter-modal-head span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-modal-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.chapter-modal-panel .manuscript {
  overflow: auto;
  max-height: calc(86vh - 76px);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,0.025);
}

.project-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(143, 124, 255, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(143, 124, 255, 0.12), rgba(43, 210, 189, 0.04)),
    rgba(255,255,255,0.035);
}

.project-command h3 {
  margin: 3px 0 8px;
  font-size: 24px;
}

.project-command p {
  margin: 0;
  color: var(--soft);
  line-height: 1.7;
}

.project-command-actions {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.project-command-actions span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.pipe-step {
  position: relative;
  min-height: 112px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
}

.pipe-step span {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: rgba(160, 167, 187, 0.55);
}

.pipe-step.done {
  border-color: rgba(102, 211, 142, 0.28);
  background: rgba(102, 211, 142, 0.045);
}

.pipe-step.done span {
  background: var(--good);
}

.pipe-step.current {
  border-color: rgba(242, 184, 75, 0.4);
  background: rgba(242, 184, 75, 0.06);
}

.pipe-step.current span {
  background: var(--warn);
}

.pipe-step strong {
  display: block;
}

.pipe-step p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.plan-grid {
  display: grid;
  gap: 12px;
}

.plan-card {
  padding: 15px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.plan-card.selected {
  border-color: rgba(102, 211, 142, 0.38);
  background: rgba(102, 211, 142, 0.055);
}

.plan-card h3 {
  margin-bottom: 8px;
}

.plan-card p {
  color: var(--soft);
  line-height: 1.7;
}

.plan-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.plan-badges span {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(43, 210, 189, 0.2);
  background: rgba(43, 210, 189, 0.08);
  color: #cbfff7;
  font-size: 12px;
  font-weight: 800;
}

.plan-card button {
  width: 100%;
  margin-top: 12px;
}

.mini-fields {
  display: grid;
  gap: 8px;
}

.mini-fields div,
.focus-box {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  background: rgba(0,0,0,0.16);
}

.mini-fields span,
.focus-box span {
  color: var(--muted);
  font-size: 12px;
}

.mini-fields strong,
.focus-box strong {
  color: var(--soft);
  line-height: 1.65;
  font-size: 13px;
}

.bible-view {
  display: grid;
  gap: 14px;
}

.bible-view h4 {
  margin: 4px 0 0;
}

.clean-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--soft);
  line-height: 1.7;
}

.cast-list {
  display: grid;
  gap: 8px;
}

.cast-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.cast-list span {
  color: var(--muted);
  line-height: 1.55;
}

.chapter-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.chapter-map article {
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.chapter-map span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-map strong {
  display: block;
  margin: 5px 0;
}

.chapter-map p,
.chapter-map em {
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.chapter-map em {
  display: block;
  color: #d9d2ff;
  font-style: normal;
}

.publish-box,
.review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.publish-box p,
.review-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.review-desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.review-reader,
.review-verdict {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  padding: 15px;
}

.review-verdict {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 18px;
}

.review-verdict button {
  width: 100%;
}

.review-lines {
  display: grid;
  gap: 8px;
}

.review-lines p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.review-lines strong {
  display: block;
  margin-bottom: 3px;
  color: var(--soft);
}

.review-score {
  min-width: 92px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  text-align: center;
  background: rgba(0,0,0,0.18);
}

.review-score strong {
  display: block;
  font-size: 30px;
}

.review-score span {
  color: var(--muted);
  font-size: 12px;
}

.manuscript {
  margin-top: 12px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  color: var(--soft);
  line-height: 1.9;
  white-space: pre-wrap;
}

.manuscript.preview {
  max-height: 520px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015)),
    rgba(0,0,0,0.2);
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 12px;
}

.content > .tag-row {
  margin-top: -6px;
  margin-bottom: 0;
}

.tag-row span {
  font-size: 12px;
  color: #d9d2ff;
  background: rgba(143, 124, 255, 0.1);
  border: 1px solid rgba(143, 124, 255, 0.18);
  border-radius: 999px;
  padding: 4px 8px;
}

.project-hero {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.project-score {
  min-width: 110px;
  text-align: center;
  padding: 14px;
  border-radius: 8px;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--line);
}

.project-score strong {
  display: block;
  font-size: 38px;
}

.project-score span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-list {
  display: grid;
  gap: 14px;
}

.chapter {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255,255,255,0.035);
}

.chapter-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.chapter-head span {
  color: var(--muted);
  font-size: 12px;
}

.chapter-copy {
  white-space: pre-wrap;
  line-height: 1.85;
  color: var(--soft);
  margin: 12px 0;
}

details {
  color: var(--muted);
}

summary {
  cursor: pointer;
}

.pre {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--soft);
  max-height: 420px;
  overflow: auto;
  margin: 0;
}

.soft-note {
  color: var(--muted);
  line-height: 1.7;
}

.timeline {
  position: relative;
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin: 20px auto 0;
  border-radius: 999px;
  background: var(--muted);
}

.timeline-item.running .timeline-dot, .timeline-item.queued .timeline-dot {
  background: var(--warn);
}

.timeline-item.completed .timeline-dot {
  background: var(--good);
}

.timeline-item.failed .timeline-dot {
  background: var(--danger);
}

.timeline-body {
  padding: 16px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.empty p {
  max-width: 460px;
  margin: 8px auto 16px;
  line-height: 1.7;
}

.empty-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border: 1px solid rgba(143, 124, 255, 0.25);
  border-radius: 8px;
  background: rgba(143, 124, 255, 0.12);
  color: #e2dcff;
  font-weight: 900;
  text-transform: uppercase;
}

.empty-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.danger { color: var(--danger); }
.warn { color: var(--warn); }

.login {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 26px;
  background:
    linear-gradient(90deg, rgba(4, 5, 10, 0.98), rgba(4, 5, 10, 0.68) 46%, rgba(4, 5, 10, 0.98)),
    linear-gradient(180deg, rgba(4, 5, 10, 0.72), rgba(4, 5, 10, 0.96));
  backdrop-filter: blur(16px);
  z-index: 10;
  overflow: hidden;
}

.login.show {
  display: grid;
}

.login::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 92px),
    linear-gradient(180deg, transparent, rgba(0,0,0,0.34));
  pointer-events: none;
}

.login::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 4, 9, 0.78), transparent 22%, transparent 78%, rgba(3, 4, 9, 0.84)),
    linear-gradient(180deg, rgba(3, 4, 9, 0.2), rgba(3, 4, 9, 0.88));
  pointer-events: none;
}

.login-scene {
  position: absolute;
  inset: -8vh -7vw;
  pointer-events: none;
  filter: saturate(0.82) contrast(0.96);
  perspective: 1200px;
}

.film-frame {
  --tilt: 0deg;
  position: absolute;
  width: clamp(150px, 15vw, 250px);
  height: clamp(320px, 44vw, 560px);
  margin: 0;
  padding: 9px 15px;
  border-radius: 10px;
  opacity: 0.43;
  border: 1px solid rgba(255,255,255,0.13);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    rgba(3, 4, 9, 0.82);
  box-shadow: 0 34px 88px rgba(0,0,0,0.5);
  transform-origin: center;
  transform: rotate(var(--tilt)) translateY(0);
  animation: floatFilm 9s ease-in-out infinite;
}

.film-frame.wide {
  width: clamp(260px, 34vw, 560px);
  height: clamp(148px, 19vw, 315px);
  padding: 14px 20px;
  opacity: 0.32;
}

.film-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  filter: brightness(0.9) saturate(0.9);
}

.film-frame::before,
.film-frame::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  width: 5px;
  background: radial-gradient(circle, rgba(235,240,255,0.34) 0 2px, transparent 2.6px) 0 0 / 5px 18px;
  opacity: 0.62;
}

.film-frame::before {
  left: 5px;
}

.film-frame::after {
  right: 5px;
}

.film-frame.wide::before,
.film-frame.wide::after {
  top: 8px;
  bottom: 8px;
  background-size: 5px 16px;
}

.tone-cold {
  border-color: rgba(101, 211, 238, 0.2);
}

.tone-violet {
  border-color: rgba(255, 116, 176, 0.17);
}

.tone-red {
  border-color: rgba(255, 106, 116, 0.2);
}

.tone-green {
  border-color: rgba(74, 211, 174, 0.18);
}

.tone-light {
  border-color: rgba(255, 236, 202, 0.18);
}

.tone-teal {
  border-color: rgba(43, 210, 189, 0.2);
}

.frame-a {
  left: 32vw;
  top: 5vh;
  --tilt: -2deg;
  animation-delay: -7s;
}

.frame-b {
  left: 4vw;
  top: 9vh;
  --tilt: -8deg;
  animation-delay: -1s;
}

.frame-c {
  left: 21vw;
  top: -4vh;
  --tilt: 4deg;
  animation-delay: -4s;
}

.frame-d {
  right: 23vw;
  top: -2vh;
  --tilt: -4deg;
  animation-delay: -2s;
}

.frame-e {
  right: 4vw;
  top: 10vh;
  --tilt: 7deg;
  animation-delay: -6s;
}

.frame-f {
  left: 14vw;
  bottom: -18vh;
  --tilt: 6deg;
  animation-delay: -3s;
}

.frame-g {
  right: 14vw;
  bottom: -16vh;
  --tilt: -7deg;
  animation-delay: -5s;
}

@keyframes floatFilm {
  0%, 100% { transform: rotate(var(--tilt)) translateY(0); }
  50% { transform: rotate(var(--tilt)) translateY(-14px); }
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  background:
    linear-gradient(180deg, rgba(24, 27, 40, 0.78), rgba(10, 12, 20, 0.82)),
    rgba(12, 14, 22, 0.78);
  border: 1px solid rgba(235, 240, 255, 0.16);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 32px 92px rgba(0,0,0,0.52);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.login-card-head {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  width: 148px;
  max-width: 68%;
  height: auto;
  display: block;
  margin: 0 auto 18px;
}

.login-kicker {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.login-card p {
  margin: 0;
  color: var(--soft);
  line-height: 1.7;
}

.login-fields {
  display: grid;
  gap: 12px;
}

.login-fields label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-fields input {
  height: 48px;
  border-color: rgba(235, 240, 255, 0.14);
  background: rgba(255,255,255,0.07);
}

.login-card button {
  width: 100%;
  margin-top: 16px;
}

.login-submit {
  height: 48px;
  background: linear-gradient(135deg, #f5f7ff, #cbd4ff);
}

.login-notes {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.login-notes span {
  color: #d4daf0;
  border: 1px solid rgba(235, 240, 255, 0.13);
  background: rgba(255,255,255,0.055);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

.error {
  margin-top: 12px;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(102, 211, 142, 0.42);
  background: rgba(13, 37, 24, 0.96);
  color: #d9ffe5;
  box-shadow: 0 18px 46px rgba(0,0,0,0.28);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .metrics-grid, .flow-panel, .work-grid, .split, .card-grid, .focus-panel, .page-hero, .studio-hero, .project-hero, .pipeline, .chapter-map, .asset-grid, .rhythm-strip, .compact-metrics, .command-grid, .chapter-preview-list, .project-command, .review-desk, .prompt-card-row {
    grid-template-columns: 1fr;
  }
  .hero-orbit, .forge-meter {
    width: 100%;
  }
  .project-hero {
    align-items: stretch;
  }
  .film-frame {
    width: 180px;
    height: 390px;
    opacity: 0.34;
  }
  .film-frame.wide {
    width: 360px;
    height: 205px;
    opacity: 0.28;
  }
  .frame-a { left: 18vw; top: -2vh; }
  .frame-b { left: -8vw; top: 10vh; }
  .frame-c { left: 20vw; top: -8vh; }
  .frame-d { right: 18vw; top: 0; }
  .frame-e { right: -8vw; top: 12vh; }
  .frame-f { left: 6vw; bottom: -18vh; }
  .frame-g { right: 8vw; bottom: -18vh; }
}

@media (max-width: 640px) {
  .main, .sidebar {
    padding: 16px;
  }
  .sidebar {
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
  }
  .brand-logo {
    width: 92px;
  }
  .brand-subtitle {
    font-size: 12px;
    line-height: 1.45;
  }
  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .nav {
    min-height: 38px;
    padding: 9px 8px;
    text-align: center;
  }
  .sidebar-footer {
    display: none;
  }
  .topbar {
    padding: 12px;
    flex-direction: row;
    align-items: center;
  }
  .topbar .eyebrow {
    display: none;
  }
  .topbar button {
    width: auto;
  }
  h1 {
    font-size: 26px;
  }
  h2 {
    font-size: 24px;
  }
  .section-head, .chapter-head {
    flex-direction: column;
    align-items: stretch;
  }
  .item, .project-item, .novel-item, .user-item, .job-row, .search-form, .batch-file, .publish-box, .review-card, .mission-item, .onboarding-list div, .user-edit-form {
    grid-template-columns: 1fr;
  }
  .review-verdict {
    position: static;
  }
  .mission-meta {
    justify-items: stretch;
  }
  .page-hero, .studio-hero, .project-hero, .panel {
    padding: 18px;
  }
  .page-hero, .studio-hero, .project-hero {
    min-height: auto;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-actions button {
    min-width: 0;
  }
  .flow-panel {
    padding: 10px;
  }
  .metric {
    grid-template-columns: 1fr;
  }
  .metric-value {
    font-size: 30px;
  }
  .login {
    padding: 16px;
  }
  .login-card {
    padding: 24px;
    width: min(320px, 100%);
  }
  .login-card h2 {
    font-size: 28px;
  }
  .login-scene {
    inset: -5vh -36vw;
  }
  .film-frame {
    width: 152px;
    height: 330px;
    padding: 7px 12px;
    opacity: 0.28;
  }
  .film-frame.wide {
    width: 270px;
    height: 152px;
    padding: 10px 16px;
    opacity: 0.22;
  }
  .frame-a { left: 34vw; top: 1vh; }
  .frame-b { left: -10vw; top: 0; }
  .frame-c { left: 50vw; top: -8vh; }
  .frame-d { right: -12vw; top: 10vh; }
  .frame-e { left: -20vw; right: auto; top: auto; bottom: 18vh; }
  .frame-f { left: 30vw; bottom: -16vh; }
  .frame-g { right: -18vw; bottom: -4vh; }
}

@media (prefers-reduced-motion: reduce) {
  .film-frame, .content > * {
    animation: none;
  }
}
