/* =============================================================
   Joyería Nice — v2
   Mobile first. Navegación inferior tipo app.
   ============================================================= */

:root {
    --tinta:      #241A2B;
    --tinta-60:   #6B6072;
    --tinta-40:   #9C93A1;
    --vino:       #8A2F4D;
    --laton:      #C08A3E;
    --laton-sv:   #FBF3E6;
    --marfil:     #FBF8F5;
    --papel:      #FFFFFF;
    --linea:      #ECE5DE;
    --verde:      #2E7D5B;
    --verde-sv:   #EAF5F0;
    --rojo:       #C0392F;
    --rojo-sv:    #FCEDEC;

    --r-sm: 10px;
    --r:    16px;
    --r-lg: 22px;

    --sombra:    0 1px 2px rgba(36,26,43,.04), 0 4px 14px rgba(36,26,43,.05);
    --sombra-up: 0 -1px 0 var(--linea);

    --display: 'Fraunces', Georgia, serif;
    --texto:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --nav-h: 62px;
    --seguro-abajo: env(safe-area-inset-bottom, 0px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--marfil);
    color: var(--tinta);
    font-family: var(--texto);
    font-size: 16px;
    line-height: 1.5;
    padding-bottom: calc(var(--nav-h) + var(--seguro-abajo) + 12px);
}

a { color: var(--vino); text-decoration: none; }
a:active { opacity: .7; }

/* ---------- Encabezado ---------- */
.tope {
    padding: 1.4rem 1.15rem .6rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}
.tope h1 {
    font-family: var(--display);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -.015em;
    margin: 0;
    line-height: 1.1;
}
.tope .sub {
    font-size: .82rem;
    color: var(--tinta-60);
    margin: .25rem 0 0;
}
.tope .accion {
    font-size: .85rem;
    font-weight: 500;
    color: var(--vino);
    flex: 0 0 auto;
    padding-bottom: .2rem;
}

.volver {
    display: inline-block;
    padding: 1rem 1.15rem .1rem;
    font-size: .85rem;
    color: var(--tinta-60);
}

/* ---------- Contenedor ---------- */
.contenido {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.15rem 1.5rem;
}

h2 {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--tinta-40);
    margin: 1.7rem 0 .7rem;
}

/* ---------- Tarjetas ---------- */
.tarjeta {
    background: var(--papel);
    border-radius: var(--r);
    padding: 1.05rem;
    box-shadow: var(--sombra);
    margin-bottom: .75rem;
    display: block;
    color: inherit;
}
.tarjeta.plana { box-shadow: none; border: 1px solid var(--linea); }

