/* CartWheel Driver Web App — mobile-app-like UI */

:root {
    --cw-primary: #FF6B00;
    --cw-primary-dark: #E05E00;
    --cw-bg: #F5F5F5;
    --cw-card: #FFFFFF;
    --cw-text: #1A1A1A;
    --cw-text-secondary: #666666;
    --cw-border: #E0E0E0;
    --cw-success: #4CAF50;
    --cw-danger: #F44336;
    --cw-warning: #FF9800;
    --cw-blue: #2196F3;
    --cw-radius: 8px;
    --cw-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    /* Shared height for every orange header bar (dashboard .cw-topbar + the .cw-auto-header bars on
       the automation and activity-log cards) so they stay uniform. */
    --cw-header-h: 52px;
}

#cwApp {
    max-width: 960px;
    margin: 0 auto;
    background: var(--cw-bg);
    border-radius: var(--cw-radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--cw-text);
    position: relative;
}

/* Shown instead of the login form while a saved session is being resumed */
#cwRestoring {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8F3F 100%);
}

html[data-cw-restoring] #cwRestoring {
    display: flex;
}

html[data-cw-restoring] #cwLogin {
    display: none !important;
}

.cw-restoring-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: cw-restoring-spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .cw-restoring-spinner {
        animation: none;
    }
}

/* Hero: collapsible intro (× hides it, "Show hero" bar restores it) — mirrors the Roadie hero. */
#cwHero {
    position: relative;
}

.cw-hero-close {
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 5;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 24px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
}

.cw-hero-close:hover {
    background: rgba(255, 255, 255, 0.32);
}

.cw-hero-restore {
    display: none;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    text-align: center;
}

.cw-hero-restore::after {
    content: ' \25BE';
    opacity: .85;
}

.cw-hero-restore:hover {
    background: rgba(255, 255, 255, 0.1);
}

#cwHero.cw-hero-collapsed {
    padding: 0 !important;
}

#cwHero.cw-hero-collapsed .container,
#cwHero.cw-hero-collapsed .cw-hero-close {
    display: none;
}

#cwHero.cw-hero-collapsed .cw-hero-restore {
    display: block;
}

/* Login Screen */
#cwLogin {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    padding: 40px 24px;
    background: linear-gradient(135deg, #FF6B00 0%, #FF8F3F 100%);
}

#cwLogin .cw-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#cwLogin .cw-logo svg {
    width: 48px;
    height: 48px;
    fill: var(--cw-primary);
}

#cwLogin h2 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

#cwLogin .cw-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    margin-bottom: 32px;
}

.cw-input-group {
    width: 100%;
    max-width: 420px;
    margin-bottom: 16px;
}

.cw-input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.cw-input-group input,
.cw-input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.cw-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.cw-input-group input:focus,
.cw-input-group select:focus {
    border-color: white;
    background: rgba(255, 255, 255, 0.25);
}

.cw-input-group select {
    appearance: none;
    cursor: pointer;
}

.cw-input-group select option {
    color: var(--cw-text);
    background: white;
}

.cw-btn {
    width: 100%;
    max-width: 420px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.cw-btn-login {
    background: white;
    color: var(--cw-primary);
    margin-top: 8px;
}

.cw-btn-login:hover {
    background: #F0F0F0;
    transform: translateY(-1px);
}

.cw-btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#cwLoginError {
    color: #FFE0E0;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 12px;
    max-width: 420px;
    text-align: center;
    display: none;
}

/* Main App Layout */
#cwMain {
    display: none;
    flex-direction: column;
    height: 700px;
    max-height: 85vh;
    min-height: 460px;
    overflow: hidden;
    text-align: left;
}

/* Top Bar */
.cw-topbar {
    background: var(--cw-primary);
    color: white;
    /* Pinned to the shared header height so this bar is exactly the SAME height as the
       automation/activity-log header bars (.cw-auto-header, var(--cw-header-h)) — every orange header
       in the dashboard is uniform. Content is vertically centred, so the ~38px logout button sits
       comfortably within the 52px bar at any browser's button metrics. */
    height: var(--cw-header-h);
    box-sizing: border-box;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cw-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cw-driver-name {
    font-size: 15px;
    font-weight: 600;
}

.cw-company-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Visibility Toggle */
.cw-visibility-toggle {
    /* Label sits to the LEFT of the switch, vertically centred with it. */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.cw-topbar-actions {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.4vw, 18px);
}

.cw-toggle-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.cw-toggle {
    width: 48px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.3);
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
}

.cw-toggle.active {
    background: var(--cw-success);
}

.cw-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.cw-toggle.active::after {
    transform: translateX(22px);
}

/* Content Area */
.cw-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}

.cw-sync-countdown {
    display: block;
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 900;
    font-style: italic;
    color: #2e7d32;
    animation: cw-sync-countdown-flash 1s ease-in-out infinite;
}

@keyframes cw-sync-countdown-flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .45;
    }
}

.cw-sync-countdown[hidden] {
    display: none;
}

/* Empty State */
.cw-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--cw-text-secondary);
}

.cw-empty-state svg {
    width: 64px;
    height: 64px;
    fill: #CCC;
    margin-bottom: 16px;
}

.cw-empty-orders-animation {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
}

.cw-empty-orders-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid transparent;
    border-radius: 50%;
}

.cw-empty-orders-orbit-primary {
    width: 60px;
    height: 60px;
    border-top-color: #0d6efd;
    border-right-color: rgba(13, 110, 253, .24);
    animation: cw-empty-orders-orbit-primary 2.8s linear infinite;
}

.cw-empty-orders-orbit-primary::after {
    position: absolute;
    top: 3px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e87524;
    box-shadow: 0 0 0 3px rgba(232, 117, 36, .14);
    content: '';
}

.cw-empty-orders-orbit-secondary {
    width: 42px;
    height: 42px;
    border-bottom-color: #4caf50;
    border-left-color: rgba(76, 175, 80, .2);
    border-style: dashed;
    animation: cw-empty-orders-orbit-secondary 3.6s linear infinite;
}

.cw-empty-orders-package {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 21px;
    border: 2px solid #e87524;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(72, 81, 92, .16);
    animation: cw-empty-orders-package 1.1s ease-in-out infinite;
}

.cw-empty-orders-package::before {
    position: absolute;
    top: -6px;
    left: -4px;
    width: 28px;
    height: 6px;
    border: 2px solid #e87524;
    border-radius: 3px 3px 1px 1px;
    background: #fff;
    content: '';
}

.cw-empty-orders-package::after {
    position: absolute;
    top: -4px;
    bottom: 0;
    left: 8px;
    width: 4px;
    background: rgba(232, 117, 36, .22);
    content: '';
}

.cw-empty-orders-spark {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4caf50;
    animation: cw-empty-orders-spark 1.4s ease-in-out infinite;
}

