/* ============================================================
   Sitio de Choferes — mobile-first (uso en la calle, una mano, sol).
   Botones grandes (>=52px), alto contraste, una columna, tarjetas.
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
    --brand: #00b894; --brand-d: #00a383;   /* verde ITAGE (marca) */
    --green: #1a9e6f; --green-d: #158a60;    /* Aceptar: verde más oscuro, se distingue del header */
    --red: #e17055; --red-d: #d15f45;
    --blue: #0984e3;
    --ink: #1e293b; --muted: #64748b; --line: #e6eaf0; --bg: #f4f6f9;
}
html, body { background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 400; vertical-align: middle; }

/* Header sticky */
#chofer-header {
    position: sticky; top: 0; z-index: 10;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.hd-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.hd-left > .material-symbols-rounded { font-size: 28px; flex: 0 0 auto; }
.hd-left > div { min-width: 0; }
.hd-title { font-weight: 800; font-size: 1.05rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-sub { font-size: 0.8rem; opacity: .9; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Grupo derecho: logo + botón salir, juntos, sin solaparse con el nombre. */
.hd-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.hd-logo { height: 34px; width: auto; object-fit: contain; opacity: .97; }
.hd-logout { background: rgba(255,255,255,.18); border: none; color: #fff; width: 42px; height: 42px; border-radius: 12px; font-size: 22px; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }

#chofer-main { padding: 16px 14px 40px; max-width: 640px; margin: 0 auto; }
.c-loading { text-align: center; color: var(--muted); padding: 48px 0; }

/* Bloque de turno (cuando NO hay turno abierto) */
.shift-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px 18px; text-align: center; box-shadow: 0 1px 4px rgba(16,24,40,.04); }
.shift-box h2 { font-size: 1.15rem; margin-bottom: 6px; }
.shift-box p { color: var(--muted); font-size: 0.92rem; margin-bottom: 18px; }

/* Selector de camión (grande, táctil) */
.truck-pick { display: grid; gap: 10px; margin-bottom: 18px; }
.truck-opt {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 16px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
    font-size: 1.05rem; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left;
}
.truck-opt .material-symbols-rounded { font-size: 26px; color: var(--brand); }
.truck-opt.sel { border-color: var(--brand); background: #e6fff6; }
.truck-opt:disabled { opacity: .5; }
.truck-opt small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; }

/* Botones grandes */
.btn-xl {
    width: 100%; border: none; border-radius: 14px; color: #fff;
    font-size: 1.1rem; font-weight: 700; padding: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 56px;
}
.btn-xl:active { transform: translatey(1px); }
.btn-xl .material-symbols-rounded { font-size: 24px; }
.btn-brand { background: var(--brand); } .btn-brand:active { background: var(--brand-d); }
.btn-green { background: var(--green); } .btn-green:active { background: var(--green-d); }
.btn-red   { background: var(--red); }   .btn-red:active { background: var(--red-d); }
.btn-blue  { background: var(--blue); }
.btn-ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); }

/* Barra de turno activo (mini, arriba de la lista) */
.shift-bar { display: flex; align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.shift-bar .sb-truck { font-weight: 700; }
.shift-bar .sb-truck small { display:block; font-weight:400; color: var(--muted); font-size: 0.76rem; }
.shift-bar .sb-end { background: none; border: 1px solid var(--red); color: var(--red); border-radius: 10px; padding: 8px 12px; font-size: 0.82rem; font-weight: 600; cursor: pointer; }

/* Contador de pedidos */
.orders-count { font-size: 0.86rem; color: var(--muted); margin: 4px 2px 12px; font-weight: 600; }

/* Tarjeta de pedido */
.order-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(16,24,40,.05); }
.oc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.oc-num { font-weight: 800; font-size: 1.05rem; }
.oc-badge { font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge-assigned { background: #e6fff6; color: #00916f; }
.badge-accepted { background: #d1fae5; color: #047857; }
.oc-addr { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.oc-comuna { color: var(--muted); font-weight: 500; }
.oc-ref { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.oc-line { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; margin-top: 8px; color: #334155; }
.oc-line .material-symbols-rounded { font-size: 20px; color: var(--muted); }
.oc-total { font-weight: 800; font-size: 1.1rem; }
.oc-map { display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--blue); font-weight: 700; border: 2px solid #d6ebff; border-radius: 12px; padding: 12px; margin-top: 12px; }
.oc-actions { display: grid; gap: 8px; margin-top: 12px; }
.oc-actions.two { grid-template-columns: 1fr 1fr; }

/* Empty state */
.c-empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.c-empty .material-symbols-rounded { font-size: 52px; color: #cbd5e1; display: block; margin-bottom: 10px; }

/* Modal (rechazo) */
.c-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: flex-end; z-index: 50; }
.c-sheet { background: #fff; width: 100%; border-radius: 20px 20px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px); }
.c-sheet h3 { font-size: 1.1rem; margin-bottom: 4px; }
.c-sheet p { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.c-sheet textarea { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px; font-size: 1rem; font-family: inherit; resize: vertical; min-height: 90px; outline: none; }
.c-sheet textarea:focus { border-color: var(--brand); }
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.reason-chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; cursor: pointer; }
.reason-chip:active { background: #e6fff6; border-color: var(--brand); }

/* Toast */
.c-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px); background: #1e293b; color: #fff; padding: 14px 20px; border-radius: 12px; font-size: 0.92rem; font-weight: 600; opacity: 0; transition: all .25s; z-index: 60; max-width: 90%; text-align: center; }
.c-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.c-toast.err { background: var(--red); }

/* Pantalla de "no eres chofer / sin sesión" */
.c-gate { text-align: center; padding: 60px 24px; color: var(--muted); }
.c-gate .material-symbols-rounded { font-size: 56px; color: #cbd5e1; display: block; margin-bottom: 12px; }
