/* =====================================================================
   Accendo Hub — brand tokens
   The ONLY file under static/css and static/vendor allowed to hold a colour
   literal (hex, rgb()/rgba(), a named colour). Every other stylesheet in the
   Hub shell reads a var(--...) defined here. Guarded by
   StylesheetColorContractTest / StylesheetVariableContractTest.

   Load order (fragments/head.html, then layout/base.html):
     1. fonts-brand.css
     2. vendor/bootstrap 5.3.8
     3. brand/tokens.css   (this file)
     4. vendor CSS (phosphor, DataTables, EasyMDE, Dropzone — per page)
     5. css/base.css
     6. hub.css

   The public diagnostic (diagnostic/public/layout.html) is out of scope: it
   keeps loading brand/accendo.css, the marketing site's own stylesheet, and
   is not touched here. This file's brand ramp is a verbatim copy of
   accendo.css's :root tokens (accendo.css:45-78), not a shared reference —
   the two surfaces must each stand alone.
   ===================================================================== */

:root {
  /* ---- Brand ramp (verbatim copy of accendo.css's :root, :45-78) ---- */
  --indigo: #393664;
  --indigo-soft: #5D5B80;
  --navy: #15243C;
  --navy-2: #102036;
  --navy-3: #0B1726;
  --blue-deep: #2C5A82;
  --blue: #498DBE;
  --blue-bright: #6EA4CB;
  --blue-soft: #92BBD8;
  --teal: #10658C;
  --teal-deep: #005B85;
  --teal-mid: #257396;
  --sage: #85ADA3;
  --sage-soft: #B6CEC8;
  --ink: #161A22;
  --body: #4F555E;
  --muted: #878C94;
  --line: #E6E8EC;
  --line-soft: #EFF1F4;
  --paper: #F7F8FB;
  --canvas: #F2F5F9;
  --navy-tint: #E7EDF4;
  --green-tint: #E8EFF6;
  --white: #fff;

  --font-sans: "Geist","Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --font-serif: "Newsreader",Georgia,"Times New Roman",serif;
  --font-mono: "Geist Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

  --radius-btn: 12px;
  --radius-card: 16px;

  /* RGB triplets, for an rgba() that needs the brand colour at less than full opacity. Named by
     the colour they carry, not by where they are used, so one triplet serves every caller. */
  --white-rgb: 255, 255, 255;
  --black-rgb: 0, 0, 0;
  --navy-rgb: 21, 36, 60;
  --blue-rgb: 73, 141, 190;
  --blue-deep-rgb: 44, 90, 130;
  --blue-bright-rgb: 110, 164, 203;
  --blue-soft-rgb: 146, 187, 216;
  --indigo-rgb: 57, 54, 100;
  --body-rgb: 79, 85, 94;
  --focus-ring: rgba(var(--blue-rgb), 0.25);
  accent-color: var(--blue-deep); /* native checkbox, radio, progress, range, date picker */

  /* ---- Status: one red, the muted success green (status only, never a brand accent, per D2),
     one warning amber, elevation. Formerly hub.css's own :root block (:4144-4158). ---- */
  --elev-1: 0 1px 2px rgba(11, 23, 38, 0.05), 0 10px 26px -14px rgba(11, 23, 38, 0.16);
  --ok-bg: #E6F7F1;
  --ok-fg: #0D7A55;
  --ok-line: #B7E4D4;
  --warn-bg: #FFF6E5;
  --warn-fg: #9A6B00;
  --warn-line: #F0D9A0;
  --bad-bg: #FDECEC;
  --bad-fg: #A32020;
  --bad-line: #F0B8B8;
  /* --bad-fg darkened for a hover/active state (.hub-icon-btn-danger, .btn-outline-danger.hub-btn-icon-text) */
  --bad-fg-deep: color-mix(in srgb, var(--bad-fg) 85%, black);

  /* A dark-surface reading of the same two statuses, for the navy login page only (the light
     --ok-*/--bad-* tokens above read as near-invisible on that background). */
  --bad-dark-bg-rgb: 180, 60, 60;
  --bad-dark-line-rgb: 220, 120, 120;
  --bad-dark-fg: #f0c4c4;
  --login-card-bg-rgb: 11, 25, 49;

  /* Two shadow tints hub.css already carried before this file existed (not brand triplets, kept
     at their original values rather than snapped to --navy, to leave every shadow pixel-identical). */
  --shadow-deep-rgb: 14, 42, 69;
  --shadow-slate-rgb: 15, 23, 42;

  /* ---- Semáforo (opportunity temperature): formerly hub.css's .hub-body block (:35-65). A true
     thermal gradient, warm end burns red -> orange -> amber, crosses over to cool light -> deep
     blue. --sem-glaciar aliases --sem-cool rather than repeating its hex: one value, two names,
     until the badge and the chart agree to share one. ---- */
  --sem-hot: #c8452b;
  --sem-hot-tint: #fbe7e1;
  --sem-warm: #e07b39;
  --sem-warm-tint: #fbeede;
  --sem-cool: #6f6bb0;
  --sem-frozen: #2c6a95;
  --sem-frozen-tint: #dbe7f0;
  --sem-caliente: #d99a2b;
  --sem-caliente-tint: #faf1d8;
  --sem-fria: #4f9fcb;
  --sem-fria-tint: #e4f0f8;
  --sem-glaciar: var(--sem-cool);
  --sem-glaciar-tint: #edecf8;

  /* ---- Hub one-offs the brand ramp has no name for (formerly literals inside hub.css) ---- */
  --schedule-gold: #C9A23A;      /* gantt snap guide, "changed by the consultant" dot */
  --schedule-chip-line: #C9D3DF; /* schedule phase chip's dashed border */
  --schedule-mute: #B3BAC4;      /* schedule drag grip / row delete icon */
  --schedule-mute-soft: #A9B6C8; /* schedule tooltip secondary text */

  /* ---- Type scale: hub.css's own --hub-fs-* tokens (.hub-body, CRM density) are Hub's one type
     scale; this file does not duplicate it under a second name. ---- */

  /* ---- Spacing scale, for new work; hub.css's own ~55 ad hoc values are a Phase 4 sweep. ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  /* ---- z-index scale. Column-filter popover and the schedule duration tooltip used to sit at
     1080, above Bootstrap's own modal (1055): an open filter or tooltip floated over a dialog it
     was not part of. Both now read --z-dropdown. ---- */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-rail: 1030;
  --z-offcanvas: 1040;
  --z-modal: 1055;
  --z-popover: 1070;

  /* ---- Bootstrap variable remap. Reaches every component whose CSS custom property Bootstrap
     itself reads (buttons, dropdowns, pagination, alerts, links…). Components that compile a
     hex straight into the rule, ignoring the variable entirely, need the component block below. ---- */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--body);
  --bs-body-color-rgb: var(--body-rgb);
  --bs-primary: var(--blue-deep);
  --bs-primary-rgb: var(--blue-deep-rgb);
  --bs-primary-text-emphasis: var(--navy);
  --bs-primary-bg-subtle: var(--navy-tint);
  --bs-primary-border-subtle: var(--blue-soft);
  --bs-link-color: var(--blue-deep);
  --bs-link-color-rgb: var(--blue-deep-rgb);
  --bs-link-hover-color: var(--navy);
  --bs-link-hover-color-rgb: var(--navy-rgb);
  --bs-focus-ring-color: var(--focus-ring);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-card);
  --bs-info: var(--blue-deep);
  --bs-info-rgb: var(--blue-deep-rgb);
  --bs-info-bg-subtle: var(--navy-tint);
  --bs-info-text-emphasis: var(--navy);
  --bs-info-border-subtle: var(--blue-soft);
  --bs-success: var(--ok-fg);
  --bs-success-bg-subtle: var(--ok-bg);
  --bs-success-text-emphasis: var(--ok-fg);
  --bs-success-border-subtle: var(--ok-line);
  --bs-warning: var(--warn-fg);
  --bs-warning-bg-subtle: var(--warn-bg);
  --bs-warning-text-emphasis: var(--warn-fg);
  --bs-warning-border-subtle: var(--warn-line);
  --bs-danger: var(--bad-fg);
  --bs-danger-bg-subtle: var(--bad-bg);
  --bs-danger-text-emphasis: var(--bad-fg);
  --bs-danger-border-subtle: var(--bad-line);
  --dt-row-selected: var(--blue-deep-rgb);
}

