/* ==========================================================
   TruckRoutes — design tokens
   ========================================================== */
:root {
    /* E&E Transportation brand palette */
    --primary: #073C5E;
    --primary-600: #052a42;
    --primary-50: #E7F1FD;
    --primary-100: #d3e5f8;
    --brand-red: #EB2429;
    --brand-mist: #E7F1FD;
    --amber: #d97706;
    --amber-50: #fffbeb;
    --green: #15803d;
    --green-50: #f0fdf4;
    --red: #EB2429;
    --red-50: #fde8e8;

    --ink: #073C5E;
    --ink-2: #1e4b6b;
    --muted: #5b6b7c;
    --line: #d7dee8;
    --line-2: #EEF1F6;
    --bg: #EEF1F6;
    --card: #ffffff;

    --sidebar-bg: #073C5E;
    --sidebar-ink: #b7c9d8;
    --sidebar-w: 260px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(7, 60, 94, .06);
    --shadow: 0 1px 3px rgba(7, 60, 94, .07), 0 4px 12px rgba(7, 60, 94, .05);
    --shadow-lg: 0 20px 50px rgba(7, 60, 94, .18);
    --ring: 0 0 0 4px rgba(7, 60, 94, .16);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--primary); }
small { font-size: .78rem; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.text-right { text-align: right; }
.req { color: var(--red); }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-inline { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }

/* ==========================================================
   Brand
   ========================================================== */
.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -.01em;
}
.brand-dark { color: var(--ink); }
.brand-img {
    display: block;
    width: auto;
    height: 42px;
    object-fit: contain;
}
.brand-img-full { height: 52px; max-width: 168px; }
.brand-img-mark { height: 36px; width: auto; }
.brand-img-sm { height: 34px; width: auto; }
.brand-img-lg { height: 72px; max-width: 220px; }
.mobile-bar .brand, .driver-bar .brand { gap: .55rem; }
.mobile-bar .brand span, .driver-bar .brand span { font-size: .98rem; color: var(--ink); }
.sidebar .brand { padding: .15rem .35rem; }
.sidebar .brand-img-full { height: 58px; max-width: 180px; }
.sidebar .brand-img-mark { display: none; height: 40px; }
.brand-logo {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-red), #c81e22);
    color: #fff;
    box-shadow: 0 4px 12px rgba(235, 36, 41, .28);
}
.brand-logo .icon { width: 20px; height: 20px; }

