:root {
    --brand: #201d9c;
    --brand-2: #4f46e5;
    --accent: #f5811f;
    --ink: #1e2233;
    --muted: #6b7280;
    --line: #e8e8f0;
    --bg: #f4f5fb;
    --ok: #16a34a;
    --danger: #dc2626;
    --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

ion-icon { pointer-events: none; }

/* ============ AUTH ============ */
.auth-body {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 50% -10%, #3a37c9 0%, var(--brand) 45%, #17155f 100%);
}

.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 18px 18px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    padding: 30px 26px 28px;
    box-shadow: 0 10px 30px rgba(15, 14, 71, 0.14);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.auth-logo { height: 42px; width: auto; }

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f2f3fb;
    color: var(--brand);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
}
.auth-badge ion-icon { font-size: 15px; }

.auth-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 6px;
    text-align: center;
}

.auth-sub {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0 0 22px;
    text-align: center;
}

.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--muted);
}

.auth-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    padding: 0 14px;
    transition: border-color .15s, box-shadow .15s;
    background: #fbfbfe;
}
.auth-input-wrap:focus-within {
    border-color: var(--brand-2);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    background: #fff;
}
.auth-input-wrap ion-icon { font-size: 20px; color: var(--muted); }

.auth-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 15px 0;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: .3px;
    color: var(--ink);
}

.auth-code-wrap { margin-bottom: 4px; }
.auth-code-input {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: #fbfbfe;
    text-align: center;
    font-size: 30px;
    font-weight: 500;
    letter-spacing: 12px;
    padding: 16px 0;
    outline: 0;
    color: var(--ink);
}
.auth-code-input:focus {
    border-color: var(--brand-2);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
    background: #fff;
}

.auth-btn {
    width: 100%;
    margin-top: 20px;
    border: 0;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform .08s, background .15s, opacity .15s;
}
.auth-btn ion-icon { font-size: 19px; }
.auth-btn:not(:disabled):active { transform: scale(.98); }
.auth-btn:hover:not(:disabled) { background: #1a1785; }
.auth-btn:disabled { opacity: .65; cursor: default; }
.auth-btn.is-loading { opacity: .8; }

.auth-alert {
    margin-top: 14px;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
    padding: 0 0 14px;
    cursor: pointer;
}
.auth-back ion-icon { font-size: 17px; }

.auth-resend {
    width: 100%;
    margin-top: 14px;
    background: none;
    border: 0;
    color: var(--brand-2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px;
}
.auth-resend:disabled { color: var(--muted); cursor: default; }

.auth-foot {
    color: rgba(255,255,255,.7);
    font-size: 12.5px;
    margin-top: 20px;
    text-align: center;
}

/* ============ APP / DASHBOARD ============ */
.app-body { background: var(--bg); min-height: 100vh; }

.app-header {
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
    padding: env(safe-area-inset-top) 0 0;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
}
.app-header-logo { height: 30px; width: auto; }

.app-logout-form { margin: 0; }
.app-logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 0;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.app-logout-btn:active { background: rgba(255,255,255,.28); }

.app-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 18px 40px;
}

.app-hero {
    background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 22px 22px 24px;
    margin-bottom: 16px;
    box-shadow: 0 12px 30px rgba(32, 29, 156, .25);
}
.app-hello { font-size: 14px; opacity: .85; }
.app-name { font-size: 24px; font-weight: 800; margin: 2px 0 0; }
.app-title-chip {
    display: inline-block;
    margin-top: 12px;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
}

.app-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 6px 18px;
    margin-bottom: 20px;
    border: 1px solid var(--line);
}
.app-card-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
}
.app-card-row + .app-card-row { border-top: 1px solid var(--line); }
.app-card-ico {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #eef0ff;
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    flex: none;
}
.app-card-ico--ok { background: #e7f7ee; color: var(--ok); }
.app-card-label { display: block; font-size: 12.5px; color: var(--muted); }
.app-card-value { font-size: 15.5px; font-weight: 700; }

.app-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px;
}
.app-section-title ion-icon { color: var(--brand-2); font-size: 20px; }

.app-empty {
    background: #fff;
    border: 1px dashed #cfd2e6;
    border-radius: var(--radius);
    padding: 34px 24px;
    text-align: center;
    color: var(--muted);
}
.app-empty ion-icon { font-size: 44px; color: var(--brand-2); opacity: .55; }
.app-empty p { margin: 12px 0 4px; color: var(--ink); }
.app-empty span { font-size: 13.5px; }

/* ============ JOB CARD ============ */
.job-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}
.job-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}
.job-no { font-size: 15px; font-weight: 700; }
.job-status {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 999px;
}
.job-status--assigned  { background: #eef0ff; color: var(--brand); }
.job-status--en_route  { background: #fff3e6; color: #c2610c; }
.job-status--picked_up { background: #fff3e6; color: #c2610c; }
.job-status--on_the_way{ background: #e6f0ff; color: #1d4ed8; }
.job-status--delivered { background: #e7f7ee; color: var(--ok); }

.job-leg {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}
.job-leg + .job-leg { border-top: 1px dashed var(--line); }
.job-leg-ico {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.job-leg-ico--pick { background: #eef0ff; color: var(--brand); }
.job-leg-ico--drop { background: #e7f7ee; color: var(--ok); }
.job-leg-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.job-leg-name { font-size: 15px; font-weight: 600; margin: 1px 0 2px; }
.job-leg-addr { font-size: 13.5px; color: #444a5e; line-height: 1.45; }
.job-leg-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.job-leg-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 600; text-decoration: none;
    color: var(--brand-2); background: #f2f3fb; padding: 6px 11px; border-radius: 9px;
    border: 0; cursor: pointer; font-family: inherit;
}
.job-leg-link:active { background: #e6e7f4; }
.job-leg-link ion-icon { font-size: 15px; }
.job-note {
    background: #fffbeb; border: 1px solid #fde68a; color: #92610a;
    border-radius: 10px; padding: 9px 11px; font-size: 13px; margin-top: 10px; line-height: 1.45;
}

.job-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.job-fee-label { font-size: 12px; color: var(--muted); }
.job-fee-value { font-size: 17px; font-weight: 800; color: var(--brand); }
.job-action-form { margin: 0; flex: 1; max-width: 60%; }
.job-btn {
    width: 100%; border: 0; border-radius: 12px; padding: 13px;
    background: var(--brand); color: #fff; font-size: 14.5px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
}
.job-btn ion-icon { font-size: 18px; }
.job-btn:active { transform: scale(.98); }
.job-btn--done { background: var(--ok); }

/* ============ EARNINGS ============ */
.earn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.earn-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.earn-card--main { grid-column: 1 / -1; background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; border: none; box-shadow: 0 12px 30px rgba(32,29,156,.25); }
.earn-label { font-size: 12.5px; color: var(--muted); }
.earn-card--main .earn-label { color: rgba(255,255,255,.85); }
.earn-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.earn-card--main .earn-value { font-size: 30px; }

.pay-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-amt { font-size: 15px; font-weight: 700; color: var(--ok); }
.pay-date { font-size: 12.5px; color: var(--muted); }

/* ============ BOTTOM NAV ============ */
.app-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line);
    display: flex; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    max-width: 640px; margin: 0 auto;
}
.app-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
}
.app-nav-item ion-icon { font-size: 22px; }
.app-nav-item.is-active { color: var(--brand); }
.has-nav { padding-bottom: 84px; }
