:root {
  --plotline-bg: #f4efe6;
  --plotline-bg-warm: #fbf8f0;
  --plotline-surface: rgba(255, 252, 246, 0.94);
  --plotline-surface-elevated: #fffdf8;
  --plotline-border-soft: rgba(84, 68, 48, 0.14);
  --plotline-text: #241f1b;
  --plotline-text-muted: #74695d;
  --plotline-accent: #7a4d2c;
  --plotline-accent-dark: #59371f;
  --plotline-accent-soft: #f2e2cf;
  --plotline-secondary: #315f67;
  --plotline-secondary-soft: #dfecef;
  --plotline-danger: #963f36;
  --plotline-warning: #b8762b;
  --plotline-success: #4d7654;
  --plotline-timeline-bg: #ede2d3;
  --plotline-shadow-card: 0 14px 32px rgba(62, 45, 28, 0.08);
  --plotline-shadow-subtle: 0 8px 20px rgba(62, 45, 28, 0.06);
  --plotline-radius: 12px;
  --plotline-radius-sm: 9px;
  --plotline-ink: var(--plotline-text);
  --plotline-muted: var(--plotline-text-muted);
  --plotline-paper: var(--plotline-bg-warm);
  --plotline-panel: var(--plotline-surface);
  --plotline-line: var(--plotline-border-soft);
  --plotline-soft: var(--plotline-accent-soft);
  --app-bg: var(--plotline-bg);
  --app-surface: var(--plotline-surface);
  --app-surface-alt: var(--plotline-surface-elevated);
  --app-text: var(--plotline-text);
  --app-text-muted: var(--plotline-text-muted);
  --app-border: var(--plotline-border-soft);
  --app-link: var(--plotline-accent-dark);
  --app-input-bg: rgba(255, 253, 248, 0.9);
  --app-input-text: var(--plotline-text);
  --app-card-bg: var(--plotline-surface);
  --app-timeline-bg: var(--plotline-timeline-bg);
}

[data-theme="dark"] {
  color-scheme: dark;
  --plotline-bg: #14110f;
  --plotline-bg-warm: #1c1714;
  --plotline-surface: rgba(35, 29, 25, 0.96);
  --plotline-surface-elevated: #2a231e;
  --plotline-border-soft: rgba(231, 214, 190, 0.16);
  --plotline-text: #f1e7d8;
  --plotline-text-muted: #b9aa99;
  --plotline-accent: #d49a62;
  --plotline-accent-dark: #f0c99d;
  --plotline-accent-soft: #3a2a20;
  --plotline-secondary: #78b9c2;
  --plotline-secondary-soft: #21383d;
  --plotline-danger: #ee8e83;
  --plotline-warning: #e0ad65;
  --plotline-success: #91c99a;
  --plotline-timeline-bg: #211b17;
  --plotline-shadow-card: 0 16px 38px rgba(0, 0, 0, 0.34);
  --plotline-shadow-subtle: 0 10px 26px rgba(0, 0, 0, 0.24);
  --plotline-ink: var(--plotline-text);
  --plotline-muted: var(--plotline-text-muted);
  --plotline-paper: var(--plotline-bg-warm);
  --plotline-panel: var(--plotline-surface);
  --plotline-line: var(--plotline-border-soft);
  --plotline-soft: var(--plotline-accent-soft);
  --app-bg: #14110f;
  --app-surface: rgba(35, 29, 25, 0.96);
  --app-surface-alt: #2a231e;
  --app-text: #f4eadc;
  --app-text-muted: #cdbba7;
  --app-border: rgba(231, 214, 190, 0.2);
  --app-link: #f1c38f;
  --app-input-bg: #211b17;
  --app-input-text: #f4eadc;
  --app-card-bg: rgba(35, 29, 25, 0.96);
  --app-timeline-bg: #211b17;
  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--app-text);
  --bs-secondary-color: var(--app-text-muted);
  --bs-tertiary-color: #a99886;
  --bs-border-color: var(--app-border);
  --bs-link-color: var(--app-link);
  --bs-link-hover-color: #ffd5a6;
  --bs-card-bg: var(--app-card-bg);
  --bs-card-color: var(--app-text);
  --bs-modal-bg: var(--app-surface-alt);
  --bs-modal-color: var(--app-text);
  --bs-dropdown-bg: var(--app-surface-alt);
  --bs-dropdown-color: var(--app-text);
  --bs-list-group-bg: var(--app-surface);
  --bs-list-group-color: var(--app-text);
  --bs-table-color: var(--app-text);
  --bs-table-bg: transparent;
}

body {
  color: var(--plotline-text);
  background:
    radial-gradient(circle at top left, rgba(185, 134, 83, 0.18), transparent 34rem),
    linear-gradient(135deg, var(--plotline-bg-warm), var(--plotline-bg) 52%, #efe6d8);
  font-family: "Segoe UI", "Aptos", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

h1,
h2,
h3,
.navbar-brand,
.context-title strong {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

a {
  color: var(--plotline-accent-dark);
  text-decoration-color: rgba(122, 77, 44, 0.28);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--plotline-secondary);
}

.plotline-nav {
  background: rgba(255, 251, 243, 0.9) !important;
  border-bottom: 1px solid rgba(84, 68, 48, 0.13) !important;
  box-shadow: 0 8px 28px rgba(62, 45, 28, 0.06);
}

.navbar-brand {
  color: var(--plotline-accent-dark) !important;
  font-size: 1.35rem;
}

.plotline-nav .nav-link {
  border-radius: 999px;
  color: var(--plotline-text-muted) !important;
  font-weight: 650;
  padding-inline: 0.82rem;
}

.plotline-nav .nav-link:hover,
.plotline-nav .nav-link:focus {
  color: var(--plotline-accent-dark) !important;
  background: rgba(122, 77, 44, 0.1);
}

.page-heading h1,
.workspace-heading h1 {
  color: #201a16;
  text-wrap: balance;
}

.eyebrow {
  color: var(--plotline-accent);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
}

.lead-text,
.muted {
  color: var(--plotline-text-muted) !important;
}

.plain-card,
.empty-panel,
.edit-panel,
.list-section,
.story-bible-section,
.story-bible-card,
.archive-item-card,
.warning-card,
.warning-mini-card,
.scenario-chapter,
.drag-drop-panel,
.import-tree-book,
.import-confirmation,
.import-docs details {
  background: var(--plotline-surface);
  border-color: var(--plotline-border-soft);
  border-radius: var(--plotline-radius);
  box-shadow: var(--plotline-shadow-subtle);
}

.plain-card,
.story-bible-card,
.archive-item-card,
.timeline-scene-card,
.inspector-section {
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.plain-card:hover,
.story-bible-card:hover,
.archive-item-card:hover {
  border-color: rgba(122, 77, 44, 0.24);
  box-shadow: var(--plotline-shadow-card);
}

.empty-panel {
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.96), rgba(244, 229, 209, 0.72)),
    var(--plotline-surface);
}

.btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: none;
}

