/* ===========================================================================
   Iron Mountain Delivery — design system
   Single source of truth. Two themes (cream / iron) selected by data-theme.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Palette — cream theme (default for customer + merchant) */
    --bg:               #F5F1E8;
    --bg-soft:          #EDE6D3;
    --surface:          #FFFFFF;
    --surface-dim:      #F5F1E8;
    --border:           #C9C2B0;
    --border-strong:    #2C2A24;

    --ink:              #2C2A24;
    --ink-soft:         #4A4538;
    --ink-mute:         #6B6555;
    --ink-fade:         #888280;

    --accent:           #C2703A;    /* iron-fired orange */
    --accent-soft:      #FBEDD8;
    --accent-deep:      #7A4A1A;

    --good:             #3D5A3D;
    --good-soft:        #E8EDE0;
    --good-deep:        #2A4A2A;

    --warn:             #C9A53D;
    --warn-soft:        #FBEDD8;
    --warn-deep:        #7A6018;

    --danger:           #B23A2E;
    --danger-soft:      #F7DCD8;
    --danger-deep:      #6B1F18;

    /* Typography */
    --font-serif:       'Fraunces', Georgia, 'Times New Roman', serif;
    --font-sans:        'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono:        'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* Spacing scale */
    --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
    --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
    --s-12: 48px; --s-16: 64px;

    /* Radius */
    --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;

    /* Type sizing */
    --t-xs: 11px;  --t-sm: 12px;  --t-md: 13px;  --t-base: 14px;
    --t-lg: 16px;  --t-xl: 18px;  --t-2xl: 22px; --t-3xl: 26px;
    --t-4xl: 32px; --t-5xl: 44px; --t-display: 56px;

    /* Letter spacing for eyebrow labels */
    --eyebrow-spacing: 0.15em;
}

/* Iron theme — dark, for driver and dispatch */
[data-theme="iron"] {
    --bg:               #1C2229;
    --bg-soft:          #181D24;
    --surface:          #2A3441;
    --surface-dim:      #232A33;
    --border:           #3A4250;
    --border-strong:    #5A6470;

    --ink:              #E8E4D8;
    --ink-soft:         #B8B4A8;
    --ink-mute:         #888280;
    --ink-fade:         #5A6470;

    --accent:           #E08A4A;
    --accent-soft:      #3A2D1F;
    --accent-deep:      #FAC775;

    --good:             #5DCAA5;
    --good-soft:        #1A3A2C;
    --good-deep:        #9FE1CB;

    --warn:             #FAC775;
    --warn-soft:        #3A2D1F;
    --warn-deep:        #FAC775;

    --danger:           #E0796D;
    --danger-soft:      #3A1F1B;
    --danger-deep:      #F09595;
}

/* ===========================================================================
   Reset
   =========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--t-base);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--ink); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }

/* ===========================================================================
   Layout primitives
   =========================================================================== */
.shell {
    max-width: 420px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
    position: relative;
}
.shell--wide { max-width: 1280px; }

/* Eyebrow label */
.eyebrow {
    font-size: var(--t-xs);
    color: var(--ink-mute);
    letter-spacing: var(--eyebrow-spacing);
    text-transform: uppercase;
    margin-bottom: var(--s-2);
}

/* Typography */
.display {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: var(--t-5xl);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0;
}
.serif-title {
    font-family: var(--font-serif);
    font-weight: 400;
    line-height: 1.2;
    color: var(--ink);
    margin: 0;
}
.serif-title--xl { font-size: var(--t-4xl); }
.serif-title--lg { font-size: var(--t-3xl); }
.serif-title--md { font-size: var(--t-2xl); }
.serif-title--sm { font-size: var(--t-xl); }

.muted { color: var(--ink-mute); }

/* ===========================================================================
   Progress dots (step indicator)
   =========================================================================== */
.steps {
    display: flex; gap: var(--s-1);
    margin-bottom: var(--s-6);
}
.steps__seg {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
}
.steps__seg--done { background: var(--ink); }
.steps__seg--current { background: var(--accent); }