.cw-empty-orders-spark-one {
    top: 8px;
    left: 13px;
}

.cw-empty-orders-spark-two {
    right: 11px;
    bottom: 8px;
    width: 4px;
    height: 4px;
    background: #0d6efd;
    animation-delay: .7s;
}

@keyframes cw-empty-orders-orbit-primary {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes cw-empty-orders-orbit-secondary {
    from {
        transform: translate(-50%, -50%) rotate(360deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(0deg);
    }
}

@keyframes cw-empty-orders-package {

    0%,
    100% {
        transform: translate(-50%, -50%) translateY(2px) scale(.96);
    }

    50% {
        transform: translate(-50%, -50%) translateY(-2px) scale(1.04);
    }
}

@keyframes cw-empty-orders-spark {

    0%,
    100% {
        transform: scale(.65);
        opacity: .45;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.cw-empty-state h3 {
    font-size: 18px;
    color: var(--cw-text);
    margin-bottom: 8px;
}

.cw-empty-state p {
    font-size: 14px;
}

.cw-empty-state .cw-offline-prompt {
    color: #c62828;
    font-size: 15px;
    font-weight: 900;
}

#cwOrdersList .cw-empty-state h3 .cw-empty-orders-ellipsis>span {
    display: inline-block;
    width: .38em;
    opacity: .25;
    -webkit-animation: cw-empty-orders-ellipsis-pulse .9s ease-in-out infinite;
    animation-name: cw-empty-orders-ellipsis-pulse;
    animation-duration: .9s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

#cwOrdersList .cw-empty-state h3 .cw-empty-orders-ellipsis>span:nth-child(2) {
    animation-delay: .16s;
}

#cwOrdersList .cw-empty-state h3 .cw-empty-orders-ellipsis>span:nth-child(3) {
    animation-delay: .32s;
}

@-webkit-keyframes cw-empty-orders-ellipsis-pulse {

    0%,
    70%,
    100% {
        opacity: .25;
    }

    35% {
        opacity: 1;
    }
}

@keyframes cw-empty-orders-ellipsis-pulse {

    0%,
    70%,
    100% {
        opacity: .25;
    }

    35% {
        opacity: 1;
    }
}

/* Order Cards */
.cw-order-card {
    background: var(--cw-card);
    margin: 8px 12px;
    border-radius: var(--cw-radius);
    box-shadow: var(--cw-shadow);
    /* Uniform cards: cap the height and scroll vertically inside if a card's content is unusually
       long; never scroll horizontally — every cell wraps instead (see the min-width rule below). */
    max-height: min(560px, 80vh);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    border: 1px solid var(--cw-border);
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
    /* Query container (inline axis only, so the card's height still grows with its content): lets the
       pay strip switch from a 4-across row to a 2x2 grid by the card's OWN width, not the viewport. */
    container: cwcard / inline-size;
}

.cw-order-card::-webkit-scrollbar {
    width: 6px;
}

.cw-order-card::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 3px;
}

.cw-order-card::-webkit-scrollbar-track {
    background: transparent;
}

/* Let every cell shrink below its content so a long name/address wraps instead of forcing a
   horizontal scrollbar inside the card. */
.cw-order-card * {
    min-width: 0;
}

.cw-order-card:hover {
    border-color: var(--cw-primary);
    box-shadow: 0 6px 18px rgba(23, 40, 35, .14);
}

.cw-order-card:focus-visible {
    outline: 2px solid var(--cw-primary);
    outline-offset: 2px;
}

/* Decision badges (Catering / Recommended / Ready / Not Ready), centered under the order header. */
.cw-order-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px 0;
}

.cw-order-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
    letter-spacing: .02em;
}

.cw-order-badge.catering { background: #e3f2fd; color: #1565c0; }
.cw-order-badge.recommended { background: #ede7f6; color: #5e35b1; }
.cw-order-badge.ready { background: #e8f5e9; color: #2e7d32; }
.cw-order-badge.not-ready { background: #fff3e0; color: #b45309; }

.cw-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cw-border);
}

.cw-order-id {
    font-weight: 700;
    font-size: 14px;
}

.cw-order-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.cw-order-status.unassigned,
.cw-order-status.assigned {
    background: #E3F2FD;
    color: #1565C0;
}

.cw-order-status.picked-up,
.cw-order-status.comp-for-arriving {
    background: #FFF3E0;
    color: #E65100;
}

.cw-order-status.accepted {
    background: #E8F5E9;
    color: #2E7D32;
}

.cw-order-status.completed {
    background: #E0F2F1;
    color: #00695C;
}

.cw-order-pay {
    /* Earnings / Tip / Total / Distance. 4-across by default; a narrow card (<=380px — a phone, or a
       multi-column grid cell on desktop) drops to a 2x2 grid via the @container rule below, so a big
       value like "$384.90" or a four-figure catering Total has room instead of being clipped. The
       1px gaps over the border-coloured background render as hairline dividers between cells. */
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--cw-border);
    border-bottom: 1px solid var(--cw-border);
}

@container cwcard (max-width: 380px) {
    .cw-order-pay {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cw-order-pay-cell {
    min-width: 0;
    background: var(--cw-card);
    padding: 10px 6px;
    text-align: center;
}

.cw-order-pay-label {
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--cw-text-secondary);
}

.cw-order-pay-value {
    /* Scale with the card so a 4-across value shrinks on a narrower card instead of clipping; tabular
       figures keep the columns aligned. px first as a fallback where cqi is unsupported, capped at
       17px, and never wraps mid-number. */
    font-size: 15px;
    font-size: clamp(13px, 3.8cqi, 17px);
    font-weight: 700;
    color: var(--cw-text);
    margin-top: 2px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-order-pay-cell.primary .cw-order-pay-value {
    color: var(--cw-success);
}

.cw-order-body {
    padding: 12px 16px;
}

.cw-order-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.cw-order-row:last-child {
    margin-bottom: 0;
}

.cw-order-icon {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    font-size: 14px;
}

.cw-order-icon.pickup {
    color: var(--cw-success);
}

.cw-order-icon.dropoff {
    color: var(--cw-danger);
}

.cw-order-icon.time {
    color: var(--cw-blue);
}

.cw-order-icon.items {
    color: var(--cw-warning);
}

.cw-order-label {
    font-size: 11px;
    color: var(--cw-text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.cw-order-value {
    font-size: 14px;
    color: var(--cw-text);
}

.cw-order-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    /* Buttons sit just under the order header (above the badges), so the separator goes below them. */
    border-bottom: 1px solid var(--cw-border);
}

.cw-order-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cw-order-btn.accept {
    background: var(--cw-success);
    color: white;
}

.cw-order-btn.decline {
    background: #F5F5F5;
    color: var(--cw-danger);
    border: 1px solid var(--cw-border);
}

.cw-order-btn.navigate {
    background: var(--cw-blue);
    color: white;
}

.cw-order-btn.complete {
    background: var(--cw-primary);
    color: white;
}

.cw-order-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Bottom Navigation */
.cw-bottomnav {
    display: flex;
    background: white;
    border-top: 1px solid var(--cw-border);
    padding: 4px 0;
    flex-shrink: 0;
}

.cw-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    color: var(--cw-text-secondary);
    font-size: 11px;
    font-weight: 500;
    border: none;
    background: none;
    transition: color .2s;
}

.cw-nav-item:hover {
    background: rgba(13, 110, 253, .08);
    color: var(--cw-text);
}

.cw-nav-item:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--cw-primary);
    outline-offset: -2px;
}

.cw-nav-item.active {
    color: var(--cw-primary);
}

.cw-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
}

