/* TradeTally shared foundations: fonts, colour tokens, controls.
   Palette: site-board neutrals, black for actions, tape-measure yellow as the single brand colour. */

@font-face { font-family: "Archivo"; src: url("/fonts/archivo-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/plex-600.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #F3F3F1;
  --surface: #FFFFFF;
  --surface-2: #F8F8F6;
  --ink: #16181B;
  --ink-2: #464B52;
  --ink-3: #6E737A;
  --line: #D9DAD6;
  --line-2: #E9E9E6;
  --brand: #FFC20E;
  --brand-ink: #16181B;
  --brand-soft: #FFF4CC;
  --primary: #16181B;
  --primary-ink: #FFFFFF;
  --primary-hover: #30343A;
  --green: #1D7A4B;
  --green-soft: #E2F1E8;
  --amber: #8A5A00;
  --amber-soft: #FBEFD2;
  --red: #B3261E;
  --red-soft: #F8E2E0;
  --blue: #2B5BA8;
  --blue-soft: #E4ECF8;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 0 rgba(22, 24, 27, .04), 0 2px 8px rgba(22, 24, 27, .06);
  --shadow-lg: 0 12px 32px rgba(22, 24, 27, .16);
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --logo-ink: #1B2F49;
  --logo-ruler: #6C7B89;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #1A1D20; --surface-2: #202327; --ink: #ECEDEE; --ink-2: #B9BDC2; --ink-3: #8A8F95;
    --line: #2E3236; --line-2: #25292D; --brand-soft: #3A3112; --primary: #ECEDEE; --primary-ink: #111315; --primary-hover: #FFFFFF;
    --green: #5BC48E; --green-soft: #173325; --amber: #E8B24D; --amber-soft: #3A2E14; --red: #F07A70; --red-soft: #3D1C1A;
    --blue: #8DB0EC; --blue-soft: #1C2A40; --shadow: 0 1px 0 rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    --logo-ink: #ECE9E2; --logo-ruler: #9DA9B8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #1A1D20; --surface-2: #202327; --ink: #ECEDEE; --ink-2: #B9BDC2; --ink-3: #8A8F95;
  --line: #2E3236; --line-2: #25292D; --brand-soft: #3A3112; --primary: #ECEDEE; --primary-ink: #111315; --primary-hover: #FFFFFF;
  --green: #5BC48E; --green-soft: #173325; --amber: #E8B24D; --amber-soft: #3A2E14; --red: #F07A70; --red-soft: #3D1C1A;
  --blue: #8DB0EC; --blue-soft: #1C2A40; --shadow: 0 1px 0 rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --logo-ink: #ECE9E2; --logo-ruler: #9DA9B8;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: var(--radius); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* Logo: the TradeTally ruler-and-arrow mark (sprite in /img/logo.svg), coloured by --logo-ink / --logo-ruler */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.logo__mark { width: 34px; height: 34px; flex: none; stroke: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .92rem; line-height: 1.2; text-decoration: none; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn--brand:hover { background: #F2B500; border-color: #F2B500; }
.btn--ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn--danger { color: var(--red); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn--sm { padding: 6px 10px; font-size: .82rem; }
.btn--lg { padding: 13px 22px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

/* Form fields */
.field { display: grid; gap: 5px; align-content: start; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--ink-3); }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: .95rem; font-weight: 400;
}
.field textarea { min-height: 80px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input:disabled, .field select:disabled, .input:disabled { background: var(--surface-2); color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.check small { display: block; font-weight: 400; color: var(--ink-3); }

/* Status tags: square-ish, not pills */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 4px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.tag--green { background: var(--green-soft); color: var(--green); }
.tag--amber { background: var(--amber-soft); color: var(--amber); }
.tag--red { background: var(--red-soft); color: var(--red); }
.tag--blue { background: var(--blue-soft); color: var(--blue); }
.tag--brand { background: var(--brand); color: var(--brand-ink); }

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