/* ===========================================================================
   Buttons
   =========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-5);
    border-radius: var(--r-md);
    font-size: var(--t-base);
    font-weight: 500;
    text-decoration: none;
    border: 0.5px solid transparent;
    transition: transform 80ms ease, opacity 80ms ease;
    line-height: 1.2;
    white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}
.btn--primary:hover { color: var(--bg); opacity: 0.92; }
.btn--accent {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
}
.btn--ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--ink);
}
.btn--ghost:hover { background: var(--bg-soft); }
.btn--dashed {
    background: transparent;
    color: var(--accent);
    border: 0.5px dashed var(--accent);
}
.btn--good {
    background: var(--good);
    color: #FFFFFF;
    border-color: var(--good);
}
.btn--good:hover { color: #FFFFFF; }
.btn--block { width: 100%; }
.btn--lg { padding: var(--s-4) var(--s-6); font-size: var(--t-lg); }
.btn--xl {
    padding: var(--s-5) var(--s-6); font-size: var(--t-lg);
    border-radius: var(--r-pill);
}
.btn--icon {
    width: 36px; height: 36px; padding: 0;
    border-radius: 50%;
}

/* ===========================================================================
   Forms
   =========================================================================== */
.field { margin-bottom: var(--s-4); }
.field__label {
    display: block;
    font-size: var(--t-xs);
    color: var(--ink-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--s-2);
}
.field__hint {
    font-size: var(--t-xs);
    color: var(--ink-mute);
    margin-top: var(--s-2);
    line-height: 1.5;
}
.input, .select, .textarea {
    width: 100%;
    padding: var(--s-4) var(--s-4);
    border: 0.5px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--t-base);
    border-radius: var(--r-md);
    outline: none;
    transition: border-color 120ms ease;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--ink);
}
.input--lg { font-size: var(--t-lg); padding: var(--s-4) var(--s-5); }
.input--money {
    padding-left: 32px;
    font-family: var(--font-serif);
    font-size: var(--t-xl);
    font-weight: 500;
}
.input-group { position: relative; }
.input-group__prefix {
    position: absolute;
    left: var(--s-4); top: 50%; transform: translateY(-50%);
    font-family: var(--font-serif);
    font-size: var(--t-xl);
    color: var(--ink-mute);
    pointer-events: none;
}
.textarea { resize: vertical; min-height: 80px; }

/* Pills (filter buttons, category chips) */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s-1);
    background: transparent;
    color: var(--ink);
    border: 0.5px solid var(--border);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-pill);
    font-size: var(--t-sm);
    cursor: pointer;
    white-space: nowrap;
}
.pill--active {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

/* ===========================================================================
   Cards
   =========================================================================== */
.card {
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-4) var(--s-5);
}
.card--soft {
    background: var(--bg-soft);
    border: none;
}
.card--accent {
    border-color: var(--accent);
    border-left-width: 3px;
    border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

/* ===========================================================================
   Stat grid
   =========================================================================== */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-5);
    padding: var(--s-5);
    background: var(--bg-soft);
    border-top: 0.5px solid var(--border);
    border-bottom: 0.5px solid var(--border);
    text-align: center;
}
.stats__item__num {
    font-family: var(--font-serif);
    font-size: var(--t-2xl);
    font-weight: 500;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 4px;
}
.stats__item__num--accent { color: var(--accent); }
.stats__item__label { font-size: var(--t-sm); color: var(--ink-mute); }
.stats--4 { grid-template-columns: repeat(4, 1fr); }

/* ===========================================================================
   Badges
   =========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--t-xs);
    padding: 3px 8px;
    border-radius: var(--r-xs);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
}
.badge--good { background: var(--good-soft); color: var(--good-deep); }
.badge--accent { background: var(--accent-soft); color: var(--accent-deep); }
.badge--warn { background: var(--warn-soft); color: var(--warn-deep); }
.badge--danger { background: var(--danger-soft); color: var(--danger-deep); }
.badge--neutral { background: var(--bg-soft); color: var(--ink); }

/* ===========================================================================
   Sections (page rhythm)
   =========================================================================== */
