/* 3747 N Clark condo app — mobile-first, no framework. */

:root {
  /* "Entry Panel" — cool limestone neutrals, pine accent, brass hairline. */
  --bg: #e7e9e3;
  --surface: #fbfcfa;
  --surface-2: #eef0ea;
  --text: #191d19;
  --muted: #5b625b;
  --border: #d6d9cf;
  --line-strong: #c4c8bc;
  --primary: #1f6e56;
  --primary-dark: #16523f;
  --accent: #1f6e56;
  --accent-soft: #dfeae4;
  --on-primary: #ffffff;
  --brass: #9a6a2e;
  --ok: #1f6e56;
  --ok-bg: #dcebe2;
  --warn: #8a6a12;
  --warn-bg: #f3ecd6;
  --err: #b23a2e;
  --err-bg: #f4dedb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(25, 29, 20, 0.05), 0 6px 20px rgba(25, 29, 20, 0.07);
  --shadow-lg: 0 14px 44px rgba(25, 29, 20, 0.2);
  --ring: color-mix(in srgb, var(--accent) 45%, transparent);
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101310;
    --surface: #181c17;
    --surface-2: #20251e;
    --text: #e9ece2;
    --muted: #9aa091;
    --border: #2b3029;
    --line-strong: #3a4137;
    --primary: #56b997;
    --primary-dark: #7fd0b3;
    --accent: #56b997;
    --accent-soft: #16281f;
    --on-primary: #05201a;
    --brass: #c99b5c;
    --ok: #56b997;
    --ok-bg: #14281e;
    --warn: #d3a53f;
    --warn-bg: #2c2512;
    --err: #e0705f;
    --err-bg: #2e1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 22px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.6);
    --ring: color-mix(in srgb, var(--accent) 50%, transparent);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }

h1 {
  font-size: 1.55rem;
  margin: 0.75rem 0;
}
.door-panel h1 { font-size: 2rem; }

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

a {
  color: var(--primary);
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  padding-top: 0.5rem;
  padding-bottom: 2rem;
}

.muted {
  color: var(--muted);
}

/* Header + nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand-st { color: var(--brass); font-weight: 600; }

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}

.main-nav a {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  min-height: 44px;
  line-height: 1.9;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--bg);
}

.main-nav a.active {
  color: var(--primary);
  background: var(--accent-soft);
}

.site-footer {
  padding-top: 1rem;
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin: 1rem 0;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.04s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--text) 18%, var(--border));
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-danger {
  background: var(--surface);
  border-color: var(--err);
  color: var(--err);
}

.btn-danger:hover {
  background: var(--err-bg);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  min-height: 36px;
  font-size: 0.85rem;
}

/* Door panel */

.door-panel {
  text-align: center;
  padding: 1.5rem 1rem;
}

.door-btn {
  width: 100%;
  max-width: 420px;
  min-height: 64px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  border-radius: 16px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 32%, transparent);
}

.door-btn:hover {
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 40%, transparent);
}

.door-status {
  margin: 1rem auto 0;
  max-width: 420px;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
}

.door-status[hidden] {
  display: none;
}

.door-status.ok,
.door-status.success {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}

.door-status.err,
.door-status.error,
.door-status.failure {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}

.door-status.pending,
.door-status.warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn);
}

/* Dialog */

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  width: min(92vw, 380px);
  background: var(--surface);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(10, 8, 4, 0.5);
}

dialog h2 {
  margin-top: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Banners */

.banner {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  margin: 0.75rem auto;
  font-weight: 500;
}

.banner-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(146, 96, 10, 0.35);
}

.banner-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid rgba(21, 128, 61, 0.35);
}

.banner-err {
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid rgba(185, 28, 28, 0.35);
}

/* Badges */

.badge {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: rgba(21, 128, 61, 0.3);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: rgba(146, 96, 10, 0.3);
}

.badge-err {
  background: var(--err-bg);
  color: var(--err);
  border-color: rgba(185, 28, 28, 0.3);
}

/* Eye-icon PIN reveal toggle. */
.reveal-form { display: inline; margin-left: 0.4rem; }
.btn-eye {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  border-radius: 6px;
}
.btn-eye:hover { color: var(--accent); background: var(--accent-soft); }
.btn-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-eye:disabled { opacity: 0.5; cursor: default; }
.reveal-btn .eye-hide { display: none; }
.reveal-btn.revealed .eye-show { display: none; }
.reveal-btn.revealed .eye-hide { display: inline; }
.pin-value { letter-spacing: 0.04em; }

