:root {
    color-scheme: light;
    --ink: #1f2933;
    --muted: #667085;
    --line: #ffd5b8;
    --panel: #ffffff;
    --bg: #fff7ed;
    --brand: #fc8019;
    --brand-dark: #d95f00;
    --brand-soft: #fff0df;
    --warning: #b45309;
    --success: #15803d;
    --shadow: 0 20px 55px rgba(252, 128, 25, 0.18);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: linear-gradient(180deg, #fff1df 0, var(--bg) 280px, #ffffff 100%);
    padding-bottom: 86px;
}

button,
input {
    font: inherit;
}

button {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.app-shell {
    width: min(1180px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
    gap: 16px;
    align-content: start;
}

.topbar,
.summary-grid,
.app-view {
    grid-column: 1 / -1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    animation: slideDown 0.5s ease both;
}

.driver-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.driver-badge {
    max-width: 220px;
    color: var(--brand-dark);
    font-size: 0.86rem;
    font-weight: 800;
    text-align: right;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand-dark);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(1.8rem, 5vw, 2.65rem);
    letter-spacing: 0;
}

.icon-button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #ff9f43);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-weight: 900;
}

.icon-button.muted {
    color: var(--ink);
    background: #fff3e6;
}

.icon-button.is-active {
    color: #fff;
    background: #111827;
}

.app-view {
    display: none;
}

.app-view.is-active {
    display: grid;
    gap: 16px;
    animation: fadeLift 0.35s ease both;
}

.task-view.is-active {
    grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
    align-items: start;
}

.work-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 30px rgba(252, 128, 25, 0.1);
}

.work-panel h2 {
    margin-bottom: 0;
    font-size: 1.25rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.summary-grid article,
.order-card,
.detail-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
}

.summary-grid article {
    padding: 14px;
    animation: fadeLift 0.5s ease both;
}

.summary-grid strong {
    display: block;
    font-size: 1.35rem;
}

.summary-grid span {
    color: var(--muted);
    font-size: 0.84rem;
}

.filters {
    grid-column: 1;
    display: grid;
    grid-template-columns: repeat(5, minmax(78px, 1fr));
    gap: 7px;
    overflow-x: auto;
}

.filter-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: var(--panel);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 760;
}

.filter-button.is-active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.order-list {
    grid-column: 1;
    display: grid;
    gap: 12px;
}

.order-card {
    padding: 14px;
    box-shadow: 0 10px 28px rgba(252, 128, 25, 0.09);
    cursor: pointer;
    text-align: left;
    animation: fadeLift 0.34s ease both;
}

.order-card:hover {
    box-shadow: var(--shadow);
}

.order-card.is-active {
    border-color: var(--brand);
    outline: 3px solid rgba(252, 128, 25, 0.18);
}

.order-head,
.detail-head,
.row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.order-card h2 {
    margin-bottom: 4px;
    font-size: 1.02rem;
}

.order-card p,
.detail-panel p {
    color: var(--muted);
    line-height: 1.45;
}

.badge {
    align-self: flex-start;
    white-space: nowrap;
    border-radius: 999px;
    padding: 4px 9px;
    color: var(--success);
    background: #dcfce7;
    font-size: 0.74rem;
    font-weight: 850;
}

.badge.picked_up {
    color: var(--warning);
    background: #fef3c7;
}

.badge.delivered {
    color: #1e3a8a;
    background: #dbeafe;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.meta-grid strong {
    display: block;
    font-size: 0.92rem;
}

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

.detail-panel {
    grid-column: 2;
    grid-row: 1 / span 3;
    min-height: 570px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 12px;
    z-index: 15;
    transform: translateX(-50%);
    width: min(520px, calc(100vw - 24px));
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.bottom-nav-button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 850;
}

.bottom-nav-button.is-active {
    color: #fff;
    background: var(--brand);
}