.section {
    padding: var(--s-10) var(--s-6);
    border-bottom: 0.5px solid var(--border);
}
.section--lg { padding-top: var(--s-12); padding-bottom: var(--s-12); }
.section__head {
    text-align: center;
    margin-bottom: var(--s-6);
}

/* Stack utility */
.stack > * + * { margin-top: var(--s-3); }
.stack--lg > * + * { margin-top: var(--s-4); }
.stack--xl > * + * { margin-top: var(--s-6); }

.row { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }

/* ===========================================================================
   Inline alerts
   =========================================================================== */
.notice {
    display: flex;
    gap: var(--s-3);
    padding: var(--s-4);
    border-radius: var(--r-md);
    align-items: flex-start;
    font-size: var(--t-md);
    line-height: 1.5;
    border: 0.5px solid var(--border);
}
.notice__icon { flex-shrink: 0; margin-top: 1px; }
.notice--good { background: var(--good-soft); border-color: var(--good); color: var(--good-deep); }
.notice--accent { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }
.notice--warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-deep); }
.notice--danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-deep); }

/* ===========================================================================
   App bar — fixed top, with profile dropdown
   =========================================================================== */
.appbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    padding: var(--s-2) var(--s-4);
    min-height: 52px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
}
[data-theme="iron"] .appbar {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
}
.appbar__brand {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    text-decoration: none;
    color: var(--ink);
    flex: 1;
    min-width: 0;
}
.appbar__brand:hover { color: var(--ink); }
.appbar__mark {
    width: 26px; height: 26px;
    flex-shrink: 0;
}
.appbar__name {
    display: flex;
    flex-direction: column;
    line-height: 1;
    min-width: 0;
}
.appbar__name__primary {
    font-family: var(--font-serif);
    font-size: var(--t-base);
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.appbar__name__secondary {
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Profile button + menu */
.appbar__profile {
    position: relative;
    flex-shrink: 0;
}
.appbar__profile-btn {
    background: transparent;
    border: 0.5px solid var(--border);
    border-radius: var(--r-pill);
    padding: 4px 10px 4px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--ink);
    transition: border-color 120ms ease, background 120ms ease;
    min-height: 36px;
}
.appbar__profile-btn:hover {
    border-color: var(--ink);
    background: var(--bg-soft);
}
.appbar__avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}
.appbar__avatar i { font-size: 16px; }
.appbar__avatar--merchant { background: var(--good); }
.appbar__avatar--driver { background: var(--ink); color: var(--accent); }
.appbar__avatar--anon { background: var(--bg-soft); color: var(--ink-mute); border: 0.5px solid var(--border); }
.appbar__profile-label {
    font-size: var(--t-sm);
    font-weight: 500;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appbar__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: 0 10px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
    min-width: 260px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
    z-index: 101;
}
[data-theme="iron"] .appbar__menu {
    box-shadow: 0 10px 32px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
}
.appbar__menu--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.appbar__menu__header {
    padding: var(--s-3) var(--s-3) var(--s-3);
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 4px;
}
.appbar__menu__name {
    font-family: var(--font-serif);
    font-size: var(--t-lg);
    font-weight: 500;
    color: var(--ink);
    line-height: 1.2;
}
.appbar__menu__sub {
    font-size: var(--t-xs);
    color: var(--ink-mute);
    margin-top: 2px;
}
.appbar__menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    color: var(--ink);
    text-decoration: none;
    font-size: var(--t-md);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.appbar__menu__item:hover {
    background: var(--bg-soft);
    color: var(--ink);
}
.appbar__menu__item i { font-size: 17px; color: var(--ink-mute); flex-shrink: 0; }
.appbar__menu__item:hover i { color: var(--accent); }
.appbar__menu__item--danger { color: var(--danger); }
.appbar__menu__item--danger i { color: var(--danger); }
.appbar__menu__item--danger:hover { background: var(--danger-soft); color: var(--danger-deep); }
.appbar__menu__divider {
    border: none;
    border-top: 0.5px solid var(--border);
    margin: 6px 0;
}
.appbar__menu__section-label {
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 6px 12px 2px;
}

