/* ============================================================================
   Webronic Support Center — design system (light, world-class, dark-ready).
   Colors flow from CSS variables so a future dark theme is a variable swap.
   ========================================================================== */
:root {
  /* Surfaces */
  --bg: #f4f6fb;
  --bg-grad: radial-gradient(1200px 600px at 70% -10%, #eef2fe 0%, #f4f6fb 55%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f0;
  --border-strong: #d6dbe6;

  /* Text — all pass WCAG AA (>=4.5:1) on --surface/--bg */
  --text: #0f172a;
  --text-2: #475569;
  --muted: #5c6472;      /* ~5.1:1 on white — safe for small labels/placeholders */

  /* Brand + semantics */
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-tint: #e8eefe;
  --success: #16a34a; --success-bg: #dcfce7;
  --warning: #d97706; --warning-bg: #fef3c7;
  --danger:  #dc2626; --danger-bg:  #fee2e2;
  --purple:  #7c3aed; --purple-bg:  #ede9fe;
  --info:    #2563eb; --info-bg:    #dbeafe;

  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 16px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 45px rgba(15,23,42,.12);
  --ring: 0 0 0 4px rgba(37,99,235,.15);
  --focus: 0 0 0 3px rgba(37,99,235,.5);
  --transition: .16s ease;
  --sidebar-w: 264px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--text-2); }

