/* Willow Oak Operations — themed to match the Willow Oak Lodge website reskin:
   cream field, pine sidebar, brass + blaze accents, serif display type.
   Booking-type identity colors stay on the validated categorical palette
   (CVD-safe order); status colors are reserved and always paired with text. */

:root {
  color-scheme: light;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --bg:          #EFEEE4;
  --surface:     #F6F5EC;
  --surface-2:   #E7E5D7;
  --ink:         #242A20;
  --ink-soft:    #3D4436;
  --muted:       #5F6555;
  --line:        #D5D3C2;
  --brass:       #8A6B2F;
  --brass-strong:#6F5423;
  --blaze:       #B5540F;
  --pine:        #1B231B;
  --pine-2:      #232E23;
  --on-pine:     #EAE7D6;
  --on-pine-muted: #A8AE97;
  --brass-on-pine: #C9A45C;
  --shadow: 0 1px 2px rgba(30, 35, 25, 0.06), 0 8px 24px rgba(30, 35, 25, 0.07);

  --btn-bg: #8A6B2F;
  --btn-ink: #F6F5EC;

  /* categorical: fixed order, one slot per booking type, never re-assigned */
  --type-hunt:      #2a78d6;
  --type-wedding:   #eb6834;
  --type-lodging:   #1baf7a;
  --type-corporate: #eda100;
  --type-reunion:   #e87ba4;
  --type-fishing:   #008300;
  --type-other:     #4a3aa7;

  /* status: reserved, never doubles as a series color */
  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #141A13;
    --surface:     #1B221A;
    --surface-2:   #222B21;
    --ink:         #E7E4D3;
    --ink-soft:    #C9C7B4;
    --muted:       #99A088;
    --line:        #333C2F;
    --brass:       #C9A45C;
    --brass-strong:#D9B672;
    --blaze:       #E07B33;
    --pine:        #10150F;
    --pine-2:      #1A211A;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);

    --btn-bg: #C9A45C;
    --btn-ink: #1B231B;

    --type-hunt:      #3987e5;
    --type-wedding:   #d95926;
    --type-lodging:   #199e70;
    --type-corporate: #c98500;
    --type-reunion:   #d55181;
    --type-fishing:   #008300;
    --type-other:     #9085e9;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #141A13;
  --surface:     #1B221A;
  --surface-2:   #222B21;
  --ink:         #E7E4D3;
  --ink-soft:    #C9C7B4;
  --muted:       #99A088;
  --line:        #333C2F;
  --brass:       #C9A45C;
  --brass-strong:#D9B672;
  --blaze:       #E07B33;
  --pine:        #10150F;
  --pine-2:      #1A211A;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);

  --btn-bg: #C9A45C;
  --btn-ink: #1B231B;

  --type-hunt:      #3987e5;
  --type-wedding:   #d95926;
  --type-lodging:   #199e70;
  --type-corporate: #c98500;
  --type-reunion:   #d55181;
  --type-fishing:   #008300;
  --type-other:     #9085e9;
}

* { box-sizing: border-box; }

/* Author display values (grid/flex) would otherwise defeat the hidden attr. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
}
h1 { font-size: 23px; }
h2 { font-size: 16px; }

button, input, select, textarea { font: inherit; color: inherit; }

.eyebrow, .tile-cap, .nav-sep, .u-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blaze);
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--pine) 4%, var(--bg)), var(--bg) 40%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
  width: 100%;
  max-width: 370px;
  display: grid;
  gap: 14px;
}
.login-logo { width: 78%; max-width: 260px; margin: 0 auto; display: block; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.login-sub {
  margin: -8px 0 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blaze);
}

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  background: var(--pine);
  color: var(--on-pine);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(201, 164, 92, 0.25);
}
.app.collapsed .sidebar { width: 62px; }
.app.collapsed .nav-label, .app.collapsed .brand-sub { display: none; }
.app.collapsed .side-brand { padding: 12px 8px; }
.app.collapsed .brand-badge { padding: 4px; }
.app.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.app.collapsed .side-user { justify-content: center; padding: 8px 0; }

.side-brand {
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(201, 164, 92, 0.2);
}
.brand-badge { width: 68%; max-width: 128px; margin: 0 auto; }
.brand-badge img {
  width: 100%;
  height: auto;
  display: block;
  /* soft cream glow so the dark script survives the pine sidebar */
  filter:
    drop-shadow(0 0 1px rgba(234, 231, 214, 0.9))
    drop-shadow(0 0 7px rgba(234, 231, 214, 0.45));
}
.brand-sub {
  margin-top: 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-on-pine);
}

