:root {
  color-scheme: light;
  --bg: #f3f7f5;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --ink: #15211e;
  --ink-soft: #31423e;
  --muted: #52635e;
  --line: #dce8e3;
  --line-strong: #c5d5ce;
  --accent: #0e7d5c;
  --accent-soft: #e5f7f0;
  --danger: #8d3b3b;
  --sidebar-w: 212px;
  --content-max: 1180px;
  --radius: 8px;
  --radius-sm: 4px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cell: 13px;
  --cell-gap: 4px;
}

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

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

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #c8f0df; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus { transform: none; }

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 18px 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
}

.brand {
  display: grid;
  gap: 7px;
  padding: 0 10px;
  margin-bottom: 32px;
}

.brand-word {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.9;
}

.brand-note {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

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

.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.92rem;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}

.side-link:hover { background: rgba(14, 125, 92, 0.06); color: var(--ink); }

.side-link.is-active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-icon {
  display: grid;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
}

.side-link.is-active .nav-icon,
.side-link:hover .nav-icon { color: var(--accent); }

.nav-icon svg { width: 16px; height: 16px; display: block; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 2px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(14, 125, 92, 0.45);
  animation: pulse 2.8s ease-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(14, 125, 92, 0); }
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: clip;
}

.topbar,
.content-area {
  width: min(100%, var(--content-max));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 40px 18px;
  border-bottom: 1px solid var(--line);
}

.topbar-eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.04em;
}

.topbar h1 {
  margin-top: 6px;
  font-size: clamp(1.9rem, 2.5vw, 2.45rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 1.05;
  text-wrap: balance;
}

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

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

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

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  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: 600;
  transition: border-color 160ms var(--ease), color 160ms var(--ease), background 160ms var(--ease);
}

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

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

.refresh-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  line-height: 1;
  transition: transform 420ms var(--ease);
}

.refresh-button:hover:not(:disabled) .refresh-icon { transform: rotate(-70deg); }

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

.content-area {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 28px;
  min-width: 0;
  padding: 28px 40px 72px;
}

.content-area > * { min-width: 0; }

.content-area:focus { outline: none; }

.content-area.is-entering > * {
  animation: rise 720ms var(--ease) both;
}

.content-area.is-entering > *:nth-child(2) { animation-delay: 70ms; }
.content-area.is-entering > *:nth-child(3) { animation-delay: 130ms; }
.content-area.is-entering > *:nth-child(4) { animation-delay: 190ms; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
}

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

.card-head h2,
.section-head h2,
.activity-head h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-meta,
.section-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stat-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 22px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
}

.stat-grid:not(.project-stat-grid) .stat-card:nth-child(3n) { border-right: 0; }
.stat-grid:not(.project-stat-grid) .stat-card:nth-child(n + 4) { border-bottom: 0; }

.stat-card.is-clickable { cursor: pointer; transition: background 180ms var(--ease); }
.stat-card.is-clickable:hover { background: #f3fbf7; }

.stat-card.is-clickable:focus-visible {
  outline-offset: -3px;
  position: relative;
  z-index: 1;
}

.stat-title {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 550;
  letter-spacing: 0.04em;
}

.stat-value {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 2vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.95;
  font-variant-numeric: lining-nums tabular-nums;
}

.stat-card.is-primary { padding-top: 22px; padding-bottom: 20px; }

.stat-card.is-primary .stat-value {
  font-size: clamp(2.35rem, 3.4vw, 3.2rem);
}

.stat-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

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

.stat-mix {
  display: flex;
  height: 5px;
  margin-top: 18px;
  background: #e5f2ec;
}

.stat-mix i { display: block; height: 100%; }

.stat-source-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.stat-source-line span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.stat-source-line i { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

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

.source-sheet { padding: 2px 8px 4px; }

.source-row {
  margin: 0 -8px;
  padding: 16px 22px 14px;
  transition: background 160ms var(--ease);
}
.source-row + .source-row { border-top: 1px solid var(--line); }
.source-row:hover { background: rgba(14, 125, 92, 0.05); }

.source-main {
  display: grid;
  grid-template-columns: 132px 108px 58px minmax(72px, 1fr) max-content;
  grid-template-areas: "name total percent bar facts";
  align-items: center;
  gap: 8px 16px;
}

.source-name {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-area: name;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.source-name i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--source-color);
  flex-shrink: 0;
}

.source-total {
  grid-area: total;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: right;
  font-variant-numeric: lining-nums tabular-nums;
}

.source-percent {
  grid-area: percent;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.source-share {
  grid-area: bar;
  height: 3px;
  background: #e5f2ec;
}

.source-share > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--source-color);
  transition: width 720ms var(--ease);
}

