:root {
  --bg: #111417;
  --bg-elevated: #1a2024;
  --panel: rgba(250, 246, 237, 0.95);
  --panel-soft: rgba(255, 252, 244, 0.84);
  --ink: #1f1a14;
  --muted: #75695b;
  --line: rgba(58, 46, 32, 0.16);
  --accent: #bc6c25;
  --accent-dark: #8f4b10;
  --danger: #9d2d23;
  --success: #2c7c54;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-sans: "Avenir Next", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at top left, rgba(188, 108, 37, 0.24), transparent 28%),
    radial-gradient(circle at bottom right, rgba(225, 191, 105, 0.18), transparent 26%),
    linear-gradient(180deg, #171b20 0%, #111417 100%);
  color: #f4ede1;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
}

.brand-block {
  padding: 16px 14px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block h1 {
  margin: 6px 0 8px;
  font-size: 28px;
}

.brand-copy,
.sidebar-footer,
.panel-note {
  margin: 0;
  line-height: 1.6;
  color: rgba(244, 237, 225, 0.78);
  font-size: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-footer p:first-child {
  margin-top: 0;
  margin-bottom: 8px;
  color: #f7dcc0;
  font-weight: 600;
}

.sidebar-hint {
  color: rgba(244, 237, 225, 0.62);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: rgba(244, 237, 225, 0.82);
  text-align: left;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  transform: translateX(4px);
  background: rgba(188, 108, 37, 0.14);
  border-color: rgba(244, 237, 225, 0.12);
  color: #fff2e5;
}

.main-panel {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 6px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.topbar-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 246, 233, 0.08);
  border: 1px solid rgba(255, 246, 233, 0.08);
  color: #fce8d0;
  font-size: 13px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(252, 232, 208, 0.68);
}

.view-section {
  display: none;
  animation: section-in 260ms ease;
}

.view-section.active {
  display: block;
}

@keyframes section-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ai-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.hero-card,
.panel-card {
  color: var(--ink);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 26px;
  margin-bottom: 20px;
}

.hero-card h3 {
  margin: 8px 0 10px;
  font-size: 32px;
  line-height: 1.06;
}

.hero-card p:last-child {
  margin-bottom: 0;
  max-width: 720px;
  line-height: 1.7;
  color: var(--muted);
}

.overview-hero {
  align-items: stretch;
}

.overview-hero-copy {
  flex: 1.25;
}

.overview-hero-stage {
  flex: 0.9;
  min-width: 320px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--line);
}

.overview-hero-stage h4 {
  margin: 8px 0 10px;
  font-size: 24px;
}

.hero-actions,
.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-card {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h3 {
  margin: 6px 0 0;
  font-size: 24px;
}

.overview-grid,
.derive-grid,
.history-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 20px;
}

.overview-primary-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  margin-bottom: 20px;
}

.card-manager {
  display: grid;
  gap: 20px;
  grid-template-columns: 340px minmax(0, 1fr);
}

.stories-page-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stories-page-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 64px;
  padding: 10px 16px;
}

.stories-page-hero-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.stories-export-menu {
  position: relative;
  padding-bottom: 12px;
  margin-bottom: -12px;
}

.stories-export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 188px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px 8px;
  border: 1px solid rgba(232, 173, 193, 0.45);
  border-radius: 18px;
  background: rgba(255, 252, 254, 0.98);
  box-shadow: 0 18px 42px rgba(187, 133, 149, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 220ms ease;
}

.stories-export-option {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #5d4150;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.stories-export-option:hover,
.stories-export-option:focus-visible {
  background: rgba(239, 214, 225, 0.56);
  outline: none;
}

.stories-export-menu:hover .stories-export-dropdown,
.stories-export-menu:focus-within .stories-export-dropdown,
.stories-export-menu.is-open .stories-export-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.stories-page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  text-align: center;
}

.stories-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.stories-sidebar-card,
.stories-workspace-card {
  min-height: calc(100vh - 180px);
}

.stories-sidebar-card {
  position: sticky;
  top: 20px;
  align-self: start;
}

.stories-sidebar-header {
  margin-bottom: 14px;
  align-items: center;
}

.stories-scope-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stories-list {
  max-height: calc(100vh - 320px);
  overflow: auto;
  padding-top: 6px;
  padding-right: 4px;
  scroll-padding-top: 10px;
}

.scope-chip {
  border: 1px solid rgba(236, 176, 198, 0.26);
  background: rgba(255, 255, 255, 0.72);
  color: #7a5c6b;
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.scope-chip.active {
  border-color: rgba(62, 79, 176, 0.42);
  color: #3042a5;
  background: rgba(247, 248, 255, 0.92);
}

.list-card,
.editor-card {
  min-height: calc(100vh - 180px);
}

.card-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item,
.history-item {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.list-item:hover,
.history-item:hover,
.list-item.active,
.history-item.active {
  transform: translateY(-1px);
  border-color: rgba(188, 108, 37, 0.44);
  background: rgba(255, 249, 241, 0.84);
}

.list-item h4,
.history-item h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.item-meta,
.history-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.story-list-item {
  text-align: left;
  padding: 16px 16px 14px;
  border-radius: 20px;
}

.story-list-item.active {
  border-color: rgba(62, 79, 176, 0.38);
  background: linear-gradient(180deg, rgba(244, 247, 255, 0.98), rgba(255, 252, 246, 0.92));
  box-shadow:
    0 0 0 3px rgba(62, 79, 176, 0.08),
    0 16px 30px rgba(62, 79, 176, 0.08);
}

.story-list-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.story-list-copy {
  margin: 10px 0 0;
  color: #5c4d56;
  font-size: 13px;
  line-height: 1.6;
}

.story-list-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.story-list-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(250, 246, 239, 0.88);
  border: 1px solid rgba(236, 176, 198, 0.18);
  color: #7a5c6b;
  font-size: 11px;
  font-weight: 700;
}

.story-list-status-pill.is-ready {
  border-color: rgba(90, 153, 100, 0.24);
  background: rgba(233, 247, 235, 0.9);
  color: #356943;
}

.story-list-status-pill.is-warning {
  border-color: rgba(214, 150, 55, 0.24);
  background: rgba(255, 247, 228, 0.92);
  color: #8b5d11;
}

.story-list-progress {
  height: 7px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(236, 176, 198, 0.16);
  overflow: hidden;
}

.story-list-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f1b458 0%, #e588a7 45%, #5974d3 100%);
}

.story-list-checkline {
  margin: 10px 0 0;
  color: #7a5c6b;
  font-size: 12px;
  line-height: 1.6;
}

.stories-empty-state {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.centered-actions {
  align-items: center;
}

.history-item button {
  margin-top: 10px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field.span-2 {
  grid-column: span 2;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #5d4d3d;
}

.compact-field label {
  font-size: 12px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(75, 61, 42, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  resize: vertical;
}

.field textarea {
  min-height: 120px;
}

.field .helper {
  font-size: 12px;
  color: var(--muted);
}

.story-director-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-director-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
}

.story-director-header-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.story-header-meta {
  gap: 8px;
}

.story-director-header-main h3 {
  margin: 0;
  font-size: 16px;
}

.story-director-shell .panel-header h3,
.story-director-shell .panel-header h4,
.story-director-shell .story-director-header-main h3 {
  margin: 0;
  font-size: 16px;
  color: #261b25;
}

.story-base-actions {
  margin-top: 10px;
}

.story-base-guidance-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(188, 108, 37, 0.22);
  background: rgba(255, 248, 236, 0.9);
  color: #6f543d;
  font-size: 13px;
  line-height: 1.7;
}

.story-step-card {
  padding-top: 0;
  border-top: none;
}

.story-step-lock {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(236, 176, 198, 0.28);
  background: rgba(255, 252, 247, 0.72);
  color: #8a6b79;
  font-size: 14px;
  line-height: 1.7;
}

.story-overview-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.16);
  background: rgba(255, 255, 255, 0.6);
}

