:root {
    color-scheme: light;
    --navy: #10263e;
    --navy-2: #193b5b;
    --blue: #1769e0;
    --blue-dark: #1054bc;
    --ink: #172b40;
    --muted: #718198;
    --line: #e6ebf1;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --green: #19875b;
    --red: #c63c4b;
    --shadow: 0 16px 40px rgba(24, 49, 77, .07);
    font-family: "DM Sans", "Segoe UI", sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-family: Manrope, "Segoe UI", sans-serif; letter-spacing: -.035em; }
.eyebrow { margin: 0 0 8px; color: #8796a9; font-size: 10px; font-weight: 700; letter-spacing: .16em; line-height: 1.4; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.7; }
.muted-on-dark { max-width: 350px; color: #b6c5d6; font-size: 16px; line-height: 1.7; }

.login-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(340px, .9fr) 1.1fr; background: #fff; }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 48px clamp(35px, 7vw, 110px); color: #fff; background: radial-gradient(circle at 82% 78%, rgba(51, 127, 215, .29), transparent 35%), linear-gradient(145deg, #0b2035, #133b60 72%, #174a76); }
.login-story::after { position: absolute; right: -120px; bottom: 12%; width: 420px; height: 420px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018); content: ""; pointer-events: none; }
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.brand-mark { display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #3186f6, #1761c7); box-shadow: 0 8px 20px rgba(23, 105, 224, .3); font-family: Manrope, sans-serif; font-size: 20px; font-weight: 800; }
.login-story .eyebrow { color: #81baff; }
.login-story h1 { position: relative; z-index: 1; margin: 0 0 20px; font-size: clamp(42px, 5.3vw, 70px); line-height: 1.06; }
.login-footnote { margin: 0; color: #829bb4; font-size: 12px; }
.login-panel { display: grid; align-content: center; justify-items: center; padding: 48px 28px; }
.login-card { width: min(100%, 390px); }
.login-card h2 { margin-bottom: 8px; font-size: 31px; }
.login-card > .subtle { margin-bottom: 32px; }
.login-card label, .form-stack label, .form-grid label, .proof-form label { display: grid; gap: 8px; color: #465b70; font-size: 12px; font-weight: 700; }
.login-card label { margin-bottom: 19px; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #dbe3ec; border-radius: 9px; outline: none; color: var(--ink); background: #fff; transition: border-color .16s ease, box-shadow .16s ease; }
input, select { min-height: 43px; padding: 10px 12px; }
textarea { padding: 11px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #71a9f4; box-shadow: 0 0 0 3px rgba(23, 105, 224, .1); }
input::placeholder, textarea::placeholder { color: #a0adbc; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 700; text-decoration: none; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button-primary { border-color: var(--blue); color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(23, 105, 224, .15); }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); }
.button-secondary { border-color: #dce4ed; color: #36516b; background: #fff; }
.button-quiet { border-color: transparent; color: #50677f; background: #f1f5f9; }
.button-wide { width: 100%; min-height: 46px; margin-top: 5px; }
.form-error { min-height: 18px; margin: 10px 0; color: var(--red); font-size: 12px; }
.setup-link { color: #8190a3; font-size: 11px; text-decoration: none; }
.setup-link:hover { color: var(--blue); }
.login-copyright { position: absolute; bottom: 22px; color: #9aa8b8; font-size: 11px; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; display: flex; width: 248px; height: 100dvh; flex-direction: column; padding: 27px 17px 17px; color: #d8e2ec; background: var(--navy); }
.sidebar-backdrop { display: none; }
.sidebar .brand-lockup { padding: 0 8px 34px; font-size: 16px; }
.nav-caption { margin: 0 9px 10px; color: #7188a1; font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.nav-caption-spaced { margin-top: 26px; }
.main-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: thin; }
.nav-link { display: flex; width: 100%; min-height: 42px; align-items: center; gap: 12px; padding: 10px 11px; border: 0; border-radius: 8px; color: #b9c7d6; background: transparent; text-align: left; font-size: 12px; font-weight: 600; }
.nav-link > span:first-child { width: 20px; color: #8da6be; text-align: center; font-size: 17px; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-link.active { color: #fff; background: #1c4266; box-shadow: inset 3px 0 #56a1ff; }
.nav-link.active > span:first-child { color: #73b0ff; }
.sidebar-bottom { display: grid; gap: 10px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.1); }
.user-chip { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 7px; }
.user-chip > span:last-child { display: grid; min-width: 0; gap: 3px; }
.user-chip strong { overflow: hidden; color: #edf4fb; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: #8198ad; font-size: 10px; }
.avatar, .topbar-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #d5e8ff; background: #29547b; font-weight: 700; }
.logout-link { color: #a9bacb; font-size: 11px; }
.main-panel { width: calc(100% - 248px); min-height: 100vh; margin-left: 248px; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; min-height: 83px; align-items: center; justify-content: space-between; gap: 20px; padding: 15px clamp(22px, 4vw, 58px); border-bottom: 1px solid #e8edf3; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar .eyebrow { margin-bottom: 3px; }
.topbar h1 { margin: 0; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 17px; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: #6d8094; font-size: 10px; }
.connection-state i, .live-pill i { width: 7px; height: 7px; border-radius: 50%; background: #28aa70; box-shadow: 0 0 0 3px rgba(40,170,112,.12); }
.connection-offline i { background: #d98b28; box-shadow: 0 0 0 3px rgba(217,139,40,.14); }
.topbar-avatar { width: 34px; height: 34px; color: #245692; background: #e9f2ff; }
.menu-toggle { display: none; }
.page-content { width: min(100%, 1540px); margin: 0 auto; padding: 34px clamp(22px, 4vw, 58px) 60px; }

.welcome-row, .section-heading, .card-heading, .driver-route-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.welcome-row { margin-bottom: 27px; }
.welcome-row h2, .section-heading h2 { margin: 0 0 4px; font-size: 24px; }
.welcome-row .subtle, .section-heading .subtle { margin: 0; }
.date-chip, .count-chip { padding: 8px 11px; border: 1px solid #e2e9f1; border-radius: 8px; color: #60758a; background: #fff; font-size: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 19px; }
.stat-card { position: relative; min-height: 159px; padding: 19px; overflow: hidden; border: 1px solid #e8edf3; border-radius: 13px; background: #fff; box-shadow: 0 5px 18px rgba(25,52,78,.025); }
.stat-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; font-size: 17px; }
.stat-card p { margin: 15px 0 2px; color: #708198; font-size: 11px; }
.stat-card strong { font-family: Manrope, sans-serif; font-size: 25px; letter-spacing: -.04em; }
.stat-card small { display: block; margin-top: 3px; color: #9aa7b6; font-size: 10px; }
.stat-blue .stat-icon { color: #2671d5; background: #eaf3ff; }
.stat-violet .stat-icon { color: #6e5ac8; background: #f0edff; }
.stat-amber .stat-icon { color: #be7b19; background: #fff4df; }
.stat-green .stat-icon { color: #17845a; background: #e4f7ee; }
.content-card { margin-bottom: 16px; border: 1px solid #e7ecf2; border-radius: 12px; background: var(--surface); box-shadow: 0 5px 18px rgba(25,52,78,.025); }
.welcome-card { padding: 24px; }
.welcome-card h3 { margin: 0; font-size: 18px; }
.welcome-card .subtle { max-width: 760px; margin: 19px 0; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; color: #438265; font-size: 10px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.section-heading { align-items: center; margin-bottom: 21px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin-bottom: 3px; }
.form-card { padding: 0 18px 18px; }
.form-card > summary { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; color: #27415b; font-size: 12px; font-weight: 700; }
.form-card > summary::-webkit-details-marker { display: none; }
.form-card > summary small { color: #8a9aad; font-size: 10px; font-weight: 500; }
.form-card[open] > summary { margin-bottom: 4px; border-bottom: 1px solid #edf1f5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 13px; }
.form-grid input, .form-grid select, .form-grid textarea, .proof-form input, .proof-form select, .proof-form textarea { font-size: 12px; font-weight: 400; }
.form-grid .span-2, .proof-form .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 3px; }
.field-help { color: #8393a5; font-size: 10px; font-weight: 400; }
.table-wrap { overflow-x: auto; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-actions .button { min-height: 32px; padding: 7px 9px; font-size: 10px; }
.import-print-labels { margin: 8px 0 0 8px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 13px 15px; border-bottom: 1px solid #edf0f4; color: #8a99aa; font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 15px; border-bottom: 1px solid #f0f2f5; color: #52667a; font-size: 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: #263d54; font-size: 11px; font-weight: 700; }
.cell-sub { display: block; max-width: 320px; margin-top: 4px; overflow: hidden; color: #92a0af; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 99px; color: #52718d; background: #eef3f8; font-size: 9px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.status-active { color: #138153; background: #e6f7ef; }
.status-muted { color: #8996a5; background: #f1f3f5; }
.empty-state { display: grid; min-height: 205px; align-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty-state > span { display: grid; width: 42px; height: 42px; margin-bottom: 12px; place-items: center; border-radius: 13px; color: #538bd0; background: #edf5ff; font-size: 20px; }
.empty-state strong { color: #3b536a; font-size: 13px; }
.empty-state p { margin: 7px 0 0; color: #8a9aac; font-size: 11px; }
.notice { margin: 0 0 16px; padding: 13px 15px; border: 1px solid; border-radius: 9px; font-size: 11px; line-height: 1.6; }
.notice-info { border-color: #d6e7fa; color: #375f83; background: #f0f7ff; }
.notice-error { border-color: #f4ced1; color: #9d3440; background: #fff3f4; }
.loading-card { padding: 24px; color: #788ba0; font-size: 12px; }
.toast { position: fixed; z-index: 60; right: 25px; bottom: 24px; max-width: min(380px, calc(100vw - 32px)); padding: 13px 16px; transform: translateY(14px); border: 1px solid #d6eadf; border-radius: 10px; color: #276747; background: #f0fbf4; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: 12px; }
.toast-visible { transform: translateY(0); opacity: 1; }
.toast-error { border-color: #f2d1d4; color: #943944; background: #fff4f5; }

.driver-route { padding: 19px; }
.driver-route-head { align-items: flex-start; padding-bottom: 13px; border-bottom: 1px solid #eef1f5; }
.driver-route-head h3 { margin: 0; font-size: 17px; }
.route-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; }
.stop-list { display: grid; gap: 11px; }
.stop-card { display: grid; grid-template-columns: 32px 1fr; gap: 13px; padding: 15px; border: 1px solid #edf0f4; border-radius: 10px; background: #fcfdff; }
.stop-number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: #2369c0; background: #e8f2ff; font-size: 11px; font-weight: 800; }
.stop-details h4 { margin: 3px 0; font-size: 14px; }
.stop-details > p { margin: 0 0 7px; color: #708198; font-size: 11px; line-height: 1.6; }
.phone-link { display: inline-block; margin: 0 8px 8px 0; color: #276cc0; font-size: 11px; text-decoration: none; }
.proof-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 15px; padding-top: 14px; border-top: 1px dashed #e0e6ed; }
.proof-form [hidden] { display: none !important; }
.signature-field { display: grid; gap: 7px; }
.signature-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #465b70; font-size: 12px; }
.signature-canvas { display: block; width: 100%; height: 130px; border: 1px solid #cbd9e8; border-radius: 8px; background: #fff; touch-action: none; }
.scanned-material-list { min-width: 0; }
.scanned-material-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.scanned-material-chip { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; min-width: 190px; padding: 9px 11px; border: 1px solid #dce7f2; border-radius: 9px; background: #f7faff; }
.scanned-material-chip strong { font-size: 11px; color: #334d66; }
.scanned-material-chip small { color: #71849a; font-size: 10px; }
.scanned-material-chip button { grid-column: 2; grid-row: 1 / span 2; border: 0; color: #8a4a52; background: transparent; font-size: 20px; cursor: pointer; }
.courier-directory { display: grid; gap: 9px; }
.courier-editor { padding: 12px 14px; border: 1px solid #e7edf3; border-radius: 9px; background: #fff; }
.courier-editor > summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; cursor: pointer; color: #334d66; font-size: 12px; }
.courier-editor > summary small { color: #8292a4; }
.courier-editor .form-grid { padding-top: 14px; }
.text-error { color: #9d3440 !important; }
.proof-links { display: flex; flex-wrap: wrap; gap: 9px; }
.proof-links a { white-space: nowrap; }
.shipment-classify-form { display: grid; gap: 5px; min-width: 155px; }
.shipment-classify-form select { min-height: 32px; padding: 5px 7px; font-size: 10px; }
.photo-picker { align-content: start; padding: 11px; border: 1px dashed #cbd9e8; border-radius: 8px; background: #f7faff; }
.photo-picker input { min-height: auto; padding: 0; border: 0; background: transparent; }
.photo-picker small { color: #8394a8; font-size: 10px; font-weight: 400; }
.history-card { padding: 20px; }
.history-card h3 { margin: 0 0 5px; font-size: 17px; }
.history-card .subtle { margin: 0; }
.timeline { display: grid; gap: 0; margin: 20px 0; padding-left: 11px; border-left: 1px solid #dce6f0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 1fr; padding: 0 0 19px 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; top: 2px; left: -15px; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%; background: #3786df; box-shadow: 0 0 0 1px #3786df; }
.timeline-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.timeline-title strong, .proof-summary strong { color: #334d66; font-size: 11px; text-transform: capitalize; }
.timeline-title time, .timeline-item small, .proof-summary small { color: #8898a9; font-size: 9px; }
.timeline-item p, .proof-summary p { margin: 5px 0 3px; color: #6e8195; font-size: 10px; line-height: 1.6; }
.timeline-coordinates { display: inline-block; margin: 4px 8px 4px 0; color: #276cc0; font-size: 10px; }
.route-map { margin: 13px 0 2px; padding: 8px; border: 1px solid #eaf0f6; border-radius: 10px; background: #fbfdff; }
.route-map svg { display: block; width: 100%; max-height: 230px; }
.route-map svg text { font-family: "Segoe UI", sans-serif; }
.route-map small, .map-empty { color: #8394a8; font-size: 9px; }
.map-empty { margin: 12px 0; }
.proof-heading { margin: 15px 0 10px; color: #405a73; font-size: 13px; }
.proof-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #eef1f5; }
.proof-summary > div { display: grid; gap: 4px; }
.proof-summary > a { color: #276cc0; font-size: 10px; text-decoration: none; }
.inline-form, .payment-form, .ticket-update-form { display: grid; min-width: 140px; gap: 7px; }
.inline-action { position: relative; }
.inline-action > summary { cursor: pointer; color: #2867ae; font-size: 10px; white-space: nowrap; }
.inline-action[open] { min-width: 185px; }
.inline-action .button { min-height: 32px; padding: 7px 10px; font-size: 10px; }
.payment-form input, .payment-form select, .ticket-update-form select, .ticket-update-form textarea { min-height: 34px; padding: 7px; font-size: 10px; }
.ticket-update-form { min-width: 190px; }

.setup-page { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: linear-gradient(135deg, #eaf2fa, #f7f9fc 50%, #e9f1fa); }
.setup-card { width: min(100%, 500px); padding: 34px; border: 1px solid #e5ebf2; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.setup-card .brand-mark { margin-bottom: 19px; }
.setup-card h1 { margin-bottom: 8px; font-size: 24px; }
.setup-card > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.7; }
.form-stack { display: grid; gap: 15px; margin-top: 23px; }
.form-stack .button { margin-top: 5px; }

@media (max-width: 1050px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar { width: 220px; }
    .main-panel { width: calc(100% - 220px); margin-left: 220px; }
}
@media (max-width: 900px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-story { min-height: 250px; padding: 26px 28px; }
    .login-story h1 { margin-bottom: 9px; font-size: 36px; }
    .login-story .muted-on-dark { margin-bottom: 0; font-size: 12px; }
    .login-footnote { display: none; }
    .login-panel { padding: 38px 25px 58px; }
    .sidebar { width: 280px; max-width: 84vw; transform: translateX(-105%); box-shadow: 14px 0 40px rgba(10,26,43,.2); transition: transform .22s ease; }
    .sidebar-open { transform: translateX(0); }
    .sidebar-backdrop-visible { position: fixed; z-index: 19; inset: 0; display: block; border: 0; background: rgba(9,24,39,.46); }
    .menu-open { overflow: hidden; }
    .main-panel { width: 100%; margin-left: 0; }
    .topbar { min-height: 70px; gap: 10px; padding: 12px 18px; }
    .menu-toggle { display: inline-flex; width: 35px; height: 35px; align-items: center; justify-content: center; border: 0; border-radius: 8px; color: #486079; background: #f1f5f9; }
    .topbar > div:nth-child(2) { flex: 1; }
    .topbar h1 { font-size: 16px; }
    .connection-state span { display: none; }
    .topbar-actions { gap: 9px; }
    .install-button { min-height: 34px; padding: 7px 9px; font-size: 10px; }
    .page-content { padding: 24px 16px 42px; }
    .stats-grid { gap: 9px; }
    .stat-card { min-height: 142px; padding: 14px; }
    .stat-card p { font-size: 10px; }
    .stat-card strong { font-size: 22px; }
    .welcome-row { align-items: flex-start; }
    .date-chip { display: none; }
    .form-card { padding: 0 13px 14px; }
    .form-grid { gap: 12px; }
    th, td { padding: 11px 12px; }
    .driver-route { padding: 13px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid, .proof-form { grid-template-columns: 1fr; }
    .form-grid .span-2, .proof-form .span-2 { grid-column: auto; }
    .form-grid label { min-width: 0; }
    .section-heading { align-items: flex-end; }
    .section-heading h2 { font-size: 21px; }
    .count-chip { max-width: 100px; text-align: center; }
    .driver-route-head { align-items: flex-start; }
    .route-controls .button { flex: 1 1 auto; }
}
@media (max-width: 760px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-story { min-height: 250px; padding: 26px 28px; }
    .login-story h1 { margin-bottom: 9px; font-size: 36px; }
    .login-story .muted-on-dark { margin-bottom: 0; font-size: 12px; }
    .login-footnote { display: none; }
    .login-panel { padding: 38px 25px 58px; }
}