.side-nav { padding: 12px 8px; display: grid; gap: 2px; flex: 1; align-content: start; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 3px;
  color: var(--on-pine-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.nav-item svg { flex: none; }
.nav-item:hover { color: var(--brass-on-pine); background: var(--pine-2); }
.nav-item.active {
  color: var(--brass-on-pine);
  background: var(--pine-2);
  box-shadow: inset 2px 0 0 var(--brass-on-pine);
}
.nav-item.disabled { opacity: 0.4; cursor: default; }
.nav-item.disabled:hover { color: var(--on-pine-muted); background: transparent; }
.nav-item.as-btn { background: none; border: 0; width: 100%; text-align: left; }
.nav-item.as-btn:hover { color: var(--brass-on-pine); background: var(--pine-2); }

.nav-sep {
  margin: 14px 12px 4px;
  color: var(--on-pine-muted);
  opacity: 0.7;
  letter-spacing: 0.18em;
  font-size: 10px;
}

.side-foot {
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(201, 164, 92, 0.2);
  display: grid;
  gap: 2px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--on-pine);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brass-on-pine);
  color: #1B231B;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; max-width: 1280px; }

.main-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.main-head .spacer { flex: 1; }
.head-icon {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brass) 16%, transparent);
  color: var(--brass);
}

/* ---------- stat tiles ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 13px 16px 12px;
}
.tile-cap { margin-bottom: 4px; }
.tile-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
}
.tile-value.good { color: var(--status-good); }
.tile-value.warn { color: var(--blaze); }
.tile-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.head-note { color: var(--muted); font-family: var(--font-body); font-size: 12.5px; font-weight: 400; }
.view-all {
  color: var(--brass);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.view-all:hover { color: var(--brass-strong); }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav h2 { min-width: 140px; text-align: center; }
.cal-actions { display: flex; gap: 8px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 3px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn-primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-ink);
  letter-spacing: 0.03em;
}
.btn-primary:hover { background: var(--brass-strong); border-color: var(--brass-strong); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { color: var(--status-critical); border-color: var(--status-critical); background: transparent; }

/* ---------- upcoming cards ---------- */
.ucards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 10px;
}
.ucard {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  padding: 11px 13px;
  cursor: pointer;
  display: grid;
  gap: 6px;
}
.ucard:hover { border-color: var(--brass); box-shadow: var(--shadow); }
.u-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.u-title {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.u-count { flex: none; }
.u-dates { color: var(--ink-soft); font-size: 12.5px; }
.u-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.u-meta .type-cell { gap: 5px; }

/* ---------- calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
  text-align: center;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 0;
}
.cal-day {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 5px;
  font-size: 12px;
  overflow: hidden;
  background: var(--surface);
}
.calendar.mini .cal-day { min-height: 62px; }
.calendar.full .cal-day { min-height: 96px; }
.cal-day.out { opacity: 0.45; }
.cal-day.today { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.cal-day.today .cal-num { color: var(--brass); font-weight: 700; }
.cal-num { color: var(--muted); font-size: 11px; }
.cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 3px;
  margin-top: 2px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}
.cal-chip:hover { background: var(--surface-2); }
.cal-chip .dot { flex: none; }
.cal-more { color: var(--muted); font-size: 11px; margin-top: 2px; }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- filters + table ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filters select, .filters input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 9px;
  color: var(--ink);
}
.filters input[type="search"] { flex: 1; min-width: 150px; }

.table-scroll { overflow-x: auto; }
.bookings-table { width: 100%; border-collapse: collapse; }
.bookings-table th {
  text-align: left;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
}
.bookings-table td {
  padding: 9px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  vertical-align: top;
}
.bookings-table tbody tr { cursor: pointer; }
.bookings-table tbody tr:hover { background: color-mix(in srgb, var(--brass) 7%, transparent); }
.bookings-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.b-title { font-weight: 700; }
.b-sub { color: var(--muted); font-size: 12px; }
.type-cell { display: inline-flex; align-items: center; gap: 6px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.empty { color: var(--muted); text-align: center; padding: 20px 0; }

/* ---------- documents ---------- */
.upload-row {
  display: grid;
  grid-template-columns: 2fr 2fr 2fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 900px) { .upload-row { grid-template-columns: 1fr; } }
.upload-row input[type="file"] { padding: 5px; }

.doc-card { margin-bottom: 14px; }
.doc-actions { display: flex; gap: 6px; flex: none; }
.sig-actions { white-space: nowrap; }
.sig-actions .btn { padding: 3px 8px; font-size: 12px; }

.req-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.req-form input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 6px 9px;
  color: var(--ink);
  flex: 1;
  min-width: 140px;
}

