:root{
  --bg:#0f1420; --surface:#171e2e; --surface-2:#1e2739; --border:#28324a;
  --txt:#e8edf6; --muted:#8a97b0; --faint:#5b6580;
  --brand:#3d7dff; --brand-2:#5b93ff; --brand-dim:#1c2c4d;
  --green:#25c281; --green-dim:#123227; --amber:#f2b23a; --amber-dim:#332813;
  --red:#f0524d; --red-dim:#331716; --purple:#9d7bff; --cyan:#33c2d6;
  --radius:12px; --shadow:0 4px 24px rgba(0,0,0,.35);
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{background:var(--bg);color:var(--txt);font-family:var(--font);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;overflow:hidden}
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-thumb{background:#2c374f;border-radius:6px}
::-webkit-scrollbar-track{background:transparent}
a{color:inherit;text-decoration:none}
.link{color:var(--brand-2);cursor:pointer;font-weight:600}

/* ===== Auth ===== */
.auth-screen{height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:radial-gradient(1200px 600px at 50% -10%,rgba(61,125,255,.12),transparent),var(--bg)}
.auth-card{background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:30px;width:100%;max-width:400px;box-shadow:var(--shadow)}
.auth-brand{display:flex;align-items:center;gap:12px;margin-bottom:22px}
.auth-brand .logo{width:46px;height:46px;border-radius:11px;background:#fff;display:grid;place-items:center;overflow:hidden;padding:4px;box-shadow:0 2px 10px rgba(0,0,0,.25)}
.auth-brand .logo img{width:100%;height:100%;object-fit:contain}
.auth-brand b{font-size:19px;display:block}
.auth-brand span{font-size:12px;color:var(--muted)}
.auth-tabs{display:flex;gap:4px;background:var(--surface-2);border:1px solid var(--border);padding:4px;border-radius:10px;margin-bottom:20px}
.auth-tab{flex:1;text-align:center;padding:9px;border-radius:7px;font-size:13px;font-weight:600;color:var(--muted);cursor:pointer}
.auth-tab.active{background:var(--brand-dim);color:#cfe0ff}
.auth-btn{width:100%;justify-content:center;padding:12px;margin-top:6px;font-size:14px}
.auth-err{color:var(--red);font-size:12.5px;min-height:18px;margin:2px 0 4px}
.auth-demo{text-align:center;font-size:12px;color:var(--muted);margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}

/* ===== Layout ===== */
.app{display:grid;grid-template-columns:230px 1fr;height:100vh}
.sidebar{background:#0c111b;border-right:1px solid var(--border);display:flex;flex-direction:column;padding:18px 14px}
.brand{display:flex;align-items:center;gap:10px;padding:6px 8px 20px}
.brand .logo{width:36px;height:36px;border-radius:9px;background:#fff;display:grid;place-items:center;overflow:hidden;padding:3px;box-shadow:0 2px 10px rgba(0,0,0,.3)}
.brand .logo img{width:100%;height:100%;object-fit:contain}
.brand .name{font-weight:700;font-size:16px;letter-spacing:-.2px}
.brand .name small{display:block;font-weight:500;font-size:10.5px;color:var(--muted)}
.nav{display:flex;flex-direction:column;gap:3px;margin-top:6px}
.nav-label{font-size:10.5px;text-transform:uppercase;letter-spacing:.8px;color:#5b6580;padding:14px 10px 6px;font-weight:600}
.nav-item{display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:9px;color:var(--muted);cursor:pointer;font-weight:500;font-size:13.5px;transition:.15s;position:relative}
.nav-item:hover{background:var(--surface);color:var(--txt)}
.nav-item.active{background:var(--brand-dim);color:#cfe0ff}
.nav-item.active::before{content:"";position:absolute;left:-14px;top:8px;bottom:8px;width:3px;border-radius:2px;background:var(--brand)}
.nav-item svg{width:18px;height:18px;flex-shrink:0}
.nav-item .badge{margin-left:auto;background:var(--red);color:#fff;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:20px}
.nav-item .badge.gray{background:var(--surface-2);color:var(--muted)}
.sidebar-foot{margin-top:auto;padding-top:14px;border-top:1px solid var(--border)}
.user{display:flex;align-items:center;gap:10px;padding:8px}
.avatar{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,#33c2d6,#3d7dff);display:grid;place-items:center;font-weight:700;font-size:12px;color:#fff;flex-shrink:0}
.user .meta{overflow:hidden;flex:1}
.user .meta b{font-size:13px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user .meta span{font-size:11px;color:var(--muted)}
.logout{color:var(--muted);cursor:pointer;width:30px;height:30px;display:grid;place-items:center;border-radius:8px}
.logout:hover{background:var(--surface);color:var(--red)}
.logout svg{width:16px;height:16px}

.main{display:flex;flex-direction:column;overflow:hidden}
.topbar{height:60px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:16px;padding:0 24px;flex-shrink:0}
.topbar h1{font-size:17px;font-weight:650;letter-spacing:-.3px}
.topbar .sub{color:var(--muted);font-size:12.5px}
.twilio-banner{margin-left:auto;font-size:11.5px;font-weight:600;padding:5px 11px;border-radius:20px;display:flex;align-items:center;gap:6px}
.twilio-banner.live{background:var(--green-dim);color:var(--green)}
.twilio-banner.sim{background:var(--amber-dim);color:var(--amber)}
.twilio-banner::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.search{position:relative}
.search input{background:var(--surface);border:1px solid var(--border);border-radius:9px;padding:8px 12px 8px 34px;color:var(--txt);width:200px;font-size:13px;outline:none;font-family:var(--font)}
.search input:focus{border-color:var(--brand)}
.search svg{position:absolute;left:10px;top:9px;width:15px;height:15px;color:var(--muted)}
.content{flex:1;overflow-y:auto;padding:24px}
.view{display:none;animation:fade .25s ease}
.view.active{display:block}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.btn{display:inline-flex;align-items:center;gap:7px;background:var(--brand);color:#fff;border:none;border-radius:9px;padding:9px 15px;font-size:13px;font-weight:600;cursor:pointer;font-family:var(--font);transition:.15s}
.btn:hover{background:var(--brand-2)}
.btn:disabled{opacity:.6;cursor:default}
.btn.ghost{background:var(--surface);color:var(--txt);border:1px solid var(--border)}
.btn.ghost:hover{border-color:#3a4a6a;background:var(--surface-2)}
.btn.sm{padding:6px 11px;font-size:12px}
.btn svg{width:15px;height:15px}
.pill{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;font-size:11.5px;font-weight:600;white-space:nowrap}
.pill::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.pill.green{background:var(--green-dim);color:var(--green)}
.pill.amber{background:var(--amber-dim);color:var(--amber)}
.pill.red{background:var(--red-dim);color:var(--red)}
.pill.blue{background:var(--brand-dim);color:var(--brand-2)}
.pill.gray{background:var(--surface-2);color:var(--muted)}
.pill.purple{background:#241d3d;color:var(--purple)}

.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:22px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
.kpi{padding:18px;transition:border-color .15s,transform .15s}
.kpi[onclick]:hover{border-color:var(--brand);transform:translateY(-1px)}
.kpi .top{display:flex;justify-content:space-between;align-items:flex-start}
.kpi .icon{width:36px;height:36px;border-radius:9px;display:grid;place-items:center}
.kpi .icon svg{width:19px;height:19px}
.kpi .label{color:var(--muted);font-size:12.5px;font-weight:500;margin-top:12px}
.kpi .val{font-size:27px;font-weight:750;letter-spacing:-1px;margin-top:2px}
.kpi .delta{font-size:11.5px;font-weight:600;margin-top:5px;color:var(--green)}

.grid-2{display:grid;grid-template-columns:1.5fr 1fr;gap:16px}
.panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.panel-head{padding:15px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.panel-head h3{font-size:14.5px;font-weight:650}
.panel-body{padding:6px 0}
.feed-item{display:flex;gap:12px;padding:11px 18px;align-items:flex-start}
.feed-item:hover{background:var(--surface-2)}
.feed-ic{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;flex-shrink:0;margin-top:1px}
.feed-ic svg{width:15px;height:15px}
.feed-item .body{flex:1;min-width:0}
.feed-item .body p{font-size:13px}
.feed-item .time{color:var(--faint);font-size:11.5px;white-space:nowrap}

table{width:100%;border-collapse:collapse}
th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);font-weight:600;padding:11px 18px;border-bottom:1px solid var(--border)}
td{padding:13px 18px;border-bottom:1px solid var(--border);font-size:13px;vertical-align:middle}
tr:last-child td{border-bottom:none}
tbody tr{cursor:pointer;transition:.12s}
tbody tr:hover{background:var(--surface-2)}
.load-id{font-weight:700;color:#cfe0ff;font-family:ui-monospace,monospace;font-size:12.5px}
.route{display:flex;align-items:center;gap:7px}
.route .arrow{color:var(--faint)}
.mini-driver{display:flex;align-items:center;gap:9px}
.mini-driver .avatar{width:28px;height:28px;font-size:11px}
.mini-driver small{color:var(--muted);font-size:11.5px;display:block}
.empty{text-align:center;padding:50px 20px;color:var(--muted)}

/* Messaging */
.msg-layout{display:grid;grid-template-columns:290px 1fr 280px;height:calc(100vh - 60px - 48px);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.thread-list{border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden}
.thread-search{padding:12px;border-bottom:1px solid var(--border)}
.thread-search input{width:100%;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:8px 12px;color:var(--txt);font-size:12.5px;outline:none;font-family:var(--font)}
.threads{overflow-y:auto;flex:1}
.thread{display:flex;gap:11px;padding:12px 14px;cursor:pointer;border-bottom:1px solid rgba(40,50,74,.5);position:relative}
.thread:hover{background:var(--surface-2)}
.thread.active{background:var(--brand-dim)}
.thread.active::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--brand)}
.thread .avatar{position:relative}
.thread .avatar .status{position:absolute;bottom:-1px;right:-1px;width:10px;height:10px;border-radius:50%;border:2px solid var(--surface)}
.status.on{background:var(--green)} .status.off{background:#5b6580}
.thread .info{flex:1;min-width:0}
.thread .info .row1{display:flex;justify-content:space-between;align-items:baseline}
.thread .info b{font-size:13px;font-weight:600}
.thread .info .t{font-size:10.5px;color:var(--faint)}
.thread .info .preview{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.thread .unread{background:var(--brand);color:#fff;font-size:10px;font-weight:700;min-width:18px;height:18px;padding:0 5px;border-radius:10px;display:grid;place-items:center;margin-left:6px}
.chat{display:flex;flex-direction:column;overflow:hidden}
.chat-head{padding:13px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px;min-height:62px}
.chat-head .info{flex:1}
.chat-head .info b{font-size:14px}
.chat-head .info small{font-size:11.5px;font-weight:500}
.chat-head .actions{display:flex;gap:8px}
.chat-body{flex:1;overflow-y:auto;padding:20px 18px;display:flex;flex-direction:column;gap:10px}
.bubble{max-width:74%;padding:9px 13px;border-radius:15px;font-size:13px;line-height:1.45;word-wrap:break-word;flex-shrink:0}
.bubble .bt{font-size:10px;color:var(--faint);margin-top:4px;display:block}
.bubble.in{align-self:flex-start;background:var(--surface-2);border-bottom-left-radius:4px}
.bubble.out{align-self:flex-end;background:var(--brand);color:#fff;border-bottom-right-radius:4px}
.bubble.out .bt{color:rgba(255,255,255,.6)}
.bubble.system{align-self:center;background:transparent;border:1px dashed var(--border);color:var(--muted);font-size:11.5px;padding:6px 12px;border-radius:8px;text-align:center;max-width:85%}
.bubble.card-msg{background:var(--surface-2);border:1px solid var(--border);padding:0;overflow:hidden;max-width:250px}
.bubble.card-msg .map-strip{height:80px;background:#1a2438;display:grid;place-items:center;color:var(--muted);font-size:11px}
.bubble.card-msg img{width:100%;display:block}
.bubble.card-msg .cm-body{padding:9px 13px}
.bubble.card-msg .cm-body .cm-sub{display:block;color:var(--brand-2,#6aa0ff);font-size:11px;margin-top:2px}
.bubble.card-msg .loc-thumb{position:relative;width:248px;height:132px;overflow:hidden;background:#0e1116;pointer-events:none}
.bubble.card-msg .loc-thumb img{position:absolute;width:256px;height:256px;max-width:none;display:block}
.bubble.card-msg .loc-pin{position:absolute;left:50%;top:50%;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;background:#e5484d;border:2px solid #fff;box-shadow:0 0 0 4px rgba(229,72,77,.28);z-index:2}
.loc-card{cursor:pointer;max-width:250px}

/* ===== Admin dashboard ===== */
.admin-tabs{display:flex;align-items:center;gap:6px;border-bottom:1px solid var(--border);margin-bottom:16px}
.admin-tabs .atab{padding:9px 14px;font-size:13.5px;font-weight:600;color:var(--muted);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px}
.admin-tabs .atab:hover{color:var(--txt)}
.admin-tabs .atab.active{color:var(--brand-2,#6aa0ff);border-bottom-color:var(--brand,#3d7dff)}
.admin-live-dot{margin-left:auto;font-size:11px;font-weight:700;color:var(--green);transition:opacity .3s}
.live-strip{display:flex;flex-wrap:wrap;gap:10px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:14px 8px;margin-bottom:16px}
.live-strip .ls-cell{flex:1;min-width:120px;text-align:center;padding:4px 8px;border-right:1px solid var(--border)}
.live-strip .ls-cell:last-child{border-right:none}
.live-strip .ls-val{font-size:22px;font-weight:750;line-height:1.1}
.live-strip .ls-lbl{font-size:11px;color:var(--muted);margin-top:3px}
#view-admin .kpi .val{font-size:24px}
#view-admin .pill.red{background:rgba(255,93,93,.16);color:#ff6b6b}
#view-admin .grid-2{margin-bottom:16px}
.chat-input{padding:12px 16px;border-top:1px solid var(--border)}
.templates{display:flex;gap:7px;margin-bottom:10px;flex-wrap:wrap}
.tpl{font-size:11.5px;background:var(--surface-2);border:1px solid var(--border);color:var(--muted);padding:5px 11px;border-radius:20px;cursor:pointer;transition:.12s}
.tpl:hover{border-color:var(--brand);color:#cfe0ff}
.input-row{display:flex;gap:10px;align-items:flex-end}
.input-row .box{flex:1;background:var(--surface-2);border:1px solid var(--border);border-radius:11px;display:flex;align-items:center;padding:2px 14px}
.input-row textarea{flex:1;background:none;border:none;color:var(--txt);font-family:var(--font);font-size:13.5px;resize:none;outline:none;padding:10px 0;max-height:100px;line-height:1.4}
.send-btn{width:40px;height:40px;border-radius:11px;background:var(--brand);border:none;display:grid;place-items:center;color:#fff;cursor:pointer;flex-shrink:0}
.send-btn:hover{background:var(--brand-2)}
.send-btn svg{width:18px;height:18px}
.ctx{border-left:1px solid var(--border);overflow-y:auto;padding:18px}
.ctx h4{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:18px 0 9px;font-weight:600}
.ctx h4:first-child{margin-top:0}
.ctx-card{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:12px;margin-bottom:8px}
.ctx-row{display:flex;justify-content:space-between;font-size:12.5px;padding:4px 0}
.ctx-row span{color:var(--muted)}
.ctx-row b{font-weight:600}
.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.qa{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:11px 8px;text-align:center;cursor:pointer;transition:.14s}
.qa:hover{border-color:var(--brand);background:var(--brand-dim)}
.qa svg{width:19px;height:19px;color:var(--brand-2);margin-bottom:5px}
.qa div{font-size:11.5px;font-weight:600}

/* Tracking */
.track-layout{display:grid;grid-template-columns:320px 1fr;height:calc(100vh - 60px - 48px);gap:16px}
.track-side{display:flex;flex-direction:column;overflow:hidden;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
.track-side .head{padding:14px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.track-side .head h3{font-size:14px}
.track-list{overflow-y:auto;flex:1}
.track-item{padding:13px 16px;border-bottom:1px solid rgba(40,50,74,.5);cursor:pointer;display:flex;gap:11px}
.track-item:hover{background:var(--surface-2)}
.track-item.active{background:var(--brand-dim)}
.track-item .avatar{width:34px;height:34px;font-size:12px}
.track-item .ti{flex:1;min-width:0}
.track-item .ti b{font-size:13px}
.track-item .ti .loc{font-size:11.5px;color:var(--muted);margin-top:2px}
.track-item .ti .updated{font-size:10.5px;margin-top:3px}
.track-map-wrap{position:relative;border-radius:var(--radius);overflow:hidden;border:1px solid var(--border)}
#map{width:100%;height:100%}
.map-legend{position:absolute;bottom:14px;left:14px;z-index:500;background:rgba(12,17,27,.9);border:1px solid var(--border);border-radius:10px;padding:10px 13px;display:flex;flex-direction:column;gap:6px}
.map-legend .lg{display:flex;align-items:center;gap:8px;font-size:11.5px;color:var(--muted)}
.map-legend .lg i{width:10px;height:10px;border-radius:50%;display:block}
.leaflet-popup-content-wrapper{background:var(--surface-2);color:var(--txt);border-radius:10px;border:1px solid var(--border)}
.leaflet-popup-tip{background:var(--surface-2)}
.leaflet-popup-content{margin:11px 13px;font-family:var(--font)}
.pop b{font-size:13px} .pop .r{font-size:12px;color:var(--muted);margin-top:3px}
.truck-marker{width:28px;height:28px;border-radius:50% 50% 50% 4px;transform:rotate(45deg);display:grid;place-items:center;box-shadow:0 3px 10px rgba(0,0,0,.5);border:2px solid #fff}
.truck-marker svg{transform:rotate(-45deg);width:14px;height:14px;color:#fff}

/* Toolbar / tabs */
.toolbar{display:flex;align-items:center;gap:10px;margin-bottom:16px}
.tabs{display:flex;gap:4px;background:var(--surface);border:1px solid var(--border);padding:4px;border-radius:10px}
.tab{padding:7px 14px;border-radius:7px;font-size:12.5px;font-weight:600;color:var(--muted);cursor:pointer}
.tab.active{background:var(--brand-dim);color:#cfe0ff}

/* POD */
.pod-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px}
.pod-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;cursor:pointer;transition:.15s}
.pod-card:hover{border-color:#3a4a6a;transform:translateY(-2px);box-shadow:var(--shadow)}
.pod-img{height:160px;position:relative;overflow:hidden;display:grid;place-items:center}
.pod-img img{width:100%;height:100%;object-fit:cover}
.pod-img .badge-ov{position:absolute;top:10px;left:10px}
.pod-img .drive-badge{position:absolute;top:10px;right:10px;background:rgba(12,17,27,.85);border:1px solid var(--border);color:var(--green);font-size:10.5px;font-weight:700;padding:3px 8px;border-radius:20px}
.pending-pod{background:repeating-linear-gradient(45deg,#161d2c,#161d2c 12px,#141a28 12px,#141a28 24px)}
.pod-info{padding:13px 15px}
.pod-info .r1{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.pod-info .meta{font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:3px}
.pod-info .meta div{display:flex;align-items:center;gap:6px}

/* Modal */
.modal-bg{position:fixed;inset:0;background:rgba(6,9,15,.72);backdrop-filter:blur(3px);z-index:2000;display:none;align-items:center;justify-content:center;padding:24px}
.modal-bg.show{display:flex;animation:fade .2s}
.modal{background:var(--surface);border:1px solid var(--border);border-radius:16px;width:100%;max-width:520px;box-shadow:var(--shadow);max-height:88vh;overflow:hidden;display:flex;flex-direction:column}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-head h3{font-size:16px}
.modal-body{padding:22px;overflow-y:auto}
.modal-x{cursor:pointer;color:var(--muted);width:30px;height:30px;display:grid;place-items:center;border-radius:8px}
.modal-x:hover{background:var(--surface-2);color:var(--txt)}
.field{margin-bottom:15px}
.field label{display:block;font-size:12px;font-weight:600;color:var(--muted);margin-bottom:6px}
.field input,.field select,.field textarea{width:100%;background:var(--surface-2);border:1px solid var(--border);border-radius:9px;padding:10px 12px;color:var(--txt);font-size:13.5px;font-family:var(--font);outline:none}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--brand)}

/* Settings → Integrations */
.intg-inp{width:100%;background:var(--surface-2);border:1px solid var(--border);border-radius:9px;padding:10px 12px;color:var(--txt);font-size:13px;font-family:var(--font);outline:none}
.intg-inp:focus{border-color:var(--brand)}
.intg-row{margin-bottom:15px}
.intg-row .lbl{display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:600;margin-bottom:6px}
.intg-hint{font-size:11.5px;color:var(--muted);margin-top:5px;line-height:1.5}
.intg-ev{display:flex;align-items:center;gap:9px;font-size:13px;padding:6px 0;cursor:pointer}
.intg-ev input,.intg-wa input{width:16px;height:16px;accent-color:var(--brand);cursor:pointer}
.intg-dot{width:8px;height:8px;border-radius:50%;display:inline-block}
.intg-dot.on{background:var(--green)} .intg-dot.off{background:var(--faint)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.modal-foot{padding:16px 22px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px}
.pod-big{width:100%;border-radius:10px;border:1px solid var(--border)}

/* Toast */
.toast-wrap{position:fixed;bottom:22px;right:22px;z-index:3000;display:flex;flex-direction:column;gap:10px}
.toast{background:var(--surface-2);border:1px solid var(--border);border-left:3px solid var(--green);border-radius:10px;padding:13px 16px;display:flex;gap:11px;align-items:center;box-shadow:var(--shadow);min-width:280px;animation:slideIn .3s}
.toast.err{border-left-color:var(--red)}
.toast svg{width:19px;height:19px;color:var(--green);flex-shrink:0}
.toast.err svg{color:var(--red)}
.toast b{font-size:13px;display:block}
.toast small{font-size:11.5px;color:var(--muted)}
@keyframes slideIn{from{transform:translateX(40px);opacity:0}to{transform:none;opacity:1}}

.section-title{font-size:15px;font-weight:650;margin:4px 0 14px}
.demo-tag{position:fixed;bottom:14px;left:14px;font-size:10.5px;color:var(--faint);background:rgba(12,17,27,.8);border:1px solid var(--border);padding:4px 9px;border-radius:20px}
.mono{font-family:ui-monospace,monospace;font-size:12px}
@media (max-width:1100px){.kpis{grid-template-columns:repeat(2,1fr)}.msg-layout{grid-template-columns:260px 1fr}.ctx{display:none}.track-layout{grid-template-columns:1fr;height:auto}.track-map-wrap{height:420px}}

/* ===== Mobile hamburger + drawer scaffolding (hidden on desktop) ===== */
.menu-btn{display:none;background:none;border:none;color:var(--txt);cursor:pointer;width:38px;height:38px;border-radius:9px;align-items:center;justify-content:center;margin-left:-4px;flex-shrink:0}
.menu-btn:hover{background:var(--surface)}
.menu-btn svg{width:22px;height:22px}
.nav-backdrop{display:none}
.table-wrap{width:100%;overflow-x:auto}

/* ===== Phone (≤760px): sidebar becomes a slide-in drawer, everything stacks ===== */
@media (max-width:760px){
  .menu-btn{display:inline-flex}
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;top:0;bottom:0;left:0;width:255px;z-index:1600;transform:translateX(-100%);transition:transform .25s ease;box-shadow:12px 0 44px rgba(0,0,0,.55)}
  .app.nav-open .sidebar{transform:none}
  .nav-backdrop{position:fixed;inset:0;background:rgba(6,9,15,.6);z-index:1550;display:none}
  .app.nav-open .nav-backdrop{display:block}

  .topbar{height:54px;padding:0 12px;gap:10px}
  .topbar h1{font-size:16px}
  .topbar .sub{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42vw}
  .search{display:none}
  .twilio-banner{display:none}
  .topbar .btn{padding:8px 12px;margin-left:auto}
  .content{padding:14px}

  /* Dashboard */
  .kpis{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}
  .kpi{padding:14px}
  .kpi .val{font-size:21px}
  .kpi .icon{width:32px;height:32px}
  .grid-2{grid-template-columns:1fr}

  /* Wide tables scroll horizontally inside their card */
  .table-wrap table{min-width:600px}
  th,td{padding:10px 12px}

  /* Messages: single column, list on top of chat */
  .msg-layout{grid-template-columns:1fr;height:auto;min-height:calc(100vh - 54px - 28px);border-radius:var(--radius)}
  .thread-list{border-right:none;border-bottom:1px solid var(--border);max-height:34vh}
  .chat{min-height:56vh}
  .chat-head{min-height:54px;flex-wrap:wrap}

  /* Tracking: list above map */
  .track-layout{grid-template-columns:1fr;height:auto;gap:12px}
  .track-side{max-height:38vh}
  .track-map-wrap{height:56vh;min-height:340px}

  /* Toolbars / tabs scroll horizontally */
  .toolbar{flex-wrap:wrap;gap:8px}
  .tabs{overflow-x:auto;max-width:100%}
  .tabs::-webkit-scrollbar{height:0}

  /* POD cards single column */
  .pod-grid{grid-template-columns:1fr}

  /* Modals become bottom sheets */
  .modal-bg{padding:0;align-items:flex-end}
  .modal{max-width:100%;max-height:92vh;border-radius:18px 18px 0 0}
  .field-row{grid-template-columns:1fr}
  .modal-foot .btn{flex:1;justify-content:center}

  /* Toasts full-width at the bottom */
  .toast-wrap{left:12px;right:12px;bottom:16px}
  .toast{min-width:0;width:100%}
  .demo-tag{display:none}
}