.btn-primary {
  --bs-btn-bg: var(--plotline-accent);
  --bs-btn-border-color: var(--plotline-accent);
  --bs-btn-hover-bg: var(--plotline-accent-dark);
  --bs-btn-hover-border-color: var(--plotline-accent-dark);
  --bs-btn-active-bg: var(--plotline-accent-dark);
  --bs-btn-active-border-color: var(--plotline-accent-dark);
}

.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color: var(--plotline-accent-dark);
  --bs-btn-border-color: rgba(122, 77, 44, 0.26);
  --bs-btn-hover-color: var(--plotline-accent-dark);
  --bs-btn-hover-bg: rgba(122, 77, 44, 0.12);
  --bs-btn-hover-border-color: rgba(122, 77, 44, 0.38);
  background: rgba(255, 252, 246, 0.72);
}

.btn-outline-danger {
  --bs-btn-color: var(--plotline-danger);
  --bs-btn-border-color: rgba(150, 63, 54, 0.34);
  --bs-btn-hover-bg: var(--plotline-danger);
  --bs-btn-hover-border-color: var(--plotline-danger);
}

.status-pill,
.purpose-chip,
.location-badge,
.archived-badge,
.severity-pill,
.overview-chip,
.story-bible-card-title span {
  border: 1px solid rgba(84, 68, 48, 0.13);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.82);
  color: var(--plotline-text-muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  font-weight: 750;
  letter-spacing: 0.02em;
}

.status-pill {
  background: var(--plotline-secondary-soft);
  color: #284f56;
}

.purpose-chip {
  background: var(--plotline-accent-soft);
  color: var(--plotline-accent-dark);
}

.severity-pill.warning,
.warning-placeholder.active {
  background: #fbecd3;
  color: #7b4b13;
  border-color: rgba(184, 118, 43, 0.28);
}

.context-header {
  background: rgba(255, 251, 243, 0.78);
  border: 1px solid var(--plotline-border-soft);
  border-radius: var(--plotline-radius);
  box-shadow: var(--plotline-shadow-subtle);
}

.context-nav a {
  border-radius: 999px;
  color: var(--plotline-text-muted);
  font-weight: 700;
}

.context-nav a:hover,
.context-nav a:focus {
  background: rgba(122, 77, 44, 0.1);
  color: var(--plotline-accent-dark);
}

.timeline-workspace {
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.84), rgba(237, 226, 211, 0.66)),
    var(--plotline-timeline-bg);
  border: 1px solid rgba(84, 68, 48, 0.16);
  border-radius: var(--plotline-radius);
  box-shadow: 0 18px 44px rgba(62, 45, 28, 0.1);
}

.timeline-chapter {
  background: rgba(255, 250, 242, 0.68);
  border-color: rgba(84, 68, 48, 0.15);
  border-radius: var(--plotline-radius);
}

.timeline-chapter-title,
.lane-board-heading,
.plot-lane-board-heading,
.lane-group-heading {
  background: linear-gradient(135deg, rgba(255, 252, 246, 0.96), rgba(244, 229, 209, 0.86));
  border-color: rgba(84, 68, 48, 0.16);
  color: var(--plotline-accent-dark);
}

.timeline-scene-card {
  background: linear-gradient(180deg, #fffdf8, #fbf3e8);
  border: 1px solid rgba(84, 68, 48, 0.16);
  border-radius: var(--plotline-radius-sm);
  box-shadow: 0 10px 24px rgba(62, 45, 28, 0.08);
}

.timeline-scene-card:hover,
.timeline-scene-card.selected,
.timeline-scene-card.focus-match,
.timeline-scene-card.keyboard-focus {
  border-color: rgba(122, 77, 44, 0.42);
  box-shadow: 0 0 0 3px rgba(122, 77, 44, 0.11), 0 16px 30px rgba(62, 45, 28, 0.12);
  transform: translateY(-1px);
}

.plot-lane-label,
.asset-lane-label,
.character-lane-label,
.plot-lane-slot,
.asset-lane-slot,
.character-lane-slot {
  background: rgba(255, 251, 244, 0.74);
  border-color: rgba(84, 68, 48, 0.14);
}

.thread-marker,
.asset-marker,
.character-appearance-pill {
  box-shadow: 0 4px 12px rgba(62, 45, 28, 0.12);
}

.scene-inspector-panel,
.scene-inspector-root {
  background: rgba(255, 251, 243, 0.72);
}

.inspector-section {
  background: var(--plotline-surface-elevated);
  border-color: var(--plotline-border-soft);
  border-radius: var(--plotline-radius);
  box-shadow: var(--plotline-shadow-subtle);
}

.scene-overview-card {
  background: linear-gradient(135deg, #fffaf1, #f2e2cf);
}

.inspector-quick-nav,
.inspector-accordion-toggle {
  background: rgba(255, 251, 243, 0.88);
  border-color: rgba(84, 68, 48, 0.14);
}

.inspector-accordion-toggle {
  color: var(--plotline-accent-dark);
  border-radius: var(--plotline-radius-sm);
}

.inspector-accordion-toggle:hover {
  background: rgba(122, 77, 44, 0.08);
}

.form-control,
.form-select {
  border-color: rgba(84, 68, 48, 0.2);
  border-radius: 10px;
  background-color: rgba(255, 253, 248, 0.9);
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
a:focus-visible {
  border-color: rgba(122, 77, 44, 0.56);
  box-shadow: 0 0 0 0.22rem rgba(122, 77, 44, 0.17);
  outline: none;
}

.plotline-confirm-modal {
  background: #fffaf2;
  border: 1px solid rgba(84, 68, 48, 0.16);
  border-radius: var(--plotline-radius);
  box-shadow: 0 24px 60px rgba(38, 30, 22, 0.2);
}

.plotline-confirm-modal .modal-header,
.plotline-confirm-modal .modal-footer {
  border-color: rgba(84, 68, 48, 0.12);
}

.alert-info,
.alert-warning {
  border-color: rgba(84, 68, 48, 0.16);
  border-radius: var(--plotline-radius-sm);
  background: rgba(255, 250, 241, 0.92);
  color: var(--plotline-text);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--plotline-text);
  --bs-table-border-color: rgba(84, 68, 48, 0.12);
}

/* Phase 1V polish: cohesive, writer-focused surfaces without changing layout contracts. */
.page-heading,
.workspace-heading {
  row-gap: 0.8rem;
}

.page-heading h1,
.workspace-heading h1 {
  color: #211915;
}

.lead-text {
  line-height: 1.55;
}

.btn-sm {
  padding: 0.28rem 0.72rem;
  font-size: 0.8rem;
}

.button-row {
  gap: 0.55rem;
}

.button-row .btn,
.story-bible-actions a,
.timeline-preset-panel .btn,
.timeline-filter-actions .btn {
  white-space: nowrap;
}

.badge,
.soft-count,
.attachment-kind,
.preset-chip,
.story-bible-meta span {
  border-radius: 999px;
  font-weight: 780;
  letter-spacing: 0.015em;
}

.badge.text-bg-light,
.story-bible-meta span,
.soft-count {
  border: 1px solid rgba(84, 68, 48, 0.13);
  background: rgba(255, 250, 241, 0.78) !important;
  color: var(--plotline-text-muted) !important;
}

.badge.text-bg-warning,
.warning-placeholder.active {
  border: 1px solid rgba(184, 118, 43, 0.28);
  background: #fbecd3 !important;
  color: #7b4b13 !important;
}

.badge.text-bg-success {
  background: rgba(77, 118, 84, 0.13) !important;
  color: #315936 !important;
}

.empty-panel,
.future-lane-placeholder,
.inspector-empty {
  position: relative;
  overflow: hidden;
}

.empty-panel::before,
.future-lane-placeholder::before,
.inspector-empty::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--plotline-accent), var(--plotline-secondary));
  opacity: 0.42;
}

