/* tokens.css: every colour, size, shadow and layer the app uses. Nothing else in the CSS may hold a colour literal.
   Two families: core (--bg, --ink, ...) and board (--bd-*). Dark mode is written here and only here. */
:root {
  /* Colour: core (screens, forms, lists) */
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #000000;
  --text: #1a1a1a;
  --muted: #666a72;
  --line: #d3d6db;
  --field: #e8eaee;
  --field-line: #b4b9c2;
  --flag-bg: #fbf8bc;
  --flag-line: #c4a600;
  --flag-ink: #5a4500;
  --flag-text: #111111;                        /* text in a flagged field */
  --ok: #2c5e4a;
  --wait: #b07b00;
  --err: #9b1c1c;
  --fresh: #e3f0e9;
  --seg-track: #f0f1f3;
  --hover: #f4f5f7;
  --soft-line: #e3e5e8;
  --hl-bg: #dfe5ec;                            /* search highlight */
  --hl-ink: #000000;

  /* Colour: windows, sheets and the contact board */
  --bd-ink: #0a0a0a;                           /* strong text, selected fills, rules under headings */
  --bd-on-ink: #ffffff;                        /* text on a --bd-ink fill */
  --bd-text: #1a1a1a;                          /* body text */
  --bd-muted: #666a72;                         /* secondary text */
  --bd-line: #e3e5e8;                          /* light row rule */
  --bd-line2: #d3d6db;                         /* control border */
  --bd-paper: #ffffff;                         /* windows, menus, inputs, buttons, selected segments */
  --bd-rail: #f4f5f7;                          /* grey side rail */
  --bd-seg: #f0f1f3;                           /* segment track, hover fill */
  --bd-navy: #1b2f4b;                          /* "in progress" dots and bars, links */
  --bd-orig-on-dark: #86aee6;                  /* the Origination chip on the black phone bar (boards 140 to 143) */
  --bd-green: #2f6b4f;                         /* good, text and borders */
  --bd-burg: #8a2b2b;                          /* late or destructive, text and borders */
  --bd-green-fill: #2f6b4f;                    /* the same colours as fills carrying white text (never change) */
  --bd-burg-fill: #8a2b2b;
  --bd-hero-muted: #b9bcc3;                    /* text on the black band */
  --bd-hero-line: #3a3d44;                     /* rules on the black band */
  --bd-shadow: rgba(0,0,0,.16);
  --bd-live: #7fd1a6;                          /* status dot: synced */
  --bd-warn: #ea580c;                          /* status dot: waiting */
  --bd-todo: #9a4f00;                          /* origination: a value or an approval still waiting on you (4.5:1 on white) */
  --bd-bad: #d1242f;                           /* errors, offline */
  --bd-bar-bg: #0a0a0a;                        /* the black bar (menu row) */
  --bd-err-bg: #faf3f3;                        /* error message fill */
  --ext-pdf: #8a2b2b;                          /* file type: pdf */
  --ext-doc: #1b2f4b;                          /* file type: word */
  --ext-xls: #2f6b4f;                          /* file type: excel */
  --ext-ppt: #8a5a2b;                          /* file type: powerpoint */

  /* Colour: profile accent */
  --pf-accent: #1b2f4b;                        /* profile accent */
  --pf-on-accent: #ffffff;
  --pf-yes: #2f6b4f;
  --pf-no: #8a2b2b;
  --pf-soft: #f0f1f3;

  /* Colour: fixed (the same in light and dark) */
  --navy: #0a0a0a;                             /* hero bands, pinned bar, phone menu panel */
  --navy-line: #3a3d44;                        /* thin rules and borders on navy */
  --white: #ffffff;                            /* pure white (does not change in dark mode) */
  --env-fill: #b45309;                         /* the Test / Demo tag in the top bar (white text, 5:1; does not change in dark mode) */
  --black: #000000;                            /* pure black (does not change in dark mode) */
  --gray-100: #e6e8ec;                         /* light rule / text on black */
  --gray-200: #b9bcc3;                         /* muted text on black bands */
  --gray-300: #a9adb6;                         /* secondary text on black */
  --gray-700: #3a3d44;                         /* borders and fills on black */
  --tick: #1e7a3c;                             /* green tick on resolved feedback */
  --fb-done-text: #e0e0e0;                     /* resolved feedback text. Very pale on purpose, as requested */
  --chip-off: #777777;                         /* switched-off chip dot */
  --scan-ok: #8fd1ac;                          /* scanner frame: card recognised */
  --scan-hold: #e8d36a;                        /* scanner frame: holding */
  --scan-guide: rgba(255,255,255,.85);         /* scanner frame: guide */
  --del: #b3261e;                              /* swipe-to-delete action */
  --shot-bg: #1a1c20;                          /* photo well */
  --thumb-bg: #e9e6df;                         /* photo thumbnail while loading */
  --on-dark-text: #c9ccd2;                     /* secondary text on dark panels */
  --on-dark-sub: #e2e4e8;                      /* sub-title on the camera */
  --on-photo: rgba(255,255,255,.92);           /* badge and buttons on a photo */
  --glass-line: rgba(255,255,255,.55);         /* hint on the camera */
  --glass-bg: rgba(0,0,0,.55);                 /* hint on the camera */
  --live-tint: rgba(127,209,166,.12);          /* live deal chip */
  --row-tint: rgba(127,127,127,.07);           /* row hover */
  --tok-bg: rgba(253,224,71,.14);              /* tappable text on a photo */
  --tok-line: rgba(253,224,71,.35);
  --tok-hover: rgba(253,224,71,.45);
  --tok-on: rgba(255,210,74,.55);
  --tok-on-line: #ffd24a;
  --ramp-1: #3d5878;                           /* blue ramp for charts, darkest */
  --ramp-2: #6f89a6;
  --ramp-3: #8fa3b9;
  --ramp-4: #a7b7c8;
  --ramp-5: #bcc8d4;
  --ramp-7: #d9dde3;
  --ramp-8: #e6e9ed;                           /* lightest */

  /* Overlays and shadows */
  --scrim: rgba(0,0,0,.6);                     /* dark overlay behind pop-ups */
  --sh-scrim: rgba(10, 10, 10, .32);
  --scrim-nav: rgba(0,0,0,.5);                 /* phone side menu */
  --win-outline: none;                         /* window outline: none in light, a hairline in dark */
  --sh-shadow: 0 1px 2px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.18), 0 40px 100px rgba(0,0,0,.18);
  --menu-shadow: 0 1px 2px rgba(0,0,0,.08), 0 12px 32px rgba(0,0,0,.16), 0 32px 80px rgba(0,0,0,.14);
  --shadow-seg: 0 1px 3px rgba(0,0,0,.12);     /* selected segment */
  --shadow-pop: 0 8px 20px rgba(0,0,0,.14);    /* autocomplete list */
  --shadow-acct: 0 10px 30px rgba(0,0,0,.14);  /* account pop-over */
  --shadow-kmenu: 0 8px 24px rgba(0,0,0,.28);  /* row menu */
  --shadow-sheet-up: 0 -8px 40px rgba(0,0,0,.22); /* phone bottom sheet */
  --shadow-photo: 0 8px 26px rgba(0,0,0,.25);  /* photo on the stage */
  --shadow-fab: 0 2px 10px rgba(0,0,0,.25);    /* Feedback button */
  --shadow-panel: 0 1px 2px rgba(10,10,10,.08), 0 16px 40px rgba(10,10,10,.22);   /* Feedback panel floating over the page */
  --shadow-si: 0 1px 2px rgba(0,0,0,.1), 0 24px 60px rgba(0,0,0,.35); /* sign-in card */
  --shadow-si-wide: 0 1px 2px rgba(0,0,0,.1), 0 24px 60px rgba(0,0,0,.35), 0 60px 140px rgba(0,0,0,.35); /* sign-in card, desktop */
  --shadow-si-phone: 0 1px 2px rgba(0,0,0,.1), 0 18px 44px rgba(0,0,0,.35), 0 40px 100px rgba(0,0,0,.3); /* sign-in card, phone */
  --shade-si: linear-gradient(180deg, rgba(2,6,18,.45) 0%, rgba(2,6,18,.18) 18%, rgba(2,6,18,0) 34%); /* sign-in photo */
  --fade-top: linear-gradient(var(--black) 0%, rgba(0,0,0,.78) 50%, rgba(0,0,0,0)); /* camera top bar */
  --fade-bot: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.8) 38%, var(--black)); /* camera bottom bar */

  /* Type */
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Orpheus Pro", Georgia, "Times New Roman", serif;
  --t-cap: 12px;                               /* labels in caps, tags */
  --t-meta: 13px;                              /* dates, secondary lines, counts */
  --t-body: 15px;                              /* body text, inputs, list secondary */
  --t-row: 16px;                               /* list row titles (500) */
  --t-h3: 20px;                                /* sheet titles, card titles (serif) */
  --t-h2: 26px;                                /* section titles (serif) */
  --t-h1: 34px;                                /* page title (serif) */
  --t-kpi: 30px;                               /* spacing: 4-based */

  /* Space and sizes */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --field-h: 38px;
  --row-pad: 12px;
  --bd-bar: 56px;
  --page-margin: clamp(var(--s6), calc((100vw - 1160px) / 2 + var(--s6)), 175px);

  /* Stacking order, lowest to highest */
  --z-sticky: 60;          /* pinned bar, Feedback button, camera flash */
  --z-fab: 70;             /* round Quick actions button (phone) */
  --z-window: 80;          /* capture and edit windows */
  --z-modal: 90;           /* card review overlay */
  --z-menu: 190;           /* phone side menu */
  --z-sheet: 200;          /* account sheet and its scrims */
  --z-sheet-confirm: 210;  /* confirm above a sheet */
  --z-toast: 220;          /* messages above everything */

  /* Motion and icons */
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ico-cal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8e96' stroke-width='2' stroke-linecap='square'%3E%3Crect x='3' y='5' width='18' height='16'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --ico-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8e96' stroke-width='2' stroke-linecap='square'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

