@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --bg: #05090f;
    --bg-deep: #020408;
    --surface: #0a1424;
    --panel: #101c30;
    --panel-strong: #14243b;
    --border: rgba(78, 134, 160, 0.28);
    --accent: #f3c761;
    --accent-strong: #f7da8a;
    --teal: #44c2cf;
    --teal-soft: #1b6b78;
    --danger: #ff6b6b;
    --success: #3ad589;
    --text: #e7f2ff;
    --muted: #9bb2cf;
    --shadow: 0 24px 60px rgba(4, 10, 24, 0.6);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --overlay-backdrop-z: 4000;
    --overlay-modal-z: 4010;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    background: radial-gradient(circle at 20% -10%, rgba(40, 138, 166, 0.25), transparent 45%),
        radial-gradient(circle at 80% 0%, rgba(20, 95, 120, 0.35), transparent 40%),
        linear-gradient(180deg, #05090f 0%, #02040a 60%, #05090f 100%);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(68, 194, 207, 0.12) 1px, transparent 1px),
        linear-gradient(120deg, rgba(11, 24, 40, 0.55), rgba(3, 7, 14, 0.85));
    background-size: 80px 80px, cover;
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

body.mode-login::before {
    background-image: url('../assets/driver2.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    opacity: 1;
    filter: saturate(1.75) contrast(1.22) brightness(1.32);
}

body.mode-login::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.1), transparent 55%),
        linear-gradient(180deg, rgba(2, 6, 12, 0.08), rgba(2, 6, 12, 0.28));
    background-size: cover;
    background-position: center;
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

body.drawer-open {
    overflow: hidden;
}

body.messages-open {
    overflow: hidden;
}

body.payout-open {
    overflow: hidden;
}

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

h1, h2, h3 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    letter-spacing: 0.02em;
}

.site-header {
    padding: 1.2rem 4vw 1rem;
    border-bottom: 1px solid rgba(78, 134, 160, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: rgba(4, 10, 20, 0.85);
    backdrop-filter: blur(10px);
}

.site-header.topbar {
    position: sticky;
    top: 0;
    z-index: 120;
    padding: calc(0.7rem + var(--safe-top)) calc(1rem + var(--safe-right)) 0.7rem calc(1rem + var(--safe-left));
    flex-wrap: nowrap;
    gap: 0.85rem;
}

.site-header.topbar .availability-status {
    display: none;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.topbar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.topbar-brand-text {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.topbar-title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-driver {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(44vw, 360px);
}

.topbar-driver:empty {
    display: none;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    row-gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--muted);
}

.topbar-meta[hidden] {
    display: none !important;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.45);
    background: rgba(0, 0, 0, 0.16);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
}

.status-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
}

.status-badge.is-online::before {
    background: var(--success);
}

.status-badge.is-offline::before {
    background: rgba(255, 255, 255, 0.45);
}

.status-badge.is-offered {
    border-color: rgba(243, 199, 97, 0.55);
    background: rgba(243, 199, 97, 0.12);
}

.status-badge.is-offered::before {
    background: rgba(243, 199, 97, 0.95);
}

.status-badge.is-active {
    border-color: rgba(45, 156, 219, 0.55);
    background: rgba(45, 156, 219, 0.12);
}

.status-badge.is-active::before {
    background: rgba(45, 156, 219, 0.95);
}

.status-badge.is-paused {
    border-color: rgba(255, 95, 95, 0.45);
    background: rgba(255, 95, 95, 0.1);
}

.status-badge.is-paused::before {
    background: rgba(255, 95, 95, 0.95);
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.35);
    background: rgba(0, 0, 0, 0.12);
    line-height: 1;
    max-width: min(52vw, 260px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meta-chip.gps-chip {
    color: var(--muted);
}

.meta-chip.gps-chip.is-live,
.meta-chip.gps-chip.is-locked {
    border-color: rgba(58, 213, 137, 0.55);
    background: rgba(58, 213, 137, 0.12);
    color: rgba(58, 213, 137, 0.95);
}

.meta-chip.gps-chip.is-searching {
    border-color: rgba(68, 194, 207, 0.55);
    background: rgba(68, 194, 207, 0.12);
    color: rgba(68, 194, 207, 0.95);
}

.meta-chip.gps-chip.is-prompt {
    border-color: rgba(243, 199, 97, 0.6);
    background: rgba(243, 199, 97, 0.12);
    color: rgba(243, 199, 97, 0.95);
}

.meta-chip.gps-chip.is-denied,
.meta-chip.gps-chip.is-unavailable {
    border-color: rgba(255, 107, 107, 0.65);
    background: rgba(255, 107, 107, 0.12);
    color: rgba(255, 170, 170, 0.92);
}

.topbar-meta .telemetry-chip {
    appearance: none;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.45);
    background: rgba(0, 0, 0, 0.12);
    color: var(--text);
    padding: 0.25rem 0.65rem;
    font-weight: 650;
    font-size: 0.72rem;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
    min-height: auto;
}