/* App footer — pinned to bottom of viewport, always visible during scroll. */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    text-align: center;
    padding: 10px var(--s-4);
    font-size: var(--t-xs);
    color: var(--ink-mute);
    border-top: 0.5px solid var(--border);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.04em;
    min-height: 34px;
}
[data-theme="iron"] .app-footer {
    background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.app-footer__heart {
    color: #C2703A;
    font-size: 14px;
    line-height: 1;
}
[data-theme="iron"] .app-footer__heart { color: #E08A4A; }

/* Frame layout: appbar fixed top, footer fixed bottom, main scrolls in between.
   The 52px top / 34px bottom paddings match the bar heights exactly so content
   never sits under either bar. */
body {
    padding-top: 52px;
    padding-bottom: 34px;
    min-height: 100vh;
    /* Subtle paper texture so the cream theme doesn't feel like dead screen */
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(194,112,58,0.025) 0%, transparent 60%),
        radial-gradient(circle at 80% 70%, rgba(61,90,61,0.02) 0%, transparent 60%);
    background-attachment: fixed;
}
[data-theme="iron"] body {
    background-image:
        radial-gradient(circle at 20% 20%, rgba(224,138,74,0.04) 0%, transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(93,202,165,0.025) 0%, transparent 55%);
}
main.shell {
    /* Centered, with rhythm at the bottom so the last card breathes above the footer */
    padding-bottom: var(--s-8);
}

/* ===========================================================================
   Pagebar — the per-page context strip under the global app bar
   (back button + page title + optional action). Used to be .brand.
   =========================================================================== */
.brand {
    padding: var(--s-3) var(--s-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border-bottom: 0.5px solid var(--border);
    gap: var(--s-2);
    margin-bottom: 0;
}
.brand__action {
    background: transparent;
    border: none;
    padding: var(--s-2);
    color: var(--ink-mute);
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 120ms ease, color 120ms ease;
    text-decoration: none;
}
.brand__action:hover {
    background: var(--bg-soft);
    color: var(--ink);
}
.brand__title {
    flex: 1;
    text-align: center;
    font-family: var(--font-serif);
    font-size: var(--t-base);
    font-weight: 500;
    color: var(--ink);
    line-height: 1.2;
}
.brand__place {
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 3px;
    text-align: center;
}
.brand__logo {
    /* Hide redundant logo blocks inside pagebars - the appbar already shows it */
    display: none;
}

/* ===========================================================================
   Profile dropdown — version chip
   =========================================================================== */
.appbar__menu__version {
    padding: 10px 12px 6px;
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
    border-top: 0.5px solid var(--border);
    margin-top: 4px;
}
.appbar__menu__version__num {
    font-family: var(--font-mono);
    color: var(--ink-mute);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

/* ===========================================================================
   Map (driver stop detail) - Leaflet container styling
   =========================================================================== */
.map-card {
    overflow: hidden;
    padding: 0;
    border-radius: var(--r-lg);
    border: 0.5px solid var(--border);
    background: var(--surface);
}
.map-card__header {
    padding: var(--s-3) var(--s-4);
    display: flex;
    align-items: center;
    gap: var(--s-3);
    border-bottom: 0.5px solid var(--border);
}
.map-card__header__icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
[data-theme="iron"] .map-card__header__icon {
    background: var(--accent-soft);
    color: var(--accent);
}
.map-card__header__title {
    font-family: var(--font-serif);
    font-size: var(--t-base);
    font-weight: 500;
}
.map-card__header__sub {
    font-size: var(--t-xs);
    color: var(--ink-mute);
    margin-top: 2px;
}
.map-canvas {
    height: 280px;
    width: 100%;
}
.map-card__footer {
    padding: var(--s-3) var(--s-4);
    display: flex;
    gap: var(--s-2);
    border-top: 0.5px solid var(--border);
    background: var(--bg-soft);
    font-size: var(--t-sm);
}
[data-theme="iron"] .map-card__footer { background: var(--surface-dim); }
.map-card__stat {
    flex: 1;
    text-align: center;
}
.map-card__stat__num {
    font-family: var(--font-serif);
    font-size: var(--t-lg);
    font-weight: 500;
    color: var(--ink);
    line-height: 1;
}
.map-card__stat__label {
    font-size: 10px;
    color: var(--ink-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Leaflet override - match our aesthetic */
.leaflet-container {
    background: var(--bg-soft);
    font-family: var(--font-sans);
}
.im-marker {
    width: 32px !important;
    height: 32px !important;
    margin-left: -16px !important;
    margin-top: -32px !important;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
}
.im-marker > * {
    transform: rotate(45deg);
    color: white;
    font-size: 16px;
}
.im-marker--pickup { background: var(--good); }
.im-marker--dropoff { background: var(--accent); }

/* ===========================================================================
   Warm-up touches — texture, hand-drawn lines, character
   =========================================================================== */

/* Sticker-style "Made in Montana" badge style for use in profile cards etc. */
.stamp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 0.5px dashed var(--accent);
    border-radius: var(--r-pill);
    font-size: 10px;
    color: var(--accent-deep);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: var(--accent-soft);
}

/* Section dividers with optional ornament */
.ornament-divider {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin: var(--s-6) 0;
    color: var(--ink-mute);
    font-size: var(--t-sm);
    font-style: italic;
}
.ornament-divider::before, .ornament-divider::after {
    content: "";
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

/* Cards get a barely-there shadow for depth, not flat-screen sterility */
.card {
    box-shadow: 0 1px 2px rgba(44, 42, 36, 0.04), 0 0 0 0.5px rgba(201, 194, 176, 0.4);
}
[data-theme="iron"] .card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(90, 100, 112, 0.3);
}

/* Buttons get a subtle inner highlight for warmth */
.btn--primary {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 2px rgba(0,0,0,0.1);
}
.btn--accent {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 1px 2px rgba(122, 74, 26, 0.2);
}

/* ===========================================================================
   Hero (landing)
   =========================================================================== */
.hero {
    padding: var(--s-12) var(--s-6) var(--s-8);
}
.hero__title { font-family: var(--font-serif); font-size: var(--t-display); font-weight: 400; line-height: 1; letter-spacing: -0.02em; margin: 0 0 var(--s-5); color: var(--ink); }
.hero__sub { font-size: var(--t-lg); line-height: 1.55; color: var(--ink-soft); margin: 0 0 var(--s-6); }

@media (max-width: 480px) {
    .hero { padding: var(--s-8) var(--s-5) var(--s-6); }
    .hero__title { font-size: 40px; }
}

/* ===========================================================================
   Tabler icons baseline (loaded via CDN in base.html)
   =========================================================================== */
.ti { vertical-align: -2px; }

/* ===========================================================================
   Driver / dispatch dark theme tweaks
   =========================================================================== */
[data-theme="iron"] .card {
    background: var(--surface);
    border-color: var(--border);
}
[data-theme="iron"] .input,
[data-theme="iron"] .select,
[data-theme="iron"] .textarea {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}
[data-theme="iron"] .btn--ghost { color: var(--ink); border-color: var(--border-strong); }

/* ===========================================================================
   Scanner overlay
   =========================================================================== */
.scanner-stage {
    background: #1C2229;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
}
.scanner-stage__corners {
    position: absolute;
    inset: 16%;
    pointer-events: none;
}
.scanner-stage__corner {
    position: absolute;
    width: 30px; height: 30px;
    border: 3px solid #F5F1E8;
    opacity: 0.9;
}
.scanner-stage__corner--tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.scanner-stage__corner--tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.scanner-stage__corner--bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.scanner-stage__corner--br { bottom: 0; right: 0; border-left: none; border-top: none; }
.scanner-stage__line {
    position: absolute;
    left: 16%; right: 16%;
    top: 50%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: scanLine 2s ease-in-out infinite;
}
@keyframes scanLine {
    0%, 100% { transform: translateY(-40%); opacity: 0.6; }
    50% { transform: translateY(40%); opacity: 1; }
}
.scanner-stage__status {
    position: absolute;
    bottom: var(--s-4);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 34, 41, 0.85);
    color: #F5F1E8;
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-pill);
    font-size: var(--t-md);
    display: flex; align-items: center; gap: var(--s-2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.scanner-stage__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--good);
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===========================================================================
   Tap-target sizing safeguards for mobile
   =========================================================================== */
.btn, .input, .select, .pill {
    min-height: 44px;
}
.btn--icon { min-height: 36px; }

/* ===========================================================================
   Address check & landing-specific
   =========================================================================== */
.hero__illustration {
    width: 100%;
    margin-top: var(--s-4);
}
.hero__photo {
    width: 100%;
    height: auto;
    border-radius: var(--r-lg);
    box-shadow: 0 4px 16px rgba(44, 42, 36, 0.12), 0 1px 3px rgba(44, 42, 36, 0.08);
    display: block;
}

/* Store list */
.store-card {
    display: flex;
    gap: var(--s-3);
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: var(--s-3) var(--s-4);
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--r-lg);
    transition: border-color 120ms ease;
}
.store-card:hover { border-color: var(--ink); color: var(--ink); }
.store-card__icon {
    width: 48px; height: 48px;
    background: var(--bg-soft);
    border-radius: var(--r-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}
.store-card__icon i { font-size: 24px; }
.store-card__name {
    font-family: var(--font-serif);
    font-size: var(--t-lg);
    font-weight: 500;
}
.store-card__meta {
    font-size: var(--t-sm);
    color: var(--ink-mute);
    margin-top: 2px;
}
.store-card__chevron { color: var(--ink-fade); margin-left: auto; }

/* ===========================================================================
   Catalog layouts
   =========================================================================== */
.menu-section { margin-bottom: var(--s-6); }
.menu-section__head {
    font-family: var(--font-serif);
    font-size: var(--t-md);
    color: var(--ink-mute);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    margin: var(--s-6) 0 var(--s-3);
}
.menu-item {
    display: flex;
    align-items: flex-start;
    gap: var(--s-3);
    padding: var(--s-3) 0;
    border-bottom: 0.5px solid var(--border);
}
.menu-item:last-child { border-bottom: none; }
.menu-item__body { flex: 1; min-width: 0; }
.menu-item__name {
    font-family: var(--font-serif);
    font-size: var(--t-lg);
    font-weight: 500;
    margin: 0 0 4px;
}
.menu-item__desc {
    font-size: var(--t-sm);
    color: var(--ink-mute);
    line-height: 1.4;
    margin: 0 0 var(--s-1);
}
.menu-item__price {
    font-size: var(--t-base);
    color: var(--ink);
    font-weight: 500;
}
.menu-item__action { flex-shrink: 0; }

/* Quantity stepper */
.qty {
    display: flex; align-items: center; gap: var(--s-3);
    background: var(--surface);
    border: 0.5px solid var(--good);
    border-radius: var(--r-pill);
    padding: var(--s-1);
}
.qty__btn {
    background: transparent;
    border: none;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--good);
}
.qty__btn--inc { background: var(--good); color: var(--surface); }
.qty__count { font-size: var(--t-base); font-weight: 500; min-width: 14px; text-align: center; }

/* Sticky cart footer */
.cart-bar {
    background: var(--ink);
    color: var(--bg);
    border-radius: var(--r-lg);
    padding: var(--s-3) var(--s-4);
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; text-decoration: none;
    margin: var(--s-6);
}
.cart-bar__eyebrow {
    font-size: var(--t-xs);
    opacity: 0.75;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.cart-bar__action {
    font-family: var(--font-serif);
    font-size: var(--t-lg);
    font-weight: 500;
    margin-top: 3px;
}
.cart-bar__total {
    font-family: var(--font-serif);
    font-size: var(--t-xl);
    font-weight: 500;
}

/* ===========================================================================
   Dispatch (desktop)
   =========================================================================== */
.dispatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: var(--border);
}
.dispatch-col {
    background: var(--bg);
    padding: var(--s-4);
}
.dispatch-card {
    background: var(--surface);
    border-radius: var(--r-md);
    padding: var(--s-3);
    margin-bottom: var(--s-2);
    font-size: var(--t-md);
}
.dispatch-card--urgent {
    border-left: 3px solid var(--danger);
    background: var(--surface);
}
.dispatch-card--accent {
    border-left: 3px solid var(--accent);
}

/* Make the dispatcher use the iron theme */
.dispatch-shell { background: var(--bg); min-height: 100vh; }

/* ===========================================================================
   Misc utilities
   =========================================================================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.divider {
    height: 0.5px;
    background: var(--border);
    border: none;
    margin: var(--s-4) 0;
}

/* Mono for IDs */
.mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ===========================================================================
   Profile pages
   =========================================================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-2) 0;
}
.profile-header__avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 500;
    flex-shrink: 0;
}

