/* ---------------------------------------------------------------------------
   Foundations: tokens, reset, typography.

   The palette follows Apple's system colours rather than inventing new ones,
   so the app feels at home next to the rest of the OS in both appearances.
   --------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --font-rounded: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", var(--font-sans);

  --bg: #f4f6f5;
  --bg-elevated: #ffffff;
  --bg-sunken: #eceeed;
  --felt: #e6ebe7;
  --felt-edge: rgba(60, 80, 70, 0.10);

  --label: #16181a;
  --label-secondary: rgba(60, 67, 63, 0.62);
  --label-tertiary: rgba(60, 67, 63, 0.34);
  --separator: rgba(60, 67, 63, 0.14);

  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --red: #d7382e;
  --green: #348f5b;

  --shadow-card: 0 1px 2px rgba(16, 24, 20, 0.10), 0 6px 18px rgba(16, 24, 20, 0.07);
  --shadow-lift: 0 10px 22px rgba(16, 24, 20, 0.16), 0 30px 60px rgba(16, 24, 20, 0.14);
  --shadow-panel: 0 1px 1px rgba(16, 24, 20, 0.04), 0 8px 30px rgba(16, 24, 20, 0.08);

  --radius-card: 12px;
  --radius-panel: 18px;
  --radius-control: 12px;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.44, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-sunken: #0b0d0c;
    --felt: #101613;
    --felt-edge: rgba(255, 255, 255, 0.06);

    --label: #f2f2f4;
    --label-secondary: rgba(235, 240, 238, 0.62);
    --label-tertiary: rgba(235, 240, 238, 0.30);
    --separator: rgba(235, 240, 238, 0.16);

    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.20);
    --red: #ff5b52;
    --green: #46c07f;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 12px 26px rgba(0, 0, 0, 0.6), 0 34px 64px rgba(0, 0, 0, 0.5);
    --shadow-panel: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body.page--table {
  background: var(--bg-sunken);
  overflow: hidden;
}

h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }

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

a:hover { text-decoration: underline; }

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

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

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  margin: 0 0 8px 4px;
}

.card-surface {
  background: var(--bg-elevated);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