@media (min-width: 1025px) { :root { --pm: clamp(64px, calc((100vw - 1152px) / 2), 200px); } }
@media (max-width: 1024px) { :root { --pm: 32px; } }
@media (max-width: 640px) {
  :root { --pm: 20px; --bd-bar: 98px; --bd-row: 80px; --t-body: 14px; --t-row: 15px; --t-h3: 19px; --t-h2: 18px; --t-h1: 26px; --t-kpi: 24px; --s5: 20px; --s6: 24px; --s7: 32px; --row-pad: 10px; }
}

/* Panels that always show light-on-black or their own palette */
.on-dark { --ink: #ffffff; --bg: #000000; --text: #ffffff; --muted: #b9bcc3; --line: #34363b; --ok: #7fd0a8; --wait: #e2b34a; --err: #ff9a9a; }
.dd-menu { --bg: #ffffff; --ink: #000000; --text: #1a1a1a; --muted: #6b6f77; --line: #d3d6db; --hover: #f4f5f7; --soft-line: #e3e5e8; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #0c0c0e;
    --ink: #ffffff;
    --text: #ececec;
    --muted: #a2a6af;
    --line: #2b2e34;
    --field: #1b1e23;
    --field-line: #4a4f58;
    --flag-bg: #3a3510;
    --flag-line: #b89c1c;
    --flag-ink: #f3e7a0;
    --ok: #7fd0a8;
    --wait: #e2b34a;
    --err: #ff8a8a;
    --fresh: #12301f;
    --bd-ink: #f4f5f7;
    --bd-on-ink: #0a0a0a;
    --bd-text: #ececec;
    --bd-muted: #a9adb6;
    --bd-line: #2b2e34;
    --bd-line2: #555a64;
    --bd-paper: #0c0c0e;
    --bd-rail: #121418;
    --bd-seg: #1b1e23;
    --bd-navy: #86aee6;
    --bd-green: #7fd0a8;
    --bd-burg: #ff9c9c;
    --bd-shadow: rgba(0,0,0,.6);
    --bd-bad: #ff8a8a;
    --bd-todo: #f0a868;
    --bd-bar-bg: #14161a;
    --bd-err-bg: #2a1416;
    --seg-track: #1b1e23;
    --hover: #15171b;
    --soft-line: #2b2e34;
    --sh-scrim: rgba(0,0,0,.55);
    --hl-bg: #2b3a4d;
    --hl-ink: #ffffff;
    --flag-text: #f6efc0;
    --ext-pdf: var(--text);
    --ext-doc: var(--text);
    --ext-xls: var(--text);
    --ext-ppt: var(--text);
    --pf-accent: #a9c1de;
    --pf-on-accent: #000000;
    --pf-yes: #7fd0a8;
    --pf-no: #f19a9a;
    --pf-soft: #17191c;
    --win-outline: 1px solid var(--bd-line2);
  }
  .dd-menu { --bg: #0c0c0e; --ink: #ffffff; --text: #ececec; --muted: #a2a6af; --line: #2b2e34; --hover: #15171b; --soft-line: #2b2e34; }
}