/* Tab Panels */
.cw-tab-panel {
    display: none;
}

.cw-tab-panel.active {
    display: block;
}

/* Profile Panel */
.cw-profile {
    padding: 16px;
}

.cw-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: var(--cw-radius);
    box-shadow: var(--cw-shadow);
    margin-bottom: 16px;
}

.cw-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--cw-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.cw-profile-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.cw-profile-info p {
    color: var(--cw-text-secondary);
    font-size: 14px;
    margin: 0;
}

.cw-profile-section {
    background: white;
    border-radius: var(--cw-radius);
    box-shadow: var(--cw-shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.cw-profile-section-title {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cw-text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--cw-border);
}

.cw-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cw-border);
}

.cw-profile-row:last-child {
    border-bottom: none;
}

.cw-profile-row-label {
    font-size: 14px;
    color: var(--cw-text-secondary);
}

.cw-profile-row-value {
    font-size: 14px;
    font-weight: 600;
}

#cwProfileTimezone {
    text-align: right;
}

.cw-profile-location-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    max-width: 65%;
}

.cw-profile-location-value span {
    overflow-wrap: anywhere;
    text-align: right;
}

.cw-logout-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    background: white;
    color: #8c2f25;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: var(--cw-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
}

.cw-logout-btn:hover {
    background: #8c2f25;
    color: white;
}

/* Loading Spinner */
.cw-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: cwSpin 0.8s linear infinite;
}

.cw-spinner.dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--cw-primary);
}

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

/* Profile tab lazy-load overlay */
#cwProfilePanel {
    position: relative;
}

.cw-profile-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.82);
    color: #6b6b6b;
    font-size: 13px;
    z-index: 5;
}

.cw-profile-loading p {
    margin: 0;
}

/* History List */
.cw-history-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    color: var(--cw-text-secondary);
    font-size: 14px;
}

.cw-history-loading .cw-spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
    margin-bottom: 12px;
}

.cw-history-loading p {
    margin: 0;
}

.cw-history-more {
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--cw-text-secondary);
}

.cw-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    margin: 4px 12px;
    border-radius: 8px;
    box-shadow: var(--cw-shadow);
}

.cw-history-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #E8F5E9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cw-history-item-details {
    flex: 1;
    min-width: 0;
}

.cw-history-item-id {
    font-weight: 600;
    font-size: 14px;
}

.cw-history-item-addr {
    font-size: 12px;
    color: var(--cw-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-history-item-time {
    font-size: 12px;
    color: var(--cw-text-secondary);
    text-align: right;
    flex-shrink: 0;
}

/* Notification Toast */
.cw-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 12px 16px;
    background: #f0fff4;
    color: #2e7d32;
    border: 1px solid currentColor;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    transform: translate(-50%, calc(-50% - 12px));
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
    pointer-events: none;
}

.cw-toast.show {
    transform: translate(-50%, -50%);
    opacity: 1;
}

.cw-toast.success {
    background: #f0fff4;
    color: #2e7d32;
}

.cw-toast.error {
    background: #fff5f5;
    color: #c62828;
}

/* Responsive */
@media (max-width: 520px) {
    #cwApp {
        max-width: 100%;
        margin: 8px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    }

    #cwMain {
        height: calc(100vh - 96px);
        height: calc(100dvh - 96px);
        max-height: none;
    }
}

@media (min-width: 521px) and (max-width: 767px) {
    #cwApp {
        max-width: 100%;
        margin: 8px;
    }
}

@media (min-width: 768px) {
    #cwApp {
        margin-top: 16px;
        margin-bottom: 16px;
    }
}

@media (min-width: 961px) {
    #cwApp {
        max-width: 100%;
    }
}

@media (min-width: 700px) {
    #cwOrdersList {
        display: grid;
        /* Order cards fill the row: each track is an equal 1fr share (never narrower than 280px), so
           every card in a row is the same width and the cards grow to use the whole width instead of
           leaving a gap where one more couldn't fit. auto-fit collapses empty tracks so a partial last
           row still fills. The Earnings/Tip/Total/Distance strip inside each card switches to a 2x2
           grid when the card is narrow (see .cw-order-pay @container), so its values stay legible. */
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
        /* Size card rows to their content so the cards never get squeezed when the list scrolls
           within a fixed-height pane. */
        grid-auto-rows: max-content;
        gap: 12px;
        padding: 8px 12px;
        align-content: start;
    }

    #cwOrdersList>.cw-empty-state {
        grid-column: 1 / -1;
    }

    .cw-order-card {
        margin: 0;
    }

    .cw-history-list {
        display: grid;
        /* Same side-by-side card grid as #cwOrdersList so the History tab is uniform with Orders. */
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
        grid-auto-rows: max-content;
        gap: 12px;
        padding: 8px 12px;
        align-content: start;
    }

    .cw-history-list>.cw-empty-state {
        grid-column: 1 / -1;
    }

    .cw-history-item {
        margin: 0;
    }

    .cw-profile {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* Route panel */
#cwRoutePanel {
    padding: 12px;
}

.cw-profile-row[hidden] {
    display: none;
}

/* Automation — lives at the bottom of the Orders tab and uses the same card language as the order cards */
#cwOrdersList>.cw-empty-state {
    padding: 28px 24px 20px;
}

.cw-auto-section {
    /* --cw-sec-pad-x drives both this card's inner side padding and the header bar's full-bleed
       negative margin (below), so the orange header always reaches the card edges at every width. */
    --cw-sec-pad-x: 12px;
    padding: 0 var(--cw-sec-pad-x) 16px;
}

#cwAppShell #cwAutoPanel,
#cwAppShell #cwAutoPanel * {
    text-align: left;
}

/* Automation (#cwAutoMain) and activity-log (#cwAutoLogMain) cards get an orange header bar with a
   white title, matching #cwApp's .cw-topbar, so the three cards read as one component (mirrors
   Roadie's rd-auto-header). Full-bleed via the section's side padding; sticky so it stays pinned
   like the dashboard topbar while the card's body scrolls. The card's overflow:hidden + radius clip
   the bar's top corners. */
