:root {
  --bg: #0a0d14;
  --surface: #111622;
  --surface-elevated: #171e2e;
  --surface-hover: #1e273b;
  --border: #242f45;
  --border-strong: #33425f;
  --text: #eef2f9;
  --text-muted: #93a1bc;
  --text-dim: #667591;
  --accent: #eab308;
  --accent-hover: #facc15;
  --accent-soft: rgba(234, 179, 8, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --live: #ef4444;
  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: var(--accent);
  font-size: 14px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.admin-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(234, 179, 8, 0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
}

/* Workspace Layout */
.workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 53px);
  position: sticky;
  top: 53px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
}

.year-tab {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.year-tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.year-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(234, 179, 8, 0.5);
}

.video-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.video-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.video-item:hover {
  background: var(--surface-elevated);
}

.video-item.active {
  background: var(--accent-soft);
  border-color: rgba(234, 179, 8, 0.45);
}

.video-item-main {
  min-width: 0;
  flex: 1;
}

.video-item-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.video-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-footer .btn {
  flex: 1;
}

/* Main Stage */
.main-stage {
  padding: 18px 24px 36px;
  min-width: 0;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.empty-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.empty-stage-card {
  text-align: center;
  max-width: 420px;
  padding: 36px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.empty-stage-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.empty-stage-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
}

/* Home Screen Catalog & Search */
.home-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
}

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

.home-title-row h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.home-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
  max-width: 440px;
}

.home-search-input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 12px;
}

.home-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.home-videos-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.home-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.14s;
}

.home-video-header:hover {
  background: var(--surface-hover);
}

.home-video-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-width: 0;
}

.home-video-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.home-video-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.home-watch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.home-sections-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-no-results {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Video Header */
.video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.video-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-width: 0;
}

.video-start-time {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.video-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.year-pill {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--danger-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
}

.live-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
}

.video-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-status {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Custom Player Container */
.player-container {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  width: 100%;
  user-select: none;
}

.video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.player-container:fullscreen,
.player-container:-webkit-full-screen {
  display: block;
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
}

.player-container:fullscreen .video-stage,
.player-container:-webkit-full-screen .video-stage {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}

.video-el {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

.player-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 16, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  padding: 20px;
  text-align: center;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.overlay-message {
  font-size: 14px;
  color: var(--text);
  max-width: 480px;
}

/* Controls Bar — below video in normal mode, overlay in fullscreen */
.controls-bar {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 14px 10px;
  z-index: 15;
  transition: opacity 0.25s ease;
}

.player-container:fullscreen .controls-bar,
.player-container:-webkit-full-screen .controls-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-top: none;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88) 32%);
  padding: 24px 14px 10px;
}

.player-container:fullscreen.fs-idle,
.player-container:fullscreen.fs-idle *,
.player-container:-webkit-full-screen.fs-idle,
.player-container:-webkit-full-screen.fs-idle * {
  cursor: none !important;
}

.player-container:fullscreen.fs-idle .controls-bar,
.player-container:-webkit-full-screen.fs-idle .controls-bar {
  opacity: 0;
  pointer-events: none;
}

.seek-wrapper {
  position: relative;
  padding: 8px 0;
  cursor: pointer;
  touch-action: none;
}

.seek-track {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: visible;
  transition: height 0.12s;
}

.seek-wrapper:hover .seek-track {
  height: 8px;
}

.seek-buffered {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  pointer-events: none;
}

.seek-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--accent);
  border-radius: 999px;
  pointer-events: none;
}

.seek-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.seek-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  margin-left: -1.5px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.85);
}

.seek-marker.is-sub {
  top: -1px;
  bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: rgba(250, 204, 21, 0.85);
}

.seek-marker.is-watched {
  background: #4ade80;
}

.seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.12s;
  pointer-events: none;
}

.seek-wrapper:hover .seek-thumb,
.seek-wrapper:focus .seek-thumb {
  transform: translate(-50%, -50%) scale(1);
}

