/* ═══════════════════════════════════════════════════════════════════════
   Cahill Plumbing & Gas — Operations Platform
   Palette ported directly from the single-file HTML build.
   ═══════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Cahill blues — dark navy base through to pale highlight */
  --c0:#0a1628; --c1:#0d1f3c; --c2:#112448; --c3:#162d58; --c4:#1a3568;
  --c5:#1e88e5; --c6:#2196f3; --c7:#42a5f5; --c8:#90caf9; --c9:#bbdefb; --c10:#e3f2fd;

  --border:rgba(255,255,255,0.07);
  --border-md:rgba(255,255,255,0.13);
  --border-hi:rgba(255,255,255,0.22);

  --text-1:#f0f6ff; --text-2:#8bafd4; --text-3:#4a7097;

  --green:#22c55e; --gbg:rgba(34,197,94,0.12);  --gborder:rgba(34,197,94,0.3);
  --red:#ef4444;   --rbg:rgba(239,68,68,0.12);  --rborder:rgba(239,68,68,0.3);
  --amber:#f59e0b; --abg:rgba(245,158,11,0.12); --aborder:rgba(245,158,11,0.3);

  --f:'Inter',system-ui,-apple-system,sans-serif;
  --fm:'JetBrains Mono','SFMono-Regular',Consolas,monospace;

  --r1:6px; --r2:10px; --r3:14px; --r4:20px;
  --shadow:0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:0 8px 40px rgba(0,0,0,0.55);
}

body {
  font-family: var(--f);
  background: var(--c0);
  color: var(--text-1);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--c7); text-decoration: none; }
