/* ============================================================
   真题资料站 — Notion-inspired Design System
   ============================================================ */

/* ─── Theme Variables ─── */
:root,
[data-theme="light"] {
  --bg:          #f7f7f5;
  --bg-elevated: #ffffff;
  --bg-hover:    #f1f1ef;
  --bg-active:   #e8e8e6;
  --bg-sidebar:  #f7f7f5;
  --bg-overlay:  rgba(0, 0, 0, 0.25);

  --text-primary:   #37352f;
  --text-secondary: #787774;
  --text-tertiary:  #9b9a97;
  --text-inverse:   #ffffff;

  --border:       #e9e9e7;
  --border-strong: #d3d3d0;

  --accent:       #2eaadc;
  --accent-bg:    #d3edf6;
  --accent-text:  #1a7fa3;

  --red:     #eb5757;  --red-bg:     #fde8e8;
  --orange:  #f29d38;  --orange-bg:  #fdecd0;
  --yellow:  #f2c94c;  --yellow-bg:  #fdf3d7;
  --green:   #27ae60;  --green-bg:   #d5f0e3;
  --blue:    #2d9bf0;  --blue-bg:    #d5ebf9;
  --purple:  #9b59b6;  --purple-bg:  #ecdaf5;
  --pink:    #e84393;  --pink-bg:    #fce0ef;
  --teal:    #0e9aa7;  --teal-bg:    #d0f0f2;
  --brown:   #8d6e63;  --brown-bg:   #e8ddd8;

  --shadow-sm:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.07);
  --shadow-lg:  0 12px 36px rgba(0,0,0,0.12);
  --radius-sm:  4px;
  --radius-md:  6px;
  --radius-lg:  10px;

  --sidebar-width: 248px;
  --topbar-height: 52px;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:          #191919;
  --bg-elevated: #202020;
  --bg-hover:    #2a2a2a;
  --bg-active:   #333333;
  --bg-sidebar:  #1e1e1e;
  --bg-overlay:  rgba(0, 0, 0, 0.55);

  --text-primary:   #ebebea;
  --text-secondary: #9b9a97;
  --text-tertiary:  #6b6b6b;

  --border:       #2f2f2f;
  --border-strong: #3d3d3d;

  --accent:       #529cca;
  --accent-bg:    #1c3a4d;
  --accent-text:  #7cc3e8;

  --red: #e06060;   --red-bg:    #3d1f1f;
  --orange: #d89030; --orange-bg: #3d2e15;
  --yellow: #d4b040; --yellow-bg: #3d3415;
  --green: #3dae70;  --green-bg:  #163025;
  --blue: #4da3e0;   --blue-bg:   #1a2e42;
  --purple: #a06cc0; --purple-bg: #2e1d3d;
  --pink: #d04888;   --pink-bg:   #3d182e;
  --teal: #2aabb5;   --teal-bg:   #142e30;
  --brown: #9a7b6e;  --brown-bg:  #2e2520;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.45);

  color-scheme: dark;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.25s;
  overflow: hidden;
  z-index: 30;
}

.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
  min-height: 48px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  user-select: none;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.sidebar-btn {
  width: 26px; height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}
.sidebar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); font-weight: 500; }
.nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  border-radius: 99px;
  padding: 0 7px;
  min-width: 24px;
  text-align: center;
  line-height: 20px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 16px;
}

.sidebar-section { padding: 6px 8px; flex: 1; overflow-y: auto; }
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 4px 10px 8px;
}

.subject-tree { display: flex; flex-direction: column; gap: 1px; }
.subject-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  border: none; background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.12s;
  text-align: left; width: 100%;
}
.subject-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.subject-item.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.subject-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.subject-count { margin-left: auto; font-size: 11px; color: var(--text-tertiary); }

/* ─── Sidebar Overlay (mobile) ─── */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 25;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