#cwAppShell #cwAutoMain .cw-auto-header,
#cwAppShell #cwAutoLogMain .cw-auto-header {
    margin: 0 calc(-1 * var(--cw-sec-pad-x, 12px));
    padding: 12px 16px;
    min-height: var(--cw-header-h);
    box-sizing: border-box;
    align-items: center;
    background: var(--cw-primary);
    color: #fff;
}

#cwAppShell #cwAutoMain .cw-auto-header h3,
#cwAppShell #cwAutoLogMain .cw-auto-header h3 {
    color: #fff;
}

.cw-auto-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 4px 8px;
}

.cw-auto-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#cwAppShell .cw-auto-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--cw-text);
    margin: 0;
}

.cw-auto-info {
    display: inline-flex;
    flex-shrink: 0;
}

.cw-auto-info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    cursor: help;
}

.cw-auto-info-glyph {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.cw-auto-info-button:focus-visible {
    outline: 2px solid #084298;
    outline-offset: 2px;
}

.cw-auto-tooltip {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    /* Constrain to the panel header (its positioned ancestor) so the tooltip never spills past the
       viewport when the automation panel is the narrow 25% column. */
    width: min(320px, 100%);
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #335c53;
    border-radius: 6px;
    background: #183b34;
    box-shadow: 0 6px 18px rgba(13, 35, 30, .24);
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    visibility: hidden;
    opacity: 0;
    transition: opacity .16s ease;
    pointer-events: none;
}

.cw-auto-info-button:hover+.cw-auto-tooltip,
.cw-auto-info-button:focus+.cw-auto-tooltip {
    visibility: visible;
    opacity: 1;
}

.cw-auto-group {
    background: var(--cw-card);
    border: 1px solid var(--cw-border);
    border-radius: var(--cw-radius);
    box-shadow: var(--cw-shadow);
    padding: 12px 16px;
    margin: 8px 0;
}

.cw-auto-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--cw-text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--cw-border);
}

.cw-auto-settings {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.cw-auto-settings-block {
    min-width: 0;
}

.cw-auto-settings-block+.cw-auto-settings-block {
    padding-top: 14px;
    border-top: 1px solid var(--cw-border);
}

.cw-auto-actions {
    grid-area: actions;
}

.cw-auto-schedule {
    grid-area: schedule;
}

.cw-auto-filters {
    grid-area: filters;
    text-align: left;
}

.cw-auto-filters .cw-auto-hint {
    text-align: left;
}

#cwAppShell .cw-auto-filters .cw-auto-filter-text label {
    align-items: flex-start;
    text-align: left;
}

.cw-auto-filters input {
    text-align: left;
}

.cw-auto-filters .cw-auto-filter-text>.cw-auto-hint {
    margin: 6px 0 8px;
}

#cwAppShell .cw-auto-toggle-row {
    display: flex;
    position: relative;
    margin: 0;
    gap: 10px;
    text-align: left;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
}

.cw-auto-toggle-row+.cw-auto-toggle-row {
    border-top: 1px solid #F0F0F0;
}

.cw-auto-label {
    font-size: 14px;
    color: var(--cw-text);
    text-align: left;
}

#cwAppShell .cw-auto-checkbox {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

#cwAppShell .cw-auto-checkbox:focus-visible+.cw-auto-switch {
    outline: 2px solid var(--cw-primary);
    outline-offset: 2px;
}

.cw-auto-switch {
    display: block;
    position: relative;
    width: 44px;
    height: 24px;
    background: #CFCFCF;
    border-radius: 12px;
    flex-shrink: 0;
    transition: background .2s;
}

.cw-auto-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s;
}

.cw-auto-checkbox:checked+.cw-auto-switch {
    background: var(--cw-success);
}

.cw-auto-checkbox:checked+.cw-auto-switch::after {
    transform: translateX(20px);
}

.cw-auto-hint {
    font-size: 12px;
    color: var(--cw-text-secondary);
    margin: -6px 0 8px;
    line-height: 1.4;
}

.cw-auto-actions>.cw-auto-hint {
    text-align: left;
}

.cw-auto-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 150px));
    justify-content: center;
    gap: 8px;
    margin: 4px 0 12px;
}

.cw-auto-filter-pair {
    min-width: 0;
}

#cwAppShell .cw-auto-filter-pair label,
#cwAppShell .cw-auto-filter-text label {
    margin: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#cwAppShell .cw-auto-filter-pair label {
    align-items: flex-start;
    text-align: left;
}

.cw-auto-filter-pair label span,
.cw-auto-filter-text label span {
    font-size: 12px;
    font-weight: 600;
    color: var(--cw-text-secondary);
}

.cw-auto-filter-pair input,
.cw-auto-filter-text input,
.cw-auto-filter-text select,
#cwScheduleConfig select {
    background: #FAFAFA;
    border: 1px solid var(--cw-border);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 14px;
    color: var(--cw-text);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.cw-auto-timezone-value {
    display: block;
    padding: 9px 10px;
    border: 1px solid var(--cw-border);
    border-radius: 8px;
    background: #f7f8f6;
    color: var(--cw-text);
    font-size: 14px;
    font-weight: 600;
}

.cw-auto-filter-pair input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.cw-auto-filter-pair input[type="number"]::-webkit-inner-spin-button,
.cw-auto-filter-pair input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cw-auto-filter-pair input:focus,
.cw-auto-filter-text input:focus,
.cw-auto-filter-text select:focus,
#cwScheduleConfig select:focus {
    border-color: var(--cw-primary);
    background: #fff;
}

.cw-auto-filter-pair input::placeholder,
.cw-auto-filter-text input::placeholder {
    color: #AAAAAA;
}

.cw-auto-filter-text {
    margin-bottom: 10px;
}

#cwAppShell #cwScheduleConfig label {
    margin: 0 0 8px;
    color: var(--cw-text-secondary);
    font-size: 11px;
    text-align: left;
}

