:root {
    color-scheme: light;
    --ink: #102a43;
    --muted: #617487;
    --line: #d9e2ec;
    --paper: #ffffff;
    --wash: #f3f6f8;
    --free: #087f5b;
    --free-soft: #e6f5ef;
    --busy: #8a99a8;
    --busy-soft: #edf1f4;
    --focus: #1677ff;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--wash); }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 7% 0%, rgba(69, 176, 140, .12), transparent 24rem),
        var(--wash);
    font-size: 1rem;
    line-height: 1.5;
}

button, input, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.shell { width: min(1120px, 100%); margin: 0 auto; padding: 0 24px 64px; }

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    border-bottom: 1px solid rgba(16, 42, 67, .12);
}

.identity { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-weight: 730; }
.identity-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: white; font-size: .78rem; letter-spacing: .05em; }
.timezone { color: var(--muted); font-size: .88rem; }

.booking { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; width: min(880px, 100%); margin: 0 auto; padding-top: 48px; align-items: start; }
.booking > * { min-width: 0; }
.intro { grid-column: 1; }
.intro h1 { max-width: none; margin: 6px 0 14px; font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: .98; letter-spacing: -.055em; }
.intro > p:not(.eyebrow) { max-width: 54ch; margin: 0; color: var(--muted); font-size: 1.08rem; }
.access-error { padding: 12px 14px; border-radius: 12px; background: #fff1f1; color: #a61b1b !important; font-weight: 700; }
.manage-card { display: grid; gap: 5px; margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.manage-card span { color: var(--muted); }
.cancelled-label { width: fit-content; margin-top: 5px; padding: 4px 9px; border-radius: 999px; background: var(--busy-soft); font-size: .85rem; font-weight: 800; }
.text-button { width: fit-content; padding: 0; border: 0; background: transparent; color: var(--free); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.text-button.danger { color: #a61b1b; }
.eyebrow, .step { margin: 0; color: var(--free); font-weight: 750; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }

.meeting-types { grid-column: 1; margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meeting-types legend { grid-column: 1 / -1; margin-bottom: 8px; font-weight: 700; }
.type-card { position: relative; display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.75); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.type-card:hover { transform: translateY(-1px); border-color: #9fb3c5; }
.type-card:has(input:checked) { border-color: var(--ink); background: var(--paper); box-shadow: 0 7px 22px rgba(16, 42, 67, .08); }
.type-card input { position: absolute; opacity: 0; }
.type-card:has(input:focus-visible) { outline: 3px solid rgba(22,119,255,.3); outline-offset: 2px; }
.type-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--free-soft); color: var(--free); font-size: 1.15rem; }
.type-card strong, .type-card small { display: block; }
.type-card small { margin-top: 1px; color: var(--muted); font-size: .84rem; }

.calendar-panel { grid-column: 1; grid-row: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 24px; box-shadow: 0 20px 70px rgba(16,42,67,.08); min-height: 520px; }
.calendar-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.calendar-heading h2 { margin: 3px 0 0; font-size: 1.65rem; letter-spacing: -.025em; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: .84rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; }
.free-dot { background: var(--free); }

.week-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 22px 0 18px; padding: 5px; border-radius: 14px; background: var(--wash); }
.week-tab { min-height: 44px; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 650; }
.week-tab[aria-current="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 9px rgba(16,42,67,.09); }
.week-tab:focus-visible, .slot:focus-visible, .primary-button:focus-visible, .close-button:focus-visible { outline: 3px solid rgba(22,119,255,.35); outline-offset: 2px; }

.calendar-status { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 300px; color: var(--muted); text-align: center; }
.calendar-status.error { color: #a61b1b; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--free); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.days { display: grid; gap: 10px; }
.week-section { scroll-margin-top: 12px; }
.week-range-heading { margin: 26px 0 4px; color: var(--muted); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.week-section:first-child .week-range-heading { margin-top: 0; }
.day { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 15px; align-items: start; padding: 16px 0; border-top: 1px solid var(--line); }
.week-range-heading + .day { border-top: 0; }
.day-title strong, .day-title span { display: block; }
.day-title strong { font-size: 1rem; text-transform: capitalize; }
.day-title span { color: var(--muted); font-size: .86rem; }
.slot-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slot { min-height: 48px; padding: 7px 10px; border: 1px solid transparent; border-radius: 12px; text-align: left; }
.slot b, .slot small { display: block; }
.slot b { font-size: .95rem; }
.slot small { margin-top: 1px; font-size: .76rem; }
.slot.free { background: var(--free-soft); border-color: rgba(8,127,91,.18); color: #056548; cursor: pointer; }
.slot.free:hover { background: #d6eee5; border-color: var(--free); }
.empty-day { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .9rem; padding: 13px 4px; }

.booking-dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100dvh - 28px); margin: auto; padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 30px 100px rgba(16,42,67,.28); }
.booking-dialog::backdrop { background: rgba(8, 24, 38, .58); backdrop-filter: blur(4px); }
body.dialog-open { overflow: hidden; }
body.dialog-open::before { content: ""; position: fixed; inset: 0; z-index: 999; background: rgba(8, 24, 38, .58); backdrop-filter: blur(4px); }
.booking-dialog.dialog-fallback { position: fixed; inset: 0; z-index: 1000; overflow: auto; }
.booking-dialog form, .booking-dialog > div { position: relative; padding: 28px; }
.booking-dialog h2 { margin: 4px 0 4px; font-size: 1.7rem; }
.close-button { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--wash); color: var(--ink); cursor: pointer; font-size: 1.65rem; line-height: 1; }
.chosen-time { margin: 0 0 20px; color: var(--muted); font-weight: 620; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { font-weight: 650; font-size: .9rem; }
.form-grid label span { color: var(--muted); font-weight: 450; }
.form-grid input, .form-grid textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid #bcccdc; border-radius: 11px; padding: 11px 12px; color: var(--ink); background: white; font-size: 1rem; }
.form-grid textarea { resize: vertical; }
.form-grid input:focus, .form-grid textarea:focus { outline: 3px solid rgba(22,119,255,.18); border-color: var(--focus); }
.form-grid .full { grid-column: 1 / -1; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.primary-button { display: block; width: 100%; min-height: 52px; margin-top: 18px; border: 0; border-radius: 13px; background: var(--ink); color: white; cursor: pointer; font-weight: 750; }
.primary-button:hover { background: #163a5b; }
.primary-button:disabled { opacity: .6; cursor: wait; }
.privacy-note { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: .78rem; }
.privacy-note a, .site-footer a, .legal-page a { color: var(--free); }
.site-footer { display: flex; justify-content: center; gap: 18px; width: min(1120px, 100%); margin: 0 auto; padding: 0 24px 34px; color: var(--muted); font-size: .84rem; }
.legal-page { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 70px; }
.legal-page .identity { margin-bottom: 46px; }
.legal-page h1 { margin: 7px 0 10px; font-size: clamp(2.35rem, 8vw, 4.5rem); line-height: 1; letter-spacing: -.05em; }
.legal-page h2 { margin: 32px 0 8px; font-size: 1.2rem; }
.legal-page p { color: var(--muted); }
.legal-page h1 + p { margin-top: 0; font-size: .88rem; }
.known-customer { padding: 13px 14px; border-radius: 12px; background: var(--free-soft); color: #056548; font-weight: 700; }
.invite-contact label { display: block; font-weight: 650; font-size: .9rem; }
.invite-contact input { display: block; width: 100%; margin-top: 7px; border: 1px solid #bcccdc; border-radius: 11px; padding: 12px; color: var(--ink); background: white; font-size: 1rem; }
.invite-contact input:focus { outline: 3px solid rgba(22,119,255,.18); border-color: var(--focus); }
.form-error { margin: 15px 0 0; padding: 11px 13px; border-radius: 10px; background: #fff1f1; color: #a61b1b; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 15px; margin-top: 22px; }
.danger-button { background: #a61b1b; }
.success-dialog > div { text-align: center; }
.success-mark { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%; background: var(--free-soft); color: var(--free); font-size: 2rem; font-weight: 800; }
.success-dialog p { color: var(--muted); }

@media (max-width: 760px) {
    .shell { padding: 0 14px 36px; }
    .masthead { min-height: 62px; }
    .booking { grid-template-columns: 1fr; gap: 22px; padding-top: 30px; }
    .intro, .meeting-types, .calendar-panel { grid-column: 1; grid-row: auto; }
    .intro h1 { max-width: none; font-size: clamp(2.3rem, 12vw, 3.6rem); }
    .intro > p:not(.eyebrow) { max-width: 36ch; }
    .meeting-types { grid-template-columns: 1fr 1fr; margin-top: 0; }
    .meeting-types legend { grid-column: 1 / -1; }
    .type-card { min-height: 82px; align-items: flex-start; padding: 12px; }
    .type-icon { width: 36px; height: 36px; flex: 0 0 auto; }
    .calendar-panel { padding: 18px 14px; border-radius: 19px; min-height: 470px; }
    .calendar-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
    .week-tabs { overflow-x: auto; grid-template-columns: repeat(4, minmax(118px, 1fr)); margin-right: -4px; }
    .day { grid-template-columns: 1fr; gap: 9px; }
    .day-title { display: flex; gap: 8px; align-items: baseline; }
    .slot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .slot { min-height: 54px; }
    .booking-dialog { width: 100%; max-height: calc(100dvh - 8px); margin: auto 0 0; border-radius: 22px 22px 0 0; }
    .booking-dialog form, .booking-dialog > div { padding: 24px 18px calc(22px + env(safe-area-inset-bottom)); }
    .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
    .dialog-actions .text-button { min-height: 44px; width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .full { grid-column: 1; }
}

@media (max-width: 430px) {
    .timezone { display: none; }
    .meeting-types { grid-template-columns: 1fr; }
    .type-card { min-height: 68px; align-items: center; }
    .slot-list { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
