:root {
    color-scheme: light;
    --navy: #0b477c;
    --navy-dark: #073457;
    --blue-soft: #e9f3fb;
    --sky: #4c9bd3;
    --orange: #e8752d;
    --orange-soft: #fff1e7;
    --green: #1d7a55;
    --green-soft: #e8f7f0;
    --red: #b33a3a;
    --red-soft: #fff0f0;
    --ink: #183042;
    --muted: #607483;
    --surface: #ffffff;
    --background: #f3f7fa;
    --line: #d9e4eb;
    --shadow: 0 12px 32px rgb(11 71 124 / 10%);
    --radius: 18px;
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 100% 0, rgb(76 155 211 / 13%), transparent 30rem),
        var(--background);
}

button,
input,
select {
    font: inherit;
}

a {
    color: var(--navy);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.45rem;
    color: var(--navy-dark);
    font-size: clamp(1.8rem, 5vw, 2.7rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 0.35rem;
    color: var(--navy-dark);
    font-size: 1.25rem;
}

h3 {
    color: var(--navy-dark);
}

.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;
}

.muted {
    color: var(--muted);
}

.eyebrow {
    margin-bottom: 0.35rem;
    color: var(--orange);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding:
        max(0.7rem, env(safe-area-inset-top))
        max(1rem, env(safe-area-inset-right))
        0.7rem
        max(1rem, env(safe-area-inset-left));
    color: #fff;
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    box-shadow: 0 4px 18px rgb(4 39 66 / 22%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    box-shadow: 0 3px 8px rgb(0 0 0 / 18%);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.header-actions form {
    margin: 0;
}

.icon-button {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: rgb(255 255 255 / 10%);
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 13px;
    cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
    background: rgb(255 255 255 / 20%);
}

.main-nav {
    position: sticky;
    z-index: 15;
    top: 68px;
    display: flex;
    gap: 0.25rem;
    padding: 0.55rem max(0.7rem, env(safe-area-inset-right));
    overflow-x: auto;
    background: rgb(255 255 255 / 94%);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.main-nav a {
    flex: 1 0 auto;
    min-width: 88px;
    padding: 0.7rem 0.85rem;
    color: var(--muted);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
}

.main-nav a.active {
    color: var(--navy);
    background: var(--blue-soft);
}

.page-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding:
        1.5rem
        max(1rem, env(safe-area-inset-right))
        calc(5rem + env(safe-area-inset-bottom))
        max(1rem, env(safe-area-inset-left));
}

.page-heading,
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.page-heading {
    margin-bottom: 1.4rem;
}

.page-heading p,
.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
}

.section-heading {
    margin: 2rem 0 1rem;
}

.flash {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid;
    border-radius: 14px;
    font-weight: 650;
}

.flash-success {
    color: var(--green);
    background: var(--green-soft);
    border-color: #b6dfcd;
}

.flash-error {
    color: var(--red);
    background: var(--red-soft);
    border-color: #efc2c2;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 750;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--navy), #1769a5);
    box-shadow: 0 7px 15px rgb(11 71 124 / 18%);
}

.button-primary:hover,
.button-primary:focus-visible {
    background: var(--navy-dark);
}

.button-secondary {
    color: var(--navy);
    background: #fff;
    border-color: var(--line);
}

.button-danger {
    color: var(--red);
    background: var(--red-soft);
    border-color: #efc2c2;
}

.button-small {
    min-height: 38px;
    padding: 0.55rem 0.75rem;
    font-size: 0.86rem;
}

.button-wide {
    width: 100%;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.4rem;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    padding: 0.68rem 0.75rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid #bfd0dc;
    border-radius: 11px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--sky);
    box-shadow: 0 0 0 3px rgb(76 155 211 / 18%);
}

input[type="checkbox"] {
    width: 21px;
    min-height: 21px;
    padding: 0;
    accent-color: var(--navy);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}

.auth-card {
    display: grid;
    width: min(460px, 100%);
    margin: clamp(2rem, 8vh, 6rem) auto 0;
    padding: clamp(1.35rem, 5vw, 2.25rem);
    gap: 1.4rem;
    background: rgb(255 255 255 / 94%);
    border: 1px solid #e0eaf0;
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.auth-illustration {
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: 22px;
    box-shadow: 0 8px 18px rgb(189 38 47 / 18%);
}

.auth-illustration img {
    display: block;
    width: 100%;
    height: 100%;
}

.form-card,
.booking-day,
.day-card,
.user-card,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgb(11 71 124 / 6%);
}

.form-card {
    padding: clamp(1rem, 4vw, 1.5rem);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 1rem;
}

.trip-card {
    position: relative;
    padding: 1.1rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgb(11 71 124 / 6%);
}

