/* GuardHouse SAI — light glass theme shared with the SAI Team PWA + Brain. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --text: #1c1c1c; --muted: rgba(28,28,28,.62); --muted-2: rgba(28,28,28,.40); --hero-text: #161616;
  --glass: rgba(250,250,250,.66); --card: rgba(20,20,20,.05);
  --stroke: rgba(20,20,20,.14); --stroke-soft: rgba(20,20,20,.08);
  --tint: rgba(20,20,20,.05); --shade-strong: rgba(20,20,20,.10);
  --pill: rgba(247,247,247,.94); --pill-hover: rgba(255,255,255,.99); --ink: #232323;
  --accent: #E5252D; --accent-hover: #c41a22; --error: #b5482e;
  --bg: radial-gradient(130% 120% at 72% 8%, #f4f4f4 0%, #e8e8e8 32%, #d6d6d6 62%, #c4c4c4 85%, #b6b6b6 100%), #d4d4d4;
  --overlay: radial-gradient(120% 110% at 70% 6%, rgba(255,255,255,.30) 0%, rgba(220,220,220,.10) 70%, rgba(200,200,200,.06) 100%), rgba(255,255,255,.10);
  --panel-shadow: 0 20px 48px rgba(40,40,40,.14), inset 0 1px 0 rgba(255,255,255,.55);
  --radius: 22px;
}
html, body { min-height: 100%; }
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; background: var(--bg); background-attachment: fixed; min-height: 100dvh; }
.bg-overlay { position: fixed; inset: 0; z-index: -1; background: var(--overlay); }
.app { display: flex; flex-direction: column; gap: 12px; padding: 12px; max-width: 1100px; margin: 0 auto; min-height: 100dvh; }
.panel { background: var(--glass); backdrop-filter: blur(34px) saturate(125%); -webkit-backdrop-filter: blur(34px) saturate(125%); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--panel-shadow); }
.topbar { display: flex; flex-direction: column; gap: 12px; padding: 13px 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { display: inline-flex; align-items: center; height: 36px; padding: 0 10px; background: #ededed; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.16); }
.logo img { height: 20px; width: auto; display: block; }
.brand-name { font-family: "Sora", sans-serif; font-weight: 500; font-size: 16px; letter-spacing: .2px; }
.who { font-size: 12.5px; color: var(--muted); margin-left: 4px; }
.brand-actions { margin-left: auto; display: flex; gap: 6px; }
.brand-actions[hidden] { display: none; }
.hdr-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--stroke); background: var(--pill); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.hdr-btn svg { width: 17px; height: 17px; }
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tabs[hidden] { display: none; }
.tab { font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 999px; padding: 8px 18px; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--text); background: var(--shade-strong); border-color: var(--tint); }
.content { padding: 18px 18px 24px; }
.loading { padding: 28px 6px; text-align: center; color: var(--muted); font-size: 14px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; min-height: 16px; }
.kpi-sub-error { color: var(--error); }
.kpi-refresh, .kpi-filter { font: inherit; font-size: 13px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--stroke); background: var(--pill); color: var(--text); cursor: pointer; }
.ghr-submit { background: var(--accent) !important; color: #fff !important; border-color: transparent !important; font-weight: 600; }
.pipe-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.pipe-stat { display: flex; flex-direction: column; gap: 4px; padding: 15px 16px; background: var(--card); border: 1px solid var(--stroke-soft); border-radius: 16px; }
.pipe-stat-num { font-family: "Sora", sans-serif; font-weight: 600; font-size: 26px; color: var(--hero-text); }
.pipe-stat-cap { font-size: 11.5px; color: var(--muted); letter-spacing: .2px; }
.pipe-stat-won .pipe-stat-num { color: #2e7d32; }
.pipe-stat-lost .pipe-stat-num { color: var(--error); }
.pipe-stat-warn .pipe-stat-num { color: #b26a00; }
/* login */
.login-wrap { max-width: 360px; margin: 24px auto; padding: 6px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-wrap .logo { align-self: center; margin-bottom: 4px; }
.login-wrap h2 { font-family: "Sora", sans-serif; font-weight: 500; font-size: 22px; }
.login-wrap p { font-size: 13px; line-height: 1.5; color: var(--muted); }
.login-wrap input { width: 100%; font: inherit; font-size: 14px; padding: 12px 14px; border-radius: 13px; border: 1px solid var(--stroke); background: var(--pill); color: var(--text); outline: none; }
.btn { font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--stroke); background: var(--pill); color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-block { width: 100%; display: block; }
.btn:disabled { opacity: .55; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; font-size: 13px; font-weight: 500; padding: 11px 18px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.toast.error { background: var(--accent); }
/* ============ GUARDHOUSE TAB (read-only mirror rollups) ============ */
#ghStats { margin-bottom: 18px; }
.gh-group { margin-bottom: 20px; }
.gh-group-head { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.gh-group-title { font-family: "Sora", sans-serif; font-weight: 600; font-size: 14px; color: var(--hero-text); }
.gh-chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px; white-space: nowrap;
}
.gh-chip-ok { background: rgba(123, 216, 143, .14); color: #7bd88f; }
.gh-chip-warn { background: rgba(231, 192, 110, .14); color: #e7c06e; }
.gh-chip-bad { background: rgba(255, 107, 107, .14); color: var(--error); }
.gh-chip-muted { background: var(--card); color: var(--muted); }
.gh-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--stroke-soft); border-radius: 12px;
}
.gh-row-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.gh-row-guard { font-size: 13px; color: var(--hero-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-row-site { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-row-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gh-empty { font-size: 12.5px; color: var(--muted); padding: 4px 2px; }
.gh-day-head { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 8px; }
.gh-day-name { font-family: "Sora", sans-serif; font-weight: 600; font-size: 14px; color: var(--hero-text); }
.gh-day-count { font-size: 11.5px; color: var(--muted); }
.gh-site-card {
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--stroke-soft); border-radius: 12px;
}
.gh-site-title { font-size: 12.5px; font-weight: 600; color: var(--hero-text); margin-bottom: 6px; }
.gh-site-shift { display: flex; gap: 12px; font-size: 12px; padding: 2px 0; }
.gh-site-guard { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-status-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.gh-table { border: 1px solid var(--stroke-soft); border-radius: 12px; overflow: hidden; }
.gh-table-row {
  display: grid; grid-template-columns: 1fr 80px 80px; gap: 10px;
  padding: 8px 12px; font-size: 12.5px; border-bottom: 1px solid var(--stroke-soft);
}
.gh-table-row:last-child { border-bottom: none; }
.gh-table-head { background: var(--card); font-weight: 600; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.gh-table-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Register a guard (GuardHouse tab) ---- */
.ghr-form { max-width: 720px; }
.ghr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.ghr-field { display: flex; flex-direction: column; gap: 4px; }
.ghr-label { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.ghr-input {
  padding: 9px 11px; font-size: 13px; border-radius: 10px;
  border: 1px solid var(--stroke-soft); background: var(--card); color: var(--hero-text);
}
.ghr-attest { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.ghr-reg-link { font-size: 12.5px; color: #7bb8ff; text-decoration: none; }
.ghr-attest-label { font-size: 12.5px; color: var(--hero-text); display: flex; align-items: center; gap: 8px; }
.ghr-submit { margin-top: 4px; }
.ghr-msg { font-size: 12.5px; margin: 6px 0; }
.ghr-err { color: var(--error); }
.ghr-warn { color: #e7c06e; }
.ghr-ok { color: #7bd88f; }
.ghr-list { margin-top: 22px; max-width: 720px; }

/* ---- Clients admin ---- */
.cl-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.cl-label { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.4px; margin:12px 0 5px; }
.cl-scope { display:flex; flex-direction:column; gap:8px; }
.cl-chips { display:flex; flex-wrap:wrap; gap:6px; }
.cl-chip { font-size:11.5px; padding:4px 10px; }
.cl-x { cursor:pointer; margin-left:4px; color:var(--error); }
.cl-sel { max-width:340px; padding:8px 10px; font-size:12.5px; }
.cl-small { font-size:12px; padding:6px 12px; white-space:nowrap; }
.cl-invite { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.cl-invite input { flex:1; min-width:180px; padding:9px 11px; font-size:13px; }
.cl-msg { font-size:12px; color:var(--muted); margin-top:6px; }
.cl-off { opacity:.55; }
.gh-site-card input.ghr-input { margin:6px 0; width:100%; }

.cl-approval { font-size:10px; font-weight:700; letter-spacing:.4px; padding:3px 9px; border-radius:999px; }
.cl-live { background:rgba(46,125,50,.14); color:#2e7d32; }
.cl-pending { background:rgba(178,106,0,.14); color:#b26a00; }
/* KPI scorecard (Clients tab) */
.cl-kpi-toggle { cursor:pointer; user-select:none; }
.cl-kpi-bar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:4px 0 10px; }
.cl-kpi-table .gh-table-row { display:grid; grid-template-columns:1.5fr .6fr .8fr 1fr 1.6fr .7fr; gap:8px; align-items:center; }
.cl-kpi-in { font-size:12px; padding:6px 8px; min-width:0; }
.cl-kpi-target, .cl-kpi-ytd { font-size:12px; color:var(--muted); }
@media (max-width:720px) { .cl-kpi-table .gh-table-row { grid-template-columns:1fr 1fr; } .cl-kpi-table .gh-table-head { display:none; } }
\n.cl-signed { background:rgba(46,125,50,.14); color:#2e7d32; border-color:rgba(46,125,50,.35); }\n.cl-demo { background:rgba(124,58,237,.12); color:#6d28d9; margin-left:6px; }\n.cl-comp { display:flex; flex-wrap:wrap; gap:6px 16px; margin:4px 0 6px; }\n.cl-check { font-size:13px; display:inline-flex; align-items:center; gap:4px; cursor:pointer; }\n