/* Letra de la marca ALCHEMAX (Michroma, licencia OFL), guardada en la propia Caja */
@font-face { font-family: "Michroma"; font-style: normal; font-weight: 400; font-display: swap; src: url(/michroma.woff2) format("woff2"); }

:root {
  --fondo: #eef1f5;
  --superficie: #ffffff;
  --superficie-2: #f8f9fb;
  --texto: #0b0f14;
  --suave: #64748b;
  --borde: #e4e7ec;
  --acento: #1559e8;
  --acento-suave: #e1eaff;
  --bien: #0f8a5f;
  --bien-suave: #e3f5ec;
  --mal: #c8323b;
  --mal-suave: #fbe9ea;
  --alerta: #b86a00;
  --alerta-suave: #fdf1dc;
  --barra: #07090c;
  --barra-texto: #f8fafc;
  --sombra: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --radio: 16px;
  --brillo: rgba(21, 89, 232, .28);
  --marca: "Michroma", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #040507;
    --superficie: #0e131b;
    --superficie-2: #0a0e14;
    --texto: #e6e9ef;
    --suave: #93a0b4;
    --borde: #222b3b;
    --acento: #2f8bff;
    --acento-suave: #0a1f45;
    --brillo: rgba(47, 139, 255, .45);
    --bien: #3ccf91;
    --bien-suave: #12301f;
    --mal: #ff7a83;
    --mal-suave: #3a1a1e;
    --alerta: #ffb44d;
    --alerta-suave: #3a2a12;
    --barra: #000000;
    --barra-texto: #f1f5f9;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #040507; --superficie: #0e131b; --superficie-2: #0a0e14; --texto: #e6e9ef; --suave: #93a0b4;
  --borde: #222b3b; --acento: #2f8bff; --acento-suave: #0a1f45; --brillo: rgba(47, 139, 255, .45); --bien: #3ccf91; --bien-suave: #12301f;
  --mal: #ff7a83; --mal-suave: #3a1a1e; --alerta: #ffb44d; --alerta-suave: #3a2a12; --barra: #000000;
  --barra-texto: #f1f5f9; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--acento); }
.oculto { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- acceso */
.acceso {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--acento-suave), transparent 70%), var(--fondo);
}
.acceso-caja {
  width: 100%; max-width: 380px; background: var(--superficie); border: 1px solid var(--borde);
  border-radius: 22px; padding: 28px 22px; box-shadow: var(--sombra);
}
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.logo > div { min-width: 0; }
.logo img { width: 48px; height: 48px; flex: none; border-radius: 14px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .08), 0 4px 14px var(--brillo); }
.logo h1 { margin: 0 0 4px; }
.logo p { margin: 0; color: var(--suave); font-size: 14px; }