.cw-auto-add-slot {
    background: transparent;
    border: 1px dashed #BDBDBD;
    border-radius: 8px;
    color: var(--cw-primary);
    padding: 10px;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.cw-auto-add-slot:hover {
    border-color: var(--cw-primary);
    background: #FFF4EC;
}

.cw-schedule-slot {
    background: #FAFAFA;
    border: 1px solid var(--cw-border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    container-type: inline-size;
}

.cw-schedule-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cw-schedule-slot-header span {
    font-size: 12px;
    font-weight: 600;
    color: var(--cw-text-secondary);
}

.cw-schedule-slot-remove {
    background: transparent;
    border: none;
    color: var(--cw-danger);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
}

.cw-schedule-days {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

#cwAppShell .cw-schedule-day {
    width: 38px;
    height: 28px;
    padding: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border-radius: 6px;
    border: 1px solid var(--cw-border);
    color: var(--cw-text-secondary);
    cursor: pointer;
    background: #fff;
    transition: all .15s;
}

#cwAppShell .cw-schedule-day.selected {
    background: var(--cw-success);
    border-color: var(--cw-success);
    color: #fff;
}

.cw-schedule-times {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
}

.cw-schedule-times span {
    text-align: center;
    font-size: 12px;
    color: var(--cw-text-secondary);
}

.cw-schedule-times input {
    background: #fff;
    border: 1px solid var(--cw-border);
    border-radius: 8px;
    padding: 6px 6px;
    font-size: 14px;
    color: var(--cw-text);
    outline: none;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* In a narrow card (the desktop two-column layout) the two times stack instead of truncating. */
@container (max-width: 270px) {
    .cw-schedule-times {
        grid-template-columns: 1fr;
    }

    .cw-schedule-times span {
        text-align: left;
    }
}

.cw-auto-log {
    /* Reasonable, practical cap so the log never dominates the page; it scrolls vertically past it. */
    max-height: clamp(260px, 42vh, 420px);
    overflow-y: auto;
    /* Activity entries as side-by-side cards that fill each row uniformly (auto-fit, like the order
       cards) instead of leaving an empty track on the right when a row isn't full. */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    align-content: start;
    gap: 10px;
    padding: 4px;
}

.cw-auto-log-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--cw-text-secondary);
    font-size: 13px;
    padding: 16px 0 8px;
}

.cw-auto-log-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--cw-border);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    /* Clickable card — opens the full activity-log detail modal (mirrors the Roadie log). */
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
    /* Compact, uniform cards — every card is the same height because the summary lines are single-line
       with ellipsis (full detail is in the click-through modal). max-height is a defensive cap. */
    max-height: 170px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.cw-auto-log-item::-webkit-scrollbar {
    width: 6px;
}

.cw-auto-log-item::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 3px;
}

.cw-auto-log-item::-webkit-scrollbar-track {
    background: transparent;
}

.cw-auto-log-item:hover {
    border-color: var(--cw-primary);
    box-shadow: 0 4px 14px rgba(23, 40, 35, .14);
    transform: translateY(-2px);
}

.cw-auto-log-item:focus-visible {
    outline: 2px solid var(--cw-primary);
    outline-offset: 2px;
}

.cw-auto-log-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.cw-auto-log-icon.accept {
    background: #E8F5E9;
    color: #2E7D32;
}

.cw-auto-log-icon.decline {
    background: #FFEBEE;
    color: #C62828;
}

.cw-auto-log-icon.skip {
    background: #FFF3E0;
    color: #E65100;
}

/* An action that did not go through: filled, so it never reads as the pale red of an order the bot declined. */
.cw-auto-log-icon.failed {
    background: #C62828;
    color: #FFFFFF;
}

.cw-auto-log-details {
    flex: 1;
    min-width: 0;
}

.cw-auto-log-details .cw-auto-log-action,
.cw-auto-log-details .cw-auto-log-info,
.cw-auto-log-details .cw-auto-log-time {
    /* One line each, truncated with an ellipsis, so every card is exactly three lines tall and the
       grid reads as a uniform matrix; the full, untruncated detail is in the click-through modal. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-auto-log-details .cw-auto-log-action {
    font-weight: 600;
    color: var(--cw-text);
}

.cw-auto-log-details .cw-auto-log-info {
    color: var(--cw-text-secondary);
    margin-top: 2px;
}

.cw-auto-log-details .cw-auto-log-time {
    color: #999;
    font-size: 11px;
    margin-top: 2px;
}

/* Keep the settings sections in one column at every width. */
@media (min-width: 700px) {
    .cw-auto-section {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "header header"
            "settings settings"
            "activity activity";
        gap: 0 8px;
        align-items: start;
        padding: 0 12px 16px;
    }

    .cw-auto-header {
        grid-area: header;
    }

    .cw-auto-settings {
        grid-area: settings;
        display: flex;
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .cw-auto-settings-block+.cw-auto-settings-block {
        padding-top: 0;
        border-top: 0;
    }

    .cw-auto-schedule {
        padding-top: 14px;
        border-top: 1px solid var(--cw-border);
    }

    .cw-auto-filters {
        grid-row: auto;
        padding-left: 0;
        border-left: 0;
    }

    .cw-auto-activity {
        grid-area: activity;
    }
}

.cw-app-section {
    --driver-section-space: 12px;
    padding: 12px;
    background: linear-gradient(130deg, #122825 0%, #1a3935 54%, #204841 100%);
}

.cw-app-container {
    width: 100%;
    padding: 0;
}

#cwApp {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    scroll-margin-top: 76px;
}

#cwApp.cw-login-mode {
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
}

html[data-cw-restoring] #cwApp.cw-login-mode {
    width: 100%;
    margin-inline: 0;
}

#cwRestoring,
#cwLogin {
    min-height: 520px;
}

#cwLogin {
    width: min(528px, calc(100vw - 32px));
    max-width: 100%;
    margin-inline: auto;
    padding: clamp(32px, 6vw, 64px) 24px;
}

#cwLogin .cw-input-group,
#cwLogin .cw-btn,
#cwLoginError {
    max-width: 480px;
}

#cwMain {
    height: min(780px, 85vh);
    max-height: none;
    min-height: 360px;
}

.cw-content {
    background: #f3f5f2;
}

.cw-auto-group {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(23, 40, 35, .06);
}

.cw-profile-row-value,
.cw-order-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (min-width: 700px) {
    .cw-profile {
        max-width: none;
        margin: 0;
        display: grid;
        grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr);
        gap: 12px;
    }

    .cw-profile-header,
    .cw-profile-section {
        margin: 0;
    }
}

/* The Orders tab now holds only the order list. Automation (#cwAutoMain) and the activity log
   (#cwAutoLogMain) are their own containers — siblings of #cwApp under #cwAppShell (see below).
   The panel fills the fixed-height dashboard and the list scrolls within it, like Roadie's #rdGigsList. */
#cwOrdersPanel.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
}

#cwOrdersPanel.active > #cwOrdersList {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Route and History tabs use the same side-by-side card grid as #cwOrdersList, so all three
   order lists are uniform. #cwRoutePanel holds the order cards directly (the grid is gated on
   .active so it never overrides the tab's own display:none); #cwHistoryPanel keeps its
   .cw-history-list wrapper (gridded above). Both still scroll via .cw-content like before. */
@media (min-width: 700px) {
    #cwRoutePanel.active {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
        grid-auto-rows: max-content;
        gap: 12px;
        padding: 8px 12px;
        align-content: start;
    }

    /* Non-card rows (empty state, loading spinner, throttle notice) span the full width. */
    #cwRoutePanel > .cw-empty-state,
    .cw-history-list > .cw-history-loading,
    .cw-history-list > .cw-history-more {
        grid-column: 1 / -1;
    }
}