.detail-content {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.store-cover {
    width: 100%;
    aspect-ratio: 16 / 7;
    border-radius: 8px;
    object-fit: cover;
    background: #fff1df;
}

.detail-head {
    align-items: flex-start;
}

.detail-head h2 {
    margin-bottom: 4px;
    font-size: 1.45rem;
}

.section {
    border-top: 1px solid var(--line);
    padding-top: 15px;
}

.section h3 {
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.items {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.store-block {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    align-items: start;
}

.store-logo,
.item-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff1df;
}

.item-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.item-row strong,
.item-row small {
    display: block;
}

.item-row small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.item-row span {
    color: var(--ink);
    font-weight: 850;
    white-space: nowrap;
}

.item-image.placeholder::before {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    margin: 19px auto;
    border-radius: 50%;
    background: var(--brand);
    opacity: 0.35;
}

.timeline {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-left: 3px solid var(--brand);
    padding-left: 10px;
}

.timeline span {
    color: var(--muted);
    font-size: 0.84rem;
    text-align: right;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
}

.image-gallery img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    object-fit: cover;
    background: #fff1df;
}

.row {
    align-items: baseline;
    color: var(--muted);
}

.row strong {
    color: var(--ink);
}

.actions {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 14px 18px 18px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}

.action-button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #ff9f43);
    cursor: pointer;
    font-weight: 850;
    box-shadow: 0 12px 26px rgba(252, 128, 25, 0.22);
}

.action-button.secondary {
    color: var(--ink);
    background: #fff3e6;
    box-shadow: none;
}

.actions.is-complete {
    grid-template-columns: 1fr;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
    text-align: center;
}

.detail-panel a {
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
}

.empty-state {
    display: grid;
    min-height: 360px;
    place-content: center;
    padding: 24px;
    text-align: center;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 18px;
    z-index: 30;
    transform: translateX(-50%) translateY(80px);
    max-width: min(420px, calc(100vw - 28px));
    border-radius: 8px;
    padding: 12px 14px;
    color: #fff;
    background: #111827;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: 0.22s ease;
}

.toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.login-panel {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    overflow: hidden;
    background:
        linear-gradient(115deg, rgba(255, 255, 255, 0.94) 0 36%, rgba(255, 247, 237, 0.9) 36% 62%, rgba(252, 128, 25, 0.88) 62% 100%),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.25) 0 28px, rgba(255,255,255,0) 28px 56px);
}

.login-panel::before,
.login-panel::after {
    content: "";
    position: absolute;
    left: -12%;
    right: -12%;
    height: 86px;
    background: repeating-linear-gradient(90deg, rgba(31, 41, 51, 0.08) 0 42px, transparent 42px 84px);
    transform: rotate(-7deg);
    animation: roadMove 10s linear infinite;
}

.login-panel::before {
    top: 16%;
}

.login-panel::after {
    bottom: 12%;
    animation-duration: 14s;
    opacity: 0.45;
}

.login-panel.is-hidden {
    display: none;
}

.login-card {
    position: relative;
    width: min(430px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 80px rgba(105, 48, 0, 0.22);
    animation: loginPop 0.58s cubic-bezier(.2,.9,.2,1.15) both;
}

.login-card::after {
    content: "Fast. Fresh. Delivered.";
    position: absolute;
    right: 18px;
    top: 18px;
    color: rgba(252, 128, 25, 0.16);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-brand-mark {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #ffb25b);
    box-shadow: 0 14px 34px rgba(252, 128, 25, 0.34);
    font-size: 1.45rem;
    font-weight: 950;
    animation: pulseMark 1.8s ease-in-out infinite;
}

.login-card h2 {
    margin-bottom: 18px;
    font-size: 1.7rem;
}

.login-card label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
}

.login-card input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fffaf5;
    font: inherit;
    outline: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-card input:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(252, 128, 25, 0.13);
}

.login-hint {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

@keyframes loginPop {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes roadMove {
    from {
        background-position-x: 0;
    }
    to {
        background-position-x: 168px;
    }
}

@keyframes pulseMark {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.03);
    }
}

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

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 840px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .task-view.is-active {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        grid-column: 1;
        grid-row: auto;
        min-height: auto;
    }
}

@media (max-width: 520px) {
    .summary-grid,
    .meta-grid,
    .actions {
        grid-template-columns: 1fr;
    }

    .work-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .item-row {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .item-row span {
        grid-column: 2;
    }

    .order-head,
    .detail-head {
        flex-direction: column;
    }

    .topbar {
        align-items: flex-start;
    }

    .driver-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .login-card::after {
        display: none;
    }
}