/* iCore | Field Service — design tokens (UI365 Phase 1 — Dynamics 365 Field Service look; spec: DESIGN/UI365_SPEC.md).
   Loaded BEFORE styles.css. This is the only file that may contain raw colour values.
   Dark mode: follows the OS (prefers-color-scheme) unless the user picked a theme in
   Settings > Display, which sets <html data-theme="light|dark"> (see core.js setTheme). */
:root{
  color-scheme:light;

  /* brand / surfaces (measured from reference: header #021838, sidebar #f0f0f0, gutter #f6f6f6, canvas #fff) */
  --hdr:#021838;          /* top header bar */
  --on-hdr:#ffffff;       /* text/icons on --hdr */
  --on-hdr-mut:#c5cfe0;   /* secondary text on --hdr */
  --acc:#26396b;          /* primary button, links, active bar, selected (brand Navy; D365 blue #0f6cbd intentionally not used) */
  --acc-hover:#1d2c55;
  --acc-press:#16224a;
  --on-acc:#ffffff;       /* text on --acc */
  --accsel:#e9edf5;       /* selected row / hero banner / soft fill */
  --bg:#f6f6f6;           /* page gutter behind the canvas card */
  --bg-canvas:#fafafa;    /* inner page area */
  --side:#f0f0f0;         /* sitemap sidebar */
  --card:#ffffff;         /* canvas cards, inputs, sheets */
  --card-alt:#fafafa;     /* striped / subtle surfaces */
  --hover:#f5f5f5;        /* row / item hover */
  /* Enterprise Hairline (Navy-tinted neutral, 1px): Border / Divider / Soft Border */
  --line:#d5dce8;         /* card, panel, input, section border */
  --line-soft:#e5eaf2;    /* row / column / section divider */
  --line-strong:#7d8ba4;  /* control borders, toggle-off track: >=3:1 on --card and --card-alt (WCAG 1.4.11) */
  --hair:1px;             /* standard border width */
  --ink:#242424;
  --mut:#616161;
  --scrim:rgba(0,0,0,.4);
  --gantt-today:#eef5fc;  /* Schedule Board today column */

  /* status (single set, used by badges, dots, chips, bars) */
  --ok:#107c10;   --ok-bg:#dff6dd;
  --warn:#bc4b09; --warn-bg:#fdf3e8;
  --bad:#b10e1c;  --bad-bg:#fdf3f4;
  --info:#0f6cbd; --info-bg:#e7efff;
  --neutral:#616161; --neutral-bg:#f0f0f0;
  --info-ink:#0f548c;   /* text-safe variants (>=4.5:1 on white and on their tint) */
  --warn-ink:#8a3707;
  --pill-wait:#f9dcd1; --pill-wait-ink:#7a2b0d;   /* e.g. "Waiting for details" */
  --chat-acc:var(--acc); --chat-me:var(--accsel); --chat-other:#f5f5f5; --chat-sel:var(--accsel);   /* chat (chatpop.js, #/chat): brand Navy accent, same as primary buttons */

  /* role colours (role badges) */
  --role-admin:#6b4fbb; --role-engineer:#1f6fb2; --role-suptech:#a35f00;
  --role-technician:#2b7a4b; --role-viewer:#6b7480; --on-role:#ffffff;

  /* typography (Segoe UI is a system font: never embedded) */
  --font:"Segoe UI","Source Sans 3","Noto Sans Thai",Sarabun,system-ui,-apple-system,Roboto,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,monospace;
  --fs-xs:10px; --fs-sm:12px; --fs-md:14px; --fs-lg:16px; --fs-xl:20px;
  --fw-normal:400; --fw-medium:600; --fw-bold:700;
  --lh:1.45;

  /* spacing scale */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px;

  /* radius: Square Enterprise (v1.6.3) — 90 degree corners everywhere. Every border-radius must be var(--radius); the old --r* names are aliases kept so existing CSS goes square. */
  --radius:0;
  --r:var(--radius); --r-md:var(--radius); --r-lg:var(--radius); --r-pill:var(--radius);
  /* page gutter: horizontal rules inset from the edges by this much; content is full width otherwise */
  --gutter:24px;

  /* elevation (Fluent) */
  --shadow-1:0 0 1px rgba(2,24,56,.06),0 1px 1px rgba(2,24,56,.05);
  --shadow-2:0 0 2px rgba(0,0,0,.12),0 4px 8px rgba(0,0,0,.14);
  --shadow-3:0 0 8px rgba(0,0,0,.12),0 14px 28px rgba(0,0,0,.20);

  /* focus ring */
  --focus:#26396b; --focus-ring:0 0 0 2px #26396b; --focus-line:inset 0 -2px 0 #26396b;   /* 2px square ring, no offset */

  /* control sizing (v1.17.0): THREE standard button sizes, system-wide. Do not set another height on a button.
     --btn-h-lg 35px = LARGE : page footer buttons, Home menu, pop-up sheet action rows, command bar, Login/Register, Search + Filter bar, header icons
     --btn-h    30px = MEDIUM: every button inside the page content frame (in-card / in-list buttons, Import, Export, Apply, Open report, PDF, Accept Job, segmented tabs, status pills ...)
     --btn-h-sm 22px = SMALL : mini chips / count chips / tags (.mini, .sg-c). The switch is 15px high (--sw-h) with a 44px tap area. Fields / Search / Login inputs = --fld-in 30px.
     Tap area is extended to >=44px with a transparent ::after, the visible control does not grow. */
  --btn-h-lg:35px; --btn-h:30px; --btn-h-sm:22px;   /* v1.18.1: was 30 / 25 / 15 */
  --btn-fs-lg:14px; --btn-fs:13px; --btn-fs-sm:11px; --tap:44px;
  /* legacy alias: primary buttons = LARGE */
  --btn-h-pri:var(--btn-h-lg);
  /* v1.17.1: data-entry fields (input, select, date/time) inside the page frame = MEDIUM 25px, same as the medium button (--btn-h).
     --fld-in-lg 30px is kept only for the chat message box + Send in the footer (same row as LARGE footer buttons). */
  --lbl-fs:12px; --lbl-lh:1.3; --lbl-c:var(--mut); --lbl-ml:2px; --lbl-gap:2px;
  --fld-in:30px; --fld-in-lg:var(--fld-in); --fld-fs:14px; --opt-h:40px;
  --mini-h:var(--btn-h-sm); --mini-fs:var(--btn-fs-sm);
  --hdr-h:48px; --cmd-h:44px; --row-h:42px; --side-w:200px; --side-rail:48px; --side-item-h:35px;

  /* data-viz / misc fixed tones */
  --splash-a:#0a2a5c; --splash-b:#021838;
  --paper:#ffffff;           /* always-white surface for signatures / drawings (stored images are ink on white) */
  --canvas-ink:#26396b;      /* signature stroke colour — same in light and dark (saved into the image) */
  --media-bg:#0b1530;        /* camera / drawing viewport backdrop */
  --select-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23242424' stroke-width='1.6'/%3E%3C/svg%3E");
  --splash-a-55:rgba(10,42,92,.55);
  --acc-faint:rgba(255,255,255,.22);  /* track on an --acc surface */
  --dot-ring:rgba(0,0,0,.27);
  --mask-on:#000;            /* opaque stop for CSS masks (alpha only, not a visible colour) */

  /* ---- legacy aliases (keep old CSS/JS working; do not use in new code) ---- */
  --navy:var(--acc); --navy2:var(--acc-hover);
  --soft:var(--accsel); --soft2:var(--bg);
  --pass:var(--ok); --fail:var(--bad); --pend:var(--info);
}

