:root {
  --bg: #060d1a;
  --panel: #0e1525;
  --panel-alt: #111d2e;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.15);
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: rgba(15,118,110,0.18);
  --warm: #d97706;
  --warm-soft: rgba(217,119,6,0.15);
  --danger: #ef4444;
  --sidebar-bg: #111827;
  --sidebar-bg-2: #1f2937;
  --sidebar-text: #cbd5e1;
  --sidebar-text-muted: #94a3b8;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active-bg: #0f766e;
  --sidebar-active-text: #f8fafc;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background: var(--bg);
}
a { color: var(--accent); }
.shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Top navigation bar ────────────────────────────────── */
.topnav {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  height: 48px;
  padding: 0 10px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav-logo-wrap {
  display: flex;
  align-items: center;
  margin-right: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.topnav-logo-img {
  height: 30px;
  width: auto;
}
#nav {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  gap: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
  scrollbar-width: none;
}
#nav::-webkit-scrollbar { display: none; }
.topnav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  min-width: 0;
}
.topnav-who {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 6px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.company-switcher select {
  height: 30px;
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 8px;
  font: inherit;
}
.company-create {
  font-size: 12px !important;
  padding: 0 7px !important;
}
.topnav-signout {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  border-left: 1px solid var(--line) !important;
  margin-left: 4px;
  padding: 0 10px !important;
  height: 100% !important;
  border-bottom: none !important;
}
.topnav-signout:hover { color: var(--text) !important; }
.content { padding: 24px; display: grid; gap: 16px; min-width: 0; }
.mobile-shell { display: none; }
.mobile-appbar {
  padding: 12px;
  display: grid;
  gap: 10px;
}
.mobile-appbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mobile-brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}
.mobile-brand-copy {
  min-width: 0;
}
.mobile-brand-copy .eyebrow {
  margin-bottom: 2px;
}
.mobile-brand-copy strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.1;
}
.mobile-primary-nav,
.mobile-secondary-nav {
  display: grid;
  gap: 8px;
}
.mobile-primary-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mobile-secondary-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mobile-shell .nav-btn {
  width: 100%;
  min-width: 0;
  text-align: center;
  padding: 10px 8px;
}
.mobile-shell .btn {
  white-space: nowrap;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(53, 42, 26, .08);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
}
/* card-header as first child inside a stack — no top gap needed */
.stack > .card-header:first-child,
.panel-shell > .card-header:first-child {
  margin-top: 0;
}
.auth-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-shell .card, .auth-card { width: min(520px, 100%); }
h1, h2, h3, h4 { margin-top: 0; font-weight: 700; }
.who-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--warm); margin: 0 0 8px; }
.hero { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.hero-note { min-width: 220px; max-width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-alt); display: grid; gap: 6px; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 14px; }
.stack { display: grid; gap: 12px; }
.stack.compact { gap: 8px; }
label { display: grid; gap: 6px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); }
input, select, button { font: inherit; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-alt);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}
input:disabled, select:disabled { opacity: 0.55; background: var(--panel-alt); cursor: not-allowed; }
.form-group { display: grid; gap: 6px; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--ink); }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--panel-alt);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, opacity 0.15s ease;
}
.btn:hover { background: rgba(255,255,255,0.07); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn:disabled, .btn[disabled] { opacity: 0.48; pointer-events: none; cursor: not-allowed; }

/* Variants */
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(15, 118, 110, .22); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 6px 18px rgba(15, 118, 110, .28); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(185, 28, 28, .18); }
.btn.danger:hover { background: #991b1b; border-color: #991b1b; box-shadow: 0 6px 18px rgba(185, 28, 28, .26); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: rgba(0,0,0,.04); border-color: var(--line-strong); }
.btn.ghost.is-active {
  background: rgba(34,197,94,0.10);
  border-color: #16a34a;
  color: #166534;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .18);
}
.btn.ghost.is-active::after {
  content: "OK";
  font-weight: 700;
  font-size: .72rem;
}

/* Sizes */
.btn.sm { padding: 6px 11px; font-size: 0.8rem; }
.btn.lg { padding: 13px 22px; font-size: 1rem; }
.btn.block { width: 100%; justify-content: center; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.muted { color: var(--muted); }
.alert { padding: 12px; border-radius: 10px; }
.alert.error { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert.success { background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.nav-btn {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 100%;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-alt);
  font-weight: 600;
}
.report-mode-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 14px;
}
.record-item, .report-item, .list-card, .mini-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.record-item.flagged, .mini-card.warn { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.record-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.record-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── Matched Records Table ───────────────────────────────── */
.records-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.records-table thead th { background: var(--panel-alt); color: var(--text-muted); font-weight: 500; font-size: 12px; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.records-table thead th:last-child { text-align: right; }
.records-table tbody tr { border-bottom: 1px solid var(--line); transition: background 0.1s; }
.records-table tbody tr:last-child { border-bottom: none; }
.records-table tbody tr:hover { background: var(--panel-alt); }
.records-table tbody tr.row-flagged td:first-child { border-left: 3px solid #e24b4a; }
.records-table tbody tr.row-missing td:first-child { border-left: 3px solid #ef9f27; }
.records-table tbody td { padding: 10px 12px; vertical-align: middle; }
.rec-name { font-weight: 500; color: var(--text); }
.rec-site { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rec-time { color: var(--text); white-space: nowrap; }
.rec-dist { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rec-missing { color: var(--text-muted); font-style: italic; }
.rec-hours { font-weight: 500; color: var(--text); }
.rbadge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.rbadge-ok   { background: rgba(34,197,94,0.12); color: #86efac; }
.rbadge-flag { background: rgba(239,68,68,0.12); color: #f87171; }
.rbadge-open { background: rgba(245,158,11,0.12); color: #fbbf24; }
.rbadge-emrg { background: rgba(236,72,153,0.12); color: #f9a8d4; }
@media (prefers-color-scheme: dark) {
  .rbadge-ok   { background: #173404; color: #c0dd97; }
  .rbadge-flag { background: #501313; color: #f09595; }
  .rbadge-open { background: #412402; color: #fac775; }
  .rbadge-emrg { background: #4b1528; color: #ed93b1; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}
.kpi strong { display: block; font-size: 28px; margin-top: 6px; }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.report-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.billing-summary-list {
  display: grid;
  gap: 14px;
}
.billing-summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
}
.billing-summary-head {
  padding: 16px 18px 14px;
  background: linear-gradient(180deg, #eef8e7, #e4f2db);
  border-bottom: 1px solid var(--line);
}
.billing-summary-head h4 {
  margin: 0 0 8px;
}
.billing-summary-head .muted {
  margin-top: 6px;
}
.billing-summary-extras {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
}
.billing-summary-body {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}
.billing-summary-employee {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel);
}
.billing-summary-employee strong {
  display: block;
  margin-bottom: 4px;
}
.invoice-breakdown h3 {
  margin: 2px 0 4px;
  font-size: 22px;
  color: #0b2f2a;
}
.invoice-screen-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 10px;
  border-bottom: 2px solid var(--accent);
}
.invoice-brand {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.invoice-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.invoice-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel-alt);
}
.invoice-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.invoice-stat strong {
  margin-top: 3px;
  font-size: 15px;
}
.invoice-card {
  border-radius: 8px;
  line-height: 1.45;
}
.invoice-site-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,118,110,0.10);
}
.invoice-site-head > strong {
  font-size: 16px;
  color: #0b2f2a;
}
.invoice-site-total {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.invoice-site-total span {
  display: block;
}
.invoice-site-total strong {
  display: block;
  color: #0b2f2a;
  font-size: 16px;
}
.invoice-site-body {
  padding: 12px 14px 14px;
}
.invoice-line,
.invoice-extra,
.invoice-emp-title,
.invoice-emp {
  margin-top: 4px;
}
.invoice-emp-title {
  font-weight: 700;
  margin-top: 10px;
  color: #0b2f2a;
}
.invoice-employee-list {
  display: grid;
  border-top: 1px solid var(--line);
}
.invoice-emp {
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.invoice-emp:last-child {
  border-bottom: 0;
}
.users-workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.users-form-panel {
  position: sticky;
  top: 18px;
}
.users-list-panel {
  min-width: 0;
}
.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.users-filters {
  grid-template-columns: minmax(220px, 1.6fr) minmax(180px, .8fr);
  margin-bottom: 12px;
}
.panel-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--panel);
}
.schedule-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, .96);
  backdrop-filter: blur(6px);
}
.schedule-toolbar .row {
  align-items: end;
}
.schedule-toolbar label {
  min-width: 180px;
}
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.schedule-day {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  display: grid;
  grid-template-rows: auto 1fr;
}
.schedule-day-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
  border-radius: 14px 14px 0 0;
  display: grid;
  gap: 4px;
}
.schedule-day-body {
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.schedule-shift {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  gap: 4px;
}
.schedule-shift.is-published {
  border-color: #9ed7d1;
  background: rgba(15,118,110,0.12);
}
.schedule-shift.is-draft {
  border-style: dashed;
  background: rgba(245,158,11,0.10);
}
.schedule-banner-published {
  background: rgba(34,197,94,0.10);
  border-color: #86efac;
  color: #166534;
}
.schedule-banner-draft {
  background: rgba(217,119,6,0.10);
  border-color: #fdba74;
  color: #9a3412;
}
.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
}
.legend-published { background: rgba(34,197,94,0.12); border-color: #22c55e; }
.legend-draft { background: rgba(217,119,6,0.12); border-color: #d97706; }
.legend-open { background: rgba(245,158,11,0.08); border-color: #f59e0b; border-style: dashed; }
.legend-busy { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); }
.legend-timeoff { background: rgba(59,130,246,0.12); border-color: #60a5fa; }
.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.schedule-board-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.schedule-matrix {
  display: grid;
  grid-template-columns: 180px repeat(7, minmax(145px, 1fr));
  min-width: 1195px;
}
.schedule-matrix-corner,
.schedule-col-head,
.schedule-row-head,
.schedule-cell {
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.schedule-matrix-corner {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--panel-alt);
  display: grid;
  gap: 6px;
}
.schedule-col-head {
  background: var(--panel-alt);
  display: grid;
  gap: 4px;
  text-align: center;
}
.schedule-col-head.is-today {
  background: rgba(14,165,233,0.10);
}
.schedule-row-head {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  display: grid;
  gap: 4px;
}
.schedule-row-head.is-current-user {
  background: rgba(6,182,212,0.10);
}
.schedule-row-head.is-open-row {
  background: rgba(217,119,6,0.10);
}
.schedule-cell {
  min-height: 94px;
  background: var(--panel);
  display: grid;
  gap: 6px;
  align-content: start;
  position: relative;
  outline: 1px solid rgba(255,255,255,0.03);
}
.schedule-cell.is-today {
  background: rgba(59,130,246,0.10);
}
.schedule-cell.is-current-user {
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, .08);
}
.schedule-cell.is-time-off {
  background: var(--panel-alt);
}
.schedule-cell.is-drop-target {
  outline: 2px solid #0f766e;
  outline-offset: -2px;
  background: rgba(34,197,94,0.10);
}
.shift-pill {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(20,184,166,0.5);
  background: rgba(15,118,110,0.18);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.25;
  color: #e2e8f0;
}
.shift-pill.is-dragging {
  opacity: .55;
}
.shift-pill strong {
  font-size: 12px;
  color: #f1f5f9;
}
.shift-pill.is-draft {
  border-color: rgba(251,191,36,0.5);
  background: rgba(217,119,6,0.15);
  color: #fcd34d;
}
.shift-pill.is-open {
  border-style: dashed;
  border-color: #f59e0b;
}
.shift-pill.is-cancelled {
  opacity: .7;
  text-decoration: line-through;
  border-color: #cbd5e1;
  background: var(--panel-alt);
}
.schedule-add {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(15,118,110,0.6);
  background: rgba(15,118,110,0.25);
  color: #5eead4;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.schedule-add:hover {
  background: rgba(15,118,110,0.5);
  color: #fff;
  border-color: #0f766e;
}
.busy-pill,
.timeoff-chip {
  padding: 5px 7px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.25;
}
.busy-pill {
  background: var(--panel-alt);
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
}
.timeoff-chip {
  background: rgba(59,130,246,0.10);
  border: 1px solid rgba(96,165,250,0.4);
  color: #93c5fd;
}
/* ── Compact schedule toolbar ──────────────────────────── */
.sched-ctb {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: -20px -20px 16px;
  padding: 0 16px;
  height: 40px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}
.sched-ctb-grp { display: flex; align-items: center; gap: 4px; }
.sched-ctb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 10px; flex-shrink: 0; }
.sched-ctb-pill {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  height: 26px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.sched-ctb-pill:hover { border-color: var(--accent); }
.sched-ctb-date {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  height: 26px;
  width: 112px;
  color: var(--text);
  background: var(--panel);
}
.sched-ctb-select {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  height: 26px;
  color: var(--text);
  background: var(--panel);
  max-width: 200px;
}
.sched-ctb-stat {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.sched-ctb-link {
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 8px;
  height: 40px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  transition: color 0.12s;
}
.sched-ctb-link:hover { color: var(--text); }
.sched-ctb-publish { color: var(--accent); font-weight: 500; border-bottom-color: var(--accent); }
.sched-ctb-publish:hover { color: #0a5c56; }
.sched-ctb-danger { color: var(--danger); border-bottom-color: rgba(185, 28, 28, .35); }
.sched-ctb-danger:hover { color: #991b1b; border-bottom-color: #991b1b; }

/* ── Shift modal ───────────────────────────────────────── */
.shift-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 16px;
}
.shift-modal-overlay.hidden { display: none; }
.shift-modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}
.shift-modal-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* ── OFF label on empty schedule cells ─────────────────── */
.schedule-off-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(148,163,184,0.5);
  letter-spacing: .05em;
  text-transform: uppercase;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}
/* ── Row head extra info ───────────────────────────────── */
.schedule-row-head .row-shifts-count {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
/* ── Color-coded shift pills ───────────────────────────── */
.shift-pill.color-1 { border-left: 3px solid #6366f1; }
.shift-pill.color-2 { border-left: 3px solid #0ea5e9; }
.shift-pill.color-3 { border-left: 3px solid #10b981; }
.shift-pill.color-4 { border-left: 3px solid #f59e0b; }
.shift-pill.color-5 { border-left: 3px solid #ef4444; }
.shift-pill.color-6 { border-left: 3px solid #8b5cf6; }
.shift-pill.color-7 { border-left: 3px solid #ec4899; }
.shift-pill.color-8 { border-left: 3px solid #14b8a6; }
.schedule-self-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.schedule-self-day {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  overflow: hidden;
}
.schedule-self-day.is-past {
  opacity: .72;
}
.schedule-self-day.is-today .schedule-self-head {
  background: rgba(14,165,233,0.10);
}
.schedule-self-head {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.schedule-self-body {
  padding: 10px;
  display: grid;
  gap: 6px;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .35);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  width: min(1100px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}
.schedule-template-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}
.admin-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-alt);
}
.admin-view-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.admin-view-btn:hover {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.25);
}
.admin-view-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.admin-stage {
  min-width: 0;
}
.admin-sheet {
  display: block;
}
.admin-workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.admin-workspace-single {
  grid-template-columns: minmax(0, 520px);
}
.admin-panel { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--panel); }
.admin-form-panel {
  position: sticky;
  top: 18px;
}
.admin-list-panel {
  min-width: 0;
}
.section-head.slim {
  margin-bottom: 10px;
}
.inline-check { display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 14px; }
.list-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  margin: 2px 6px 2px 0;
  font-size: 12px;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.role-badge-super {
  background: rgba(217,119,6,0.10);
  border-color: #fdba74;
  color: #9a3412;
}
.hidden { display: none !important; }

@media (min-width: 1180px) {
  .content {
    padding: 18px 20px;
    gap: 12px;
  }
  .card {
    padding: 16px 18px;
    border-radius: 20px;
  }
  .hero {
    gap: 14px;
  }
  .hero-note {
    min-width: 260px;
    max-width: 340px;
    padding: 12px;
  }
  .section-head {
    margin-bottom: 10px;
  }
  .summary,
  .panel-shell,
  .record-item,
  .report-item,
  .list-card,
  .mini-card {
    padding: 10px 12px;
    border-radius: 16px;
  }
  .billing-summary-card {
    border-radius: 16px;
  }
  .filters {
    gap: 8px;
    margin-bottom: 10px;
  }
  .kpi-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
  }
  .kpi {
    min-height: 118px;
    padding: 14px 16px;
    border-radius: 18px;
  }
  .kpi strong {
    font-size: 24px;
    margin-top: 4px;
  }
  .dashboard-grid,
  .report-columns {
    gap: 10px;
  }
  .dashboard-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  #tab-dashboard .stack,
  #tab-report .stack,
  #tab-users .stack,
  #tab-admin .stack {
    gap: 10px;
  }
  #tab-dashboard h3,
  #tab-report h3,
  #tab-users h3,
  #tab-admin h3 {
    margin-bottom: 6px;
  }
  .users-workspace,
  .admin-workspace,
  .admin-workspace-single,
  .compact-grid {
    gap: 10px;
  }
}

@media (min-width: 1280px) {
  .content {
    padding: 16px 22px;
    gap: 14px;
    align-items: start;
  }

  /* Clock tab — controls left, status right */
  #tab-clock .stack {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 20px;
    align-items: start;
  }
  #tab-clock #permission-bar {
    grid-column: 1 / -1;
  }
  #tab-clock #clock-status,
  #tab-clock #clock-result {
    grid-column: 1 / -1;
  }

  /* Records tab — list left, unmatched right */
  #tab-records {
    display: grid;
    grid-template-rows: auto auto auto;
  }
  #tab-records .section-head { grid-column: 1 / -1; }
  #tab-records .filters { grid-column: 1 / -1; }
  #tab-records-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 14px;
    align-items: start;
  }
  #records-summary { grid-column: 1 / -1; }

  /* Profile tab — 2 column form */
  #tab-profile .stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
  }
  #tab-profile .stack h4,
  #tab-profile .stack hr,
  #tab-profile .stack .row,
  #tab-profile .stack .alert,
  #tab-profile .stack .panel-shell {
    grid-column: 1 / -1;
  }

  /* Tighter kpi cards */
  .kpi-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .kpi strong { font-size: 22px; }

  /* Admin workspace wider form panel */
  .admin-workspace {
    grid-template-columns: 400px minmax(0, 1fr);
  }
}

@media (min-width: 1600px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }
  .content {
    padding: 18px 28px;
    max-width: 1600px;
  }
  .admin-workspace {
    grid-template-columns: 440px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 12px; }
  .content { padding: 16px; }
  .card { padding: 16px; }
  #nav { overflow-x: auto; }
  .topnav { padding: 0 12px; }
  .topnav-who { display: none; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid, .dashboard-grid, .report-columns { grid-template-columns: 1fr; }
  .users-workspace, .compact-grid { grid-template-columns: 1fr; }
  .users-form-panel, .admin-form-panel { position: static; }
  .admin-workspace, .admin-workspace-single { grid-template-columns: 1fr; }
  .admin-toolbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px;
  }
  .admin-view-btn {
    white-space: nowrap;
  }
  .schedule-toolbar .row { flex-wrap: nowrap; overflow-x: auto; }
  .schedule-toolbar label { min-width: 200px; }
  .schedule-template-layout { grid-template-columns: 1fr; }
  .shift-modal-card { max-width: 100%; border-radius: 12px; }
  .schedule-self-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1380px) {
  .topnav-logo-img { height: 24px; }
  .topnav-logo-wrap { margin-right: 6px; }
  .nav-btn { padding-left: 8px; padding-right: 8px; }
  .role-badge-super { padding-left: 8px; padding-right: 8px; }
  .company-switcher span { display: none; }
  .company-switcher select { max-width: 145px; }
  .topnav-who { max-width: 150px; }
}

@media (max-width: 1180px) {
  .topnav-right { gap: 2px; }
  .topnav-who { display: none; }
  .company-switcher select { max-width: 130px; }
  .company-create { display: none !important; }
}

@media (max-width: 640px) {
  .shell {
    min-height: auto;
  }
  .app-authenticated .shell {
    display: block;
    min-height: auto;
  }
  .app-authenticated .topnav {
    display: none;
  }
  .app-authenticated .mobile-shell {
    display: block;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .app-authenticated .mobile-appbar {
    border-radius: 0 0 18px 18px;
    background: rgba(14, 21, 37, .97);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  }
  .app-authenticated .content {
    padding: 0 10px 12px;
    gap: 10px;
  }
  .app-authenticated #view-app {
    display: grid;
    gap: 10px;
  }
  .content { padding: 12px; gap: 12px; }
  .card { padding: 14px; border-radius: 16px; }
  .brand-logo { max-width: 180px; }
  .brand-block .muted { font-size: 13px; }
  .sidebar {
    gap: 10px;
  }
  .app-authenticated .brand-block {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
  }
  .app-authenticated .mobile-primary-nav .nav-btn,
  .app-authenticated .mobile-secondary-nav .nav-btn {
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.15;
  }
  .app-authenticated .sched-ctb {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    gap: 6px;
  }
  .app-authenticated .admin-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px;
    gap: 6px;
    scrollbar-width: none;
  }
  .app-authenticated .admin-toolbar::-webkit-scrollbar {
    display: none;
  }
  .app-authenticated .admin-view-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .app-authenticated .hero {
    display: none;
  }
  .who-line h2 {
    font-size: 1.5rem;
    line-height: 1.15;
    word-break: break-word;
  }
  .who-line {
    gap: 6px;
  }
  .eyebrow {
    margin-bottom: 4px;
  }
  .hero .muted {
    font-size: 14px;
    line-height: 1.35;
  }
  .hero > div:first-child,
  .hero-note {
    min-width: 0;
    width: 100%;
  }
  .hero-note {
    padding: 12px;
  }
  #nav {
    gap: 5px;
  }
  .nav-btn {
    padding: 9px 12px;
    font-size: 14px;
  }
  .section-head,
  .record-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .filters,
  .users-filters,
  .compact-grid {
    grid-template-columns: 1fr;
  }
  .app-authenticated .record-actions,
  .app-authenticated .list-actions {
    flex-direction: column;
  }
  .app-authenticated .record-actions > *,
  .app-authenticated .list-actions > * {
    width: 100%;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .row .btn,
  .row button,
  .row a {
    width: 100%;
    text-align: center;
  }
  .kpi strong { font-size: 24px; }
  .app-authenticated .schedule-self-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .app-authenticated .modal {
    padding: 10px 10px 0;
    align-items: end;
  }
  .app-authenticated .modal-card {
    width: 100%;
    max-height: calc(100vh - 10px);
  }
  .app-authenticated #tab-clock,
  .app-authenticated #tab-profile,
  .app-authenticated #tab-schedule,
  .app-authenticated #tab-records,
  .app-authenticated #tab-dashboard,
  .app-authenticated #tab-report,
  .app-authenticated #tab-users,
  .app-authenticated #tab-admin {
    margin-top: 0;
  }
  .modal { padding: 10px; }
  .modal-card { padding: 14px; }
  .auth-card { width: 100%; }
}

@media (max-width: 480px) {
  .sidebar { gap: 10px; }
  .brand-block { gap: 8px; }
  .brand-logo { max-width: 135px; }
  .brand-block .muted { display: none; }
  #nav { padding: 6px; border-radius: 12px; }
  .nav-btn { padding: 8px 11px; font-size: 14px; }
  .sidebar-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sidebar-actions .btn:last-child { grid-column: 1 / -1; }
  .hero {
    gap: 12px;
  }
  .app-authenticated .hero {
    display: none;
  }
  .hero-note {
    display: none;
  }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.35rem; }
  .eyebrow {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .app-authenticated .eyebrow {
    font-size: 10px;
    letter-spacing: .08em;
  }
  .app-authenticated .hero p.muted {
    display: none;
  }
  .app-authenticated .hero-note {
    display: none;
  }
  .app-authenticated .card {
    border-radius: 14px;
  }
  .app-authenticated .content {
    padding: 0 8px 10px;
    gap: 8px;
  }
  .app-authenticated .mobile-appbar {
    padding: 10px 8px;
    border-radius: 0 0 16px 16px;
    gap: 8px;
  }
  .app-authenticated .mobile-appbar-row {
    align-items: flex-start;
  }
  .app-authenticated .mobile-brand {
    gap: 8px;
  }
  .app-authenticated .mobile-brand-logo {
    width: 34px;
    height: 34px;
  }
  .app-authenticated .mobile-brand-copy strong {
    font-size: .98rem;
  }
  .app-authenticated #mobile-logout {
    width: auto;
    margin-top: 0;
    padding: 9px 12px;
  }
  .app-authenticated .schedule-toolbar {
    padding: 8px;
    gap: 8px;
    margin-bottom: 10px;
  }
  .app-authenticated .mobile-primary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-authenticated .mobile-secondary-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-authenticated .schedule-toolbar .btn {
    width: 100%;
  }
  .app-authenticated .section-head .muted,
  .app-authenticated .hero .eyebrow {
    display: none;
  }
  .app-authenticated .summary,
  .app-authenticated .panel-shell,
  .app-authenticated .mini-card,
  .app-authenticated .list-card,
  .app-authenticated .record-item,
  .app-authenticated .report-item,
  .app-authenticated .kpi {
    padding: 10px;
  }
  .app-authenticated .kpi strong {
    font-size: 24px;
  }
  .app-authenticated .section-head {
    margin-bottom: 8px;
  }
  .app-authenticated .stack {
    gap: 8px;
  }
  .app-authenticated h3 {
    font-size: 1.2rem;
    margin-bottom: 0;
  }
  .app-authenticated .modal {
    padding: 0;
  }
  .app-authenticated .modal-card {
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
  }
  .app-authenticated #tab-clock > .section-head,
  .app-authenticated #tab-profile > .section-head,
  .app-authenticated #tab-records > .section-head,
  .app-authenticated #tab-dashboard > .section-head,
  .app-authenticated #tab-report > .section-head,
  .app-authenticated #tab-users > .section-head,
  .app-authenticated #tab-admin > .section-head,
  .app-authenticated #tab-schedule > .section-head {
    margin-bottom: 6px;
  }
  .app-authenticated input,
  .app-authenticated select,
  .app-authenticated .btn {
    font-size: 16px;
  }
  .summary,
  .panel-shell,
  .mini-card,
  .list-card,
  .record-item,
  .report-item {
    padding: 10px 12px;
  }
  input,
  select,
  .btn { padding: 11px 12px; }
}

/* ── Mobile Today Schedule ───────────────────────────────────────────────── */
#schedule-mobile-today { display: none; }

/* Date bar */
.smt-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  padding: 14px 16px 12px;
}
.smt-nav-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.smt-nav-btn:active { background: rgba(255,255,255,0.28); }
.smt-date-label { text-align: center; flex: 1; }
.smt-weekday { color: rgba(255,255,255,0.75); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.smt-date { color: white; font-size: clamp(16px, 4vw, 20px); font-weight: 700; line-height: 1.2; }

/* Stats */
.smt-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 14px 14px;
  background: var(--accent);
}
.smt-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 4px;
}
.smt-stat-num { color: white; font-size: clamp(18px, 5vw, 22px); font-weight: 700; line-height: 1; }
.smt-num-on   { color: #bbf7d0; }
.smt-num-up   { color: #fde68a; }
.smt-stat-lbl { color: rgba(255,255,255,0.75); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }

/* Site filter chips */
.smt-chips {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.smt-chips::-webkit-scrollbar { display: none; }
.smt-chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  min-height: 34px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.smt-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Section headers */
.smt-section-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 10px 14px 4px;
}

/* Mobile admin schedule actions */
.smt-admin-actions {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 14px 4px;
}
.smt-admin-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.smt-admin-danger {
  color: var(--danger);
  border-color: rgba(185, 28, 28, .35);
}

/* List container */
.smt-list { padding-bottom: 16px; }

/* Guard card */
.smt-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 14px 8px;
  cursor: pointer;
  min-height: 64px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.12s;
}
.smt-card:active { background: var(--panel-alt); }

/* Avatar */
.smt-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.smt-av-on     { background: #16a34a; }
.smt-av-up     { background: var(--accent); }
.smt-av-done   { background: var(--muted); }
.smt-av-open   { background: #d97706; }
.smt-av-miss   { background: var(--danger); }

/* Info block */
.smt-info { flex: 1; min-width: 0; }
.smt-name { font-weight: 600; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smt-site { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }

/* Status badge */
.smt-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
}
.smt-badge-on     { background: #dcfce7; color: #166534; }
.smt-badge-up     { background: #dbeafe; color: #1e40af; }
.smt-badge-done   { background: var(--panel-alt); color: var(--muted); }
.smt-badge-open   { background: rgba(245,158,11,0.15); color: #fbbf24; }
.smt-badge-cancel { background: rgba(239,68,68,0.12); color: #f87171; }

/* Right column: time + hours */
.smt-right { text-align: right; flex-shrink: 0; }
.smt-time  { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.smt-hours { font-size: 11px; color: var(--muted); }

/* Empty state */
.smt-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 40px 20px;
}

/* ── Action Sheet ─────────────────────────────────────────────────────────── */
#smt-action-sheet {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
/* backdrop */
#smt-action-sheet .smt-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
/* card panel */
.smt-sheet-card {
  position: relative;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  animation: smt-slide-up 0.22s cubic-bezier(0.32,0.72,0,1) forwards;
}
@keyframes smt-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
/* handle bar */
.smt-sheet-card::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--line);
  border-radius: 9999px;
  margin: 0 auto 16px;
}
.smt-sheet-guard-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 2px;
}
.smt-sheet-guard-meta {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 18px;
}
.smt-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.smt-action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.12s;
  background: var(--panel-alt);
  color: var(--ink);
}
.smt-action-btn:active { opacity: 0.7; }
#smt-action-call   { background: rgba(34,197,94,0.15); color: #22c55e; }
#smt-action-reassign { background: rgba(245,158,11,0.15); color: #fbbf24; }
.smt-sheet-cancel {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Show mobile view, hide desktop schedule on small screens ─────────────── */
@media (max-width: 640px) {
  #schedule-mobile-today { display: block; }
  .app-authenticated #schedule-staff-view    { display: none !important; }
  .app-authenticated .sched-ctb              { display: none !important; }
  .app-authenticated #schedule-status-banner { display: none !important; }

  /* Strip card padding so the mobile view fills edge-to-edge */
  #tab-schedule.card {
    padding: 0;
    overflow: hidden;
  }
  /* List area keeps inner breathing room */
  #schedule-mobile-today .smt-chips,
  #schedule-mobile-today .smt-list,
  #schedule-mobile-today .smt-section-head { padding-left: 12px; padding-right: 12px; }
  .app-authenticated #schedule-mobile-today .smt-admin-actions:not(.hidden) { display: grid; }
  #schedule-mobile-today .smt-card { margin-left: 0; margin-right: 0; }
}


/* ══ Command Center ══════════════════════════════════════════════════════ */
.cc-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 100vh;
  background: #080c14;
}
.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #0e1525;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
}
.cc-header-left { display: flex; align-items: center; gap: 16px; }
.cc-header-right { display: flex; align-items: center; gap: 10px; }
.cc-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: #f1f5f9; }
.cc-clock { font-size: .88rem; color: #38bdf8; font-variant-numeric: tabular-nums; font-family: 'SF Mono', 'Fira Code', monospace; }
.cc-status { font-size: .78rem; color: #64748b; }

.cc-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.cc-kpi {
  background: #0e1525;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
#cc-kpi-duty   { border-top: 2px solid #22c55e; }
#cc-kpi-sites  { border-top: 2px solid #3b82f6; }
#cc-kpi-enroute{ border-top: 2px solid #f59e0b; }
#cc-kpi-review { border-top: 2px solid #ef4444; }
#cc-kpi-duty   .cc-kpi-val { color: #22c55e; }
#cc-kpi-sites  .cc-kpi-val { color: #60a5fa; }
#cc-kpi-enroute .cc-kpi-val { color: #fbbf24; }
#cc-kpi-review  .cc-kpi-val { color: #f87171; }
.cc-kpi-icon { font-size: 1rem; }
.cc-kpi-val  { font-size: 1.6rem; font-weight: 800; line-height: 1; color: #f1f5f9; }
.cc-kpi-label { font-size: .72rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.cc-grid { display: grid; grid-template-columns: 1fr 320px; gap: 12px; }
.cc-map-panel {
  background: #0e1525;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
#cc-map { height: 420px; width: 100%; min-height: 420px; }

.cc-side { display: flex; flex-direction: column; gap: 12px; }
.cc-panel {
  background: #0e1525;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  overflow: hidden;
  flex: 1;
}
.cc-panel-head {
  padding: 10px 14px;
  font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: #94a3b8;
  background: #0a1020;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 8px;
}
.cc-badge {
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .72rem; font-weight: 700; color: #94a3b8;
}
.cc-list {
  padding: 8px;
  display: flex; flex-direction: column; gap: 5px;
  max-height: 180px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.cc-activity-list { max-height: 160px; }
.cc-item {
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  font-size: .82rem; color: #cbd5e1;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.cc-item:hover { background: rgba(255,255,255,.06); }
.cc-item strong { display: block; font-size: .85rem; color: #f1f5f9; font-weight: 600; }
.cc-item-sub { color: #64748b; font-size: .76rem; margin-top: 1px; }
.cc-item-time { color: #475569; font-size: .73rem; white-space: nowrap; flex-shrink: 0; font-family: monospace; }
.cc-empty { padding: 20px; text-align: center; color: #334155; font-size: .83rem; }
.cc-shell .btn.ghost { border-color: rgba(255,255,255,.12); color: #94a3b8; }
.cc-shell .btn.ghost:hover { background: rgba(255,255,255,.07); color: #f1f5f9; }

/* Live dot */
.cc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 6px #22c55e88;
  display: inline-block; animation: cc-pulse 2s infinite;
}
.cc-dot.off { background: #334155; box-shadow: none; animation: none; }
@keyframes cc-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Leaflet dark theme — same approach as SentinelTrackerHQ */
.leaflet-container { background: #0a1025 !important; }
.leaflet-tile-pane { filter: brightness(0.7) contrast(1.1) saturate(0.3) hue-rotate(180deg) invert(1); }
.leaflet-control-zoom a { background: #0e1525 !important; color: #94a3b8 !important; border-color: rgba(255,255,255,0.1) !important; }
.leaflet-popup-content-wrapper { background: #0e1525 !important; color: #e2e8f0 !important; border: 1px solid rgba(255,255,255,0.1) !important; }
.leaflet-popup-tip { background: #0e1525 !important; }

@media (max-width: 900px) {
  .cc-kpis { grid-template-columns: repeat(2,1fr); }
  .cc-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cc-kpis { grid-template-columns: repeat(2,1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   PATROL TAB — Phase 4
   ═══════════════════════════════════════════════════════════════ */


/* Idle state */





/* Big start button */







/* Active patrol header */





/* Progress bar */





/* Checkpoint list */












/* QR Scanner overlay */




#patrol-qr-reader { border-radius: 12px; overflow: hidden; }









/* ── Feature toggle switches (Sites admin panel) ─────── */
.feature-toggles { display: grid; gap: 8px; }
.feature-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.feature-toggle:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.feature-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.feature-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}
.feature-toggle-icon { font-size: 1.2rem; }
.feature-toggle strong { display: block; font-size: 0.9rem; color: var(--ink); }
.feature-toggle-sub { font-size: 0.75rem; color: var(--muted); }

/* ── Patrol Admin Panel ──────────────────────────────── */


















.input-sm {
  background: var(--panel-alt);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--ink);
  padding: 6px 10px;
  font-size: .85rem;
}
.input-sm:focus { outline: none; border-color: var(--accent); }

/* ── Guard onboarding message box ───────────────────── */
.guard-onboarding-box {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(56, 189, 148, 0.08);
  border: 1px solid rgba(56, 189, 148, 0.25);
  font-size: .88rem;
  line-height: 1.6;
}
.onboarding-title {
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.guard-onboarding-box p { margin: 0 0 8px; color: var(--muted); }
.guard-onboarding-box code {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: monospace;
  color: var(--accent);
  font-size: .9em;
}
.onboarding-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.onboarding-steps li strong { color: var(--ink); }

/* ── Login page centering (unauthenticated state) ──────── */
body:not(.app-authenticated) .content {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  min-height: calc(100vh - 48px); /* 48px = topnav height */
}
@media (max-width: 640px) {
  body:not(.app-authenticated) .content {
    padding-top: 20px;
  }
}