.story-overview-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(250, 246, 239, 0.92);
  border: 1px solid rgba(236, 176, 198, 0.18);
  color: #7a5c6b;
  font-size: 12px;
  font-weight: 800;
}

.story-overview-pill.is-ready {
  border-color: rgba(90, 153, 100, 0.24);
  background: rgba(233, 247, 235, 0.9);
  color: #356943;
}

.story-overview-pill.is-warning {
  border-color: rgba(214, 150, 55, 0.24);
  background: rgba(255, 247, 228, 0.92);
  color: #8b5d11;
}

.story-overview-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.story-director-grid {
  gap: 18px;
}

.story-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.story-choice-toggle {
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid rgba(236, 176, 198, 0.14);
  background: rgba(255, 255, 255, 0.56);
  overflow: hidden;
}

.story-choice-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #7a5c6b;
}

.story-choice-toggle > summary::-webkit-details-marker {
  display: none;
}

.story-choice-toggle[open] > summary {
  border-bottom: 1px solid rgba(236, 176, 198, 0.12);
}

.story-choice-toggle .story-chip-group {
  padding: 12px;
}

.story-field-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.16);
  background: rgba(255, 255, 255, 0.62);
}

.story-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-field-head label {
  margin: 0;
}

.story-field-meta {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(250, 246, 239, 0.92);
  border: 1px solid rgba(236, 176, 198, 0.18);
  color: #7a5c6b;
  font-size: 12px;
  font-weight: 700;
}

.story-field-meta.is-complete {
  background: rgba(228, 247, 235, 0.98);
  border-color: rgba(110, 185, 132, 0.28);
  color: #2f7b49;
}

.story-source-script-text {
  min-height: 180px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  line-height: 1.8;
}

.story-source-script-text.is-editing {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(188, 108, 37, 0.28);
}

.story-source-script-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.story-director-shell > .story-source-script-section {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
}

.story-director-shell > .story-source-script-section::before {
  display: none !important;
  content: none !important;
}

.story-chip {
  border: 1px solid rgba(236, 176, 198, 0.24);
  background: rgba(255, 255, 255, 0.76);
  color: #6d5561;
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  line-height: 1;
}

.story-chip.active {
  border-color: rgba(62, 79, 176, 0.36);
  background: rgba(244, 247, 255, 0.96);
  color: #3042a5;
}

.story-inline-tools {
  display: flex;
  justify-content: flex-start;
}

.story-plan-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 12px 14px;
}

.story-plan-strip-header {
  padding: 0;
}

.story-plan-strip .field select {
  border-color: rgba(188, 108, 37, 0.26);
  background: rgba(255, 251, 245, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.story-plan-strip .field select:focus {
  outline: none;
  border-color: rgba(188, 108, 37, 0.42);
  box-shadow:
    0 0 0 3px rgba(188, 108, 37, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.story-plan-toggle {
  margin-bottom: 14px;
}

.story-shot-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-shot-focus-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.story-shot-pill-row {
  width: 100%;
}

.story-shot-pill {
  border: 1px solid rgba(236, 176, 198, 0.24);
  background: rgba(255, 255, 255, 0.78);
  color: #6d5561;
  padding: 9px 13px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.story-shot-pill.active {
  border-color: rgba(62, 79, 176, 0.34);
  background: rgba(244, 247, 255, 0.96);
  color: #3042a5;
  box-shadow: 0 0 0 3px rgba(62, 79, 176, 0.08);
}

.story-shot-card {
  padding: 15px;
  border-radius: 22px;
  border: 1px solid rgba(236, 176, 198, 0.2);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 24px rgba(232, 215, 203, 0.09);
}

.story-shot-card.active {
  border-color: rgba(62, 79, 176, 0.32);
  box-shadow: 0 0 0 4px rgba(62, 79, 176, 0.08), 0 12px 24px rgba(232, 215, 203, 0.09);
}

.story-shot-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.story-shot-main,
.story-shot-side {
  min-width: 0;
}

.story-shot-side-card {
  height: 100%;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.16);
  background: rgba(250, 246, 239, 0.62);
}

.story-shot-hero-field textarea {
  min-height: 132px;
}

.story-shot-writing-card {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.84), rgba(255, 255, 255, 0.92));
}

.story-shot-helper-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.story-shot-helper-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(236, 176, 198, 0.18);
  color: #7a5c6b;
  font-size: 11px;
  font-weight: 700;
}

.story-shot-hero-field,
.story-shot-side-card,
.story-shot-grid .field,
.story-shot-side-grid .field {
  box-shadow: none;
}

.story-shot-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.story-shot-head-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.story-shot-head h5 {
  margin: 0;
  font-size: 16px;
}

.story-shot-beat-badge {
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a07a88;
  font-size: 12px;
  font-weight: 700;
}

.story-shot-head-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.story-shot-tools-toggle {
  border-radius: 999px;
  border: 1px solid rgba(236, 176, 198, 0.14);
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.story-shot-tools-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 9px;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  color: #6d5561;
}

.story-shot-tools-toggle > summary::-webkit-details-marker {
  display: none;
}

.story-shot-tools-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(236, 176, 198, 0.12);
}

.story-shot-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.story-shot-grid .field {
  gap: 6px;
}

.story-shot-detail-field {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(236, 176, 198, 0.14);
  background: rgba(255, 250, 242, 0.72);
}

.story-shot-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-shot-grid .field label {
  font-size: 12px;
}

.story-shot-detail-field label,
.story-shot-field-head label {
  font-size: 12px;
  font-weight: 700;
}

.story-shot-selected-row {
  margin-top: 10px;
}

.story-shot-preset-bank {
  margin: 10px 0 10px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(236, 176, 198, 0.12);
}

.story-shot-preset-bank-title {
  margin-bottom: 8px;
  color: #8b6a78;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.story-shot-grid .field input,
.story-shot-grid .field textarea,
.story-shot-grid .field select {
  padding: 11px 12px;
  border-color: rgba(236, 176, 198, 0.14);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.story-shot-grid .field textarea {
  min-height: 96px;
}

.story-shot-side-grid .field input,
.story-shot-side-grid .field textarea,
.story-shot-side-grid .field select,
.story-shot-hero-field textarea {
  border-color: rgba(236, 176, 198, 0.14);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.story-shot-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.story-shot-preset {
  border: 1px solid rgba(236, 176, 198, 0.24);
  background: rgba(255, 255, 255, 0.82);
  color: #6d5561;
  padding: 6px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
}

.story-shot-preset.active {
  border-color: rgba(62, 79, 176, 0.34);
  background: rgba(244, 247, 255, 0.96);
  color: #3042a5;
}

.story-shot-grid .compact-textarea {
  min-height: 104px;
}

.story-shot-side-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.story-output-card .validation-meta {
  margin-bottom: 12px;
}

.story-ai-check-result {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 250, 242, 0.84);
}

.story-ai-check-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(236, 176, 198, 0.14);
  color: #7a5c6b;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.story-ai-check-result p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.story-continuity-panel {
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 250, 242, 0.84);
}