/* ---------- public signing page ---------- */
.sign-body { background: var(--bg); }
.sign-head {
  background: var(--pine);
  color: var(--on-pine);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(201, 164, 92, 0.25);
}
.sign-logo {
  width: 54px;
  height: auto;
  filter:
    drop-shadow(0 0 1px rgba(234, 231, 214, 0.9))
    drop-shadow(0 0 7px rgba(234, 231, 214, 0.45));
}
.sign-brand { font-family: var(--font-display); font-size: 19px; }
.sign-brand-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-on-pine);
}
.sign-main { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.sign-note { text-align: center; padding: 32px 24px; }
.sign-note h2 { margin-bottom: 8px; }
.sign-instructions { color: var(--ink-soft); margin: 0 0 12px; }
.doc-frame {
  width: 100%;
  /* US Letter proportions. Paired with #view=FitH the whole page lands in the
     frame at full width — nothing cut off, nothing to zoom. Capped so a large
     monitor doesn't produce an absurdly tall frame. */
  aspect-ratio: 8.5 / 11;
  max-height: 82vh;
  display: block;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
}
@media (max-width: 560px) {
  /* On a phone a full-page-tall frame pushes the signature form off-screen;
     a shorter window with the "open in a new tab" link is the better read. */
  .doc-frame { aspect-ratio: auto; height: 58vh; }
}
.sign-grid { display: grid; gap: 14px; }
#sig-pad {
  width: 100%;
  height: 160px;
  display: block;
  background: var(--bg);
  border: 1px dashed var(--brass);
  border-radius: 3px;
  touch-action: none;
  cursor: crosshair;
  margin: 4px 0 6px;
}
.consent { display: flex; gap: 10px; align-items: start; font-weight: 400; color: var(--ink-soft); font-size: 13px; }
.consent input { margin-top: 3px; width: 15px; height: 15px; }
.btn-sign { padding: 11px 18px; font-size: 15px; }
.sign-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 28px; }

/* ---------- modal ---------- */
dialog {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 24px;
  width: min(560px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(20, 26, 19, 0.55); }
dialog h2 { font-size: 19px; }
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-top: 14px;
}
.grid2 .span2 { grid-column: span 2; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .grid2 .span2 { grid-column: span 1; } }

label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
label input, label select, label textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blaze);
  outline-offset: 2px;
}
textarea { resize: vertical; }

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.modal-actions .spacer { flex: 1; }

.form-error { color: var(--status-critical); margin: 10px 0 0; }

/* ---------- small screens ---------- */
/* =====================================================================
   MOBILE
   The sidebar becomes a sticky top bar with a scrolling nav strip, tables
   scroll rather than squeeze, and every control clears a 44px touch target.
   ===================================================================== */