.trip-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 5px;
    content: "";
    background: var(--sky);
}

.trip-card.direction-return::before {
    background: var(--orange);
}

.trip-card h3 {
    margin: 0.9rem 0 0.3rem;
    text-transform: capitalize;
}

.trip-card p {
    margin-bottom: 0.65rem;
}

.trip-card form {
    margin-top: 0.9rem;
}

.trip-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.trip-card-topline strong {
    color: var(--navy);
    font-size: 1.35rem;
}

.pill {
    display: inline-flex;
    padding: 0.38rem 0.62rem;
    color: var(--navy);
    background: var(--blue-soft);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
}

.direction-return .pill {
    color: #9d4b17;
    background: var(--orange-soft);
}

.capacity {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.children-list {
    min-height: 2.7rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.quick-action {
    display: grid;
    padding: 1.25rem;
    gap: 0.2rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.quick-action > span {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.quick-action strong {
    color: var(--navy);
}

.quick-action small {
    color: var(--muted);
}

.week-overview,
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(170px, 1fr));
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x proximity;
}

.day-summary,
.day-card {
    min-width: 170px;
    scroll-snap-align: start;
}

.day-summary {
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
}

.day-summary h3 {
    margin-bottom: 0.55rem;
    font-size: 0.98rem;
    text-transform: capitalize;
}

.day-summary p {
    margin-bottom: 0.55rem;
}

.booking-badges {
    display: grid;
    gap: 0.35rem;
}

.booking-badges span {
    padding: 0.35rem 0.5rem;
    border-radius: 9px;
    font-size: 0.76rem;
    font-weight: 700;
}

.booking-badges .ok {
    color: var(--green);
    background: var(--green-soft);
}

.booking-badges .missing,
.status-warning {
    color: #a04b13;
    background: var(--orange-soft);
}

.status-warning {
    padding: 0.35rem 0.5rem;
    border-radius: 9px;
    font-size: 0.8rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card {
    display: grid;
    padding: 1.3rem;
    gap: 0.2rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat-card strong {
    color: var(--navy);
    font-size: 2rem;
}

.stat-card span {
    color: var(--muted);
}

.empty-state {
    padding: clamp(1.5rem, 6vw, 3rem);
    text-align: center;
}

.empty-state > span {
    display: block;
    margin-bottom: 0.7rem;
    font-size: 2.4rem;
}

.empty-state.compact {
    padding: 1.5rem;
}

.week-switcher {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    text-align: center;
}

.day-card {
    padding: 1rem;
}

.day-card h2,
.booking-day h2 {
    font-size: 1.05rem;
    text-transform: capitalize;
}

.day-school-fields {
    display: grid;
    margin-top: 0.85rem;
    gap: 0.8rem;
}

.day-school-fields[hidden] {
    display: none;
}

.time-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.sticky-action {
    position: sticky;
    z-index: 10;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    width: min(480px, 100%);
    margin: 0 auto;
    padding: 0.65rem;
    background: rgb(255 255 255 / 92%);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.booking-day {
    padding: 1rem;
}

.schedule-hours {
    color: var(--muted);
    font-weight: 650;
}

.booking-directions {
    display: grid;
    gap: 0.8rem;
}

.booking-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--background);
    border-radius: 13px;
}

.booking-row.not-needed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
}

.inline-alert {
    padding: 0.8rem;
    color: #8d471b;
    background: var(--orange-soft);
    border-radius: 12px;
}

.user-list {
    display: grid;
    gap: 0.8rem;
}

.user-card {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr) auto;
    align-items: center;
    padding: 0.9rem 1rem;
    gap: 1rem;
}

.user-card.disabled {
    opacity: 0.58;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-identity h3,
.user-identity p {
    margin-bottom: 0;
}

.user-identity p {
    color: var(--muted);
    font-size: 0.84rem;
}

.user-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    color: #fff;
    background: var(--navy);
    border-radius: 13px;
    font-weight: 800;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 0.55rem;
}

.notification-panel {
    position: fixed;
    z-index: 40;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    width: min(360px, calc(100vw - 2rem));
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 17px;
    box-shadow: 0 20px 60px rgb(3 35 58 / 24%);
}

.notification-panel-title {
    margin-bottom: 0.3rem;
    color: var(--navy);
    font-weight: 800;
}

.notification-panel p:not(.notification-panel-title) {
    color: var(--muted);
}

@media (max-width: 720px) {
    .page-heading,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid,
    .quick-actions,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .week-switcher {
        grid-template-columns: 1fr 1fr;
    }

    .week-switcher strong {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .user-card {
        grid-template-columns: 1fr;
    }

    .booking-row {
        grid-template-columns: 1fr;
    }
}

@media (display-mode: standalone) {
    .site-header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}