.story-continuity-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.story-continuity-summary {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.story-continuity-issue-list {
  display: grid;
  gap: 10px;
}

.story-continuity-issue-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(236, 176, 198, 0.16);
}

.story-continuity-issue-check {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
}

.story-continuity-issue-check input {
  width: 16px;
  height: 16px;
}

.story-continuity-issue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.story-continuity-target {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 240, 245, 0.9);
  color: #8b596f;
  font-size: 11px;
  font-weight: 700;
}

.story-continuity-issue-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.story-continuity-suggestion {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #5e4753;
}

.story-continuity-issue-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.story-advanced-toggle {
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.16);
  background: rgba(255, 255, 255, 0.58);
  overflow: hidden;
}

.story-advanced-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 800;
  color: #6d5561;
}

.story-advanced-toggle > summary::-webkit-details-marker {
  display: none;
}

.story-advanced-toggle[open] > summary {
  border-bottom: 1px solid rgba(236, 176, 198, 0.14);
}

.story-edit-advanced-grid {
  padding: 16px;
}

.story-output-toggle {
  margin-bottom: 18px;
}

.story-deliverable-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.story-deliverable-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.68);
}

.story-deliverable-card strong {
  font-size: 16px;
}

.story-deliverable-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.story-deliverable-preview {
  margin-top: 10px;
  min-height: 64px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(250, 246, 239, 0.82);
  color: #5d4d3d;
  font-size: 13px;
  line-height: 1.7;
}

.story-output-main-textarea {
  margin-top: 10px;
  min-height: 320px;
  height: auto;
  width: 100%;
  background: rgba(250, 246, 239, 0.82);
}

.story-deliverable-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-deliverable-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.story-char-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.76);
  color: #7a5c6b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.story-char-count.is-over {
  color: #b14f5e;
  border-color: rgba(221, 108, 128, 0.32);
  background: rgba(255, 241, 243, 0.92);
}

.story-output-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.story-output-detail-grid .field.full {
  grid-column: 1 / -1;
}

.story-output-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.story-output-textarea {
  width: 100%;
  min-height: 168px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  resize: none;
  overflow: hidden;
}

.story-output-textarea.compact {
  min-height: 132px;
}

.story-prompt-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.story-prompt-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.68);
}

.story-prompt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.story-prompt-preview {
  margin: 10px 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.compact-copy-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.story-review-disclosure {
  border-top: none;
  padding-top: 0;
}

.story-review-disclosure > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.story-review-disclosure > summary::-webkit-details-marker {
  display: none;
}

.story-review-disclosure > summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.story-review-disclosure > summary .validation-meta {
  margin-left: auto;
  justify-content: flex-end;
}

.story-review-body {
  margin-top: 16px;
}

.inline-status {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(75, 61, 42, 0.14);
  color: var(--ink);
}

.primary-button,
.ghost-button,
.danger-button {
  appearance: none;
  border-radius: 999px;
  padding: 11px 16px;
  border: 1px solid transparent;
  font-weight: 700;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(180deg, #c97a32, #a85c1b);
  color: #fff7ed;
}

.ghost-button {
  background: rgba(255, 252, 246, 0.72);
  color: #5c4533;
  border-color: rgba(92, 69, 51, 0.12);
}

.ai-action-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-action-button::before {
  content: "AI";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(62, 79, 176, 0.12);
  color: #3042a5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ai-action-button.is-loading {
  opacity: 0.88;
}

.ai-action-button.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(92, 69, 51, 0.18);
  border-top-color: #3042a5;
  animation: ai-spin 0.8s linear infinite;
}

.danger-button {
  background: rgba(157, 45, 35, 0.08);
  color: var(--danger);
  border-color: rgba(157, 45, 35, 0.14);
}

.file-input-label input {
  display: none;
}

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

.compact-stats {
  margin-top: 16px;
}

.workflow-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workflow-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
}

.workflow-card.current {
  border-color: rgba(188, 108, 37, 0.36);
  background: rgba(188, 108, 37, 0.08);
}

.workflow-card.done {
  border-color: rgba(44, 124, 84, 0.22);
  background: rgba(44, 124, 84, 0.07);
}

.workflow-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.workflow-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.workflow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.checklist-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checklist-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
}

.checklist-item.warning {
  border-color: rgba(188, 108, 37, 0.24);
  background: rgba(188, 108, 37, 0.06);
}

.checklist-item h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.checklist-item p {
  margin: 0 0 12px;
  line-height: 1.6;
  color: var(--muted);
}

.editor-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.command-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.command-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid var(--line);
}

.command-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.command-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.inventory-table-wrap {
  overflow: auto;
}

.inventory-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(180px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.inventory-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 14px;
}

.inventory-table th,
.inventory-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.inventory-table th {
  color: #5d4d3d;
  font-size: 13px;
}

.inventory-table td {
  color: var(--muted);
  line-height: 1.6;
}

.compact-empty {
  padding: 18px 12px;
  border: none;
  background: transparent;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--line);
}

.stat-card p {
  margin: 0;
}

.stat-card .stat-number {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
}

.json-preview {
  margin: 0;
  max-height: 460px;
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #1d2328;
  color: #edf4f7;
  font-size: 13px;
  line-height: 1.5;
}

.compact-preview {
  margin-top: 16px;
  max-height: 360px;
}

.compact-json-panel .json-preview {
  max-height: 260px;
}

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(92, 69, 51, 0.24);
  border-radius: var(--radius-md);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.tag-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(188, 108, 37, 0.12);
  color: #7d4a18;
  font-size: 12px;
  font-weight: 700;
}

.tag-chip-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(188, 108, 37, 0.14);
  cursor: pointer;
}

.tag-chip-remove {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(125, 74, 24, 0.08);
  font-size: 12px;
  line-height: 1;
}

.story-tag-add-button {
  width: 30px;
  height: 30px;
  border: 1px dashed rgba(236, 137, 165, 0.42);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #ca7185;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(214, 120, 147, 0.08);
}

.story-tag-add-button:hover {
  border-color: rgba(231, 100, 127, 0.54);
  background: rgba(255, 245, 248, 0.98);
}

.story-tag-add-icon {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.story-tag-selected-row {
  margin-top: 10px;
}

.story-tag-preset-bank {
  margin-top: 10px;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(236, 176, 198, 0.12);
}

.story-tag-preset-bank-title {
  margin-bottom: 8px;
  color: #8b6a78;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.story-preset-chip-editable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.story-preset-remove-button {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(236, 137, 165, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #ba6a7d;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  position: absolute;
  top: -6px;
  right: -6px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 14px rgba(214, 120, 147, 0.14);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  transform: scale(0.9);
}

.story-preset-chip-editable:hover .story-preset-remove-button,
.story-preset-chip-editable:focus-within .story-preset-remove-button {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.story-type-dialog-field .story-tag-preset-bank {
  margin-top: 12px;
}

.subsection {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.compact-field {
  margin-top: 16px;
}

.subsection h4 {
  margin: 0 0 8px;
  font-size: 18px;
}

.passage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.passage-item {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--line);
}

.passage-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.passage-item h5 {
  margin: 0;
  font-size: 15px;
}

.passage-item.compact p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  line-height: 1.65;
}

.annotation-workbench {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.story-breakdown-panel-header {
  justify-content: center;
  text-align: center;
}

.story-breakdown-panel-header > div {
  width: 100%;
}

.annotation-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 12px;
}

.annotation-stat-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.2);
  background: rgba(255, 255, 255, 0.66);
}