.topbar-meta .telemetry-chip.is-enabled {
    border-color: rgba(58, 213, 137, 0.6);
    background: rgba(58, 213, 137, 0.14);
    color: rgba(58, 213, 137, 0.98);
}

.topbar-meta .telemetry-chip.is-disabled {
    border-color: rgba(255, 255, 255, 0.16);
    color: var(--muted);
}

.topbar-meta .telemetry-chip:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: nowrap;
}

.icon-btn {
    padding: 0.55rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.45);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text);
    font-weight: 600;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.icon-btn .icon {
    width: 20px;
    height: 20px;
    display: block;
}

.site-header h1 {
    margin: 0 0 0.3rem 0;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
}

.header-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.header-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(56px, 5vw, 84px);
    pointer-events: none;
}

.header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    opacity: 0.95;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.5));
}

.session-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.session-bar.topbar-actions {
    margin-left: auto;
    gap: 0.55rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: auto;
}

.messages-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    position: relative;
}

.messages-badge {
    min-width: 1.55rem;
    height: 1.55rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(68, 194, 207, 0.18);
    border: 1px solid rgba(68, 194, 207, 0.45);
    color: var(--teal);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

.availability-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.availability-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.availability-status.online {
    background: rgba(58, 213, 137, 0.18);
    color: #a8f2c4;
}

.availability-status.offline {
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

.session-label {
    color: var(--muted);
    font-size: 0.9rem;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.install-btn {
    border: 1px solid rgba(78, 134, 160, 0.45);
    background: transparent;
    color: var(--accent-strong);
    padding: 0.5rem 1rem;
}

main.command-shell {
    padding: 1.6rem calc(4vw + var(--safe-right)) calc(2.5rem + var(--safe-bottom)) calc(4vw + var(--safe-left));
    display: grid;
    gap: 1.5rem;
    width: min(1240px, 100%);
    margin: 0 auto;
    flex: 1;
}

body.mode-active main.command-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.mode-active #active-card,
body.mode-active #assignment-card,
body.mode-active #offer-card {
    grid-column: 1 / -1;
}

body.mode-offer #assignment-card {
    display: none;
}

body.mode-offer #active-card {
    display: none;
}

body.mode-offer #offer-card {
    max-width: 720px;
    justify-self: center;
}

body.mode-login #login-card {
    width: min(860px, 92vw);
    max-width: 860px;
    justify-self: center;
}

body.mode-login main.command-shell,
body.mode-offer main.command-shell,
body.mode-panel main.command-shell {
    grid-template-columns: minmax(0, 1fr);
}

.card {
    background: linear-gradient(180deg, rgba(18, 30, 52, 0.96), rgba(9, 16, 28, 0.96));
    border: 1px solid var(--border);
    border-radius: 1.1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    animation: rise 0.4s ease both;
}

.login-card {
    position: relative;
    overflow: hidden;
    padding: 2.25rem 2.5rem 2.6rem;
    border-radius: 1.4rem;
    border: 1px solid rgba(94, 159, 189, 0.55);
    background: linear-gradient(145deg, rgba(10, 20, 36, 0.82), rgba(7, 14, 24, 0.80) 55%, rgba(12, 22, 38, 0.82));
    box-shadow: 0 34px 78px rgba(2, 8, 18, 0.65), 0 0 0 1px rgba(14, 34, 54, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 12% 0%, rgba(68, 194, 207, 0.22), transparent 55%),
        radial-gradient(circle at 85% 15%, rgba(243, 199, 97, 0.14), transparent 50%),
        linear-gradient(120deg, rgba(20, 40, 64, 0.32), transparent 45%, rgba(8, 18, 32, 0.4));
    opacity: 0.85;
    pointer-events: none;
}

.login-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, rgba(68, 194, 207, 0.12), rgba(68, 194, 207, 0.55), rgba(243, 199, 97, 0.75));
    box-shadow: 0 0 20px rgba(68, 194, 207, 0.3);
    opacity: 0.95;
    pointer-events: none;
}

.login-card > * {
    position: relative;
    z-index: 1;
}

.login-card h2 {
    margin: 0;
    font-size: 1.6rem;
    color: #f1f5ff;
}

.login-subtitle {
    margin: 0.35rem 0 0;
    color: #c1d0e2;
    font-size: 0.92rem;
}