/* ─── Main ─── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── Topbar ─── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.mobile-only { display: none; }

.search-wrapper {
  flex: 1;
  position: relative;
  max-width: 520px;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-shortcut {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-family: inherit;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-tertiary);
  background: var(--bg);
  pointer-events: none;
}

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

/* View toggle */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}
.vt-btn {
  width: 30px; height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.12s, color 0.12s;
}
.vt-btn:hover { color: var(--text-primary); }
.vt-btn.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* Icon Button */
.icon-btn {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Theme toggle icons */
[data-theme="light"] .moon-icon,
[data-theme="dark"]  .sun-icon { display: none; }
[data-theme="light"] .sun-icon,
[data-theme="dark"]  .moon-icon { display: block; }

/* ─── Filter Bar ─── */
.filter-bar {
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

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

/* Filter Group (dropdown) */
.filter-group { position: relative; }

.filter-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.filter-trigger:hover { border-color: var(--border-strong); color: var(--text-primary); }
.filter-trigger.has-selection {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-bg);
}

.filter-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  display: none;
}
.filter-popup.open { display: block; }

.filter-popup-search {
  position: sticky;
  top: 0;
  padding: 4px;
  background: var(--bg-elevated);
  z-index: 1;
}
.filter-popup-search input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
  outline: none;
}
.filter-popup-search input:focus {
  border-color: var(--accent);
}
.filter-option.filter-hidden { display: none; }

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.1s;
  user-select: none;
}
.filter-option:hover { background: var(--bg-hover); }
.filter-option input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.filter-option-label { flex: 1; }
.filter-option-count {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Active filter chips */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
  transition: margin-top 0.2s;
}
.filter-chips:not(:empty) { margin-top: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  cursor: default;
  animation: chipIn 0.2s ease;
}
.chip-remove {
  width: 16px; height: 16px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  transition: opacity 0.12s;
}
.chip-remove:hover { opacity: 1; }

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.reset-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--red);
  transition: background 0.12s;
}
.reset-btn:hover { background: var(--red-bg); }

/* text-btn */
.text-btn {
  padding: 5px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--accent-text);
  transition: background 0.12s;
  white-space: nowrap;
  text-decoration: none;
}
.text-btn:hover { background: var(--accent-bg); text-decoration: none; }

/* ─── Results Bar ─── */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.results-bar-right { display: flex; align-items: center; gap: 8px; }
.sort-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13px;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

/* ─── View Panels ─── */
.view-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.view-panel.active-view { display: block; }

/* ─── Results Grid (Card view) ─── */
.results-grid {
  padding: 16px 20px;
}

.results-grid[data-mode="card"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

/* Card */
.q-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
  animation: cardIn 0.3s ease both;
}
.q-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.q-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

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