/* ---------------------------------------------------------------------------
   App shell — the Roadie-style dashboard layout. #cwApp (the dashboard), #cwAutoMain
   (automation settings) and #cwAutoLogMain (activity log) are three sibling cards.
   Stacked by default; at >=1200px the dashboard (75%) and automation (25%) sit side by
   side with the activity log always its own full-width row below them. The cards are
   shown only when signed in or in demo mode — the driver client toggles .cw-authed.
   --------------------------------------------------------------------------- */
#cwAutoMain,
#cwAutoLogMain {
    display: none;
    width: 100%;
    margin-top: 12px;
    background: var(--cw-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    text-align: left;
}

#cwAppShell.cw-authed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#cwAppShell.cw-authed > #cwApp,
#cwAppShell.cw-authed > #cwAutoMain,
#cwAppShell.cw-authed > #cwAutoLogMain {
    margin-top: 0;
    max-width: 100%;
}

#cwAppShell.cw-authed > #cwAutoMain,
#cwAppShell.cw-authed > #cwAutoLogMain {
    display: block;
}

@media (min-width: 1200px) {
    #cwAppShell.cw-authed {
        flex-flow: row wrap;
        align-items: flex-start;
    }

    #cwAppShell.cw-authed > #cwApp {
        flex: 1 1 calc(75% - 6px);
        min-width: 0;
        width: auto;
    }

    /* Automation column: fixed to the dashboard's height; its settings scroll vertically
       (never horizontally) within the card, like Roadie's #rdAutoMain. */
    #cwAppShell.cw-authed > #cwAutoMain {
        flex: 0 1 calc(25% - 6px);
        min-width: 0;
        width: auto;
        height: min(780px, 85vh);
        display: flex;
        flex-direction: column;
    }

    #cwAppShell.cw-authed > #cwAutoMain > #cwAutoPanel {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* The automation panel scrolls internally here, so pin its orange header to the card top like
       #cwApp's topbar stays put while #cwMain scrolls. */
    #cwAppShell.cw-authed > #cwAutoMain > #cwAutoPanel > .cw-auto-header {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    /* Activity log always takes its own full-width row below the dashboard + automation. */
    #cwAppShell.cw-authed > #cwAutoLogMain {
        flex: 1 1 100%;
    }
}

@media (max-width: 520px) {
    #cwApp {
        margin: 0;
    }

    #cwMain {
        height: calc(100dvh - 96px);
        min-height: 360px;
    }

    .cw-auto-section {
        --cw-sec-pad-x: 8px;
        padding-inline: 8px;
    }
}

#cwAppShell #cwAutoPanel,
#cwAppShell #cwAutoPanel * {
    text-align: left !important;
}

#cwAppShell #cwAutoPanel .cw-auto-filter-grid .cw-auto-filter-pair label>span {
    align-self: stretch;
    text-align: center !important;
}

/* Order card: Pick-up Time and Items share one 50/50 row */
.cw-order-row-split {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.cw-order-row-split:last-child {
    margin-bottom: 0;
}

.cw-order-split-cell {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Order card: center the Items cell content in its half of the row */
.cw-order-split-cell.cw-split-center {
    justify-content: center;
    text-align: center;
}

/* Automation log: the reason(s) an order was declined or skipped, as a bulleted list */
.cw-auto-log-reasons {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cw-auto-log-reason {
    position: relative;
    padding-left: 12px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--cw-text-secondary);
}

.cw-auto-log-reason::before {
    content: '\2022';
    position: absolute;
    left: 2px;
    color: var(--cw-text-secondary);
}

/* ------------------------------------------------------------------------- */
/* Order detail modal — a full-height sheet with the complete order details  */
/* (mirrors the Roadie gig-detail modal). Bottom sheet on phones, centered   */
/* dialog on wider screens.                                                  */
/* ------------------------------------------------------------------------- */
.cw-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: cw-detail-fade 0.2s ease;
}

@keyframes cw-detail-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cw-detail-slide {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cw-detail-sheet {
    background: var(--cw-card);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 560px;
    height: 94vh;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    animation: cw-detail-slide 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

.cw-detail-header {
    background: var(--cw-card);
    padding: 16px;
    border-bottom: 1px solid var(--cw-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0;
}

.cw-detail-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--cw-text);
}

.cw-detail-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--cw-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}

.cw-detail-body {
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.cw-detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: var(--cw-text-secondary);
    font-size: 14px;
    gap: 8px;
}

.cw-detail-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--cw-border);
}

.cw-detail-section:last-child {
    border-bottom: none;
}

.cw-detail-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cw-text-secondary);
    margin: 0 0 8px;
}

.cw-detail-pay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));
    gap: 8px;
}

.cw-detail-pay-item {
    text-align: center;
    padding: 10px 8px;
    background: var(--cw-bg);
    border-radius: 6px;
}

.cw-detail-pay-item.primary {
    background: var(--cw-success);
    color: #fff;
}

.cw-detail-pay-item .label {
    font-size: 11px;
    color: var(--cw-text-secondary);
    margin-bottom: 2px;
}

.cw-detail-pay-item.primary .label {
    color: rgba(255, 255, 255, 0.85);
}

.cw-detail-pay-item .value {
    font-size: 18px;
    font-weight: 700;
}

.cw-detail-route-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cw-detail-stop {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
}

.cw-detail-stop-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.cw-detail-stop-dot.pickup {
    background: var(--cw-success);
}

.cw-detail-stop-dot.dropoff {
    background: var(--cw-danger);
}

.cw-detail-stop-type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cw-text-secondary);
}

.cw-detail-stop-name {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.cw-detail-stop-addr {
    font-size: 13px;
    color: var(--cw-text-secondary);
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.cw-detail-stop-phone {
    font-size: 13px;
    margin-top: 2px;
}

.cw-detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cw-detail-meta-item {
    padding: 8px 10px;
    background: var(--cw-bg);
    border-radius: 6px;
}

.cw-detail-meta-item .label {
    font-size: 11px;
    color: var(--cw-text-secondary);
}

.cw-detail-meta-item .value {
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.cw-detail-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cw-detail-items li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--cw-border);
    font-size: 14px;
}

.cw-detail-items li:last-child {
    border-bottom: none;
}

.cw-detail-items .qty {
    font-size: 12px;
    color: var(--cw-text-secondary);
    background: var(--cw-bg);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.cw-detail-note {
    font-size: 13px;
    color: var(--cw-text);
    background: var(--cw-bg);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 8px;
    overflow-wrap: anywhere;
}

.cw-detail-note-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cw-text-secondary);
    margin-bottom: 2px;
}

.cw-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cw-detail-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--cw-bg);
    color: var(--cw-text-secondary);
}