.source-facts {
  display: flex;
  grid-area: facts;
  gap: 14px;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.source-facts b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.account-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 10px;
  padding-left: 15px;
}

.account-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.account-label {
  overflow: hidden;
  max-width: 180px;
  color: var(--ink-soft);
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.account-empty { color: var(--muted); font-size: 0.78rem; }

.activity-panel { margin: 0; }

.activity-modes,
.range-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.activity-mode,
.range-button {
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 550;
}

.activity-mode + .activity-mode,
.range-button + .range-button { box-shadow: inset 1px 0 0 var(--line); }

.activity-mode:hover,
.range-button:hover { color: var(--ink); }

.activity-mode.is-active,
.range-button.is-active,
.range-button:hover.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.activity-body,
.activity-view { min-width: 0; }

.activity-scroll,
.activity-chart-scroll,
.table-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 6px;
  overscroll-behavior-x: contain;
}

.activity-months {
  display: grid;
  grid-template-columns: repeat(var(--activity-columns), var(--cell));
  column-gap: var(--cell-gap);
  min-width: max-content;
  height: 22px;
  color: var(--muted);
  font-size: 0.72rem;
}

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

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

.activity-cell {
  display: block;
  width: var(--cell);
  height: var(--cell);
  border-radius: 2px;
  background: #e7f3ee;
  transition: transform 140ms var(--ease);
}

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