.timeline-workspace {
  padding: 0.35rem;
}

.timeline-shell {
  border-color: rgba(84, 68, 48, 0.14);
  background:
    linear-gradient(90deg, rgba(84, 68, 48, 0.05) 1px, transparent 1px) 0 0 / calc(var(--timeline-scene-width) + var(--timeline-grid-gap)) 100%,
    linear-gradient(180deg, rgba(255, 252, 246, 0.94), rgba(244, 235, 221, 0.86));
}

.timeline-project-title,
.timeline-book-title {
  border: 1px solid rgba(45, 33, 23, 0.12);
  background:
    linear-gradient(135deg, rgba(49, 95, 103, 0.96), rgba(89, 55, 31, 0.94));
  box-shadow: 8px 0 24px rgba(62, 45, 28, 0.1);
}

.timeline-book {
  padding: 0.15rem;
}

.timeline-book-title {
  min-height: 58px;
  align-content: center;
}

.timeline-chapter {
  border: 1px solid rgba(84, 68, 48, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.78), rgba(242, 226, 207, 0.42));
  outline: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.timeline-chapter-title {
  min-height: 52px;
  border-bottom: 1px solid rgba(84, 68, 48, 0.13);
  border-radius: var(--plotline-radius-sm) var(--plotline-radius-sm) 0 0;
  backdrop-filter: blur(10px);
}

.timeline-chapter-title strong,
.timeline-book-title strong {
  font-size: 0.96rem;
}

.timeline-scenes {
  padding: 0.65rem;
}

.timeline-scene-card,
.timeline-empty-scene {
  border-radius: 11px;
}

.timeline-scene-card {
  position: relative;
  min-height: 176px;
  border-color: rgba(84, 68, 48, 0.15);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(251, 243, 232, 0.95));
  box-shadow: 0 10px 22px rgba(62, 45, 28, 0.08);
}

.timeline-scene-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.timeline-scene-card strong {
  color: #221a15;
  font-size: 0.98rem;
  line-height: 1.2;
}

.scene-summary {
  color: var(--plotline-text-muted);
  line-height: 1.38;
}

.location-pill,
.scene-pov-label,
.metric-mini-summary,
.dependency-placeholder,
.warning-placeholder {
  border: 1px solid rgba(84, 68, 48, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.timeline-placeholder-scene,
.timeline-placeholder-cell {
  border-color: rgba(84, 68, 48, 0.18);
  color: rgba(84, 68, 48, 0.58);
  background:
    repeating-linear-gradient(-45deg, rgba(122, 77, 44, 0.06) 0 8px, rgba(255, 255, 255, 0.18) 8px 16px),
    rgba(255, 252, 246, 0.52);
}

.timeline-scene-card:hover,
.timeline-scene-card.selected,
.timeline-scene-card.focus-match,
.timeline-scene-card.keyboard-focus,
.timeline-scene-card.search-hit {
  z-index: 3;
}

.timeline-scene-card.selected::before,
.timeline-scene-card.focus-match::before,
.timeline-scene-card.keyboard-focus::before,
.timeline-scene-card.search-hit::before {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  top: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--plotline-accent), var(--plotline-secondary));
}

.timeline-section-header,
.lane-board-heading,
.pacing-heading {
  border: 1px solid rgba(84, 68, 48, 0.13);
  backdrop-filter: blur(10px);
}

.plot-lane-board,
.asset-lane-board,
.character-lane-board {
  border-top-color: rgba(84, 68, 48, 0.12);
}

.plot-lane-label,
.asset-lane-label,
.character-lane-label {
  border-radius: 10px;
  background: rgba(255, 252, 246, 0.94);
  box-shadow: 6px 0 18px rgba(62, 45, 28, 0.06);
}

.plot-lane-slot,
.asset-lane-slot,
.character-lane-slot {
  min-height: 50px;
  border-radius: 10px;
}

.thread-marker,
.asset-marker,
.character-marker,
.character-appearance-pill {
  min-height: 24px;
  font-size: 0.7rem;
}