.login-card form {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 1.4rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(78, 134, 160, 0.22);
}

.login-card label {
    color: #c7d6e6;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.login-card .login-field {
    gap: 0.45rem;
}

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

.login-card .login-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(78, 134, 160, 0.35);
    background: rgba(6, 12, 22, 0.4);
    grid-column: 1 / -1;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #c7d6e6;
}

.login-card .login-checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.login-card .login-checkbox.is-disabled {
    opacity: 0.65;
}

.login-card .login-checkbox.is-disabled input {
    pointer-events: none;
}

.login-card input,
.login-card select {
    background: linear-gradient(180deg, rgba(12, 22, 40, 0.95), rgba(7, 14, 26, 0.95));
    border-color: rgba(78, 134, 160, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    padding: 0.75rem 1rem;
}

.login-card input::placeholder {
    color: rgba(201, 214, 233, 0.7);
}

.login-card input:focus,
.login-card select:focus {
    outline: none;
    border-color: rgba(68, 194, 207, 0.7);
    box-shadow: 0 0 0 2px rgba(68, 194, 207, 0.18);
}

.login-card button[type='submit'] {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, rgba(243, 199, 97, 0.95), rgba(247, 218, 138, 0.95));
    box-shadow: 0 18px 34px rgba(243, 199, 97, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    grid-column: 1 / -1;
}

.login-card .result {
    margin-top: 0.9rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(78, 134, 160, 0.3);
    background: rgba(6, 12, 22, 0.55);
}

.login-links {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

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

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

.link-btn:focus-visible {
    outline: 2px solid rgba(243, 199, 97, 0.6);
    outline-offset: 3px;
    border-radius: 0.45rem;
}

.reset-panel {
    margin-top: 1.6rem;
}

.reset-panel h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #f1f5ff;
}

.login-card .reset-panel form {
    border-bottom: none;
    padding-bottom: 0;
}

.reset-divider {
    height: 1px;
    background: rgba(78, 134, 160, 0.22);
    margin: 1.2rem 0;
}

.reset-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.card-subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.offer-card {
    border-color: rgba(243, 199, 97, 0.5);
    background: linear-gradient(180deg, rgba(26, 24, 12, 0.6), rgba(14, 17, 22, 0.98));
}

.offer-card .card-header {
    align-items: flex-start;
    gap: 1rem;
}

.offer-subtitle {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.offer-countdown {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(243, 199, 97, 0.35);
    color: var(--accent);
    font-weight: 700;
    background: rgba(243, 199, 97, 0.12);
    white-space: nowrap;
}

.offer-grid {
    margin-bottom: 1rem;
}

.offer-bid-form {
    margin-bottom: 1.1rem;
}

.offer-reason-label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.offer-reason {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.2fr);
    margin-bottom: 1rem;
}

.mission-card {
    padding: 1rem;
}

.active-job-shell {
    display: grid;
    gap: 1rem;
}

.active-job-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.active-job-toolbar .trip-picker.compact {
    flex: 1 1 220px;
    margin: 0;
}

.active-job-toolbar #activeTripStatusChip {
    white-space: nowrap;
}

.active-job-card {
    border: 1px solid rgba(78, 134, 160, 0.35);
    border-radius: 1.15rem;
    padding: 1.1rem 1.15rem 0.95rem;
    background: radial-gradient(circle at top, rgba(68, 194, 207, 0.18), rgba(0, 0, 0, 0.2));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: grid;
    gap: 0.85rem;
}

.active-job-card__header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}