/* Renglón tocable (listas) */
.reng {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    background: var(--papel);
    border-radius: var(--r);
    padding: .95rem 1.05rem;
    box-shadow: var(--sombra);
    margin-bottom: .55rem;
    color: inherit;
}
.reng .izq { min-width: 0; flex: 1; }
.reng .titulo {
    font-weight: 600;
    font-size: .97rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reng .meta {
    font-size: .76rem;
    color: var(--tinta-40);
    margin-top: .12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reng .der { text-align: right; flex: 0 0 auto; }
.reng .monto { font-weight: 600; font-size: .97rem; font-variant-numeric: tabular-nums; }

/* ---------- Cifras ---------- */
.cifras {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
    margin-bottom: .3rem;
}
.cifra {
    background: var(--papel);
    border-radius: var(--r);
    padding: .95rem 1rem;
    box-shadow: var(--sombra);
}
.cifra .etiqueta {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--tinta-40);
    margin-bottom: .25rem;
}
.cifra .valor {
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.cifra.alerta .valor { color: var(--rojo); }
.cifra.buena  .valor { color: var(--verde); }
.cifra.tres   { grid-column: span 2; }

.cifras.trio { grid-template-columns: repeat(3, 1fr); }
.cifras.trio .valor { font-size: 1.15rem; }

/* ---------- Etiquetas de estado ---------- */
.chip {
    display: inline-block;
    font-size: .68rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 100px;
    letter-spacing: .02em;
}
.chip.ok    { background: var(--verde-sv); color: var(--verde); }
.chip.debe  { background: var(--rojo-sv);  color: var(--rojo); }
.chip.medio { background: var(--laton-sv); color: #8A5F1C; }

/* ---------- Formularios ---------- */
label {
    display: block;
    font-size: .78rem;
    font-weight: 500;
    color: var(--tinta-60);
    margin-bottom: .3rem;
}
input[type=text], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=tel], select, textarea {
    width: 100%;
    padding: .85rem .9rem;
    font-family: inherit;
    font-size: 16px;              /* 16px evita el zoom de iOS */
    color: var(--tinta);
    background: var(--papel);
    border: 1.5px solid var(--linea);
    border-radius: var(--r-sm);
    margin-bottom: .85rem;
    appearance: none;
    -webkit-appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6072' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    padding-right: 2.2rem;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--laton);
    box-shadow: 0 0 0 3px rgba(192,138,62,.14);
}
textarea { resize: vertical; }

.fila { display: flex; gap: .6rem; }
.fila > * { flex: 1; min-width: 0; }

.boton {
    display: block;
    width: 100%;
    padding: .95rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--marfil);
    background: var(--tinta);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: center;
}
.boton:active { transform: scale(.985); }
.boton.secundario {
    background: var(--papel);
    color: var(--tinta);
    border: 1.5px solid var(--linea);
}
.boton.peligro { background: var(--papel); color: var(--rojo); border: 1.5px solid var(--linea); }
.boton.chico   { width: auto; padding: .6rem .85rem; font-size: .85rem; }

.botones { display: flex; gap: .55rem; }
.botones > * { flex: 1; }

/* Botón flotante de acción principal */
.flotante {
    position: fixed;
    right: 1.1rem;
    bottom: calc(var(--nav-h) + var(--seguro-abajo) + 14px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tinta);
    color: var(--marfil);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    line-height: 1;
    box-shadow: 0 6px 20px rgba(36,26,43,.28);
    z-index: 30;
}

/* ---------- Avisos ---------- */
.aviso {
    padding: .85rem 1rem;
    border-radius: var(--r-sm);
    font-size: .88rem;
    margin-bottom: .9rem;
}
.aviso.ok    { background: var(--verde-sv); color: #1E5540; }
.aviso.error { background: var(--rojo-sv);  color: #8C271F; }
.aviso.info  { background: var(--laton-sv); color: #7A5417; }

/* ---------- Tablas ---------- */
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th {
    text-align: left;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tinta-40);
    padding: .4rem .3rem;
    border-bottom: 1px solid var(--linea);
    font-weight: 600;
}
.tabla td { padding: .7rem .3rem; border-bottom: 1px solid var(--linea); }
.tabla tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.totales td { border: none; padding: .3rem 0; font-size: .9rem; }
.totales .rot { color: var(--tinta-60); }
.totales .grande {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -.02em;
}

.vacio {
    text-align: center;
    color: var(--tinta-40);
    padding: 2.2rem 1rem;
    font-size: .9rem;
}

/* ---------- Barras de reporte ---------- */
.barra-dato { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; font-size: .85rem; }
.barra-dato .rotulo { flex: 0 0 30%; color: var(--tinta-60); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-dato .pista { flex: 1; height: 18px; background: var(--linea); border-radius: 100px; overflow: hidden; }
.barra-dato .relleno { height: 100%; background: var(--tinta); border-radius: 100px; }
.barra-dato .relleno.oro { background: var(--laton); }
.barra-dato .cifra-fin { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .78rem; }

.progreso { height: 6px; background: var(--linea); border-radius: 100px; overflow: hidden; }
.progreso > span { display: block; height: 100%; background: var(--laton); }

/* ---------- Partidas de captura ---------- */
.partida {
    background: var(--marfil);
    border-radius: var(--r-sm);
    padding: .85rem;
    margin-bottom: .7rem;
}
.partida .encabezado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}
.partida .numero {
    font-family: var(--display);
    font-size: .95rem;
    font-weight: 600;
    color: var(--laton);
}
.partida .quitar {
    background: none;
    border: none;
    color: var(--tinta-40);
    font-size: .8rem;
    cursor: pointer;
    padding: .2rem .3rem;
}
.partida input, .partida select { margin-bottom: .6rem; }
.calculo {
    font-size: .78rem;
    color: var(--tinta-60);
    background: var(--papel);
    border-radius: 8px;
    padding: .5rem .65rem;
    margin: 0;
}
.calculo strong { color: var(--verde); }

/* ---------- Navegación inferior ---------- */
.nav-abajo {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--nav-h) + var(--seguro-abajo));
    padding-bottom: var(--seguro-abajo);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--sombra-up);
    display: flex;
    z-index: 40;
}
.nav-abajo a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--tinta-40);
    font-size: .64rem;
    font-weight: 500;
    letter-spacing: .01em;
}
.nav-abajo a.activo { color: var(--tinta); }
.nav-abajo a.activo svg { stroke: var(--vino); }
.nav-abajo svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Acceso ---------- */
.acceso {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--tinta);
}
.acceso .caja {
    width: 100%;
    max-width: 360px;
    background: var(--marfil);
    border-radius: var(--r-lg);
    padding: 2.2rem 1.6rem;
}
.acceso .titulo {
    font-family: var(--display);
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 .2rem;
    letter-spacing: -.02em;
}
.acceso .sub {
    text-align: center;
    font-size: .72rem;
    color: var(--tinta-40);
    margin-bottom: 1.8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

/* ---------- Escritorio ---------- */
@media (min-width: 640px) {
    .cifras { grid-template-columns: repeat(4, 1fr); }
    .cifra.tres { grid-column: auto; }
    .tope h1 { font-size: 2.1rem; }
    .fila-desktop { display: flex; gap: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
