:root {
    --paper:      #F1F3EF;
    --surface:    #FFFFFF;
    --surface-2:  #F7F8F5;
    --ink:        #101A16;
    --ink-soft:   #47564F;
    --ink-faint:  #6E7C75;
    --line:       #DCE1DA;
    --line-firm:  #C3CCC2;
    --brand:      #17564A;
    --brand-lit:  #2F8B71;
    --brand-wash: #E7EFEA;
    --focus:      #2F8B71;
    --shadow:     0 1px 2px rgba(16,26,22,.06), 0 8px 24px -12px rgba(16,26,22,.18);
    --shadow-lift:0 2px 4px rgba(16,26,22,.08), 0 18px 40px -16px rgba(16,26,22,.28);
    --r:          14px;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper:      #0B120F;
      --surface:    #141F1A;
      --surface-2:  #1A2721;
      --ink:        #EAF0EB;
      --ink-soft:   #AFBDB5;
      --ink-faint:  #8A9891;
      --line:       #26332C;
      --line-firm:  #35453C;
      --brand:      #58B296;
      --brand-lit:  #7ACCAF;
      --brand-wash: #16271F;
      --focus:      #7ACCAF;
      --shadow:     0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
      --shadow-lift:0 2px 4px rgba(0,0,0,.5), 0 18px 40px -16px rgba(0,0,0,.7);
    }
  }
  :root[data-theme="dark"] {
    --paper:      #0B120F;
    --surface:    #141F1A;
    --surface-2:  #1A2721;
    --ink:        #EAF0EB;
    --ink-soft:   #AFBDB5;
    --ink-faint:  #8A9891;
    --line:       #26332C;
    --line-firm:  #35453C;
    --brand:      #58B296;
    --brand-lit:  #7ACCAF;
    --brand-wash: #16271F;
    --focus:      #7ACCAF;
    --shadow:     0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lift:0 2px 4px rgba(0,0,0,.5), 0 18px 40px -16px rgba(0,0,0,.7);
  }

  * { box-sizing: border-box; }

/* The `hidden` attribute must always win. A class that sets `display` has
   higher specificity than the browser's own [hidden] rule, so without this a
   panel marked hidden stays on screen and nothing can dismiss it. */
[hidden] { display: none !important; }


  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* ---------- branch bar ---------- */
  .branchbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 14px 20px 13px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .cross {
    width: 26px; height: 26px; flex: none;
    color: var(--brand);
  }
  .branchbar .who { display: flex; flex-direction: column; min-width: 0; }
  .branchbar .name {
    font-family: "Bricolage Grotesque", "Public Sans", sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.015em;
    line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .branchbar .addr {
    font-size: 13px;
    color: var(--ink-faint);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* ---------- progress ---------- */
  .progress {
    display: flex;
    gap: 6px;
    padding: 0 20px;
    margin-top: 18px;
    max-width: 460px;
    width: 100%;
    margin-inline: auto;
  }
  .progress span {
    flex: 1;
    height: 4px;
    border-radius: 99px;
    background: var(--line-firm);
    transition: background .35s ease;
  }
  .progress span.on { background: var(--brand); }

  /* ---------- shell ---------- */
  main {
    flex: 1;
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
    padding: 26px 20px 40px;
    display: flex;
    flex-direction: column;
  }

  .step { display: none; flex-direction: column; flex: 1; }
  .step.active { display: flex; animation: rise .34s cubic-bezier(.2,.7,.3,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .step.active { animation: none; }
    * { transition-duration: .01ms !important; }
  }

  h1 {
    font-family: "Bricolage Grotesque", "Public Sans", sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.1;
    letter-spacing: -.03em;
    text-wrap: balance;
    margin: 0 0 8px;
  }
  .lede {
    color: var(--ink-soft);
    margin: 0 0 26px;
    font-size: 16px;
    max-width: 34ch;
  }

  /* ---------- form ---------- */
  label.field { display: block; margin-bottom: 18px; }
  label.field .lab {
    display: block;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--ink-soft);
    margin-bottom: 7px;
  }
  input[type="text"], input[type="tel"], input[type="email"],
  input[type="password"], input[type="date"], input[type="number"] {
    width: 100%;
    font-family: inherit;
    font-size: 19px;           /* >16px: stops iOS zoom-on-focus */
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line-firm);
    border-radius: var(--r);
    padding: 15px 16px;
    min-height: 56px;
    transition: border-color .16s ease, box-shadow .16s ease;
  }
  input::placeholder { color: var(--ink-faint); opacity: .75; }
  input:focus-visible {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent);
  }
  input[aria-invalid="true"] { border-color: #B22A20; }
  :root[data-theme="dark"] input[aria-invalid="true"],
  :root:not([data-theme="light"]) input[aria-invalid="true"] { border-color: #F2736A; }
  .hint { font-size: 13.5px; color: var(--ink-faint); margin-top: 7px; }
  .err {
    font-size: 14px;
    font-weight: 500;
    color: #B22A20;
    margin-top: 8px;
    display: none;
  }
  .err.show { display: block; }

  .dob-row { display: flex; gap: 10px; }
  .dob-row label.field { flex: 1; margin-bottom: 0; }
  .dob-row input { text-align: center; font-family: "IBM Plex Mono", monospace; }

  /* ---------- reason list ---------- */
  .reasons { display: flex; flex-direction: column; gap: 10px; }
  .reason {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 18px;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--r);
    padding: 18px 16px;
    min-height: 66px;
    cursor: pointer;
    transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
  }
  .reason:hover { border-color: var(--brand); }
  .reason:active { transform: scale(.985); }
  .reason:focus-visible {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent);
  }
  .reason .chev { margin-left: auto; color: var(--ink-faint); flex: none; }
  .reason .dot {
    width: 9px; height: 9px; border-radius: 99px;
    background: var(--brand); flex: none;
    opacity: .85;
  }

  /* ---------- buttons ---------- */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .01em;
    min-height: 58px;
    padding: 16px 20px;
    border-radius: var(--r);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform .14s ease, filter .14s ease;
  }
  .btn:active { transform: scale(.99); }
  .btn:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 30%, transparent); }
  .btn-primary { background: var(--brand); color: #FFFFFF; }
  :root[data-theme="dark"] .btn-primary,
  :root:not([data-theme="light"]) .btn-primary { color: #06120E; }
  @media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .btn-primary { color: #FFFFFF; } }
  .btn-primary:hover { filter: brightness(1.08); }
  .btn-quiet {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line-firm);
    min-height: 50px;
    font-size: 16px;
  }
  .btn-quiet:hover { border-color: var(--ink-faint); color: var(--ink); }

  .actions { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; gap: 12px; }

  .privacy {
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--ink-faint);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
  }

  /* ---------- confirmation ---------- */
  .tick-wrap {
    display: flex; align-items: center; justify-content: center;
    width: 84px; height: 84px; border-radius: 99px;
    background: var(--brand-wash);
    color: var(--brand);
    margin: 8px 0 22px;
  }
  .tick { width: 40px; height: 40px; }
  .tick path {
    stroke-dasharray: 48; stroke-dashoffset: 48;
    animation: draw .5s .12s cubic-bezier(.4,0,.2,1) forwards;
  }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @media (prefers-reduced-motion: reduce) { .tick path { animation: none; stroke-dashoffset: 0; } }

  .recap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 4px 16px;
    margin-top: 24px;
  }
  .recap dl { margin: 0; }
  .recap .row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
  }
  .recap .row:last-child { border-bottom: none; }
  .recap .row[hidden] { display: none; }   /* class rule would otherwise beat the hidden attribute */
  .recap dt { font-size: 14px; color: var(--ink-faint); }
  .recap dd { margin: 0; font-size: 16px; font-weight: 600; text-align: right; }

  .reassure {
    display: flex; gap: 11px; align-items: flex-start;
    margin-top: 22px; font-size: 15px; color: var(--ink-soft);
  }
  .reassure svg { flex: none; margin-top: 2px; color: var(--brand); }


  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- server-rendered additions ---------- */