.annotation-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.annotation-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: #8a6c7a;
}

.script-source-textarea {
  min-height: 240px;
  white-space: pre-wrap;
}

.story-script-textarea {
  min-height: 280px;
  margin-top: 14px;
}

.annotation-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.story-mark-toolbar {
  margin-top: 16px;
}

.story-breakdown-step-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  margin-bottom: 10px;
}

.story-breakdown-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.66);
  color: #836672;
  font-size: 13px;
  font-weight: 700;
}

.story-breakdown-step.current {
  border-color: rgba(188, 108, 37, 0.28);
  background: rgba(255, 248, 236, 0.92);
  color: #7e5624;
}

.story-breakdown-step.complete {
  border-color: rgba(110, 185, 132, 0.28);
  background: rgba(234, 247, 238, 0.94);
  color: #2f7b49;
}

.story-breakdown-step.locked {
  opacity: 0.62;
}

.story-breakdown-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  font-weight: 800;
}

.story-breakdown-step-divider {
  width: 24px;
  height: 1px;
  background: rgba(236, 176, 198, 0.32);
}

.story-breakdown-ai-button {
  margin-left: auto;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
}

.story-breakdown-note {
  margin-top: 0;
  margin-bottom: 0;
}

.annotation-tool-button {
  min-width: 106px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.annotation-tool-button.primary-tool {
  border-color: rgba(227, 171, 33, 0.32);
  background: rgba(255, 247, 221, 0.92);
  color: #8c5a00;
}

.annotation-tool-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(236, 176, 198, 0.2);
  font-size: 12px;
  font-weight: 800;
}

.annotation-selection-hint {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.22);
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.88), rgba(255, 255, 255, 0.74));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.annotation-selection-copy strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.annotation-selection-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.annotation-selection-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.script-annotation-canvas {
  width: 100%;
  min-height: 320px;
  padding: 22px 24px;
  border-radius: 22px;
  border: 1px solid rgba(188, 108, 37, 0.18);
  background: rgba(255, 252, 245, 0.86);
  color: var(--ink);
  line-height: 1.95;
  font-size: 16px;
  white-space: pre-wrap;
  user-select: text;
}

.annotated-script-segment {
  border-radius: 8px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.story-marking-canvas {
  min-height: clamp(420px, 58vh, 760px);
  width: 100%;
  height: auto;
  overflow: visible;
}

.story-marking-canvas.edit-mode {
  background: rgba(255, 255, 255, 0.92);
}

.story-marking-canvas.mark-mode {
  background: rgba(255, 252, 245, 0.92);
}

.story-mark-chip {
  display: inline;
  position: relative;
  padding: 2px 4px;
  border-radius: 10px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.story-mark-chip::before {
  content: attr(data-story-label);
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.95);
  color: #6a4252;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.story-mark-tone-0 {
  background: rgba(255, 226, 182, 0.95);
}

.story-mark-tone-1 {
  background: rgba(255, 216, 230, 0.95);
}

.story-mark-tone-2 {
  background: rgba(217, 239, 255, 0.95);
}

.story-mark-tone-3 {
  background: rgba(226, 244, 215, 0.95);
}

.story-mark-tone-4 {
  background: rgba(243, 227, 255, 0.95);
}

.story-mark-tone-5 {
  background: rgba(255, 239, 208, 0.95);
}

.annotation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.annotation-layout.single-column {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.annotation-canvas-card {
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(236, 176, 198, 0.2);
  background: rgba(255, 255, 255, 0.62);
}

.annotation-canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.annotation-canvas-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.annotation-canvas-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(236, 176, 198, 0.18);
  color: #7a5c6b;
  font-size: 12px;
  font-weight: 700;
}

.annotation-canvas-status.editing {
  border-color: rgba(188, 108, 37, 0.24);
  background: rgba(255, 248, 236, 0.92);
  color: #7e5624;
}

.annotation-canvas-status.marking {
  border-color: rgba(110, 185, 132, 0.24);
  background: rgba(234, 247, 238, 0.94);
  color: #2f7b49;
}

.annotation-canvas-status.count {
  background: rgba(255, 255, 255, 0.72);
}

.annotation-canvas-tip {
  font-size: 12px;
  color: var(--muted);
}

.annotation-canvas-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
}

.annotation-canvas-head-actions .annotation-canvas-tip {
  margin-right: auto;
}

.text-link-button {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #7c6370;
  cursor: pointer;
}

.text-link-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.text-link-button:hover:not(:disabled) {
  color: #3a4475;
}

.story-mark-footer-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  padding-top: 10px;
}

.story-mark-flow-bar {
  position: sticky;
  bottom: 0;
  padding: 14px 0 4px;
  margin-top: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 245, 0.96) 28%);
  backdrop-filter: blur(6px);
}

.story-mark-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
}

.story-mark-summary-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.8);
  color: #6d5561;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.story-mark-summary-pill:hover {
  border-color: rgba(188, 108, 37, 0.26);
  transform: translateY(-1px);
}

.story-mark-summary-empty {
  margin-top: 14px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.bottom-flow-button {
  min-width: 180px;
  min-height: 50px;
  font-size: 16px;
  border-radius: 999px;
}

.annotation-summary-block h5 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}

.annotation-side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.annotation-result-title {
  margin-top: 4px;
}

.annotation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.annotation-item {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
}

.annotation-item p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.annotation-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-segment-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-mark-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-mark-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.18);
}

.story-mark-item p {
  margin: 10px 0 0;
  white-space: pre-wrap;
  line-height: 1.75;
}

