/* ===========================================================================
 * InfinityCore — design tokens.
 *
 * Two layers:
 *
 *   1. GROUP BRAND DEFAULTS — the Infinity Group palette / typography /
 *      spacing / radii / shadows / fleet aliases. Company-neutral. Every
 *      screen consumes these via `var(--accent)`, `var(--ink)`, etc.
 *
 *   2. PER-COMPANY OVERRIDE HOOK — a thin band of `--company-*` variables
 *      that default to the group brand. Each Infinity company can override
 *      these by setting `[data-company="<code>"]` on <html>/<body> (the
 *      attribute is emitted by base.html). Phase 1 only ships the RAC
 *      theme, which equals the group defaults. Cars Services / Limousine
 *      / Motorcycles can adopt later by adding their own block without
 *      forking screens or component primitives.
 *
 * Token values are unchanged in this revision -- only the file structure
 * and the per-company override band are new. (Font self-hosting is a
 * follow-up; the Google Fonts @import below is the only remaining CDN
 * font reference and will be replaced with @font-face once the Geist
 * .woff2 files are vendored under static/fonts/geist/.)
 * =========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

/* ===========================================================================
 * 1. GROUP BRAND DEFAULTS
 * =========================================================================== */
:root {
  /* Surfaces */
  --bg:        #f5f3ee;
  --surface:   #ffffff;
  --surface-2: #faf8f3;
  --surface-3: #f1eee5;

  /* Borders */
  --line:        #e6e1d6;
  --line-soft:   #efeae0;
  --line-strong: #d6cfbf;

  /* Ink (text on light) */
  --ink:     #16181d;
  --ink-2:   #2a2d34;
  --muted:   #6b6a64;
  --muted-2: #8b897f;

  /* Sidebar (charcoal) */
  --sidebar:          #16181d;
  --sidebar-2:        #1d2027;
  --sidebar-3:        #262932;
  --sidebar-ln:       #262932;
  --on-sidebar:       #d8d6d0;
  --on-sidebar-muted: #7c7e86;
  --on-sidebar-2:     #f4f2ec;

  /* Accent — bronze (group default) */
  --accent:      oklch(0.66 0.10 75);
  --accent-2:    oklch(0.58 0.11 70);
  --accent-3:    oklch(0.74 0.09 80);
  --accent-tint: oklch(0.66 0.10 75 / 0.10);

  /* Status colors */
  --green: oklch(0.55 0.12 150);   --green-tint: oklch(0.55 0.12 150 / 0.10);  --green-ink: oklch(0.40 0.12 150);
  --amber: oklch(0.66 0.13 75);    --amber-tint: oklch(0.66 0.13 75  / 0.12); --amber-ink: oklch(0.45 0.12 75);
  --red:   oklch(0.54 0.18 27);    --red-tint:   oklch(0.54 0.18 27  / 0.10); --red-ink:   oklch(0.42 0.17 27);
  --blue:  oklch(0.55 0.12 245);   --blue-tint:  oklch(0.55 0.12 245 / 0.10); --blue-ink:  oklch(0.42 0.12 245);
  --slate: oklch(0.50 0.03 250);   --slate-tint: oklch(0.50 0.03 250 / 0.10);

  /* Spacing */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  /* Radii */
  --r-1: 3px;  --r-2: 4px;  --r-3: 6px;  --r-4: 10px;  --r-pill: 999px;

  /* Elevation */
  --shadow-1: 0 1px 0 0 var(--line);
  --shadow-2: 0 4px 12px -6px rgba(20,20,20,0.08), 0 0 0 1px var(--line);
  --shadow-3: 0 24px 80px -20px rgba(0,0,0,0.35), 0 0 0 1px var(--line);
  --shadow-drawer: -24px 0 60px -30px rgba(20,20,20,0.18), 0 0 0 1px var(--line);
  --shadow-toast:  0 16px 40px -16px rgba(0,0,0,0.25), 0 0 0 1px var(--line);

  /* Type */
  --ff-ui:   "Geist", "Söhne", -apple-system, BlinkMacSystemFont, sans-serif;
  --ff-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --t-h1: 22px; --t-h2: 16px; --t-h3: 14px;
  --t-body: 13px; --t-sm: 12px; --t-xs: 11px;
  --t-mono-data: 12px; --t-mono-id: 11px;

  /* Z-index */
  --z-topbar: 20; --z-drawer: 50; --z-modal: 60; --z-toast: 80;

  /* Focus ring — single source of truth (was previously repeated in 8+
     component <style> blocks). */
  --focus-ring:        2px solid var(--accent);
  --focus-ring-offset: 1px;

  /* Transition timing — narrow palette, used everywhere. */
  --t-fast:  120ms ease-out;
  --t-base:  150ms ease-out;
  --t-slow:  200ms ease-out;

  /* Fleet-status alias tokens (spec: clear at-a-glance status).
     These map fleet states to the existing semantic palette so per-screen
     code references the *state* (Available, Rented, …) rather than picking
     a generic green/amber/red itself. Change a state's colour in one place. */
  --fs-available-bg:   var(--green-tint);  --fs-available-ink:   var(--green-ink);
  --fs-reserved-bg:    var(--blue-tint);   --fs-reserved-ink:    var(--blue-ink);
  --fs-rented-bg:      var(--accent-tint); --fs-rented-ink:      var(--accent-2);
  --fs-garage-bg:      var(--amber-tint);  --fs-garage-ink:      var(--amber-ink);
  --fs-accident-bg:    var(--red-tint);    --fs-accident-ink:    var(--red-ink);
  --fs-inactive-bg:    var(--surface-3);   --fs-inactive-ink:    var(--muted);
  --fs-blocked-bg:     var(--surface-3);   --fs-blocked-ink:     var(--ink-2);
  --fs-overdue-bg:     var(--red-tint);    --fs-overdue-ink:     var(--red-ink);
  --fs-alert-bg:       var(--red-tint);    --fs-alert-ink:       var(--red-ink);

  /* Money — negative-amount tint (used by the qar template filter wrapper). */
  --money-neg-ink: var(--red-ink);

  /* =========================================================================
   * 2. PER-COMPANY OVERRIDE HOOK
   *
   * Group-level defaults. Each Infinity company can override these on
   * `[data-company="<code>"]` (or `body.company-<code>`) — Phase 1 only
   * RAC is wired; other companies leave these unset and inherit group.
   *
   * Screens / component primitives should consume `--company-*` aliases
   * when they want the per-company hook in play (e.g. a company-themed
   * accent on cover banners), and stick with the group `--accent` etc.
   * for the shared neutral chrome (forms, badges, status). The split is
   * deliberately conservative: most chrome is GROUP, only brand-forward
   * surfaces (logo, cover gradient, marketing accent) hook into COMPANY.
   * ========================================================================= */
  --company-code:        "infinity-group";
  --company-name:        "Infinity Group";
  --company-accent:      var(--accent);
  --company-accent-2:    var(--accent-2);
  --company-accent-3:    var(--accent-3);
  --company-accent-tint: var(--accent-tint);
  /* Logo URL: optional per-company override. Phase 1 leaves it unset; the
     login + sidebar templates already reference the static logo image by
     name via the static tag. A future per-company override would set
     this variable to its own image reference. Do NOT include a literal
     CSS function call in this comment block -- the WhiteNoise
     CompressedManifest storage scans every CSS file (comments included)
     for matching tokens during collectstatic post-processing and would
     try to resolve the contents as a relative file path. Keep this text
     descriptive only. */
  --company-logo-url:    none;
}