.notice {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--brand-wash);
  border: 1px solid var(--brand);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 22px;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.45;
}
.notice svg { flex: none; margin-top: 2px; color: var(--brand); }
.notice b { font-weight: 600; }

.reason.selected { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.reasons input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }

.err-summary {
  background: #FDECEA; border: 1px solid #E2A9A3; color: #8C1F16;
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; font-size: 15px;
}
:root[data-theme="dark"] .err-summary,
:root:not([data-theme="light"]) .err-summary { background: #2B1512; border-color: #6B2C25; color: #FFB4AA; }
.err-summary ul { margin: 6px 0 0; padding-left: 18px; }

/* Reason label with an optional clarifying line beneath it. */
.reason .rlabel { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.reason .rhint {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink-faint);
}

/* ---------- grouped reasons ---------- */
.rgroup { display: flex; flex-direction: column; gap: 10px; }
.rgroup-head {
  font-family: inherit;
  cursor: pointer;
}
.rgroup.open .rgroup-head { border-color: var(--brand); }
.rgroup.open .rgroup-head .chev { transform: rotate(90deg); }
.rgroup-head .chev { transition: transform .16s ease; }
.rchildren { display: flex; flex-direction: column; gap: 10px; padding-left: 18px; }
.reason.child { min-height: 60px; background: var(--surface-2); }

/* ---------- appointment times ---------- */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 66px; padding: 10px 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color .14s ease, transform .14s ease;
}
.slot:hover { border-color: var(--brand); }
.slot:active { transform: scale(.98); }
.slot.selected { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot .t {
  font-family: "IBM Plex Mono", monospace;
  font-size: 19px; font-weight: 600; letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.slot .off { font-size: 12px; color: var(--ink-faint); }
.slot.is-now { border-color: var(--brand); background: var(--brand-wash); }
.slot.is-now .off { color: var(--brand); font-weight: 600; }

/* ---------- the number they watch for ---------- */
.ticket {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--brand-wash);
  border: 1.5px solid var(--brand);
  border-radius: 16px;
  padding: 18px 20px 20px;
  margin: 4px 0 22px;
  text-align: center;
}
.ticket .tk-lab {
  font-size: 13px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--brand);
}
.ticket .tk-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 58px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.02em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ticket .tk-note { font-size: 13.5px; color: var(--ink-soft); }

/* Tenant wordmark. Sat on a white plate so a two-tone logo reads on any
   ground, light or dark, without needing a second artwork file. */
.branchbar .brandbox {
  display: inline-flex; align-items: center;
  background: #FFFFFF; border-radius: 8px; padding: 5px 8px; flex: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.branchbar .brandbox img { height: 26px; width: auto; display: block; }
