@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --paper: #F5EFE4;
  --paper-2: #EFE7D6;
  --paper-3: #E8DFCB;
  --ink: #1F1A14;
  --ink-2: #3A3128;
  --ink-3: #6B5F4F;
  --ink-4: #9A8E7B;
  --rule: #D9CFB8;
  --rule-2: #C8BC9F;
  --accent: #B0451C;
  --accent-deep: #8A3413;
  --accent-soft: #F4E4D6;
  --ok: #4E6B3A;
  --ok-soft: #E4E9D6;
  --warn: #B08A1C;
  --warn-soft: #F4EAD0;
  --bad: #9A2B1C;
  --bad-soft: #F1DCD5;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(31,26,20,.08);
  --shadow-md: 0 6px 18px rgba(43,38,32,.12);
  --shadow-lg: 0 12px 30px rgba(43,38,32,.18);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html, body { margin: 0; padding: 0; background: #2B2620; font-family: var(--font-sans); color: var(--ink); }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ===== CANVAS & DEVICE FRAME ===== */
.canvas {
  width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  background:
    radial-gradient(1200px 800px at 20% 10%, #3a3229 0%, transparent 60%),
    radial-gradient(1000px 700px at 80% 90%, #34291f 0%, transparent 60%),
    #2B2620;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px;
}

.device {
  width: 422px;
  background: #0b0906;
  border-radius: 56px;
  padding: 16px;
  box-shadow:
    0 0 0 2px #1a1611,
    0 30px 80px rgba(0,0,0,.55),
    inset 0 0 0 1px rgba(255,255,255,.04);
  position: relative;
  flex: none;
}
.device::before, .device::after {
  content: ""; position: absolute; background: #1a1611;
}
.device::before { width: 3px; height: 90px; left: -3px; top: 180px; border-radius: 2px 0 0 2px; }
.device::after { width: 3px; height: 60px; right: -3px; top: 200px; border-radius: 0 2px 2px 0; }

.screen {
  width: 390px;
  background: var(--paper);
  border-radius: 44px;
  overflow: hidden;
  position: relative;
  min-height: 844px;
  display: flex;
  flex-direction: column;
}

/* ===== STATUS BAR ===== */
.statusbar {
  height: 54px;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 32px 10px;
  font-family: var(--font-sans); font-weight: 600; font-size: 15px; color: var(--ink);
  position: relative;
  background: var(--paper);
  flex: none;
}
.statusbar .right { display: flex; gap: 6px; align-items: center; }
.statusbar svg { display: block; }
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 34px; border-radius: 20px; background: #0b0906;
}

/* ===== HEADER ===== */
.header {
  padding: 14px 24px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
  flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 16px;
  letter-spacing: -.02em;
}
.brand-text { line-height: 1; }
.brand-text .t1 { font-family: var(--font-serif); font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -.01em; }
.brand-text .t1 em { font-style: italic; color: var(--accent); }
.brand-text .t2 { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .12em; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--paper-2);
  display: grid; place-items: center; color: var(--ink-2);
  position: relative;
}
.icon-btn:hover { background: var(--paper-3); }
.icon-btn:active { transform: scale(.95); }

/* ===== META STRIP ===== */
.meta-strip {
  padding: 12px 24px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex: none;
}
.meta-strip .who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #8A3413, #B0451C);
  color: #F5EFE4;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 600; font-size: 13px;
  border: 1px solid rgba(0,0,0,.1);
  flex: none;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.who .txt { line-height: 1.15; }
.who .n { font-family: var(--font-sans); font-weight: 600; font-size: 13px; color: var(--ink); }
.who .s { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.shift-info { text-align: right; line-height: 1.15; }
.shift-info .l { font-family: var(--font-mono); font-size: 9px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .14em; }
.shift-info .v { font-family: var(--font-serif); font-weight: 600; font-size: 13.5px; color: var(--ink); margin-top: 2px; letter-spacing: -.01em; }
.live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); margin-right: 6px;
  box-shadow: 0 0 0 3px var(--ok-soft);
  transform: translateY(-1px);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--ok-soft); }
  50% { box-shadow: 0 0 0 5px rgba(78,107,58,.15); }
}

