
:root{--bg:#f4f7fb;--panel:#fff;--text:#162033;--muted:#6b778b;--line:#dce3ed;--dark:#10223e;--blue:#0b5bd3;--green:#15753c;--red:#c9223e;--amber:#b66b00}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}
.hidden{display:none!important}.muted{color:var(--muted)}.error{color:var(--red);margin-top:10px}
button,input,select,textarea{font:inherit}button{border:0;border-radius:9px;background:var(--blue);color:#fff;padding:10px 14px;cursor:pointer;font-weight:700}
button.secondary{background:#42516a}button.danger{background:var(--red)}button:disabled{opacity:.45;cursor:not-allowed}
input,select,textarea{width:100%;border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:9px}
input[type=checkbox]{width:22px;height:22px}.stack{display:grid;gap:12px}.actions{display:flex;gap:8px;flex-wrap:wrap}
.auth-screen{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(160deg,#10223e,#1d426f)}
.auth-card{width:min(420px,100%);background:#fff;border-radius:18px;padding:28px;box-shadow:0 22px 60px #0004}.auth-card form{display:grid;gap:15px}.brand{font-weight:900;letter-spacing:.08em}.brand.big{font-size:25px}
.topbar{position:sticky;top:0;z-index:20;background:var(--dark);color:#fff;padding:15px 22px;display:flex;justify-content:space-between;align-items:center;gap:12px}.topbar .muted{color:#c9d3df}
.top-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.badge{border-radius:999px;background:#17723a;padding:7px 10px;font-size:13px}.badge.subtle{background:#41516b}
.nav{position:sticky;top:73px;z-index:18;background:#fff;border-bottom:1px solid var(--line);display:flex;gap:6px;padding:8px 16px;overflow:auto}.nav button{white-space:nowrap;background:#edf2f9;color:#263651}.nav button.active{background:var(--blue);color:#fff}
main{max-width:1900px;margin:auto;padding:18px}.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:15px;margin-bottom:15px}.page-head h1{margin:0 0 4px}
.panel{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px;margin-bottom:16px}.cards{display:grid;grid-template-columns:repeat(6,minmax(135px,1fr));gap:12px;margin-bottom:16px}.card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:16px}.card .value{font-size:30px;font-weight:900;margin-top:3px}
.status-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}.status-card{border:1px solid var(--line);border-radius:12px;padding:12px}
.table-wrap{overflow:auto}.orders-table{width:100%;min-width:1600px;border-collapse:collapse}.orders-table th,.orders-table td{padding:8px;border-bottom:1px solid var(--line);text-align:center}.orders-table th{background:#eef3fb;position:sticky;top:0;z-index:1}.orders-table th:first-child,.orders-table td:first-child{text-align:left}.qty{width:80px}
.kitchen-grid,.display-grid,.driver-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:14px}.k-card,.d-card,.driver-card{background:#fff;border:2px solid #d8e0ea;border-radius:14px;padding:15px}.k-card h3,.d-card h3,.driver-card h3{margin:0 0 10px}.nums{display:grid;grid-template-columns:1fr 1fr;gap:7px;font-size:18px}
.status{font-weight:900;margin-top:10px}.ok{color:var(--green)}.warn{color:var(--amber)}.bad{color:var(--red)}
.flash{animation:flash 1s infinite;border-color:var(--red)!important}.flash-cell{animation:flash 1s infinite}
@keyframes flash{0%,100%{background:#fff0f2}50%{background:#ff96aa}}
.display-head{background:#10223e;color:#fff;border-radius:14px;padding:16px;margin-bottom:14px;display:flex;justify-content:space-between;gap:12px;align-items:center}.display-totals{font-size:20px;font-weight:900;text-align:right}
.display-grid .d-card{font-size:19px}.display-grid .d-card h3{font-size:25px}.display-grid .nums{font-size:21px}
.client-row,.user-row{display:grid;grid-template-columns:2fr 2fr 1fr auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}.user-row{grid-template-columns:2fr 2fr 1fr}
.split{display:grid;grid-template-columns:minmax(280px,420px) 1fr;gap:30px}.audit{max-height:600px;overflow:auto}.audit-item{padding:10px;border-bottom:1px solid var(--line)}
dialog{border:0;border-radius:16px;padding:0;box-shadow:0 20px 70px #0005;width:min(520px,90vw)}dialog form{padding:22px}
#toastHost{position:fixed;right:20px;bottom:20px;z-index:100}.toast{background:#10223e;color:#fff;padding:12px 16px;border-radius:10px;margin-top:8px;box-shadow:0 8px 30px #0003}
.report-table{width:100%;border-collapse:collapse}.report-table th,.report-table td{border:1px solid #bbb;padding:7px;text-align:center}.report-table th:first-child,.report-table td:first-child{text-align:left}
@media(max-width:1000px){.cards{grid-template-columns:repeat(2,1fr)}.split{grid-template-columns:1fr}.page-head{align-items:flex-start;flex-direction:column}.nav{top:96px}.client-row,.user-row{grid-template-columns:1fr}}
@media print{.topbar,.nav,.page-head .actions,.date-tools{display:none!important}body{background:#fff}main{padding:0}.page:not(#reportsPage){display:none!important}#reportsPage{display:block!important}.panel{border:0;padding:0}}

.orders-table tr.editing{background:#f7fbff;box-shadow:inset 0 0 0 2px #0b5bd333}
.orders-table tr:not(.editing) input:disabled,.orders-table tr:not(.editing) select:disabled{background:#f5f7fa;color:#344054;opacity:1}
.row-actions{min-width:205px;white-space:nowrap}
.row-actions button{padding:8px 10px;margin:2px;font-size:13px}
.orders-table tr.editing input,.orders-table tr.editing select{border-color:#0b5bd3;box-shadow:0 0 0 2px #0b5bd31a}

.user-row .actions{display:flex;justify-content:flex-end;gap:8px}
.user-row .danger{min-width:90px}

.user-actions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
.user-actions button{white-space:nowrap}

.row-actions .active-alert{font-weight:800;box-shadow:0 0 0 3px rgba(255,140,0,.22)}
.row-actions .urgent-active{font-weight:900;animation:urgentPulse 1s infinite}
.urgent-card{outline:4px solid #c62828;outline-offset:-4px}
.urgent-banner{
  margin:8px 0 12px;padding:10px 12px;border-radius:10px;
  background:#c62828;color:#fff;font-weight:900;font-size:1.05em;
  text-transform:uppercase;letter-spacing:.3px;
  animation:urgentPulse 1s infinite
}
@keyframes urgentPulse{
  0%,100%{transform:scale(1);filter:brightness(1)}
  50%{transform:scale(1.015);filter:brightness(1.25)}
}

.user-role-group{margin:0 0 22px;border:1px solid #dfe5ee;border-radius:14px;overflow:hidden;background:#fff}
.user-role-head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#f5f7fa;border-bottom:1px solid #e5e9f0}
.user-role-head h3{margin:0}
.user-role-list{display:flex;flex-direction:column}
.user-card{display:grid;grid-template-columns:minmax(220px,1.3fr) 120px 100px minmax(320px,1fr);align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid #edf0f4}
.user-card:last-child{border-bottom:0}
.user-email{font-size:13px;color:#667085;margin-top:3px;word-break:break-all}
.user-inactive{opacity:.7;background:#fafafa}
@media(max-width:900px){
  .user-card{grid-template-columns:1fr;align-items:stretch}
  .user-actions{justify-content:flex-start}
}

.driver-change-icon{font-size:.95em;vertical-align:middle;display:inline-block}
.k-driver-assign{margin:10px 0}
.k-driver-assign select{width:100%;margin-top:4px}
.driver-route-picker{margin-bottom:18px}
.route-choice-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:10px}
.route-choice{display:flex;gap:10px;align-items:flex-start;border:1px solid #dfe5ee;border-radius:12px;padding:12px;background:#fff;cursor:pointer}
.route-choice input{margin-top:4px;transform:scale(1.25)}
.route-choice span{display:flex;flex-direction:column;gap:3px}
.route-choice small{color:#667085}
.route-choice.driver-changed{border-width:2px}
.warn-text{font-weight:700}
.driver-deliveries{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}

.missing-menu-badge{
  display:inline-block;margin-left:7px;padding:3px 7px;border-radius:999px;
  background:#b42318;color:#fff;font-size:.78em;font-weight:900;white-space:nowrap
}
.missing-menu-card{outline:3px solid #b42318;outline-offset:-3px}
.driver-missing-menu{margin:10px 0}
.route-copy-note{margin:0 0 14px;padding:10px 12px;border-radius:10px;background:#f7f8fa}

.transfer-approval-panel{margin-bottom:16px}
.transfer-request-list{display:flex;flex-direction:column;gap:10px}
.transfer-request-item{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:12px;border:1px solid #e3e8ef;border-radius:12px;background:#fff}
.transfer-history-item{border-left:4px solid currentColor}
@media(max-width:700px){
  .transfer-request-item{flex-direction:column;align-items:stretch}
}

.reset-all-orders{
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.3px;
  border-width:2px
}

/* Driver mobile-first */
.driver-mobile-summary{
  margin-bottom:14px;
  padding:16px;
  border-radius:18px;
  background:#fff;
  border:1px solid #e3e8ef;
}
.driver-summary-main{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.driver-eyebrow{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  opacity:.65;
}
.driver-summary-main h2{margin:4px 0 0;font-size:22px}
.driver-summary-count{
  width:58px;height:58px;
  border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  font-size:28px;font-weight:900;
  background:#eef2f6;
}
.driver-summary-stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-top:14px;
}
.driver-summary-stats>div{
  padding:10px 8px;
  border-radius:12px;
  background:#f7f8fa;
  text-align:center;
}
.driver-summary-stats b{display:block;font-size:20px}
.driver-summary-stats span{font-size:12px;opacity:.7}

.driver-mobile-panel{
  border-radius:18px;
  padding:16px;
}
.driver-section-title h2{margin:0 0 4px}
.driver-section-title p{margin:0;color:#667085}
.driver-section-title.compact{margin:18px 0 10px}
.driver-route-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:14px 0;
}
.driver-big-btn{
  min-height:52px;
  font-size:15px;
  font-weight:800;
  border-radius:12px;
}
.driver-route-list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.driver-route-item{
  min-height:64px;
  padding:12px 14px;
  border-radius:14px;
}
.driver-route-item input{
  width:24px;height:24px;
  flex:0 0 auto;
}
.route-choice-content{display:flex!important;flex-direction:column;gap:4px}
.route-choice-name{font-size:16px;font-weight:800}
.driver-route-item.occupied{opacity:.65}

.driver-delivery-section{margin-top:14px}
.driver-deliveries{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.driver-mobile-card{
  padding:16px;
  border-radius:18px;
  border:1px solid #e3e8ef;
  background:#fff;
}
.driver-card-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.driver-client-block{min-width:0}
.driver-client-name{
  font-size:20px;
  font-weight:900;
  line-height:1.15;
}
.driver-status-pill{
  display:inline-flex;
  margin-top:8px;
  padding:5px 9px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
}
.driver-status-pill.pending{background:#fff3cd}
.driver-status-pill.departed{background:#dbeafe}
.driver-status-pill.delivered{background:#dcfce7}
.driver-portions{
  flex:0 0 auto;
  min-width:72px;
  padding:10px 8px;
  border-radius:14px;
  background:#f6f7f9;
  text-align:center;
  font-size:24px;
  font-weight:900;
}
.driver-portions span{
  display:block;
  font-size:11px;
  font-weight:700;
  opacity:.65;
}
.driver-info-row{
  display:grid;
  grid-template-columns:24px 1fr;
  gap:8px;
  margin-top:12px;
  font-size:15px;
  line-height:1.35;
}
.driver-info-row.important{
  padding:10px;
  border-radius:12px;
  background:#fff8e1;
  font-weight:700;
}
.driver-inline-alert{
  margin-top:10px;
  padding:8px 10px;
  border-radius:10px;
  background:#eef2f6;
  font-weight:800;
}
.driver-inline-alert.danger{background:#fdecec}
.driver-secondary-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:14px;
}
.driver-secondary-actions button{
  min-height:48px;
  border-radius:12px;
  font-size:14px;
  font-weight:800;
}
.driver-primary-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:10px;
}
.driver-action-btn{
  min-height:62px;
  border-radius:14px;
  font-size:17px;
  font-weight:900;
  letter-spacing:.02em;
}
.driver-action-btn:disabled{opacity:.55}
.driver-empty-state{
  padding:28px 16px;
  text-align:center;
  border-radius:18px;
  font-weight:700;
}

@media(max-width:640px){
  #driverPage{padding-left:10px!important;padding-right:10px!important}
  #driverPage .page-head{display:none}
  .driver-route-actions{grid-template-columns:1fr}
  .driver-primary-actions{grid-template-columns:1fr 1fr}
  .driver-secondary-actions{grid-template-columns:1fr}
  .driver-client-name{font-size:19px}
  .driver-mobile-card{padding:14px}
  .driver-big-btn{width:100%}
}

@media(max-width:390px){
  .driver-primary-actions{grid-template-columns:1fr}
  .driver-summary-main h2{font-size:19px}
  .driver-summary-stats span{font-size:11px}
}

.breakfast-display{font-weight:900;border:2px solid currentColor;border-radius:10px;padding:6px 8px}

.rectification-delta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:8px;
  min-width:34px;
  padding:3px 7px;
  border-radius:999px;
  font-size:.95em;
  font-weight:900;
  line-height:1.2;
  border:2px solid currentColor;
}
.rectification-delta.plus::before{content:"RECT. ";font-size:.65em;margin-right:3px}
.rectification-delta.minus::before{content:"RECT. ";font-size:.65em;margin-right:3px}

.display-head-actions{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

@media (max-width:700px){
  .display-head-actions{justify-content:flex-start}
}

.qty-control{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  min-width:142px;
}
.qty-control .qty{
  width:58px;
  min-width:58px;
  height:44px;
  padding:6px 4px;
  text-align:center;
  font-size:18px;
  font-weight:900;
  border:2px solid var(--line, #cfd5df);
  border-radius:10px;
  background:#fff;
}
.qty-control .qty:focus{
  outline:3px solid rgba(0,0,0,.16);
  outline-offset:1px;
}
.qty-step{
  width:38px;
  min-width:38px;
  height:44px;
  padding:0;
  border-radius:10px;
  font-size:25px;
  line-height:1;
  font-weight:900;
  touch-action:manipulation;
}
.qty-minus{font-size:27px}
.qty-saving{opacity:.55}
.qty-saved{box-shadow:0 0 0 3px rgba(0,0,0,.13)}
.qty-control.flash-cell{
  animation:flashCell 1s infinite;
  border-radius:12px;
  padding:2px;
}
@media (max-width:700px){
  .qty-control{
    min-width:136px;
    gap:4px;
  }
  .qty-control .qty{
    width:54px;
    min-width:54px;
    height:46px;
    font-size:19px;
  }
  .qty-step{
    width:37px;
    min-width:37px;
    height:46px;
    font-size:26px;
  }
}

.rectification-delta.cumulative{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:8px;
  min-width:58px;
  padding:3px 8px;
  border-radius:999px;
  font-size:.9em;
  font-weight:900;
  line-height:1.2;
  border:2px solid currentColor;
}
