/* CBMW Internal Tools — Shared Theme  v2
   Design language extracted from the Sales Dashboard: flat, dense, quiet.
   One accent (BMW blue), slate ink, soft grey chrome, semantic status colours.
   Link from every internal page:
   <link rel="stylesheet" href="/auth/cbmw-theme.css">

   Rules for pages using this theme:
   - Do NOT redeclare :root tokens or theme classes locally.
   - Compose with the components below; add page-specific classes only for
     genuinely page-specific things. */

:root {
  /* ── Core palette ── */
  --bmw:        #1c69d4;   /* the one accent */
  --bmw-dark:   #1558b0;   /* accent, pressed/hover */
  --slate:      #16212B;   /* dark header bands, strongest ink */
  --ink:        #1c252e;   /* body text */
  --muted:      #6a7682;   /* secondary text */
  --line:       #e2e8ed;   /* borders */
  --soft:       #f5f8fa;   /* soft fills: table heads, wells */
  --bg:         #eef1f4;   /* page background */
  --card:       #ffffff;

  /* ── Status (semantic — use these, not ad-hoc greens/reds) ── */
  --ahead:      #2e7d4f;  --ahead-bg:  #e7f4ec;
  --behind:     #b3261e;  --behind-bg: #fbe7e5;
  --watch:      #9a6b00;  --watch-bg:  #fbf2dc;
  --sched:      #185fa5;  --sched-bg:  #e8f1fa;
  --ok:         var(--ahead);
  --danger:     var(--behind);

  /* ── Geometry ── */
  --radius:     10px;      /* cards, panels */
  --radius-sm:  6px;       /* controls, inputs, small elements */
  --shadow:     0 1px 3px rgba(22,33,43,.05);
  --shadow-lg:  0 4px 20px rgba(22,33,43,.10);

  /* Aliases used by the shared navigation and older pages —
     keep these pointing at the canonical values above. */
  --bmw-blue:       var(--bmw);
  --bmw-dark-blue:  #0f2349;
  --bmw-light-blue: #4285f4;
  --text-primary:   var(--ink);
  --text-secondary: var(--muted);
  --border-light:   var(--line);
  --white:          #ffffff;
  --bmw-light-grey: var(--soft);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
  font-size: 13.5px;
  min-height: 100vh;
}

/* ── Layout ── */
.page-wrap {
  max-width: 1000px;
  margin: 1.5rem auto;
  padding: 0 1rem 3rem;
}
.page-wrap-wide {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem 3rem;
}

/* ── Page header band (the Sales Dashboard's dark slate band) ──
   <header class="page-head">
     <div class="ph-brand"><h1>Title</h1><div class="sub">Context line</div></div>
     <div class="ph-meta">right-hand meta / links</div>
   </header> */