/* ===== CONTENT AREA ===== */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ===== SECTION TITLE ===== */
.section-title { padding: 22px 24px 6px; }
.kicker {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  color: var(--accent); text-transform: uppercase; letter-spacing: .18em;
  display: flex; align-items: center; gap: 8px;
}
.kicker::before { content: ""; width: 18px; height: 1px; background: var(--accent); }
h1.title {
  font-family: var(--font-serif); font-weight: 500;
  font-size: 28px; line-height: 1.08; color: var(--ink);
  margin: 8px 0 4px; letter-spacing: -.02em;
}
h1.title em { font-style: italic; font-weight: 400; color: var(--accent-deep); }
.dek {
  font-family: var(--font-serif); font-style: italic; font-weight: 400;
  font-size: 14px; line-height: 1.5; color: var(--ink-3); max-width: 320px;
}

/* ===== BOTTOM NAV ===== */
.tabbar {
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding: 10px 12px 22px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  flex: none;
  position: relative;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px; border-radius: 12px;
  color: var(--ink-4);
  position: relative;
  transition: all .15s ease;
}
.tab .lbl {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
}
.tab.active { color: var(--accent-deep); background: var(--accent-soft); }
.tab.active .lbl { color: var(--accent-deep); }
.tab:hover:not(.active) { background: var(--paper-2); }
.tab:active { transform: scale(.95); }
.tab .icon svg { width: 18px; height: 18px; }
.tab .badge {
  position: absolute; top: 2px; right: 50%; transform: translateX(14px);
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--bad); color: #fff;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.home-ind {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 8px; width: 134px; height: 5px; border-radius: 3px;
  background: var(--ink); opacity: .85;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 15px 16px; border-radius: 14px;
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: -.005em; border: 1px solid transparent;
  transition: all .15s ease;
  width: 100%;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: var(--ink); color: var(--paper);
  box-shadow: 0 8px 18px rgba(31,26,20,.28), inset 0 1px 0 rgba(255,255,255,.06);
}
.btn.primary:hover { background: var(--ink-2); }
.btn.accent {
  background: var(--accent); color: #F5EFE4;
  box-shadow: 0 8px 18px rgba(176,69,28,.25);
}
.btn.accent:hover { background: var(--accent-deep); }
.btn.ghost {
  background: var(--paper); color: var(--ink-2);
  border-color: var(--rule-2);
}
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger {
  background: transparent; color: var(--bad); border-color: #E5C7BE;
}
.btn.danger:hover { background: var(--bad-soft); }
.btn.ok {
  background: var(--ok); color: #F5EFE4;
  box-shadow: 0 6px 14px rgba(78,107,58,.25);
}
.btn.ok:hover { background: #3d5a2e; }
.btn.warn-btn {
  background: var(--warn); color: #fff;
  box-shadow: 0 6px 14px rgba(176,138,28,.25);
}
.btn.sm { padding: 10px 14px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 18px 20px; font-size: 16px; min-height: 56px; }
.btn .icon { display: inline-flex; }
.btn .icon svg { width: 16px; height: 16px; }

/* ===== CHIPS ===== */
.chip {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px;
  background: var(--paper-2); color: var(--ink-2);
  border: 1px solid var(--rule);
  display: inline-flex; align-items: center; gap: 4px;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-deep); border-color: #E8CDB8; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: #C5D4B0; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: #E5C7BE; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #D9CC9F; }

/* ===== STATUS CHIPS ===== */
.status-chip {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 5px;
}
.status-chip.approved { background: var(--ok-soft); color: var(--ok); }
.status-chip.checkedin { background: #D6E4E9; color: #2E5A6B; }
.status-chip.checkedout { background: var(--paper-2); color: var(--ink-3); }
.status-chip.expired { background: var(--paper-3); color: var(--ink-4); }
.status-chip.denied { background: var(--bad-soft); color: var(--bad); }
.status-chip.unauthorized { background: var(--warn-soft); color: var(--warn); }
.status-chip.triggered { background: var(--bad-soft); color: var(--bad); }
.status-chip.acknowledged { background: var(--warn-soft); color: #8A6B14; }
.status-chip.resolved { background: var(--ok-soft); color: var(--ok); }

/* ===== CARDS ===== */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ===== SCANNER AREA ===== */
.scanner-wrap { padding: 18px 24px 0; }
.scanner-area {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11,9,6,.55), rgba(11,9,6,.35)),
    radial-gradient(circle at 30% 30%, #6b5137 0%, #2b2118 55%, #14100b 100%);
  border: 1px solid var(--rule-2);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,.04);
}
.scanner-area::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120px 60px at 22% 78%, rgba(255,220,180,.10), transparent 60%),
    radial-gradient(200px 120px at 80% 20%, rgba(255,180,120,.06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, transparent 2px 6px);
  pointer-events: none;
}
.reticle {
  position: absolute; inset: 16%; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(11,9,6,.35);
}
.corner {
  position: absolute; width: 26px; height: 26px;
  border: 2.5px solid var(--paper); border-radius: 4px;
}
.corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }
.scanline {
  position: absolute; left: 16%; right: 16%; top: 16%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, #F4B285 50%, var(--accent) 80%, transparent);
  box-shadow: 0 0 18px rgba(176,69,28,.75);
  animation: scan 2.4s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes scan {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(220px); }
}
.scan-status {
  position: absolute; top: 12px; left: 12px;
  background: rgba(11,9,6,.55);
  backdrop-filter: blur(8px);
  color: var(--paper); border: 1px solid rgba(245,239,228,.14);
  border-radius: 999px; padding: 6px 11px 6px 9px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
}
.scan-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(176,69,28,.25);
  animation: pulse2 1.2s ease-in-out infinite;
}
@keyframes pulse2 {
  0%, 100% { box-shadow: 0 0 0 3px rgba(176,69,28,.25); }
  50% { box-shadow: 0 0 0 6px rgba(176,69,28,.05); }
}
.scan-hint {
  position: absolute; top: 12px; right: 12px;
  color: var(--paper);
  font-family: var(--font-serif); font-style: italic; font-size: 12px;
  background: rgba(11,9,6,.35);
  backdrop-filter: blur(6px);
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(245,239,228,.12);
}

