:root {
    --bg: #0c101b;
    --panel: #141a2a;
    --accent: #f2c94c;
    --text: #f7f7fb;
    --muted: #8f98b3;
    --border: #232b3d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #0c101b;
    background-image:
        url('../assets/customer.png?v=20260104-5');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body.customer-auth {
    background-color: #0c101b;
    background-image:
        url('../assets/customer.png?v=20260104-5');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.customer-auth main.grid {
    flex: 1;
    align-content: center;
    justify-items: center;
    grid-template-columns: minmax(0, 1fr);
    max-width: min(640px, 92vw);
    margin: 0 auto;
}

body.customer-auth .card {
    width: min(560px, 92vw);
}

body.customer-unauthenticated .portal-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 1.75rem;
}

body.customer-unauthenticated .contact-dispatch,
body.customer-unauthenticated #authLanding {
    width: min(720px, 92vw);
    margin-left: auto;
    margin-right: auto;
}

.site-header {
    padding: 2rem 4vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 12, 20, 0.7);
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
    z-index: 2;
}

.top-nav {
    display: flex;
    flex: 1 1 420px;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.view-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(242, 201, 76, 0.35);
    background: rgba(14, 21, 36, 0.65);
    color: var(--text);
    padding: 0.45rem 0.95rem;
    font-weight: 650;
    cursor: pointer;
    letter-spacing: 0.01em;
    user-select: none;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-tab.is-active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(242, 201, 76, 0.12), 0 18px 38px rgba(0, 0, 0, 0.3);
}

#view-new:checked ~ header .top-nav .nav-tab[data-view="new"],
#view-status:checked ~ header .top-nav .nav-tab[data-view="status"],
#view-active:checked ~ header .top-nav .nav-tab[data-view="active"],
#view-history:checked ~ header .top-nav .nav-tab[data-view="history"] {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 1px rgba(242, 201, 76, 0.12), 0 18px 38px rgba(0, 0, 0, 0.3);
}

.nav-tab:focus-visible {
    outline: 2px solid rgba(242, 201, 76, 0.8);
    outline-offset: 2px;
}

.pac-container {
    z-index: 10000 !important;
}

.brand h1 {
    margin: 0;
    font-size: 1.8rem;
}

.brand p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

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

.mobile-nav-toggle {
    display: none;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: rgba(14, 21, 36, 0.65);
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.mobile-nav-toggle:focus-visible {
    outline: 2px solid rgba(242, 201, 76, 0.8);
    outline-offset: 2px;
}

.install-btn {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.install-button {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

.portal-shell {
    width: min(1060px, 92vw);
    margin: 0 auto;
    padding: 1.75rem 0 3rem;
}

.auth-landing {
    margin-bottom: 1.25rem;
}

.trip-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
    margin: 1rem 0 0.75rem;
}

.trip-detail-addresses {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.trip-surface-grid {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}

.trip-surface {
    border-radius: 0.95rem;
    border: 1px solid rgba(242, 201, 76, 0.18);
    background: rgba(14, 21, 36, 0.55);
    padding: 1.05rem 1.1rem;
}

.trip-surface h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.trip-surface .hint {
    margin-top: 0.45rem;
}

.surface-kv {
    margin: 0.95rem 0 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
}

.surface-kv-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 0.75rem;
    align-items: baseline;
}

.surface-kv-row dt {
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    font-weight: 700;
}

.surface-kv-row dd {
    margin: 0;
    font-weight: 750;
}

.surface-subsection {
    margin-top: 0.85rem;
}

.surface-subtitle {
    font-weight: 750;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.surface-divider {
    height: 1px;
    background: rgba(242, 201, 76, 0.18);
    margin: 1rem 0;
}

.surface-callout {
    border-radius: 0.75rem;
    border: 1px solid rgba(242, 201, 76, 0.22);
    background: rgba(14, 21, 36, 0.45);
    padding: 0.85rem 0.95rem;
    color: var(--muted);
    line-height: 1.45;
}

.timeline-entry.is-clickable {
    cursor: pointer;
    border-radius: 0.8rem;
    padding: 0.7rem 0.75rem;
    border: 1px solid transparent;
}

.timeline-entry.is-clickable:hover {
    border-color: rgba(242, 201, 76, 0.35);
    background: rgba(14, 21, 36, 0.45);
}

.contact-dispatch {
    margin-bottom: 1.25rem;
}

.contact-dispatch-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: rgba(14, 21, 36, 0.72);
    border: 1px solid rgba(242, 201, 76, 0.22);
    border-radius: 1rem;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.25);
}

.contact-dispatch-title {
    font-weight: 750;
    letter-spacing: 0.01em;
    color: var(--text);
}

.contact-dispatch-phone {
    display: inline-flex;
    margin-top: 0.35rem;
    font-weight: 800;
    color: var(--accent);
    text-decoration: none;
}

.contact-dispatch-phone:focus-visible {
    outline: 2px solid rgba(242, 201, 76, 0.8);
    outline-offset: 3px;
    border-radius: 0.4rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 190;
}

.modal-backdrop[hidden],
.modal[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 200;
}

.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 12, 20, 0.6);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-close {
    border: 1px solid rgba(242, 201, 76, 0.5);
    background: rgba(14, 21, 36, 0.65);
    color: var(--accent);
    font-weight: 750;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
}

.modal-close:focus-visible {
    outline: 2px solid rgba(242, 201, 76, 0.8);
    outline-offset: 2px;
}

