/* Mobile-first styles for every page (public booking + admin). No framework. */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a; background: #f6f7f9; overflow-wrap: anywhere;
}
main, .page { max-width: 720px; margin: 0 auto; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 1.125rem; margin: 16px 0 8px; }
p { margin: 8px 0; }
img, svg, video { max-width: 100%; height: auto; }

/* Tap targets >= 44px; 16px controls so iOS never zooms on focus. */
button, input, select, textarea { font: inherit; font-size: 16px; }
button, .btn, input[type="submit"] {
  min-height: 44px; min-width: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid #1d4ed8; background: #1d4ed8; color: #fff; font-weight: 600; cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #f59e0b; outline-offset: 2px;
}
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]), select, textarea {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid #9ca3af; border-radius: 10px; background: #fff; color: inherit;
}
textarea { min-height: 96px; }
label { display: block; margin: 12px 0; font-weight: 600; }
input[type="radio"], input[type="checkbox"] { width: 22px; height: 22px; margin: 0 8px 0 0; vertical-align: middle; }
fieldset { border: 0; padding: 0; margin: 8px 0; }
fieldset label, label:has(> input[type="radio"]), label:has(> input[type="checkbox"]) {
  display: flex; align-items: center; min-height: 44px; margin: 4px 0; font-weight: 400;
}
form { margin: 8px 0; }
[role="alert"] { padding: 12px; border-radius: 10px; background: #fef3c7; }

/* Admin nav: wraps, never scrolls sideways. */
nav[aria-label="Admin"] { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 auto 8px; max-width: 720px; }
nav[aria-label="Admin"] a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border-radius: 999px; background: #e5e7eb; color: #111; text-decoration: none; font-weight: 600;
}
nav[aria-label="Admin"] a[aria-current="page"] { background: #1d4ed8; color: #fff; }
nav[aria-label="Admin"] .nav-logout { margin: 0 0 0 auto; }

/* Tables: real tables on wide screens, cards on phones. */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
td form { display: inline-flex; flex-wrap: wrap; gap: 8px; margin: 0; }
td form select { width: auto; flex: 1 1 140px; }
@media (max-width: 480px) {
  body { padding: 12px; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table { background: transparent; }
  tr { background: #fff; border-radius: 12px; margin: 0 0 12px; padding: 4px 0; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  td { border: 0; padding: 6px 14px; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: 13px; color: #6b7280; font-weight: 600; }
  td form, td form select { width: 100%; }
  td form button { flex: 1 1 auto; }
  form > button, form > .btn { width: 100%; }
}
ul.cards { list-style: none; padding: 0; margin: 0; }
ul.cards > li { background: #fff; border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
ul.cards > li form { margin-top: 8px; }

/* Public booking page. */
#booking .desc { color: #4b5563; }
#days { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 12px 0; }
#days button { background: #fff; color: #1d4ed8; padding: 8px; line-height: 1.2; min-height: 56px; }
#days button[aria-pressed="true"] { background: #1d4ed8; color: #fff; }
#days button span { display: block; font-size: 13px; font-weight: 400; }
#slots section h2 { margin-top: 8px; }
#slots section { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
#slots section h2 { grid-column: 1 / -1; }
#slots button[data-start-utc] { min-height: 48px; background: #fff; color: #1d4ed8; font-size: 17px; }
#slots button[aria-pressed="true"] { background: #1d4ed8; color: #fff; }
#details { background: #fff; border-radius: 12px; padding: 12px 14px 0; margin-top: 16px; }
#details .sticky-actions {
  position: sticky; bottom: 0; margin: 12px -14px 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); border-top: 1px solid #e5e7eb; border-radius: 0 0 12px 12px;
}
#details .sticky-actions button { width: 100%; min-height: 52px; font-size: 18px; }
#chosen { font-weight: 700; }
@media (min-width: 481px) { #slots section { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } }
.btn.secondary, button.secondary { background: #fff; color: #1d4ed8; }
button.danger { background: #fff; color: #b91c1c; border-color: #b91c1c; }
td .btn, td form { vertical-align: middle; }
@media (max-width: 480px) {
  td:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  td:last-child > * { flex: 1 1 120px; }
  td:last-child form button { width: 100%; }
}

/* Shareable links (admin). */
.notice { background: #fff; border-radius: 12px; padding: 12px 14px; margin: 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.notice h2 { margin-top: 0; }
.notice.success { border-left: 4px solid #16a34a; }
.notice.warn { border-left: 4px solid #d97706; background: #fffbeb; }
.hint { color: #4b5563; font-size: 14px; }
code { font-size: 14px; overflow-wrap: anywhere; }
.share { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; color: #1d4ed8; overflow-wrap: anywhere; word-break: break-all; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions > * { flex: 1 1 120px; }
button.copy-link { min-height: 48px; }
button.copy-link.copied { background: #16a34a; border-color: #16a34a; }
table.links td[data-label="Shareable link"] { min-width: 240px; }
@media (max-width: 480px) { table.links td[data-label="Shareable link"] { min-width: 0; } }
form span[role="alert"] { display: block; color: #b91c1c; font-weight: 600; margin-top: -6px; }
