/* aggr design tokens: every page of the panel and the website uses only these.
   Colors: Flexoki defaults here (the panel uses Radix Slate + Iris: palettes.css / accents.css). Fonts: Source Sans 3
   (words) and Source Code Pro (every number), OFL; other pairs for comparison: fonts.css (tools/make_fonts.py).
   Theme: follows the system; [data-theme] on <html> overrides it. */


@font-face { font-family: "Source Sans 3"; src: url(fonts/source-sans-3-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url(fonts/source-sans-3-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url(fonts/source-sans-3-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url(fonts/source-code-pro-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url(fonts/source-code-pro-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Source Code Pro"; src: url(fonts/source-code-pro-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  /* type */
  --sans: "Source Sans 3", system-ui, sans-serif;
  --mono: "Source Code Pro", ui-monospace, monospace;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-28: 28px; --fs-40: 40px;
  --lh-tight: 1.2; --lh-ui: 1.4; --lh-prose: 1.65;

  /* space: a 4 px grid */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px;
  --row: 22px;              /* one line of a board row */
  --radius: 2px;            /* inputs only; everything else is square */
  --prose: 720px;           /* website text column */
  --page: 1120px;           /* the sites' width: top bar, footer, front page, docs */
  --content: 1280px;        /* panel content cap */

  /* motion */
  --fast: 150ms ease-out;
  --flash: 1.2s;

  /* color (light) */
  --bg: #FFFCF0;            /* paper */
  --bg-2: #F2F0E5;          /* 50: table heads, hover, drawer */
  --line: #E6E4D9;          /* 100: hairlines */
  --line-strong: #CECDC3;   /* 200: inputs, active dividers */
  --muted: #878580;         /* 500 */
  --text-2: #575653;        /* 700: secondary text that must stay readable */
  --text: #100F0F;          /* black */
  --blue: #205EA6;          /* links, selection, focus */
  --green: #66800B;         /* price up */
  --red: #AF3029;           /* price down */
  --orange: #BC5215;        /* in-play */
  --yellow: #AD8301;        /* delayed, warnings */
  --green-tint: color-mix(in srgb, var(--green) 16%, var(--bg));   /* flash backgrounds, from the palette */
  --red-tint: color-mix(in srgb, var(--red) 16%, var(--bg));
  --yellow-tint: color-mix(in srgb, var(--yellow) 16%, var(--bg));
  --shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(16, 15, 15, .10);   /* the drawer only */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100F0F; --bg-2: #1C1B1A; --line: #282726; --line-strong: #403E3C;
    --muted: #878580; --text-2: #B7B5AC; --text: #CECDC3;
    --blue: #4385BE; --green: #879A39; --red: #D14D41; --orange: #DA702C; --yellow: #D0A215;
    --shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #100F0F; --bg-2: #1C1B1A; --line: #282726; --line-strong: #403E3C;
  --muted: #878580; --text-2: #B7B5AC; --text: #CECDC3;
  --blue: #4385BE; --green: #879A39; --red: #D14D41; --orange: #DA702C; --yellow: #D0A215;
  --shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 var(--fs-13)/var(--lh-ui) var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 1px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.i { width: 16px; height: 16px; stroke-width: 1.5; fill: none; flex: none; vertical-align: -3px; }
.i-14 { width: 14px; height: 14px; }

/* controls: their look comes from the --ctl-* variables; the presets in styles.css (data-ui on <html>) change them */
:root {
  --ctl-h: 28px; --ctl-radius: 6px; --ctl-bg: var(--bg); --ctl-border: var(--line-strong);
  --ctl-border-hover: var(--muted); --ctl-shadow: none; --ctl-hover-bg: var(--ctl-bg);
}
.input, .select, .btn, .who { height: var(--ctl-h); background-color: var(--ctl-bg); border: 1px solid var(--ctl-border);
  border-radius: var(--ctl-radius); box-shadow: var(--ctl-shadow);
  transition: border-color var(--fast), background-color var(--fast), box-shadow var(--fast); }
.input { padding: 3px 8px; }
.input:hover, .select:hover, .btn:hover, .who:hover { border-color: var(--ctl-border-hover); background-color: var(--ctl-hover-bg); }
.select { appearance: none; padding: 3px 26px 3px 10px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%; background-size: 4px 4px; background-repeat: no-repeat; }
.select option { background: var(--bg); color: var(--text); }
.check { display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; user-select: none; color: var(--text-2); }
.check input { appearance: none; margin: 0; width: 14px; height: 14px; border: 1px solid var(--ctl-border);
  border-radius: min(var(--ctl-radius), 4px); background: var(--ctl-bg); display: inline-grid; place-content: center; cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast); }
.check input:hover { border-color: var(--text); }
.check input::after { content: ""; width: 7px; height: 4px; margin-top: -2px; border-left: 1.5px solid var(--bg);
  border-bottom: 1.5px solid var(--bg); transform: rotate(-45deg); opacity: 0; }
.check input:checked { background: var(--text); border-color: var(--text); }
.check input:checked::after { opacity: 1; }
.check:has(input:checked) { color: var(--text); }
.btn { padding: 4px 12px; cursor: pointer; }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--text); opacity: .88; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--ctl-h); height: var(--ctl-h); border: 0;
  background: none; color: var(--muted); cursor: pointer; border-radius: var(--ctl-radius); transition: color var(--fast), background-color var(--fast); }
.icon-btn:hover { color: var(--text); background: var(--bg-2); }

/* price movement */
.up { color: var(--green); } .down { color: var(--red); }
.tri { display: inline-block; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }
.tri.up { border-bottom: 5px solid var(--green); } .tri.down { border-top: 5px solid var(--red); }

/* dialogs (dialog.js): confirm / prompt in the design's style */
.dlg { border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); padding: var(--s6); width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(16, 15, 15, .45); }
.dlg h3 { margin: 0 0 var(--s3); font-size: var(--fs-16); font-weight: 600; }
.dlg p { margin: 0 0 var(--s4); color: var(--text-2); font-size: var(--fs-14); line-height: 1.5; }
.dlg .input { width: 100%; margin: 0 0 var(--s4); }
.dlg .acts { display: flex; gap: var(--s2); justify-content: flex-end; }
.dlg .btn { display: inline-flex; align-items: center; font-size: var(--fs-14); }
.btn.primary.danger { background: var(--red); border-color: var(--red); color: #fff; }
