:root{
    --bg: #f5f5f7;
    --fg: #111114;
    --muted: #6e6e73;
    --card: #ffffff;
    --border: rgba(0,0,0,0.10);
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
    --shadow-sm: 0 6px 18px rgba(0,0,0,0.06);
    --accent: #0a84ff;
    --accent-2: #34c759;
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.wrap{
    max-width: 980px;
    margin: 0 auto;
    padding: 18px 18px;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.top{
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(245,245,247,0.72);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 14px;
}

.brand{
    display:flex;
    align-items:center;
    gap: 10px;
    color: var(--fg);
    text-decoration:none;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo{
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

.brand-text{
    font-size: 16px;
}

/* Desktop navigation */
.nav-desktop {
    display: flex;
    gap: 4px;
}

.nav-desktop a{
    color: var(--muted);
    text-decoration:none;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background 120ms ease, color 120ms ease;
}

.nav-desktop a:hover{
    color: var(--fg);
    background: rgba(0,0,0,0.04);
}

.nav-desktop button{
    color: var(--muted);
    text-decoration:none;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background 120ms ease, color 120ms ease;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.nav-desktop button:hover{
    color: var(--fg);
    background: rgba(0,0,0,0.04);
}

/* Hamburger menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--fg);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile navigation */
.nav-mobile {
    position: fixed;
    top: 71px;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: calc(100vh - 71px);
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 20px 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 99;
    visibility: hidden;
}

.nav-mobile.active {
    transform: translateX(0);
    visibility: visible;
}

.nav-mobile a,
.nav-mobile button {
    color: var(--fg);
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 0;
    transition: background 120ms ease;
    text-align: left;
    width: 100%;
    display: block;
    font-size: 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-mobile a:hover,
.nav-mobile button:hover {
    background: rgba(0,0,0,0.06);
}

.nav-mobile form {
    margin: 0;
    width: 100%;
}

.nav-mobile form button {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 20px;
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-desktop {
        display: none;
    }
}

/* Desktop - hide mobile nav completely */
@media (min-width: 769px) {
    .nav-mobile {
        display: none !important;
    }
}

/* ============================================
   LAYOUT
   ============================================ */
main.wrap{
    padding-top: 22px;
    padding-bottom: 30px;
}

.card{
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.card h1{
    margin: 0 0 10px 0;
    font-size: clamp(26px, 3.4vw, 40px);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.card p{
    margin: 10px 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-card{
    max-width: 500px;
    margin: 2rem auto;
}

.auth-card-wide{
    max-width: 600px;
}

.auth-footer{
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.auth-footer p{
    margin: 0;
    color: var(--muted);
}

.auth-link{
    color: var(--accent-2);
    text-decoration: none;
    font-weight: 500;
}

.auth-link:hover{
    text-decoration: underline;
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */
.flash{
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(52, 199, 89, 0.3);
    background: rgba(52, 199, 89, 0.1);
    color: #1e7e34;
}

.error-message{
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 59, 48, 0.3);
    background: rgba(255, 59, 48, 0.1);
    color: #c33;
    font-weight: 500;
}

.error{
    display: block;
    color: #c33;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   FORMS
   ============================================ */
.form{
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

fieldset{
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin: 0 0 16px 0;
    background: rgba(0, 0, 0, 0.02);
}

legend{
    font-weight: 600;
    font-size: 14px;
    color: var(--fg);
    padding: 0 8px;
}

label{
    display: block;
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
}

label input,
label select,
label textarea{
    margin-top: 6px;
}

input,
select,
textarea{
    width: 100%;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--fg);
    outline: none;
    font-size: 16px;
    font-family: inherit;
    transition: box-shadow 120ms ease, border-color 120ms ease;
}

input:focus,
select:focus,
textarea:focus{
    border-color: rgba(10,132,255,0.55);
    box-shadow: 0 0 0 4px rgba(10,132,255,0.15);
}

textarea{
    resize: vertical;
    min-height: 80px;
}

.hint{
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

/* Form validation */
.form input:invalid:not(:placeholder-shown),
.form textarea:invalid:not(:placeholder-shown) {
    border-color: #c33;
}

.form input:valid:not(:placeholder-shown),
.form textarea:valid:not(:placeholder-shown) {
    border-color: #4CAF50;
}

/* Show red border for required inputs when invalid (after form submission) */
.form input:required:invalid,
.form textarea:required:invalid {
    border-color: #c33;
}

.form select:invalid,
.form select:required:invalid {
    border-color: #c33;
}

.form select:valid {
    border-color: #4CAF50;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn{
    display: inline-flex;
    align-items:center;
    justify-content:center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(10,132,255,0.25);
    background: linear-gradient(180deg, rgba(10,132,255,0.95), rgba(10,132,255,0.82));
    color: white;
    font-weight: 700;
    font-size: 16px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(10,132,255,0.18);
    transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover{
    filter: brightness(1.02);
    transform: translateY(-1px);
}

.btn:active{
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
}

.btn-full{
    width: 100%;
    margin-top: 8px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--fg);
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 120ms ease;
}

.btn-secondary:hover {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.2);
}

.btn-secondary:active {
    background: rgba(0,0,0,0.06);
}

/* ============================================
   BOOKING FLOW SPECIFIC
   ============================================ */
.apply-start {
    text-align: center;
}

.apply-start h1 {
    margin-bottom: 1rem;
}

.apply-start p {
    font-size: 1.125rem;
    color: var(--muted);
    margin-bottom: 2rem;
}

.apply-start .btn {
    margin-top: 2rem;
}

/* Terms page */
.terms-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin: 1rem 0;
    background: rgba(0,0,0,0.02);
    border-radius: 14px;
}

.terms-scroll h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--fg);
    font-size: 1.5rem;
}

.terms-scroll h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--fg);
    font-size: 1.125rem;
}

.terms-scroll p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--muted);
}

.terms-scroll em {
    color: var(--muted);
    display: block;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.terms-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(0,0,0,0.02);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.terms-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.terms-checkbox span {
    font-weight: 500;
    color: var(--fg);
}

/* Display fields */
.display-field {
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 14px;
    font-size: 1rem;
    color: var(--fg);
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    margin-top: 6px;
}

.total-field {
    background-color: rgba(52, 199, 89, 0.1);
    border-color: var(--accent-2);
    font-weight: 600;
    font-size: 1.1rem;
}

.grand-total {
    background-color: rgba(10, 132, 255, 0.1);
    border-color: var(--accent);
    font-size: 1.2rem;
}

/* Review page */
.review-intro {
    color: var(--muted);
    margin-bottom: 2rem;
    font-size: 1.0625rem;
}

.review-section {
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 14px;
}

.review-section h2 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    color: var(--fg);
    border-bottom: 2px solid var(--accent-2);
    padding-bottom: 0.5rem;
}

.review-section dl {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.review-section dt {
    font-weight: 600;
    color: var(--muted);
}

.review-section dd {
    margin: 0;
    color: var(--fg);
}

.review-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Confirmation page */
.apply-sent {
    text-align: center;
}

.apply-sent h1 {
    margin-bottom: 1rem;
    color: var(--fg);
}

.success-icon {
    font-size: 4rem;
    color: var(--accent-2);
    margin: 2rem 0;
    line-height: 1;
}

.sent-message {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--fg);
    font-weight: 500;
}

.sent-description {
    color: var(--muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.next-steps {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(10, 132, 255, 0.1);
    border-radius: 14px;
    border-left: 4px solid var(--accent);
    text-align: left;
}

.next-steps p {
    margin: 0;
    color: var(--fg);
    line-height: 1.8;
}

.next-steps strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--accent);
    font-size: 1.0625rem;
}

.sent-actions {
    margin-top: 2rem;
}

/* ============================================
   FOOTER
   ============================================ */
.footer{
    margin-top: 26px;
    border-top: 1px solid var(--border);
    background: transparent;
}

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

.footer-inner {
    text-align: center;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ============================================
   ACCESSIBILITY
   ============================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .review-section dl {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .review-section dt {
        margin-top: 0.75rem;
        font-size: 0.875rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .review-section dd {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border);
    }

    .review-section dd:last-of-type {
        border-bottom: none;
    }

    .review-actions {
        flex-direction: column;
    }

    .btn,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }

    fieldset {
        padding: 1rem;
    }

    .terms-scroll {
        max-height: 300px;
        padding: 1rem;
    }
}

@media (max-width: 540px){
    .wrap{ padding: 14px; }
    .card{ padding: 18px; }
    .logo{ width: 30px; height: 30px; border-radius: 9px; }

    .success-icon {
        font-size: 3rem;
    }

    .sent-message {
        font-size: 1rem;
    }

    .next-steps {
        padding: 1rem;
    }

    .terms-scroll h2 {
        font-size: 1.25rem;
    }

    .terms-scroll h3 {
        font-size: 1rem;
    }
}