/* ---------- formularios */
label { display: block; font-size: 13px; color: var(--suave); margin: 14px 0 6px; font-weight: 600; }
.campo {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--superficie-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.campo:focus { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.ayuda { font-size: 13px; color: var(--suave); margin: 6px 0 0; }
.fila-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fila-campos label { margin-top: 10px; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 12px; border: 1px solid var(--borde);
  background: var(--superficie); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--texto);
  transition: transform .06s, background .15s, border-color .15s; min-height: 44px;
}
.boton:active { transform: scale(.98); }
.boton.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
:root[data-theme="dark"] .boton.primario { color: #0a0e16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .boton.primario { color: #0a0e16; } }
.boton.ancho { width: 100%; margin-top: 18px; }
.boton.chico { padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }
.boton.peligro { color: var(--mal); }
.boton.bien { background: var(--bien-suave); color: var(--bien); border-color: transparent; }
.boton[disabled] { opacity: .55; cursor: default; }
.error-form { color: var(--mal); font-size: 14px; margin: 12px 0 0; min-height: 1em; }

/* ---------- estructura */
.app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.barra {
  position: sticky; top: 0; z-index: 20; background: var(--barra); color: var(--barra-texto);
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
}
.barra-arriba { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca img { width: 36px; height: 36px; border-radius: 10px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 3px 12px var(--brillo); }
/* ALCHEMAX en acero y DAILY en azul eléctrico, como el logo */
.nombre-marca { font-family: var(--marca); font-weight: 400; font-size: 16px; letter-spacing: .16em; white-space: nowrap; margin: 0;
  background: linear-gradient(100deg, #f4f6f8 0%, #9aa3ad 45%, #eef1f4 70%, #b5bdc6 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nombre-marca b { font-weight: 400; color: #2f8bff; -webkit-text-fill-color: #2f8bff; text-shadow: 0 0 8px rgba(47, 139, 255, .45); }
.acceso .nombre-marca { font-size: 15px; letter-spacing: .12em; background-image: linear-gradient(100deg, #1d242c 0%, #6b7682 45%, #2b333c 70%, #59636e 100%); }
.acceso .nombre-marca b { color: var(--acento); -webkit-text-fill-color: var(--acento); text-shadow: 0 0 8px var(--brillo); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .acceso .nombre-marca { background-image: linear-gradient(100deg, #f4f6f8 0%, #9aa3ad 45%, #eef1f4 70%, #b5bdc6 100%); } }
:root[data-theme="dark"] .acceso .nombre-marca { background-image: linear-gradient(100deg, #f4f6f8 0%, #9aa3ad 45%, #eef1f4 70%, #b5bdc6 100%); }
@media (max-width: 370px) { .nombre-marca { font-size: 14px; letter-spacing: .12em; } }
.boton-icono {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .08);
  color: var(--barra-texto); display: grid; place-items: center; cursor: pointer;
}
.boton-icono svg { width: 20px; height: 20px; }
.boton-icono.girando svg { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.dias { display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto; padding: 12px 0 14px; }
.dias button.flecha {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .08);
  color: var(--barra-texto); font-size: 22px; cursor: pointer; flex: none;
}
.dia-centro { flex: 1; text-align: center; cursor: pointer; position: relative; }
.dia-titulo { font-weight: 700; font-size: 17px; }
.dia-sub { font-size: 12.5px; opacity: .7; }
.dia-centro input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--superficie) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--borde); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; color: var(--suave); text-decoration: none; font-size: 12px; font-weight: 600; border-radius: 12px;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.activa { color: var(--acento); }
.tabs .globo {
  position: absolute; margin-left: 22px; margin-top: -2px; background: var(--mal); color: #fff;
  font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px;
}
.tabs a { position: relative; }

/* ---------- tarjetas */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px;
}
.tarjeta h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tarjeta h2 small { font-weight: 500; color: var(--suave); font-size: 13px; }

.heroe {
  background: radial-gradient(420px 180px at 100% 0%, rgba(47, 139, 255, .35), transparent 70%), linear-gradient(135deg, #0b0f14 0%, #18202b 60%, #0f2a57 100%);
  color: #fff; border: 1px solid rgba(47, 139, 255, .35); padding: 20px 18px; box-shadow: 0 6px 24px var(--brillo);
}
.heroe .etq { font-family: var(--marca); font-size: 11.5px; opacity: .8; letter-spacing: .18em; text-transform: uppercase; }
.heroe .grande { font-size: 38px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 6px; }
.heroe .linea-heroe { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; opacity: .92; }
.heroe.negativo { background: linear-gradient(135deg, #2a0b10, #8f1d2a); border-color: rgba(255, 122, 131, .4); box-shadow: none; }

.filas { display: grid; gap: 0; }
.fila { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--borde); }
.fila:last-child { border-bottom: 0; }
.fila .izq { color: var(--suave); }
.fila .izq b { color: var(--texto); font-weight: 600; }
.fila.total { border-top: 1px solid var(--borde); border-bottom: 0; margin-top: 4px; padding-top: 12px; font-weight: 700; }
.fila.total .izq { color: var(--texto); }
.menos { color: var(--mal); }
.mas { color: var(--bien); }

.aviso { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; display: flex; gap: 8px; align-items: flex-start; }
.aviso.alerta { background: var(--alerta-suave); color: var(--alerta); }
.aviso.mal { background: var(--mal-suave); color: var(--mal); }
.aviso.info { background: var(--acento-suave); color: var(--acento); }
.aviso.bien { background: var(--bien-suave); color: var(--bien); }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--superficie-2); border: 1px solid var(--borde); color: var(--suave);
  white-space: nowrap;
}
.chip.flex { background: var(--acento-suave); color: var(--acento); border-color: transparent; }
.chip.full { background: var(--alerta-suave); color: var(--alerta); border-color: transparent; }
.chip.bien { background: var(--bien-suave); color: var(--bien); border-color: transparent; }
.chip.mal { background: var(--mal-suave); color: var(--mal); border-color: transparent; }
.chip.alerta { background: var(--alerta-suave); color: var(--alerta); border-color: transparent; }

/* ---------- ventas */
.venta { padding: 12px 0; border-bottom: 1px solid var(--borde); }
.venta:last-child { border-bottom: 0; }
.venta-arriba { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.venta-prod { font-weight: 600; font-size: 15px; }
.venta-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--suave); font-size: 13px; margin-top: 4px; }
.venta-plata { text-align: right; white-space: nowrap; }
.venta-plata .neto { font-weight: 700; }
.venta-plata .bruto { font-size: 12.5px; color: var(--suave); }

/* ---------- gastos */
.gasto { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.gasto:last-child { border-bottom: 0; }
.gasto .det { font-size: 14px; }
.gasto .det small { display: block; color: var(--suave); }
.form-gasto { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.form-gasto .campo { padding: 10px 12px; }
.form-gasto .completo { grid-column: 1 / -1; }
.borrar { border: 0; background: none; color: var(--suave); cursor: pointer; font-size: 18px; padding: 6px; border-radius: 8px; }

/* ---------- compras */
.resumen-compras { display: flex; gap: 10px; margin-bottom: 14px; }
.resumen-compras .cuadro { flex: 1; background: var(--superficie); border: 1px solid var(--borde); border-radius: 14px; padding: 10px 12px; box-shadow: var(--sombra); }
.cuadro .n { font-size: 22px; font-weight: 800; }
.cuadro .t { font-size: 12.5px; color: var(--suave); }
.interruptor { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 14px; color: var(--suave); margin: -4px 0 10px; }
.interruptor input { width: 18px; height: 18px; accent-color: var(--acento); }

.proveedor-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.proveedor-cab h2 { margin: 0; }
.acciones-prov { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }

.linea { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.linea:last-child { border-bottom: 0; }
.linea .foto { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--superficie-2); border: 1px solid var(--borde); }
.linea .sin-foto { display: grid; place-items: center; color: var(--suave); font-size: 22px; }
.linea-tit { font-weight: 600; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.linea-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.unidades { font-size: 15px; font-weight: 800; color: var(--texto); background: var(--superficie-2); border: 1px solid var(--borde); border-radius: 8px; padding: 1px 8px; }
.codigo { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; color: var(--texto); }
.linea-botones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; grid-column: 1 / -1; }
.linea-botones .boton { padding: 8px 6px; font-size: 13.5px; min-height: 40px; }
.linea.comprado { background: linear-gradient(90deg, var(--bien-suave), transparent 70%); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.linea.sin_stock { background: linear-gradient(90deg, var(--alerta-suave), transparent 70%); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.linea.pasada { opacity: .55; }
.enlace { background: none; border: 0; color: var(--acento); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; }

.vacio { text-align: center; color: var(--suave); padding: 28px 12px; }
.vacio .grande { font-size: 34px; margin-bottom: 6px; }

/* ---------- ajustes */
.cuenta { border: 1px solid var(--borde); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--superficie-2); }
.cuenta-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cuenta-cab b { font-size: 15.5px; }
.cuenta p { margin: 6px 0 0; font-size: 13.5px; color: var(--suave); }
.cuenta .acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.copiar-uri { display: flex; gap: 8px; align-items: center; }
.copiar-uri code { flex: 1; overflow-x: auto; white-space: nowrap; background: var(--superficie-2); border: 1px solid var(--borde); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.item-lista { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--borde); font-size: 14.5px; }
.item-lista:last-child { border-bottom: 0; }
.item-lista small { color: var(--suave); display: block; }
details.desplegable > summary { cursor: pointer; font-weight: 600; color: var(--acento); list-style: none; padding: 6px 0; }
details.desplegable > summary::-webkit-details-marker { display: none; }

/* ---------- mensajes y diálogos */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--texto); color: var(--superficie); padding: 11px 16px; border-radius: 12px; font-size: 14.5px;
  box-shadow: var(--sombra); opacity: 0; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.mal { background: var(--mal); color: #fff; }

dialog {
  border: 0; border-radius: 20px; padding: 20px; width: min(420px, calc(100% - 32px)); background: var(--superficie);
  color: var(--texto); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(10, 14, 22, .55); }
dialog h3 { margin: 0 0 6px; }
.dialogo-botones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.cargando { text-align: center; color: var(--suave); padding: 40px 0; }
.pie { text-align: center; color: var(--suave); font-size: 12.5px; margin-top: 8px; }

@media (min-width: 640px) {
  .heroe .grande { font-size: 44px; }
  .linea { grid-template-columns: 72px 1fr; }
  .linea .foto { width: 72px; height: 72px; }
}
.aviso a { color: inherit; font-weight: 600; }

@media (max-width: 360px) { .acceso .nombre-marca { font-size: 13px; letter-spacing: .08em; } }
.interruptor.izquierda { justify-content: flex-start; margin: 14px 0 0; }