/* =====================================================================
   Component block: Bootstrap 5.3 compiles these straight into the rule, so
   no :root variable reaches them. One place for every disabled/focus/checked/
   active state the audit (css.md §4) found leaking the stock Bootstrap blue
   (13,110,253 / 134,183,254 / 49,132,253).
   ===================================================================== */

/* D1: --blue-deep for primary (7.3:1 contrast; --blue alone is 3.6:1, below WCAG AA). Full state
   set, including disabled and the keyboard focus ring, so a disabled "Emitir" never reads as
   stock Bootstrap blue at 65% opacity. */
.btn-primary {
  --bs-btn-bg: var(--blue-deep);
  --bs-btn-border-color: var(--blue-deep);
  --bs-btn-hover-bg: var(--navy);
  --bs-btn-hover-border-color: var(--navy);
  --bs-btn-active-bg: var(--navy);
  --bs-btn-active-border-color: var(--navy);
  --bs-btn-disabled-bg: var(--blue-deep);
  --bs-btn-disabled-border-color: var(--blue-deep);
  --bs-btn-focus-shadow-rgb: var(--blue-rgb);
}

/* Bootstrap hardcodes the outline variant's blue and its disabled state; without this every
   outline-primary button reads stock Bootstrap blue beside the brand one. */
.btn-outline-primary {
  --bs-btn-color: var(--blue-deep);
  --bs-btn-border-color: var(--blue);
  --bs-btn-hover-color: var(--white);
  --bs-btn-hover-bg: var(--blue);
  --bs-btn-hover-border-color: var(--blue);
  --bs-btn-active-color: var(--white);
  --bs-btn-active-bg: var(--blue-deep);
  --bs-btn-active-border-color: var(--blue-deep);
  --bs-btn-disabled-color: var(--blue);
  --bs-btn-disabled-border-color: var(--blue);
  --bs-btn-focus-shadow-rgb: var(--blue-rgb);
}