.active-job-card__title {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.active-job-card__subtitle {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.active-job-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.42);
    background: rgba(78, 134, 160, 0.12);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.active-job-grid {
    margin: 0;
}

.active-job-grid dd {
    font-weight: 650;
    overflow-wrap: anywhere;
}

.mileage-card {
    border: 1px solid rgba(243, 199, 97, 0.25);
    border-radius: 1.1rem;
    padding: 0.85rem 1rem 0.95rem;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.mileage-card__headline {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.mileage-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.mileage-card__value {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.mileage-card__grid {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.mileage-card__note {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: rgba(231, 242, 255, 0.75);
    line-height: 1.35;
}

.mileage-card__note--muted {
    color: var(--muted);
    margin-top: 0.35rem;
}

.mileage-chip {
    border-radius: 0.95rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(78, 134, 160, 0.25);
    background: rgba(10, 20, 36, 0.35);
}

.mileage-chip span {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.mileage-chip strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.mileage-chip strong.is-muted {
    color: var(--muted);
}

.performance-card {
    border-color: rgba(68, 194, 207, 0.35);
    background: linear-gradient(135deg, rgba(68, 194, 207, 0.12), rgba(0, 0, 0, 0.14));
}

.performance-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.performance-grid {
    margin-bottom: 0;
}

.performance-grid dd {
    font-weight: 650;
}

.proof-details {
    margin-top: 0.85rem;
}

.proof-details[open] summary {
    margin-bottom: 0.85rem;
}

.job-details {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.14);
}

.job-details summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
}

.job-details[open] summary {
    margin-bottom: 0.85rem;
}

.job-details-grid {
    display: grid;
    gap: 0.85rem;
}

.details-grid {
    margin: 0;
}

body.mode-active .mission-card {
    padding: 0;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(68, 194, 207, 0.5);
    background: rgba(68, 194, 207, 0.12);
    color: var(--teal);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
}

.status-chip.is-online {
    border-color: rgba(58, 213, 137, 0.55);
    background: rgba(58, 213, 137, 0.12);
    color: rgba(58, 213, 137, 0.95);
}

.status-chip.is-offline {
    border-color: rgba(255, 107, 107, 0.55);
    background: rgba(255, 107, 107, 0.12);
    color: rgba(255, 107, 107, 0.95);
}

.mission-map {
    position: relative;
    min-height: clamp(420px, 68vh, 720px);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(78, 134, 160, 0.35);
    background: radial-gradient(circle at top, rgba(68, 194, 207, 0.22), rgba(8, 15, 26, 0.95));
    box-shadow: inset 0 0 0 1px rgba(68, 194, 207, 0.08);
}

body.mode-active .mission-map.map-screen {
    min-height: 0;
    height: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
}

body.mode-active #active-card {
    flex: 1;
    min-height: 0;
}

.map-status-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0.85rem 1rem;
    pointer-events: none;
    z-index: 3;
}

.map-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border-radius: 999px;
    background: rgba(6, 12, 22, 0.75);
    border: 1px solid rgba(78, 134, 160, 0.45);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 16px 40px rgba(4, 10, 22, 0.45);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 rgba(58, 213, 137, 0.65);
    animation: pulse 1.4s ease-in-out infinite;
}

.map-status-overlay.is-offline .pulse-dot {
    background: var(--danger);
    box-shadow: 0 0 0 rgba(255, 107, 107, 0.6);
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(58, 213, 137, 0.55);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 14px rgba(58, 213, 137, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(58, 213, 137, 0);
    }
}

.map-route-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
    z-index: 2;
}

.map-route-placeholder[hidden] {
    display: none !important;
}

.map-route-placeholder-card {
    max-width: min(440px, 92vw);
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(78, 134, 160, 0.35);
    background: rgba(6, 12, 22, 0.72);
    color: rgba(255, 255, 255, 0.82);
    text-align: center;
    box-shadow: 0 16px 45px rgba(4, 10, 22, 0.42);
}

.idle-dashboard-overlay {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: calc(92px + var(--safe-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
    z-index: 3;
}

.idle-dashboard-overlay[hidden] {
    display: none !important;
}

.idle-dashboard-card {
    width: min(480px, 92vw);
    border-radius: 1.25rem;
    border: 1px solid rgba(78, 134, 160, 0.4);
    background: linear-gradient(180deg, rgba(18, 30, 52, 0.94), rgba(9, 16, 28, 0.92));
    padding: 1.25rem 1.25rem 1.15rem;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}

.idle-dashboard-title {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}

.idle-dashboard-subtitle {
    margin: 0.65rem 0 1rem;
    color: var(--muted);
    line-height: 1.35;
}

.idle-action-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 52px;
    border-radius: 1rem;
}

.idle-action-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(10, 16, 25, 0.25);
    border-top-color: rgba(10, 16, 25, 0.75);
    display: none;
    animation: spin 1s linear infinite;
}

.idle-action-btn.is-waiting .idle-action-spinner {
    display: inline-block;
}

.idle-action-btn.is-waiting {
    opacity: 0.82;
    animation: softPulse 2.4s ease-in-out infinite;
}

.idle-jobs-panel {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(78, 134, 160, 0.25);
    background: rgba(0, 0, 0, 0.14);
}

.idle-jobs-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    font-size: 0.72rem;
    color: rgba(243, 199, 97, 0.85);
    margin-bottom: 0.4rem;
}

.idle-jobs-text {
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.35;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes softPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(68, 194, 207, 0.05);
    }
    50% {
        box-shadow: 0 0 0 16px rgba(68, 194, 207, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(68, 194, 207, 0);
    }
}

