:root {
  --ink: #102033;
  --muted: #607085;
  --paper: #ffffff;
  --canvas: #f1f5f7;
  --line: #dce4e8;
  --teal: #0d766e;
  --teal-dark: #075b55;
  --navy: #07111f;
  --danger: #b42318;
  --success: #16794a;
  --shadow: 0 18px 60px rgba(18, 34, 52, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0, #e1f1ef 0, transparent 30rem), var(--canvas); }
a { color: var(--teal-dark); }
button, input { font: inherit; }
.site-header { min-height: 68px; padding: 10px clamp(16px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 780; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--teal), #094d66); font-size: 12px; letter-spacing: .08em; }
nav { display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); }
nav a, .link-button { color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 650; }
nav form { margin: 0; }
.link-button { padding: 0; border: 0; background: none; cursor: pointer; }
.page-shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: clamp(28px, 5vw, 56px) 0 80px; }
.card { background: var(--paper); border: 1px solid rgba(203,215,221,.85); border-radius: 22px; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
h1, h2 { margin-top: 0; letter-spacing: -.035em; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; }
h2 { font-size: 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.messages { margin-bottom: 20px; display: grid; gap: 8px; }
.message { padding: 13px 16px; border-radius: 12px; background: #eef3f5; border: 1px solid var(--line); }
.message.success { color: #0e5a37; background: #e7f6ed; border-color: #b8e4c8; }
.message.error { color: #8f1d15; background: #fff0ee; border-color: #f3c1bc; }
.auth-card { width: min(480px, 100%); margin: 3vh auto 0; padding: clamp(26px, 6vw, 48px); }
.auth-card h1 { font-size: clamp(30px, 7vw, 42px); }
.stack-form { display: grid; gap: 18px; margin-top: 28px; }
.stack-form label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
input { width: 100%; padding: 13px 14px; color: var(--ink); background: white; border: 1px solid #b9c7ce; border-radius: 11px; outline: none; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,118,110,.14); }
label small { color: var(--muted); font-weight: 450; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 13px; font-weight: 550; }
.form-errors { color: var(--danger); background: #fff0ee; border: 1px solid #f3c1bc; border-radius: 10px; padding: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 11px; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .15s, background .15s; }
.button:active { transform: translateY(1px); }
.button.primary { color: white; background: var(--teal); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { color: var(--ink); background: white; border-color: #c7d2d8; }
.button.full { width: 100%; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.dashboard-head, .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; white-space: nowrap; border-radius: 999px; color: #0b5f3a; background: #e5f5eb; font-size: 13px; font-weight: 750; }
.live-pill span { width: 8px; height: 8px; border-radius: 50%; background: #20a965; box-shadow: 0 0 0 5px rgba(32,169,101,.13); }
.camera-card { padding: 8px; overflow: hidden; background: var(--navy); }
.camera-card iframe { display: block; width: 100%; aspect-ratio: 16/9; min-height: 260px; border: 0; border-radius: 15px; background: #000; }
.camera-help { margin: 9px 10px 4px; color: #b8c4d1; font-size: 12px; }
.action-card { margin-top: 20px; padding: clamp(22px, 4vw, 34px); display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.action-card h2 { margin-bottom: 5px; }
.action-card p { margin: 0; color: var(--muted); max-width: 650px; line-height: 1.55; }
.door-open-form { flex: 0 0 auto; }
.door-control-frame { flex: 0 0 auto; width: 260px; height: 128px; border: 0; background: transparent; }
.door-control-body { min-height: 0; padding: 4px; background: transparent; }
.door-control-body .door-open-form { width: 100%; }
.door-control-body .button.unlock { width: 100%; }
.door-control-message { min-height: 20px; margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: center; }
.door-control-message.success { color: var(--success); }
.door-control-message.error { color: var(--danger); }
.button.unlock { flex: 0 0 auto; min-height: 58px; padding: 14px 24px; color: white; background: #b52b22; box-shadow: 0 8px 25px rgba(181,43,34,.2); }
.button.unlock:hover { background: #941e17; }
.recent-card, .table-card, .form-card { margin-top: 22px; padding: clamp(20px, 4vw, 32px); }
.event-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.event-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.event-list time { color: var(--muted); font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-dot.success { background: var(--success); }.status-dot.failed { background: var(--danger); }
.confirm-dialog { width: min(480px, calc(100% - 28px)); padding: 30px; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.confirm-dialog::backdrop { background: rgba(3,11,20,.65); backdrop-filter: blur(3px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.form-card { max-width: 680px; }
.success-panel h2 { margin-bottom: 7px; }
.copy-row { display: flex; gap: 8px; margin-top: 20px; }
.copy-row input { min-width: 0; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.table-wrap { width: 100%; overflow-x: auto; }
.actions-cell { display: flex; gap: .5rem; flex-wrap: wrap; }
.mfa-qr { display: flex; justify-content: center; margin: 1.25rem 0; }
.mfa-qr img { width: min(240px, 75vw); height: auto; padding: .5rem; background: #fff; border-radius: 12px; }
.secret-code { padding: .75rem; overflow-wrap: anywhere; background: var(--canvas); border-radius: 10px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1.25rem 0; padding: 0; list-style: none; }
.recovery-codes li { padding: .65rem .35rem; text-align: center; background: var(--canvas); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 11px 12px; color: var(--muted); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid #edf1f3; vertical-align: middle; }
td span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
td .tag { display: inline-block; margin-left: 7px; padding: 2px 6px; color: #45576a; background: #edf2f5; border-radius: 5px; }
.status-label { display: inline-block; margin: 0; padding: 4px 8px; border-radius: 999px; font-weight: 700; }
.status-label.active { color: #0b633c; background: #e5f5eb; }.status-label.inactive { color: #7c2d26; background: #fae9e7; }
td.details { max-width: 300px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .site-header { align-items: flex-start; }
  nav { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  nav a, .link-button { font-size: 12px; }
  .brand > span:last-child { display: none; }
  .page-heading, .dashboard-head { align-items: flex-start; }
  .page-heading { flex-direction: column; }
  .action-card { align-items: stretch; flex-direction: column; }
  .door-open-form { width: 100%; }
  .door-control-frame { width: 100%; }
  .button.unlock { width: 100%; }
  .camera-card iframe { min-height: 210px; }
  .copy-row { flex-direction: column; }
  .invite-actions .button { width: 100%; }
  .dialog-actions { flex-direction: column-reverse; }
}
