:root {
    --marron: #5a2e1d;
    --dorado: #d9a441;
    --dorado-oscuro: #b5812a;
    --verde: #2e7d32;
    --rojo: #c62828;
    --gris-claro: #f4f1ec;
    --gris-borde: #d9d2c3;
    --texto: #2b2420;
    --radio: 14px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--gris-claro);
    color: var(--texto);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 18px;
    -webkit-tap-highlight-color: transparent;
}

.contenedor {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 80px;
}

header.barra-superior {
    background: var(--marron);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

header.barra-superior h1 {
    font-size: 20px;
    margin: 0;
}

header.barra-superior .salir {
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
}

h2 { font-size: 20px; margin: 18px 0 10px; }

.tarjeta {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: var(--radio);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--radio);
    border: none;
    cursor: pointer;
    background: var(--dorado);
    color: #2b2420;
    margin-bottom: 10px;
    min-height: 56px;
}

.boton:active { background: var(--dorado-oscuro); }
.boton.secundario { background: #fff; border: 2px solid var(--dorado-oscuro); }
.boton.peligro { background: var(--rojo); color: #fff; }
.boton.chico { padding: 10px; font-size: 15px; min-height: 40px; width: auto; }
.boton:disabled { opacity: 0.5; }

input, select, textarea {
    width: 100%;
    padding: 12px;
    font-size: 17px;
    border: 1px solid var(--gris-borde);
    border-radius: 10px;
    margin-bottom: 12px;
    background: #fff;
    color: var(--texto);
}

label { font-weight: 600; display: block; margin-bottom: 6px; }

.pin-pad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.pin-pad button {
    padding: 20px;
    font-size: 24px;
    border-radius: 12px;
    border: 1px solid var(--gris-borde);
    background: #fff;
}

.pin-visor {
    text-align: center;
    font-size: 32px;
    letter-spacing: 8px;
    min-height: 44px;
    margin-bottom: 8px;
}

#camara-video, #lector-qr {
    width: 100%;
    border-radius: var(--radio);
    overflow: hidden;
}

.resultado-feedback {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    z-index: 100;
    color: #fff;
}

.resultado-feedback.ok { background: var(--verde); }
.resultado-feedback.error { background: var(--rojo); }
.resultado-feedback h2 { font-size: 28px; color: #fff; }
.resultado-feedback p { font-size: 20px; }

.cantidad-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.cantidad-selector button {
    width: 44px;
    height: 44px;
    font-size: 22px;
    border-radius: 10px;
    border: 1px solid var(--gris-borde);
    background: #fff;
}

.cantidad-selector .valor {
    min-width: 40px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.producto-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--gris-borde);
}

.producto-fila:last-child { border-bottom: none; }

.etiqueta-saldo {
    background: var(--dorado);
    border-radius: 8px;
    padding: 2px 10px;
    font-weight: 700;
    font-size: 15px;
}

.mensaje-error {
    background: #fde7e7;
    border: 1px solid var(--rojo);
    color: var(--rojo);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.mensaje-ok {
    background: #e7f5e8;
    border: 1px solid var(--verde);
    color: var(--verde);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.pestañas {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pestañas button {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--gris-borde);
    background: #fff;
    font-size: 14px;
}

.pestañas button.activa {
    background: var(--marron);
    color: #fff;
    border-color: var(--marron);
}

.oculto { display: none !important; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th, table td {
    text-align: left;
    padding: 8px 4px;
    border-bottom: 1px solid var(--gris-borde);
}

.qr-grande {
    width: 100%;
    max-width: 320px;
    display: block;
    margin: 0 auto 16px;
    border: 8px solid #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.texto-chico { font-size: 13px; color: #6b6258; }
.centro { text-align: center; }
