:root {
  --fondo: #f4f6f9; --tarjeta: #fff; --texto: #14181f; --suave: #5b6472; --borde: #d9dee6;
  --azul: #1d4ed8; --azul-2: #e8eefc; --verde: #15803d; --verde-2: #e6f4ea; --rojo: #b42318; --rojo-2: #fdecea;
  --ambar: #a15c00; --ambar-2: #fff4e0; --radio: 14px; --sombra: 0 1px 3px rgba(16, 24, 40, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0f141b; --tarjeta: #18202a; --texto: #e8edf3; --suave: #9aa5b4; --borde: #2b3542;
    --azul: #6b9bff; --azul-2: #1b2a47; --verde: #4ec27a; --verde-2: #173324; --rojo: #ff7b6e; --rojo-2: #3a1c1a;
    --ambar: #f3b351; --ambar-2: #3a2c14; --sombra: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 96px; }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--tarjeta); border-bottom: 1px solid var(--borde); }
.marca { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.marca span { color: var(--suave); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.volver, .menu { border: 0; background: none; color: var(--azul); font-size: 17px; padding: 8px; min-height: 44px; cursor: pointer; }
.menu { font-size: 24px; line-height: 1; }
.menuPanel { position: fixed; right: 10px; top: 60px; z-index: 6; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.15); min-width: 230px; overflow: hidden; }
.menuPanel button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--texto); padding: 14px 16px; font-size: 16px; cursor: pointer; }
.menuPanel button + button { border-top: 1px solid var(--borde); }
h1 { font-size: 22px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 18px 0 8px; }
p { margin: 6px 0; }
.suave { color: var(--suave); font-size: 14px; }
.cargando { color: var(--suave); text-align: center; padding: 40px 0; }
.botones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.boton-grande { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; min-height: 112px; padding: 14px;
  border: 1px solid var(--borde); border-radius: var(--radio); background: var(--tarjeta); color: var(--texto); box-shadow: var(--sombra); font-size: 19px; font-weight: 650; text-align: left; cursor: pointer; }
.boton-grande .ico { font-size: 30px; line-height: 1; }
.boton-grande small { font-size: 13px; font-weight: 400; color: var(--suave); }
.boton-grande.destacado { border-color: var(--azul); background: var(--azul-2); }
.contador { display: inline-block; min-width: 24px; padding: 1px 8px; border-radius: 99px; background: var(--rojo); color: #fff; font-size: 14px; text-align: center; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px; margin: 10px 0; box-shadow: var(--sombra); }
label { display: block; font-weight: 600; font-size: 15px; margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--texto); background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azul); outline-offset: 1px; }
textarea { min-height: 70px; }
.fila { display: flex; gap: 8px; align-items: flex-end; }
.fila > * { flex: 1; min-width: 0; }
.fila > .angosto { flex: 0 0 92px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--tarjeta); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.verde { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.peligro { color: var(--rojo); border-color: var(--rojo); }
.btn.ancho { width: 100%; margin-top: 16px; }
.btn.chico { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.acciones .btn { flex: 1; }
.foto-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 150px; border: 2px dashed var(--azul);
  border-radius: var(--radio); background: var(--azul-2); color: var(--azul); font-size: 18px; font-weight: 650; cursor: pointer; text-align: center; padding: 12px; }
.foto-btn .ico { font-size: 40px; }
.foto-btn input { display: none; }
.miniaturas { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.miniaturas img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--borde); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); border-radius: 99px; padding: 9px 14px; font: inherit; font-size: 15px; cursor: pointer; min-height: 40px; }
.chip.si { background: var(--azul); border-color: var(--azul); color: #fff; }
.selector { position: relative; }
.selector .lista { max-height: 260px; overflow: auto; border: 1px solid var(--borde); border-radius: 10px; margin-top: 6px; background: var(--tarjeta); }
.selector .lista button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--texto); padding: 12px; font: inherit; cursor: pointer; }
.selector .lista button + button { border-top: 1px solid var(--borde); }
.selector .elegido { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--azul); border-radius: 10px; background: var(--azul-2); font-weight: 600; }
.selector .elegido button { border: 0; background: none; color: var(--azul); font: inherit; cursor: pointer; padding: 4px; }
.estado { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--azul-2); color: var(--azul); white-space: nowrap; }
.estado.ok { background: var(--verde-2); color: var(--verde); }
.estado.mal { background: var(--rojo-2); color: var(--rojo); }
.estado.espera { background: var(--ambar-2); color: var(--ambar); }
.item { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item + .item { border-top: 1px solid var(--borde); margin-top: 10px; padding-top: 10px; }
.monto { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.aviso { position: fixed; left: 12px; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 9; max-width: 616px; margin: 0 auto;
  display: flex; gap: 10px; align-items: center; background: #14181f; color: #fff; padding: 14px 16px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.aviso.error { background: var(--rojo); }
.aviso span { flex: 1; }
.aviso button { border: 0; background: none; color: #9cc0ff; font: inherit; font-weight: 700; cursor: pointer; min-height: 40px; }
.aviso.error button { color: #fff; text-decoration: underline; }
.alerta { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.alerta.ambar { background: var(--ambar-2); color: var(--ambar); }
.alerta.azul { background: var(--azul-2); color: var(--azul); }
.barra-costo { height: 10px; border-radius: 99px; background: var(--azul-2); overflow: hidden; margin: 8px 0 4px; display: flex; }
.barra-costo i { display: block; height: 100%; }
.barra-costo .g { background: var(--verde); }
.barra-costo .c { background: var(--azul); }
.barra-costo.pasado .g, .barra-costo.pasado .c { background: var(--rojo); }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 13px; color: var(--suave); }
.cifras b { display: block; color: var(--texto); font-size: 15px; font-variant-numeric: tabular-nums; }
.presu { border: 0; background: none; color: var(--azul); font: inherit; font-weight: 700; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.linea-material { border: 1px solid var(--borde); border-radius: 12px; padding: 10px; margin-top: 10px; }
.linea-material .quitar { border: 0; background: none; color: var(--rojo); font: inherit; cursor: pointer; padding: 6px 0 0; }
.total { display: flex; justify-content: space-between; font-size: 17px; margin-top: 14px; }
.pestanas { display: flex; gap: 6px; margin: 8px 0 4px; }
.pestanas button { flex: 1; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); padding: 10px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; }
.pestanas button.si { background: var(--azul); border-color: var(--azul); color: #fff; }
.vacio { text-align: center; color: var(--suave); padding: 24px 8px; }
a { color: var(--azul); }
