/* FloMar — app del cadete. Pensada para una mano, a la intemperie y con el celular que tenga:
   texto grande, botones altos (44px es el mínimo que se toca sin errar) y mucho contraste. */
:root {
    --navy: #0e2a47;
    --gold: #c39a4d;
    --bg: #f4f6f8;
    --card: #fff;
    --line: #dfe5ea;
    --muted: #667381;
    --green: #16a672;
    --red: #cf4d46;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    background: var(--bg);
    color: #16232e;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
}

.c-top {
    display: flex; align-items: center; gap: .5rem;
    background: var(--navy); color: #fff;
    padding: calc(env(safe-area-inset-top) + .6rem) .9rem .6rem;
    position: sticky; top: 0; z-index: 10;
}
.c-brand { font-weight: 700; letter-spacing: .2px; }
.c-spacer { flex: 1; }
.c-net { font-size: 1.1rem; line-height: 1; }
.c-net.on { color: #6fe0a6; }
.c-net.off { color: #ffb4b0; }

.c-main { padding: .8rem .8rem calc(env(safe-area-inset-bottom) + 2rem); max-width: 640px; margin: 0 auto; }
.c-loading { text-align: center; color: var(--muted); padding: 2rem 0; }

/* ---------- tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; margin-bottom: .7rem; }
.card h2 { margin: 0 0 .2rem; font-size: 1.05rem; }

.parada { display: flex; gap: .7rem; align-items: flex-start; }
.parada .n {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
    background: var(--navy); color: #fff; font-weight: 800;
    display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.parada .cuerpo { flex: 1; min-width: 0; }
.cliente { font-weight: 700; font-size: 1.05rem; }
.dir { color: var(--muted); font-size: .92rem; margin-top: .1rem; word-break: break-word; }
.dir.falta { color: var(--red); }

.plata { font-weight: 800; font-size: 1.15rem; margin-top: .35rem; }
.plata.cobrar { color: var(--navy); }
.plata.pagado { color: var(--green); font-size: 1rem; }

.chips { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .4rem; }
.chip { font-size: .74rem; padding: .12rem .5rem; border-radius: 999px; background: #eef2f6; color: #44525f; }
.chip.gold { background: #f6edd9; color: #7c5d1e; }

.acciones { display: flex; gap: .5rem; margin-top: .6rem; }
.btn {
    flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; color: #16232e; font-size: .95rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    text-decoration: none; cursor: pointer;
}
.btn.tel { border-color: #cfe0d6; color: #0b6b4a; }
.btn.wa { border-color: #bfe8cd; color: #128c7e; }
.btn.mapa { border-color: #cdd9ea; color: #23507f; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn:disabled { opacity: .55; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 8vh auto 0; }
.field { margin-bottom: .7rem; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; }
.field input {
    width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px;
    padding: .5rem .7rem; font-size: 1.05rem; background: #fff; color: inherit;
}
.aviso { border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; margin-bottom: .7rem; }
.aviso.error { background: #fdeaea; border: 1px solid #f0b4b4; color: var(--red); }
.aviso.ok { background: #e8f7f0; border: 1px solid #b7e5d0; color: #0b6b4a; }
.aviso.info { background: #eef2f6; border: 1px solid var(--line); color: #44525f; }

.vacio { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.vacio .grande { font-size: 2.4rem; }

.pie { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1.2rem; }
.pie button { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: .8rem; }

/* ---------- qué lleva el pedido ---------- */
/* Va plegado detrás de un botón: en la calle lo primero es a quién y dónde, no el detalle. */
.items { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .45rem; }
.item {
    display: grid; grid-template-columns: 1fr auto auto; gap: .1rem .6rem;
    align-items: baseline; padding: .32rem 0; border-bottom: 1px solid #eef1f4;
}
.item:last-of-type { border-bottom: none; }
.it-nom { font-size: .92rem; }
.it-obs { color: var(--muted); font-size: .82rem; }
.it-cant { font-size: .92rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.it-cant.pesado { color: var(--green); }
.it-tag {
    display: inline-block; margin-left: .3rem; font-size: .64rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--green); background: #e8f7f0; border-radius: 5px; padding: .06rem .28rem;
    vertical-align: middle;
}
.it-sub { font-size: .92rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- firma del cliente ---------- */
.firma-wrap { max-width: 520px; margin: 0 auto; }
.firma-caja {
    position: relative; height: 190px; border: 2px dashed var(--line); border-radius: 12px;
    background: #fff; overflow: hidden;
}
/* touch-action: el navegador tiene que dejar de hacer scroll cuando el dedo arrastra sobre la firma;
   sin esto, firmar mueve la página y no dibuja nada. */
.firma-caja canvas { display: block; touch-action: none; cursor: crosshair; }
.firma-pista {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: .95rem; pointer-events: none; text-align: center; padding: 0 1rem;
}
.firma-pista.alerta { color: var(--red); font-weight: 600; }
