/* Chicago Skin Clinic — waitlist UI
   Mobile-first; WCAG AA contrast; large tap targets (>=48px, kiosk >=64px). */

:root {
  --teal: #12555a;
  --teal-dark: #0c3d41;
  --teal-tint: #e3efee;
  --gold: #c9a227;
  --gold-ink: #6f5a0e;
  --bg: #f7f4ee;
  --card: #ffffff;
  --ink: #1d2528;
  --muted: #55666a;
  --line: #d9d4c8;
  --danger: #a52e2e;
  --ok: #1e6b40;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 35, 37, 0.06), 0 8px 24px rgba(20, 35, 37, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 20px;
}
.logo { height: 40px; width: auto; display: block; }

h1 { font-size: 1.65rem; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p.lede { color: var(--muted); margin: 0 0 20px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}

/* ---- Language toggle ---- */
.lang-toggle { display: flex; gap: 6px; }
.lang-toggle button {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 8px 12px;
  min-width: 48px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* ---- Form ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
input[type="text"],
input[type="tel"] {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 14px;
  min-height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 20px;
}
fieldset legend { font-weight: 600; padding: 0; margin-bottom: 10px; }

/* Tag selections as large tap targets */
.choices { display: grid; gap: 10px; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choices.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 420px) {
  .choices.cols-3 { grid-template-columns: 1fr; }
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 56px;
  padding: 12px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.choice input:checked + span {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.choice input:focus-visible + span {
  outline: 3px solid var(--teal-dark);
  outline-offset: 2px;
}

/* Provider cards: photo + name so nobody confuses the doctors.
   The roster is settings-driven, so the grid adapts to any provider count. */
.choices.providers {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.choice-photo span {
  flex-direction: column;
  gap: 10px;
  padding: 16px 10px 14px;
  min-height: 150px;
}
.choice-photo img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--teal-tint);
  border: 3px solid var(--line);
}
.choice-photo input:checked + span img {
  border-color: #fff;
}
.choice-photo b { font-weight: 700; line-height: 1.25; }
body.kiosk .choice-photo img { width: 104px; height: 104px; }
body.kiosk .choice-photo span { min-height: 190px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  min-height: 56px;
  padding: 14px 20px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-dark); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--teal); border-color: var(--teal); }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-quiet { background: transparent; color: var(--muted); border: 0; min-height: 48px; }

.form-error {
  display: none;
  background: #fbeaea;
  color: var(--danger);
  border: 1px solid #e5b9b9;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
  font-weight: 600;
}
.form-error.visible { display: block; }

/* ---- Status page ---- */
.status-hero { text-align: center; padding: 30px 18px; }
.position-big {
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--teal);
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
}
.eta-range { font-size: 1.15rem; color: var(--ink); font-weight: 600; }
.auto-note { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.notified-banner {
  display: none;
  background: var(--teal-tint);
  color: var(--teal-dark);
  border: 1.5px solid var(--teal);
  border-radius: 12px;
  padding: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}
.notified-banner.visible { display: block; }
.status-actions { margin-top: 20px; }

.promo { margin-top: 34px; }
.promo h2 { color: var(--teal-dark); }
.promo-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.promo-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.promo-card p { margin: 0; color: var(--muted); }
.promo-card a { color: var(--teal); font-weight: 700; }

/* Terminal-state pages */
.state-card { text-align: center; padding: 36px 20px; }
.state-card .emoji { font-size: 2.6rem; display: block; margin-bottom: 10px; }

/* ---- Cancel dialog ---- */
dialog {
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 360px;
  width: calc(100vw - 48px);
}
dialog::backdrop { background: rgba(18, 37, 40, 0.5); }
dialog h2 { margin: 0 0 8px; }
dialog p { margin: 0 0 20px; color: var(--muted); }
dialog .btn + .btn { margin-top: 10px; }

/* ---- Kiosk mode ---- */
body.kiosk {
  font-size: 130%;
  user-select: none;
  -webkit-user-select: none;
}
body.kiosk .page { max-width: 760px; padding-top: 32px; }
body.kiosk .choice span { min-height: 80px; font-size: 1.15em; }
body.kiosk .btn { min-height: 76px; font-size: 1.2em; }
body.kiosk input[type="text"],
body.kiosk input[type="tel"] { min-height: 68px; font-size: 1.2em; }
body.kiosk .lang-toggle button { min-height: 60px; min-width: 76px; font-size: 1em; }

.kiosk-step { display: none; }
.kiosk-step.active { display: block; }
.kiosk-welcome { text-align: center; padding: 8vh 16px 0; }
.kiosk-welcome .logo { height: 56px; margin: 0 auto 24px; }
.kiosk-welcome h1 { font-size: 2.4rem; }
.kiosk-big-q { font-size: 1.6rem; font-weight: 700; text-align: center; margin: 24px 0; }
.kiosk-done { text-align: center; padding: 6vh 16px 0; }
.kiosk-done .position-big { font-size: 6rem; }
.kiosk-reset-note { color: var(--muted); margin-top: 28px; }
.kiosk-nav { display: flex; gap: 12px; margin-top: 24px; }
.kiosk-nav .btn { flex: 1; }

/* ================= Front desk ================= */

body.desk { font-size: 15px; }
.desk-shell { max-width: 1200px; margin: 0 auto; padding: 16px 20px 60px; }
.desk-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 6px 0 16px; flex-wrap: wrap;
}
.desk-brand { display: flex; align-items: center; gap: 12px; }
.desk-brand .logo { height: 34px; }
.desk-title { font-weight: 800; font-size: 1.15rem; color: var(--teal-dark); }
.desk-header-actions { display: flex; gap: 8px; }
.btn-compact { width: auto; min-height: 42px; padding: 8px 16px; font-size: 0.95rem; border-radius: 10px; }