a:hover { color: var(--c8); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

:focus-visible { outline: 2px solid var(--c6); outline-offset: 2px; }

/* ── LAYOUT ─────────────────────────────────────────────────────────── */
.wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0; background: var(--c1);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.sb-logo {
  padding: 16px 18px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sb-logo-name { font-size: 13px; font-weight: 700; letter-spacing: .3px; color: var(--text-1); }
.sb-logo-name span { color: var(--c7); }
.sb-logo-sub {
  font-size: 9px; color: var(--text-3); letter-spacing: .08em;
  text-transform: uppercase; font-family: var(--fm); margin-top: 2px;
}
.sb-nav { flex: 1; padding: 8px 7px; overflow-y: auto; }
.sb-section {
  font-size: 9px; font-weight: 600; letter-spacing: .1em; color: var(--text-3);
  text-transform: uppercase; padding: 10px 10px 4px; font-family: var(--fm);
}
.ni {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--r1); cursor: pointer; transition: all .12s;
  color: var(--text-2); font-size: 13px; border: none; background: none;
  width: 100%; text-align: left; position: relative; font-family: var(--f);
}
.ni:hover { background: rgba(255,255,255,.06); color: var(--text-1); }
.ni.act { background: rgba(30,136,229,.18); color: var(--c7); font-weight: 600; }
.ni.act::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--c5);
}
.nbadge {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; font-family: var(--fm);
}
.nb-red { background: var(--red); color: #fff; }
.nb-amber { background: var(--amber); color: #1a0f00; }
.nb-blue { background: var(--c5); color: #fff; }

.sb-user {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.su-av {
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 11px;
  font-weight: 700; font-family: var(--fm); flex-shrink: 0;
}
.su-name { font-size: 12px; font-weight: 600; color: var(--text-1); }
.su-role { font-size: 10px; color: var(--text-3); font-family: var(--fm); }

.main { flex: 1; margin-left: 236px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 20px; border-bottom: 1px solid var(--border);
  background: var(--c1); position: sticky; top: 0; z-index: 100; gap: 10px;
}
.tb-title { font-size: 15px; font-weight: 700; white-space: nowrap; letter-spacing: .2px; }
.tb-right { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.page { padding: 18px 20px; flex: 1; }

.live-pill {
  display: flex; align-items: center; gap: 5px; font-size: 10px;
  font-family: var(--fm); color: var(--green); padding: 3px 9px;
  background: var(--gbg); border-radius: 20px; border: 1px solid var(--gborder);
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
.live-pill.stale { color: var(--amber); background: var(--abg); border-color: var(--aborder); }
.live-pill.stale .live-dot { background: var(--amber); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.sync-pill {
  font-size: 10px; font-family: var(--fm); color: var(--c8); padding: 3px 9px;
  background: rgba(30,136,229,.12); border-radius: 20px;
  border: 1px solid rgba(30,136,229,.3);
}

.mob-btn { display: none; background: none; border: none; color: var(--text-1); cursor: pointer; padding: 4px; }
.sb-overlay { display: none; position: fixed; inset: 0; z-index: 199; background: rgba(0,0,0,.7); }
.sb-overlay.open { display: block; }

/* ── BUTTONS ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: var(--r2); font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border-md); background: var(--c3); color: var(--text-1);
  transition: all .12s; font-family: var(--f); line-height: 1.4; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--c4); border-color: var(--border-hi); color: var(--text-1); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.prim { background: var(--c5); border-color: var(--c5); color: #fff; font-weight: 600; }
.btn.prim:hover:not(:disabled) { background: var(--c6); color: #fff; }
.btn.suc { border-color: var(--gborder); color: var(--green); }
.btn.suc:hover:not(:disabled) { background: var(--gbg); color: var(--green); }
.btn.dan { border-color: var(--rborder); color: var(--red); }
.btn.dan:hover:not(:disabled) { background: var(--rbg); color: var(--red); }
.btn.warn { border-color: var(--aborder); color: var(--amber); }
.btn.warn:hover:not(:disabled) { background: var(--abg); color: var(--amber); }
.btn.sm { padding: 5px 10px; font-size: 11px; }
.btn.lg { padding: 11px 22px; font-size: 14px; font-weight: 700; }
.btn.block { width: 100%; justify-content: center; }

.bic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r1); border: 1px solid var(--border);
  background: var(--c2); color: var(--text-2); cursor: pointer; transition: all .12s; flex-shrink: 0;
}
.bic:hover { background: var(--c4); color: var(--text-1); border-color: var(--border-md); }
.bic.dan:hover { color: var(--red); border-color: var(--rborder); }

/* ── CARDS & METRICS ────────────────────────────────────────────────── */
.card { background: var(--c1); border: 1px solid var(--border); border-radius: var(--r3); overflow: hidden; }
.card-hdr {
  padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px;
}
.card-ttl {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-2);
}

.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 11px; margin-bottom: 16px; }
.metric-card {
  background: var(--c1); border: 1px solid var(--border); border-radius: var(--r3);
  padding: 14px; position: relative; overflow: hidden;
}
.metric-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.mc-green::after { background: var(--green); }
.mc-red::after { background: var(--red); }
.mc-amber::after { background: var(--amber); }
.mc-blue::after { background: var(--c5); }
.m-lbl {
  font-size: 10px; color: var(--text-3); font-family: var(--fm);
  letter-spacing: .05em; margin-bottom: 5px; text-transform: uppercase;
}
.m-val { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text-1); }
.m-sub { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.mv-r { color: var(--red); } .mv-g { color: var(--green); }
.mv-a { color: var(--amber); } .mv-b { color: var(--c7); }

.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 12px; margin-bottom: 12px; }
.sh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.st {
  font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .3px;
}

/* ── FORMS ──────────────────────────────────────────────────────────── */
.fg { margin-bottom: 13px; }
.lbl {
  font-size: 10px; font-weight: 600; color: var(--text-2); margin-bottom: 5px;
  display: block; font-family: var(--fm); text-transform: uppercase; letter-spacing: .06em;
}
.inp, .sel, .ta {
  width: 100%; background: var(--c2); border: 1px solid var(--border-md);
  border-radius: var(--r2); padding: 9px 12px; color: var(--text-1);
  font-size: 13px; font-family: var(--f); outline: none; transition: border-color .15s;
}
.inp:focus, .sel:focus, .ta:focus {
  border-color: var(--c5); box-shadow: 0 0 0 2px rgba(30,136,229,.15);
}
.ta { resize: vertical; min-height: 68px; }
option { background: var(--c1); }
.ir { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ir3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pw-wrap { position: relative; }
.pw-wrap .inp { padding-right: 42px; }
.pw-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 15px; padding: 0; line-height: 1;
}
.pw-eye:hover { color: var(--text-1); }
.hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── TABLES ─────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 9px 12px; text-align: left; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  font-family: var(--fm); border-bottom: 1px solid var(--border);
  background: var(--c0); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.025); }
.tbl-wrap { overflow-x: auto; }

/* ── CHIPS ──────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: var(--r1); font-size: 10px; font-family: var(--fm);
  font-weight: 500; white-space: nowrap;
}
.cg { background: var(--gbg); color: var(--green); border: 1px solid var(--gborder); }
.cr { background: var(--rbg); color: var(--red); border: 1px solid var(--rborder); }
.ca { background: var(--abg); color: var(--amber); border: 1px solid var(--aborder); }
.cb { background: rgba(30,136,229,.15); color: var(--c8); border: 1px solid rgba(30,136,229,.35); }
.cm { background: var(--c3); color: var(--text-2); border: 1px solid var(--border); }
.blink { animation: blink 2s step-end infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.pm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* ── TABS ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; margin-bottom: 14px; padding: 3px; background: var(--c1);
  border-radius: var(--r2); border: 1px solid var(--border); width: fit-content; flex-wrap: wrap;
}
.tab {
  padding: 6px 13px; border-radius: var(--r1); font-size: 12px; font-weight: 500;
  cursor: pointer; border: none; background: none; color: var(--text-2);
  transition: all .12s; font-family: var(--f); text-decoration: none;
}
.tab.act { background: var(--c5); color: #fff; font-weight: 700; }
.tab:hover:not(.act) { color: var(--text-1); background: rgba(255,255,255,.06); }

/* ── MODALS ─────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,.82);
  backdrop-filter: blur(5px); display: flex; align-items: center;
  justify-content: center; padding: 14px;
}
.overlay[hidden] { display: none; }
.modal {
  background: var(--c1); border: 1px solid var(--border-md); border-radius: var(--r4);
  width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 780px; }
.modal.mid { max-width: 560px; }
.modal.narrow { max-width: 420px; }
.mhdr {
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border); display: flex;
  align-items: flex-start; justify-content: space-between; position: sticky;
  top: 0; background: var(--c1); z-index: 2;
}
.mttl { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.msub { font-size: 11px; color: var(--text-3); font-family: var(--fm); margin-top: 3px; }
.mbody { padding: 18px 20px; }
.mftr {
  padding: 12px 20px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 7px; position: sticky; bottom: 0; background: var(--c1);
}
.xbtn {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 1px; flex-shrink: 0;
}
.xbtn:hover { color: var(--text-1); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── ALERTS & FLAGS ─────────────────────────────────────────────────── */
.ai {
  display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent; transition: background .12s;
}
.ai:last-child { border-bottom: none; }
.ai:hover { background: rgba(255,255,255,.02); }
.ai.ared { border-left-color: var(--red); }
.ai.aamber { border-left-color: var(--amber); }
.ai.agreen { border-left-color: var(--green); }
.ai-ic {
  width: 26px; height: 26px; border-radius: var(--r1); display: flex;
  align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;
}
.ai-red { background: var(--rbg); } .ai-amber { background: var(--abg); } .ai-green { background: var(--gbg); }
.ai-body { flex: 1; min-width: 0; }
.ai-title { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.ai-meta { font-size: 10px; color: var(--text-2); font-family: var(--fm); display: flex; gap: 7px; flex-wrap: wrap; }
.ai-time { color: var(--text-3); font-size: 10px; font-family: var(--fm); white-space: nowrap; }

.fi { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.fi:last-child { border-bottom: none; }
.fi.fc { border-left-color: var(--red); }
.fi.fw { border-left-color: var(--amber); }
.fi.fr { opacity: .45; }
.fi-body { flex: 1; }
.fi-title { font-size: 12px; font-weight: 500; }
.fi-meta { font-size: 10px; color: var(--text-2); font-family: var(--fm); margin-top: 2px; }

/* ── FLASH MESSAGES ─────────────────────────────────────────────────── */
.flashes { position: fixed; bottom: 18px; right: 18px; z-index: 900; display: flex; flex-direction: column; gap: 7px; }
.flash {
  display: flex; align-items: center; gap: 9px; padding: 10px 14px;
  border-radius: var(--r3); background: var(--c2); border: 1px solid var(--border-md);
  box-shadow: var(--shadow); font-size: 12px; max-width: 340px; animation: slideIn .3s ease;
}
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.flash.success { border-left: 3px solid var(--green); }
.flash.error { border-left: 3px solid var(--red); }
.flash.warning { border-left: 3px solid var(--amber); }
.flash.info { border-left: 3px solid var(--c5); }
.flash-x { margin-left: auto; background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; }

/* ── LOGIN ──────────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(30,136,229,.12) 0%, transparent 60%), var(--c0);
  padding: 20px;
}
.auth-card {
  background: var(--c1); border: 1px solid var(--border-md); border-radius: var(--r4);
  width: 100%; max-width: 460px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.auth-hdr {
  background: linear-gradient(135deg, var(--c2) 0%, var(--c0) 100%);
  padding: 30px 28px 22px; border-bottom: 1px solid var(--border);
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.auth-title { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.auth-title span { color: var(--c7); }
.auth-sub { font-size: 11px; color: var(--text-3); font-family: var(--fm); letter-spacing: .08em; margin-top: 3px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.atab {
  flex: 1; padding: 12px; text-align: center; font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; background: none; color: var(--text-3);
  transition: all .15s; font-family: var(--f); border-bottom: 2px solid transparent;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.atab.act { color: var(--c7); border-bottom-color: var(--c5); background: rgba(30,136,229,.08); }
.auth-body { padding: 22px 24px; }
.auth-err {
  background: var(--rbg); border: 1px solid var(--rborder); border-radius: var(--r1);
  padding: 9px 12px; font-size: 12px; color: var(--red); margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.pm-list { display: flex; flex-direction: column; gap: 6px; }
.pm-opt {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  border-radius: var(--r3); border: 1px solid var(--border); cursor: pointer;
  transition: all .15s; background: var(--c2); width: 100%; text-align: left; font-family: var(--f);
}
.pm-opt:hover { border-color: var(--c5); background: rgba(30,136,229,.08); }
.pm-opt.sel { border-color: var(--c5); background: rgba(30,136,229,.14); }
.pm-av {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-family: var(--fm); font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.pm-nm { font-size: 13px; font-weight: 600; color: var(--text-1); }
.pm-st { font-size: 10px; color: var(--text-3); font-family: var(--fm); margin-top: 1px; }
.info-box {
  background: rgba(30,136,229,.1); border: 1px solid rgba(30,136,229,.25);
  border-radius: var(--r1); padding: 9px 12px; font-size: 12px; color: var(--c8); margin-bottom: 14px;
}

/* ── STAFF PORTAL ───────────────────────────────────────────────────── */
.portal { min-height: 100vh; background: var(--c0); display: flex; flex-direction: column; }
.portal-hdr {
  background: var(--c1); border-bottom: 1px solid var(--border); padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.portal-logo { display: flex; align-items: center; gap: 10px; }
.portal-user { font-size: 11px; color: var(--text-2); font-family: var(--fm); }
.portal-body { padding: 16px 20px; flex: 1; }
.eq-portal-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 12px; margin-top: 14px; }
.eq-portal-card {
  background: var(--c1); border: 1px solid var(--border); border-radius: var(--r3);
  padding: 16px; border-left: 4px solid transparent;
}
.eq-portal-card.av { border-left-color: var(--green); }
.eq-portal-card.out { border-left-color: var(--c5); }
.eq-portal-card.ov { border-left-color: var(--red); }
.eq-pname { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.eq-pcat {
  font-size: 10px; font-family: var(--fm); color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px;
}

/* ── CALENDAR SCHEDULER ─────────────────────────────────────────────── */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r3); border: 1px solid var(--border); }
.cal-tbl { border-collapse: collapse; min-width: 100%; }
.cal-tbl th {
  padding: 8px 4px; text-align: center; font-size: 10px; font-weight: 600;
  color: var(--text-3); font-family: var(--fm); border-bottom: 1px solid var(--border);
  background: var(--c0); white-space: nowrap; user-select: none;
}
.cal-tbl th.site-th {
  text-align: left; padding-left: 14px; min-width: 168px; width: 168px;
  position: sticky; left: 0; z-index: 10; background: var(--c0);
}
.cal-tbl th.wk-th { color: var(--c7); background: rgba(30,136,229,.07); font-size: 9px; padding: 5px 4px; }
.cal-tbl th.today-th { background: rgba(30,136,229,.14); color: var(--c7); }
.cal-tbl td {
  padding: 2px; border-bottom: 1px solid var(--border); text-align: center;
  vertical-align: middle; position: relative; user-select: none;
}
.cal-tbl td.site-td {
  text-align: left; padding: 8px 14px; position: sticky; left: 0;
  background: var(--c1); z-index: 5; border-right: 1px solid var(--border);
}
.cal-tbl td.today-td { background: rgba(30,136,229,.05); }
.cal-tbl tr:last-child td { border-bottom: none; }

.cal-cell {
  width: 100%; min-height: 34px; border-radius: 4px; display: flex;
  align-items: center; justify-content: center; font-size: 10px;
  font-family: var(--fm); font-weight: 700; cursor: pointer; position: relative;
  transition: all .1s; border: 1.5px solid transparent; background: var(--c2); color: var(--text-3);
}
.cal-cell:hover { border-color: var(--c5); }
.cal-cell.filled { color: #fff; }
.cal-cell.selecting {
  background: rgba(30,136,229,.35) !important; border-color: var(--c5) !important; color: var(--c10) !important;
}
.cal-cell.conflict { outline: 1.5px solid var(--red); outline-offset: -1px; }
.cal-dots { position: absolute; bottom: 2px; right: 3px; display: flex; gap: 2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; }
.conflict-pip {
  position: absolute; top: 2px; right: 2px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red); border: 1px solid var(--c1);
}
.site-name { font-size: 12px; font-weight: 600; color: var(--text-1); margin-bottom: 1px; }
.site-pm-name { font-size: 10px; font-family: var(--fm); }
.cal-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.legend-item {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-family: var(--fm);
  padding: 2px 8px; border-radius: var(--r1);
}

/* ── STAFF CARDS ────────────────────────────────────────────────────── */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 11px; }
.scard {
  background: var(--c2); border: 1px solid var(--border); border-radius: var(--r2);
  padding: 14px; transition: border-color .15s;
}
.scard:hover { border-color: var(--border-md); }
.scard.has-conflict { border-color: var(--red); }
.sc-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.sc-role { font-size: 11px; color: var(--text-2); margin-bottom: 8px; }
.cert-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ctag {
  font-size: 9px; font-family: var(--fm); padding: 2px 7px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .04em; border: 1px solid;
}
.ctag.lic { background: rgba(30,136,229,.12); color: var(--c8); border-color: rgba(30,136,229,.3); }
.ctag.cert { background: rgba(34,197,94,.1); color: var(--green); border-color: var(--gborder); }
.ctag.skill { background: var(--c3); color: var(--text-2); border-color: var(--border); }
.ctag.exp { background: var(--rbg); color: var(--red); border-color: var(--rborder); }
.ctag.warn { background: var(--abg); color: var(--amber); border-color: var(--aborder); }

/* ── EQUIPMENT ──────────────────────────────────────────────────────── */
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 11px; }
.ecard {
  background: var(--c2); border: 1px solid var(--border); border-radius: var(--r2);
  padding: 14px; border-left: 4px solid var(--border);
}
.ecard.av { border-left-color: var(--green); }
.ecard.out { border-left-color: var(--c5); }
.ecard.ov { border-left-color: var(--red); }
.eq-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.eq-cat {
  font-size: 10px; font-family: var(--fm); color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.eq-who { font-size: 12px; font-weight: 600; color: var(--c8); }
.eq-log-row {
  font-size: 10px; font-family: var(--fm); color: var(--text-3); padding: 3px 0;
  border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px;
}
.eq-log-row:last-child { border-bottom: none; }

/* ── CREDENTIAL ROWS ────────────────────────────────────────────────── */
.cred-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px;
  background: var(--c2); border-radius: var(--r1); border: 1px solid var(--border); margin-bottom: 5px;
}
.cred-name { font-size: 12px; font-weight: 500; }
.cred-meta { font-size: 10px; font-family: var(--fm); color: var(--text-3); margin-top: 1px; }
.cred-edit-row { display: flex; gap: 7px; align-items: flex-end; margin-bottom: 8px; flex-wrap: wrap; }
.cred-edit-row .fg { margin-bottom: 0; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-2); font-family: var(--fm); margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

/* ── MISC ───────────────────────────────────────────────────────────── */
.empty { padding: 28px; text-align: center; color: var(--text-3); font-family: var(--fm); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); font-size: 11px; font-family: var(--fm); }
.select-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 6px; }
.select-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  border-radius: var(--r2); border: 1px solid var(--border); cursor: pointer;
  background: var(--c2); transition: all .12s;
}
.select-item:hover { border-color: var(--border-md); }
.select-item.on { border-color: var(--c5); background: rgba(30,136,229,.12); }
.select-item.on.clash { border-color: var(--red); background: var(--rbg); }
.select-box {
  width: 18px; height: 18px; border-radius: 4px; background: var(--c3);
  display: flex; align-items: center; justify-content: center; font-size: 10px;
  color: var(--text-3); font-weight: 700; flex-shrink: 0;
}
.select-item.on .select-box { background: var(--c5); color: #fff; }
.warn-box {
  background: var(--rbg); border: 1px solid var(--rborder); border-radius: var(--r1);
  padding: 8px 11px; font-size: 11px; color: var(--red); margin-bottom: 9px;
}
.error-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; text-align: center; padding: 20px;
}
.error-code { font-size: 64px; font-weight: 800; color: var(--c5); line-height: 1; font-family: var(--fm); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mob-btn { display: block; }
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .two-col { grid-template-columns: 1fr; }
  .page { padding: 12px 14px; }
  .topbar { padding: 9px 14px; }
}
@media (max-width: 580px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .m-val { font-size: 22px; }
  .ir, .ir3 { grid-template-columns: 1fr; }
  .eq-grid, .eq-portal-grid, .staff-grid { grid-template-columns: 1fr; }
  .cal-tbl th.site-th, .cal-tbl td.site-td { min-width: 124px; width: 124px; }
  .flashes { left: 12px; right: 12px; bottom: 12px; }
  .flash { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   LIGHT THEME
   The platform was designed dark. This flips it via data-theme on <html>,
   set manually from the topbar and remembered per browser.

   Most of the work is re-pointing the palette variables. The exceptions
   are the semi-transparent white borders and shadows, which vanish on a
   light background and have to be restated as dark-on-light.
   ════════════════════════════════════════════════════════════════════ */
html[data-theme="light"]{
  /* Surfaces, lightest first — the reverse of the dark ramp. */
  --c0:#eef4fa;   /* page background        */
  --c1:#ffffff;   /* cards, sidebar, topbar */
  --c2:#f4f8fc;   /* inputs, wells          */
  --c3:#e6eef7;   /* buttons                */
  --c4:#d8e5f2;   /* button hover           */

  /* Blues darkened so they stay legible on white. */
  --c5:#1565c0; --c6:#1976d2; --c7:#0d47a1;
  --c8:#1565c0; --c9:#42a5f5; --c10:#e3f2fd;

  --border:rgba(10,22,40,0.10);
  --border-md:rgba(10,22,40,0.18);
  --border-hi:rgba(10,22,40,0.30);

  --text-1:#0a1628; --text-2:#42607f; --text-3:#6b88a6;

  --green:#1b8a3f; --gbg:rgba(27,138,63,0.10);  --gborder:rgba(27,138,63,0.30);
  --red:#c62828;   --rbg:rgba(198,40,40,0.09);  --rborder:rgba(198,40,40,0.28);
  --amber:#b45309; --abg:rgba(180,83,9,0.10);   --aborder:rgba(180,83,9,0.28);

  --shadow:0 2px 10px rgba(10,22,40,0.10);
  --shadow-lg:0 8px 30px rgba(10,22,40,0.16);

  color-scheme: light;
}

/* ── Places the dark theme relied on white-on-transparent ──────────── */
html[data-theme="light"] body{background:var(--c0);color:var(--text-1)}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar{
  background:var(--c1);
  border-color:var(--border);
  box-shadow:0 1px 3px rgba(10,22,40,0.06);
}

html[data-theme="light"] .ni:hover{background:rgba(10,22,40,0.05)}
html[data-theme="light"] .ni.act{background:rgba(21,101,192,0.10);color:var(--c7)}

html[data-theme="light"] .card,
html[data-theme="light"] .metric-card{
  background:var(--c1);
  border-color:var(--border);
  box-shadow:0 1px 3px rgba(10,22,40,0.05);
}

html[data-theme="light"] .tbl th{background:var(--c2);color:var(--text-2)}
html[data-theme="light"] .tbl tr:hover td{background:rgba(10,22,40,0.03)}

html[data-theme="light"] .btn{background:var(--c3);color:var(--text-1)}
html[data-theme="light"] .btn:hover:not(:disabled){background:var(--c4)}
html[data-theme="light"] .btn.prim{background:var(--c5);color:#fff;border-color:var(--c5)}
html[data-theme="light"] .btn.prim:hover:not(:disabled){background:var(--c6)}

html[data-theme="light"] .inp,
html[data-theme="light"] .sel,
html[data-theme="light"] .ta{background:#fff;color:var(--text-1)}

html[data-theme="light"] .bic{background:var(--c2);color:var(--text-2)}
html[data-theme="light"] .bic:hover{background:var(--c3);color:var(--text-1)}

html[data-theme="light"] .ai:hover{background:rgba(10,22,40,0.03)}
html[data-theme="light"] .overlay{background:rgba(10,22,40,0.45)}
html[data-theme="light"] .modal{background:var(--c1)}
html[data-theme="light"] .mhdr,
html[data-theme="light"] .mftr{background:var(--c1)}
html[data-theme="light"] .toast{background:var(--c1);color:var(--text-1)}
html[data-theme="light"] .sb-overlay{background:rgba(10,22,40,0.45)}
html[data-theme="light"] option{background:#fff;color:var(--text-1)}

/* Scheduler grid: the dark theme used faint white washes for today and
   hover, which disappear on white. */
html[data-theme="light"] .cal-tbl th{background:var(--c2)}
html[data-theme="light"] .cal-tbl th.site-th{background:var(--c2)}
html[data-theme="light"] .cal-tbl td.site-td{background:var(--c1)}
html[data-theme="light"] .cal-tbl td.today-td{background:rgba(21,101,192,0.07)}
html[data-theme="light"] .cal-tbl th.today-th{background:rgba(21,101,192,0.12);color:var(--c7)}
html[data-theme="light"] .cal-tbl tr:hover td:not(.site-td){background:rgba(10,22,40,0.03)}
html[data-theme="light"] .cal-cell.empty{background:var(--c2);color:var(--text-3)}
html[data-theme="light"] .cal-cell.empty:hover{background:var(--c3);color:var(--c5)}
html[data-theme="light"] .cal-cell.selecting{
  background:rgba(21,101,192,0.18)!important;border-color:var(--c5)!important;
  color:var(--c7)!important;
}
html[data-theme="light"] .scard,
html[data-theme="light"] .ecard,
html[data-theme="light"] .eq-portal-card{background:var(--c2)}
html[data-theme="light"] .ctag.skill{background:var(--c3);color:var(--text-2)}
html[data-theme="light"] .portal-hdr{background:var(--c1)}
html[data-theme="light"] .auth-screen{
  background:radial-gradient(ellipse at 30% 20%,rgba(21,101,192,0.10) 0%,transparent 60%),var(--c0);
}
html[data-theme="light"] .auth-card{background:var(--c1)}
html[data-theme="light"] .auth-hdr{
  background:linear-gradient(135deg,#f4f8fc 0%,#e6eef7 100%);
}
html[data-theme="light"] .pm-opt{background:var(--c2)}
html[data-theme="light"] .tabs{background:var(--c2)}
html[data-theme="light"] .tab:hover:not(.act){background:rgba(10,22,40,0.05)}

/* ── Theme toggle button ───────────────────────────────────────────── */
.theme-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  padding:5px 10px;border-radius:var(--r2);font-size:11px;font-weight:500;
  cursor:pointer;border:1px solid var(--border-md);background:var(--c3);
  color:var(--text-1);transition:all .12s;font-family:var(--f);line-height:1.4;
}
.theme-btn:hover{background:var(--c4);border-color:var(--border-hi)}

/* Printing is always light, whatever the screen is set to. */
@media print{
  html,html[data-theme="dark"]{
    --c0:#fff;--c1:#fff;--c2:#fff;--c3:#fff;
    --text-1:#000;--text-2:#333;--text-3:#555;
    --border:rgba(0,0,0,.2);--border-md:rgba(0,0,0,.3);
  }
  .sidebar,.topbar,.theme-btn,.live-pill{display:none!important}
}
