/* Design tokens used by the pages, in light and dark. */
:root {
  color-scheme: light;
  --font-anthropic-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-anthropic-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --cds-font-size-title: 2rem;
  --cds-font-size-heading: 1.2rem;
  --cds-font-size-body: 1rem;
  --cds-font-size-caption: 0.86rem;
  --cds-font-weight-medium: 600;
  --cds-gap-xs: 0.25rem; --cds-gap-sm: 0.5rem; --cds-gap-md: 1rem; --cds-gap-lg: 1.5rem; --cds-gap-xl: 2.25rem;
  --cds-pad-xs: 0.3rem; --cds-pad-sm: 0.5rem; --cds-pad-md: 0.8rem; --cds-pad-lg: 1.25rem;
  --cds-radius: 8px;
  --cds-dur-slow: 0.3s;
  --color-bg: #faf9f6;
  --color-panel: #fefefd;
  --color-border-line: #e6e3dc;
  --color-fg: #1d1c1a;
  --color-fg-muted: #625f58;
  --color-bad: #b42318;
  --cds-chart-status-critical: #d14b3d;
  --cds-chart-muted: #b3afa5;
  --cds-chart-reference: #dd9b2c;
  --cds-chart-axis: #c4bfb3;
  --cds-surface-popover: #fdfcfb;
  --cds-border: #e6e3dc;
  --cds-shadow-popover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --cds-text-secondary: #625f58;
  --side-bg: #f3f1ec;
  --side-active: #e7e4dc;
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --color-bg: #1a1918;
    --color-panel: #232220;
    --color-border-line: #3a3835;
    --color-fg: #ecebe7;
    --color-fg-muted: #a7a49c;
    --color-bad: #f2867a;
    --cds-chart-status-critical: #e5685a;
    --cds-chart-muted: #6f6c66;
    --cds-chart-reference: #e5a845;
    --cds-chart-axis: #55524d;
    --cds-surface-popover: #2b2a27;
    --cds-border: #3a3835;
    --cds-shadow-popover: 0 6px 20px rgba(0, 0, 0, 0.5);
    --cds-text-secondary: #a7a49c;
    --side-bg: #141312;
    --side-active: #2b2a27;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--color-bg); color: var(--color-fg); font-family: var(--font-anthropic-sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* Layout: sidebar on the left, about a fifth of the width. */
.site { display: grid; grid-template-columns: minmax(13rem, 20%) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg); border-right: 1px solid var(--color-border-line); padding: 1.75rem 1.1rem; display: flex; flex-direction: column; gap: 1.25rem; }
.side-brand { text-decoration: none; display: flex; flex-direction: column; gap: 0.2rem; padding: 0 0.6rem; }
.side-kicker { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-fg-muted); }
.side-title { font-family: var(--font-anthropic-serif); font-size: 1.3rem; line-height: 1.2; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-list a { display: block; padding: 0.45rem 0.6rem; border-radius: 6px; text-decoration: none; font-size: 0.93rem; color: var(--color-fg); }
.side-list a:hover { background: var(--side-active); }
.side-list a[aria-current="page"] { background: var(--side-active); font-weight: 600; }
.side-group { margin: 0.9rem 0 0.2rem; padding: 0 0.6rem; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-fg-muted); }
.side-meta { margin: auto 0 0; padding: 0 0.6rem; font-size: 0.78rem; color: var(--color-fg-muted); line-height: 1.45; }

.main { padding: 2.5rem clamp(1rem, 4vw, 3.5rem) 3rem; min-width: 0; }
#dash-root { max-width: 1180px; }
.foot { max-width: 1180px; margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border-line); font-size: 0.85rem; color: var(--color-fg-muted); }
.foot p { margin: 0 0 0.5rem; max-width: 60rem; }

@media (max-width: 860px) {
  .site { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 0.75rem 1rem; gap: 0.5rem; border-right: 0; border-bottom: 1px solid var(--color-border-line); }
  .side-brand { padding: 0; }
  .side-kicker, .side-meta, .side-group { display: none; }
  .side-title { font-size: 1.05rem; }
  .side-list { flex-direction: row; overflow-x: auto; gap: 0.25rem; padding-bottom: 2px; scrollbar-width: none; }
  .side-list a { white-space: nowrap; font-size: 0.85rem; padding: 0.35rem 0.6rem; }
  .main { padding: 1.25rem 1rem 2.5rem; }
}

/* Narrow screens: stack the league-table rows so company names wrap instead of overflowing. */
@media (max-width: 640px) {
  .ax .ax-lrow { grid-template-columns: minmax(0, 1fr) auto; }
  .ax .ax-lrow.ax-lhead { display: none; }
  .ax .ax-lrow > .ax-chips { grid-column: 1 / -1; }
  .ax .ax-lrow > .ax-money { grid-column: 1 / -1; text-align: left; }
  .ax .ax-srow { grid-template-columns: 1fr; gap: var(--cds-gap-xs); }
  .ax .ax-bar-line { grid-template-columns: 3.2rem 1fr 6.2rem !important; }
  .kv .kv-bar-row { grid-template-columns: minmax(0, 1fr) 1.5rem; }
  .kv .kv-bar-row > .kv-chips { grid-column: 1 / -1; grid-row: 2; }
}
.ax .ax-grid2 > *, .ax .ax-finds > *, .kv .kv-grid > * { min-width: 0; }
.ax .ax-mc-who { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .ax .ax-matrix { grid-template-columns: minmax(4.5rem, 6rem) repeat(2, minmax(0, 1fr)); }
}

/* Always-visible contact line at the bottom of the screen. */
.main { display: flex; flex-direction: column; }
.reach { position: sticky; bottom: 0; margin: 2rem 0 -3rem; padding: 0.55rem 0; background: var(--color-bg); border-top: 1px solid var(--color-border-line); text-align: center; font-size: 0.8rem; color: var(--color-fg-muted); z-index: 5; }
.reach a { color: var(--color-fg); text-underline-offset: 2px; }
@media (max-width: 860px) { .reach { margin-bottom: -2.5rem; } }

/* Light / dark toggle in the sidebar. */
.side-top { display: flex; flex-direction: column; gap: 1.25rem; }
.theme-toggle { display: inline-flex; align-items: center; gap: 0.45rem; align-self: flex-start; margin: 0 0.6rem; padding: 0.35rem 0.7rem; border: 1px solid var(--color-border-line); border-radius: 999px; background: transparent; color: var(--color-fg-muted); font: inherit; font-size: 0.78rem; cursor: pointer; }
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--color-fg); border-color: var(--color-fg-muted); }
.theme-toggle svg { width: 15px; height: 15px; flex: none; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.75rem; }
.side-foot .side-meta { margin: 0; }
@media (max-width: 860px) {
  .side-top { flex-direction: row; align-items: center; justify-content: space-between; gap: 0.5rem; }
  .side-foot { display: none; }
  .side-top .theme-toggle { margin: 0; }
}
.side-top .theme-toggle { display: none; }
@media (max-width: 860px) { .side-top .theme-toggle { display: inline-flex; } }

/* Ten findings: two columns on wide screens, one on narrow. */
#dash-root .ax .ax-finds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { #dash-root .ax .ax-finds { grid-template-columns: minmax(0, 1fr); } }
