:root {
  --navy: #14213D;
  --ink: #14213D;
  --muted: #5b6477;
  --line: #d5d9e2;
  --bg: #f3f5f9;
  --card: #ffffff;
  --blue: #1f5fbf;
  --green: #6CC183;
  --amber: #F4C542;
  --red: #EB7268;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
header {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 5;
}
header h1 { font-size: 18px; margin: 0; flex: 1; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--green); color: var(--navy); }
.pill.off { background: var(--red); }
.pill.warn { background: var(--amber); }
main { max-width: 560px; margin: 0 auto; padding: 12px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
h2 { font-size: 17px; margin: 0 0 10px; }
label, legend { display: block; font-weight: 600; font-size: 14px; margin-top: 12px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-size: 17px; color: var(--ink);
  padding: 12px; border: 1px solid #9aa3b5; border-radius: 8px; background: #fff;
  min-height: 48px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid #8fb4ee; outline-offset: 1px; }
input.filled, textarea.filled { background: #fff8dc; border-color: #b58a00; }
input.bad, select.bad { border-color: #b3261e; border-width: 2px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 16px 0 0; padding: 4px 12px 12px; }
fieldset legend { margin: 0; padding: 0 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.row.spread { justify-content: space-between; margin-top: 0; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.error { color: #b3261e; font-size: 14px; font-weight: 600; margin: 4px 0 0; display: block; min-height: 0; }
.appt { font-size: 17px; margin: 8px 0 0; }
button { font: inherit; font-weight: 600; border-radius: 10px; border: 0; min-height: 48px; padding: 0 16px; cursor: pointer; }
button.primary { width: 100%; margin-top: 16px; min-height: 56px; font-size: 18px; background: var(--navy); color: #fff; }
button.primary:disabled { opacity: .6; }
button.secondary { background: #e4e9f3; color: var(--navy); border: 1px solid #9aa3b5; }
button.link { background: none; color: var(--blue); min-height: 44px; padding: 0 8px; }
button.mic { background: var(--blue); color: #fff; flex: 1; }
button.mic[aria-pressed="true"] { background: #b3261e; }
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button { flex: 1; background: none; border-radius: 0; min-height: 60px; color: var(--muted); border-top: 3px solid transparent; }
nav button.on { color: var(--navy); border-top-color: var(--navy); }
.badge { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--amber); color: var(--navy); font-size: 13px; }

/* Calendar: one row per day, one cell per time slot */
.cal { margin-top: 12px; overflow-x: auto; }
.cal table { border-collapse: separate; border-spacing: 3px; width: 100%; }
.cal th { font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; padding: 2px; }
.cal th.day { text-align: left; white-space: nowrap; color: var(--ink); font-size: 12px; padding-left: 0; }
.cal td { padding: 0; }
.cal .slot {
  width: 100%; min-height: 48px; min-width: 44px; border-radius: 8px; padding: 2px;
  color: var(--navy); font-weight: 700; font-size: 15px; border: 2px solid transparent;
}
.cal .slot small { display: block; font-weight: 500; font-size: 11px; }
.slot.open, .key.open { background: var(--green); }
.slot.last, .key.last { background: var(--amber); }
.slot.full, .key.full { background: var(--red); }
.slot.none, .key.none { background: #e4e7ee; color: var(--muted); }
.slot.picked { border-color: var(--navy); }
.slot:disabled { cursor: default; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; margin: 12px 0 0; }
.key { padding: 2px 10px; border-radius: 6px; color: var(--navy); font-weight: 600; }

.sent { list-style: none; margin: 8px 0 0; padding: 0; }
.sent li { border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 10px; align-items: center; }
.sent li div { flex: 1; min-width: 0; }
.sent li small { display: block; color: var(--muted); }
.status { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: var(--navy); white-space: nowrap; }
.status.sent { background: var(--green); }
.status.pending { background: var(--amber); }
.status.fix { background: var(--red); }
[hidden] { display: none !important; }
.who { text-align: center; }
#gate-msg { margin-top: 0; }
.help { margin-top: 12px; padding: 12px; border-radius: 8px; background: #F4C542; color: #14213D; }
.help p { margin: 6px 0; }
.help ol { margin: 6px 0; padding-left: 22px; }
.help li { margin: 4px 0; }
.help .hint { color: #14213D; }
.help button.link { color: #14213D; text-decoration: underline; }
input.doubt, textarea.doubt { border: 2px solid #b3261e; background: #fdecea; }
.doubt-note { display: block; color: #b3261e; font-size: 14px; font-weight: 600; margin-top: 4px; }
.doubt-note button.link { color: #14213D; text-decoration: underline; min-height: 36px; }
button:disabled { opacity: .55; }
#start-over { padding-left: 0; }
