:root{
  --bg:#f4f7fb;--surface:#fff;--surface-2:#f8fafc;--ink:#11213a;--muted:#6b7a90;--line:#e2e8f0;
  --nav:#0a2747;--nav-2:#0d335b;--blue:#0877f9;--blue-2:#0d6efd;--blue-soft:#eaf3ff;
  --green:#13b76a;--green-soft:#e8f8f0;--red:#ff4d5e;--red-soft:#fff0f2;--amber:#f5a623;--amber-soft:#fff6e5;
  --purple:#7c4dff;--radius:14px;--radius-sm:10px;--shadow:0 8px 30px rgba(17,33,58,.07);--shadow-sm:0 2px 10px rgba(17,33,58,.06)
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Inter,Roboto,Arial,sans-serif;-webkit-font-smoothing:antialiased}
a{color:var(--blue);text-decoration:none}a:hover{text-decoration:none}
button,input,select,textarea{font:inherit}

/* Shared app chrome */
.app-frame{min-height:100vh}
.wrap{max-width:1480px;margin:0 auto;padding:24px 26px 38px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow-sm);padding:16px;margin:12px 0}
.muted{color:var(--muted)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;padding:10px 15px;border:1px solid transparent;border-radius:9px;background:var(--blue);color:#fff;font-weight:760;text-decoration:none;cursor:pointer;transition:.16s ease;white-space:nowrap}
.btn:hover{filter:brightness(.98);transform:translateY(-1px)}
.btn.good{background:var(--green)}.btn.bad{background:var(--red)}.btn.alt{background:#fff;border-color:var(--line);color:var(--ink);box-shadow:0 1px 3px rgba(17,33,58,.04)}
.btn.ghost{background:transparent;color:var(--muted);border-color:transparent}
.btn.small{min-height:34px;padding:7px 10px;font-size:13px}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}.stat{font-size:29px;font-weight:850}
input,select,textarea{width:100%;padding:10px 12px;border:1px solid #d8e0eb;border-radius:9px;background:#fff;color:var(--ink);outline:0;transition:.15s ease}
input:focus,select:focus,textarea:focus{border-color:#9cc8ff;box-shadow:0 0 0 3px rgba(8,119,249,.10)}
label{font-size:13px;font-weight:700;color:#43516a}
label input,label select,label textarea{margin-top:6px}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:12px;background:#fff}
table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px}
th,td{padding:12px 11px;text-align:left;border-bottom:1px solid #edf1f6;vertical-align:middle}
th{position:sticky;top:0;background:#f8fafc;color:#526077;font-size:11px;text-transform:uppercase;letter-spacing:.035em;z-index:1}
tbody tr:last-child td{border-bottom:0}tbody tr:hover td{background:#fbfdff}
.type,.status-chip{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;background:#f1f4f8;font-size:11px;font-weight:800;white-space:nowrap}
.status-chip.s-done{background:var(--green-soft);color:#07844c}.status-chip.s-problem{background:var(--red-soft);color:#d63243}.status-chip.s-in_progress{background:var(--blue-soft);color:#116ac6}.status-chip.s-new{background:var(--amber-soft);color:#a56a00}
.row-green td{background:#e9f8ef}.row-yellow td{background:#fff6dc}.row-red td{background:#ffeded}.row-blue td{background:#eaf3ff}.row-gray td{background:#f2f4f7}

/* Brand */
.brand{display:flex;align-items:center;gap:10px;color:inherit;text-decoration:none;font-weight:850;letter-spacing:-.015em}
.brand:hover{text-decoration:none}.brand-cube{width:29px;height:29px;display:grid;place-items:center;border-radius:8px;background:linear-gradient(145deg,#3c9cff,#0567e8);box-shadow:inset 0 0 0 1px rgba(255,255,255,.25),0 4px 12px rgba(8,119,249,.28);color:#fff;font-size:15px;transform:rotate(45deg)}.brand-cube span{transform:rotate(-45deg);font-size:12px;font-weight:900}

/* Dispatcher shell */
body.dispatcher-ui{background:#f5f8fc}
.dispatcher-shell{min-height:100vh;display:grid;grid-template-columns:230px minmax(0,1fr)}
.dispatcher-side{background:linear-gradient(180deg,var(--nav) 0%,#071d35 100%);color:#fff;min-height:100vh;position:sticky;top:0;height:100vh;padding:20px 14px;display:flex;flex-direction:column;z-index:45}
.dispatcher-side .brand{color:#fff;font-size:17px;padding:4px 10px 20px}
.dispatcher-side-title{font-size:10px;text-transform:uppercase;letter-spacing:.11em;color:#7992ae;padding:12px 12px 5px}
.side-nav{display:grid;gap:4px}.side-nav a{display:flex;align-items:center;gap:11px;min-height:42px;padding:10px 12px;border-radius:9px;color:#d8e4f0;font-weight:680;font-size:14px}.side-nav a:hover,.side-nav a.active{background:linear-gradient(90deg,#0b6dca,#0877f9);color:#fff}.side-icon{width:19px;text-align:center;opacity:.92}
.side-bottom{margin-top:auto;padding:12px 8px 0;border-top:1px solid rgba(255,255,255,.09)}.side-bottom .muted{color:#8da3ba;font-size:12px}.side-logout{margin-top:8px;width:100%;justify-content:flex-start;background:transparent;border-color:rgba(255,255,255,.12);color:#d9e5f1}
.dispatcher-main{min-width:0}
.dispatcher-top{height:64px;display:flex;align-items:center;gap:16px;padding:0 26px;background:rgba(255,255,255,.96);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:35;backdrop-filter:blur(12px)}
.global-search{width:min(520px,48vw);position:relative}.global-search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:17px;height:17px;color:#718096}.global-search input{margin:0;padding-left:38px;background:#f8fafc;border-color:#e4eaf2}
.top-spacer{flex:1}.top-user{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:760;white-space:nowrap}.avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#0f527f;color:#fff;font-weight:850}.mobile-menu,.mobile-drawer{display:none}

/* Courier shell */
body.courier-ui{background:#f3f6fa}
.courier-top{height:58px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 16px;position:sticky;top:0;z-index:35}.courier-top .brand{font-size:16px}.courier-user{display:flex;align-items:center;gap:8px}.courier-user .logout{border:0;background:transparent;color:#64748b;font-weight:700;cursor:pointer;padding:8px}
body.courier-ui .wrap{max-width:720px;padding:14px 14px 34px}

/* Lab identity */
.lab-badge{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:24px;min-width:38px;padding:0 7px;border-radius:7px;font-size:10px;font-weight:950;letter-spacing:.02em;line-height:1;box-shadow:inset 0 0 0 1px rgba(17,33,58,.05)}
.lab-badge--cmd{background:#ddf8e7;color:#0c8c4d;border:1px solid #a8e6c0;letter-spacing:.06em}.lab-badge--invitro{background:#e8f6ff;color:#0583c8;border:1px solid #bee7fb}.lab-badge--other{width:26px;min-width:26px;padding:0;background:#f3edff;color:#7444d8;border:1px solid #ded0ff}.lab-badge--service{background:#eff3f7;color:#64748b;border:1px solid #dfe5ec}.lab-badge svg{width:13px;height:13px}
.lab-caption{font-size:12px;font-weight:730;color:#66758a;margin-top:3px}.lab-caption strong{color:#42526b;font-weight:800}

/* Courier page */
.courier-shell{max-width:680px;margin:0 auto}.courier-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:4px 2px 12px}.courier-head h1{font-size:24px;letter-spacing:-.03em;margin:0 0 3px}.progress-pill{font-weight:850;color:#1769cf;background:var(--blue-soft);padding:7px 10px;border-radius:999px;flex:none;font-size:13px}
.next-card{padding:0;overflow:hidden;border-color:#cfe2ff;box-shadow:0 10px 30px rgba(8,119,249,.08)}.next-bar{background:linear-gradient(90deg,#0d6efd,#0a82ff);color:#fff;padding:10px 14px;display:flex;justify-content:space-between;gap:8px;font-size:12px;font-weight:850;letter-spacing:.025em}.next-body{padding:16px}.next-lab{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}.next-address{font-size:23px;line-height:1.18;margin:6px 0 2px;letter-spacing:-.025em;overflow-wrap:anywhere}.address-line{display:flex;gap:8px;align-items:flex-start}.address-pin{width:21px;height:21px;flex:none;margin-top:3px;color:#0f2d52}.address-pin svg{width:20px;height:20px}.next-meta{display:grid;gap:7px;margin:12px 0 2px;font-weight:720;color:#243957}.meta-line{display:flex;align-items:center;gap:8px}.meta-icon{width:18px;text-align:center;color:#0d5ca8}.meta-line a{font-weight:760}
.action-row{display:grid;grid-template-columns:1.35fr 1fr;gap:8px;margin-top:14px}.action-row .btn{width:100%;min-width:0}.big-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:9px}.big-actions .btn{width:100%;min-height:50px}
.route-section{margin-top:18px}.route-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:9px}.route-title h2{margin:0;font-size:17px;letter-spacing:-.015em}.route-list{background:#fff;border:1px solid var(--line);border-radius:13px;overflow:hidden;box-shadow:var(--shadow-sm)}
.route-row{display:grid;grid-template-columns:27px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 12px;border-bottom:1px solid #edf1f5}.route-row:last-child{border-bottom:0}.route-row.current{background:#edf6ff}.route-row.problem{background:#fff2f3}.route-row.done{background:#fbfdfc}.route-dot{width:22px;height:22px;border-radius:50%;display:grid;place-items:center;background:#e7ecf2;color:#6e7c90;font-size:10px;font-weight:900}.route-row.done .route-dot{background:var(--green);color:#fff}.route-row.current .route-dot{background:var(--blue);color:#fff}.route-row.problem .route-dot{background:var(--red);color:#fff}.route-primary{min-width:0}.route-labline{height:21px;display:flex;align-items:center;gap:6px;margin-bottom:1px}.route-address{font-weight:790;line-height:1.25;overflow-wrap:anywhere}.route-sub{font-size:11px;color:#758399;margin-top:2px}.route-time{font-size:12px;color:#30445f;white-space:nowrap;font-weight:700}
.delivery-detail{margin-top:10px}.delivery-detail summary{cursor:pointer;overflow-wrap:anywhere}.reorder-actions{display:flex;gap:6px;margin-top:12px;flex-wrap:wrap}.reorder-actions form{margin:0}.reorder-actions .btn{margin:0}

/* Dispatcher dashboard */
.dashboard-page{max-width:1500px;margin:0 auto}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:18px}.page-title{display:flex;gap:12px;align-items:center}.page-title-icon{width:37px;height:37px;border-radius:10px;background:#fff;border:1px solid var(--line);display:grid;place-items:center;color:#0f2d52;box-shadow:var(--shadow-sm)}.page-head h1{margin:0;font-size:25px;letter-spacing:-.025em}.page-sub{color:var(--muted);font-size:13px;margin-top:3px}.head-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.date-nav{display:flex;align-items:center;gap:6px;margin-top:8px}.date-nav .btn{min-height:32px;padding:5px 9px;font-size:12px}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0 0 18px}.kpi{display:flex;align-items:center;gap:12px;padding:15px 16px;margin:0;min-height:90px}.kpi-icon{width:40px;height:40px;border-radius:10px;display:grid;place-items:center;flex:none;font-size:18px}.kpi-icon.total{background:#eaf3ff;color:#0877f9}.kpi-icon.done{background:#e8f8f0;color:#0aa55d}.kpi-icon.problem{background:#fff0f2;color:#ee3f52}.kpi-icon.route{background:#eaf3ff;color:#0a6bcf}.kpi-label{font-size:11px;color:#69788e;font-weight:700}.kpi-value{font-size:27px;font-weight:900;letter-spacing:-.03em;margin-top:1px}
.quick-filters{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin:0 0 10px}.filter-chip{border:1px solid var(--line);background:#fff;color:#384860;border-radius:8px;padding:8px 13px;font-size:12px;font-weight:760;cursor:pointer}.filter-chip:hover,.filter-chip.active{background:var(--blue);color:#fff;border-color:var(--blue)}
.filter-card{margin:0 0 12px;padding:12px}.filter-row{display:grid;grid-template-columns:minmax(230px,2fr) repeat(3,minmax(140px,1fr)) auto;gap:8px;align-items:end}.filter-row input,.filter-row select{margin:0}.filter-row label{margin:0}.filter-row .btn{min-height:39px}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:22px 0 9px}.section-head h2{font-size:17px;margin:0}.section-head:first-child{margin-top:0}.bulk-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:10px 12px;margin:0 0 10px;background:#f8fbff}.bulk-bar select{width:auto;min-width:190px;margin:0}.bulk-bar strong{font-size:12px}
.delivery-panel{padding:0;margin:0;overflow:hidden}.delivery-panel .table-wrap{border:0;border-radius:0}.delivery-panel th{background:#f8fafc}.delivery-panel td{padding-top:10px;padding-bottom:10px}.delivery-address-main{font-weight:760;color:#213651}.delivery-address-sub{font-size:11px;color:#8591a3;margin-top:2px}.lab-cell{min-width:120px}.lab-cell .lab-caption{margin-top:4px}.table-actions{display:flex;align-items:center;gap:5px;white-space:nowrap}.table-actions a{font-size:12px}
.status-note{font-size:11px;color:var(--red);margin-top:3px}.mobile-deliveries{display:none}.delivery-card{padding:13px;margin:8px 0}.delivery-card-head{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}.delivery-card .delivery-address-main{margin-top:7px}.delivery-meta{font-size:12px;color:#6f7d91;margin-top:5px}.delivery-actions{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin-top:10px}.delivery-actions a{flex:1}
.route-summary,.courier-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:10px}.route-card{margin:0}.route-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.route-actions{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin-top:9px}.route-actions form{display:flex;gap:6px;flex:1}.route-actions select{margin:0;min-width:150px}.progress-track{height:6px;background:#edf0f4;border-radius:20px;overflow:hidden;margin:10px 0}.progress-track span{display:block;height:100%;background:var(--green)}.order-note{margin:9px 0;padding:9px 10px;border-radius:9px;background:var(--amber-soft);font-size:12px}

/* Mobile dispatcher */
@media(max-width:980px){
  .dispatcher-shell{display:block}.dispatcher-side{display:none}.dispatcher-top{height:58px;padding:0 13px}.mobile-menu{display:inline-flex;width:39px;height:39px;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:9px;background:#fff;font-size:18px;cursor:pointer}.global-search{width:min(460px,60vw)}.top-user .user-name{display:none}
  .mobile-drawer.open{display:block;position:fixed;inset:58px 0 0;z-index:60;background:rgba(10,28,51,.45)}.mobile-drawer nav{width:min(320px,88vw);height:100%;background:var(--nav);padding:16px}.mobile-drawer a{display:flex;color:#e2ebf5;padding:12px;border-bottom:1px solid rgba(255,255,255,.07);font-weight:700}.wrap{padding:18px}.kpi-grid{grid-template-columns:repeat(2,1fr)}.filter-row{grid-template-columns:1fr 1fr}.filter-row label:first-of-type{grid-column:1/-1}
}
@media(max-width:700px){
  .wrap{padding:12px}.card{border-radius:12px}.btn{min-height:44px}.global-search{display:none}.dispatcher-top{justify-content:space-between}.top-spacer{display:none}.page-head{display:block}.page-head h1{font-size:21px}.head-actions{margin-top:12px}.head-actions .btn{flex:1}.kpi-grid{display:flex;overflow-x:auto;margin-left:-12px;margin-right:-12px;padding:0 12px 4px;scrollbar-width:none}.kpi{min-width:155px}.quick-filters{overflow-x:auto;flex-wrap:nowrap;padding-bottom:3px;scrollbar-width:none}.filter-chip{flex:none}.filter-row{grid-template-columns:1fr 1fr}.filter-row label:first-of-type{grid-column:1/-1}.filter-row .btn{grid-column:1/-1}.desktop-table{display:none}.mobile-deliveries{display:block}.delivery-panel.card{background:transparent;border:0;box-shadow:none;overflow:visible}.bulk-bar select{width:100%;min-width:0}.bulk-bar .btn{flex:1}.route-summary,.courier-stats{grid-template-columns:1fr}.route-actions form{width:100%}
  body.courier-ui .wrap{padding-bottom:max(24px,env(safe-area-inset-bottom))}.courier-top{padding-top:env(safe-area-inset-top);height:calc(58px + env(safe-area-inset-top))}.next-address{font-size:21px}.action-row{grid-template-columns:1fr 1fr}.big-actions{grid-template-columns:1fr 1fr}.route-row{padding:10px}.delivery-detail{padding:13px}
}
@media(max-width:430px){
  .courier-head h1{font-size:22px}.next-body{padding:14px}.next-address{font-size:20px}.action-row{grid-template-columns:1fr}.big-actions{grid-template-columns:1fr}.route-row{grid-template-columns:25px minmax(0,1fr) auto;gap:8px}.route-time{font-size:11px}.reorder-actions{display:grid;grid-template-columns:1fr 1fr}.reorder-actions form,.reorder-actions .btn{width:100%}.kpi{min-width:145px}.filter-row{grid-template-columns:1fr}.filter-row label:first-of-type,.filter-row .btn{grid-column:auto}.delivery-actions{display:grid;grid-template-columns:1fr 1fr}.delivery-actions label{grid-column:1/-1}.route-actions form{display:grid;grid-template-columns:1fr}.route-actions .btn{width:100%}
}