/* ---------------------------------------------------------------------------
 * Per-company theme blocks. Phase 1 ships only RAC; the others are sketched
 * as comments so the override surface is documented in one place. None of
 * these blocks add or rename a group-level token -- they only re-bind the
 * thin `--company-*` band above.
 * --------------------------------------------------------------------------- */
[data-company="rac"] {
  --company-code:        "rac";
  --company-name:        "Infinity Rent A Car";
  /* Phase 1: RAC = group defaults. Left explicit so future divergence is
     a one-line edit and so the rule appears in DevTools when inspecting. */
  --company-accent:      var(--accent);
  --company-accent-2:    var(--accent-2);
  --company-accent-3:    var(--accent-3);
  --company-accent-tint: var(--accent-tint);
}

/* Examples for future companies (intentionally left as comments — do NOT
   uncomment until each company's brand work lands):

   [data-company="cars-services"] {
     --company-code: "cars-services";
     --company-name: "Infinity Cars Services";
     --company-accent: ...;
     ...
   }

   [data-company="limousine"]   { ... }
   [data-company="motorcycles"] { ... }
*/


/* ===========================================================================
 * Base reset + body typography
 * =========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ff-ui);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}
.mono { font-family: var(--ff-mono); font-feature-settings: "tnum" 1; letter-spacing: 0; }

/* ===========================================================================
 * Chrome (Session 17a) — minimal CSS for layout primitives the templates use.
 * Component-specific styles ship in later 17 sessions.
 * =========================================================================== */