/* Type badges: distinguish web links from keypad PINs at a glance. */
.tbadge-link {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.tbadge-pin {
  background: color-mix(in srgb, var(--brass) 14%, transparent);
  color: var(--brass);
  border-color: color-mix(in srgb, var(--brass) 35%, transparent);
}

/* Tables */

.table-scroll {
  overflow-x: auto;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Zebra + hover only where rows are real table rows (not the mobile
   stacked-card layout below 760px). */
@media (min-width: 761px) {
  tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
  tbody tr:hover td { background: var(--surface-2); }
}

.ua-cell {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-unmapped {
  background: var(--warn-bg);
}

.row-inactive td {
  opacity: 0.55;
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.setting-block { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.setting-block:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-name { margin: 0 0 0.2rem; font-size: 1rem; }
.setting-key { margin: 0 0 0.5rem; font-size: 0.78rem; word-break: break-all; }
.setting-desc { margin: 0 0 0.75rem; line-height: 1.4; }
.val-change { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.6rem; }
.val-box { flex: 1 1 240px; min-width: 0; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.val-from { background: var(--bg); }
.val-to { background: var(--ok-bg); }
.val-tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.val-num { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600; }
.val-meaning { font-size: 0.85rem; line-height: 1.4; overflow-wrap: anywhere; }
.val-arrow { align-self: center; font-size: 1.4rem; color: var(--muted); flex: 0 0 auto; }
@media (max-width: 520px) { .val-arrow { transform: rotate(90deg); } }

/* Guest / temporary codes */
.stacked-form { display: flex; flex-direction: column; gap: 0.85rem; max-width: 640px; }
.stacked-form label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.stacked-form input { max-width: 100%; }
.form-row { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.form-row label { flex: 1 1 220px; }
.inline-form { display: inline; }
.new-code { border: 2px solid var(--ok); background: var(--ok-bg); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
.pin-reveal { font-family: var(--font-mono); font-size: 2rem; font-weight: 500; letter-spacing: 0.25em; margin: 0.25rem 0; }

/* Guest hub: create-type chooser (pure-CSS segmented control + panes) */
.create-guest .seg-radio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 999px; margin: 0.25rem 0 1.1rem; }
.seg-btn { padding: 0.45rem 1.1rem; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--muted); user-select: none; }
.seg-btn:hover { color: var(--text); }
#ct-link:checked ~ .seg label[for="ct-link"],
#ct-code:checked ~ .seg label[for="ct-code"] { background: var(--accent); color: var(--on-primary); }
#ct-link:focus-visible ~ .seg label[for="ct-link"],
#ct-code:focus-visible ~ .seg label[for="ct-code"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.create-pane { display: none; }
#ct-link:checked ~ .pane-link,
#ct-code:checked ~ .pane-code { display: block; }
.expiry-preview { display: block; margin-top: 0.3rem; font-size: 0.82rem; }
.create-guest > summary { list-style: none; cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; display: flex; align-items: center; }
.create-guest > summary::-webkit-details-marker { display: none; }
.create-guest > summary::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 1.4rem; display: inline-block; transition: transform 0.15s ease; }
.create-guest[open] > summary::after { transform: rotate(90deg); }
.create-guest[open] > summary { margin-bottom: 1rem; }

/* Past (expired & revoked) guest items — collapsed section header. */
.past-guests { margin-top: 1.5rem; }
.past-summary { list-style: none; cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--muted); display: flex; align-items: center; padding: 0.35rem 0; }
.past-summary::-webkit-details-marker { display: none; }
.past-summary::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 1.4rem; display: inline-block; transition: transform 0.15s ease; }
.past-guests[open] > .past-summary::after { transform: rotate(90deg); }
.past-note { margin: 0.25rem 0 0.75rem; font-size: 0.85rem; }

.door-buttons { display: flex; flex-direction: column; gap: 1.25rem; align-items: center; }
.door-item { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; max-width: 420px; }

/* Users table: keep it within the page at desktop widths (no horizontal
   scroll) by letting cells wrap, sizing controls to their cell, and stacking
   the per-row action buttons vertically. */
.users-table { table-layout: fixed; }
.users-table th,
.users-table td { white-space: normal; word-break: break-word; }
.users-table input:not([type="checkbox"]),
.users-table select { width: 100%; box-sizing: border-box; }
.users-table .row-actions { flex-direction: column; align-items: stretch; gap: 0.35rem; }
.users-table .row-actions form { margin: 0; }
.users-table .row-actions .btn { width: 100%; }

/* Responsive tables: below 760px, stack each row into a labelled card so
   inline edit controls and action buttons are fully visible without any
   horizontal scrolling. Add class="stack-table" and data-label on each td. */
@media (max-width: 760px) {
  .stack-table thead { display: none; }
  .stack-table,
  .stack-table tbody,
  .stack-table tr,
  .stack-table td { display: block; width: 100%; }
  .stack-table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 0.85rem;
    padding: 0.25rem 0.85rem;
  }
  .stack-table tbody tr:last-child td { border-bottom: 1px solid var(--border); }
  .stack-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    white-space: normal;
    padding: 0.55rem 0;
  }
  .stack-table tr td:last-child { border-bottom: none; }
  .stack-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    flex: 0 0 auto;
  }
  .stack-table td input:not([type="checkbox"]),
  .stack-table td select { flex: 1 1 auto; min-width: 0; }
  .stack-table td.row-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .stack-table td.row-actions::before { margin-bottom: 0.4rem; }
  .stack-table td.row-actions form { width: 100%; }
  .stack-table td.row-actions .btn { width: 100%; }
}