.q-card-id {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.q-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.q-card-prompt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.q-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.q-card-fav {
  position: absolute;
  top: 12px; right: 12px;
  color: var(--yellow);
  font-size: 14px;
}
.q-card { position: relative; }

/* Mini tag */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

/* Difficulty stars on card */
.q-card-stars {
  margin-left: auto;
  font-size: 12px;
  color: var(--orange);
  letter-spacing: 0.1em;
}

/* ─── Table View ─── */
.results-grid[data-mode="table"] {
  display: block;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.results-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.results-table tr {
  cursor: pointer;
  transition: background 0.1s;
}
.results-table tbody tr:hover { background: var(--bg-hover); }
.results-table tbody tr.active { background: var(--accent-bg); }

.table-title {
  font-weight: 500;
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-stars { color: var(--orange); letter-spacing: 0.05em; font-size: 12px; }

/* ─── Compact View ─── */
.results-grid[data-mode="compact"] {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.compact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
}
.compact-row:hover { background: var(--bg-hover); }
.compact-row.active { background: var(--accent-bg); }
.compact-id { font-size: 12px; color: var(--text-tertiary); min-width: 52px; }
.compact-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.compact-tags { display: flex; gap: 4px; flex-shrink: 0; }
.compact-fav { color: var(--yellow); font-size: 12px; }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* Scroll sentinel */
.scroll-sentinel { height: 1px; }

/* ─── Detail Panel (Slide-over) ─── */
.detail-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.detail-overlay.open { opacity: 1; pointer-events: auto; }

.detail-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 90vw);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 65;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dp-header-left { display: flex; align-items: center; gap: 8px; }
.dp-nav { display: flex; align-items: center; gap: 2px; border-left: 1px solid var(--border); padding-left: 8px; margin-left: 4px; }
.dp-header-right { display: flex; align-items: center; gap: 4px; }

/* Fav button */
.fav-btn .star-f { display: none; }
.fav-btn.is-fav .star-o { display: none; }
.fav-btn.is-fav .star-f { display: block; color: var(--yellow); }

/* Card favorites SVG */
.q-card-fav svg, .compact-fav svg { width: 14px; height: 14px; }

.dp-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 40px;
}

/* Detail content elements */
.dp-kicker {
  font-size: 12px;
  color: var(--accent-text);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.dp-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}
.dp-section {
  margin-bottom: 24px;
}
.dp-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.dp-prompt {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  line-height: 1.7;
  white-space: pre-wrap;
  font-size: 14px;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.dp-fact {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.dp-fact-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.dp-fact-value {
  font-size: 15px;
  font-weight: 600;
}

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

.dp-taxonomy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.dp-taxonomy-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 50px;
}

.dp-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}
.dp-crumb-sep { color: var(--text-tertiary); }

.dp-hierarchy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.dp-h-card {
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.dp-h-level { font-size: 11px; color: var(--text-tertiary); display: block; margin-bottom: 2px; }
.dp-h-name { font-size: 13px; font-weight: 600; }

.dp-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dp-mini-panel {
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.dp-mini-label { font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.dp-mini-value { font-size: 18px; font-weight: 700; }
.dp-mini-row { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.dp-stars { color: var(--orange); letter-spacing: 0.1em; margin-top: 6px; font-size: 16px; }

/* ─── Stats View ─── */
.stats-page { padding: 24px 20px 60px; }
.stats-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.stats-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-box {
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.stat-box-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-text);
}
.stat-box-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stats-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.bar-label {
  width: 90px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  flex: 1;
  height: 22px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  min-width: 2px;
}
.bar-count {
  width: 44px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
}

/* ─── Utilities ─── */
.hidden { display: none !important; }

/* Tag color classes (assigned via JS) */
.tag-blue    { background: var(--blue-bg);   color: var(--blue); }
.tag-green   { background: var(--green-bg);  color: var(--green); }
.tag-purple  { background: var(--purple-bg); color: var(--purple); }
.tag-orange  { background: var(--orange-bg); color: var(--orange); }
.tag-teal    { background: var(--teal-bg);   color: var(--teal); }
.tag-pink    { background: var(--pink-bg);   color: var(--pink); }
.tag-yellow  { background: var(--yellow-bg); color: var(--yellow); }
.tag-red     { background: var(--red-bg);    color: var(--red); }
.tag-brown   { background: var(--brown-bg);  color: var(--brown); }
.tag-default { background: var(--bg-active); color: var(--text-secondary); }

/* ─── Responsive ─── */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    margin-left: calc(-1 * var(--sidebar-width));
    z-index: 30;
  }
  .sidebar.mobile-open { margin-left: 0; }

  .results-grid[data-mode="card"] {
    grid-template-columns: 1fr;
  }
  .stats-charts {
    grid-template-columns: 1fr;
  }
  .dp-split { grid-template-columns: 1fr; }
  .dp-grid { grid-template-columns: 1fr; }
  .filter-row { gap: 4px; }
}

@media (max-width: 520px) {
  .topbar { padding: 8px 12px; }
  .filter-bar { padding: 8px 12px; }
  .results-bar { padding: 6px 12px; }
  .results-grid { padding: 12px; }
  .search-shortcut { display: none; }
  .view-toggle { display: none; }
}