/* Tab bar */
.profile-tabs {
    display: flex;
    gap: 2px;
    padding: 0 var(--s-6);
    overflow-x: auto;
    border-bottom: 0.5px solid var(--border);
    background: var(--bg);
    margin-bottom: var(--s-5);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs__tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--s-3) var(--s-3);
    text-decoration: none;
    color: var(--ink-mute);
    font-size: var(--t-md);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 120ms ease, border-color 120ms ease;
    margin-bottom: -0.5px;
}
.profile-tabs__tab:hover { color: var(--ink); }
.profile-tabs__tab i { font-size: 17px; }
.profile-tabs__tab--active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}
.profile-tabs__tab--active i { color: var(--accent); }

/* Card grid on overview */
.profile-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-3);
}
@media (min-width: 540px) {
    .profile-card-grid { grid-template-columns: 1fr 1fr; }
}
.profile-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, transform 120ms ease;
    min-height: 130px;
}
.profile-card:hover {
    border-color: var(--ink);
    color: inherit;
}
.profile-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--t-xs);
    color: var(--ink-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--s-3);
}
.profile-card__head i { font-size: 16px; color: var(--accent); }
.profile-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: var(--t-md);
    line-height: 1.4;
}
.profile-card__row { color: var(--ink); }
.profile-card__row.muted { color: var(--ink-mute); font-size: var(--t-sm); }
.profile-card__edit {
    margin-top: var(--s-3);
    padding-top: var(--s-3);
    border-top: 0.5px solid var(--border);
    font-size: var(--t-sm);
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.profile-card__edit i { font-size: 14px; }

/* Radio pill rows for preferences */
.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}
.radio-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.radio-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.radio-pill span {
    display: inline-block;
    padding: 8px 14px;
    border: 0.5px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--t-sm);
    font-weight: 500;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}
.radio-pill:hover span { border-color: var(--ink-mute); }
.radio-pill input[type="radio"]:checked + span {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}
.radio-pill input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Payment card icons */
.payment-card-icon {
    width: 54px;
    height: 34px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 11px;
    color: white;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.payment-card-icon i { font-size: 18px; }
.payment-card-icon--visa { background: #1A1F71; }
.payment-card-icon--mastercard { background: #EB001B; position: relative; }
.payment-card-icon--mastercard::after {
    content: '';
    position: absolute;
    right: 8px;
    width: 14px; height: 14px;
    background: #F79E1B;
    border-radius: 50%;
    opacity: 0.85;
    mix-blend-mode: multiply;
}
.payment-card-icon--amex { background: #2E77BB; }
.payment-card-icon--discover { background: #FF6000; }
.payment-card-icon--unknown { background: var(--ink-mute); }