.story-mark-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-mark-menu {
  position: fixed;
  z-index: 180;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  transform: translate(0, -50%);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.story-mark-inline-anchor {
  display: inline-block;
  width: 1.9em;
  height: 1em;
  margin: 0 0.34em 0 0.02em;
  vertical-align: -0.08em;
  line-height: 1em;
  user-select: none;
  position: relative;
  font-size: inherit;
}

.story-mark-inline-anchor .story-mark-menu,
.story-mark-menu.inline-mounted {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 1;
  pointer-events: auto;
  transform-origin: center;
  animation: story-mark-inline-fade 160ms ease-out;
  transition: opacity 120ms ease;
}

.story-mark-inline-anchor .story-mark-menu.open,
.story-mark-menu.inline-mounted.open,
.story-mark-inline-anchor .story-mark-menu[data-placement="side-right"],
.story-mark-inline-anchor .story-mark-menu[data-placement="side-left"],
.story-mark-inline-anchor .story-mark-menu.open[data-placement="side-right"],
.story-mark-inline-anchor .story-mark-menu.open[data-placement="side-left"],
.story-mark-menu.inline-mounted[data-placement="side-right"],
.story-mark-menu.inline-mounted[data-placement="side-left"],
.story-mark-menu.inline-mounted.open[data-placement="side-right"],
.story-mark-menu.inline-mounted.open[data-placement="side-left"] {
  transform: translate(-50%, -50%);
}

.ai-runtime-hud {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.ai-runtime-spinner-shell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(232, 187, 203, 0.32);
  box-shadow: 0 18px 40px rgba(47, 34, 46, 0.12);
  opacity: 0;
  transform: translateY(-8px) scale(0.94);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(10px);
}

.ai-runtime-spinner-shell.is-running {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.ai-runtime-spinner-icon {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1.8px solid rgba(64, 92, 229, 0.9);
  background: rgba(255, 255, 255, 0.92);
  transform-style: preserve-3d;
  animation: ai-runtime-flip 1s linear infinite;
}

.ai-runtime-spinner-icon::before,
.ai-runtime-spinner-icon::after,
.ai-runtime-spinner-core::before,
.ai-runtime-spinner-core::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: #3d6df2;
}

.ai-runtime-spinner-icon::before {
  width: 4px;
  height: 4px;
  left: 5px;
  top: 5px;
  box-shadow: 14px 0 0 #3d6df2, 0 14px 0 #3d6df2, 14px 14px 0 #3d6df2;
}

.ai-runtime-spinner-icon::after {
  inset: 7px;
  border: 1.6px solid rgba(61, 109, 242, 0.9);
  background: transparent;
  border-radius: 7px;
}

.ai-runtime-spinner-core {
  position: absolute;
  inset: 0;
}

.ai-runtime-spinner-core::before {
  width: 8px;
  height: 1.8px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.ai-runtime-spinner-core::after {
  width: 1.8px;
  height: 8px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.ai-runtime-spinner-text {
  font-size: 12px;
  font-weight: 700;
  color: #5e4c57;
  white-space: nowrap;
}

.ai-runtime-toast {
  max-width: min(320px, calc(100vw - 40px));
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(36, 36, 43, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 18px 40px rgba(20, 16, 26, 0.22);
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  white-space: pre-wrap;
}

.ai-runtime-toast.open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes ai-runtime-flip {
  0% {
    transform: perspective(140px) rotateY(0deg);
  }

  50% {
    transform: perspective(140px) rotateY(180deg);
  }

  100% {
    transform: perspective(140px) rotateY(360deg);
  }
}

@media (max-width: 720px) {
  .ai-runtime-hud {
    top: 12px;
    right: 14px;
    gap: 8px;
  }

  .ai-runtime-spinner-shell {
    padding: 9px 11px 9px 9px;
  }

  .ai-runtime-spinner-text {
    display: none;
  }

  .ai-runtime-toast {
    max-width: min(260px, calc(100vw - 28px));
  }
}

.story-mark-menu.open {
  opacity: 1;
  pointer-events: auto;
}

@keyframes story-mark-inline-fade {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.82);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.story-mark-menu[data-placement="side-left"] {
  transform: translate(-100%, -50%);
}

.story-mark-menu.open[data-placement="side-right"] {
  transform: translate(0, -50%) scale(1);
}

.story-mark-menu.open[data-placement="side-left"] {
  transform: translate(-100%, -50%) scale(1);
}

.compact-menu-button {
  min-width: auto;
  min-height: auto;
  padding: 0;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
}

.story-mark-icon-button {
  width: 1em;
  height: 1em;
  display: inline-grid;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0.11em solid currentColor;
  background: transparent;
  box-shadow: 0 4px 10px rgba(74, 73, 103, 0.08);
  color: transparent;
  position: relative;
  flex: 0 0 auto;
  cursor: pointer;
  font-size: 18px;
}

.story-mark-icon-button.add {
  color: #3d6df2;
}

.story-mark-icon-button.remove {
  color: #e65b64;
}

.story-mark-icon-button::before,
.story-mark-icon-button.add::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: currentColor;
}

.story-mark-icon-button::before {
  width: 0.44em;
  height: 0.11em;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.story-mark-icon-button.add::after {
  width: 0.11em;
  height: 0.44em;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.story-mark-icon-button:disabled {
  opacity: 0.38;
  box-shadow: none;
}

.story-mark-icon-button:not(.add):not(.remove) {
  opacity: 0;
  pointer-events: none;
}

.story-segment-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(236, 176, 198, 0.2);
  background: rgba(255, 255, 255, 0.74);
}

.story-segment-card.active {
  border-color: rgba(231, 100, 127, 0.34);
  box-shadow: 0 0 0 3px rgba(231, 100, 127, 0.1);
}

.story-segment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.story-segment-head h5 {
  margin: 4px 0 0;
  font-size: 18px;
}

.story-segment-textarea {
  min-height: 160px;
}

.story-segment-tag-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

.story-segment-tag-group {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.18);
  background: rgba(255, 255, 255, 0.66);
}

.workspace-centered-title {
  width: 100%;
  text-align: center;
}

.workspace-centered-title h4 {
  margin: 6px 0 0;
  font-size: 28px;
}

.tag-picker-library {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.active-tag-option {
  background: linear-gradient(180deg, rgba(255, 247, 221, 0.96), rgba(255, 255, 255, 0.9));
  border-color: rgba(227, 171, 33, 0.32);
  color: #8c5a00;
}

.tag-picker-selected {
  min-height: 42px;
  align-items: center;
}

.project-settings-subsection {
  margin-top: 8px;
}

.compact-card-list {
  gap: 12px;
}

.compact-list-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annotation-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.annotation-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(236, 176, 198, 0.2);
  font-size: 12px;
  font-weight: 800;
  color: #7a5368;
}

.annotation-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
}

.annotation-tool-segment {
  background: rgba(255, 213, 102, 0.28);
  border-color: rgba(227, 171, 33, 0.34);
  color: #8c5a00;
}

.annotation-tool-climax {
  background: rgba(241, 99, 114, 0.2);
  border-color: rgba(225, 75, 91, 0.32);
  color: #ac2740;
}

.annotation-tool-laugh {
  background: rgba(255, 192, 73, 0.24);
  border-color: rgba(219, 148, 5, 0.32);
  color: #9d6500;
}

.annotation-tool-boost {
  background: rgba(102, 186, 255, 0.2);
  border-color: rgba(68, 148, 214, 0.3);
  color: #245a87;
}

.annotation-tool-elevate {
  background: rgba(188, 137, 255, 0.18);
  border-color: rgba(148, 96, 220, 0.28);
  color: #6b3fa4;
}

.annotation-tool-foreshadow {
  background: rgba(117, 205, 145, 0.2);
  border-color: rgba(78, 162, 106, 0.3);
  color: #286542;
}

.annotation-tool-twist {
  background: rgba(255, 123, 179, 0.18);
  border-color: rgba(218, 78, 141, 0.28);
  color: #9e2e63;
}

.mini-button {
  appearance: none;
  border: 1px solid rgba(92, 69, 51, 0.14);
  background: rgba(255, 255, 255, 0.7);
  color: #5c4533;
  padding: 8px 12px;
  border-radius: 999px;
}

.derive-report {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}

.report-entry {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--line);
}

.report-entry h4 {
  margin: 0 0 8px;
}

.report-entry p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.validation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.validation-item {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.validation-item h4,
.json-status-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.validation-item p,
.json-status-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.validation-item.error {
  border-color: rgba(157, 45, 35, 0.22);
  background: rgba(157, 45, 35, 0.06);
}

.validation-item.warning {
  border-color: rgba(188, 108, 37, 0.24);
  background: rgba(188, 108, 37, 0.06);
}

.validation-item.success {
  border-color: rgba(44, 124, 84, 0.18);
  background: rgba(44, 124, 84, 0.06);
}

.validation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.review-heading {
  margin: 0 0 8px;
  font-size: 20px;
}

.review-copy {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.review-section {
  margin-top: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.error {
  background: rgba(157, 45, 35, 0.12);
  color: var(--danger);
}

.status-pill.warning {
  background: rgba(188, 108, 37, 0.12);
  color: #8d581d;
}

.status-pill.success {
  background: rgba(44, 124, 84, 0.12);
  color: var(--success);
}

.json-status-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.json-status-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell,
  .overview-primary-grid,
  .card-manager,
  .overview-grid,
  .derive-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .app-shell {
    min-height: auto;
  }

  .inventory-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .inventory-toolbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .main-panel,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid,
  .stats-grid,
  .inventory-toolbar {
    grid-template-columns: 1fr;
  }
}

/* Reference UI Refresh */

:root {
  --bg: #fff9fb;
  --bg-elevated: #fffdfd;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.82);
  --ink: #241a23;
  --muted: #76606f;
  --line: rgba(231, 162, 186, 0.22);
  --accent: #ef6f8e;
  --accent-dark: #d44f73;
  --danger: #c45364;
  --success: #49a175;
  --shadow: 0 28px 70px rgba(233, 165, 189, 0.2);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 14px;
  --font-sans: "LXGW WenKai", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html,
body {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 201, 222, 0.35), transparent 24%),
    radial-gradient(circle at 100% 12%, rgba(255, 230, 167, 0.34), transparent 22%),
    linear-gradient(180deg, #fffdfd 0%, #fff7fa 100%);
  color: var(--ink);
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 18px;
  top: 18px;
  bottom: 18px;
  width: 102px;
  padding: 18px 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 80px rgba(214, 186, 194, 0.28);
  backdrop-filter: blur(20px);
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.hamt-logo-text {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #eb667e;
  text-shadow:
    0 2px 0 #ffffff,
    0 8px 18px rgba(235, 102, 126, 0.22);
}

.nav-list {
  margin-top: 18px;
  gap: 10px;
}

.nav-item {
  min-height: 74px;
  padding: 14px 8px;
  border-radius: 24px;
  border: 1px solid transparent;
  background: transparent;
  color: #5c4754;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: none;
}

.nav-item:hover,
.nav-item.active {
  transform: none;
  background: linear-gradient(180deg, rgba(255, 236, 244, 0.98), rgba(255, 247, 251, 0.94));
  border-color: rgba(242, 147, 177, 0.24);
  color: #e55c7c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.nav-item-bottom {
  margin-bottom: 10px;
}

.nav-glyph {
  display: block;
  font-size: 15px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.sidebar-footer #save-status {
  display: none;
}

.sidebar-hint {
  display: none;
}

.main-panel {
  margin-left: 144px;
  padding: 12px 36px 56px;
}

.topbar {
  min-height: 52px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar.quiet {
  opacity: 0.72;
}

.topbar h2 {
  font-size: clamp(22px, 3vw, 30px);
}

.topbar-metrics {
  gap: 8px;
}

.topbar-logout-button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.metric-pill {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(242, 156, 183, 0.2);
  color: #80596d;
}

.eyebrow {
  color: #c79cac;
  letter-spacing: 0.18em;
}

.panel-card,
.hero-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 252, 253, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.panel-header h3,
.hero-card h3 {
  color: #261b25;
}

.panel-note,
.brand-copy,
.sidebar-footer,
.command-card p,
.validation-item p,
.checklist-item p {
  color: var(--muted);
}

.primary-button,
.ghost-button,
.danger-button,
.file-input-label {
  min-height: 48px;
  border-radius: 999px;
  padding: 0 22px;
  border: 1px solid transparent;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #ffffff 0%, #fff7fb 100%);
  border-color: #33418f;
  color: #33418f;
  box-shadow: 0 12px 24px rgba(92, 103, 182, 0.12);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.file-input-label:hover {
  transform: translateY(-1px);
}

.ghost-button,
.file-input-label {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(237, 137, 164, 0.26);
  color: #7a5368;
}

.danger-button {
  background: rgba(255, 240, 243, 0.92);
  border-color: rgba(196, 83, 100, 0.22);
  color: var(--danger);
}

.compact-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field label,
.helper,
.inline-status {
  color: #846877;
}

.field input,
.field textarea,
.field select {
  border-radius: 18px;
  border: 1px solid rgba(236, 176, 198, 0.24);
  background: rgba(255, 255, 255, 0.92);
  color: #2d202a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.field textarea {
  min-height: 120px;
}

.tag-chip,
.status-pill {
  border-radius: 999px;
}

.home-stage {
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  flex: 1 1 auto;
}

.home-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hamt-emblem {
  font-size: clamp(58px, 9vw, 102px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #ea687f;
  text-shadow:
    0 3px 0 #ffffff,
    0 18px 36px rgba(234, 104, 127, 0.2);
}

.home-brand-en {
  margin: 0;
  font-size: clamp(24px, 3vw, 44px);
  font-weight: 800;
  color: #ef768c;
}

.home-brand-cn {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 36px);
  font-weight: 800;
  color: #ef768c;
}

.home-cta {
  min-width: 304px;
  min-height: 56px;
  font-size: 28px;
}

.home-copy-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.home-copy-stack p {
  margin: 0;
}

.home-focus-title,
.home-focus-copy {
  margin: 0;
}

.home-focus-copy {
  color: #846877;
  font-size: 15px;
  font-weight: 500;
}

.hidden-copy {
  display: none;
}

.home-projects-card {
  margin-top: 12px;
  flex: 0 0 auto;
  padding-top: 20px;
  padding-bottom: 20px;
}

.view-section[data-view="home"].active {
  height: calc(100dvh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-section[data-view="home"] .panel-header {
  margin-bottom: 10px;
}

.project-gallery-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 24px;
}

.project-gallery-grid.compact .project-tile {
  min-height: 144px;
  gap: 10px;
  padding: 8px 10px;
}

.project-gallery-grid.compact .project-book {
  width: 96px;
  height: 72px;
}

.project-gallery-grid.compact .project-tile strong {
  font-size: 15px;
}

.project-gallery-grid.compact .project-tile-meta {
  font-size: 12px;
  line-height: 1.35;
}

.page-title-block.centered {
  text-align: center;
  margin: 32px 0 28px;
}

.page-title-block h3 {
  margin: 8px 0 0;
  font-size: clamp(40px, 5vw, 64px);
}

.project-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px 36px;
}

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

.project-tile {
  min-height: 234px;
  padding: 16px 14px;
  border: none;
  border-radius: 28px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  color: var(--ink);
}

.project-tile.compact {
  min-height: 178px;
}

.project-tile strong {
  font-size: 18px;
}

.project-tile-meta {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: #846877;
}

.project-book {
  position: relative;
  display: block;
  width: 128px;
  height: 96px;
  border-radius: 10px 24px 18px 10px;
  background: linear-gradient(90deg, #d6584f 0 16%, #fef1ba 16% 52%, #fee29b 52% 100%);
  box-shadow:
    10px 12px 0 rgba(200, 108, 90, 0.08),
    0 14px 28px rgba(220, 154, 105, 0.18);
  transform: perspective(220px) rotateY(-18deg);
}

.project-book::before,
.project-book::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: 4px;
}

.project-book::before {
  left: 18px;
  width: 6px;
  background: #4ba6bb;
}

.project-book::after {
  right: 10px;
  width: 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 233, 166, 0.06));
}

.project-create-tile {
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(236, 137, 165, 0.26);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-shell.open {
  display: flex;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 246, 248, 0.78);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(236, 137, 165, 0.16);
  box-shadow: 0 28px 60px rgba(161, 101, 115, 0.18);
}

.episode-modal-card {
  width: min(calc(100vw - 56px), max(760px, calc((100vw - 360px) * 0.6)));
}

.status-modal-card {
  width: min(520px, calc(100vw - 32px));
}

.story-tag-modal-card {
  width: min(460px, calc(100vw - 32px));
}

.story-tag-modal-helper {
  margin: 12px 2px 0;
  color: #846877;
  font-size: 13px;
  line-height: 1.6;
}

.mini-modal {
  padding: 24px 24px 22px;
}

.mini-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mini-modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(249, 226, 231, 0.9);
  color: #8c5e6f;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.mini-modal-body input {
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(236, 137, 165, 0.22);
  background: rgba(255, 250, 251, 0.96);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.mini-modal-body textarea {
  width: 100%;
  min-height: 240px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(236, 137, 165, 0.22);
  background: rgba(255, 250, 251, 0.96);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  resize: vertical;
}

.mini-modal-body input:focus {
  outline: none;
  border-color: rgba(231, 100, 127, 0.52);
  box-shadow: 0 0 0 4px rgba(231, 100, 127, 0.12);
}

.mini-modal-body textarea:focus {
  outline: none;
  border-color: rgba(231, 100, 127, 0.52);
  box-shadow: 0 0 0 4px rgba(231, 100, 127, 0.12);
}

.mini-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.mini-modal-actions .primary-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.status-modal-message {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 250, 251, 0.96);
  border: 1px solid rgba(236, 137, 165, 0.16);
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.project-plus {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 90px;
  line-height: 1;
  color: #ffffff;
  background: linear-gradient(180deg, #f07b90 0%, #e7647f 100%);
  box-shadow: 0 18px 34px rgba(231, 100, 127, 0.22);
}

.workspace-stage {
  padding-top: 6px;
}

.workspace-workbench.is-hidden {
  display: none;
}

.episode-board-card.is-hidden {
  display: none;
}

.project-settings-modal-card {
  width: min(760px, calc(100vw - 40px));
}

.episode-settings-modal-card {
  width: min(420px, calc(100vw - 32px));
}

.episode-delete-modal-card {
  width: min(460px, calc(100vw - 32px));
}

.project-settings-body textarea {
  min-height: 160px;
}

.episode-story-subsection {
  margin-top: 22px;
}

.episode-story-hub {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.episode-story-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.episode-story-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.episode-story-card {
  text-align: left;
}

.episode-story-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.episode-story-empty {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(188, 108, 37, 0.22);
  background: rgba(255, 250, 244, 0.62);
  color: var(--muted);
  line-height: 1.7;
}

.workspace-title-block {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-bottom: 26px;
  text-align: center;
  min-height: 52px;
}

.workspace-title-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.workspace-title-block h3 {
  margin: 0;
  font-size: clamp(28px, 4vw, 54px);
}

.workspace-title-actions {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

.canvas-settings-button {
  min-width: 112px;
}

.workspace-meta {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(237, 137, 164, 0.2);
  color: #7a5368;
  font-size: 12px;
  font-weight: 700;
}

.episode-board-card {
  padding: 26px 30px 32px;
  margin-bottom: 28px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.episode-board {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: flex-start;
}

.episode-note-card {
  width: 180px;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: #2b2027;
}

.episode-note-item {
  position: relative;
  width: 180px;
  cursor: grab;
}

.episode-note-item.dragging {
  opacity: 0.72;
}

.episode-note-item.drag-over-before .episode-note-sheet,
.episode-note-item.drag-over-after .episode-note-sheet {
  box-shadow:
    0 0 0 3px rgba(231, 100, 127, 0.18),
    20px 12px 0 rgba(235, 151, 112, 0.28),
    34px 16px 0 rgba(231, 168, 194, 0.26);
}

.episode-note-item.drag-over-before::before,
.episode-note-item.drag-over-after::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 44px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f07b90 0%, #e7647f 100%);
  box-shadow: 0 10px 20px rgba(231, 100, 127, 0.18);
}

.episode-note-item.drag-over-before::before {
  left: -12px;
}

.episode-note-item.drag-over-after::after {
  right: -12px;
}

.episode-note-sheet {
  position: relative;
  display: block;
  width: 144px;
  height: 124px;
  padding-top: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffe08a 0%, #ffd565 100%);
  box-shadow:
    20px 12px 0 rgba(235, 151, 112, 0.28),
    34px 16px 0 rgba(231, 168, 194, 0.26);
  clip-path: polygon(0 0, 84% 0, 100% 18%, 100% 100%, 0 100%);
}

.episode-note-pin {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 4px 4px 8px 8px;
  background: #ffd14d;
  box-shadow: 0 4px 0 rgba(179, 133, 36, 0.16);
}

.episode-note-index {
  font-size: 18px;
  font-weight: 800;
  color: #4a3a22;
}

.episode-note-card.active .episode-note-sheet {
  transform: translateY(-2px) scale(1.02);
}

.episode-note-edit-button {
  position: absolute;
  top: 12px;
  right: -6px;
  min-height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #7a5368;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(161, 101, 115, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.workspace-episode-header-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
}

.workspace-episode-header-copy h3 {
  margin: 0;
}

.workspace-episode-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #7c6370;
}

.workspace-back-button {
  min-height: 34px;
  padding: 0 14px;
}

.workspace-episode-panel-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
}

.workspace-episode-settings-wrap {
  justify-self: end;
  flex-direction: column;
  align-items: flex-end;
}

.workspace-meta.is-hidden {
  display: none;
}

.story-breakdown-panel-header {
  margin-bottom: 8px;
}

.story-breakdown-panel-header h4 {
  margin: 4px 0 0;
  font-size: 20px;
}

.story-script-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.story-script-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.story-script-toolbar-meta {
  font-size: 13px;
  font-weight: 700;
  color: #8a6c7a;
}

.episode-note-item:hover .episode-note-edit-button,
.episode-note-item.editing .episode-note-edit-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.episode-note-index-editing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.episode-note-number-input {
  width: 54px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid rgba(184, 127, 58, 0.24);
  background: rgba(255, 248, 226, 0.92);
  color: #4a3a22;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.episode-note-number-input:focus {
  outline: none;
  border-color: rgba(231, 100, 127, 0.42);
  box-shadow: 0 0 0 3px rgba(231, 100, 127, 0.12);
}

.episode-note-card.add-card {
  justify-content: center;
  width: 180px;
  min-height: 180px;
  border-radius: 36px;
  background: transparent;
}

.episode-plus {
  font-size: 132px;
  line-height: 0.9;
  color: rgba(180, 171, 177, 0.52);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.workspace-workbench {
  padding: 20px;
}

.workspace-panels {
  display: block;
}

.workspace-panel {
  display: block;
}

.inset-panel {
  box-shadow: none;
  border: 1px solid rgba(239, 170, 192, 0.16);
  background: rgba(255, 255, 255, 0.64);
}

.topbar.canvas-hidden {
  display: none;
}

.compact-field {
  margin-top: 16px;
}

.card-list,
.history-list,
.validation-list,
.checklist-list {
  gap: 14px;
}

.list-item,
.history-item,
.validation-item,
.checklist-item,
.command-card,
.workflow-card {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(239, 170, 192, 0.16);
}

.stats-grid {
  gap: 14px;
}

.stat-card {
  background: rgba(255, 252, 253, 0.84);
}

.json-preview {
  border-radius: 22px;
  background: #1d1f2a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.topbar.quiet + .view-section[data-view="home"] .home-stage,
.topbar.quiet + .view-section[data-view="overview"] {
  margin-top: -18px;
}

@media (max-width: 1280px) {
  .project-gallery-grid,
  .project-gallery-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .view-section[data-view="home"].active {
    height: calc(100dvh - 24px);
    max-height: calc(100dvh - 24px);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    margin: 18px;
  }

  .main-panel {
    margin-left: 0;
    padding: 0 18px 48px;
  }

  .project-gallery-grid,
  .project-gallery-grid.compact,
  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stories-layout,
  .story-output-summary-grid,
  .story-deliverable-grid,
  .story-output-detail-grid,
  .story-plan-strip {
    grid-template-columns: 1fr;
  }

  .story-overview-strip {
    align-items: flex-start;
  }

  .stories-sidebar-card {
    position: static;
  }

  .stories-page-hero,
  .story-director-header,
  .story-shot-head {
    flex-direction: column;
  }

  .stories-page-hero-actions,
  .story-prompt-list-head,
  .story-director-header-actions {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .home-stage {
    gap: 16px;
  }

  .hamt-emblem {
    font-size: clamp(48px, 8vw, 78px);
  }

  .home-brand-en {
    font-size: clamp(20px, 3vw, 34px);
  }

  .home-brand-cn {
    font-size: clamp(18px, 2.4vw, 28px);
  }

  .home-cta {
    min-height: 52px;
    font-size: 24px;
  }

  .home-copy-stack {
    font-size: 16px;
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    min-height: 52px;
    padding: 12px 16px;
    border-radius: 999px;
  }

  .sidebar-footer {
    width: 100%;
  }

  .home-cta {
    min-width: 0;
    width: 100%;
    max-width: 320px;
    font-size: 24px;
  }

  .stories-layout,
  .story-shot-workbench,
  .story-shot-grid {
    grid-template-columns: 1fr;
  }

  .field.span-2 {
    grid-column: 1 / -1;
  }

  .stories-page-summary {
    justify-content: flex-start;
  }

  .stories-page-hero-actions,
  .story-shot-focus-nav,
  .story-shot-focus-actions,
  .story-shot-pill-row,
  .story-prompt-list-head,
  .story-director-header-actions,
  .story-shot-head-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .stories-export-dropdown {
    left: 0;
    right: auto;
    min-width: 100%;
  }

  .view-section[data-view="home"].active {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .home-stage {
    min-height: 52vh;
  }

  .home-projects-card {
    margin-top: 18px;
  }

  .project-gallery-grid,
  .project-gallery-grid.compact,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .episode-board {
    justify-content: center;
  }

  .workspace-title-block {
    flex-direction: column;
    min-height: auto;
  }

  .workspace-title-actions {
    position: static;
    transform: none;
    margin-top: 12px;
  }

  .mini-modal {
    padding: 20px 18px 18px;
  }

  .episode-modal-card {
    width: min(calc(100vw - 32px), 100%);
  }

  .project-settings-modal-card {
    width: min(calc(100vw - 32px), 100%);
  }

  .episode-settings-modal-card {
    width: min(calc(100vw - 32px), 100%);
  }

  .mini-modal-head h3 {
    font-size: 22px;
  }

  .mini-modal-body input {
    min-height: 54px;
    font-size: 18px;
  }

  .mini-modal-body textarea {
    min-height: 220px;
    font-size: 16px;
  }

  .mini-modal-actions {
    flex-direction: column-reverse;
  }

  .mini-modal-actions .ghost-button,
  .mini-modal-actions .primary-button {
    width: 100%;
  }

  .episode-story-actions .ghost-button,
  .episode-story-actions .primary-button {
    width: 100%;
  }

  .annotation-stats,
  .annotation-layout,
  .annotation-selection-hint {
    grid-template-columns: 1fr;
  }

  .annotation-layout {
    grid-template-columns: 1fr;
  }

  .story-breakdown-step-strip {
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .story-breakdown-step-strip::-webkit-scrollbar {
    display: none;
  }

  .story-breakdown-step {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  .story-breakdown-step-divider {
    flex: 0 0 18px;
  }

  .annotation-canvas-card {
    padding: 14px;
    border-radius: 20px;
  }

  .annotation-canvas-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .annotation-canvas-status-row {
    gap: 6px;
  }

  .annotation-canvas-head-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .annotation-canvas-head-actions .annotation-canvas-tip {
    margin-right: 0;
  }

  .script-annotation-canvas {
    padding: 18px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.82;
  }

  .story-marking-canvas {
    min-height: 52vh;
  }

  .story-mark-summary-strip {
    gap: 8px;
    overflow-x: auto;
    padding-top: 10px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .story-mark-summary-strip::-webkit-scrollbar {
    display: none;
  }

  .story-mark-summary-pill {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 10px;
  }

  .story-mark-flow-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 252, 245, 0.98) 24%);
  }

  .bottom-flow-button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    font-size: 15px;
  }

  .story-mark-menu {
    width: auto;
    max-width: calc(100vw - 32px);
    gap: 8px;
  }

  .story-mark-menu .compact-menu-button {
    width: 40px;
    justify-content: center;
  }

  .annotation-selection-hint {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-segment-tag-groups {
    grid-template-columns: 1fr;
  }
}

.app-shell.auth-gate .sidebar,
.app-shell.auth-gate .topbar {
  display: none;
}

.app-shell.auth-gate .main-panel {
  padding: 32px;
}

.auth-shell {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(760px, 100%);
  padding: 36px;
  border-radius: 32px;
}

.auth-page,
.admin-console {
  display: grid;
  gap: 18px;
}

.auth-page h2,
.admin-console h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
}

.auth-copy {
  margin: 0;
  color: rgba(84, 64, 74, 0.78);
}

.auth-switch {
  display: inline-flex;
  gap: 10px;
}

.auth-switch .ghost-button.active {
  border-color: rgba(231, 120, 146, 0.42);
  background: rgba(255, 236, 242, 0.88);
  color: #7d3950;
}

.auth-form-grid {
  display: grid;
  gap: 16px;
}

.auth-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.admin-console-card {
  width: min(1120px, 100%);
}

.admin-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-settings-stack {
  gap: 14px;
}

.admin-setting-block {
  gap: 12px;
}

.admin-setting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-setting-head h4 {
  margin: 0;
}

.admin-setting-form {
  display: grid;
  gap: 12px;
}

.admin-key-actions {
  flex-wrap: wrap;
}

.admin-secret-meta {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#admin-openai-key-input,
#admin-default-model-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .app-shell.auth-gate .main-panel {
    padding: 18px;
  }

  .auth-card {
    padding: 24px;
    border-radius: 24px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-console-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-inline-row {
    grid-template-columns: 1fr;
  }

  .admin-setting-head {
    align-items: flex-start;
  }
}
