:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4ef;
  --bg-glow: radial-gradient(900px 360px at 50% -80px, rgba(39, 76, 145, 0.06), transparent 70%);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #efece4;
  --surface-subtle: #faf9f6;
  --topbar-bg: rgba(250, 249, 245, 0.88);
  --text: #18191d;
  --text-muted: #616774;
  --text-soft: #858c98;
  --border: #e6e1d6;
  --border-strong: #d4cdbf;
  --primary: #274c91;
  --primary-hover: #1d3b73;
  --primary-soft: #edf2fb;
  --primary-text: #274c91;
  --warn-bg: #fef6e4;
  --warn-text: #a15208;
  --info-bg: #ecf3fe;
  --info-text: #1e40af;
  --ok-bg: #eaf7ef;
  --ok-text: #166534;
  --danger-bg: #fef0f1;
  --danger-text: #be123c;
  --dot-ok: #16a34a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 24, 22, 0.04), 0 6px 20px rgba(24, 24, 22, 0.03);
  --shadow-card: 0 2px 6px rgba(24, 24, 22, 0.04), 0 14px 36px rgba(24, 24, 22, 0.06);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23616774' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111317;
  --bg-glow: radial-gradient(900px 360px at 50% -80px, rgba(108, 155, 255, 0.08), transparent 70%);
  --surface: #191c22;
  --surface-elevated: #20242c;
  --surface-muted: #242933;
  --surface-subtle: #15181d;
  --topbar-bg: rgba(17, 19, 23, 0.86);
  --text: #eceae4;
  --text-muted: #9aa2b1;
  --text-soft: #6f7785;
  --border: #282d37;
  --border-strong: #373e4c;
  --primary: #5b8af5;
  --primary-hover: #739cf8;
  --primary-soft: rgba(91, 138, 245, 0.16);
  --primary-text: #8eb2ff;
  --warn-bg: rgba(245, 158, 11, 0.15);
  --warn-text: #fbbf24;
  --info-bg: rgba(96, 165, 250, 0.16);
  --info-text: #93c5fd;
  --ok-bg: rgba(34, 197, 94, 0.15);
  --ok-text: #6ee7b7;
  --danger-bg: rgba(244, 63, 94, 0.16);
  --danger-text: #fda4af;
  --dot-ok: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.3);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa2b1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-glow);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

code {
  background: var(--surface-muted);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow: 0 1px 0 var(--border);
}

.hidden {
  display: none !important;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

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

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-ok);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

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

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-muted);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nav-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 13px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--surface-elevated);
  color: var(--primary-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

html[data-theme="dark"] .icon-moon {
  display: none;
}
html[data-theme="dark"] .icon-sun {
  display: block !important;
}
html[data-theme="light"] .icon-sun {
  display: none !important;
}

/* Main container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 22px 64px;
}

/* Overview stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 15px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.stat-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-val-info { color: var(--info-text); }
.stat-val-warn { color: var(--warn-text); }
.stat-val-ok { color: var(--ok-text); }

/* Cards & toolbars */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.toolbar {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.pill:hover {
  border-color: var(--primary);
  color: var(--text);
}

.pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pill span {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

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

.search-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

.input-search {
  padding-left: 33px !important;
}

.filter-row .select {
  width: auto;
  flex: 0 0 155px;
}

/* Form controls */
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-subtle);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.select {
  cursor: pointer;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-soft);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.textarea {
  resize: vertical;
  line-height: 1.65;
}

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s, transform 0.1s;
}

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

.btn:active {
  transform: scale(0.99);
}

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

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: 7px;
  width: 34px;
  height: 34px;
  background: var(--surface);
  color: var(--text-muted);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-muted);
  border-color: var(--border);
}

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

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

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

.btn-danger-ghost:hover {
  background: var(--danger-bg);
  border-color: transparent;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }

/* Interview cards */
.iv-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.iv-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.iv-card[data-status="to_read"] { border-left-color: var(--primary); }
.iv-card[data-status="picking"] { border-left-color: var(--info-text); }
.iv-card[data-status="done"] { border-left-color: var(--ok-text); }
.iv-card[data-status="skipped"] { border-left-color: var(--border); opacity: 0.62; }

.iv-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

.iv-main {
  flex: 1 1 auto;
  min-width: 0;
}

.iv-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.iv-title {
  margin: 0 0 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  line-height: 1.45;
}