.page-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  background: var(--slate); color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 26px;
}
.page-head .ph-brand { border-left: 3px solid var(--bmw); padding-left: 16px; }
.page-head h1 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; color: #fff; margin: 0; text-align: left; }
.page-head .sub { font-size: 11px; color: #9fb4c5; letter-spacing: .16em; text-transform: uppercase; margin-top: 3px; }
.page-head .ph-meta { text-align: right; font-size: 11.5px; color: #c4d2dd; }
.page-head .ph-meta b { color: #fff; }
.page-head .ph-meta a { color: #fff; text-decoration: none; font-weight: 700; }
/* Standalone band (no attached .page-body below it) */
.page-head.solo { border-radius: var(--radius); }
/* Controls that sit inside the band: quiet translucent buttons/selects */
.page-head .band-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff;
  text-decoration: none; font-weight: 700; font-size: 13px; font-family: inherit;
}
.page-head .band-btn:hover { background: rgba(255,255,255,.25); }
.page-head .band-btn.accent { background: var(--bmw); }
.page-head .band-btn.accent:hover { background: var(--bmw-dark); }
.page-head select.band-sel {
  width: auto; margin: 0; padding: 7px 10px; border: none; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff; font-weight: 600; font-size: 13px;
}
.page-head select.band-sel option { color: var(--ink); background: #fff; }
.page-body {
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px 26px 30px;
  box-shadow: var(--shadow-lg);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }

/* ── Headings ── */
h1 { color: var(--slate); font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 1rem; text-align: center; }
h2 {
  color: var(--slate); font-size: 14px; font-weight: 700;
  margin: 0 0 .75rem; padding-bottom: 6px;
  border-bottom: 2px solid var(--bmw);
  display: flex; align-items: center; gap: 8px;
}
h2 .tag {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px;
  font-weight: 700; font-size: 13px; font-family: inherit;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--bmw); outline-offset: 2px; }

.btn-primary            { background: var(--bmw);      color: #fff; }
.btn-primary:hover      { background: var(--bmw-dark); color: #fff; }
.btn-secondary          { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover    { border-color: var(--bmw); color: var(--bmw); }
.btn-ok                 { background: var(--ahead);    color: #fff; }
.btn-ok:hover           { background: #256641; color: #fff; }
.btn-danger             { background: var(--behind);   color: #fff; }
.btn-danger:hover       { background: #921e18; color: #fff; }
.btn-block              { display: flex; width: 100%; margin: .4rem 0; }

/* ── Filter pills (Sales Dashboard pattern) ── */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.filters button, .pill-btn {
  font: inherit; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 14px; padding: 4px 12px; cursor: pointer;
}
.filters button:hover, .pill-btn:hover { border-color: var(--bmw); color: var(--bmw); }
.filters button.on, .pill-btn.on { background: var(--bmw); border-color: var(--bmw); color: #fff; }

/* ── Forms ── */
label {
  display: block; font-weight: 600; font-size: 13px;
  margin-bottom: .3rem; color: var(--ink);
}
input:not([type="submit"]):not([type="button"]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s;
  margin-bottom: .75rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bmw);
  box-shadow: 0 0 0 3px rgba(28,105,212,.12);
}

/* ── Tables (Sales Dashboard style: soft heads, quiet rows) ── */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  background: var(--soft); color: var(--muted);
  padding: 8px 12px; text-align: center;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
tbody td {
  border-top: 1px solid var(--line);
  padding: 8px 12px; text-align: center;
}
/* No global row hover: it repaints colour-coded cells (holiday calendars etc.).
   Pages that want a row highlight opt in with their own rule. */

/* Horizontal scroll wrapper for wide tables on small screens */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 640px; }

/* ── Chips (status / classification badges) ── */
.chip {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 8px; border-radius: 9px;
}
.chip-ok    { color: var(--ahead);  background: var(--ahead-bg); }
.chip-bad   { color: var(--behind); background: var(--behind-bg); }
.chip-watch { color: var(--watch);  background: var(--watch-bg); }
.chip-info  { color: var(--sched);  background: var(--sched-bg); }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: 8px; font-weight: 600;
  margin-bottom: 1rem; border: 1px solid transparent; border-left-width: 4px;
}
.alert-ok   { background: var(--ahead-bg);  border-color: var(--ahead);  color: var(--ahead); }
.alert-err  { background: var(--behind-bg); border-color: var(--behind); color: var(--behind); }
.alert-info { background: var(--sched-bg);  border-color: var(--sched);  color: var(--sched); }

/* ── Progress bar ── */
.progress {
  height: 8px; background: var(--line);
  border-radius: 999px; overflow: hidden;
}
.progress .bar { height: 100%; background: var(--bmw); transition: width .25s; }
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}

/* ── Notes & footer ── */
.note { font-size: 11.5px; color: var(--muted); }
.page-footer {
  text-align: center; font-size: 11px; color: var(--muted); margin-top: 2rem;
}
.page-footer a { color: var(--muted); text-decoration: none; }
.page-footer a:hover { color: var(--bmw); }

/* ── Focus visibility for keyboard users ── */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--bmw); outline-offset: 2px;
}

/* ── Utilities ── */
.text-muted  { color: var(--muted) !important; }
.text-center { text-align: center; }
.text-bmw    { color: var(--bmw); }