.modal-body {
    padding: 1.2rem 1.25rem 1.35rem;
    overflow: auto;
}

.dispatch-message-cta {
    margin-top: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(14, 21, 36, 0.4);
}

.message-thread {
    margin-top: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(14, 21, 36, 0.55);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 42vh;
    overflow-y: auto;
}

.message-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: min(520px, 95%);
}

.message-item.is-outgoing {
    align-self: flex-end;
    text-align: right;
}

.message-item.is-incoming {
    align-self: flex-start;
}

.message-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

.message-bubble {
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: #0e1524;
    padding: 0.65rem 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.35;
}

.message-item.is-outgoing .message-bubble {
    border-color: rgba(242, 201, 76, 0.35);
    background: rgba(242, 201, 76, 0.12);
}

.message-compose {
    margin-top: 1rem;
    gap: 0.85rem;
}

.message-compose-actions {
    align-items: center;
}

.view-panel {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

#view-new:checked ~ main .view-panel[data-view-panel="new"],
#view-status:checked ~ main .view-panel[data-view-panel="status"],
#view-active:checked ~ main .view-panel[data-view-panel="active"],
#view-history:checked ~ main .view-panel[data-view-panel="history"] {
    display: flex;
}

main.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem 4vw 3rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card h2 {
    margin-top: 0;
}

.portal-card.is-locked {
    display: none;
}

.signup-card.is-hidden {
    display: none;
}

.signin-card.is-hidden {
    display: none;
}

.auth-switch {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-link {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

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

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.field-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    color: var(--muted);
}

input,
textarea {
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: #0e1524;
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
}

select {
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    background: #0e1524;
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
}

.field-error {
    margin-top: 0.35rem;
    color: #ffbaba;
    font-size: 0.85rem;
    line-height: 1.35;
}

.input-error {
    border-color: rgba(255, 107, 107, 0.85) !important;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.14);
}

button[type="submit"] {
    border: none;
    background: linear-gradient(120deg, #f2c94c, #f2994a);
    color: #0a0d18;
    font-weight: 700;
    padding: 0.9rem 1.4rem;
    border-radius: 0.8rem;
    cursor: pointer;
    transition: transform 0.15s ease;
}

button[type="submit"]:hover {
    transform: translateY(-1px);
}

.secondary-btn {
    border: 1px solid rgba(242, 201, 76, 0.5);
    background: rgba(14, 21, 36, 0.65);
    color: var(--accent);
    font-weight: 700;
    padding: 0.7rem 1rem;
    border-radius: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.secondary-btn:hover {
    transform: translateY(-1px);
}

.result {
    margin-top: 1rem;
    padding: 0.9rem;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
}

.result.error {
    border-color: #ff6b6b;
    color: #ffbaba;
}

.result.success {
    border-color: #2ecc71;
    color: #c6ffd6;
}

.timeline {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.timeline-entry {
    border-left: 3px solid var(--accent);
    padding-left: 0.75rem;
}

.docs-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.docs-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: 0.8rem;
    border: 1px solid var(--border);
    background: rgba(14, 21, 36, 0.65);
}

.docs-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.docs-meta strong {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.docs-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(242, 201, 76, 0.35);
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
}

.docs-link:hover {
    border-color: var(--accent);
}

.pod-preview {
    margin-top: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.pod-preview a {
    display: block;
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.hint {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.service-banner {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    margin-bottom: 8px;
    border-left: 4px solid #ffeeba;
    border-radius: 4px;
}
.service-banner.hidden {
    display: none;
}

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

.availability-summary {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.availability-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: baseline;
}

.availability-label {
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.availability-reason {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
}

.availability-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
}

.route-preview {
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.route-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.78);
}

.route-map {
    height: 320px;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

.driver-map {
    height: 300px;
    border-radius: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    margin-top: 0.75rem;
}

.stripe-card {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
}

.tip-panel {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.tip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

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

.tip-column {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tip-label {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tip-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tip-chip {
    border: 1px solid var(--border);
    background: #0e1524;
    color: var(--text);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.tip-chip.is-active {
    background: var(--accent);
    color: #0a0d18;
    border-color: var(--accent);
}

.tip-summary {
    font-weight: 700;
    color: var(--accent);
}

.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

@media (max-width: 600px) {
    .site-header {
        padding: 1.25rem 4vw 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        z-index: 60;
    }

    .brand {
        text-align: center;
    }

    .brand h1 {
        font-size: 1.35rem;
    }

    .brand p {
        display: none;
    }

    .top-nav {
        display: none;
    }

    body.customer-unauthenticated .top-nav {
        display: none;
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    body.mobile-nav-open .top-nav {
        display: flex;
        position: fixed;
        inset: 0;
        padding: calc(var(--customer-pwa-header-height, 140px) + env(safe-area-inset-top)) 1.25rem calc(env(safe-area-inset-bottom) + 1.5rem);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0.75rem;
        background: rgba(10, 12, 20, 0.96);
        overflow-y: auto;
        z-index: 50;
    }

    body.mobile-nav-open .nav-tab {
        justify-content: center;
        border-radius: 1rem;
        padding: 0.95rem 1rem;
        font-size: 1rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
}

body.customer-unauthenticated .top-nav,
body.customer-unauthenticated .mobile-nav-toggle {
    display: none;
}

body.customer-unauthenticated .view-panel {
    display: none !important;
}