.iv-title:hover {
  color: var(--primary-text);
}

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

.iv-bg-chip {
  background: var(--surface-muted);
  color: var(--text);
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11.5px;
}

.iv-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  align-items: center;
}

/* Detail two-column workspace */
.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-id-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-workspace {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.detail-sidebar {
  position: sticky;
  top: 74px;
}

.detail-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.detail-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
}

.detail-submeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seg-status-pills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 5px 4px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--primary-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

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

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

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

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

.meta-form-footer {
  margin-top: 2px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

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

.section-head h2 {
  margin: 0;
  font-size: 15.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-q-form {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.topic-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-pill {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.topic-pill:hover {
  border-color: var(--primary);
  color: var(--text);
}

.topic-pill.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
}

.add-q-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.inline-ans-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}

.raw-fallback {
  margin-top: 14px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.raw-fallback summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-muted);
  user-select: none;
}

.raw-fallback-body {
  margin-top: 10px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 13px;
}

.raw-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 6px;
}

.raw-line:hover {
  background: var(--surface);
}

.raw-line-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Question lists */
.q-list,
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.q-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  background: var(--surface);
}

.q-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.q-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.q-item-title {
  font-weight: 600;
  font-size: 14.5px;
  margin: 0;
  line-height: 1.5;
}

.q-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.q-answer-box {
  margin-top: 10px;
  padding: 11px 13px;
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  animation: fadeUp 0.16s ease-out;
}

.q-tldr {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.q-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.75;
}

.q-bullets li {
  margin-bottom: 3px;
}

.q-user-note {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Pending view */
.pending-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pending-banner h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.pending-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px;
  box-shadow: var(--shadow);
}

.pending-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Flashcard deck */
.mem-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  background: var(--surface-muted);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  gap: 3px;
}

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

.mode-switch .btn.active {
  background: var(--surface-elevated);
  color: var(--primary-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.flashcard-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}

.flashcard-deck-wrap {
  position: relative;
  width: 100%;
  max-width: 780px;
}

.flashcard-deck-wrap::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -7px;
  height: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 14px 14px;
  opacity: 0.72;
  z-index: 0;
}

.flashcard {
  position: relative;
  z-index: 1;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.fc-progress-bar {
  height: 3px;
  width: 100%;
  background: var(--surface-muted);
}

.fc-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.25s ease;
}

.fc-inner {
  padding: 22px 26px 20px;
}

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

.fc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.fc-question {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.fc-source-bar {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.fc-answer-hidden {
  border: 1.5px dashed var(--border-strong);
  border-radius: 11px;
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-subtle);
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.fc-answer-hidden:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}

.fc-answer-revealed {
  padding: 16px 18px;
  background: var(--surface-subtle);
  border-radius: 11px;
  border-left: 4px solid var(--primary);
  animation: fadeUp 0.18s ease-out;
}

.fc-tldr-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-text);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.fc-tldr-text {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.55;
}

.fc-controls {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fc-grade-group,
.fc-nav-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fc-grade-danger:hover {
  border-color: var(--danger-text);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.fc-grade-warn:hover {
  border-color: var(--warn-text);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.fc-shortcuts {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.fc-shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-sync-note {
  text-align: center;
  margin-top: 26px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Empty states */
.empty-state {
  width: 100%;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 22px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state svg {
  color: var(--text-soft);
  opacity: 0.75;
}

.empty-state p {
  margin: 0;
  max-width: 440px;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 24, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.16s ease-out;
}

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

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

.edit-q-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* Toast */
.toast {
  position: fixed;
  top: 68px;
  right: 22px;
  z-index: 80;
  pointer-events: none;
  background: #1d222b;
  color: #f3f2ee;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  animation: fadeUp 0.16s ease-out;
}

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

@media (max-width: 960px) {
  .detail-workspace {
    grid-template-columns: 1fr;
  }
  .detail-sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .meta-grid-2 {
    grid-template-columns: 1fr;
  }
  .iv-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .iv-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .filter-row .select {
    flex: 1 1 140px;
  }
}

/* Auth gate */
.auth-checking #app-header,
.auth-checking #app-main {
  opacity: 0;
  pointer-events: none;
}

.auth-locked #app-header,
.auth-locked #app-main {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.18s ease-out;
}

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

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

.auth-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.auth-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  font-size: 12.5px;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid rgba(190, 18, 60, 0.2);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  font-size: 14px;
}

.auth-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
}