.thread-marker {
  border-color: color-mix(in srgb, var(--plot-colour), #241f1b 18%);
}

.asset-marker {
  border-radius: 8px;
  background: #eeeaf8;
}

.character-marker {
  background: #fff4d9;
}

.drag-chip,
[draggable="true"] {
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.drag-chip:hover,
[draggable="true"]:hover {
  transform: translateY(-1px);
}

.is-dragging {
  opacity: 0.55;
  box-shadow: 0 0 0 3px rgba(49, 95, 103, 0.14);
}

.drop-target-active {
  outline-color: rgba(49, 95, 103, 0.34);
  background-color: rgba(223, 236, 239, 0.55);
}

.timeline-control-panel,
.timeline-drag-palette,
.drag-drop-panel {
  background: rgba(255, 251, 243, 0.82);
  backdrop-filter: blur(10px);
}

.timeline-filter-drawer,
.timeline-control-group {
  border-color: rgba(84, 68, 48, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.scene-inspector-panel {
  border-color: rgba(84, 68, 48, 0.14);
  box-shadow: -14px 0 36px rgba(62, 45, 28, 0.07);
}

.inspector-header {
  border-bottom: 1px solid rgba(84, 68, 48, 0.12);
  margin-bottom: 0.75rem;
  padding-bottom: 0.7rem;
}

.inspector-header h2,
.inspector-empty h2 {
  color: #211915;
}

.scene-inspector-root {
  display: grid;
  gap: 0.85rem;
}

.inspector-section {
  padding: 0.95rem;
}

.inspector-section h3 {
  color: #211915;
  font-size: 1.02rem;
}

.scene-overview-card {
  border: 1px solid rgba(122, 77, 44, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(242, 226, 207, 0.82));
}

.inspector-quick-nav {
  top: 0.35rem;
  box-shadow: 0 10px 26px rgba(62, 45, 28, 0.08);
}

.inspector-nav-links {
  max-height: 6.2rem;
  overflow: auto;
}

.inspector-nav-links a {
  background: rgba(255, 253, 248, 0.84);
}

.inspector-accordion-toggle {
  min-height: 2.25rem;
  padding-inline: 0.2rem;
}

.writer-mini-card {
  border-color: rgba(84, 68, 48, 0.13);
  background: rgba(255, 253, 248, 0.78);
}

.writer-mini-card[open] {
  box-shadow: 0 10px 24px rgba(62, 45, 28, 0.07);
}

.writer-add-form,
.writer-edit-form {
  gap: 0.5rem;
}

.attachment-card-list {
  gap: 0.65rem;
}

.attachment-summary {
  align-items: center;
}

.attachment-kind {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(49, 95, 103, 0.18);
  padding: 2px 8px;
  background: var(--plotline-secondary-soft);
  color: #284f56;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.attachment-preview-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.attachment-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(84, 68, 48, 0.14);
  border-radius: 10px;
  background: rgba(255, 250, 241, 0.88);
  text-decoration: none;
}

.attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.attachment-thumb:hover img {
  transform: scale(1.04);
}

.attachment-thumb-fallback span {
  color: var(--plotline-text-muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.attachment-preview-copy {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.attachment-preview-copy p {
  margin: 0;
}

.attachment-add-card summary {
  color: var(--plotline-accent-dark);
}

.story-bible-section,
.writer-dashboard-panel {
  border-color: rgba(84, 68, 48, 0.14);
  background: rgba(255, 251, 243, 0.8);
}

.writer-dashboard-panel:first-child {
  border-color: rgba(49, 95, 103, 0.22);
  background:
    linear-gradient(135deg, rgba(223, 236, 239, 0.56), rgba(255, 251, 243, 0.9));
  box-shadow: 0 18px 38px rgba(49, 95, 103, 0.09);
}

.writer-queue-list {
  display: grid;
  gap: 0.75rem;
}

.writer-queue-card {
  border-color: rgba(84, 68, 48, 0.13);
  background: rgba(255, 253, 248, 0.86);
}

.writer-dashboard-panel:first-child .writer-queue-card:first-child {
  border-left: 4px solid var(--plotline-secondary);
}

.writer-queue-card h3 {
  line-height: 1.25;
}

.story-bible-nav {
  background: rgba(255, 251, 243, 0.78);
  border: 1px solid rgba(84, 68, 48, 0.12);
  border-radius: var(--plotline-radius);
  padding: 0.45rem;
}

.story-bible-card {
  background: rgba(255, 253, 248, 0.9);
}

.story-bible-card h3 {
  color: #211915;
}

.story-bible-card-title {
  gap: 0.8rem;
}

.story-bible-facts {
  border-top: 1px solid rgba(84, 68, 48, 0.1);
  padding-top: 0.65rem;
}

.story-bible-actions a {
  border-color: rgba(122, 77, 44, 0.2);
  background: rgba(255, 250, 241, 0.75);
}

.story-bible-actions a:hover {
  background: rgba(122, 77, 44, 0.1);
}

.timeline-settings-form {
  display: grid;
  gap: 1rem;
  max-width: 1180px;
}

.timeline-settings-section {
  display: grid;
  gap: 0.85rem;
}

.timeline-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.timeline-setting-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.72rem;
  align-items: start;
  min-height: 92px;
  border: 1px solid rgba(84, 68, 48, 0.13);
  border-radius: var(--plotline-radius-sm);
  padding: 0.85rem;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: var(--plotline-shadow-subtle);
  cursor: pointer;
}

.timeline-setting-card input {
  margin-top: 0.25rem;
  accent-color: var(--plotline-secondary);
}

.timeline-setting-card strong,
.timeline-setting-card small {
  display: block;
}

.timeline-setting-card strong {
  color: #211915;
}

.timeline-setting-card small {
  margin-top: 0.25rem;
  color: var(--plotline-text-muted);
  line-height: 1.4;
}

.timeline-setting-card:has(input:checked) {
  border-color: rgba(49, 95, 103, 0.25);
  background: linear-gradient(135deg, rgba(223, 236, 239, 0.52), rgba(255, 253, 248, 0.92));
}

.plotline-confirm-modal .modal-title {
  font-family: Georgia, "Times New Roman", serif;
}

.plotline-confirm-modal .modal-body {
  color: var(--plotline-text-muted);
  line-height: 1.55;
}

.theme-switcher {
  flex: 0 0 auto;
}

.theme-switcher .btn {
  --bs-btn-color: var(--plotline-text-muted);
  --bs-btn-border-color: var(--plotline-border-soft);
  --bs-btn-hover-color: var(--plotline-accent-dark);
  --bs-btn-hover-bg: rgba(122, 77, 44, 0.1);
  --bs-btn-hover-border-color: rgba(122, 77, 44, 0.28);
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: var(--plotline-accent);
  --bs-btn-active-border-color: var(--plotline-accent);
  font-weight: 700;
}

[data-theme="dark"] body {
  color: var(--app-text);
  background:
    radial-gradient(circle at top left, rgba(212, 154, 98, 0.12), transparent 34rem),
    linear-gradient(135deg, var(--plotline-bg-warm), var(--plotline-bg) 52%, #0f0d0c);
}

[data-theme="dark"] a:not(.btn) {
  color: var(--app-link);
  text-decoration-color: rgba(241, 195, 143, 0.36);
}

[data-theme="dark"] a:not(.btn):hover,
[data-theme="dark"] a:not(.btn):focus {
  color: var(--bs-link-hover-color);
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .lead-text,
[data-theme="dark"] .scene-summary,
[data-theme="dark"] .timeline-chapter-title span,
[data-theme="dark"] .timeline-book-title span,
[data-theme="dark"] .plotline-nav .nav-link,
[data-theme="dark"] .plotline-nav .navbar-text,
[data-theme="dark"] .plain-card p,
[data-theme="dark"] .inspector-empty,
[data-theme="dark"] .plotline-confirm-modal .modal-body,
[data-theme="dark"] .timeline-setting-card small {
  color: var(--app-text-muted) !important;
}

[data-theme="dark"] .plotline-nav {
  background: rgba(29, 23, 20, 0.92) !important;
  border-bottom-color: var(--plotline-border-soft) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

[data-theme="dark"] .plotline-nav .nav-link:hover,
[data-theme="dark"] .plotline-nav .nav-link:focus,
[data-theme="dark"] .plotline-nav .nav-link.active {
  color: var(--app-link) !important;
}

[data-theme="dark"] .navbar-toggler {
  border-color: var(--plotline-border-soft);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .page-heading h1,
[data-theme="dark"] .workspace-heading h1,
[data-theme="dark"] .timeline-scene-card strong,
[data-theme="dark"] .timeline-chapter-title strong,
[data-theme="dark"] .timeline-book-title strong,
[data-theme="dark"] .plain-card h2,
[data-theme="dark"] .plain-card h3,
[data-theme="dark"] .context-title strong,
[data-theme="dark"] .asset-card h2,
[data-theme="dark"] .character-card h2,
[data-theme="dark"] .inspector-header h2,
[data-theme="dark"] .inspector-empty h2,
[data-theme="dark"] .inspector-section h3,
[data-theme="dark"] .story-bible-card h3,
[data-theme="dark"] .timeline-setting-card strong {
  color: var(--app-text);
}

[data-theme="dark"] .plain-card,
[data-theme="dark"] .card,
[data-theme="dark"] .empty-panel,
[data-theme="dark"] .edit-panel,
[data-theme="dark"] .list-section,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .story-bible-section,
[data-theme="dark"] .story-bible-card,
[data-theme="dark"] .story-bible-nav,
[data-theme="dark"] .archive-item-card,
[data-theme="dark"] .warning-card,
[data-theme="dark"] .warning-mini-card,
[data-theme="dark"] .scenario-chapter,
[data-theme="dark"] .drag-drop-panel,
[data-theme="dark"] .import-tree-book,
[data-theme="dark"] .import-confirmation,
[data-theme="dark"] .import-docs details,
[data-theme="dark"] .scene-inspector-panel,
[data-theme="dark"] .pacing-panel,
[data-theme="dark"] .timeline-control-panel,
[data-theme="dark"] .timeline-drag-palette,
[data-theme="dark"] .timeline-filter-drawer,
[data-theme="dark"] .timeline-control-group,
[data-theme="dark"] .timeline-visibility-panel,
[data-theme="dark"] .timeline-jump-panel,
[data-theme="dark"] .timeline-preset-panel,
[data-theme="dark"] .attachment-card,
[data-theme="dark"] .attachment-preview-row,
[data-theme="dark"] .attachment-thumb,
[data-theme="dark"] .asset-mini-item,
[data-theme="dark"] .archive-empty,
[data-theme="dark"] .writer-dashboard-panel,
[data-theme="dark"] .writer-dashboard-panel:first-child,
[data-theme="dark"] .writer-queue-card,
[data-theme="dark"] .writer-mini-card,
[data-theme="dark"] .timeline-setting-card,
[data-theme="dark"] .timeline-setting-card:has(input:checked),
[data-theme="dark"] .scene-overview-card,
[data-theme="dark"] .inspector-section,
[data-theme="dark"] .inspector-quick-nav,
[data-theme="dark"] .inspector-accordion-toggle {
  color: var(--app-text);
  background: var(--app-surface);
  border-color: var(--app-border);
  box-shadow: var(--plotline-shadow-subtle);
}

[data-theme="dark"] .timeline-workspace,
[data-theme="dark"] .timeline-shell {
  background:
    linear-gradient(180deg, rgba(42, 35, 30, 0.96), rgba(29, 24, 21, 0.96)),
    var(--app-timeline-bg);
  border-color: var(--app-border);
}

[data-theme="dark"] .timeline-section-header,
[data-theme="dark"] .metric-lane-label,
[data-theme="dark"] .metric-shape-controls,
[data-theme="dark"] .metric-chart-frame,
[data-theme="dark"] .lane-board-heading,
[data-theme="dark"] .plot-lane-board-heading,
[data-theme="dark"] .pacing-heading,
[data-theme="dark"] .lane-group-heading,
[data-theme="dark"] .timeline-chapter-title,
[data-theme="dark"] .timeline-book-title {
  color: var(--app-link);
  background: rgba(37, 31, 27, 0.96);
  border-color: var(--app-border);
}

[data-theme="dark"] .timeline-project-title {
  background: #352318;
}

[data-theme="dark"] .timeline-chapter,
[data-theme="dark"] .timeline-scene-card,
[data-theme="dark"] .timeline-empty-scene,
[data-theme="dark"] .plot-lane-label,
[data-theme="dark"] .asset-lane-label,
[data-theme="dark"] .character-lane-label,
[data-theme="dark"] .plot-lane-slot,
[data-theme="dark"] .asset-lane-slot,
[data-theme="dark"] .character-lane-slot,
[data-theme="dark"] .timeline-placeholder-scene,
[data-theme="dark"] .timeline-placeholder-cell,
[data-theme="dark"] .metric-graph-points,
[data-theme="dark"] .timeline-minimap {
  color: var(--app-text);
  background: rgba(42, 35, 30, 0.9);
  border-color: var(--app-border);
}

[data-theme="dark"] .timeline-scene-card,
[data-theme="dark"] .timeline-empty-scene {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

[data-theme="dark"] .timeline-scene-card:hover,
[data-theme="dark"] .timeline-scene-card.selected,
[data-theme="dark"] .timeline-scene-card.focus-match,
[data-theme="dark"] .timeline-scene-card.keyboard-focus,
[data-theme="dark"] .timeline-scene-card.search-hit {
  border-color: rgba(212, 154, 98, 0.62);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .timeline-minimap button {
  color: var(--plotline-accent-dark);
  background: linear-gradient(180deg, #332920 0%, #241d18 100%);
  border-color: var(--plotline-border-soft);
}

[data-theme="dark"] .timeline-minimap button.is-active {
  color: #1c120d;
  background: linear-gradient(180deg, var(--plotline-accent-dark) 0%, var(--plotline-accent) 100%);
}

[data-theme="dark"] .drag-chip,
[data-theme="dark"] .purpose-chip,
[data-theme="dark"] .metric-mini-summary,
[data-theme="dark"] .scene-pov-label,
[data-theme="dark"] .location-pill,
[data-theme="dark"] .archive-pill,
[data-theme="dark"] .badge,
[data-theme="dark"] .badge.text-bg-light,
[data-theme="dark"] .status-pill,
[data-theme="dark"] .scenario-tag,
[data-theme="dark"] .plain-preview,
[data-theme="dark"] .soft-count,
[data-theme="dark"] .attachment-kind,
[data-theme="dark"] .preset-chip,
[data-theme="dark"] .story-bible-meta span {
  color: var(--app-text);
  background: rgba(212, 154, 98, 0.14);
  border-color: rgba(212, 154, 98, 0.24);
}

[data-theme="dark"] .badge.text-bg-warning,
[data-theme="dark"] .warning-placeholder.active {
  color: #ffe4b8 !important;
  background: rgba(224, 173, 101, 0.22) !important;
  border-color: rgba(224, 173, 101, 0.36);
}

[data-theme="dark"] .badge.text-bg-success {
  color: #c8f0ce !important;
  background: rgba(145, 201, 154, 0.16) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea,
[data-theme="dark"] input,
[data-theme="dark"] select {
  color: var(--app-input-text);
  background-color: var(--app-input-bg);
  border-color: var(--app-border);
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: #a99886;
  opacity: 1;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-check-input:focus {
  border-color: var(--plotline-accent);
  box-shadow: 0 0 0 0.2rem rgba(212, 154, 98, 0.2);
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled,
[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] textarea:disabled {
  color: #a99886;
  background-color: #1b1613;
  border-color: rgba(231, 214, 190, 0.12);
  opacity: 1;
}

[data-theme="dark"] .table {
  --bs-table-color: var(--app-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--app-border);
  --bs-table-striped-color: var(--app-text);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.035);
  --bs-table-hover-color: var(--app-text);
  --bs-table-hover-bg: rgba(212, 154, 98, 0.1);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .plotline-confirm-modal {
  color: var(--app-text);
  background: var(--app-surface-alt);
  border-color: var(--app-border);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--app-border);
}

[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1) brightness(1.6);
}

[data-theme="dark"] .dropdown-menu {
  --bs-dropdown-color: var(--app-text);
  --bs-dropdown-bg: var(--app-surface-alt);
  --bs-dropdown-border-color: var(--app-border);
  --bs-dropdown-link-color: var(--app-text);
  --bs-dropdown-link-hover-color: var(--app-link);
  --bs-dropdown-link-hover-bg: rgba(212, 154, 98, 0.12);
  --bs-dropdown-link-active-color: #1c120d;
  --bs-dropdown-link-active-bg: var(--plotline-accent-dark);
  --bs-dropdown-link-disabled-color: #8f8172;
}

[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .btn-outline-info {
  --bs-btn-color: var(--app-link);
  --bs-btn-border-color: rgba(241, 195, 143, 0.46);
  --bs-btn-hover-color: #1c120d;
  --bs-btn-hover-bg: var(--app-link);
  --bs-btn-hover-border-color: var(--app-link);
  --bs-btn-active-color: #1c120d;
  --bs-btn-active-bg: var(--app-link);
  --bs-btn-active-border-color: var(--app-link);
  --bs-btn-disabled-color: #9c8d7d;
  --bs-btn-disabled-border-color: rgba(231, 214, 190, 0.18);
}

[data-theme="dark"] .btn-outline-danger {
  --bs-btn-color: #ffb2aa;
  --bs-btn-border-color: rgba(238, 142, 131, 0.5);
  --bs-btn-hover-color: #2a1210;
  --bs-btn-hover-bg: #ffb2aa;
  --bs-btn-hover-border-color: #ffb2aa;
}

[data-theme="dark"] .nav-tabs {
  --bs-nav-tabs-border-color: var(--app-border);
  --bs-nav-tabs-link-hover-border-color: rgba(241, 195, 143, 0.28);
  --bs-nav-tabs-link-active-color: var(--app-text);
  --bs-nav-tabs-link-active-bg: var(--app-surface);
  --bs-nav-tabs-link-active-border-color: var(--app-border);
}

[data-theme="dark"] .context-header {
  color: var(--app-text);
  background: rgba(35, 29, 25, 0.94);
  border-color: rgba(241, 195, 143, 0.2);
}

[data-theme="dark"] .context-header .eyebrow {
  color: #dfc6aa;
}

[data-theme="dark"] .context-title strong,
[data-theme="dark"] .context-title strong span {
  color: #fff0df;
}

[data-theme="dark"] .context-nav a {
  color: #f1dcc4;
  background: rgba(241, 195, 143, 0.1);
  border-color: rgba(241, 195, 143, 0.28);
}

[data-theme="dark"] .context-nav a:hover,
[data-theme="dark"] .context-nav a:focus {
  color: #21160f;
  background: #f1c38f;
  border-color: #ffd5a6;
}

[data-theme="dark"] .timeline-filter,
[data-theme="dark"] .workspace-heading .button-row,
[data-theme="dark"] .timeline-control-panel {
  color: var(--app-text);
}

[data-theme="dark"] .timeline-filter .form-select,
[data-theme="dark"] .timeline-control-panel .form-control,
[data-theme="dark"] .timeline-control-panel .form-select,
[data-theme="dark"] .timeline-control-select .form-select {
  color: #fff0df;
  background-color: #251d18;
  border-color: rgba(241, 195, 143, 0.3);
}

[data-theme="dark"] .timeline-control-select,
[data-theme="dark"] .timeline-control-panel .form-label,
[data-theme="dark"] .timeline-filter-checks,
[data-theme="dark"] .timeline-visibility-panel label,
[data-theme="dark"] .timeline-preset-panel,
[data-theme="dark"] .preset-chip,
[data-theme="dark"] .metric-shape-intro,
[data-theme="dark"] .metric-raw-details summary {
  color: #dfc6aa;
}

[data-theme="dark"] .timeline-filter-drawer summary,
[data-theme="dark"] .timeline-control-group summary,
[data-theme="dark"] .timeline-drag-palette summary {
  color: #ffe2bd;
  background: rgba(241, 195, 143, 0.1);
}

[data-theme="dark"] .timeline-filter-drawer[open] summary,
[data-theme="dark"] .timeline-control-group[open] summary,
[data-theme="dark"] .timeline-drag-palette[open] summary {
  color: #fff4e8;
  background: rgba(241, 195, 143, 0.16);
}

[data-theme="dark"] .timeline-filter-drawer summary::after,
[data-theme="dark"] .timeline-control-group summary::after,
[data-theme="dark"] .timeline-drag-palette summary::after {
  color: #f1c38f;
}

[data-theme="dark"] .timeline-visibility-panel label,
[data-theme="dark"] .preset-chip {
  background: rgba(241, 195, 143, 0.1);
  border-color: rgba(241, 195, 143, 0.24);
}

[data-theme="dark"] .timeline-visibility-panel label:has(input:checked),
[data-theme="dark"] .preset-chip:hover {
  color: #fff0df;
  background: rgba(241, 195, 143, 0.18);
  border-color: rgba(241, 195, 143, 0.38);
}

[data-theme="dark"] .metric-toggle-pill {
  color: #f1dcc4;
  background: rgba(241, 195, 143, 0.1);
  border-color: rgba(241, 195, 143, 0.24);
}

[data-theme="dark"] .metric-toggle-pill::before {
  border: 1px solid rgba(255, 244, 232, 0.7);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .metric-toggle-pill:has(input:checked) {
  color: #fff4e8;
  background: rgba(241, 195, 143, 0.18);
  border-color: rgba(241, 195, 143, 0.42);
}

[data-theme="dark"] .metric-toggle-pill:hover,
[data-theme="dark"] .metric-toggle-pill:focus-within {
  color: #ffffff;
  border-color: rgba(255, 213, 166, 0.58);
}

[data-theme="dark"] .character-marker,
[data-theme="dark"] .character-appearance-pill {
  color: #24160d;
  background: #ffdca6;
  border-color: #fff0c9;
  box-shadow: 0 0 0 1px rgba(36, 22, 13, 0.32), 0 4px 10px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .character-marker:hover,
[data-theme="dark"] .character-appearance-pill:hover {
  color: #160d07;
  background: #fff0c9;
  border-color: #fff8df;
}

[data-theme="dark"] .alert-info {
  --bs-alert-color: #cceaf0;
  --bs-alert-bg: #17343a;
  --bs-alert-border-color: #285c66;
}

[data-theme="dark"] .alert-warning,
[data-theme="dark"] .validation-summary-errors {
  --bs-alert-color: #ffe3ad;
  --bs-alert-bg: #3b2a16;
  --bs-alert-border-color: #705229;
}

.plotweaver-help-layout {
  --help-drawer-width: 25%;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  transition: gap 0.18s ease;
}

.plotweaver-help-main {
  flex: 1 1 auto;
  min-width: 0;
  transition: flex-basis 0.18s ease;
}

.plotweaver-help-splitter,
.plotweaver-help-drawer {
  display: none;
}

.plotweaver-help-layout.help-open .plotweaver-help-splitter {
  display: block;
  flex: 0 0 8px;
  cursor: col-resize;
  background: linear-gradient(90deg, transparent, rgba(107, 114, 128, 0.22), transparent);
}

.plotweaver-help-layout.help-open .plotweaver-help-drawer {
  display: block;
  flex: 0 0 clamp(20%, var(--help-drawer-width), 50%);
  min-width: 20%;
  max-width: 50%;
  border-left: 1px solid rgba(107, 114, 128, 0.22);
  background: rgba(255, 253, 248, 0.96);
  transition: flex-basis 0.18s ease;
}

.plotweaver-help-layout.help-collapsed .plotweaver-help-splitter {
  display: none;
}

.plotweaver-help-layout.help-collapsed .plotweaver-help-drawer {
  flex-basis: 2.35rem;
  min-width: 2.35rem;
  max-width: 2.35rem;
}

.plotweaver-help-layout.help-collapsed .plotweaver-help-drawer-panel {
  display: none;
}

.plotweaver-help-collapsed-strip {
  display: none;
}

.plotweaver-help-layout.help-collapsed .plotweaver-help-collapsed-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  min-height: calc(100vh - 5rem);
  color: #5f6875;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  cursor: pointer;
}

.plotweaver-help-drawer-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 1rem);
}

.plotweaver-help-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem;
  border-bottom: 1px solid rgba(107, 114, 128, 0.18);
}

.plotweaver-help-drawer-content {
  min-height: 12rem;
  padding: 1rem;
  overflow: auto;
}

.help-drawer-article h2 {
  margin-bottom: 0.5rem;
}

.help-markdown-body {
  display: grid;
  gap: 0.75rem;
}

.help-markdown-body h1,
.help-markdown-body h2,
.help-markdown-body h3,
.help-markdown-body h4 {
  margin: 0.5rem 0 0;
}

.help-markdown-body p,
.help-markdown-body ul {
  margin-bottom: 0;
}

.help-article-image {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid rgba(107, 114, 128, 0.18);
  border-radius: 0.45rem;
}

.help-related-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(107, 114, 128, 0.18);
}

.help-related-section button {
  padding: 0;
  color: #2f6f63;
  background: none;
  border: 0;
  font-weight: 700;
  text-align: left;
}

.help-markdown-body .help-markdown-table {
  margin-bottom: 0;
}

.help-resizing {
  cursor: col-resize;
  user-select: none;
}

.plotweaver-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  padding: 0;
  color: #5f6875;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  background: transparent;
  border: 1px solid rgba(95, 104, 117, 0.42);
  border-radius: 999px;
  vertical-align: text-top;
}

.plotweaver-help-icon-wrapper {
  display: inline-flex;
  vertical-align: text-top;
}

.plotweaver-help-icon-wrapper-inline .plotweaver-help-icon {
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  font-size: 0.68rem;
}

.plotweaver-help-icon:hover,
.plotweaver-help-icon:focus {
  color: #2f6f63;
  border-color: #2f6f63;
  outline: none;
}

.plotweaver-help-popover {
  max-width: 350px;
}

.plotweaver-help-popover .popover-header {
  font-weight: 800;
}

.plotweaver-help-more {
  font-weight: 700;
  text-decoration: none;
}

[data-theme="dark"] .plotweaver-help-icon {
  color: #d8d0c4;
  border-color: rgba(216, 208, 196, 0.45);
}

[data-theme="dark"] .plotweaver-help-icon:hover,
[data-theme="dark"] .plotweaver-help-icon:focus {
  color: #f1c38f;
  border-color: #f1c38f;
}

[data-theme="dark"] .plotweaver-help-layout.help-open .plotweaver-help-drawer {
  border-left-color: rgba(255, 255, 255, 0.12);
  background: rgba(22, 22, 27, 0.97);
}

[data-theme="dark"] .plotweaver-help-drawer-header,
[data-theme="dark"] .help-related-section {
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .plotweaver-help-collapsed-strip {
  color: #d8d0c4;
}

.relationship-map-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.relationship-map-check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  min-height: 2rem;
  margin: 0;
  white-space: nowrap;
}

.relationship-map-legend {
  display: grid;
  grid-template-columns: minmax(160px, max-content) 1fr;
  gap: 0.9rem 1.2rem;
  align-items: center;
  margin: 0 0 1rem;
}

.relationship-map-legend h2 {
  margin: 0;
  font-size: 1rem;
}

.relationship-map-legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  align-items: center;
}

.relationship-map-legend-item {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  padding: 0.28rem 0.45rem;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 650;
}

.relationship-map-legend-line {
  display: inline-block;
  width: 2.15rem;
  height: 0;
  border-top: 4px solid currentColor;
  border-radius: 999px;
}

.relationship-map-detail-badges .status-pill,
.relationship-map-list-item .status-pill {
  border: 1px solid transparent;
}

.relationship-map-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
  align-items: stretch;
}

.relationship-map-canvas {
  min-height: 660px;
  overflow: hidden;
}

.relationship-map-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(107, 114, 128, 0.12);
}

.relationship-map-graph {
  width: 100%;
  min-height: 620px;
  border: 1px solid rgba(107, 114, 128, 0.16);
  border-radius: 0.75rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(196, 124, 44, 0.08), transparent 28rem),
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(248, 250, 252, 0.86));
}

.relationship-map-details {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.relationship-map-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0 0.8rem;
}

.relationship-map-detail-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 1rem 0;
}

.relationship-map-detail-list dt {
  color: var(--muted-text, #667085);
  font-weight: 600;
}

.relationship-map-detail-list dd {
  margin: 0;
}

.relationship-map-history {
  display: grid;
  gap: 0.45rem;
  padding-left: 1.1rem;
}

.relationship-map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.6rem;
}

.relationship-map-list-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem;
  text-align: left;
  color: inherit;
  background: var(--surface, #fff);
  border: 1px solid rgba(107, 114, 128, 0.22);
  border-radius: 0.6rem;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
}

.relationship-map-list-item:hover,
.relationship-map-list-item:focus,
.relationship-map-list-item.is-selected {
  border-color: #c47c2c;
  outline: none;
}

.relationship-category-family {
  color: #7c3f12;
  border-color: #d89a5e;
  background: #fff1df;
}

.relationship-category-friendship {
  color: #14532d;
  border-color: #7cc69a;
  background: #e7f8ed;
}

.relationship-category-romantic {
  color: #831843;
  border-color: #efa3c1;
  background: #fde7f0;
}

.relationship-category-hostile {
  color: #7f1d1d;
  border-color: #ee8f8f;
  background: #fee6e6;
}

.relationship-category-professional {
  color: #1e3a8a;
  border-color: #93b4ef;
  background: #e8f0ff;
}

.relationship-category-other {
  color: #374151;
  border-color: #bac2cf;
  background: #f2f4f7;
}

[data-theme="dark"] .relationship-map-list-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .relationship-map-graph {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 20% 20%, rgba(241, 195, 143, 0.08), transparent 28rem),
    linear-gradient(180deg, rgba(33, 32, 38, 0.96), rgba(22, 22, 27, 0.92));
}

[data-theme="dark"] .relationship-map-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .relationship-category-family {
  color: #ffd2a5;
  background: rgba(184, 101, 34, 0.17);
  border-color: rgba(255, 210, 165, 0.3);
}

[data-theme="dark"] .relationship-category-friendship {
  color: #a8e8bf;
  background: rgba(47, 158, 95, 0.16);
  border-color: rgba(168, 232, 191, 0.3);
}

[data-theme="dark"] .relationship-category-romantic {
  color: #f8b5cf;
  background: rgba(217, 70, 127, 0.16);
  border-color: rgba(248, 181, 207, 0.3);
}

[data-theme="dark"] .relationship-category-hostile {
  color: #ffb4b4;
  background: rgba(220, 63, 63, 0.16);
  border-color: rgba(255, 180, 180, 0.3);
}

[data-theme="dark"] .relationship-category-professional {
  color: #b7cdf7;
  background: rgba(79, 127, 216, 0.16);
  border-color: rgba(183, 205, 247, 0.3);
}

[data-theme="dark"] .relationship-category-other {
  color: #d0d6df;
  background: rgba(122, 135, 150, 0.15);
  border-color: rgba(208, 214, 223, 0.28);
}

@media (max-width: 1200px) {
  .timeline-filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .timeline-control-panel {
    align-items: stretch;
  }

  .relationship-map-controls {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .relationship-map-workspace {
    grid-template-columns: 1fr;
  }

  .relationship-map-details {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .workspace-heading,
  .page-heading,
  .context-header {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row {
    align-items: stretch;
  }

  .button-row .btn,
  .button-row form {
    width: 100%;
  }

  .attachment-preview-row {
    grid-template-columns: 1fr;
  }

  .attachment-thumb {
    width: 100%;
    max-width: 260px;
  }

  .inspector-nav-links {
    max-height: 8.5rem;
  }
}
