:root {
  --bg: #f6f7f9; --card: #fff; --text: #1f2328; --muted: #6b7280; --line: #e5e7eb;
  --brand: #2563eb; --active: #16a34a; --away: #f59e0b; --unk: #60a5fa; --off: #e5e7eb; --err: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
main.narrow { max-width: 520px; padding-top: 48px; }
h1 { font-size: 22px; margin: 0 0 16px; } h2 { font-size: 17px; margin: 0 0 12px; }
a { color: var(--brand); }
.muted { color: var(--muted); font-weight: normal; } .small { font-size: 13px; } .strong { font-weight: 600; }
.error { color: var(--err); background: #fef2f2; padding: 8px 12px; border-radius: 8px; }
.ok { color: #166534; background: #f0fdf4; padding: 8px 12px; border-radius: 8px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; }
.brand { font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--text); }
.topbar nav a:hover { color: var(--brand); }
.topbar form { margin: 0; }
.linklike { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; margin-bottom: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; color: var(--text); background: #fff; }
button, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff;
  color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
button:hover, .btn:hover { border-color: #9ca3af; }
.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.primary:hover { background: #1d4ed8; }
form.inline { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
form.inline.wrap { flex-wrap: wrap; }
form.inline label { flex-direction: column; }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h1 { margin: 0; }
.kpis { display: flex; gap: 16px; margin: 8px 0 16px; flex-wrap: wrap; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; min-width: 200px; }
.kpi .label, .stats .label { display: block; font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 600; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table.report { border-collapse: collapse; width: 100%; font-size: 14px; }
.report th, .report td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.report th { background: #f9fafb; font-weight: 600; font-size: 13px; color: #374151; vertical-align: bottom; }
.report tr:last-child td { border-bottom: 0; }
.report tr.absent td { background: #fcfcfd; }
.tl-cell { width: 38%; min-width: 320px; }

.timeline { position: relative; height: 18px; background: var(--off); border-radius: 4px; overflow: hidden; }
.timeline .seg { position: absolute; top: 0; bottom: 0; }
.seg.a { background: var(--active); } .seg.w { background: var(--away); } .seg.u { background: var(--unk); }
.scale { position: relative; height: 16px; margin-top: 4px; font-size: 11px; color: var(--muted); font-weight: normal; }
.scale span { position: absolute; transform: translateX(-50%); }
.scale span:first-child { transform: none; } .scale span:last-child { transform: translateX(-100%); }
.legend { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.legend .seg { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-left: 10px; }
.legend .seg.none { background: var(--off); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: #dcfce7; color: #166534; } .badge.away { background: #fef3c7; color: #92400e; }
.badge.off { background: #f3f4f6; color: #6b7280; } .badge.unk { background: #dbeafe; color: #1e40af; }

.keybox { border-color: #93c5fd; background: #eff6ff; }
.keybox pre { background: #111827; color: #e5e7eb; padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: 13px; }

/* Employee tracker page */
.tracker { text-align: center; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: #f3f4f6; font-weight: 600; margin: 8px 0 16px; }
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; }
.status-pill.active { background: #dcfce7; color: #166534; } .status-pill.active .dot { background: var(--active); }
.status-pill.idle, .status-pill.locked { background: #fef3c7; color: #92400e; }
.status-pill.idle .dot, .status-pill.locked .dot { background: var(--away); }
.status-pill.unknown { background: #dbeafe; color: #1e40af; } .status-pill.unknown .dot { background: var(--unk); }
.status-pill.off { background: #fee2e2; color: #991b1b; } .status-pill.off .dot { background: var(--err); }
.notice { background: #eff6ff; border-radius: 10px; padding: 14px; margin: 0 0 16px; }
.notice.warn { background: #fffbeb; color: #92400e; }
.notice p { margin: 0 0 10px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin: 8px 0 16px; }
.stats > div { background: #f9fafb; border-radius: 10px; padding: 12px 14px; }
.stats .value { font-size: 18px; font-weight: 600; }
.stats .value.big { font-size: 24px; color: var(--active); }