@media (max-width: 760px) {
  .app { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(201, 164, 92, 0.25);
  }

  /* Logo shrinks to a mark; the wordmark is in the page heading anyway. */
  .side-brand { padding: 6px 4px; border-bottom: 0; flex: none; }
  .brand-badge { width: 40px; }
  .brand-sub { display: none; }

  .side-nav {
    display: flex;
    flex: 1;
    gap: 2px;
    padding: 6px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    padding: 10px;
    min-height: 44px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--brass-on-pine); }
  .nav-sep { display: none; }

  .side-foot {
    border-top: 0;
    display: flex;
    gap: 2px;
    padding: 6px 0;
    flex: none;
  }
  /* Only the icons fit across a phone; names would wrap the bar. */
  .side-foot .nav-label, .side-user .nav-label { display: none; }
  .side-user { padding: 8px 6px; }
  #btn-collapse { display: none; }

  .main { padding: 14px 12px 32px; max-width: 100%; }
  .main-head { margin-bottom: 14px; gap: 10px; }
  .main-head h1 { font-size: 20px; }
  .head-icon { width: 32px; height: 32px; }

  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 11px 13px; }
  .tile-value { font-size: 25px; }
  .tile-sub { font-size: 11.5px; }

  .panel { padding: 13px; }
  .panel-head { flex-wrap: wrap; }

  .ucards { grid-template-columns: 1fr; }

  /* A 7-column month can't hold text on a phone: keep the grid legible and
     let the coloured dots carry the "something is booked" signal. */
  .calendar.mini .cal-day, .calendar.full .cal-day { min-height: 52px; padding: 2px; }
  .cal-chip { font-size: 0; gap: 0; padding: 1px; justify-content: center; }
  .cal-chip .dot { width: 7px; height: 7px; }
  .cal-more { font-size: 9px; text-align: center; }
  .cal-dow { font-size: 9px; letter-spacing: 0.02em; }
  .cal-num { font-size: 10px; }
  .cal-nav h2 { min-width: 0; font-size: 15px; }

  .filters { gap: 6px; }
  .filters select, .filters input { flex: 1 1 45%; min-height: 40px; }
  .filters input[type="search"] { flex: 1 1 100%; }

  .bookings-table th, .bookings-table td { padding: 8px 6px; font-size: 13px; }
  .bookings-table th { font-size: 9.5px; }

  /* Buttons are thumb targets, and primary actions span the row. */
  .btn { min-height: 44px; padding: 10px 14px; }
  .btn-ghost { min-height: 40px; }
  #btn-new, #btn-new-cal, #btn-upload { width: 100%; }
  .cal-actions { flex: 1 1 100%; }
  .cal-actions .btn { flex: 1; }

  dialog { padding: 16px; width: 100%; max-width: 100%; border-radius: 10px 10px 0 0; margin: auto 0 0; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }

  .req-form { flex-direction: column; }
  .req-form .btn { width: 100%; }
  .doc-actions { width: 100%; }
  .doc-actions .btn { flex: 1; }
  .sig-actions { display: flex; flex-wrap: wrap; gap: 4px; }

  .sec-tab { padding: 10px 8px; font-size: 13px; }
  .backup-codes { grid-template-columns: 1fr; }
}

/* iOS zooms the page when a focused input is under 16px. Applies to every
   text control on the app and the guest signing page alike. */
@media (max-width: 760px) {
  input, select, textarea,
  label input, label select, label textarea,
  .filters input, .filters select, .req-form input {
    font-size: 16px;
  }
}

/* ---------- two-factor ---------- */
.twofa-hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 2px; text-align: center; }

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-warning);
  margin-left: auto;
  flex: none;
}

.sec-status { display: flex; align-items: center; gap: 8px; margin: 14px 0 10px; font-size: 15px; }
.sec-copy { color: var(--ink-soft); margin: 0 0 12px; font-size: 13.5px; }
.sec-fine { color: var(--muted); font-size: 12px; margin-top: 8px; }
.sec-qr {
  display: block;
  margin: 10px auto 12px;
  width: 200px;
  height: 200px;
  background: #fff;      /* QR must stay high-contrast in dark mode */
  padding: 8px;
  border-radius: 4px;
}
.sec-manual code {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 3px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  word-break: break-all;
}
.sec-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px;
}
.sec-details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brass); }
.sec-details label { margin-top: 10px; }
.sec-details .btn { margin-top: 10px; }

.backup-codes {
  list-style: none;
  padding: 14px;
  margin: 0 0 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  letter-spacing: 0.04em;
}

/* ---------- security modal tabs + user directory ---------- */
.sec-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 4px;
}
.sec-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
  font-family: var(--font-display);
}
.sec-tab:hover { color: var(--ink); }
.sec-tab.active { color: var(--brass); border-bottom-color: var(--brass); }

