/* TablePop dashboard: design tokens and base elements.
 *
 * Load order (base.html): styles.css (this file) -> components.css -> forms.css ->
 * shell.css -> screens.css, plus workspace.css on a page's workspace. Components are
 * documented in static/README.md. Colours are only ever read through the custom
 * properties below, so a theme is one block of overrides.
 *
 * Themes: light is the default. `html[data-theme="dark"]` forces dark and
 * `html[data-theme="light"]` forces light (set by theme.js from localStorage before
 * first paint); with no attribute the OS decides through prefers-color-scheme.
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas,
    monospace;

  /* neutrals */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --sidebar: #fbfbfc;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  /* form control outlines: >= 3:1 against surface and bg (WCAG 1.4.11) */
  --border-input: #858f9f;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --overlay: rgba(16, 24, 40, 0.45);

  /* brand */
  --primary: #3772a3;
  --primary-hover: #2d5e86;
  --primary-text: #ffffff;
  --primary-soft: #eef4fa;
  --primary-soft-text: #2d5e86;
  --link: #2d6a9c;
  --highlight: #ffdc03;
  --highlight-text: #3d3300;

  /* status: text / background / border */
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --ok-border: #abefc6;
  --ok-dot: #17b26a;
  --warn: #93370d;
  --warn-bg: #fffaeb;
  --warn-border: #fedf89;
  --warn-dot: #f79009;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;
  --danger-dot: #f04438;
  --danger-solid: #d92d20;
  --danger-solid-hover: #b42318;
  --neutral: #475467;
  --neutral-bg: #f2f4f7;
  --neutral-border: #e4e7ec;
  --neutral-dot: #98a2b3;

  /* charts */
  --chart-1: #3772a3;
  --chart-2: #dc6803; /* blue/orange: apart by hue for colour-blind readers, >= 3:1 */
  --chart-grid: #eaecf0;

  /* shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --ring: 0 0 0 3px rgba(55, 114, 163, 0.3);
  --ring-danger: 0 0 0 3px rgba(217, 45, 32, 0.24);

  /* layout */
  --sidebar-width: 244px;
  --topbar-height: 56px;
  --content-width: 1120px;
}

/* Dark tokens, twice: once forced, once for "system" on a dark OS. Keep them equal. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --surface: #15181d;
  --surface-2: #1a1d23;
  --surface-3: #22262d;
  --sidebar: #111318;
  --border: #262a31;
  --border-strong: #353b45;
  --border-input: #6b7280;
  --text: #edf0f3;
  --text-2: #b3bac5;
  --text-3: #8d96a3;
  --overlay: rgba(0, 0, 0, 0.6);
  --primary: #3772a3;
  --primary-hover: #4382b8;
  --primary-soft: #182635;
  --primary-soft-text: #9cc2e2;
  --link: #79aad2;
  --ok: #75e0a7;
  --ok-bg: #0f2a1d;
  --ok-border: #1d4d33;
  --warn: #fec84b;
  --warn-bg: #2b2111;
  --warn-border: #574216;
  --danger: #fda29b;
  --danger-bg: #2d1515;
  --danger-border: #5c2621;
  --neutral: #b3bac5;
  --neutral-bg: #22262d;
  --neutral-border: #353b45;
  --neutral-dot: #667085;
  --chart-1: #79aad2;
  --chart-2: #fdb022;
  --chart-grid: #232830;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, 0.6), 0 4px 8px -2px rgba(0, 0, 0, 0.4);
  --ring: 0 0 0 3px rgba(121, 170, 210, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0e12;
    --surface: #15181d;
    --surface-2: #1a1d23;
    --surface-3: #22262d;
    --sidebar: #111318;
    --border: #262a31;
    --border-strong: #353b45;
    --border-input: #6b7280;
  --border-input: #6b7280;
    --text: #edf0f3;
    --text-2: #b3bac5;
    --text-3: #8d96a3;
    --overlay: rgba(0, 0, 0, 0.6);
    --primary: #3772a3;
    --primary-hover: #4382b8;
    --primary-soft: #182635;
    --primary-soft-text: #9cc2e2;
    --link: #79aad2;
    --ok: #75e0a7;
    --ok-bg: #0f2a1d;
    --ok-border: #1d4d33;
    --warn: #fec84b;
    --warn-bg: #2b2111;
    --warn-border: #574216;
    --danger: #fda29b;
    --danger-bg: #2d1515;
    --danger-border: #5c2621;
    --neutral: #b3bac5;
    --neutral-bg: #22262d;
    --neutral-border: #353b45;
    --neutral-dot: #667085;
    --chart-1: #79aad2;
    --chart-2: #fdb022;
    --chart-grid: #232830;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, 0.6), 0 4px 8px -2px rgba(0, 0, 0, 0.4);
    --ring: 0 0 0 3px rgba(121, 170, 210, 0.4);
  }
}

/* --- base ------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
fieldset {
  margin: 0;
}

fieldset {
  padding: 0;
  border: 0;
  min-width: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.011em;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

strong {
  font-weight: 600;
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

code,
kbd,
samp,
pre {
  font-family: var(--mono);
  font-size: 0.92em;
}

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

::selection {
  background: rgba(55, 114, 163, 0.22);
}

[hidden] {
  display: none !important;
}

/* Rendered for everyone, shown only once theme.js has put `js` on <html>. */
html:not(.js) .js-only {
  display: none !important;
}

html.js .no-js-only {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 500;
  transform: translateY(-200%);
}

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

.num,
.tabular {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-3);
}

.text-2 {
  color: var(--text-2);
}

.mono {
  font-family: var(--mono);
  font-size: 13px;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.spacer {
  flex: 1;
}

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

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

@media (max-width: 900px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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