/* CrewTrack — Six Sigma brand colours (from SIX_SIGMA_LOGO_FINAL.pdf)
   Orange-red C14 M80 Y100 K5 ≈ #CC4420 · Dark grey K80 ≈ #4F4C4D · Grey K50 ≈ #918F8F */
:root {
  --brand: #CC4420;        /* buttons, Lead app header (white text 4.7:1) */
  --brand-dark: #A8381A;   /* links, pressed states */
  --brand-tint: #FBEDE8;
  --charcoal: #4F4C4D;     /* Engineer/Admin headers (white text 8:1) */
  --charcoal-dark: #3B3839;
  --grey: #918F8F;         /* borders and decoration only — too light for text */
  --ink: #2E2B2C;
  --muted: #5F5B5C;        /* secondary text (≥ 6:1 on white) */
  --line: #DAD8D8;
  --bg: #F4F4F4;
  --card: #FFFFFF;
  --ok: #1F6B3A;   --ok-bg: #E3F2E8;
  --warn: #8A4B00; --warn-bg: #FDF0D9;
  --bad: #A61B1B;  --bad-bg: #FBE4E4;
  --radius: 12px;
  --tap: 48px;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.45; background: var(--bg); }
a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 22px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* App bar */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; color: #fff; background: var(--brand); }
.appbar.charcoal { background: var(--charcoal); }
.appbar .title { font-weight: 800; font-size: 18px; }
.appbar .who { font-size: 14px; opacity: .92; }
.appbar .row { flex-wrap: nowrap; }
.appbar button { background: rgba(255,255,255,.16); color: #fff; border: 0; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.wide { max-width: none; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 10px; }

/* Buttons and fields */
button, .btn { min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--grey);
  background: #fff; color: var(--ink); font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid #F2A285; outline-offset: 2px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); font-weight: 600; }
input, select, textarea { min-height: var(--tap); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--grey);
  font-family: inherit; font-size: 16px; color: var(--ink); background: #fff; width: 100%; }
textarea { min-height: 80px; }
label.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-size: 15px; }
label.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 200px !important; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

/* Chips */
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px;
  font-weight: 700; background: #ECEBEB; color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.brand { background: var(--brand-tint); color: var(--brand-dark); }

/* Notices */
.notice { border-radius: 10px; padding: 12px 14px; font-size: 15px; }
.notice.info { background: var(--brand-tint); color: #6E2610; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }

/* Lists and tables */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.table-box { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #FAFAFA; color: var(--muted); font-size: 13px; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }

/* Login */
.login { max-width: 420px; margin: 0 auto; padding: 32px 16px; display: flex; flex-direction: column; gap: 16px; }
.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark .tile { width: 52px; height: 52px; border-radius: 12px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 24px; }
.brandmark .tile.charcoal { background: var(--charcoal); }

/* Modal + toast */
.backdrop { position: fixed; inset: 0; background: rgba(30,28,29,.5); display: flex; align-items: flex-end;
  justify-content: center; z-index: 50; }
.dialog { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0;
  padding: 20px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 700px) { .backdrop { align-items: center; } .dialog { border-radius: 16px; } }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: 92vw;
  padding: 12px 18px; border-radius: 10px; color: #fff; background: var(--charcoal); font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }

/* Admin layout */
.admin { display: flex; min-height: 100vh; }
.side { width: 220px; flex: none; background: var(--charcoal); color: #fff; padding: 16px 10px;
  display: flex; flex-direction: column; gap: 2px; }
.side .title { font-weight: 800; font-size: 17px; padding: 4px 10px 14px; }
.side a { color: #F1F1F1; text-decoration: none; padding: 11px 12px; border-radius: 8px; font-size: 15px; }
.side a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 700; }
.side a:hover { background: var(--charcoal-dark); }
.side .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 800px) {
  .admin { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; }
  .side .title { width: 100%; }
  .side .spacer { display: none; }
}
.split { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.pick { text-align: left; justify-content: space-between; width: 100%; }
.pick[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-tint); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.kpi .n { font-size: 28px; font-weight: 800; }