.users-table td { vertical-align: middle; }
.users-table .sig-actions .btn { padding: 3px 8px; font-size: 12px; }
#security-modal { width: min(680px, calc(100vw - 32px)); }

/* ---------- 2FA method chooser ---------- */
.method-card {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--bg);
}
.method-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.method-card .rec {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blaze);
  margin-left: 6px;
}
.method-card .sec-copy { margin-bottom: 10px; }
.method-card label { margin-bottom: 10px; }

/* ---------- guest signing page on a phone ---------- */
@media (max-width: 620px) {
  .sign-head { padding: 10px 14px; gap: 10px; }
  .sign-logo { width: 40px; }
  .sign-brand { font-size: 16px; }
  .sign-brand-sub { font-size: 9px; }
  .sign-main { padding: 12px 10px 32px; }
  .sign-main .panel { padding: 13px; }
  .sign-instructions { font-size: 13.5px; }

  /* Signing is the whole job here: make the pad tall enough to sign with a
     finger and the confirm button impossible to miss. */
  #sig-pad { height: 190px; }
  .btn-sign { width: 100%; min-height: 52px; font-size: 16px; }
  #sig-clear { min-height: 44px; }
  .consent { font-size: 13px; }
  .consent input { width: 22px; height: 22px; margin-top: 1px; }

  .sign-note { padding: 24px 16px; }
  .sign-foot { font-size: 11px; padding: 0 12px 24px; }
}

/* The signature canvas must never scroll the page while being drawn on. */
#sig-pad { touch-action: none; }

/* ---------- phone: nav strip + tables as cards ---------- */
@media (max-width: 760px) {
  /* Four nav items plus the footer icons won't fit with labels, so only the
     current section is named — the page heading repeats it anyway. */
  .side-nav .nav-item .nav-label { display: none; }
  .side-nav .nav-item.active .nav-label { display: inline; }
  .side-nav .nav-item { padding: 10px 12px; }

  /* A six-column booking table shreds itself at this width. Each row becomes
     a card instead: title first, then dates, then the smaller facts. */
  .bookings-table, .bookings-table tbody, .bookings-table tr, .bookings-table td {
    display: block;
    width: 100%;
  }
  .bookings-table thead { display: none; }
  .bookings-table tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 13px;
    margin-bottom: 8px;
    background: var(--bg);
  }
  .bookings-table td { border: 0; padding: 0; font-size: 13.5px; }
  .bookings-table td:empty { display: none; }

  .bookings-table td:nth-child(2) { order: -1; }              /* booking name */
  .bookings-table td:nth-child(1) { order: 0; color: var(--ink-soft); }
  .bookings-table td:nth-child(3),
  .bookings-table td:nth-child(4) { order: 1; display: inline-block; width: auto; }
  .bookings-table td:nth-child(5) { order: 2; color: var(--muted); font-size: 12.5px; }
  .bookings-table td:nth-child(6) { order: 3; text-align: left; }
  .bookings-table td:nth-child(6):not(:empty)::before {
    content: 'Party of ';
    color: var(--muted);
  }
  /* type + status share one line under the dates */
  .bookings-table tr { position: relative; }
  .bookings-table td:nth-child(3) { margin-top: 4px; }
  .bookings-table td:nth-child(4) { margin-top: 4px; }

  /* Same treatment for the document signing-request rows. */
  .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
  .users-table thead { display: none; }
  .users-table tr {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 13px;
    margin-bottom: 8px;
  }
  .users-table td { border: 0; padding: 3px 0; }
}

@media (max-width: 760px) {
  /* Row-wrap instead of a column so type and status sit side by side. */
  .bookings-table tr { flex-direction: row; flex-wrap: wrap; align-items: baseline; }
  .bookings-table td:nth-child(1),
  .bookings-table td:nth-child(2),
  .bookings-table td:nth-child(5),
  .bookings-table td:nth-child(6) { width: 100%; }
  .bookings-table td:nth-child(3) { width: auto; margin-right: 16px; }
  .bookings-table td:nth-child(4) { width: auto; }
}