.desk-login .card { max-width: 380px; margin: 8vh auto 0; }
.pin-input {
  width: 100%; font-size: 1.8rem; text-align: center; letter-spacing: 0.4em;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 14px;
}

/* Next-up lanes */
.lanes {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.lane {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 14px; border-top: 4px solid var(--teal);
}
.lane-empty { opacity: 0.65; border-top-color: var(--line); }
.lane header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lane h3 { margin: 0; font-size: 0.95rem; }
.lane-count { color: var(--muted); font-size: 0.8rem; }
.lane-photo { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--teal-tint); }
.lane-photo-generic { display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.lane-next { margin-bottom: 8px; }
.lane-name { display: block; font-weight: 700; }
.lane-meta { color: var(--muted); font-size: 0.82rem; }
.lane-empty-note { color: var(--muted); font-style: italic; }
.lane-take { width: 100%; }

/* Toolbar */
.desk-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 0.88rem; font-weight: 600; padding: 7px 14px;
  border-radius: 999px; cursor: pointer; min-height: 38px;
}
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.desk-search {
  flex: 1; min-width: 180px; font: inherit; padding: 9px 14px; min-height: 40px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
}

/* Queue list */
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 14px;
}
.queue-row.status-pending { opacity: 0.62; }
.queue-row.status-notified { border-left: 4px solid var(--gold); }
.queue-row.dragging { opacity: 0.4; }
.queue-row.drop-above { box-shadow: 0 -3px 0 0 var(--teal), var(--shadow); }
.row-grip { cursor: grab; color: var(--muted); font-size: 1.05rem; letter-spacing: -2px; user-select: none; }
.row-pos { font-weight: 800; color: var(--teal); min-width: 34px; font-size: 1.05rem; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-name { font-weight: 700; }
.row-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
  font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--teal-tint); color: var(--teal-dark); white-space: nowrap;
}
.badge-provider.pc-teal { background: #d9ebe9; color: #0c3d41; }
.badge-provider.pc-gold { background: #f2e8c9; color: #6f5a0e; }
.badge-provider.pc-plum { background: #ecdcec; color: #5c2a5c; }
.badge-provider.pc-slate { background: #dfe5ea; color: #33434d; }
.badge-provider.pc-rust { background: #f4ded3; color: #7a3b16; }
.badge-provider.pc-neutral { background: #e9e4d8; color: #5a5340; }
.badge-callname { background: #fdeacc; color: #7a4b09; }
.badge-warn { background: #fbdcdc; color: var(--danger); }
.badge-notified { background: #e0f0e6; color: var(--ok); }
.badge-pending { background: #eee9df; color: #6b6350; }
.row-meta { color: var(--muted); font-size: 0.82rem; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row-remove { color: var(--danger); }
.row-arrows { display: flex; flex-direction: column; gap: 2px; }
.arrow {
  border: 1px solid var(--line); background: var(--card); border-radius: 6px;
  cursor: pointer; font-size: 0.7rem; padding: 2px 7px; color: var(--muted);
}
.queue-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(18, 37, 40, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 40; padding: 20px;
}
/* display:flex above would defeat the hidden attribute — keep it authoritative */
.modal-backdrop[hidden] { display: none; }
.modal { max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field select {
  width: 100%; font: inherit; padding: 12px; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
.switch-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 14px; cursor: pointer; }
.switch-row input { width: 22px; height: 22px; }

/* Settings */
.settings-shell { max-width: 860px; }
.settings-card { margin-bottom: 18px; }
.settings-card h2 { margin-top: 0; }
.settings-card .btn-compact { margin-top: 10px; margin-right: 8px; }
.save-note {
  position: sticky; top: 8px; z-index: 30; background: #e0f0e6; color: var(--ok);
  border-radius: 10px; padding: 10px 14px; font-weight: 700; box-shadow: var(--shadow);
}
.save-note-error { background: #fbdcdc; color: var(--danger); }
.provider-editor { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.provider-thumb { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--teal-tint); }
.provider-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.provider-name { width: 100%; font: inherit; font-weight: 600; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.provider-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.provider-tools .btn-compact { margin: 0; }
.photo-btn { cursor: pointer; }
.provider-remove { color: var(--danger); }
.template-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.template-group summary { font-weight: 700; cursor: pointer; }
.template-group .field { margin-top: 12px; }
textarea {
  width: 100%; font: inherit; font-size: 0.92rem; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; resize: vertical; background: #fff;
}

@media (max-width: 760px) {
  .queue-row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .field-row { grid-template-columns: 1fr; }
}

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