*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ink: #0f0e0c;
    --ink-soft: #1a1916;
    --paper: #f5f2ed;
    --paper-soft: #fafaf8;
    --accent: #e8430a;
    --accent-hover: #c93608;
    --green: #5de8a0;
    --accent2: #1a3a2a;
    --muted: #7a7670;
    --muted-light: #9a968f;
    --border: rgba(15, 14, 12, 0.12);
    --border-dark: rgba(245, 242, 237, 0.1);
    --ff-head: 'Syne', sans-serif;
    --ff-body: 'DM Sans', sans-serif;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--ff-body);
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* NAV */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: rgba(15, 14, 12, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-dark);
    color: var(--paper);
}

.nav-logo {
    font-family: var(--ff-head);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo span { color: var(--accent); }

.nav-dot {
    width: 8px; height: 8px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.nav-right { display: flex; align-items: center; gap: 1rem; }

.nav-link {
    font-size: 0.85rem;
    color: rgba(245, 242, 237, 0.8);
    transition: color 0.2s;
}

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

/* APP LAYOUT */
.app {
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    display: grid;
    grid-template-columns: 420px 1fr;
}

/* SIDE PANEL */
.side-panel {
    background: var(--paper);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.side-panel::-webkit-scrollbar { width: 6px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.track-input-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 1.25rem;
}

.track-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.track-input-row {
    display: flex;
    gap: 0.5rem;
}

.track-input-row input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    font-family: var(--ff-body);
    font-size: 0.95rem;
    background: var(--paper);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}

.track-input-row input:focus { border-color: var(--accent); }

.btn-primary {
    padding: 0.7rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0.55rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.2s;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.track-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.chip {
    padding: 0.3rem 0.7rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 1rem;
    font-size: 0.75rem;
    color: var(--ink);
    font-family: inherit;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

/* STATUS LINE */
.status-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.conn-dot {
    width: 8px; height: 8px;
    background: #c83c25;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.conn-dot.connected {
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

/* ORDER DETAILS */
.order-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-header {
    background: var(--ink);
    color: var(--paper);
    border-radius: 0.9rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-id {
    font-family: var(--ff-head);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}

.detail-status {
    font-size: 0.72rem;
    color: var(--green);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.eta-box {
    text-align: right;
}

.eta-val {
    font-family: var(--ff-head);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.03em;
}

.eta-label {
    font-size: 0.7rem;
    color: rgba(245, 242, 237, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
}

/* PROGRESS */
.progress-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--paper);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--green));
    width: 0%;
    transition: width 0.6s ease;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ROUTE BLOCK */
.route-block {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
}

.route-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.route-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    flex-shrink: 0;
}

.pickup-dot { background: var(--ink); }
.drop-dot { background: var(--accent); border-color: var(--accent); }

.route-line {
    width: 2px;
    height: 22px;
    background: var(--border);
    margin-left: 4px;
    margin-block: 0.25rem;
}

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

.route-addr {
    font-size: 0.88rem;
    color: var(--ink);
    font-weight: 500;
    margin-top: 0.1rem;
}

/* CARDS */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
}

.section-heading {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

/* RIDER */
.rider-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.rider-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.rider-info { flex: 1; }

.rider-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}

.rider-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.rider-call {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--green);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.rider-call:hover { transform: scale(1.08); }

/* PACKAGE */
.pkg-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.pkg-label {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pkg-val {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
    margin-top: 0.15rem;
}

/* PARTIES */
.party-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem;
    align-items: center;
}

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

.party-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    margin-top: 0.2rem;
}

.party-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.party-sep {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 700;
}

/* EMPTY STATE */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: var(--ff-head);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 280px;
    line-height: 1.6;
}

.empty-foot {
    margin-top: 1.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* MAP */
.map-wrap {
    position: relative;
    background: #ddd;
}

#map {
    width: 100%;
    height: 100%;
}

.mobile-panel-toggle {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 500;
    width: 42px;
    height: 42px;
    background: var(--ink);
    border: none;
    border-radius: 50%;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.mobile-panel-toggle span {
    width: 18px;
    height: 2px;
    background: var(--paper);
}

/* Leaflet custom markers */
.leaflet-rider-icon {
    background: var(--accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(232, 67, 10, 0.5);
    animation: pulseRider 1.5s ease-in-out infinite;
}

@keyframes pulseRider {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: linear-gradient(135deg, #0f0e0c 0%, #1a1916 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.login-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(232, 67, 10, 0.15), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(93, 232, 160, 0.1), transparent 40%);
    pointer-events: none;
}

.login-card {
    position: relative;
    background: rgba(245, 242, 237, 0.03);
    border: 1px solid rgba(245, 242, 237, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1.25rem;
    padding: 2.5rem;
    max-width: 460px;
    width: 100%;
    color: var(--paper);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    margin: 60px 0 20px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--ff-head);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
    margin-bottom: 1.75rem;
}

.login-brand-text span { color: var(--accent); }

.login-title {
    font-family: var(--ff-head);
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.login-sub {
    font-size: 0.9rem;
    color: rgba(245, 242, 237, 0.55);
    line-height: 1.65;
    margin-bottom: 1.75rem;
}

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

.login-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(245, 242, 237, 0.5);
    margin-bottom: 0.4rem;
}

.login-field input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(245, 242, 237, 0.15);
    border-radius: 0.6rem;
    font-family: var(--ff-body);
    font-size: 0.95rem;
    background: rgba(245, 242, 237, 0.05);
    color: var(--paper);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.login-field input::placeholder {
    color: rgba(245, 242, 237, 0.3);
}

.login-field input:focus {
    border-color: var(--accent);
    background: rgba(245, 242, 237, 0.08);
}

.login-submit {
    margin-top: 0.4rem;
    padding: 0.95rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0.6rem;
    font-family: var(--ff-body);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.login-submit:hover { background: var(--accent-hover); transform: translateY(-1px); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-error {
    padding: 0.75rem 1rem;
    background: rgba(232, 67, 10, 0.15);
    border: 1px solid rgba(232, 67, 10, 0.3);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: #ff8a5c;
}

.login-help {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(245, 242, 237, 0.1);
}

.login-help-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 0.5rem;
}

.login-help p {
    font-size: 0.82rem;
    color: rgba(245, 242, 237, 0.55);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.login-help strong, .login-help code {
    color: var(--paper);
    font-family: monospace;
    background: rgba(245, 242, 237, 0.08);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.78rem;
}

.login-demo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: rgba(245, 242, 237, 0.55);
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(245, 242, 237, 0.08);
    font-size: 0.82rem;
    color: rgba(245, 242, 237, 0.5);
    text-align: center;
}

.login-footer a {
    color: var(--accent);
    font-weight: 500;
}

.nav-logout {
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

/* TABLET (up to 1024px) */
@media (max-width: 1024px) {
    .app {
        grid-template-columns: 360px 1fr;
    }
}

/* MOBILE (up to 768px) */
@media (max-width: 768px) {
    nav { padding: 0 1rem; }
    .nav-link { font-size: 0.8rem; }

    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .side-panel {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 400;
        transform: translateY(calc(100% - 120px));
        transition: transform 0.3s ease;
        border-right: none;
        border-top: 1px solid var(--border);
        border-radius: 1.25rem 1.25rem 0 0;
        padding: 1rem;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
    }

    .side-panel.expanded {
        transform: translateY(0);
    }

    .side-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: -0.25rem auto 0.75rem;
    }

    .map-wrap { position: relative; }

    .mobile-panel-toggle {
        display: flex;
        top: 76px;
    }

    .track-input-wrap { padding: 1rem; }
}

@media (max-width: 480px) {
    .detail-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .eta-box { text-align: left; }
    .pkg-row { grid-template-columns: 1fr 1fr; }
}