.seek-tooltip {
  position: absolute;
  bottom: 24px;
  left: 0;
  transform: translateX(-50%);
  background: rgba(12, 16, 26, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 5px 9px;
  pointer-events: none;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.seek-tooltip-chapter {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seek-tooltip-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 7px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.ctrl-btn-text {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}

.time-sep {
  color: rgba(255, 255, 255, 0.45);
  margin: 0 2px;
}

.active-chapter-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(234, 179, 8, 0.16);
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.volume-slider {
  width: 78px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Audio Sync & Quality Toolbar */
.toolbar-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-group-end {
  margin-left: auto;
}

.toolbar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.offset-controls, .quality-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.offset-readout {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  min-width: 74px;
  text-align: center;
}

/* Sections & Subsections Panel */
.sections-panel {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

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

.sections-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sections-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.count-pill,
.watched-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.count-pill {
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}

.watched-count-pill {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.watched-count-pill.all-watched {
  background: rgba(34, 197, 94, 0.24);
  border-color: rgba(34, 197, 94, 0.6);
  color: #bbf7d0;
}

/* Inline Section Form */
.section-form {
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}

.section-form-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.section-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

/* Sections List */
.sections-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}

.section-row:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.section-row.active {
  background: var(--accent-soft);
  border-color: rgba(234, 179, 8, 0.55);
}

.section-row.is-subsection {
  margin-left: 26px;
  padding: 7px 12px;
  background: rgba(23, 30, 46, 0.6);
  border-left: 2px solid var(--border-strong);
}

.section-row.is-subsection:hover {
  background: var(--surface-hover);
}

.section-row.is-subsection.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.section-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.timestamp-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.25);
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.section-row.is-subsection .timestamp-pill {
  font-size: 11.5px;
  color: #fde047;
}

.section-label {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-row.is-subsection .section-label {
  font-weight: 500;
  font-size: 13.5px;
}

.section-end-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.section-row.is-watched:not(.active) {
  border-color: rgba(34, 197, 94, 0.28);
}

.section-row.is-watched:not(.active) .section-label {
  color: var(--text-muted);
}

.watch-toggle-btn {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.1s;
}

.watch-toggle-btn:hover {
  border-color: rgba(74, 222, 128, 0.75);
  color: rgba(74, 222, 128, 0.55);
  background: rgba(34, 197, 94, 0.08);
}

.watch-toggle-btn.is-watched {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #86efac;
}

.watch-toggle-btn.is-watched:hover {
  background: rgba(34, 197, 94, 0.32);
  border-color: #4ade80;
  color: #dcfce7;
}

.watch-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.section-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

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

.section-form-note {
  margin: 0 0 10px;
}

/* Pending Suggestions */
.btn-pending {
  background: var(--accent-soft);
  border-color: rgba(234, 179, 8, 0.45);
  color: var(--accent);
}

.btn-pending:hover {
  background: rgba(234, 179, 8, 0.22);
}

.pending-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0e14;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.video-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(234, 179, 8, 0.45);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pending-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}

.pending-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pending-section-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.suggestion-row {
  border-style: dashed;
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.04);
  align-items: flex-start;
  flex-wrap: wrap;
}

.suggestion-row:hover {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.55);
}

.suggestion-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 240px;
}

.suggestion-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.pending-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 1px 6px;
  border-radius: 999px;
}

.parent-context-pill {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 999px;
}

.parent-missing-pill {
  font-size: 11px;
  color: #fca5a5;
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 1px 7px;
  border-radius: 999px;
}

.btn-approve {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.btn-approve:hover {
  background: rgba(34, 197, 94, 0.26);
}

.pending-modal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-modal-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}

.pending-modal-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pending-modal-video-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.pending-modal-video-link:hover {
  text-decoration: underline;
}

.pending-modal-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Shortcuts footer */
.shortcuts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
}

.btn-primary {
  background: var(--accent);
  color: #0b0e14;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-elevated);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-chip {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 9px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.btn-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-chip.active {
  background: var(--accent-soft);
  border-color: rgba(234, 179, 8, 0.55);
  color: var(--accent);
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

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

.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field input[type="datetime-local"],
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 7px 10px;
}

.field input[type="datetime-local"] {
  color-scheme: dark;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.input-with-btn {
  display: flex;
  gap: 6px;
}

.input-with-btn input {
  flex: 1;
  min-width: 0;
}

.field-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.form-error {
  color: #f87171;
  font-size: 12.5px;
  min-height: 18px;
}

.empty-hint {
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px 6px;
}

/* Modal */
.modal {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  max-width: 640px;
  width: calc(100% - 28px);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 75vh;
  overflow-y: auto;
}

.quick-paste-box {
  background: var(--surface-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
}

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

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-elevated);
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.field input[type="file"] {
  width: 100%;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
}

.import-preview {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.import-preview-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.import-mode-group {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.import-mode-group legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  cursor: pointer;
}

.radio-option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--accent);
}

.radio-option span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-option strong {
  font-size: 13px;
  color: var(--text);
}

.radio-option small {
  font-size: 12px;
  color: var(--text-muted);
}

.radio-option-danger:has(input:checked) {
  border-color: rgba(239, 68, 68, 0.55);
  background: var(--danger-soft);
}

.radio-option-danger:has(input:checked) strong {
  color: #fca5a5;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.mobile-only {
  display: none;
}

/* Responsive */
@media (max-width: 920px) {
  .mobile-only {
    display: inline-flex;
  }

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 53px;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.6);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-stage {
    padding: 14px 14px 28px;
  }

  .section-form-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: span 1;
  }

  .checkbox-field {
    padding-top: 4px;
  }

  .toolbar-group-end {
    margin-left: 0;
  }

  .active-chapter-badge {
    display: none;
  }
}