.command-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    max-height: min(78vh, 720px);
    padding-bottom: var(--safe-bottom);
    background: rgba(6, 12, 22, 0.9);
    border-top: 1px solid rgba(243, 199, 97, 0.2);
    border-left: 1px solid rgba(78, 134, 160, 0.25);
    border-right: 1px solid rgba(78, 134, 160, 0.25);
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    box-shadow: 0 -20px 55px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    transition: max-height 220ms ease;
}

.command-sheet[data-state="collapsed"] {
    max-height: calc(92px + var(--safe-bottom));
}

.command-sheet[data-state="collapsed"] .sheet-body {
    display: none;
}

.sheet-toggle {
    width: 100%;
    border: 0;
    background: rgba(4, 10, 20, 0.85);
    padding: 0.65rem 1rem 0.75rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    color: var(--text);
    cursor: pointer;
}

.sheet-grip {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.26);
    justify-self: start;
}

.sheet-summary {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.sheet-summary-title {
    font-size: 0.95rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-summary-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.sheet-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 134, 160, 0.42);
    background: rgba(78, 134, 160, 0.12);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.sheet-chevron {
    width: 14px;
    height: 14px;
    border-right: 2px solid rgba(255, 255, 255, 0.55);
    border-bottom: 2px solid rgba(255, 255, 255, 0.55);
    transform: rotate(45deg);
    transition: transform 200ms ease;
}

.command-sheet[data-state="expanded"] .sheet-chevron {
    transform: rotate(-135deg);
}

.sheet-body {
    overflow-y: auto;
    padding: 0.85rem 1rem 1.1rem;
    display: grid;
    gap: 0.95rem;
}

.sheet-header-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.sheet-header-row .trip-picker.compact {
    margin: 0;
    flex: 1 1 220px;
}

.sheet-section {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.16);
    display: grid;
    gap: 0.55rem;
}

.sheet-section h3 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sheet-link {
    color: var(--accent-strong);
    text-decoration: none;
    font-weight: 650;
    line-height: 1.35;
}

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

.sheet-subrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    color: var(--text);
}

.sheet-link-secondary {
    color: var(--teal);
    text-decoration: none;
    font-weight: 650;
}

.sheet-link-secondary:hover {
    text-decoration: underline;
}

.sheet-text {
    line-height: 1.45;
    overflow-wrap: anywhere;
}

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

.metrics-grid .metric {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

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

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

.metric-value {
    font-weight: 650;
    overflow-wrap: anywhere;
}

.sheet-actions {
    display: grid;
    gap: 0.65rem;
}

body.mode-active .site-footer {
    display: none;
}

.active-map {
    width: 100%;
    height: 100%;
    border: 0;
    position: absolute;
    inset: 0;
    z-index: 1;
}

.active-map-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.2rem 1.4rem;
    color: var(--muted);
    background: rgba(4, 8, 16, 0.7);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    z-index: 2;
}

.mission-overlay {
    position: absolute;
    top: 1.2rem;
    left: 1.2rem;
    width: min(440px, 92%);
    display: grid;
    gap: 0.75rem;
    padding: 1rem 1.05rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(78, 134, 160, 0.45);
    background: rgba(6, 12, 22, 0.82);
    backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(4, 10, 22, 0.55);
    z-index: 3;
    max-height: calc(100% - 2.4rem);
    overflow: auto;
}

.trip-header-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.trip-picker.compact {
    margin: 0;
    gap: 0.25rem;
}

.trip-picker.compact label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.trip-picker.compact select {
    padding: 0.55rem 0.7rem;
    min-width: 160px;
}

.trip-panel {
    display: grid;
    gap: 0.85rem;
}

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

.trip-block {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    padding: 0.8rem 0.9rem;
    background: rgba(0, 0, 0, 0.16);
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

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

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

.trip-value {
    line-height: 1.35;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.trip-link {
    color: var(--accent-strong);
    text-decoration: none;
    display: inline-block;
    max-width: 100%;
}

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

.notes-details {
    border: 1px solid rgba(78, 134, 160, 0.3);
    border-radius: 0.95rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.2);
}

.notes-details summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 700;
}

.notes-details[open] summary {
    margin-bottom: 0.65rem;
}

.notes-body {
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.proof-panel {
    display: grid;
    gap: 0.75rem;
}

.proof-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.14);
    display: grid;
    gap: 0.65rem;
}

.proof-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.signature-uploader {
    margin-top: 0.25rem;
    border-top: none;
    padding-top: 0;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.overlay-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.active-details {
    margin: 0;
    line-height: 1.6;
    font-size: 0.92rem;
    padding: 1rem 1.05rem;
    border-radius: 1rem;
    border: 1px solid rgba(78, 134, 160, 0.25);
    background: rgba(0, 0, 0, 0.14);
}

.active-details strong {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
}

.primary-action-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

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

.secondary-actions summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 600;
}