/* Dark palette. Defined once as a block and applied for OS-dark (unless forced light) and for forced dark. */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --hdr:#001029; --on-hdr:#ffffff; --on-hdr-mut:#a9b6cf;
    --acc:#9db4f2; --acc-hover:#b7c8f7; --acc-press:#8aa3e6; --on-acc:#0e1733; --accsel:#26324f;
    --bg:#141414; --bg-canvas:#1a1a1a; --side:#1f1f1f; --card:#292929; --card-alt:#2e2e2e; --hover:#333333;
    --line:#35445e; --line-soft:#293950; --line-strong:#6a7fa3;
    --ink:#f5f5f5; --mut:#adadad; --scrim:rgba(0,0,0,.62); --gantt-today:#16283f;
    --ok:#54b054;   --ok-bg:#1b3a1b;
    --warn-ink:#f1a56f; --warn:#f1a56f; --warn-bg:#3d2411;
    --bad:#e37d80;  --bad-bg:#3b1a1c;
    --info-ink:#7db8f7; --info:#7db8f7; --info-bg:#16304f;
    --neutral:#adadad; --neutral-bg:#333333;
    --pill-wait:#4a2a1c; --pill-wait-ink:#f6b79b;
  --chat-acc:var(--acc); --chat-me:var(--accsel); --chat-other:#333333; --chat-sel:var(--accsel);
    --shadow-1:0 0 1px rgba(0,0,0,.35),0 1px 1px rgba(0,0,0,.3); --shadow-2:0 0 2px rgba(0,0,0,.5),0 4px 8px rgba(0,0,0,.55); --shadow-3:0 0 8px rgba(0,0,0,.5),0 14px 28px rgba(0,0,0,.6);
    --focus:#7db8f7; --focus-ring:0 0 0 2px #7db8f7; --focus-line:inset 0 -2px 0 #7db8f7;
    --splash-a:#0a2a5c; --splash-b:#001029;
    --media-bg:#05080f; --acc-faint:rgba(4,17,31,.25); --select-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23f5f5f5' stroke-width='1.6'/%3E%3C/svg%3E"); --dot-ring:rgba(255,255,255,.35);
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --hdr:#001029; --on-hdr:#ffffff; --on-hdr-mut:#a9b6cf;
  --acc:#9db4f2; --acc-hover:#b7c8f7; --acc-press:#8aa3e6; --on-acc:#0e1733; --accsel:#26324f;
  --bg:#141414; --bg-canvas:#1a1a1a; --side:#1f1f1f; --card:#292929; --card-alt:#2e2e2e; --hover:#333333;
  --line:#35445e; --line-soft:#293950; --line-strong:#6a7fa3;
  --ink:#f5f5f5; --mut:#adadad; --scrim:rgba(0,0,0,.62); --gantt-today:#16283f;
  --ok:#54b054;   --ok-bg:#1b3a1b;
  --warn-ink:#f1a56f; --warn:#f1a56f; --warn-bg:#3d2411;
  --bad:#e37d80;  --bad-bg:#3b1a1c;
  --info-ink:#7db8f7; --info:#7db8f7; --info-bg:#16304f;
  --neutral:#adadad; --neutral-bg:#333333;
  --pill-wait:#4a2a1c; --pill-wait-ink:#f6b79b;
  --chat-acc:var(--acc); --chat-me:var(--accsel); --chat-other:#333333; --chat-sel:var(--accsel);
  --shadow-1:0 0 1px rgba(0,0,0,.35),0 1px 1px rgba(0,0,0,.3); --shadow-2:0 0 2px rgba(0,0,0,.5),0 4px 8px rgba(0,0,0,.55); --shadow-3:0 0 8px rgba(0,0,0,.5),0 14px 28px rgba(0,0,0,.6);
  --focus:#7db8f7; --focus-ring:0 0 0 2px #7db8f7; --focus-line:inset 0 -2px 0 #7db8f7;
  --splash-a:#0a2a5c; --splash-b:#001029;
  --media-bg:#05080f; --acc-faint:rgba(4,17,31,.25); --select-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23f5f5f5' stroke-width='1.6'/%3E%3C/svg%3E"); --dot-ring:rgba(255,255,255,.35);
}
:root{--brand-fs:16px}
