:root {
  --bg: #f5f6f8;
  --sidebar-bg: #fafbfc;
  --sidebar-w: 232px;
  --surface: #ffffff;
  --ink: #1a1d23;
  --ink-soft: #3a3f4a;
  --muted: #7a8294;
  --line: #e6e9ef;
  --line-strong: #d5d9e2;
  --accent: #3b82f6;
  --accent-soft: #eff6ff;
  --blue: #3b82f6;
  --green: #22c55e;
  --purple: #a855f7;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --cyan: #06b6d4;
  --orange: #f97316;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

html { scroll-behavior: smooth; background: var(--bg); }

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

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; cursor: pointer; }
button:active { transform: scale(0.98); }
h1, h2, h3, p { margin: 0; }

/* ── Layout ── */
.console-frame {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  margin-bottom: 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.brand-text strong { display: block; font-size: 0.92rem; }
.brand-text small { display: block; margin-top: 1px; color: var(--muted); font-size: 0.7rem; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 520;
  transition: background 120ms, color 120ms;
}

.side-link:hover { background: #eef1f6; color: var(--ink); }
.side-link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }

.nav-icon { width: 18px; text-align: center; font-size: 0.95rem; opacity: 0.7; flex-shrink: 0; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8rem;
  background: #f0f2f5;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

/* ── Main Area ── */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 720;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.refresh-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.refresh-status[data-state="error"] { color: var(--rose); }

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: background 120ms, border-color 120ms, color 120ms;
}

.refresh-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.refresh-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.refresh-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  line-height: 1;
}

.refresh-button.is-loading .refresh-icon {
  animation: spin 700ms linear infinite;
}

.content-area {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

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

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 0.95rem;
  font-weight: 680;
}

.card-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ── Stat Cards Grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 150ms, border-color 150ms;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.stat-title { font-size: 0.8rem; color: var(--muted); font-weight: 520; }

.stat-value {
  font-size: 1.6rem;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stat-source-list {
  display: grid;
  gap: 5px;
  margin-top: 4px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.stat-source-item {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.stat-source-item i { width: 6px; height: 6px; border-radius: 50%; }
.stat-source-item b { color: var(--ink-soft); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Source Stats ── */
.source-section { margin-bottom: 22px; }

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

.section-head h2 { margin-top: 2px; font-size: 1rem; font-weight: 720; }

.section-kicker {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.09em;
}

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

.source-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--source-color);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.source-heading h3 { font-size: 0.92rem; font-weight: 720; }
.source-heading div > span { color: var(--muted); font-size: 0.72rem; }

.source-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--source-color) 12%, white);
  color: var(--source-color);
  font-size: 0.7rem;
  font-weight: 800;
}