/* Accessibility: visible focus, skip link, screen-reader-only, reduced motion */
:focus-visible { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible,
[tabindex]:focus-visible, .nav-item:focus-visible {
  outline: none; box-shadow: var(--focus); border-radius: 8px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 14px; top: -60px; z-index: 200;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; box-shadow: var(--shadow); transition: top var(--transition);
}
.skip-link:focus { top: 14px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border: 1px solid transparent; border-radius: var(--radius);
  padding: 11px 18px; font-family: var(--font); font-size: 14.5px; font-weight: 600;
  letter-spacing: -0.01em; cursor: pointer; transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:active { background: #1a44b8; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 36px; padding: 8px 13px; font-size: 13.5px; }

/* Inputs ------------------------------------------------------------------- */
.field { position: relative; display: grid; gap: 7px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .lead-icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.input {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text); padding: 12px 14px; font-size: 14.5px;
  transition: var(--transition);
}
.input.has-lead { padding-left: 40px; }
.input.has-trail { padding-right: 44px; }
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input-toggle {
  position: absolute; right: 8px; display: grid; place-items: center; width: 32px; height: 32px;
  border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.input-toggle:hover { color: var(--text-2); background: var(--surface-2); }

.checkline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.checkline input { width: 17px; height: 17px; accent-color: var(--primary); }
.link { color: var(--primary); font-weight: 600; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

/* ============================================================================
   Auth (split screen)
   ========================================================================== */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px 60px;
  display: flex; flex-direction: column;
  background: linear-gradient(150deg, #2f6bf6 0%, #2456d6 45%, #1e40af 100%);
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08);
}
.auth-hero::before { width: 460px; height: 460px; top: -120px; right: -120px; }
.auth-hero::after  { width: 320px; height: 320px; bottom: -140px; left: 40px; background: rgba(255,255,255,.06); }
.auth-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.auth-brand img { width: 46px; height: 46px; border-radius: 12px; background: #fff; padding: 3px; }
.auth-brand .b-name { font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.auth-brand .b-sub { font-size: 11px; letter-spacing: 2.5px; opacity: .85; }
.auth-hero h1 { position: relative; z-index: 1; font-size: 46px; line-height: 1.05; font-weight: 800; margin: auto 0 18px; max-width: 12ch; }
.auth-hero .lede { position: relative; z-index: 1; font-size: 16px; opacity: .92; max-width: 40ch; margin-bottom: 34px; }
.auth-features { position: relative; z-index: 1; display: grid; gap: 20px; margin-bottom: auto; }
.auth-feature { display: flex; gap: 14px; align-items: flex-start; }
.auth-feature .fi { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex: none; }
.auth-feature h4 { font-size: 15px; margin-bottom: 2px; }
.auth-feature p { font-size: 13.5px; opacity: .85; margin: 0; }
.auth-copy { position: relative; z-index: 1; font-size: 12.5px; opacity: .7; }

.auth-panel { display: grid; place-items: center; padding: 40px; background: var(--bg-grad); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-logo { width: 62px; height: 62px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; margin: 0 auto 18px; }
.auth-card .card-logo img { width: 40px; height: 40px; }
.auth-card h2 { text-align: center; font-size: 26px; font-weight: 800; }
.auth-card .sub { text-align: center; color: var(--text-2); margin: 6px 0 26px; }
.auth-form { display: grid; gap: 18px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; }
.auth-error { margin-top: 16px; color: var(--danger); background: var(--danger-bg); border: 1px solid #fecaca; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 22px; line-height: 1.7; }
/* Public-schedule link on the sign-in page — the one thing here that needs no account. */
.auth-public { text-align: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); line-height: 1.7; }
.auth-public a { color: var(--primary); font-size: 14px; font-weight: 600; text-decoration: none; }
.auth-public a:hover { text-decoration: underline; }
.auth-public span { color: var(--muted); font-size: 12.5px; }
.mfa-hint { text-align: center; color: var(--text-2); font-size: 13.5px; margin: -4px 0 4px; }

/* ============================================================================
   App shell
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 15px 12px 12px;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 13px; margin-bottom: 5px; border-bottom: 1px solid var(--border); }
.sb-brand img { width: 32px; height: 32px; }
.sb-brand .n { font-weight: 800; font-size: 15px; letter-spacing: -.01em; line-height: 1.05; }
.sb-brand .s { font-size: 9.5px; font-weight: 700; letter-spacing: 1.7px; color: var(--muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; margin: 0 -4px; padding: 5px 4px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.nav::-webkit-scrollbar-track { background: transparent; }

/* Every top-level entry — flat item or collapsible group header — is a row with
   a rounded icon "chip", a label, and (for groups) a chevron. */
.nav-item, .nav-group > .gh {
  display: flex; align-items: center; gap: 11px; padding: 6px 11px 6px 7px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14.5px; cursor: pointer;
  list-style: none; user-select: none; transition: var(--transition);
}
.nav-item .nl, .gh .nl { flex: 1; min-width: 0; letter-spacing: -.006em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ni {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); transition: var(--transition);
}
.ni svg { width: 18px; height: 18px; }

.nav-item:hover, .nav-group > .gh:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .ni, .nav-group > .gh:hover .ni { background: var(--border); color: var(--text); }
.nav-item:focus-visible, .nav-group > .gh:focus-visible { outline: none; box-shadow: var(--focus); }

.nav-item.active { background: var(--primary-tint); color: var(--primary-600); font-weight: 700; }
.nav-item.active .ni { background: var(--primary); color: #fff; }

.nav-group { margin-top: 3px; }
.nav-group > .gh::-webkit-details-marker { display: none; }
.nav-group[open] > .gh { color: var(--text); }
.gh-chev { display: grid; place-items: center; color: var(--muted); opacity: .7; transition: transform .2s ease; flex: none; }
.nav-group[open] > .gh .gh-chev { transform: rotate(90deg); }

/* Sub-items: a touch smaller, grouped tightly beneath the header. */
.ng-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 5px; }
.ng-body .nav-item { padding: 5px 11px 5px 8px; font-size: 13.5px; }
.ng-body .nav-item .ni { width: 29px; height: 29px; border-radius: 9px; }
.ng-body .nav-item .ni svg { width: 16px; height: 16px; }

.nav-item.soon { color: var(--muted); cursor: default; }
.nav-item.soon .ni { opacity: .55; }
.nav-item.soon:hover { background: transparent; color: var(--muted); }
.nav-item.soon:hover .ni { background: var(--surface-2); color: var(--text-2); }
.badge-soon { flex: none; font-size: 10px; font-weight: 600; letter-spacing: .2px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 18px; padding: 16px 30px; }
.bell { position: relative; width: 40px; height: 40px; padding: 0; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: var(--transition); }
.bell:hover { background: var(--surface-2); color: var(--text); }
.bell .dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.who { display: flex; align-items: center; gap: 11px; }
.who .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.who .n { font-weight: 700; font-size: 14px; }
.who .r { font-size: 12px; color: var(--text-2); }
.who .logout { font-size: 11.5px; color: var(--primary); font-weight: 600; }

.content { padding: 8px 30px 40px; }
.loader, .empty { color: var(--text-2); padding: 40px; text-align: center; }

/* Page hero */
.page-hero { display: flex; align-items: center; gap: 18px; margin: 10px 0 24px; }
.page-hero .hero-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.page-hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.page-hero p { color: var(--text-2); margin-top: 2px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); transition: var(--transition); }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card.alert { border-color: #f6c9c9; box-shadow: 0 0 0 1px #f8d4d4 inset, var(--shadow-sm); }
.stat-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1; }
.stat-lbl { color: var(--text-2); font-size: 13px; margin-top: 5px; }

/* Panels grid */
.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
/* Collapsible panels (Hide/Show toggle added by enhancePanels in app.js). */
.panel.panel-collapsed > *:not(.panel-head) { display: none !important; }
.panel.panel-collapsed > .panel-head { margin-bottom: 0; }
.panel-collapse-btn { flex: none; }
.panel-head .ph-ic { color: var(--primary); display: grid; place-items: center; }
.panel-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

/* Alert banner */
.alert-banner { display: flex; align-items: center; gap: 12px; background: var(--danger-bg); border: 1px solid #fbcaca; color: #991b1b; padding: 13px 15px; border-radius: var(--radius); font-weight: 600; font-size: 13.5px; }
.ok-banner { display: flex; align-items: center; gap: 12px; background: var(--success-bg); border: 1px solid #bbf7d0; color: #166534; padding: 13px 15px; border-radius: var(--radius); font-weight: 600; font-size: 13.5px; }

.sub-head { font-size: 11.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Colored tiles (team / incidents) */
.tile-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { border-radius: var(--radius-lg); padding: 16px; text-align: center; }
.tile .t-num { font-size: 26px; font-weight: 800; line-height: 1; }
.tile .t-lbl { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.tile.green  { background: var(--success-bg); color: var(--success); }
.tile.purple { background: var(--purple-bg);  color: var(--purple); }
.tile.blue   { background: var(--info-bg);    color: var(--info); }
.tile.red    { background: var(--danger-bg);  color: var(--danger); }
.tile.amber  { background: var(--warning-bg); color: var(--warning); }
/* Small labels need AA (4.5:1) — darken ink vs the tint (numbers are large text). */
.tile.green  .t-lbl { color: #166534; }
.tile.purple .t-lbl { color: #5b21b6; }
.tile.blue   .t-lbl { color: #1e40af; }
.tile.red    .t-lbl { color: #991b1b; }
.tile.amber  .t-lbl { color: #92400e; }

/* List (follow-ups / projects) */
.list { display: grid; gap: 2px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; }
.list-item .li-meta { font-size: 12px; color: var(--text-2); }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.high { background: var(--danger-bg); color: var(--danger); }
.pill.med  { background: var(--warning-bg); color: var(--warning); }
.pill.low  { background: var(--info-bg); color: var(--info); }
.empty-mini { color: var(--muted); font-size: 13px; padding: 16px 4px; }

/* Icon chips reused for stat icons */
.ic-green  { background: var(--success-bg); color: var(--success); }
.ic-amber  { background: var(--warning-bg); color: var(--warning); }
.ic-purple { background: var(--purple-bg);  color: var(--purple); }
.ic-red    { background: var(--danger-bg);  color: var(--danger); }
.ic-blue   { background: var(--info-bg);    color: var(--info); }

/* ============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  /* Sidebar becomes a full-width block at the top; collapsible groups keep it
     compact (collapsed by default) so it doesn't dominate the screen. */
  .sidebar { position: static; height: auto; }
  .content { padding: 8px 16px 30px; }
  .topbar { padding: 12px 16px; }
  .two-col { grid-template-columns: 1fr; }
}


/* ── CSV import panel ───────────────────────────────────────────────────
   Shared by every module that mounts mountCsvImport() (assets/js/app.js).
   Lived in pages/shifts.php until four more pages needed them. */
.io-bar { margin-left:auto; display:flex; gap:8px; align-items:center; }
.io-menu { position:relative; }
.io-drop { position:absolute; right:0; top:calc(100% + 6px); z-index:20; min-width:180px; padding:6px;
  background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; gap:2px; }
.io-drop button { text-align:left; padding:8px 10px; font-size:13.5px; border:0; background:none;
  width:100%; border-radius:7px; cursor:pointer; color:var(--text); }
.io-drop button:hover { background:var(--surface-2); color:var(--text); }
.io-panel { margin-bottom:18px; }
.io-hint { font-size:13px; color:var(--muted); margin:0 0 12px; line-height:1.6; }
.io-hint code { background:var(--surface-2); padding:1px 5px; border-radius:4px; font-size:12.5px; }
.io-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.io-row .input { flex:1; min-width:220px; }
.io-result { margin-top:14px; }
.io-sum { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:10px; font-size:13.5px; font-weight:600; }
.io-ok { color:var(--success); } .io-bad { color:var(--danger); }
.io-tbl { width:100%; border-collapse:collapse; font-size:13px; }
.io-tbl th, .io-tbl td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--border); }
.io-tbl th { color:var(--muted); font-weight:600; }
.io-errs { margin-top:10px; padding:10px 12px; border-radius:8px; background:var(--danger-bg); color:var(--danger); font-size:13px; }
.io-errs div { margin:3px 0; }
.io-scroll { max-height:320px; overflow:auto; }

/* Ambient shift-clock chip in the topbar (Sprint 5 — SOD/EOD timer). Hidden until a
   session is active, so the Manager with no shift never sees it. */
.shift-timer { display:inline-flex; align-items:center; gap:8px; margin-right:14px; padding:5px 10px;
  background:var(--success-bg); border:1px solid var(--success); border-radius:999px; font-size:12.5px; font-weight:600; color:var(--success); }
.shift-timer.paused { background:var(--warning-bg); border-color:var(--warning); color:var(--warning); }
.shift-timer .st-dot { width:8px; height:8px; border-radius:50%; background:var(--success); }
.shift-timer.paused .st-dot { background:var(--warning); }
.shift-timer .st-live { font-variant-numeric:tabular-nums; letter-spacing:.01em; }
.shift-timer .st-brk { border:0; background:rgba(0,0,0,.06); color:inherit; font:inherit; font-size:11.5px; font-weight:700;
  padding:2px 9px; border-radius:999px; cursor:pointer; }
.shift-timer .st-brk:hover { background:rgba(0,0,0,.12); }

/* Non-collapsible nav group (e.g. Operations) — always-open, no chevron/toggle.
   The whole block gets a tinted "card" background so its children read as grouped;
   the heading becomes a compact small-caps section label (no icon chip). */
.nav-group-flat { background:var(--bg); border:1px solid var(--border); border-radius:12px;
  padding:4px 5px 6px; margin:6px 0; }                        /* --bg reads clearly vs the white sidebar */
.nav-group-flat > .ng-body { display:block; }
.nav-group-flat .gh-flat { cursor:default; padding:7px 9px 4px; font-size:10.5px; font-weight:750;
  text-transform:uppercase; letter-spacing:.08em; color:var(--muted); }
.nav-group-flat .gh-flat:hover { background:none; }
.nav-group-flat .gh-flat .ni { display:none; }               /* heading is text, not an icon chip */
.nav-group-flat .ng-body .nav-item { border-radius:9px; }
.nav-group-flat .ng-body .nav-item:hover { background:var(--surface); }   /* children pop to white on hover */
.nav-group-flat .ng-body .nav-item.active { background:var(--primary-tint); }

/* Compact sidebar — tighter rows so the fuller nav fits without scrolling. */
.nav { gap:1px; }
.nav-item, .nav-group > .gh { padding:5px 10px 5px 6px; font-size:14px; }
.ni { width:30px; height:30px; }
.ng-body .nav-item { padding:4px 10px 4px 8px; font-size:13px; }
.ng-body .nav-item .ni { width:27px; height:27px; }