/* Forms */

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input:not([type="checkbox"]),
select,
textarea {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1rem;
}

.form-actions {
  justify-content: flex-end;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  flex-wrap: wrap;
}

.filter-bar label {
  font-weight: 600;
  color: var(--muted);
}

.btn.active {
  background: var(--accent, #2563eb);
  color: #fff;
  border-color: var(--accent, #2563eb);
}

/* Pager */

.pager {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  justify-content: center;
}

/* Dashboard activity list */

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.activity-main {
  display: flex;
  flex-direction: column;
}

.activity-photo { display: block; flex: 0 0 auto; }
.activity-photo img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
  background: var(--bg);
}
td .activity-photo img { width: 40px; height: 40px; }

.activity-name {
  font-weight: 600;
}

.activity-side {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

/* Admin */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Clickable stat cards (filters / links) */
a.stat {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
a.stat:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}
a.stat:active { transform: translateY(1px); }
.stat.active {
  border-color: var(--accent, #2563eb);
  box-shadow: inset 0 0 0 1px var(--accent, #2563eb);
}

.stat-warn {
  border-color: var(--warn);
  background: var(--warn-bg);
}

.stat-err {
  border-color: var(--err);
  background: var(--err-bg);
}

.admin-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-links li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.admin-links li:last-child {
  border-bottom: none;
}

/* Profile session list (rendered by auth pages) */

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.session-list li:last-child {
  border-bottom: none;
}

/* Wider screens */

@media (min-width: 640px) {
  h1 {
    font-size: 1.85rem;
  }

  .form-grid {
    grid-template-columns: 2fr 2fr 1fr 1fr auto;
    align-items: end;
  }

  .door-btn {
    width: auto;
    min-width: 320px;
  }
}

/* Admin settings page */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1.25rem;
}
.kv dt { font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #ddd);
}
.settings-actions form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Layout structure refresh (page headers, admin nav, auth, wide) --- */

/* Wider canvas for data-dense admin pages (header/main/footer stay aligned). */
.container-wide { max-width: 1180px; }

/* Consistent page header: title + subtitle on the left, actions on the right. */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.25rem;
}
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0; }
.page-sub { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.92rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }

/* Admin sub-navigation (persistent across admin pages). */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.25rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.admin-nav a {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.admin-nav a:hover { color: var(--text); background: var(--surface-2); }
.admin-nav a.active { color: var(--primary); background: var(--accent-soft); }

/* Auth / login — a centered, focused card instead of floating top-left. */
.auth-wrap {
  min-height: calc(100vh - 210px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
}
.auth-card { width: 100%; max-width: 400px; margin: 0; padding: 1.5rem; }
.auth-brand {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.auth-card { padding: 2rem 1.75rem; }
.auth-card h1 { text-align: center; margin: 0 0 0.5rem; }
.auth-card > .muted { text-align: center; margin: 0 auto 1.25rem; max-width: 34ch; }
.auth-mark { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; letter-spacing: -0.01em; text-align: center; }
.auth-eyebrow { display: block; text-align: center; margin: 0.2rem 0 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.5rem 0 0; }
.login-form label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.login-form input { width: 100%; }
.login-form .btn-primary { width: 100%; margin-top: 0.35rem; }
.auth-foot { text-align: center; margin-top: 1.1rem; font-size: 0.85rem; }
.notice { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.notice-error { background: var(--err-bg); color: var(--err); }
.guest-ok { background: var(--ok-bg); color: var(--ok); }
.guest-note { margin-top: 1rem; font-size: 0.85rem; }
.copy-row { display: flex; gap: 0.5rem; align-items: stretch; margin-top: 0.5rem; flex-wrap: wrap; }
.copy-row .guest-url { flex: 1 1 260px; margin-top: 0; cursor: pointer; }
.copy-row .btn { flex: 0 0 auto; white-space: nowrap; }
.copy-status { display: inline-block; margin-top: 0.5rem; color: var(--ok); font-size: 0.85rem; }

/* Deliveries: table on desktop, tap-to-expand rows on mobile */
.del-mobile { display: none; padding: 0; }
@media (max-width: 760px) {
  .del-desktop { display: none; }
  .del-mobile { display: block; }
}
.del-day {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
}
.del-row { border-bottom: 1px solid var(--border); }
.del-row:last-child { border-bottom: none; }
.del-summary {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
}
.del-summary::-webkit-details-marker { display: none; }
.del-time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.del-carrier { font-weight: 600; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
/* Guest rows: type badge, then label takes the row, then status + chevron. */
.gl-summary { grid-template-columns: auto 1fr auto auto; }
.gl-summary .badge { justify-self: start; }
.gl-detail { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.list-h { margin: 1.5rem 0 0.5rem; }
.del-chev { color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform 0.15s ease; }
.del-row[open] .del-chev { transform: rotate(90deg); }
.del-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-start;
  padding: 0 1rem 1rem;
}
.del-photo { display: block; flex: 0 0 auto; }
.del-photo img {
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  display: block;
  background: var(--surface-2);
}
.del-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; align-items: baseline; }
.del-facts dt { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.del-facts dd { margin: 0; overflow-wrap: anywhere; }
/* Profile: reuse the collapsible-row pattern for the sessions list. */
.session-accordion { padding: 0; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.guest-url { width: 100%; padding: 0.6rem 0.7rem; font-size: 0.85rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); margin-top: 0.5rem; }

/* --- Dashboard door hero (two-column entry panel) --- */
.eyebrow {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin: 1rem 0;
}
.door-hero { display: grid; grid-template-columns: 1.15fr .85fr; }
.door-hero .panel-main { padding: 1.75rem 1.75rem 1.9rem; }
.door-hero h1 { margin: .35rem 0 .1rem; }
.door-hero-sub { margin: 0 0 1.25rem; }
.door-hero .door-buttons { align-items: stretch; }
.door-hero .door-item { max-width: none; }
.door-hero .door-btn { width: 100%; max-width: none; min-width: 0; }
.relock { display: flex; align-items: center; gap: .5rem; margin: .9rem 0 0; font-size: .82rem; }
.rl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); flex: 0 0 auto; }
.panel-side {
  padding: 1.75rem; border-left: 1px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; justify-content: center; gap: 1rem;
}
.side-stat + .side-stat { padding-top: 1rem; border-top: 1px solid var(--border); }
.side-stat .eyebrow { display: block; margin-bottom: .3rem; }
.side-big { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -.01em; line-height: 1.1; }
.side-cap { font-size: .85rem; margin-top: .15rem; }
.side-stat-link { display: block; text-decoration: none; color: inherit; cursor: pointer; border-radius: var(--radius-sm); transition: background .12s ease; }
.side-stat-link:hover { background: var(--accent-soft); }
.status { display: flex; align-items: center; gap: .45rem; }
.status .sd { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.sd.ok { background: var(--ok); } .sd.miss { background: var(--err); } .sd.pend { background: var(--warn); }
@media (max-width: 640px) {
  .door-hero { grid-template-columns: 1fr; }
  .panel-side { border-left: none; border-top: 1px solid var(--border); flex-direction: row; justify-content: space-between; gap: 1.5rem; }
  .panel-side .side-stat { flex: 1; }
  .side-stat + .side-stat { padding-top: 0; border-top: none; border-left: 1px solid var(--border); padding-left: 1.5rem; }
}