.source-total {
  display: block;
  margin-top: 18px;
  font-size: 1.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.source-total-label { display: block; margin-top: 6px; color: var(--muted); font-size: 0.76rem; }

.source-facts {
  display: flex;
  gap: 18px;
  margin-top: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.source-facts b { color: var(--ink-soft); font-weight: 700; }
.account-list { margin-top: 6px; }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 4px;
}

.account-row > div { display: grid; min-width: 0; }
.account-label { overflow: hidden; font-size: 0.78rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.account-row small { color: var(--muted); font-size: 0.68rem; }
.account-row > strong { flex-shrink: 0; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.account-empty { padding-top: 10px; color: var(--muted); font-size: 0.76rem; }

/* ── Token Activity ── */
.activity-panel {
  margin-bottom: 22px;
  padding: 20px 22px 16px;
}

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

.activity-head h2 { margin-top: 2px; font-size: 1.05rem; font-weight: 720; }

.activity-modes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.activity-mode {
  padding: 5px 9px;
  border-radius: 5px;
  background: transparent;
  color: #9298a4;
  font-size: 0.95rem;
  font-weight: 620;
}

.activity-mode:hover { background: #f2f4f7; color: var(--ink-soft); }
.activity-mode.is-active { color: var(--ink); background: transparent; font-weight: 720; }
.activity-body { min-width: 0; }
.activity-view { min-width: 0; }

.activity-scroll,
.activity-chart-scroll {
  width: 100%;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.activity-months {
  display: grid;
  grid-template-columns: repeat(var(--activity-columns), 14px);
  column-gap: 6px;
  min-width: max-content;
  height: 24px;
  color: #8a909b;
  font-size: 0.72rem;
}

.activity-months span { white-space: nowrap; }

.activity-calendar-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 6px;
  width: max-content;
}

.activity-stacked-grid {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 6px;
  width: max-content;
}

.activity-cell {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #f0f2f5;
  outline: 1px solid rgba(26, 29, 35, 0.015);
  transition: transform 100ms, filter 100ms;
}

.activity-cell:not(.is-empty):hover {
  position: relative;
  z-index: 1;
  transform: scale(1.28);
  filter: saturate(1.15);
}

.activity-cell.is-empty { visibility: hidden; }
.activity-cell.is-filled { background: #60a5fa; }
.activity-cell.level-0, .activity-legend .level-0 { background: #f0f2f5; }
.activity-cell.level-1, .activity-legend .level-1 { background: #dbeafe; }
.activity-cell.level-2, .activity-legend .level-2 { background: #bfdbfe; }
.activity-cell.level-3, .activity-legend .level-3 { background: #93c5fd; }
.activity-cell.level-4, .activity-legend .level-4 { background: #60a5fa; }
.activity-cell.level-5, .activity-legend .level-5 { background: #2583ed; }

.activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.72rem;
}

.activity-legend { display: flex; align-items: center; gap: 5px; }
.activity-legend i { display: block; width: 11px; height: 11px; border-radius: 3px; }

.activity-chart-scroll svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: 230px;
  overflow: visible;
  cursor: crosshair;
}

.activity-axis { stroke: var(--line-strong); stroke-width: 1; }
.activity-guide { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 6; }
.activity-area { fill: rgba(59, 130, 246, 0.09); }
.activity-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.activity-hover-line { stroke: rgba(59, 130, 246, 0.4); stroke-width: 1; stroke-dasharray: 3 4; pointer-events: none; }
.activity-hover-point { fill: var(--surface); stroke: var(--accent); stroke-width: 3; pointer-events: none; }
.activity-month-label { fill: var(--muted); font-size: 11px; }

.activity-cumulative-summary {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.activity-cumulative-summary strong { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }

.activity-tooltip {
  position: fixed;
  z-index: 1000;
  display: grid;
  gap: 4px;
  max-width: min(480px, calc(100vw - 16px));
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(31, 41, 55, 0.16);
  pointer-events: none;
}

.activity-tooltip[hidden] { display: none; }
.activity-tooltip strong { font-size: 0.84rem; font-weight: 680; white-space: nowrap; }
.activity-tooltip span { color: var(--muted); font-size: 0.7rem; white-space: nowrap; }

.activity-insights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.activity-insight {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f9fb;
}

.activity-insight small { color: var(--muted); font-size: 0.68rem; }
.activity-insight strong { color: var(--ink-soft); font-size: 0.78rem; font-weight: 720; font-variant-numeric: tabular-nums; }

/* ── Chart containers ── */
.chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.chart-row .card { min-height: 340px; }

.bar-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(10px, 1fr);
  align-items: end;
  gap: 4px;
  padding: 0 4px 26px 4px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to top, rgba(230, 233, 239, 0.4) 1px, transparent 1px),
    linear-gradient(to top, rgba(230, 233, 239, 0.2) 1px, transparent 1px);
  background-size: 100% 25%, 100% 12.5%;
}

.bar-slot { position: relative; display: grid; align-items: end; height: 100%; min-width: 10px; }

.bar {
  width: 100%; min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: opacity 120ms, filter 120ms;
}

.bar:hover { opacity: 0.85; filter: brightness(1.1); }

.bar-label {
  position: absolute; left: 50%; bottom: -22px;
  transform: translateX(-50%);
  color: var(--muted); font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-empty {
  margin: 12px 0; padding: 24px;
  color: var(--muted); font-size: 0.88rem;
  text-align: center;
}

/* ── Lower Grid ── */
.lower-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

/* ── Progress Bars ── */
.progress-item {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: inherit;
}

.progress-item:first-child { padding-top: 0; border-top: 0; }

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

.progress-label {
  font-size: 0.84rem;
  font-weight: 540;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-value {
  font-size: 0.8rem;
  font-weight: 640;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #eef0f4;
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table thead { background: #f8f9fb; }

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 650;
  color: var(--ink-soft);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.table-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 0.88rem; }

/* ── Project Stats ── */
.project-page .stat-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.range-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #eef1f6;
}

.range-button {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 650;
}

.range-button:hover,
.range-button.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.project-search {
  width: min(280px, 100%);
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.project-search:focus {
  outline: 2px solid rgba(59, 130, 246, 0.18);
  border-color: var(--accent);
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
}

.project-table-card { min-width: 0; }

.project-name-cell {
  display: block;
  max-width: 260px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name-cell.is-link {
  color: var(--accent);
}

.stat-card.is-clickable,
.progress-item.is-clickable,
.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.stat-card.is-clickable:hover {
  border-color: var(--accent);
}

.stat-card.is-clickable:focus-visible,
.progress-item.is-clickable:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.28);
  outline-offset: 2px;
}

.progress-item.is-clickable:hover .progress-label {
  color: var(--accent);
}

.data-table tbody tr.is-clickable:hover {
  background: var(--accent-soft);
}

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

.events-back {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 650;
}

.events-back:hover {
  text-decoration: underline;
}

.events-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.events-title-card {
  margin-bottom: 16px;
}

.events-title-card .card-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.events-title-card h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.events-model-cell,
.events-session-cell {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.events-session-cell {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ── Status Badges ── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.status-success { background: #ecfdf5; color: #065f46; }
.status-error { background: #fef2f2; color: #991b1b; }

.error-text { color: var(--rose); font-size: 0.78rem; }

/* ── Settings ── */
.settings-card { max-width: 780px; }

.settings-body { display: grid; gap: 20px; }

.setting-group h3 {
  font-size: 0.95rem;
  font-weight: 680;
  margin-bottom: 6px;
}

.setting-group p { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.6; }
.setting-group ol { margin: 4px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.8; }
.setting-group code { font-size: 0.82rem; background: #f0f2f5; padding: 1px 6px; border-radius: 4px; }

.setting-field {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 220px);
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.setting-select {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.setting-select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.18);
  border-color: var(--accent);
}

.setting-note { margin-top: 8px; color: var(--muted); }

.setting-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 10px;
}

.setting-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.setting-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Loading ── */
.page-loader {
  display: grid;
  place-items: center;
  min-height: 240px;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 1120px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-row { grid-template-columns: 1fr; }
  .lower-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .console-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin-bottom: 0; }
  .side-nav { flex-direction: row; flex: 0; }
  .sidebar-footer { display: none; }
  .main-area { padding: 0; }
  .topbar { padding: 12px 16px; }
  .topbar-actions { gap: 8px; }
  .refresh-status { display: none; }
  .content-area { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-grid { grid-template-columns: 1fr; }
  .lower-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .events-head { align-items: start; flex-direction: column; gap: 6px; }
  .chart-row .card { min-height: auto; }
  .activity-panel { padding: 16px; }
}

@media (max-width: 500px) {
  .stat-grid { grid-template-columns: 1fr; }
  .section-head { align-items: start; flex-direction: column; gap: 4px; }
  .activity-head { align-items: start; flex-direction: column; gap: 10px; }
  .activity-footer { align-items: start; flex-direction: column; gap: 8px; }
  .project-toolbar { align-items: stretch; flex-direction: column; }
  .range-toggle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-search { width: 100%; }
  .setting-field { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
