:root{
  --bg:#07111f;--panel:#0d1728;--card:#111c30;--card2:#ffffff;
  --line:#25324a;--blue:#1976ff;--violet:#612cff;--cyan:#22d3ee;
  --green:#16a34a;--red:#ef4444;--orange:#f59e0b;--muted:#94a3b8;
  --text:#f8fafc;--dark:#07111f;
}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:radial-gradient(circle at top,#10254a,#07111f 48%,#030712);color:var(--text)}
button,input,select,textarea{font:inherit}
button{border:0;border-radius:16px;padding:13px 15px;font-weight:850;background:linear-gradient(135deg,var(--blue),var(--violet));color:white;cursor:pointer;transition:transform .1s,box-shadow .15s}
button:active{transform:scale(.97)}
button.light{background:#101a2d;border:1px solid var(--line);color:#dbeafe}
button.green{background:linear-gradient(135deg,#16a34a,#22c55e)}
button.orange{background:#f59e0b;color:#111827}
button.red{background:#ef4444}
input,select,textarea{width:100%;border:1px solid #263852;background:#0b1628;color:#f8fafc;border-radius:17px;padding:14px;outline:none;transition:border-color .2s}
input:focus,select:focus,textarea:focus{border-color:var(--blue)}
textarea{min-height:92px;resize:vertical;white-space:pre-wrap}
label{font-size:13px;font-weight:850;color:#dbeafe;display:block;margin-bottom:7px}
small{color:var(--muted)}
a{color:#60a5fa;font-weight:850}

/* Login & Public form */
.login,.public{min-height:100vh;display:grid;place-items:center;padding:18px}
.card{background:linear-gradient(180deg,rgba(17,28,48,.96),rgba(9,18,34,.96));border:1px solid #263852;border-radius:30px;padding:20px;box-shadow:0 24px 70px rgba(0,0,0,.35);width:100%;max-width:650px}
.logo-img{display:block;width:190px;max-width:70%;margin:0 auto 12px;border-radius:22px}
.brand{text-align:center;margin-bottom:18px}
.brand h1{margin:0;font-size:34px;letter-spacing:.06em}
.brand p{margin:4px 0 0;color:#60a5fa;text-transform:uppercase;letter-spacing:.18em;font-weight:850}
.field{margin-bottom:14px}
.pass-wrap{position:relative}.pass-wrap input{padding-right:54px}.eye{position:absolute;right:8px;top:8px;width:42px;height:42px;border-radius:14px;background:#14233a;color:#93c5fd;padding:0}
.quick{margin-top:14px;border-top:1px solid #25324a;padding-top:12px}
.quick a{display:flex;align-items:center;justify-content:space-between;text-decoration:none;background:#0b1628;border:1px solid #263852;border-radius:18px;padding:15px}

/* Admin panel */
.app{min-height:100vh;padding-bottom:92px;background:#f3f7ff;color:#07111f}
.header{background:linear-gradient(135deg,#07111f,#10254a);color:white;padding:18px 16px 28px;border-radius:0 0 30px 30px}
.header-row{display:flex;align-items:center;gap:12px}.mini-logo{width:56px;height:56px;border-radius:18px;object-fit:cover}.header h1{margin:18px 0 2px;font-size:32px;letter-spacing:-.04em}.header p{margin:0;color:#bfdbfe}
.main{padding:16px;max-width:980px;margin:auto}
.white-card{background:white;border:1px solid #e5e7eb;border-radius:26px;padding:17px;box-shadow:0 18px 45px rgba(15,23,42,.10);margin-bottom:15px}
.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:-34px}.stat b{font-size:30px;display:block}.stat span{font-size:12px;color:#667085;font-weight:850}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.full{grid-column:1/-1}
.app input,.app select,.app textarea,.public input,.public select,.public textarea{background:white;color:#07111f;border-color:#d8e1ee}
.public label{color:#344054}.public .card{background:white;color:#07111f;border-color:#e5e7eb}.public small{color:#667085}
.actions{display:flex;gap:8px;flex-wrap:wrap}.actions button{flex:1 1 130px}
.bottom{position:fixed;left:12px;right:12px;bottom:12px;background:rgba(255,255,255,.92);backdrop-filter:blur(18px);border:1px solid #e5e7eb;border-radius:26px;padding:8px;display:grid;grid-template-columns:repeat(5,1fr);gap:6px;box-shadow:0 20px 60px rgba(15,23,42,.22);z-index:100}
.bottom button{background:transparent;color:#667085;padding:9px 4px;font-size:11px;display:grid;gap:2px;box-shadow:none}
.bottom button b{font-size:18px}.bottom button.active{background:linear-gradient(135deg,var(--blue),var(--violet));color:white}
.order{background:white;border:1px solid #e5e7eb;border-radius:24px;padding:15px;margin-bottom:12px}
.order-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}.client{font-size:18px;font-weight:950}.meta{font-size:13px;color:#667085}
.badge{border-radius:999px;padding:7px 11px;font-size:12px;font-weight:950;background:#e0f2fe;color:#075985;white-space:nowrap}.enruta{background:#fef3c7;color:#92400e}.entregado{background:#dcfce7;color:#166534}.cancelado{background:#fee2e2;color:#991b1b}.nuevo{background:#e0f2fe;color:#075985}
.line{display:flex;justify-content:space-between;gap:10px;background:#f8fafc;border:1px solid #edf2f7;border-radius:18px;padding:12px;margin:10px 0;align-items:center}
.total{border:1px dashed #cbd5e1;background:#f8fafc;border-radius:19px;padding:13px;display:grid;gap:7px}.total div{display:flex;justify-content:space-between}.final{font-weight:950;font-size:18px;border-top:1px solid #e5e7eb;padding-top:8px}
.empty{text-align:center;color:#667085;padding:26px;border:1px dashed #cbd5e1;border-radius:22px;background:white}
.notice{padding:14px;border-radius:18px;background:#ecfdf5;color:#166534;border:1px solid #bbf7d0}

/* Loading */
.loader{text-align:center;padding:40px;color:#667085}
.loader::after{content:'';display:block;width:32px;height:32px;margin:12px auto;border:3px solid #e5e7eb;border-top-color:var(--blue);border-radius:50%;animation:spin .6s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* Modal */
.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.5);display:grid;place-items:center;z-index:200;padding:16px}
.modal{background:white;border-radius:26px;padding:22px;width:100%;max-width:500px;max-height:90vh;overflow-y:auto;box-shadow:0 24px 70px rgba(0,0,0,.3)}
.modal h2{margin:0 0 16px;font-size:22px}
.modal .field{margin-bottom:12px}
.modal .actions{margin-top:16px}
.modal .grid{margin-bottom:12px}
.modal input,.modal select,.modal textarea{background:white;color:#07111f;border-color:#d8e1ee}
.modal label{color:#344054}

/* Toast */
.toast{position:fixed;top:20px;left:50%;transform:translateX(-50%);background:#166534;color:white;padding:12px 24px;border-radius:16px;font-weight:700;z-index:300;box-shadow:0 8px 30px rgba(0,0,0,.3);animation:toastIn .3s ease;max-width:90vw;text-align:center}
.toast.error{background:#ef4444}
@keyframes toastIn{from{opacity:0;transform:translateX(-50%) translateY(-20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}

/* Custom checkbox for driver */
.driver-check{position:relative;display:flex;align-items:flex-start;cursor:pointer;padding-top:4px}
.driver-check input{position:absolute;opacity:0;width:0;height:0}
.checkmark{width:28px;height:28px;min-width:28px;background:#f1f5f9;border:2px solid #cbd5e1;border-radius:10px;display:flex;align-items:center;justify-content:center;transition:all .2s}
.driver-check input:checked~.checkmark{background:linear-gradient(135deg,var(--blue),var(--violet));border-color:transparent}
.driver-check input:checked~.checkmark::after{content:'\2713';color:white;font-size:16px;font-weight:900}

/* ═══ DRIVER PAGE — premium cards ═══ */
.drv-order{background:white;border:1px solid #e5e7eb;border-radius:24px;padding:16px;margin-bottom:14px;cursor:grab;transition:box-shadow .2s,border-color .2s,transform .15s}
.drv-order:active{cursor:grabbing}
.drv-order[draggable="true"]:hover{border-color:var(--blue);box-shadow:0 8px 28px rgba(25,118,255,.14)}

.drv-addr{font-size:14px;color:#475569;line-height:1.5;padding:4px 0}
.drv-ref{font-size:13px;color:#92400e;font-weight:600;background:#fffbeb;border:1px solid #fef3c7;border-radius:12px;padding:8px 12px;margin:6px 0}
.driver-ref{font-size:13px;color:#92400e;font-weight:600;background:#fffbeb;border:1px solid #fef3c7;border-radius:12px;padding:8px 12px;margin:6px 0}

.drv-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}

.drv-btn{display:flex;align-items:center;justify-content:center;gap:6px;border:0;border-radius:16px;padding:14px 12px;font-weight:800;font-size:14px;cursor:pointer;transition:transform .1s,box-shadow .15s;color:white}
.drv-btn:active{transform:scale(.96)}
.drv-btn span{font-size:16px}

.drv-maps{background:linear-gradient(135deg,var(--blue),var(--violet))}
.drv-maps-exact{background:linear-gradient(135deg,#7c3aed,#a855f7);grid-column:1/-1}
.drv-call{background:#101a2d;border:1px solid #263852;color:#dbeafe}
.drv-wa{background:linear-gradient(135deg,#16a34a,#22c55e)}
.drv-delivered{background:linear-gradient(135deg,#f59e0b,#fbbf24);color:#111827;grid-column:1/-1;font-size:16px;padding:16px}

@media(max-width:720px){
  .grid,.stats{grid-template-columns:1fr}
  .brand h1{font-size:30px}
  .logo-img{width:170px}
  .drv-actions{grid-template-columns:1fr 1fr}
  .drv-btn{padding:12px 8px;font-size:13px}
}
