:root {
  --navy: #002035;
  --blue: #2b5baa;
  --blue-soft: #e8eff9;
  --orange: #ffa300;
  --orange-dark: #e69200;
  --text: #14202b;
  --muted: #5b6875;
  --line: #dfe4ea;
  --bg: #ffffff;
  --page: #f3f5f8;
  --danger: #b42318;
  --ok: #1f7a3d;
  --radius: 10px;
  font: 16px/1.5 "Avenir Next", Avenir, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Standalone (not in a popup): center the card on a navy page. */
body.standalone { background: var(--navy); }
body.standalone .shell { max-width: 760px; margin: 0 auto; height: 100dvh; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
@media (min-width: 800px) {
  body.standalone { padding: 24px 0; }
  body.standalone .shell { height: calc(100dvh - 48px); border-radius: 16px; overflow: hidden; }
}

.shell { display: flex; flex-direction: column; height: 100dvh; background: var(--bg); }

/* Header */
.top { display: flex; align-items: center; gap: 18px; padding: 14px 20px; background: var(--navy); color: #fff; }
.logo { width: 84px; height: auto; display: block; }
.brand { border-left: 1px solid rgba(255, 255, 255, .35); padding-left: 18px; line-height: 1.3; }
.brand strong { display: block; font-size: 19px; letter-spacing: .02em; text-transform: uppercase; }
.brand span { font-size: 15px; color: rgba(255, 255, 255, .8); }
.close { margin-left: auto; background: none; border: 0; color: #fff; padding: 8px; border-radius: 8px; cursor: pointer; }
.close:hover, .close:focus-visible { background: rgba(255, 255, 255, .12); }
.close svg { width: 28px; height: 28px; }

/* Step indicator */
.steps { border-bottom: 1px solid var(--line); padding: 12px 12px 10px; }
.steps ol { list-style: none; margin: 0 auto; padding: 0; display: flex; justify-content: space-between; max-width: 640px; }
.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); position: relative; }
.steps li::after { content: ""; position: absolute; top: 17px; left: calc(50% + 24px); right: calc(-50% + 24px); height: 2px; background: var(--line); border-radius: 2px; }
.steps li:last-child::after { display: none; }
.steps .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #9aa5b1; color: #6b7783; background: #fff; }
.steps .dot svg { width: 18px; height: 18px; }
.steps li.current { color: var(--navy); font-weight: 600; }
.steps li.current .dot { border-color: var(--navy); color: var(--navy); }
.steps li.done .dot { background: var(--navy); border-color: var(--navy); color: #fff; }
.steps li.done::after { background: var(--navy); }

/* Content */
main { flex: 1; overflow-y: auto; padding: 24px 24px 32px; outline: none; -webkit-overflow-scrolling: touch; }
.step { max-width: 640px; margin: 0 auto; }
h2 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; color: var(--text); }
h3 { font-size: 19px; line-height: 1.3; margin: 28px 0 12px; }
.lede { color: var(--muted); margin: 0 0 18px; }
.center { text-align: center; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

label.field { display: block; font-weight: 600; font-size: 15px; margin: 0 0 6px; }
label.field .req { color: var(--danger); margin-left: 2px; }
.input { width: 100%; padding: 12px 14px; border: 1px solid #c9d1da; border-radius: 8px; background: #fff; font-size: 17px; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43, 91, 170, .2); }
.input.invalid { border-color: var(--danger); }
.err { color: var(--danger); font-size: 14px; margin-top: 4px; min-height: 0; }
textarea.input { min-height: 96px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.grid2 > div { min-width: 0; }
.span2 { grid-column: 1 / -1; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* Service tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px 14px; border: 1px solid #cfd6de; border-radius: var(--radius); background: #fff; cursor: pointer; text-align: center; font-size: 15px; color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.tile svg { width: 44px; height: 44px; color: var(--navy); stroke-width: 1.5; }
.tile .halo { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); }
.tile:hover { border-color: #9fb2cc; }
.tile:focus-visible { outline: 3px solid rgba(43, 91, 170, .35); outline-offset: 2px; }
.tile[aria-pressed="true"] { border: 2px solid var(--blue); color: var(--text); font-weight: 600; padding: 17px 7px 13px; }
.tile[aria-pressed="true"]::before { content: ""; position: absolute; top: -10px; left: -10px; width: 24px; height: 24px; border-radius: 50%; background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* Chips (options and answers) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 10px 16px; border: 1px solid #cfd6de; border-radius: 8px; background: #fff; cursor: pointer; font-size: 16px; text-align: left; }
.chip:hover { border-color: #9fb2cc; }
.chip:focus-visible { outline: 3px solid rgba(43, 91, 170, .35); outline-offset: 2px; }
.chip[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-soft); padding: 9px 15px; font-weight: 600; }

/* Schedule */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; margin: 18px 0 20px; }
.seg button { padding: 12px; border: 0; background: #fff; cursor: pointer; font-size: 17px; }
.seg button + button { border-left: 1.5px solid var(--navy); }
.seg button[aria-pressed="true"] { background: #c4d2e7; font-weight: 600; }
.label-caps { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.tz { display: flex; align-items: center; gap: 10px; color: var(--text); }
.tz svg { color: var(--muted); width: 20px; height: 20px; }
.slots { display: grid; gap: 10px; }
.slot { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid #cfd6de; border-radius: var(--radius); cursor: pointer; font-size: 17px; background: #fff; }
.slot input { width: 22px; height: 22px; accent-color: var(--navy); margin: 0; flex: none; }
.slot:has(input:checked) { border: 2px solid var(--navy); padding: 15px 17px; box-shadow: 0 2px 6px rgba(0, 32, 53, .15); }
.slot:has(input:focus-visible) { outline: 3px solid rgba(43, 91, 170, .35); outline-offset: 2px; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: #fff7e6; border: 1px solid #f5d8a0; margin: 16px 0; }
.note svg { color: #9a5b00; margin-top: 2px; }
.note.info { background: var(--blue-soft); border-color: #c4d2e7; }
.note.info svg { color: var(--blue); }
.note p { margin: 0; }
.call-line { margin-top: 18px; color: var(--muted); font-size: 15px; }
.call-line a, .link { color: var(--blue); font-weight: 600; }

.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cal-head strong { font-size: 19px; min-width: 112px; }
.cal-head .today { margin-left: auto; }
.icon-btn { border: 0; background: none; padding: 8px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.icon-btn:hover:not(:disabled) { background: var(--page); }
.icon-btn:disabled { color: #b6bec7; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .dow { font-size: 14px; color: var(--muted); padding: 6px 0; }
.cal button { aspect-ratio: 1.2; max-height: 56px; border: 0; border-radius: 8px; background: none; font-size: 17px; cursor: pointer; }
.cal button:hover:not(:disabled) { background: var(--blue-soft); }
.cal button:disabled { color: #b6bec7; text-decoration: line-through; cursor: default; }
.cal button.has { font-weight: 600; }
.cal button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* Returning customer badge */
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.badge-ok { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ok); font-weight: 600; }
.badge-ok svg { width: 18px; height: 18px; }

.check { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; cursor: pointer; font-size: 16px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

/* Review */
.summary { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.summary .tile-mini { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; color: var(--navy); }
.summary .tile-mini svg { width: 40px; height: 40px; stroke-width: 1.5; }
.summary h3 { margin: 0 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--page); border-radius: 6px; padding: 4px 10px; font-size: 15px; }
.meta { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.meta li { display: flex; gap: 10px; align-items: center; }
.meta svg { width: 20px; height: 20px; color: var(--muted); }
.ts { margin: 18px 0 6px; min-height: 65px; }

/* Done */
.done-mark { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 24px auto 16px; }
.done-mark svg { width: 38px; height: 38px; stroke-width: 2.6; }
.test-mode { display: inline-block; margin-top: 12px; padding: 6px 12px; border-radius: 6px; background: #fff7e6; border: 1px solid #f5d8a0; font-size: 14px; }

/* Footer buttons */
.actions { display: flex; justify-content: space-between; gap: 12px; padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 26px; border-radius: 8px; border: 0; font-size: 18px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 52px; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--orange); color: var(--navy); }
.btn.primary:hover:not(:disabled) { background: var(--orange-dark); }
.btn.primary:disabled { background: #f3d8a6; color: rgba(0, 32, 53, .55); cursor: default; }
.btn.secondary { background: #eef1f4; color: var(--text); font-weight: 500; }
.btn.secondary:hover { background: #e2e7ec; }
.btn:focus-visible { outline: 3px solid rgba(43, 91, 170, .4); outline-offset: 2px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 20px; height: 20px; border: 3px solid rgba(0, 32, 53, .3); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0, 32, 53, .55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-card { background: #fff; border-radius: 12px; width: 100%; max-width: 440px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 22px; }
.modal-body { padding: 20px; }
.modal-body p { margin: 0 0 12px; font-size: 17px; }
.modal-art { width: 132px; height: 132px; border-radius: 50%; background: var(--page); margin: 8px auto 0; display: grid; place-items: center; color: var(--navy); }
.modal-art svg { width: 76px; height: 76px; stroke-width: 1.4; }
.modal-foot { display: flex; justify-content: space-between; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .top { padding: 12px 16px; gap: 12px; }
  .logo { width: 64px; }
  .brand { padding-left: 12px; }
  .brand strong { font-size: 16px; }
  .brand span { font-size: 13px; }
  .steps { padding: 10px 4px 8px; }
  .steps li { font-size: 11px; }
  .steps .dot { width: 32px; height: 32px; }
  .steps li::after { top: 15px; left: calc(50% + 20px); right: calc(-50% + 20px); }
  main { padding: 20px 16px 28px; }
  h2 { font-size: 21px; }
  .actions { padding-left: 16px; padding-right: 16px; }
  .btn { padding: 12px 18px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