.secondary-actions[open] summary {
    margin-bottom: 0.6rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.nav-actions {
    margin-top: 0.25rem;
}

.location-details {
    border: 1px solid rgba(78, 134, 160, 0.3);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.location-details summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 600;
}

.location-details[open] summary {
    margin-bottom: 0.8rem;
}

.location-form {
    margin-top: 0.5rem;
}

.location-actions {
    margin-bottom: 0.4rem;
}

.trip-picker {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.info-details {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    background: rgba(0, 0, 0, 0.12);
    margin-bottom: 1rem;
}

.info-details summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 700;
}

.info-details[open] summary {
    margin-bottom: 0.8rem;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
    margin: 0 0 1rem 0;
}

.info-grid > div {
    display: grid;
    gap: 0.25rem;
}

.info-grid dt {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-grid dd {
    margin: 0;
    line-height: 1.35;
}

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

.proof-uploader {
    display: grid;
    gap: 0.6rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.proof-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.proof-status {
    color: var(--muted);
    font-size: 0.9rem;
}

.proof-status.ok {
    color: var(--success);
}

.proof-status.error {
    color: var(--danger);
}

.proof-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.proof-controls input[type='file'] {
    flex: 1;
    min-width: 220px;
}

.signature-pad {
    display: grid;
    gap: 0.75rem;
}

.signature-pad canvas {
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.16);
    touch-action: none;
}

.signature-controls button {
    flex: 1;
    min-width: 160px;
}

.loads-table {
    width: 100%;
    border-collapse: collapse;
}

.loads-table th,
.loads-table td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.loads-table tbody tr {
    cursor: pointer;
}

.loads-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.loads-table td:nth-child(3),
.loads-table td:nth-child(4) {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result {
    min-height: 1.4rem;
    color: var(--muted);
}

.result.success {
    color: var(--success);
}

.result.error {
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border-radius: 0.7rem;
    border: 1px solid rgba(78, 134, 160, 0.35);
    background: var(--surface);
    color: var(--text);
    padding: 0.65rem 0.85rem;
    font-family: inherit;
    color-scheme: dark;
}

select option,
select optgroup {
    background-color: #0b1628;
    color: var(--text);
}

select option:disabled {
    color: rgba(187, 201, 220, 0.7);
}

select option:checked {
    background-color: #15243a;
}

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

label {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--muted);
}

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

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

button {
    border: none;
    border-radius: 0.75rem;
    padding: 0.65rem 1.2rem;
    background: var(--accent);
    color: #101011;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

button.secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text);
}

button.danger {
    background: var(--danger);
    color: #fff;
}

button.success {
    background: var(--success);
    color: #041007;
}

.messages-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--overlay-backdrop-z);
}

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

.messages-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: var(--overlay-modal-z);
}

.messages-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    background: rgba(11, 18, 30, 0.98);
    border: 1px solid rgba(78, 134, 160, 0.35);
    border-radius: 1rem;
    box-shadow: 0 30px 65px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.messages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: calc(1rem + var(--safe-top)) calc(1.1rem + var(--safe-right)) 1rem calc(1.1rem + var(--safe-left));
    border-bottom: 1px solid rgba(78, 134, 160, 0.25);
    background: rgba(4, 10, 20, 0.85);
}

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

.messages-emergency-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem calc(1.1rem + var(--safe-right)) 0.75rem calc(1.1rem + var(--safe-left));
    background: rgba(255, 95, 95, 0.12);
    border-bottom: 1px solid rgba(255, 95, 95, 0.35);
}

.messages-emergency-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 210, 210, 0.95);
}

.messages-thread {
    flex: 1;
    overflow-y: auto;
    padding: 1rem calc(1.1rem + var(--safe-right)) 1rem calc(1.1rem + var(--safe-left));
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(5, 12, 22, 0.65);
}

.messages-pinned {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -1rem -1.1rem 0.6rem;
    padding: 0.85rem 1.1rem 0.75rem;
    background: rgba(4, 10, 20, 0.95);
    border-bottom: 1px solid rgba(78, 134, 160, 0.25);
    backdrop-filter: blur(10px);
}

.messages-pinned-header {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(243, 199, 97, 0.95);
    margin-bottom: 0.65rem;
}

.messages-pinned-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.messages-empty {
    color: var(--muted);
    text-align: center;
    padding: 1rem 0.5rem;
}

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

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

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

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