.cw-detail-badge.warn {
    background: #fff3e0;
    color: #b45309;
}

.cw-detail-badge.info {
    background: #e3f2fd;
    color: #1565c0;
}

.cw-detail-badge.good {
    background: #e8f5e9;
    color: #2e7d32;
}

.cw-detail-actions {
    padding: 14px 16px 4px;
    display: flex;
    gap: 10px;
}

.cw-detail-actions .cw-order-btn {
    flex: 1;
}

@media (min-width: 600px) {
    .cw-detail-overlay {
        align-items: center;
    }

    .cw-detail-sheet {
        border-radius: 16px;
        height: 92vh;
        max-height: 92vh;
    }

    .cw-detail-header {
        border-radius: 16px 16px 0 0;
    }
}

/* ------------------------------------------------------------------------- */
/* Activity-log detail modal — click a log card to read the full entry in a  */
/* large, full-height dialog (mirrors the Roadie activity-log modal). The log */
/* card shows only the essentials; every logged detail is shown here.         */
/* ------------------------------------------------------------------------- */
.cw-log-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 16px;
    animation: cw-detail-fade 0.2s ease;
}

.cw-log-modal-overlay[hidden] {
    display: none;
}

@keyframes cw-log-modal-pop {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cw-log-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    height: 96vh;
    background: var(--cw-card);
    color: var(--cw-text);
    border-radius: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px 28px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    animation: cw-log-modal-pop 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

.cw-log-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    color: var(--cw-text-secondary);
    background: var(--cw-bg);
    border: 1px solid var(--cw-border);
    cursor: pointer;
}

.cw-log-modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

.cw-log-modal-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cw-log-modal-status {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.cw-log-modal-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 700;
    flex-shrink: 0;
}

.cw-log-modal-badge.accept { background: #E8F5E9; color: #2E7D32; }
.cw-log-modal-badge.decline { background: #FFEBEE; color: #C62828; }
.cw-log-modal-badge.skip { background: #FFF3E0; color: #E65100; }
.cw-log-modal-badge.failed { background: #C62828; color: #FFFFFF; }

.cw-log-modal-status-label {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cw-log-modal-status.accept .cw-log-modal-status-label { color: #2E7D32; }
.cw-log-modal-status.decline .cw-log-modal-status-label { color: #C62828; }
.cw-log-modal-status.skip .cw-log-modal-status-label { color: #E65100; }
.cw-log-modal-status.failed .cw-log-modal-status-label { color: #C62828; }

.cw-log-modal-failure {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #1A1A1A;
}

.cw-log-modal-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--cw-text);
    overflow-wrap: anywhere;
}

.cw-log-modal-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
    gap: 12px;
}

.cw-log-modal-metric {
    text-align: center;
    padding: 16px 12px;
    background: var(--cw-bg);
    border-radius: 10px;
}

.cw-log-modal-metric.primary {
    background: var(--cw-primary);
    color: #fff;
}

.cw-log-modal-metric-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cw-text-secondary);
    margin-bottom: 6px;
}

.cw-log-modal-metric.primary .cw-log-modal-metric-label { color: rgba(255, 255, 255, 0.85); }

.cw-log-modal-metric-value {
    font-size: 22px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.cw-log-modal-section {
    margin: 0;
}

.cw-log-modal-kv {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cw-log-modal-kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
}

.cw-log-modal-kv-label {
    flex-shrink: 0;
    font-size: 13px;
    color: var(--cw-text-secondary);
}

.cw-log-modal-kv-value {
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cw-log-modal-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cw-text-secondary);
    margin: 0 0 10px;
}

.cw-log-modal-reasons {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cw-log-modal-reasons li {
    font-size: 15px;
    line-height: 1.4;
    color: var(--cw-text);
    overflow-wrap: anywhere;
}

.cw-log-modal-note {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--cw-text-secondary);
}

.cw-log-modal-time {
    margin-top: auto;
    padding-top: 10px;
    font-size: 14px;
    color: var(--cw-text-secondary);
}

/* ------------------------------------------------------------------------- */
/* Sign-in modal — the login form shows in a dialog over the dashboard (demo  */
/* while logged out), opened by the topbar "Login" button (mirrors Roadie's   */
/* auth modal).                                                               */
/* ------------------------------------------------------------------------- */
.cw-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: cw-detail-fade 0.2s ease;
}

.cw-auth-modal[hidden] {
    display: none;
}

.cw-auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.cw-auth-modal-card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    max-height: 92vh;
    overflow: hidden auto;
    background: var(--cw-card);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.cw-auth-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    z-index: 3;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 22px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
}

.cw-auth-modal-close:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* The login form fits the modal card instead of filling the screen. */
.cw-auth-modal #cwLogin {
    min-height: auto;
    width: 100%;
    margin-inline: 0;
    padding: clamp(28px, 5vw, 44px) clamp(20px, 5vw, 32px);
}
/* ---- The intro (2026-12-01): the Roadie Bot page's layout, in this page's colours. One chip style for the line above the
   title and for the three facts under the button, one size of copy, and a button as heavy as the chips. A chip whose
   translation is too long for a small phone takes a second line instead of pushing the page sideways (the line above the
   title did by 8 to 24px at 320 and 360px in German, Spanish, French, Italian, Dutch, Polish, Portuguese, Russian and
   Vietnamese with `nowrap`). ---- */
#cwHero .hero-eyebrow,
#cwHero .hero-trust-item {
    display: inline-block;
    max-width: 100%;
    background: rgba(255, 107, 0, .14);
    color: #ffd0b0;
    border: 1px solid rgba(255, 143, 63, .42);
    border-radius: 50rem;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
    padding: 7px 14px;
    white-space: normal;
    text-wrap: balance;
}

#cwHero .hero-eyebrow i,
#cwHero .hero-trust-item i {
    color: #ffd0b0;
}

#cwHero .hero-trust {
    font-size: 13px;
}

#cwHero p {
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
}

#cwHero .download-btn {
    font-weight: 600;
}

/* ---- The tutorial video in the hero. Nothing of it loads until it is played. ----
   One column that is never wider than its place: without the minmax() the longest name in the list of parts (a
   <select> is as wide as its longest option) would widen the whole block, and with it the page, on a phone. The
   captions are written under the picture, in the language of the page; two lines are always kept free for them, so
   the page stands still as they come and go. */
#cwHero .cw-video {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-self: center;
    gap: 12px;
    width: 100%;
    max-width: 720px;
    min-width: 0;
    margin-inline: auto;
    text-align: center;
}

#cwHero .cw-video__frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 12px;
    background: #1f0606;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35);
}

#cwHero .cw-video__player {
    display: block;
    width: 100%;
    height: 100%;
    background: #1f0606;
    object-fit: contain;
}