.btn-link {
  --bs-btn-focus-shadow-rgb: var(--blue-rgb);
}

/* D3: btn-outline-secondary (236 uses, the most-used button) is stock Bootstrap slate; a brand
   neutral instead, built from the same body/line tokens the rest of Hub already reads. */
.btn-outline-secondary {
  --bs-btn-color: var(--body);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--white);
  --bs-btn-hover-bg: var(--body);
  --bs-btn-hover-border-color: var(--body);
  --bs-btn-active-color: var(--white);
  --bs-btn-active-bg: var(--body);
  --bs-btn-active-border-color: var(--body);
  --bs-btn-disabled-color: var(--muted);
  --bs-btn-disabled-border-color: var(--line);
  --bs-btn-focus-shadow-rgb: var(--body-rgb);
}

/* .form-select:focus is not scoped by hub.css's own .hub-form override (only .form-control is),
   so about 400 of 490 form controls outside a .hub-form kept the stock #86b7fe border and blue
   glow. One rule, unscoped, ends every leak at once. */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--blue-deep);
  border-color: var(--blue-deep);
}

/* The switch knob is an inline SVG data URI; Bootstrap's own focus/checked variants paint it
   stock blue (%2386b7fe) regardless of --bs-primary. */
.form-switch .form-check-input:focus {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2392BBD8'/%3e%3c/svg%3e");
}

.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--navy-tint);
  --bs-dropdown-link-active-color: var(--ink);
}

.pagination {
  --bs-pagination-active-bg: var(--blue-deep);
  --bs-pagination-active-border-color: var(--blue-deep);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

.btn-close {
  --bs-btn-close-focus-shadow: 0 0 0 0.25rem var(--focus-ring);
}

.nav-link:focus-visible {
  box-shadow: 0 0 0 0.25rem var(--focus-ring);
}