.message-bubble {
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgba(78, 134, 160, 0.2);
    color: var(--text);
    line-height: 1.4;
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-actions {
    margin-top: 0.65rem;
    display: flex;
    gap: 0.6rem;
}

.message-item.outgoing .message-actions {
    justify-content: flex-end;
}

.message-item.incoming .message-actions {
    justify-content: flex-start;
}

.message-ack-btn {
    border-radius: 999px;
    border: 1px solid rgba(255, 95, 95, 0.7);
    background: rgba(255, 95, 95, 0.18);
    color: rgba(255, 210, 210, 0.95);
    padding: 0.45rem 0.85rem;
    font-weight: 750;
    cursor: pointer;
}

.message-ack-btn:hover {
    border-color: rgba(255, 95, 95, 0.95);
}

.message-ack-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.message-item.incoming .message-bubble {
    background: rgba(45, 156, 219, 0.18);
    border-color: rgba(45, 156, 219, 0.55);
}

.message-item.incoming.is-priority .message-bubble {
    background: rgba(65, 216, 255, 0.18);
    border-color: rgba(65, 216, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(65, 216, 255, 0.18);
}

.message-item.incoming.is-emergency .message-bubble {
    background: rgba(255, 95, 95, 0.14);
    border-color: rgba(255, 95, 95, 0.85);
    box-shadow: 0 0 0 1px rgba(255, 95, 95, 0.12);
}

.message-item.incoming.is-emergency .message-meta {
    color: rgba(255, 170, 170, 0.9);
}

.message-item.outgoing .message-bubble {
    background: rgba(58, 213, 137, 0.16);
    border-color: rgba(58, 213, 137, 0.55);
}

.message-item.is-pending .message-bubble {
    opacity: 0.75;
}

.message-item.is-failed .message-bubble {
    border-color: rgba(255, 107, 107, 0.75);
}

.messages-compose {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem calc(1.1rem + var(--safe-right)) calc(0.9rem + var(--safe-bottom)) calc(1.1rem + var(--safe-left));
    border-top: 1px solid rgba(78, 134, 160, 0.25);
    background: rgba(4, 10, 20, 0.85);
}

.messages-compose textarea {
    flex: 1;
    min-height: 56px;
    max-height: 140px;
    resize: none;
}

.messages-compose button {
    flex: 0 0 auto;
    align-self: flex-end;
    padding: 0.65rem 1rem;
}

.messages-card .result {
    margin: 0;
    border-top: 1px solid rgba(78, 134, 160, 0.18);
    border-radius: 0;
    padding: 0.75rem 1.1rem;
    background: rgba(5, 12, 22, 0.72);
}

.payout-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    z-index: var(--overlay-backdrop-z);
}

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

.payout-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: var(--overlay-modal-z);
}

.payout-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    background: rgba(11, 18, 30, 0.98);
    border: 1px solid rgba(243, 199, 97, 0.3);
    border-radius: 1rem;
    box-shadow: 0 30px 65px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.payout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: calc(1rem + var(--safe-top)) calc(1.1rem + var(--safe-right)) 1rem calc(1.1rem + var(--safe-left));
    border-bottom: 1px solid rgba(243, 199, 97, 0.18);
    background: rgba(4, 10, 20, 0.9);
}

.payout-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--accent-strong);
}

.payout-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem calc(1.1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1.1rem + var(--safe-left));
    display: grid;
    gap: 0.85rem;
    background: rgba(5, 12, 22, 0.7);
}

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

.payout-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.16);
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

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

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

.payout-value {
    line-height: 1.35;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.payout-table {
    width: 100%;
    border-collapse: collapse;
}

.payout-table th,
.payout-table td {
    text-align: left;
    padding: 0.5rem 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.92rem;
}

.payout-table th {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.payout-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-strong);
}

.payout-card .result {
    margin: 0;
    border-top: 1px solid rgba(243, 199, 97, 0.18);
    border-radius: 0;
    padding: 0.75rem 1.1rem;
    background: rgba(5, 12, 22, 0.72);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 140;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(380px, 92vw);
    background: rgba(11, 18, 30, 0.98);
    border-right: 1px solid rgba(78, 134, 160, 0.35);
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    padding: calc(1.25rem + var(--safe-top)) calc(1.25rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1.25rem + var(--safe-left));
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.drawer-content {
    overflow: auto;
    padding-right: 0.25rem;
}

.drawer-menu {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.open-jobs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.open-jobs-header h3 {
    margin: 0;
    font-size: 1rem;
}

.open-jobs-list {
    display: grid;
    gap: 0.75rem;
}

.open-jobs-card {
    border: 1px solid rgba(78, 134, 160, 0.3);
    border-radius: 0.85rem;
    padding: 0.75rem;
    background: rgba(5, 12, 22, 0.6);
    display: grid;
    gap: 0.6rem;
}

.open-jobs-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-weight: 600;
}

.open-jobs-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(68, 194, 207, 0.15);
    color: var(--teal);
    white-space: nowrap;
}