/* Skip-link (a11y) */
.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  background: var(--ink);
  color: var(--on-sidebar-2);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-2);
  z-index: var(--z-modal);
}
.skip-link:focus {
  position: fixed;
  left: var(--s-4);
  top: var(--s-4);
  width: auto;
  height: auto;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Global focus-visible — uses --focus-ring so every component reads the
   same definition. Change once, applies everywhere. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* App shell — sidebar 232px (fixed), topbar 60px (sticky), content area */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}
.app-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--on-sidebar);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
}
.app-main {
  margin-left: 232px;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  position: sticky;
  top: 0;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: var(--z-topbar);
  box-shadow: var(--shadow-1);
}
.app-content {
  padding: 22px 28px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}
.app-content > * + * { margin-top: 28px; }

/* Sidebar pieces */
.app-sidebar__logo {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 var(--s-4);
  color: var(--on-sidebar-2);
  font-family: var(--ff-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  border-bottom: 1px solid var(--sidebar-ln);
}
.app-sidebar__nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: var(--s-4);
}
.app-sidebar__group { list-style: none; padding: 0; margin: 0; }
.app-sidebar__group-label {
  padding: var(--s-4) 14px var(--s-1) 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-sidebar-muted);
}
.app-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 14px;
  color: var(--on-sidebar);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
}
.app-sidebar__item:hover { background: var(--sidebar-2); }
.app-sidebar__item.is-active {
  background: var(--sidebar-3);
  border-left-color: var(--accent);
  color: var(--on-sidebar-2);
}
.app-sidebar__icon { width: 12px; height: 12px; flex-shrink: 0; color: currentColor; }
.app-sidebar__footer {
  padding: 14px;
  border-top: 1px solid var(--sidebar-ln);
  color: var(--on-sidebar-muted);
  font-size: 11px;
  line-height: 1.4;
}

/* Topbar pieces */
.app-topbar__row {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: var(--s-4);
}
.app-topbar__breadcrumb {
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
}
.app-topbar__breadcrumb a { color: var(--muted); text-decoration: none; }
.app-topbar__breadcrumb a:hover { color: var(--ink); }
.app-topbar__breadcrumb-sep {
  color: var(--line-strong);
  margin: 0 var(--s-2);
  display: inline-block;
}
.app-topbar__selector {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.app-topbar__selector:hover { background: var(--surface-2); }
.app-topbar__selector[disabled],
.app-topbar__selector.is-readonly {
  cursor: default;
  background: var(--surface);
  color: var(--muted);
}
.app-topbar__bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-3);
  color: var(--ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.app-topbar__bell:hover { background: var(--surface-2); }
.app-topbar__bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: var(--on-sidebar-2);
  border-radius: var(--r-pill);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-topbar__user {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--ink-2);
}
.app-topbar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

/* Page header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
}
.page-header__breadcrumb { font-size: 12px; color: var(--muted); }
.page-header__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
}
.page-header__title {
  font-size: var(--t-h1);
  font-weight: 600;
  letter-spacing: 0;
  margin: 0;
  color: var(--ink);
}
.page-header__sub { font-size: 13px; color: var(--muted); }
.page-header__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