/* ==========================================================
   Admin layout (sidebar)
   ========================================================== */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.25rem 1rem;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    z-index: 40;
    transition: transform .25s ease;
}
.sidebar .brand { padding: .25rem .5rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.sidebar-label {
    padding: 0 .75rem .5rem;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #475569;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-ink);
    text-decoration: none;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.sidebar-link:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.sidebar-link.active { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 3px 0 0 var(--brand-red); }
.sidebar-link.disabled { opacity: .5; cursor: not-allowed; }
.pill {
    margin-left: auto;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sidebar-user-info strong { color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: .78rem; }
.sidebar-user .icon-btn { color: var(--sidebar-ink); }
.sidebar-user .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.sidebar-overlay { display: none; }

.app { margin-left: var(--sidebar-w); min-height: 100vh; }
.mobile-bar { display: none; }

.content { max-width: 1180px; margin: 0 auto; padding: 2rem 2rem 4rem; }
.content-narrow { max-width: 760px; padding-top: 1.5rem; }
.content-wide { max-width: 1600px; }

/* ==========================================================
   Driver layout (top bar)
   ========================================================== */
.driver-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.25rem;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.driver-bar-user { display: flex; align-items: center; gap: .65rem; font-weight: 500; }

/* ==========================================================
   Page header
   ========================================================== */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-subtitle { margin-top: .35rem; color: var(--muted); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .75rem;
    color: var(--muted);
    font-weight: 500;
    font-size: .9rem;
    text-decoration: none;
}
.back-link:hover { color: var(--primary); }
.back-link .icon { width: 16px; height: 16px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 2rem 0 .75rem; }

/* ==========================================================
   Cards
   ========================================================== */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.card-header .muted { margin-top: .2rem; font-size: .88rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary-100); }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .88rem; }
.stat-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    flex-shrink: 0;
}
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon-blue { background: var(--primary-50); color: var(--primary); }
.stat-icon-amber { background: var(--amber-50); color: #d97706; }
.stat-icon-green { background: var(--green-50); color: var(--green); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.step.done { background: var(--line-2); }
.step.done .step-body strong { color: var(--muted); text-decoration: line-through; }
.step-num {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
}
.step.done .step-num { background: var(--green); color: #fff; }
.step-num .icon { width: 16px; height: 16px; }
.step-body { flex: 1; min-width: 0; }
.step-body p { color: var(--muted); font-size: .86rem; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .75rem 0; border-top: 1px solid var(--line-2); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.list-main .muted { font-size: .85rem; }

.quick-actions { display: grid; gap: .75rem; }
.quick-action {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.quick-action:hover { border-color: var(--primary); background: var(--primary-50); }
.quick-action > span:last-child { display: flex; flex-direction: column; }
.quick-action small { color: var(--muted); font-size: .85rem; }

/* Empty states */
.empty { text-align: center; padding: 3.5rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.empty p { color: var(--muted); max-width: 420px; }
.empty .btn { margin-top: .75rem; }
.empty-sm { padding: 1.5rem; }
.empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary-50);
    color: var(--primary);
    margin-bottom: .25rem;
}
.empty-icon .icon { width: 26px; height: 26px; }
.empty-icon-amber { background: var(--amber-50); color: #d97706; }
.empty-icon-green { background: var(--green-50); color: var(--green); }
.empty-sm .empty-icon { width: 44px; height: 44px; border-radius: 12px; }
.empty-sm .empty-icon .icon { width: 20px; height: 20px; }

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .65; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(7, 60, 94, .28); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: #fff; color: var(--ink-2); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--line-2); border-color: #cbd5e1; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-ghost-danger { background: transparent; color: var(--red); }
.btn-ghost-danger:hover { background: var(--red-50); }
.btn-ghost-success { background: transparent; color: var(--green); }
.btn-ghost-success:hover { background: var(--green-50); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; }
.btn-accent { background: var(--brand-red); color: #fff; box-shadow: 0 1px 2px rgba(235, 36, 41, .28); }
.btn-accent:hover { background: #c91e22; }

.btn-sm { padding: .45rem .75rem; font-size: .84rem; border-radius: 8px; }
.btn-lg { padding: .85rem 1.25rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
.icon-btn-danger:hover { background: var(--red-50); color: var(--red); }
.icon-btn .icon { width: 18px; height: 18px; }

/* ==========================================================
   Forms
   ========================================================== */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-section { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; align-items: start; }
/* Keep the left intro in column 1; every other block (photo, fields, etc.) stays in the wide column. */
.form-section > :not(.form-section-intro) { grid-column: 2; min-width: 0; }
.form-section-intro p { margin-top: .35rem; color: var(--muted); font-size: .88rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.25rem; align-content: start; }
.field-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field-label { font-weight: 500; font-size: .88rem; color: var(--ink-2); }
.field-hint { font-size: .8rem; color: var(--muted); }

.field input, .field select, .field textarea,
.search input {
    width: 100%;
    padding: .65rem .85rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: .95rem;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 96px; }
.field select {
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
    background-size: 16px;
}
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}
.field input::placeholder, .field textarea::placeholder, .search input::placeholder { color: #94a3b8; }

.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.input-icon input { padding-left: 2.6rem; }

.input-group { display: flex; align-items: stretch; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.input-addon {
    display: inline-flex;
    align-items: center;
    padding: 0 .85rem;
    border: 1px solid #cbd5e1;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: var(--line-2);
    color: var(--muted);
    font: inherit;
    font-size: .85rem;
    font-weight: 500;
}
button.input-addon { cursor: pointer; }
button.input-addon:hover { color: var(--ink); }
.input-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: flex;
    flex-direction: column;
    padding: .75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-weight: 600;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.segmented small { font-weight: 400; color: var(--muted); }
.segmented input:checked + span { border-color: var(--primary); background: var(--primary-50); box-shadow: var(--ring); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

.form-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    padding: 1rem 0;
    background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.error-list { margin: .25rem 0 0; padding-left: 1.1rem; }

/* ==========================================================
   Alerts & toasts
   ========================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: .92rem;
}
.alert .icon { margin-top: 1px; }
.alert-error { background: var(--red-50); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--green-50); color: #166534; border: 1px solid #bbf7d0; }

.toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: min(420px, calc(100vw - 2rem));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .92rem;
    animation: toast-in .3s ease;
    transition: opacity .3s, transform .3s;
}
.toast > span { flex: 1; }
.toast-success > .icon { color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-error > .icon { color: var(--red); }
.toast-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.toast-close .icon { width: 16px; height: 16px; }
.toast-hide { opacity: 0; transform: translateX(20px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ==========================================================
   Modal
   ========================================================== */
.modal {
    width: min(420px, calc(100vw - 2rem));
    padding: 1.75rem;
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.modal::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: scale(.96); } }
.modal-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--red-50);
    color: var(--red);
}
.modal-primary .modal-icon { background: var(--primary-50); color: var(--primary); }
.modal-icon .icon { width: 24px; height: 24px; }
.modal h3 { font-size: 1.15rem; }
.modal p { margin-top: .5rem; color: var(--muted); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1.5rem; }

/* ==========================================================
   Toolbar, tabs, search
   ========================================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}
.toolbar-plain { padding: 0; border: 0; margin-bottom: 1rem; }

.tabs { display: inline-flex; padding: 4px; gap: 2px; background: var(--line-2); border-radius: 10px; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .85rem;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
    font-size: .88rem;
    text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-count { padding: 0 .45rem; border-radius: 999px; background: var(--line); font-size: .75rem; }
.tab.active .tab-count { background: var(--primary-50); color: var(--primary); }

.search { position: relative; flex: 0 1 340px; }
.search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #94a3b8; width: 16px; height: 16px; }
.search input { padding-left: 2.3rem; }

/* ==========================================================
   Tables
   ========================================================== */
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: .7rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
}
.table td { padding: .9rem 1.25rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: .25rem; }
.row-muted td { opacity: .65; }
.row-muted td.actions { opacity: 1; }

.person { display: flex; align-items: center; gap: .8rem; }
.person > div, .stack { display: flex; flex-direction: column; }
.person .muted { font-size: .85rem; }
.inline-form { display: inline; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #c7d2fe);
    color: #3730a3;
    font-weight: 700;
    font-size: .82rem;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.35rem; }
.avatar-photo { background: var(--line-2); padding: 0; }
.avatar-photo img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.sidebar .avatar { background: linear-gradient(135deg, var(--primary-600), var(--brand-red)); color: #fff; }
.sidebar .avatar-photo { background: transparent; }
.avatar-editor {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}
.avatar-editor-fields { flex: 1; min-width: 0; }
.avatar-editor .field { margin: 0; }
.check-line {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-top: .65rem;
    font-size: .88rem;
    color: var(--muted);
    cursor: pointer;
}
.check-line input { width: 1rem; height: 1rem; accent-color: var(--primary); flex-shrink: 0; }
.check-line-card {
    align-items: flex-start;
    gap: .75rem;
    margin-top: .25rem;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--primary-50);
    color: var(--ink);
}
.check-line-card span { display: flex; flex-direction: column; gap: .2rem; }
.check-line-card strong { font-size: .95rem; }
.check-line-card small { font-size: .82rem; line-height: 1.35; }

/* Badges & status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--green-50); color: var(--green); }
.badge-muted { background: var(--line-2); color: var(--muted); }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: var(--red-50); color: var(--red); }

.status { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 500; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-active { color: var(--green); }
.status-active::before { background: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.status-inactive { color: var(--muted); }
.status-inactive::before { background: #94a3b8; }

/* ==========================================================
   Routes
   ========================================================== */
.route-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.route-card { display: flex; flex-direction: column; gap: 1.1rem; padding: 1.25rem; transition: box-shadow .15s, border-color .15s; }
.route-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }
.route-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.route-card-head h3 { padding-top: .35rem; }
.route-card-actions { display: flex; margin: -.25rem -.4rem 0 0; }

.route-line { display: flex; flex-direction: column; gap: .9rem; position: relative; }
.route-point { display: flex; align-items: flex-start; gap: .85rem; position: relative; }
.route-point > div { display: flex; flex-direction: column; }
.route-point small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.route-point:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 16px;
    bottom: -14px;
    border-left: 2px dashed #cbd5e1;
}
.route-point-stops { align-items: center; font-size: .86rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: .3rem; flex-shrink: 0; position: relative; z-index: 1; }
.route-point-stops .dot { margin-top: 0; }
.dot-start { background: #fff; border: 3px solid var(--primary); }
.dot-stop { background: var(--amber); border: 3px solid #fde68a; }
.dot-end { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }

.route-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line-2); color: var(--ink-2); font-size: .86rem; font-weight: 500; }
.route-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.route-meta .icon { width: 15px; height: 15px; color: var(--muted); }

.route-preview { padding: 1rem 1.25rem; background: linear-gradient(135deg, #f8fbff, #eef4ff); border-color: var(--primary-100); }
.route-preview-label { display: inline-flex; align-items: center; gap: .4rem; color: var(--primary); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.route-preview-label .icon { width: 15px; height: 15px; }
.route-preview-path { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .6rem; }
.route-preview-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

/* Google Maps */
.map-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--line-2); }
.map-frame-lg { margin-top: 1rem; aspect-ratio: 21 / 9; min-height: 260px; }
.map-frame[hidden] { display: none; }
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-empty { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 0; padding: .9rem 1rem; border: 1px dashed #bfd3f5; border-radius: var(--radius); color: var(--muted); font-size: .88rem; background: rgba(255, 255, 255, .6); }
.map-empty[hidden] { display: none; }
.map-empty .icon { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.place-link { display: inline-flex; align-items: center; gap: .3rem; color: var(--primary); font-size: .85rem; text-decoration: none; }
.place-link:hover { text-decoration: underline; }
.place-link .icon { width: 14px; height: 14px; flex-shrink: 0; }
.trip-map-link { align-self: flex-start; width: fit-content; }
.trip-map-link[hidden] { display: none; }
.calc-btn { margin-top: .75rem; }
.calc-status { margin: .5rem 0 0; font-size: .82rem; }
.calc-status:empty { display: none; }
.calc-status.is-success { color: var(--green); }
.calc-status.is-error { color: var(--red); }
.calc-hint { margin-top: .6rem; font-size: .8rem; color: var(--muted); }
.calc-hint code { font-size: .75rem; background: var(--line-2); padding: .05rem .3rem; border-radius: 4px; }
@media (max-width: 640px) {
    .map-frame-lg { aspect-ratio: 4 / 3; min-height: 0; }
    .map-frame { aspect-ratio: 4 / 3; }
}
.chip { padding: .3rem .7rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .86rem; font-weight: 500; }
.chip-start { border-color: var(--primary); color: var(--primary); }
.chip-end { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-stop { border-color: #fcd34d; background: var(--amber-50); color: #92400e; }
.chip-empty { border-style: dashed; color: #94a3b8; background: transparent; }
.chip-arrow { color: #94a3b8; }

.stops { display: flex; flex-direction: column; gap: .75rem; margin-bottom: .9rem; }
.stops-empty { margin-bottom: .9rem; font-size: .9rem; }
.stop-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fcfcfd;
    animation: toast-in .2s ease;
}
.stop-num {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--amber-50);
    color: #b45309;
    border: 1px solid #fde68a;
    font-weight: 700;
    font-size: .82rem;
}
.stop-fields { display: grid; grid-template-columns: 1.3fr 1fr; gap: .75rem; }
.stop-actions { display: flex; flex-direction: column; gap: .15rem; }
.stop-actions .icon-btn { width: 32px; height: 32px; }

/* ==========================================================
   Weekly schedule
   ========================================================== */
.week-nav { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.week-nav-buttons { display: flex; align-items: center; gap: .4rem; }
.week-nav-title { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.week-nav-title h2 { font-size: 1.15rem; white-space: nowrap; }
.icon-btn-bordered { border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
.badge-primary { background: var(--primary-50); color: var(--primary); }

.view-toggle { display: inline-flex; padding: 4px; gap: 2px; background: #e9eef5; border-radius: 10px; }
.view-toggle button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
}
.view-toggle button .icon { width: 16px; height: 16px; }
.view-toggle button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.schedule-views[data-view="week"] .day-view,
.schedule-views[data-view="day"] .week-view { display: none; }

.legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.25rem;
    margin-bottom: .75rem;
    color: var(--muted);
    font-size: .82rem;
}
.legend > span { display: inline-flex; align-items: center; gap: .45rem; }
.legend-count { margin-left: auto; font-weight: 600; color: var(--ink-2); }
.legend-swatch { display: inline-grid; place-items: center; width: 22px; height: 14px; border-radius: 4px; }
.legend-depart { background: var(--primary-50); border: 1px solid var(--primary-100); border-left: 3px solid var(--primary); }
.legend-transit { background: repeating-linear-gradient(135deg, #e0e7ff 0 6px, #eef2ff 6px 12px); border: 1px solid #c7d2fe; }
.legend-add { border: 1px dashed #94a3b8; color: #94a3b8; }
.legend-add .icon { width: 10px; height: 10px; }

.schedule-wrap { overflow-x: auto; }
.schedule { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.schedule th, .schedule td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line-2); }
.schedule tr > :last-child { border-right: 0; }
.schedule tbody tr:last-child > * { border-bottom: 0; }
.schedule thead th {
    position: relative;
    padding: .75rem .6rem;
    background: #f8fafc;
    text-align: left;
    font-weight: 500;
}
.schedule-driver-col { width: 170px; }
.schedule thead .schedule-driver-col {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    vertical-align: bottom;
}
.schedule tbody th {
    position: sticky;
    left: 0;
    z-index: 2;
    padding: .75rem 1rem;
    background: #fff;
    text-align: left;
    font-weight: 400;
    vertical-align: top;
}
.schedule thead .schedule-driver-col { position: sticky; left: 0; z-index: 3; }
.schedule-day { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.schedule-date { display: block; font-weight: 600; color: var(--ink); }
.schedule-sub { display: block; margin-top: .15rem; font-size: .7rem; color: var(--muted); font-weight: 500; }
.row-inactive th, .row-inactive td { background: #fafbfc !important; }
.row-inactive .person { opacity: .6; }
.schedule thead th.is-today { background: var(--primary-50); box-shadow: inset 0 3px 0 var(--primary); }
.schedule thead th.is-today .schedule-day, .schedule thead th.is-today .schedule-date { color: var(--primary); }
.schedule td { padding: .45rem; vertical-align: top; background: #fff; }
.schedule td.is-today { background: #f8fbff; }

.cell { display: flex; flex-direction: column; gap: .35rem; min-height: 72px; height: 100%; }
.trip-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .05rem;
    padding: .45rem .55rem;
    border: 1px solid var(--primary-100);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    background: var(--primary-50);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: box-shadow .15s, transform .1s;
}
.trip-chip:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.trip-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.trip-chip-time { font-size: .72rem; font-weight: 700; color: var(--primary); }
.plus-day { margin-left: .15rem; font-size: .62rem; color: #b45309; }
.trip-chip-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.3;
}
.trip-chip-path { font-size: .72rem; color: var(--muted); }

/* Multi-day trips: segments touch the cell edges so they read as one continuous bar. */
.trip-chip.continues {
    margin-right: calc(-.45rem - 1px);
    border-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.trip-chip.continues { padding-right: 1.2rem; }
.trip-chip.continues::after {
    content: "";
    position: absolute;
    right: 6px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
    transform: translateY(-50%) rotate(45deg);
    opacity: .6;
}
.trip-chip.is-continued {
    margin-left: calc(-.45rem - 1px);
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: repeating-linear-gradient(135deg, #e0e7ff 0 8px, #eef2ff 8px 16px);
    border-color: #c7d2fe;
    padding-left: .75rem;
}
.trip-chip.is-continued .trip-chip-time { color: #4338ca; }
.trip-chip.is-continued .trip-chip-path { color: #4338ca; font-weight: 600; }
.trip-chip:hover { z-index: 1; }

.cell-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    flex: 1;
    min-height: 30px;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    border: 1px dashed transparent;
    border-radius: 8px;
    background: transparent;
    color: transparent;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.schedule tr:hover .cell-add { border-color: #cbd5e1; color: #94a3b8; }
.cell-add:hover, .cell-add:focus-visible { border-color: var(--primary) !important; color: var(--primary) !important; background: var(--primary-50); outline: none; }
.cell-add .icon { width: 14px; height: 14px; }
.cell-add span { display: none; }
.cell-add:hover span, .cell-add:focus-visible span { display: inline; }

@media (hover: none) {
    .cell-add { border-color: #e2e8f0; color: #94a3b8; }
}

/* Day view */
.day-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(52px, 1fr));
    gap: .4rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.day-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    padding: .55rem .25rem .5rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.day-tab:hover { border-color: #cbd5e1; }
.day-tab-name { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.day-tab-num { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
.day-tab-dots { display: flex; gap: 3px; height: 6px; }
.day-tab-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.day-tab.is-today .day-tab-name { color: var(--primary); }
.day-tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(7, 60, 94, .28); }
.day-tab[aria-selected="true"] .day-tab-name { color: #dbeafe; }
.day-tab[aria-selected="true"] .day-tab-dots i { background: #fff; }

.day-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .9rem; }
.day-panel-head h3 { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; }
.day-panel-stats { display: flex; gap: 1rem; }
.status-road { color: var(--primary); }
.status-road::before { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }

.driver-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .9rem; align-items: start; }
.driver-day {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.driver-day.is-busy { border-left: 4px solid var(--primary); }
.driver-day-head { display: flex; align-items: center; gap: .65rem; }
.driver-day-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-trips-list { display: flex; flex-direction: column; gap: .5rem; }
.day-trip {
    display: flex;
    align-items: center;
    gap: .85rem;
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid var(--primary-100);
    border-radius: 12px;
    background: var(--primary-50);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.day-trip:hover { box-shadow: var(--shadow); }
.day-trip.is-continued { background: repeating-linear-gradient(135deg, #e0e7ff 0 8px, #eef2ff 8px 16px); border-color: #c7d2fe; }
.day-trip-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: .35rem .4rem;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}
.day-trip-time strong { font-size: .9rem; color: var(--primary); white-space: nowrap; }
.day-trip-time strong .icon { color: #4338ca; }
.day-trip-time small { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.day-trip-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.day-trip-body .muted { font-size: .84rem; }
.day-trip-eta { display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.day-trip-eta .icon { width: 13px; height: 13px; color: var(--muted); }
.day-trip-eta.is-later { color: #4338ca; }
.day-trip-edit { color: var(--muted); }
.day-trip-edit .icon { width: 16px; height: 16px; }
.driver-day-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    width: 100%;
    padding: .65rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.driver-day-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.driver-day-add .icon { width: 16px; height: 16px; }

.trip-eta { display: flex; align-items: flex-start; gap: .5rem; padding: .65rem .8rem; border-radius: 10px; background: var(--line-2); color: var(--ink-2); font-size: .86rem; }
.trip-eta .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--muted); }
.trip-eta.is-multiday { background: #eef2ff; color: #3730a3; }
.trip-eta.is-multiday .icon { color: #4338ca; }

.modal-form { width: min(520px, calc(100vw - 2rem)); text-align: left; }
.modal-form .form { gap: 1rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.2rem; }
.modal-form .alert { margin-bottom: 0; }
.modal-actions-split { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: .5rem; }
.modal-actions-right { display: flex; gap: .6rem; margin-left: auto; }
.empty-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

/* ==========================================================
   Driver view
   ========================================================== */
.today-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #1e3a8a, var(--primary));
    color: #fff;
    box-shadow: 0 12px 30px rgba(7, 60, 94, .22);
}
.today-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.today-label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
.today-count { padding: .2rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .15); font-size: .82rem; font-weight: 600; }
.empty-on-dark p { color: #dbeafe; }

.trips, .day-trips { display: flex; flex-direction: column; gap: .6rem; }
.trip { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.trip summary {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .9rem 1rem;
    cursor: pointer;
    list-style: none;
}
.trip summary::-webkit-details-marker { display: none; }
.trip-time {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem;
    border-radius: 8px;
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
}
.trip-time .icon { width: 14px; height: 14px; }
.trip-time-transit { background: #eef2ff; color: #4338ca; }
.trip-continued { background: repeating-linear-gradient(135deg, #f5f7ff 0 10px, #fff 10px 20px) !important; }
.trip-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.trip-title .muted { font-size: .84rem; }
.trip-chevron { color: var(--muted); transition: transform .2s; }
.trip[open] .trip-chevron { transform: rotate(180deg); }
.trip-body { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; border-top: 1px solid var(--line-2); padding-top: 1rem; }
.note { display: flex; gap: .6rem; padding: .8rem; border-radius: 10px; background: var(--amber-50); color: #78350f; font-size: .9rem; }
.note .icon { color: #d97706; margin-top: 2px; }
.note p + p { margin-top: .4rem; }

.week { display: flex; flex-direction: column; gap: .6rem; }
.day { display: grid; grid-template-columns: 56px 1fr; gap: 1rem; align-items: start; padding: .85rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.day-today { border-color: var(--primary); box-shadow: var(--ring); }
.day-past { opacity: .6; }
.day-date { display: flex; flex-direction: column; align-items: center; padding: .35rem 0; border-radius: 10px; background: var(--line-2); }
.day-today .day-date { background: var(--primary); color: #fff; }
.day-name { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.day-num { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.day-off { display: block; padding: .6rem 0; font-size: .9rem; }
.day .trip { border-color: var(--line-2); background: #fcfcfd; }

/* ==========================================================
   Login
   ========================================================== */
.auth-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; background: #fff; }
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    color: #b7c9d8;
    background:
        radial-gradient(circle at 18% 18%, rgba(235, 36, 41, .28), transparent 42%),
        radial-gradient(circle at 82% 88%, rgba(231, 241, 253, .18), transparent 40%),
        var(--sidebar-bg);
    overflow: hidden;
}
.auth-hero-body { max-width: 460px; }
.auth-hero h1 { color: #fff; font-size: 2.4rem; letter-spacing: -.03em; }
.auth-hero-body > p { margin-top: 1rem; font-size: 1.05rem; }
.auth-features { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-direction: column; gap: .9rem; }
.auth-features li { display: flex; align-items: center; gap: .75rem; }
.auth-features .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; }
.auth-hero-foot { font-size: .85rem; color: #64748b; }

.auth-panel { display: grid; place-items: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.6rem; font-weight: 700; }
.auth-card > .muted { margin: .4rem 0 1.75rem; }
.auth-mobile-brand { display: none; margin-bottom: 2rem; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1024px) {
    .form-section { grid-template-columns: 1fr; gap: 1.25rem; }
    .form-section > :not(.form-section-intro) { grid-column: 1; }
}

/* Tablets in landscape: icon-only sidebar leaves room for the weekly grid. */
@media (min-width: 901px) and (max-width: 1240px) {
    :root { --sidebar-w: 76px; }
    .sidebar { padding: 1.25rem .75rem; align-items: center; }
    .sidebar .brand { padding: 0; justify-content: center; }
    .sidebar .brand-img-full { display: none; }
    .sidebar .brand-img-mark { display: block; }
    .sidebar-label,
    .sidebar-link > span,
    .sidebar-user-info { display: none; }
    .sidebar-nav { width: 100%; align-items: center; }
    .sidebar-link { justify-content: center; width: 48px; height: 44px; padding: 0; }
    .sidebar-link .icon { width: 20px; height: 20px; }
    .sidebar-user { flex-direction: column; padding: .5rem; gap: .5rem; }
    .content { padding: 1.5rem 1.5rem 3rem; }
    .schedule { min-width: 780px; }
    .schedule-driver-col { width: 132px; }
    .schedule tbody th { padding: .75rem .6rem; }
    .schedule tbody th .avatar { display: none; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(15, 23, 42, .45);
    }
    .app { margin-left: 0; }
    .mobile-bar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: .5rem;
        padding: .6rem 1rem;
        background: rgba(255, 255, 255, .92);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--line);
    }
    .content { padding: 1.5rem 1rem 3rem; }

    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-mobile-brand { display: inline-flex; }
}

@media (max-width: 640px) {
    h1 { font-size: 1.45rem; }
    .page-header { align-items: stretch; }
    .page-header > .btn { width: 100%; }
    .page-header-inline { flex-wrap: nowrap; align-items: flex-start; }
    .page-header-inline > .btn { width: auto; flex-shrink: 0; }
    .form-grid, .stop-fields { grid-template-columns: 1fr; }
    .modal-form .form-grid { grid-template-columns: 1fr 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .hide-mobile { display: none; }
    .search { flex-basis: 100%; }
    .tabs { width: 100%; }
    .tab { flex: 1; justify-content: center; }

    .stop-row { grid-template-columns: 1fr; }
    .stop-actions { flex-direction: row; justify-content: flex-end; order: -1; margin-bottom: -.5rem; }
    .stop-num { position: absolute; }
    .stop-row { position: relative; }

    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: .75rem 0; border-bottom: 1px solid var(--line); }
    .table td { padding: .3rem 1.25rem; border: 0; }
    .table td[data-label]:not(:first-child)::before {
        content: attr(data-label);
        display: block;
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .table .actions { text-align: left; padding-top: .6rem; }

    .week-nav-title { order: -1; flex-basis: 100%; }
    .week-nav-buttons { flex: 1; }
    .legend-count { margin-left: 0; }
    .day-tabs { gap: .3rem; grid-template-columns: repeat(7, minmax(44px, 1fr)); }
    .day-tab { padding: .45rem 0; border-radius: 10px; }
    .day-tab-num { font-size: 1.05rem; }
    .driver-days { grid-template-columns: 1fr; }
    .day-panel-head h3 { font-size: 1rem; }

    .modal-form {
        width: 100vw;
        max-width: 100vw;
        max-height: 92vh;
        margin: auto 0 0;
        border-radius: 20px 20px 0 0;
        padding: 1.25rem;
    }
    .modal-actions-split { flex-direction: column-reverse; align-items: stretch; }
    .modal-actions-right { margin-left: 0; }
    .modal-actions-right .btn { flex: 1; }

    .form-footer { flex-direction: column-reverse; }
    .form-footer .btn { width: 100%; }
    .trip summary { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
    .trip-time { justify-self: start; }
    .trip-title { grid-column: 1 / -1; grid-row: 2; }
    .trip-chevron { grid-column: 2; grid-row: 1; }
    .day { grid-template-columns: 1fr; gap: .6rem; }
    .day-date { flex-direction: row; justify-content: flex-start; gap: .4rem; padding: .3rem .7rem; width: fit-content; }
    .day-num { font-size: .95rem; }
}

/* ==========================================================
   Account, trucks, trip status, printing, app install
   ========================================================== */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn-success { background: var(--green); color: #fff; box-shadow: 0 1px 2px rgba(22, 163, 74, .3); }
.btn-success:hover { background: #15803d; }
.status-warning { color: #b45309; }
.status-warning::before { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-50); }
.stat-icon-slate { background: #f1f5f9; color: #334155; }
.segmented-3 { grid-template-columns: repeat(3, 1fr); }
.page-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.inline-form { display: inline; }
.card-span { grid-column: 1 / -1; }

/* Sidebar & driver bar account links */
.sidebar-user-link { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; color: inherit; text-decoration: none; border-radius: 8px; }
.sidebar-user-link:hover .sidebar-user-info span, .sidebar-user-link.active .sidebar-user-info span { color: #fff; }
.driver-bar-account { display: inline-flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; padding: .2rem .5rem .2rem .2rem; border-radius: 999px; }
.driver-bar-account:hover { background: var(--line-2); }

.auth-help { display: flex; align-items: center; gap: .4rem; margin-top: 1.25rem; font-size: .84rem; color: var(--muted); }

/* Account / home: install & phone alerts */
.install-card, .form + .form-section, .form-section + .form-section { margin-top: 1.25rem; }
.push-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }
.alerts-setup {
    margin-bottom: 1.25rem;
    padding: 1.15rem 1.2rem 1.2rem;
    border: 1px solid var(--primary-100);
    background:
        linear-gradient(180deg, var(--primary-50) 0%, #fff 42%);
    box-shadow: var(--shadow);
}
.alerts-setup-needs-action {
    border-color: #f0c36a;
    background:
        linear-gradient(180deg, var(--amber-50) 0%, #fff 48%);
}
.alerts-setup-ready {
    border-color: #b7e0c4;
    background:
        linear-gradient(180deg, var(--green-50) 0%, #fff 48%);
}
.alerts-setup-ready .alerts-setup-body,
.alerts-setup-ready .alerts-setup-install {
    display: none;
}
.alerts-setup.is-installed .alerts-setup-install,
.alerts-setup.is-installed [data-install-hint] {
    display: none !important;
}
.alerts-setup-ready .alerts-setup-icon {
    background: var(--green);
}
.alerts-setup-hero {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.alerts-setup-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}
.alerts-setup-icon .icon { width: 22px; height: 22px; }
.alerts-setup-intro h2 { font-size: 1.15rem; margin-bottom: .25rem; }
.alerts-setup-intro p { color: var(--ink-2); font-size: .92rem; }
.alerts-setup-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}
.alerts-setup-col h3 {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .55rem;
}
.alerts-checklist,
.alerts-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}
.alerts-checklist li {
    display: flex;
    gap: .45rem;
    align-items: flex-start;
    font-size: .9rem;
    color: var(--ink-2);
}
.alerts-checklist .icon {
    width: 16px;
    height: 16px;
    color: var(--green);
    margin-top: 2px;
}
.alerts-steps {
    list-style: decimal;
    padding-left: 1.15rem;
}
.alerts-steps li {
    font-size: .88rem;
    color: var(--ink-2);
    padding-left: .15rem;
}
.alerts-setup-status {
    padding: .85rem 0 .25rem;
    border-top: 1px solid var(--line);
}
.alerts-setup-install {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--line);
}
.alerts-install-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}
.alerts-install-row h3 { font-size: .95rem; margin-bottom: .2rem; }
.setting-warn { color: #9a3412; }
@media (max-width: 720px) {
    .alerts-setup-body { grid-template-columns: 1fr; }
}
.install-body { display: flex; flex-direction: column; gap: .75rem; justify-content: center; }
.install-body [hidden] { display: none; }
.install-steps p { margin: 0 0 .4rem; font-size: .9rem; color: var(--ink-2); }
.install-done, .setting-state { display: flex; align-items: flex-start; gap: .5rem; margin: 0; font-size: .9rem; color: var(--ink-2); }
.install-done { color: var(--green); font-weight: 600; }
.install-done .icon, .setting-state .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.setting-on { color: var(--green); font-weight: 600; }
.setting-state code { font-size: .8rem; background: var(--line-2); padding: .05rem .3rem; border-radius: 4px; }

/* Error pages */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.error-card { max-width: 440px; padding: 2.5rem 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.brand-logo-lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-logo-lg .icon { width: 28px; height: 28px; }
.error-page .brand-img { height: 64px; max-width: 200px; margin: 0 auto 1rem; }
.error-code { font-size: .8rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.error-card h1 { font-size: 1.5rem; }
.error-card .btn { margin-top: .5rem; }

/* Trucks */
.unit-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.unit-icon .icon { width: 20px; height: 20px; }
.unit-icon-truck { background: #fff7ed; color: #ea580c; }
.unit-icon-trailer { background: #f1f5f9; color: #475569; }
.equipment { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.equipment-item { display: flex; align-items: center; gap: .7rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; }
.equipment-item > div { display: flex; flex-direction: column; min-width: 0; }
.equipment-item small { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.equipment-item .muted { font-size: .8rem; }

/* Trip status badges */
.trip-status { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.trip-status .icon { width: 13px; height: 13px; }
.trip-status-scheduled { background: var(--line-2); color: var(--muted); }
.trip-status-in_progress { background: var(--primary-50); color: var(--primary); }
.trip-status-delivered { background: var(--green-50); color: var(--green); }
.trip-status-detail { display: block; margin-top: .2rem; font-size: .78rem; color: var(--muted); }
.trip-status-line { display: flex; flex-direction: column; align-items: flex-start; padding: .6rem .75rem; border-radius: 10px; background: var(--line-2); }
.trip-status-line[hidden] { display: none; }
.trip-status-line .trip-status-detail { margin-top: .3rem; }

/* Status on the schedule grid */
.trip-chip-time { display: inline-flex; align-items: center; gap: .3rem; }
.trip-chip-dot { display: none; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.trip-chip.is-in_progress .trip-chip-dot { display: inline-block; background: var(--primary); animation: pulse 1.8s infinite; }
.trip-chip.is-delivered { background: var(--green-50); border-color: #bbf7d0; border-left-color: var(--green); }
.trip-chip.is-delivered .trip-chip-time { color: var(--green); }
.trip-chip.is-delivered .trip-chip-dot { display: inline-block; background: var(--green); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.legend-dot-progress { background: var(--primary); box-shadow: 0 0 0 3px rgba(7, 60, 94, .2); }
.legend-dot-delivered { background: var(--green); }
.day-trip.is-delivered { border-color: #bbf7d0; }
.day-trip-unit { display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; font-size: .8rem; color: var(--ink-2); }
.day-trip-unit .icon { width: 13px; height: 13px; color: var(--muted); }
.day-trip-status { margin-top: .4rem; }
.live-flash { animation: flash 2s ease-out; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(7, 60, 94, .45); } 50% { box-shadow: 0 0 0 4px rgba(7, 60, 94, 0); } }
@keyframes flash { 0% { box-shadow: 0 0 0 4px rgba(250, 204, 21, .7); } 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); } }

/* Dashboard live list */
.live-dot { display: inline-block; width: 8px; height: 8px; margin: 0 .15rem 0 .1rem; border-radius: 50%; background: var(--green); animation: pulse-green 1.8s infinite; vertical-align: middle; }
@keyframes pulse-green { 0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); } 50% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); } }
.today-summary { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: .9rem; padding: .6rem .8rem; border-radius: 10px; background: var(--line-2); font-size: .85rem; color: var(--muted); }
.today-summary strong { color: var(--ink); }
.list-status { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; text-align: right; flex-shrink: 0; max-width: 45%; }

/* Driver: progress actions */
.trip-progress { display: flex; flex-direction: column; gap: .6rem; }
.trip-progress-note { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .65rem .8rem; border-radius: 10px; background: var(--line-2); font-size: .88rem; color: var(--ink-2); }
.trip-progress-note .icon { width: 17px; height: 17px; flex-shrink: 0; }
.trip-progress-live { background: var(--primary-50); color: var(--primary-600); font-weight: 600; }
.trip-progress-done { background: var(--green-50); color: #15803d; font-weight: 600; }
.trip-action-form { margin: 0; }
.trip-action-form .btn-lg { min-height: 52px; font-size: 1rem; }
.stop-done { display: inline-flex; align-items: center; gap: .3rem; margin-top: .15rem; font-size: .8rem; font-weight: 600; color: var(--green); }
.stop-done .icon { width: 13px; height: 13px; }
.stop-arrive { margin-top: .45rem; }
.route-point.is-done .dot-start, .route-point.is-done .dot-stop, .route-point.is-done .dot-end { background: var(--green); border-color: #bbf7d0; box-shadow: none; }
.trip-undo { display: flex; justify-content: flex-end; margin-top: -.25rem; }
.trip-undo .btn { color: var(--muted); }
.trip.trip-is-delivered summary { opacity: .8; }
.trip summary .trip-status { flex-shrink: 0; }

/* Driver: week navigation */
.driver-week-nav { display: flex; align-items: center; gap: .75rem; margin: 2rem 0 .75rem; }
.driver-week-title { flex: 1; text-align: center; }
.driver-week-title h2 { font-size: 1.15rem; }
.driver-week-title .muted { font-size: .85rem; }
.back-this-week { margin-bottom: .75rem; }
.next-week-hint { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; padding: .75rem 1rem; border: 1px solid var(--primary-100); border-radius: var(--radius); background: var(--primary-50); color: var(--primary-600); text-decoration: none; font-size: .9rem; }
.next-week-hint span { flex: 1; }
.next-week-hint .icon { width: 18px; height: 18px; }

.week-confirmed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: 0 0 .85rem;
    padding: .7rem .95rem;
    border-radius: 999px;
    background: var(--green-50);
    border: 1px solid #86efac;
}
.week-confirmed-status {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--green);
    font-size: .88rem;
    font-weight: 600;
}
.week-confirmed-status .icon { width: 16px; height: 16px; flex-shrink: 0; }
.week-confirmed-undo {
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
    padding: .35rem .55rem;
    border-radius: 8px;
}
.week-confirmed-undo:hover { background: rgba(7, 60, 94, .08); }

.week-has-float { padding-bottom: 7.5rem; }
.week-float {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}
.week-float-card {
    pointer-events: auto;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .95rem 1rem .95rem 1.15rem;
    border-radius: 20px;
    background: linear-gradient(145deg, #0a4a73 0%, #073C5E 55%, #052a42 100%);
    color: #fff;
    box-shadow:
        0 12px 40px rgba(7, 60, 94, .35),
        0 4px 12px rgba(7, 60, 94, .2),
        inset 0 1px 0 rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .1);
}
.week-float-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .12rem;
}
.week-float-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #7eb6e0;
}
.week-float-label .icon { width: 13px; height: 13px; }
.week-float-text strong {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}
.week-float-text > span:last-child {
    font-size: .8rem;
    color: rgba(255, 255, 255, .72);
    line-height: 1.3;
}
.week-float-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 48px;
    padding: .75rem 1.15rem;
    border: 0;
    border-radius: 14px;
    background: #16a34a;
    color: #fff;
    font: inherit;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(22, 163, 74, .4);
    transition: background .15s, transform .1s, box-shadow .15s;
}
.week-float-btn:hover { background: #15803d; box-shadow: 0 8px 20px rgba(22, 163, 74, .5); }
.week-float-btn:active { transform: scale(.97); }
.week-float-btn .icon { width: 18px; height: 18px; }

@media (max-width: 480px) {
    .week-float-card {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
        border-radius: 18px;
        padding: 1rem;
    }
    .week-float-btn { width: 100%; }
}

.badge-confirm { display: inline-flex; margin-top: .25rem; font-size: .68rem; }
.legend-confirm { color: var(--primary-600); }
.offline-banner { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; padding: .7rem 1rem; border-radius: var(--radius); background: #fef3c7; color: #92400e; font-size: .88rem; font-weight: 500; }
.offline-banner[hidden] { display: none; }
.offline-banner .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* View toggle used with links (print page) */
.view-toggle a { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 600; text-decoration: none; }
.view-toggle a .icon { width: 16px; height: 16px; }
.view-toggle a[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* Print pages */
.print-page { background: #e9eef5; padding: 0 0 3rem; }
.print-toolbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line); }
.print-toolbar > .btn-primary { margin-left: auto; }
.print-toolbar-group { display: flex; align-items: center; gap: .5rem; }
.print-toolbar select { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .88rem; background: #fff; }
.sheet { width: min(816px, calc(100% - 2rem)); margin: 1.5rem auto; padding: 2.25rem; background: #fff; color: #0f172a; box-shadow: var(--shadow); border-radius: 6px; font-size: 13px; }
.sheet-landscape { width: min(1100px, calc(100% - 2rem)); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 2px solid #0f172a; }
.sheet-brand { display: inline-flex; align-items: center; gap: .45rem; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #073C5E; }
.sheet-brand .icon { width: 14px; height: 14px; }
.sheet-brand .brand-img { height: 22px; }
.sheet-head h1 { margin: .25rem 0; font-size: 22px; }
.sheet-head p { margin: 0; color: #475569; }
.sheet-meta { text-align: right; color: #475569; line-height: 1.6; }
.sheet-meta strong { font-size: 18px; color: #0f172a; }
.sheet-empty { color: #64748b; padding: 2rem 0; text-align: center; }
.sheet-trip { display: grid; grid-template-columns: 110px 1fr 150px; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid #e2e8f0; break-inside: avoid; }
.sheet-trip-when { display: flex; flex-direction: column; }
.sheet-trip-when strong { font-size: 14px; }
.sheet-trip-when span { font-size: 16px; font-weight: 700; color: #073C5E; }
.sheet-trip-body h2 { margin: 0 0 .35rem; font-size: 15px; }
.sheet-stops { margin: 0; padding: 0; list-style: none; line-height: 1.6; }
.sheet-stops b { display: inline-block; min-width: 52px; font-size: 11px; text-transform: uppercase; color: #64748b; }
.sheet-stops em { display: block; color: #64748b; font-size: 12px; }
.sheet-facts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .45rem 0 0; color: #334155; font-weight: 500; }
.sheet-notes { margin: .45rem 0 0; padding: .45rem .6rem; background: #f8fafc; border-left: 3px solid #f59e0b; color: #334155; }
.sheet-check { display: flex; flex-direction: column; gap: 1.1rem; padding-top: .2rem; color: #64748b; font-size: 12px; white-space: nowrap; }
.sheet-foot { margin-top: 1rem; color: #94a3b8; font-size: 11px; text-align: right; }
.print-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-grid th, .print-grid td { border: 1px solid #cbd5e1; padding: .35rem .4rem; vertical-align: top; text-align: left; }
.print-grid thead th { background: #f1f5f9; font-size: 12px; text-align: center; }
.print-grid thead th:first-child, .print-grid tbody th { width: 120px; }
.print-grid tbody th { font-size: 12px; background: #f8fafc; }
.print-trip { display: flex; flex-direction: column; padding: .25rem 0; font-size: 11px; line-height: 1.3; }
.print-trip + .print-trip { border-top: 1px dashed #cbd5e1; }
.print-trip strong { color: #073C5E; }
.print-trip small { color: #64748b; }

@page { margin: 12mm; }
@page landscape { size: landscape; }
@media print {
    .no-print { display: none !important; }
    .print-page { background: #fff; padding: 0; }
    .sheet { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
    .sheet + .sheet { break-before: page; }
    .sheet-landscape { page: landscape; }
    a { color: inherit; text-decoration: none; }
}

@media (min-width: 901px) and (max-width: 1240px) {
    .sidebar-user-link { flex: none; }
    .page-actions .btn > span { display: none; }
}

@media (max-width: 640px) {
    .page-actions { width: 100%; }
    .page-actions > .btn, .page-actions > .inline-form { flex: 1; }
    .page-actions .inline-form .btn { width: 100%; }
    .segmented-3 { grid-template-columns: 1fr; }
    .trip summary { grid-template-columns: auto 1fr auto; }
    .trip summary .trip-status { grid-column: 2; grid-row: 1; justify-self: start; }
    .trip-chevron { grid-column: 3; }
    .list-item { flex-wrap: wrap; }
    .list-status { align-items: flex-start; margin-left: 0; text-align: left; flex-basis: 100%; max-width: none; padding-left: 4.6rem; }
    .print-toolbar > .btn-primary { margin-left: 0; width: 100%; }
    .sheet { padding: 1.25rem; }
    .sheet-trip { grid-template-columns: 1fr; gap: .4rem; }
    .sheet-check { flex-direction: row; gap: 1rem; }
    .print-grid { font-size: 10px; }
}