.open-jobs-route {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.open-jobs-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.8rem;
}

.open-jobs-meta span {
    padding: 0.2rem 0.55rem;
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.05);
}

.open-jobs-reason {
    flex-basis: 100%;
    padding: 0.2rem 0.55rem;
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    line-height: 1.35;
}

.open-jobs-actions {
    display: grid;
    gap: 0.5rem;
}

.open-jobs-actions button {
    width: 100%;
}

.open-jobs-bid-form {
    display: grid;
    gap: 0.5rem;
}

.open-jobs-bid-row {
    display: grid;
    gap: 0.5rem;
}

.open-jobs-bid-status {
    font-size: 0.8rem;
    color: var(--muted);
}

.open-jobs-empty {
    margin-top: 0.5rem;
    color: var(--muted);
}

.open-job-status {
    min-height: 1.2rem;
}

.drawer-section {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.12);
    margin-bottom: 0.9rem;
}

.drawer-section summary {
    cursor: pointer;
    font-weight: 700;
}

.drawer-section[open] summary {
    margin-bottom: 0.75rem;
}

.drawer-grid {
    margin-bottom: 0.75rem;
}

.drawer-actions {
    margin-bottom: 0.6rem;
}

.drawer-muted {
    margin: 0 0 0.75rem 0;
    color: var(--muted);
    line-height: 1.45;
}

.payout-requirements-label {
    margin-bottom: 0.45rem;
}

.payout-requirements {
    list-style: none;
    margin: 0 0 0.75rem 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(78, 134, 160, 0.28);
    border-radius: 0.75rem;
    background: rgba(5, 12, 22, 0.55);
    display: grid;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
}

.payout-requirements li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.payout-requirements li::before {
    content: '•';
    color: var(--accent);
    line-height: 1.2;
}

#trip-history {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.12);
    margin-bottom: 1rem;
    display: grid;
    gap: 0.75rem;
}

#trip-history h3 {
    margin: 0;
    font-size: 1rem;
}

.trip-history-total {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.65rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0, 0, 0, 0.18);
    color: var(--accent);
    font-weight: 700;
}

.trip-history-list {
    display: grid;
    gap: 0.75rem;
}

.trip-history-list > div {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 0.85rem;
    background: rgba(0, 0, 0, 0.18);
    display: grid;
    gap: 0.35rem;
}

.trip-history-list > div > div:first-child {
    color: var(--muted);
    font-size: 0.85rem;
}

.trip-history-list > div > div:last-child {
    color: var(--success);
    font-weight: 600;
}

.site-footer {
    margin-top: auto;
    padding: 2rem calc(1rem + var(--safe-right)) calc(2rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
    text-align: center;
    color: var(--muted);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    body.mode-active main.command-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .login-card form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .site-header.topbar {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .topbar-brand {
        flex: 1 1 100%;
    }

    .session-bar.topbar-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .availability-toggle {
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .topbar-title {
        font-size: 0.85rem;
    }

    .topbar-driver {
        max-width: 44vw;
        font-size: 0.8rem;
    }

    .availability-toggle {
        gap: 0.4rem;
    }

    .availability-toggle button {
        padding: 0.55rem 0.85rem;
        min-height: 42px;
    }

    .messages-modal {
        padding: 0;
        align-items: stretch;
    }

    .messages-card {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .payout-modal {
        padding: 0;
        align-items: stretch;
    }

    .payout-card {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .login-card {
        padding: 1.5rem 1.35rem 1.7rem;
    }

    .header-logo {
        width: 100%;
        justify-content: flex-start;
    }

    .session-bar {
        width: 100%;
        justify-content: flex-start;
    }

    .field-row {
        flex-direction: column;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .trip-grid {
        grid-template-columns: 1fr;
    }

    .trip-header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .offer-card .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .offer-reason {
        grid-template-columns: 1fr;
    }

    .payout-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

.runtime-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.95rem 1rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(68, 194, 207, 0.4);
    background: rgba(16, 28, 48, 0.96);
    color: var(--text);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
}

.runtime-banner__content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.runtime-banner__title {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    color: var(--accent-strong);
}

.runtime-banner__message {
    font-size: 0.85rem;
    color: rgba(231, 242, 255, 0.85);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.runtime-banner__actions {
    flex-shrink: 0;
}

.runtime-banner__reload {
    min-height: 40px;
    padding: 0 1rem;
    white-space: nowrap;
}

@media (min-width: 720px) {
    .runtime-banner {
        left: auto;
        max-width: 440px;
        right: 1.5rem;
        bottom: 1.5rem;
    }
}