/* At the desktop width the two halves of the intro are as tall as each other, to the pixel, in every language (the Roadie Bot
   page's rule, roadie-driver.css). The row is as tall as the words need, and never under 400 px (so that the picture stays a
   size worth watching); the words are spread over it from its top edge to its bottom edge; and the player fills the other half
   exactly: its picture is as large as the height left over the captions and their controls allows, at 16 by 9, in the middle
   of the half. The player is out of the flow (absolute), so only the words decide the height of the row (measured in the 17
   languages by test/cartwheel-hero-layout-browser.test.js). Below this width the halves stand one above the other, and the
   player is as wide as the intro but no wider than 720 px. */
@media (min-width: 1200px) {
    #cwHero > .container > .row {
        min-height: 400px;
    }

    #cwHero > .container > .row > :first-child {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
    }

    #cwHero > .container > .row > :last-child {
        position: relative;
    }

    #cwHero .cw-video {
        position: absolute;
        inset: 0 calc(var(--bs-gutter-x, 1.5rem) * .5);
        display: flex;
        flex-direction: column;
        align-self: auto;
        width: auto;
        max-width: none;
        margin: 0;
    }

    #cwHero .cw-video__frame {
        flex: 1 1 0;
        align-self: center;
        min-height: 0;
        max-width: 100%;
    }
}

/* Until the video plays, the whole picture is the button; after that the browser's own controls are there. */
#cwHero .cw-video__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0 12px 6%;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(31, 6, 6, 0) 50%, rgba(31, 6, 6, .55) 100%);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

#cwHero .cw-video__play[hidden] {
    display: none;
}

#cwHero .cw-video__pill {
    display: inline-flex;
    box-sizing: border-box;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-height: 46px;
    padding: 6px 22px 6px 14px;
    border-radius: 999px;
    background: #ef6b3c;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    transition: transform .15s, background-color .15s;
}

#cwHero .cw-video__pill .bi {
    font-size: 26px;
    line-height: 1;
}

#cwHero .cw-video__pill-time {
    padding-inline-start: 10px;
    border-inline-start: 1px solid rgba(255, 255, 255, .55);
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#cwHero .cw-video__pill-time[hidden] {
    display: none;
}

#cwHero .cw-video__play:hover .cw-video__pill {
    background: #f47d52;
    transform: scale(1.04);
}

#cwHero .cw-video__play:focus-visible {
    outline: 3px solid #ffd24a;
    outline-offset: -5px;
}

/* The video starts by itself without sound (a browser allows nothing else); this is the one button that turns it on. It
   lies over the top corner of the picture, clear of the browser's own controls along the bottom, and goes away once the
   sound is on. A few seconds after it appeared (cartwheel-video.js adds --small) it shrinks to the muted speaker alone, so
   that it covers less of the picture; the words stay in the page for a screen reader, and hovering the button or putting
   the keyboard on it brings them back. */
#cwHero .cw-video__sound {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    z-index: 2;
    display: inline-flex;
    box-sizing: border-box;
    align-items: center;
    max-width: calc(100% - 20px);
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding-block: 6px;
    padding-inline: 12px 16px;
    border: 0;
    border-radius: 999px;
    background: #ef6b3c;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    text-align: start;
    text-wrap: balance;
    cursor: pointer;
    transition: transform .15s, background-color .15s, padding-inline .3s ease;
}

#cwHero .cw-video__sound[hidden] {
    display: none;
}

#cwHero .cw-video__sound .bi {
    flex: 0 0 auto;
    font-size: 22px;
    line-height: 1;
}

/* Two speakers: the one that says "turn sound on" beside the words, the muted one when the button is the icon alone. */
#cwHero .cw-video__sound .cw-video__sound-off {
    display: none;
}

/* One line, always: squeezed to no width a label that may wrap breaks into one letter a line and makes the button tall. */
#cwHero .cw-video__sound-text {
    display: block;
    max-width: 24em;
    margin-inline-start: 8px;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width .3s ease, margin-inline-start .3s ease, opacity .2s ease;
}

#cwHero .cw-video__sound--small:not(:hover):not(:focus-visible) {
    justify-content: center;
    padding-inline: 0;
}

#cwHero .cw-video__sound--small:not(:hover):not(:focus-visible) .cw-video__sound-text {
    max-width: 0;
    margin-inline-start: 0;
    opacity: 0;
}

#cwHero .cw-video__sound--small:not(:hover):not(:focus-visible) .cw-video__sound-on {
    display: none;
}

#cwHero .cw-video__sound--small:not(:hover):not(:focus-visible) .cw-video__sound-off {
    display: inline-block;
}

#cwHero .cw-video__sound:hover {
    background: #f47d52;
    transform: scale(1.04);
}

#cwHero .cw-video__sound:focus-visible {
    outline: 3px solid #ffd24a;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    #cwHero .cw-video__sound,
    #cwHero .cw-video__sound-text { transition: none; }
    #cwHero .cw-video__sound:hover { transform: none; }
}

#cwHero .cw-video__caption {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.1em;
    margin: 0;
    padding: 0 6px;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    text-wrap: balance;
    unicode-bidi: plaintext;
}

#cwHero .cw-video__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 22px;
}

/* The shell gives every label of a page its own line and spacing; inside the intro this one is a switch. */
#cwHero .cw-video__switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

#cwHero .cw-video__switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

#cwHero .cw-video__track {
    position: relative;
    flex: 0 0 46px;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #aab2a8;
    transition: background-color .15s;
}

#cwHero .cw-video__track::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 35, 30, .35);
    content: "";
    transition: transform .15s;
}

#cwHero .cw-video__switch input:checked + .cw-video__track {
    background: #ff8f3f;
}

#cwHero .cw-video__switch input:checked + .cw-video__track::after {
    background: #2d0a0a;
    transform: translateX(20px);
}

#cwHero .cw-video__switch input:focus-visible + .cw-video__track {
    outline: 3px solid #ef6b3c;
    outline-offset: 2px;
}

#cwHero .cw-video__chapters {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 40px 0 16px;
    border: 1px solid #d6d9d3;
    border-radius: 8px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2317231e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 14px;
    color: #17231e;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-align-last: center;
    text-overflow: ellipsis;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#cwHero .cw-video__chapters:focus-visible {
    outline: 3px solid #ef6b3c;
    outline-offset: 2px;
}

#cwHero .cw-video__chapters[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    #cwHero .cw-video__pill,
    #cwHero .cw-video__track,
    #cwHero .cw-video__track::after {
        transition: none;
    }

    #cwHero .cw-video__play:hover .cw-video__pill {
        transform: none;
    }
}

/* While a signed-in driver's own settings are on their way (cartwheel-automation.js, awaitOwnPrefs) the panel is empty,
   closed to changes and dimmed, so that nobody takes it for the settings in force. */
#cwAutoPanel[aria-busy="true"] {
    opacity: .55;
    transition: opacity .2s ease;
}