.activity-cell.is-empty { visibility: hidden; }
.activity-cell.is-filled { background: var(--accent); }
.activity-cell.level-0,
.activity-legend .level-0 { background: #e7f3ee; }
.activity-cell.level-1,
.activity-legend .level-1 { background: #c6eadc; }
.activity-cell.level-2,
.activity-legend .level-2 { background: #8ed9bf; }
.activity-cell.level-3,
.activity-legend .level-3 { background: #4eb992; }
.activity-cell.level-4,
.activity-legend .level-4 { background: #1a9a72; }
.activity-cell.level-5,
.activity-legend .level-5 { background: #0e7d5c; }

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

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

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

.activity-axis { stroke: var(--line-strong); stroke-width: 1; }
.activity-guide { stroke: var(--line); stroke-width: 1; }
.activity-area { fill: rgba(14, 125, 92, 0.14); }
.activity-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.75;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.activity-hover-line { stroke: rgba(14, 125, 92, 0.55); stroke-width: 1; pointer-events: none; }
.activity-hover-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; pointer-events: none; }
.activity-month-label { fill: var(--muted); font-size: 11px; font-family: var(--sans); }

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

.activity-cumulative-summary strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}

.activity-tooltip {
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 4px;
  max-width: min(420px, calc(100vw - 16px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(21, 33, 30, 0.08);
  pointer-events: none;
}

.activity-tooltip[hidden] { display: none; }
.activity-tooltip strong { font-size: 0.84rem; font-weight: 600; }
.activity-tooltip span { color: var(--muted); font-size: 0.72rem; }

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

.activity-insight { display: grid; gap: 2px; }
.activity-insight small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; }
.activity-insight strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums tabular-nums;
}

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

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

.bar-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(10px, 1fr);
  align-items: end;
  gap: 4px;
  padding: 0 4px 26px;
  border-bottom: 1px solid var(--line);
}

.bar-slot { position: relative; display: grid; align-items: end; height: 100%; min-width: 10px; }
.bar { width: 100%; min-height: 2px; }
.bar-label {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.chart-empty,
.table-empty,
.account-empty {
  color: var(--muted);
}

.chart-empty,
.table-empty {
  padding: 28px 8px;
  text-align: center;
  font-size: 0.88rem;
}

.mix-bar {
  display: flex;
  height: 12px;
  margin: 2px 0 18px;
  background: #e5f2ec;
  overflow: hidden;
}

.mix-bar span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 720ms var(--ease);
}

.progress-item {
  display: block;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  color: inherit;
}

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

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

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

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

.progress-track {
  height: 4px;
  background: #e5f2ec;
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  transition: width 720ms var(--ease);
}

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

.table-wrapper { overflow-x: auto; }

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

.data-table th {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}

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

.data-table tbody tr { transition: background 160ms var(--ease); }
.data-table tbody tr:hover { background: rgba(14, 125, 92, 0.05); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.is-clickable { cursor: pointer; }

.data-table tbody tr.is-clickable:focus-visible {
  outline-offset: -2px;
}

.project-page,
.events-page { display: grid; gap: 22px; }

.project-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-stat-grid .stat-card { border-bottom: 0; }
.project-stat-grid .stat-card:nth-child(4n) { border-right: 0; }

.project-page .stat-card:last-child .stat-value {
  overflow: hidden;
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 560;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.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);
}

.project-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.project-search::placeholder { color: var(--muted); }

.project-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.38fr) minmax(0, 1fr);
  gap: 14px;
}

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

.project-name-cell {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  vertical-align: bottom;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name-cell.is-link {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 200ms var(--ease);
}

.project-name-cell.is-link:hover,
.project-name-cell.is-link:focus-visible { background-size: 100% 1px; }

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

.events-back {
  border-bottom: 1px solid transparent;
  font-weight: 550;
  transition: border-color 160ms var(--ease);
}

.events-back:hover { border-bottom-color: var(--ink); }

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

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

.events-title-card h2 {
  min-width: 0;
  overflow: hidden;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  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 {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-success { background: var(--accent-soft); color: var(--accent); }
.status-error { background: #f8ecec; color: var(--danger); }
.error-text { color: var(--danger); font-size: 0.9rem; }

.settings-card { max-width: 760px; }
body[data-page="settings"] .settings-card > .card-head { display: none; }
.settings-body { display: grid; gap: 0; }

.setting-group + .setting-group {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.setting-group h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.setting-group p { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.65; }

.setting-group code,
.data-table code {
  font-family: var(--mono);
  font-size: 0.84em;
  padding: 0.05em 0.35em;
  background: #eef6f2;
  border-radius: 3px;
}

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

.setting-select {
  width: 100%;
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
}

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

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

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

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

.setting-group .data-table { margin-top: 12px; }
.setting-group .data-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.page-loader {
  position: relative;
  display: grid;
  gap: 16px;
  min-height: 0;
  align-content: start;
}

.page-loader::before,
.page-loader::after {
  content: "";
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(100deg, #e3eee8 25%, #f7fbf9 42%, #e3eee8 58%);
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.page-loader::before { height: 188px; }
.page-loader::after { height: 280px; }

.loader-label,
.spinner {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

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

@media (max-width: 1180px) {
  .project-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-stat-grid .stat-card { border-bottom: 1px solid var(--line); }
  .project-stat-grid .stat-card:nth-child(2n) { border-right: 0; }
  .project-stat-grid .stat-card:nth-child(n + 3) { border-bottom: 0; }
  .chart-row,
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .source-main {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name total"
      "percent facts"
      "bar bar";
  }

  .source-percent { text-align: left; }
}

@media (max-width: 860px) {
  .console-frame { grid-template-columns: 1fr; }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 244, 239, 0.92);
    backdrop-filter: blur(12px);
  }

  .brand { grid-auto-flow: column; align-items: baseline; gap: 10px; margin: 0; padding: 0 8px 0 2px; }
  .brand-word { font-size: 1.45rem; }
  .brand-note { display: none; }
  .side-nav {
    flex: 1;
    flex-direction: row;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-link { flex: 0 0 auto; min-height: 44px; padding: 0 12px; white-space: nowrap; }
  .sidebar-footer { display: none; }

  .topbar,
  .content-area { padding-left: 18px; padding-right: 18px; }
  .topbar { padding-top: 22px; align-items: flex-end; }
  .content-area { gap: 22px; padding-bottom: 48px; }

  .stat-grid,
  .project-stat-grid,
  .lower-grid { grid-template-columns: 1fr; }

  .source-main {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name total"
      "percent facts"
      "bar bar";
  }

  .source-percent { text-align: left; }
  .account-list { padding-left: 0; }

  .content-area .stat-grid:not(.project-stat-grid) .stat-card,
  .content-area .project-stat-grid .stat-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content-area .stat-grid .stat-card:last-child,
  .content-area .project-stat-grid .stat-card:last-child { border-bottom: 0; }

  .stat-card.is-primary .stat-value { font-size: 2.6rem; }
  .events-head,
  .section-head,
  .activity-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .activity-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
  .refresh-button { min-height: 44px; }
}

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .topbar-actions { justify-content: space-between; padding-bottom: 0; }
  .project-toolbar { align-items: stretch; flex-direction: column; }
  .range-toggle { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .project-search { width: 100%; }
  .setting-field { grid-template-columns: 1fr; }
  .events-title-card h2 { white-space: normal; }
}

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