/* ===== SCAN RESULT CARDS ===== */
.result-card {
  margin: 12px 24px;
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: slideUp .3s ease-out;
}
.result-card.accepted {
  background: linear-gradient(180deg, var(--ok-soft) 0%, #d4dfc6 100%);
  border: 2px solid var(--ok);
}
.result-card.denied {
  background: linear-gradient(180deg, var(--bad-soft) 0%, #e5c7be 100%);
  border: 2px solid var(--bad);
}
.result-card.unauthorized {
  background: linear-gradient(180deg, var(--warn-soft) 0%, #e5d9a8 100%);
  border: 2px solid var(--warn);
}
.result-card .result-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 12px;
}
.result-card.accepted .result-icon { background: var(--ok); color: #fff; }
.result-card.denied .result-icon { background: var(--bad); color: #fff; }
.result-card.unauthorized .result-icon { background: var(--warn); color: #fff; }
.result-card .result-icon svg { width: 24px; height: 24px; }
.result-card .result-status {
  font-family: var(--font-serif); font-weight: 700; font-size: 22px;
  text-align: center; letter-spacing: -.01em; margin-bottom: 4px;
}
.result-card.accepted .result-status { color: var(--ok); }
.result-card.denied .result-status { color: var(--bad); }
.result-card.unauthorized .result-status { color: var(--warn); }
.result-card .result-detail {
  font-family: var(--font-serif); font-style: italic; font-size: 14px;
  text-align: center; color: var(--ink-3);
}
.result-card .result-info {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--rule-2);
}
.result-card .result-info .ri-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0;
}
.result-card .ri-row .ri-k {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .12em;
}
.result-card .ri-row .ri-v {
  font-family: var(--font-serif); font-size: 14px; color: var(--ink);
  font-weight: 500; text-align: right;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== DEMO SCAN BUTTONS ===== */
.demo-buttons {
  padding: 12px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.demo-btn {
  padding: 14px 10px; border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--rule);
  background: var(--paper-2); color: var(--ink-2);
  transition: all .15s ease;
  min-height: 56px;
}
.demo-btn:hover { background: var(--paper-3); box-shadow: var(--shadow-sm); }
.demo-btn:active { transform: scale(.96); }
.demo-btn.ok-demo { border-color: #C5D4B0; background: var(--ok-soft); color: var(--ok); }
.demo-btn.ok-demo:hover { background: #d4dfc6; }
.demo-btn.bad-demo { border-color: #E5C7BE; background: var(--bad-soft); color: var(--bad); }
.demo-btn.bad-demo:hover { background: #e5c0b6; }
.demo-btn.warn-demo { border-color: #D9CC9F; background: var(--warn-soft); color: var(--warn); }
.demo-btn.warn-demo:hover { background: #e5dcb8; }
.demo-btn .icon svg { width: 14px; height: 14px; }

/* ===== SCAN LOG ===== */
.scan-log { padding: 0 24px 16px; }
.scan-log-title {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  color: var(--ink-4); text-transform: uppercase; letter-spacing: .14em;
  padding: 10px 0 6px;
  display: flex; align-items: center; gap: 8px;
}
.scan-log-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule);
}
.scan-log-item:last-child { border-bottom: none; }
.scan-log-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.scan-log-dot.allowed { background: var(--ok); }
.scan-log-dot.denied-dot { background: var(--bad); }
.scan-log-body { flex: 1; min-width: 0; }
.scan-log-name {
  font-family: var(--font-serif); font-size: 13px; font-weight: 500;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-log-time {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 2px;
}
.scan-log-result {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}

/* ===== VISITOR LIST ===== */
.visitor-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  transition: background .1s;
}
.visitor-row:hover { background: var(--paper-2); }
.visitor-row:active { background: var(--paper-3); }
.visitor-row.unauthorized-row { border-left: 4px solid var(--warn); }
.visitor-info { flex: 1; min-width: 0; }
.visitor-name {
  font-family: var(--font-serif); font-size: 15px; font-weight: 500;
  color: var(--ink); line-height: 1.2;
}
.visitor-host {
  font-family: var(--font-sans); font-size: 12px; color: var(--ink-3);
  margin-top: 2px;
}
.visitor-time {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 4px;
}
.visitor-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ===== PATROL ===== */
.patrol-stepper { padding: 0 24px; }
.step {
  display: flex; gap: 14px; position: relative;
  padding-bottom: 4px;
}
.step::before {
  content: ""; position: absolute;
  left: 15px; top: 32px; bottom: 0;
  width: 2px; background: var(--rule);
}
.step:last-child::before { display: none; }
.step.done::before { background: var(--ok); }
.step.current::before { background: var(--accent); }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  border: 2px solid var(--rule); background: var(--paper);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--ink-4);
  transition: all .2s ease;
}
.step.done .step-dot {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.step.current .step-dot {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.step.missed .step-dot {
  background: var(--warn-soft); border-color: var(--warn); color: var(--warn);
}
.step-body {
  flex: 1; min-width: 0;
  padding-bottom: 20px;
}
.step-name {
  font-family: var(--font-serif); font-size: 14px; font-weight: 600;
  color: var(--ink); margin-bottom: 2px;
}
.step-loc {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .1em;
}
.step-ts {
  font-family: var(--font-mono); font-size: 9px; color: var(--ok);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 4px;
}
.step-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ===== SOS ===== */
.sos-card {
  margin: 8px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--paper);
  transition: box-shadow .15s;
}
.sos-card:hover { box-shadow: var(--shadow-md); }
.sos-card.triggered-card {
  border-color: var(--bad);
  background: linear-gradient(180deg, var(--bad-soft) 0%, var(--paper) 30%);
  animation: sosPulse 2s ease-in-out infinite;
}
@keyframes sosPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(154,43,28,0); }
  50% { box-shadow: 0 0 0 4px rgba(154,43,28,.15); }
}
.sos-card-header {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.sos-type-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
}
.sos-type-icon.fire-icon { background: #F4D6CD; color: var(--bad); }
.sos-type-icon.health-icon { background: #D6E9D6; color: var(--ok); }
.sos-type-icon.lift-icon { background: #D6DCE9; color: #3A4E6B; }
.sos-type-icon.other-icon { background: var(--warn-soft); color: var(--warn); }
.sos-type-icon .icon svg { width: 20px; height: 20px; }
.sos-card-info { flex: 1; min-width: 0; }
.sos-card-type {
  font-family: var(--font-serif); font-size: 15px; font-weight: 600;
  color: var(--ink); text-transform: capitalize;
}
.sos-card-reporter {
  font-family: var(--font-sans); font-size: 12px; color: var(--ink-3); margin-top: 1px;
}
.sos-card-loc {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .08em; margin-top: 3px;
}
.sos-card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
}
.sos-card-time {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .08em;
}

/* ===== COUNTDOWN ===== */
.countdown-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.countdown-circle {
  width: 80px; height: 80px; position: relative;
}
.countdown-circle svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.countdown-circle .bg { fill: none; stroke: var(--rule); stroke-width: 4; }
.countdown-circle .fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.countdown-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 22px; color: var(--accent);
}

/* ===== TIMELINE ===== */
.timeline { padding: 0 16px 12px; }
.timeline-item {
  display: flex; gap: 10px; padding: 6px 0;
  font-family: var(--font-sans); font-size: 12px; color: var(--ink-3);
}
.timeline-item .tl-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  margin-top: 5px;
}
.timeline-item .tl-label { flex: 1; }
.timeline-item .tl-ts {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink-4);
  letter-spacing: .06em;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(31,26,20,.6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-content {
  width: 390px;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp .3s ease-out;
}
.modal-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 20px;
  color: var(--ink); margin-bottom: 16px; letter-spacing: -.01em;
}
.modal-close {
  float: right; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--paper-2);
  display: grid; place-items: center; color: var(--ink-3);
}
.modal-close:hover { background: var(--paper-3); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 14px 20px;
  border-radius: 14px;
  font-family: var(--font-serif); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: toastIn .3s ease-out, toastOut .3s ease-in 2.2s forwards;
  display: flex; align-items: center; gap: 8px;
  max-width: 350px;
}
@keyframes toastIn { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* ===== ORNAMENT DIVIDER ===== */
.ornament {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px 6px; color: var(--ink-4);
}
.ornament .line { flex: 1; height: 1px; background: var(--rule); }
.ornament .sym {
  font-family: var(--font-serif); font-style: italic; font-size: 13px; color: var(--ink-3);
}

/* ===== LOGIN ===== */
.login-screen {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px;
  height: 100%;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 26px;
  margin-top: 40px;
}
.login-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 24px;
  color: var(--ink); margin-top: 16px; letter-spacing: -.02em;
}
.login-subtitle {
  font-family: var(--font-serif); font-style: italic; font-size: 14px;
  color: var(--ink-3); margin-top: 4px;
}
.guard-card {
  width: 100%; margin-top: 24px;
  padding: 16px; border-radius: var(--radius-lg);
  border: 2px solid var(--rule);
  background: var(--paper);
  display: flex; align-items: center; gap: 14px;
  transition: all .15s ease;
}
.guard-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.guard-card:active { transform: scale(.98); }
.guard-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.guard-card .gc-info { flex: 1; }
.guard-card .gc-name {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  color: var(--ink);
}
.guard-card .gc-id {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .1em; margin-top: 2px;
}
.guard-card .gc-shift {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px;
}
.gc-shift.day { background: var(--warn-soft); color: var(--warn); }
.gc-shift.night { background: #D6DCE9; color: #3A4E6B; }

/* ===== BOTTOM SHEET (for anomaly form) ===== */
.bottom-sheet-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(31,26,20,.6);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}
.bottom-sheet {
  width: 390px;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 20px 24px 32px;
  animation: slideUp .3s ease-out;
}
.bottom-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--rule-2); margin: 0 auto 16px;
}

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 14px; }
.form-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .14em;
  margin-bottom: 6px; display: block;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-md);
  background: var(--paper);
  font-family: var(--font-sans); font-size: 14px; color: var(--ink);
  transition: border-color .15s;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A8E7B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  padding: 40px 24px;
  text-align: center;
}
.empty-state .empty-icon {
  width: 48px; height: 48px; margin: 0 auto 12px;
  color: var(--ink-4);
}
.empty-state .empty-icon svg { width: 48px; height: 48px; }
.empty-state .empty-title {
  font-family: var(--font-serif); font-weight: 500; font-size: 18px;
  color: var(--ink-3);
}
.empty-state .empty-desc {
  font-family: var(--font-serif); font-style: italic; font-size: 13px;
  color: var(--ink-4); margin-top: 6px;
}

/* ===== PATROL SUMMARY ===== */
.patrol-summary {
  margin: 12px 24px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.patrol-summary-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  color: var(--ink); margin-bottom: 12px;
}
.patrol-stat {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dotted var(--rule);
}
.patrol-stat:last-child { border-bottom: none; }
.patrol-stat .ps-k {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .1em;
}
.patrol-stat .ps-v {
  font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--ink);
}

/* ===== CHECKPOINT FLASH ===== */
@keyframes checkpointFlash {
  0% { background: var(--ok); box-shadow: 0 0 20px rgba(78,107,58,.5); }
  100% { background: transparent; box-shadow: none; }
}
.flash-green { animation: checkpointFlash .4s ease-out; }

/* ===== SOS PULSE ===== */
.sos-pulse {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bad);
  animation: sosPulseDot 1.4s ease-in-out infinite;
}
@keyframes sosPulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(154,43,28,.4); }
  50% { box-shadow: 0 0 0 6px rgba(154,43,28,0); }
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.px-24 { padding-left: 24px; padding-right: 24px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
