:root {
  color-scheme: dark;
  --ink: #f4f1e8;
  --muted: #aaa89f;
  --surface: #161819;
  --surface-2: #202324;
  --line: #343839;
  --red: #d55346;
  --amber: #d6a449;
  --green: #70ad83;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

button, input, select, textarea { touch-action: manipulation; }

a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid #f08a80;
  outline-offset: 3px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, #50312955 0, transparent 34rem),
    #0d0f10;
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topnav, .masthead, main, footer { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--ink); font-weight: 850; letter-spacing: .08em; text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.navlinks { display: flex; align-self: stretch; gap: 26px; }
.navlinks a { display: grid; place-items: center; position: relative; color: var(--muted); font-size: .88rem; font-weight: 650; text-decoration: none; }
.navlinks a:hover, .navlinks a.active { color: var(--ink); }
.navlinks a.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--red); }
.logout-form { display: grid; place-items: center; margin: 0; }
.logout-form button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: .78rem; }
.logout-form button:hover { color: var(--ink); }

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 64px 0 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow { margin: 0 0 6px; color: var(--red); font-size: .76rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 7vw, 5.6rem); font-weight: 500; letter-spacing: -.045em; line-height: .9; }
.subtitle { margin: 15px 0 0; color: var(--muted); }
.mode { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.mode span { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #70ad8320; }

main { padding: 28px 0 70px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)) auto; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.summary > div, .summary button, .summary-action { min-height: 88px; padding: 18px 22px; border: 0; background: var(--surface); color: var(--ink); }
.summary strong, .summary span { display: block; }
.summary strong { font: 500 1.75rem Georgia, serif; }
.summary span { margin-top: 3px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.summary button { cursor: pointer; padding-inline: 30px; font-weight: 700; }
.summary button:hover { background: var(--surface-2); }
.summary button:disabled { cursor: wait; color: var(--muted); }
.summary button.is-syncing::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 9px; border: 2px solid #ffffff35; border-top-color: var(--ink); border-radius: 50%; vertical-align: -2px; animation: access-spin .8s linear infinite; }
.summary-action { display: grid; place-items: center; font-weight: 800; text-decoration: none; }
.summary-action:hover { background: var(--surface-2); color: #f08a80; }

.notice { margin: 28px 0 16px; color: var(--muted); }
.notice.error { color: #ee8c82; }
.notice.progress-notice { color: #e1bd78; }
.gateway-section { margin-top: 30px; }
.list-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 13px; }
.list-heading h2 { margin: 0; font: 500 1.55rem Georgia, serif; }
.list-heading > span { color: var(--muted); font-size: .82rem; }
.gateway-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.gateway-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 78px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.gateway-card strong, .gateway-card span { display: block; }
.gateway-card strong { font: 500 1.08rem Georgia, serif; }
.gateway-card div > span { margin-top: 3px; color: var(--muted); font-size: .77rem; }
.lock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.lock-card { padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lock-card { transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.lock-card:hover { transform: translateY(-2px); border-color: #505657; background: #191c1d; }
.lock-card header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.lock-card h2 { margin: 0; font: 500 1.45rem Georgia, serif; }
.lock-card .group { margin: 3px 0 0; color: var(--muted); font-size: .84rem; }
.status { padding: 5px 8px; border-radius: 99px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status.online { background: #70ad8320; color: #8bcea0; }
.status.offline { background: #d5534620; color: #e67a70; }
.status.warning { background: #d6a44920; color: #e1bd78; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
.fact { padding-top: 10px; border-top: 1px solid var(--line); }
.fact span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
.fact strong { display: block; margin-top: 3px; font-size: .96rem; }
.state-button { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; font-weight: 700; }
.state-button:hover { border-color: #676c6e; background: var(--surface-2); }
.state-button:disabled { cursor: wait; color: var(--muted); }

footer { display: flex; justify-content: space-between; padding: 20px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

.schedule-hero h1 { font-size: clamp(3.2rem, 8vw, 6.8rem); }
.schedule-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .75fr); gap: 18px; align-items: start; }
.schedule-layout-wide { grid-template-columns: minmax(0, 1.9fr) minmax(260px, .65fr); }
.schedule-stack { display: grid; gap: 18px; }
.schedule-card, .assurance-card, .run-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.schedule-card { padding: 30px; }
.section-heading, .time-section, .form-footer { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.schedule-card h2, .schedule-aside h2 { margin: 0; font: 500 1.6rem Georgia, serif; }
.step { margin: 0 0 5px; color: var(--red); font-size: .7rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.schedule-description { max-width: 560px; margin: 8px 0 0; color: var(--muted); font-size: .88rem; }

.switch-row { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: .84rem; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 46px; height: 26px; border: 1px solid #555b5d; border-radius: 99px; background: #292d2e; transition: .2s ease; }
.switch-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #a9aca8; transition: .2s ease; }
.switch-row input:checked + i { border-color: var(--green); background: #70ad8330; }
.switch-row input:checked + i::after { transform: translateX(20px); background: #91d1a5; }
.switch-row input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 3px; }

.day-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 28px 0 38px; padding: 0 0 38px; border: 0; border-bottom: 1px solid var(--line); }
.day-picker legend { width: 100%; margin-bottom: 12px; color: var(--muted); font-size: .78rem; }
.day-picker input { position: absolute; opacity: 0; pointer-events: none; }
.day-picker span { display: grid; place-items: center; min-height: 52px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 750; transition: .15s ease; }
.day-picker span:hover { border-color: #656b6d; color: var(--ink); }
.day-picker input:checked + span { border-color: var(--red); background: #d553461a; color: #f08a80; }
.day-picker input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.time-section { align-items: end; }
.time-section p:not(.step) { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.time-field span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.time-field input { width: 180px; min-height: 52px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: #0f1112; color: var(--ink); font: 500 1.45rem Georgia, serif; color-scheme: dark; }
.time-field input:focus { outline: 2px solid #d5534660; border-color: var(--red); }

.form-footer { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-footer p { margin: 0; color: var(--muted); font-size: .84rem; }
.inline-run-status { display: grid; grid-template-columns: 92px 1fr; gap: 7px 16px; margin-top: 24px; padding: 18px; border-radius: 9px; background: var(--surface-2); }
.inline-run-status span { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.inline-run-status strong { font: 500 .96rem Georgia, serif; }
.inline-run-status p { grid-column: 2; margin: 0; color: var(--muted); font-size: .8rem; }
.error-text { color: #ee8c82 !important; }
.primary-button { min-height: 48px; padding: 0 22px; border: 0; border-radius: 8px; background: var(--red); color: #fff; cursor: pointer; font-weight: 800; box-shadow: 0 8px 22px #d5534625; }
.primary-button:hover { background: #e05d50; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.profile-door-access.is-processing { border-color: #d6a44970; box-shadow: 0 0 0 1px #d6a44918; }
.profile-door-access.is-processing .primary-button::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 9px; border: 2px solid #ffffff55; border-top-color: #fff; border-radius: 50%; vertical-align: -2px; animation: access-spin .8s linear infinite; }
@keyframes access-spin { to { transform: rotate(360deg); } }
.primary-link { display: inline-grid; place-items: center; min-height: 46px; padding: 0 20px; border-radius: 8px; background: var(--red); color: #fff; font-weight: 800; text-decoration: none; box-shadow: 0 8px 22px #d5534625; }
.primary-link:hover { background: #e05d50; }

.schedule-aside { display: grid; gap: 18px; }
.assurance-card, .run-card { padding: 24px; }
.assurance-card { background: linear-gradient(150deg, #221b19, var(--surface)); }
.assurance-card p:last-child, .run-card p { margin: 12px 0 0; color: var(--muted); font-size: .86rem; }
.run-card > span { display: block; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.run-card > strong { display: block; margin-top: 7px; font: 500 1.15rem Georgia, serif; }
.run-card hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line); }

.users-summary { grid-template-columns: repeat(2, minmax(130px, 1fr)) auto; }
.user-table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.user-filters { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.user-filters > div:first-child { margin-right: auto; }
.user-filters > div:first-child span, .user-filters > div:first-child strong { display: block; }
.user-filters > div:first-child span { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.user-filters > div:first-child strong { margin-top: 4px; font: 500 1rem Georgia, serif; }
.filter-menu { position: relative; min-width: 165px; }
.filter-menu summary { display: flex; justify-content: space-between; gap: 18px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; color: var(--ink); font-size: .8rem; font-weight: 750; list-style: none; }
.filter-menu summary::-webkit-details-marker { display: none; }
.filter-menu summary span { color: var(--muted); }
.filter-menu[open] summary { border-color: #676c6e; border-radius: 8px 8px 0 0; }
.filter-menu fieldset { position: absolute; z-index: 10; top: calc(100% - 1px); right: 0; width: max(100%, 240px); max-height: 320px; overflow: auto; margin: 0; padding: 12px; border: 1px solid #676c6e; border-radius: 8px 0 8px 8px; background: #171a1b; box-shadow: 0 16px 35px #0008; }
.filter-menu legend { padding: 0 4px; color: var(--muted); font-size: .68rem; }
.filter-menu [data-options] { display: grid; gap: 4px; }
.filter-menu label { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 6px; cursor: pointer; font-size: .82rem; }
.filter-menu label:hover { background: var(--surface-2); }
.filter-menu input { accent-color: var(--red); }
.filter-menu [data-clear] { width: 100%; margin-top: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.user-table { width: 100%; border-collapse: collapse; text-align: left; }
.user-table th { padding: 13px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.user-table th button { display: flex; align-items: center; gap: 7px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; }
.user-table th button:hover, .user-table th[aria-sort]:not([aria-sort="none"]) button { color: var(--ink); }
.user-table th button span { color: var(--red); font-size: .9rem; }
.user-table td { padding: 18px 20px; border-bottom: 1px solid var(--line); vertical-align: top; }
.user-table tr:last-child td { border-bottom: 0; }
.user-table tbody tr { transition: background .15s ease; }
.user-table tbody tr:hover { background: var(--surface-2); }
.user-id { width: 13%; color: var(--muted); font: 750 .78rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.user-name { width: 24%; font: 500 1.1rem Georgia, serif; }
.user-name a { color: var(--ink); text-decoration-color: #d5534670; text-underline-offset: 4px; }
.user-name a:hover { color: #f08a80; }
.user-credentials { width: 25%; color: #e4b863; font-weight: 700; }
.user-doors { color: var(--muted); }
.source-warnings { margin-top: 18px; padding: 18px 20px; border: 1px solid #5d4830; border-radius: 10px; background: #d6a44912; color: #e1bd78; font-size: .82rem; }
.source-warnings:empty { display: none; }
.admin-layout { display: grid; gap: 34px; }
.admin-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-list { display: grid; gap: 10px; }
.admin-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.admin-card div { min-width: 0; }
.admin-card strong, .admin-card span { display: block; }
.admin-card strong { font: 500 1.08rem Georgia, serif; }
.admin-card div span { margin-top: 4px; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.audit-list { display: grid; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.audit-list article { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) auto; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.audit-list article:last-child { border-bottom: 0; }
.audit-list strong { text-transform: capitalize; }
.audit-list span, .audit-list time { color: var(--muted); font-size: .82rem; }
@media (max-width: 760px) { .audit-list article { grid-template-columns: 1fr; gap: 4px; } .admin-card { align-items: flex-start; flex-direction: column; } .admin-actions { justify-content: flex-start; } }
.current-admin { padding: 6px 10px; border-radius: 999px; background: #70ad8320; color: #8bcea0; font-size: .72rem; font-weight: 750; }
.danger-button { min-height: 38px; padding: 0 14px; border: 1px solid #8e4c47; border-radius: 7px; background: transparent; color: #ef8b82; cursor: pointer; font-weight: 750; }
.danger-button:hover { background: #d553461a; }
.danger-button:disabled { cursor: wait; opacity: .6; }
.source-warnings strong { color: var(--ink); }
.source-warnings ul { margin: 8px 0 0; padding-left: 18px; }

.login-page { display: grid; place-items: center; }
.login-shell { display: grid; place-items: center; width: min(100% - 32px, 470px); padding: 40px 0; }
.login-card { width: 100%; padding: 38px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 24px 80px #0007; }
.login-card .brand { display: inline-block; margin-bottom: 48px; }
.login-card h1 { font-size: clamp(3.2rem, 12vw, 5rem); }
.login-card form { display: grid; gap: 17px; margin-top: 30px; }
.login-card label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-card input { width: 100%; min-height: 50px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: #0f1112; color: var(--ink); font: inherit; }
.login-card input:focus { outline: 2px solid #d5534660; border-color: var(--red); }
.login-card .primary-button { width: 100%; margin-top: 5px; }
.login-card small { display: block; margin-top: 24px; color: var(--muted); }
.login-error { margin: 22px 0 -12px; padding: 10px 12px; border: 1px solid #7d403a; border-radius: 7px; background: #d5534615; color: #ee8c82; font-size: .84rem; }

.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.profile-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.profile-summary div { padding: 18px 22px; border-right: 1px solid var(--line); }
.profile-summary div:last-child { border-right: 0; }
.profile-summary strong, .profile-summary span { display: block; }
.profile-summary strong { font: 500 1.35rem Georgia, serif; }
.profile-summary span { margin-top: 3px; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.email-summary form > label:first-child { display: block; margin-bottom: 5px; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.email-summary form > div { display: flex; gap: 6px; }
.email-summary input[type="email"] { min-width: 0; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #0f1112; color: var(--ink); }
.email-summary button { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); cursor: pointer; font-weight: 700; }
.email-summary .replace-ekeys { display: flex; gap: 6px; align-items: center; margin-top: 7px; color: #e4b863; font-size: .7rem; }
.email-summary .replace-ekeys[hidden] { display: none; }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 22px; align-items: start; }
.profile-door-access { margin: 22px 0; }
.profile-door-access .list-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: .84rem; }
.profile-door-access .lock-choice:has(input:disabled) { cursor: default; border-color: #70ad8350; background: #70ad8310; }
.credential-groups { display: grid; gap: 14px; }
.credential-group { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.credential-group h3 { margin: 0; padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.credential-group > p { margin: 0; padding: 18px; color: var(--muted); }
.credential-item { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.credential-item:last-child { border-bottom: 0; }
.credential-item strong, .credential-item span { display: block; }
.credential-item span, .credential-item em { color: var(--muted); font-size: .78rem; font-style: normal; }
.passcode-change { display: flex; gap: 7px; }
.passcode-change input { width: 170px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #0f1112; color: var(--ink); }
.passcode-change button { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); cursor: pointer; font-weight: 700; }
.passcode-change .danger-button { border-color: #7d403a; color: #ee8c82; }
.passcode-change .danger-button:hover { background: #d5534615; }
.passcode-change-all { flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.passcode-change-all p { flex-basis: 100%; margin: 2px 0 0; color: var(--muted); font-size: .75rem; }
.add-user-form { display: grid; gap: 18px; }
.form-card { padding: 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.field-grid, .choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field-grid label > span, .standalone-field > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.field-grid input, .standalone-field input { width: 100%; min-height: 48px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #0f1112; color: var(--ink); font: inherit; }
.choice-card, .lock-choice { display: flex; gap: 12px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.choice-card:has(input:checked), .lock-choice:has(input:checked) { border-color: var(--red); background: #d5534612; }
.choice-card span, .choice-card strong, .choice-card small, .lock-choice span, .lock-choice strong, .lock-choice small { display: block; }
.choice-card small, .lock-choice small, .standalone-field small { margin-top: 3px; color: var(--muted); }
.standalone-field { display: block; max-width: 430px; margin-top: 18px; }
.standalone-field[hidden] { display: none; }
.lock-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.text-button { border: 0; background: transparent; color: #f08a80; cursor: pointer; font-weight: 750; }
.creation-results { display: grid; gap: 8px; margin-top: 18px; }
.creation-result { padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .84rem; }
.creation-result.success { color: #8bcea0; }
.creation-result.failure { color: #ee8c82; }
.activity-list { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.activity-list article, .activity-list > p { margin: 0; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.activity-list article:last-child { border-bottom: 0; }
.activity-list strong, .activity-list span { display: block; }
.activity-list span, .activity-list > p { color: var(--muted); font-size: .78rem; }

@media (max-width: 760px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
  }
  .topnav, .masthead, main, footer { width: calc(100% - 28px); }
  .topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    min-height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
    border-bottom-color: #343839cc;
    background: #0d0f10e8;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .brand { display: grid; min-height: 54px; place-items: center start; }
  .navlinks {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) 52px;
    gap: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 max(5px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(5px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: #121415f2;
    box-shadow: 0 -10px 28px #0005;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .navlinks a {
    min-width: 0;
    min-height: 64px;
    padding: 4px 2px 0;
    font-size: .68rem;
    line-height: 1.05;
    text-align: center;
  }
  .navlinks a[href="/nightly-auto-lock"] { font-size: 0; }
  .navlinks a[href="/nightly-auto-lock"]::before { content: "Nightly"; font-size: .68rem; }
  .navlinks a.active { background: #ffffff08; }
  .navlinks a.active::after { right: 16%; bottom: auto; left: 16%; top: 0; height: 3px; border-radius: 0 0 3px 3px; }
  .logout-form, .logout-form button { width: 100%; min-height: 64px; }
  .logout-form button { padding: 0 2px; font-size: 0; }
  .logout-form button::before { content: "Out"; font-size: .68rem; font-weight: 650; }
  .masthead { padding: 32px 0 22px; align-items: end; gap: 18px; }
  .masthead h1, .schedule-hero h1 { font-size: clamp(2.45rem, 14vw, 4.25rem); line-height: .94; }
  .subtitle { max-width: 290px; margin-top: 11px; }
  .mode { font-size: .72rem; }
  main { padding: 18px 0 30px; }
  .summary { grid-template-columns: repeat(3, 1fr); }
  .users-summary { grid-template-columns: repeat(2, 1fr); }
  .summary > div { padding: 14px; }
  .summary button { grid-column: 1 / -1; min-height: 52px; }
  .summary strong { font-size: 1.5rem; }
  .summary span { font-size: .66rem; }
  .gateway-grid, .lock-grid { grid-template-columns: 1fr; }
  .gateway-card { min-height: 72px; }
  .lock-card { padding: 19px; }
  .state-button { min-height: 48px; }
  .user-filters { align-items: stretch; flex-wrap: wrap; }
  .user-filters > div:first-child { width: 100%; }
  .filter-menu { flex: 1; }
  .filter-menu summary { min-height: 46px; align-items: center; }
  .filter-menu fieldset {
    position: fixed;
    z-index: 120;
    top: auto;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: 55vh;
    border-radius: 14px;
    box-shadow: 0 20px 70px #000c;
  }
  .filter-menu label, .filter-menu [data-clear] { min-height: 44px; }
  .user-table-wrap { overflow: visible; border: 0; background: transparent; }
  .user-table, .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
  .user-table thead { display: none; }
  .user-table tbody { display: grid; gap: 10px; }
  .user-table tbody tr { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .user-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  .user-table td::before { content: attr(data-label); color: var(--muted); font: 750 .65rem ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
  .user-table .user-name { font-size: 1.15rem; }
  .user-name a { display: inline-flex; min-height: 32px; align-items: center; }
  .user-id, .user-name, .user-credentials, .user-doors { width: 100%; }
  .schedule-layout { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-summary { grid-template-columns: 1fr 1fr; }
  .profile-summary div { padding: 15px; border-bottom: 1px solid var(--line); }
  .profile-summary div:nth-child(2) { border-right: 0; }
  .profile-summary .email-summary { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .email-summary input, .email-summary button { min-height: 44px; }
  .credential-item { align-items: start; flex-direction: column; }
  .passcode-change, .passcode-change input { width: 100%; }
  .passcode-change button { min-height: 44px; padding-inline: 12px; }
  .field-grid, .choice-grid { grid-template-columns: 1fr; }
  .admin-fields { grid-template-columns: 1fr; }
  .form-card, .schedule-card { padding: 19px; }
  .schedule-card, .assurance-card, .run-card { border-radius: 14px; }
  .section-heading, .time-section, .form-footer { align-items: start; flex-direction: column; }
  .switch-row { min-height: 44px; }
  .day-picker { grid-template-columns: repeat(4, 1fr); }
  .time-field, .time-field input, .primary-button { width: 100%; }
  input, select, textarea { font-size: 16px !important; }
  .primary-button, .primary-link, .danger-button { min-height: 48px; }
  .inline-run-status { grid-template-columns: 1fr; }
  .inline-run-status p { grid-column: 1; }
  .admin-actions { width: 100%; }
  .admin-actions button { flex: 1; }
  .list-heading { align-items: start; }
  footer { flex-direction: column; gap: 7px; padding: 18px 0 22px; }
  .login-shell { min-height: 100svh; padding: calc(22px + env(safe-area-inset-top)) 0 calc(22px + env(safe-area-inset-bottom)); }
  .login-page { padding-bottom: 0; }
  .login-card { padding: 28px 22px; }
  .login-card .brand { margin-bottom: 34px; }
}

@media (hover: none), (pointer: coarse) {
  .lock-card:hover { transform: none; }
  .summary button:hover, .summary-action:hover, .state-button:hover, .primary-button:hover, .primary-link:hover { background-color: inherit; }
  .primary-button:hover, .primary-link:hover { background-color: var(--red); }
}

@media (display-mode: standalone) {
  body { user-select: none; }
  input, textarea, .user-name a, .credential-item { user-select: text; }
}
