:root {
    --navy: #000055;
    --navy-soft: #14166b;
    --verde: #03912D;
    --amarillo: #E8B800;
    --amarillo-bg: #FCE900;
    --naranja: #FD6102;
    --rojo: #EE0F1C;
    --crema: #FFFBF2;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: linear-gradient(160deg, #eef0fb 0%, #f7f6f2 45%, #f7f6f2 100%);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    color: #1c1c1e;
    font-size: 17px;
}

.franja {
    height: 6px;
    background: linear-gradient(90deg, var(--verde) 0%, var(--verde) 25%, var(--amarillo-bg) 25%, var(--amarillo-bg) 50%, var(--naranja) 50%, var(--naranja) 75%, var(--rojo) 75%, var(--rojo) 100%);
}

.topbar {
    background: #ffffff;
    color: var(--navy);
    padding: 10px 0;
    display: flex;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.topbar-inner {
    width: 100%;
    max-width: 1300px;
    padding: 0 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    row-gap: 10px;
}
.topbar-left { order: 1; }
.topbar-left img { height: 42px; width: auto; display: block; }
.topbar-nav { order: 3; flex-basis: 100%; justify-content: center; display: flex; flex-wrap: wrap; gap: 6px; background: #f0eef8; padding: 5px; border-radius: 100px; }
.topbar-nav a {
    text-decoration: none;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 100px;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.topbar-nav a.activo { background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(0,0,85,0.25); }
.topbar-right { order: 2; }
.topbar-right a {
    color: var(--navy);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 16px;
    border: 1.5px solid #d8d8e0;
    border-radius: 100px;
    background: #fff;
}

.container { padding: 24px 28px 60px; max-width: 1300px; margin: 0 auto; }

.login-box {
    max-width: 420px;
    margin: 60px auto;
    background: #fff;
    padding: 36px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,85,0.1);
}
.login-box h2 { text-align: center; margin-top: 0; font-size: 22px; color: var(--navy); }
.login-box img { display: block; margin: 0 auto 18px; max-width: 220px; height: auto; }

label { font-size: 15px; color: #48484a; font-weight: 600; display: block; margin-bottom: 6px; }

input[type=text], input[type=password], input[type=number], input[type=date], select {
    width: 100%;
    padding: 14px 18px;
    font-size: 18px;
    border: 1.5px solid #e2e2ea;
    border-radius: 14px;
    margin-bottom: 16px;
    background: #fafafd;
    color: #1c1c1e;
    color-scheme: light;
}
input:focus, select:focus { outline: none; border-color: var(--navy); background: #fff; }
input:disabled { background: #f2f2f5; color: #8e8e93; }

button, .btn {
    display: inline-block;
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-weight: 700;
    border: none;
    border-radius: 100px;
    background: var(--navy);
    color: #fff;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    min-height: 54px;
    box-shadow: 0 4px 14px rgba(0,0,85,0.25);
    transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}
button:hover, .btn:hover { opacity: 0.94; transform: translateY(-1px); }
button:active, .btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0,0,85,0.2);
}
.btn-secundario {
    background: #fff;
    color: var(--navy);
    border: 1.5px solid #e2e2ea;
    box-shadow: none;
}
.error { background: #ffe5e5; color: var(--rojo); padding: 14px 18px; border-radius: 14px; margin-bottom: 16px; font-size: 16px; border: 1px solid #ffb3b3; }
.ok { background: #e5f7e9; color: #14631f; padding: 14px 18px; border-radius: 14px; margin-bottom: 16px; font-size: 16px; font-weight: 600; border: 1px solid #a9e2b4; }

.card {
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 4px 24px rgba(20,20,50,0.06);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-header h3 { margin: 0; font-size: 20px; color: var(--navy); }

.kpi-mini-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.kpi-mini { min-width: 0; background: #f7f6fb; border-radius: 12px; padding: 8px 10px; text-align: center; }
.kpi-mini-label { display: block; font-size: 11px; color: #8e8e93; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 700; margin-bottom: 4px; }
.kpi-mini-val { display: block; font-size: 15px; color: var(--navy); font-weight: 800; overflow-wrap: anywhere; }
.badge { font-size: 13px; padding: 6px 16px; border-radius: 100px; font-weight: 800; color: #fff; letter-spacing: 0.5px; }
.badge.rojo { background: var(--rojo); }
.badge.amarillo { background: var(--amarillo); }
.badge.verde { background: var(--verde); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 420px) {
    .row2 { grid-template-columns: 1fr; }
}

.grid-productos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    justify-content: center;
}
@media (min-width: 700px) {
    .container { padding: 32px 40px 70px; }
}

/* Barra de nivel de stock — inspirada en las barras de "Money In/Out" */
.nivel-stock { margin: 10px 0 16px; }
.nivel-stock-track {
    height: 10px;
    border-radius: 100px;
    background: #eeeef2;
    overflow: hidden;
    display: flex;
}
.nivel-stock-fill { height: 100%; border-radius: 100px; transition: width 0.2s ease; }
.nivel-stock-fill.rojo { background: linear-gradient(90deg, #ff8a80, var(--rojo)); }
.nivel-stock-fill.amarillo { background: linear-gradient(90deg, #ffd766, var(--amarillo)); }
.nivel-stock-fill.verde { background: linear-gradient(90deg, #6fd88a, var(--verde)); }
.nivel-stock-label { font-size: 12px; color: #8e8e93; margin-top: 4px; display: flex; justify-content: space-between; }

/* Jerarquía numérica: entero fuerte, decimales/unidad tenues */
.num-fuerte { font-weight: 800; color: var(--navy); }
.num-decimal { font-weight: 400; color: #b8b8c2; }
.num-unidad { font-weight: 600; color: #8e8e93; font-size: 0.7em; margin-left: 3px; }

.campos-pila { display: flex; flex-direction: column; gap: 0; }
.campo-full { width: 100%; }

.cantidad-control {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.cantidad-box {
    min-width: 0;
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e2ea;
    border-radius: 14px;
    background: #fafafd;
    padding: 0 12px;
}
.cantidad-box:focus-within { border-color: var(--navy); background: #fff; }
.cantidad-box input[type=text] {
    border: none;
    background: transparent;
    padding: 14px 4px;
    margin-bottom: 0;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    text-align: center;
    color: #1c1c1e;
}
.cantidad-box input[type=text]:focus { outline: none; }
.paso-btn {
    width: 46px;
    height: 48px;
    min-height: 48px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 100px;
    border: none;
    background: #f0eef8;
    color: var(--navy);
    cursor: pointer;
    padding: 0;
    transition: transform 0.08s ease, background 0.1s ease;
}
.paso-btn:hover { background: #e6e2f5; }
.paso-btn:active { background: #dcd6f0; transform: translateY(1px); }

.alarma-btn { background: var(--rojo); margin-bottom: 8px; box-shadow: 0 4px 14px rgba(238,15,28,0.3); }
.small { font-size: 14px; color: #6e6e73; font-weight: 400; }
.unidad-tag { font-size: 15px; color: #6e6e73; font-weight: 600; flex: 0 0 auto; white-space: nowrap; padding-left: 4px; }
.ayuda { font-size: 14px; color: #6e6e73; font-weight: 400; display: block; margin-top: 2px; margin-bottom: 8px; }

table.lista { width: 100%; border-collapse: collapse; font-size: 15px; }
table.lista th, table.lista td { padding: 12px 10px; border-bottom: 1px solid #f0f0f3; text-align: left; }
table.lista th { background: transparent; font-size: 12px; color: #8e8e93; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 700; }
.pill { padding: 5px 14px; border-radius: 100px; font-size: 12px; font-weight: 800; color: #fff; }
.pill.pendiente { background: var(--amarillo); }
.pill.recibido { background: var(--verde); }
.pill.si { background: var(--verde); }
.pill.no { background: var(--rojo); }
.btn-mini {
    display: inline-block;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 700;
    background: var(--verde);
    color: #fff;
    border-radius: 100px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    min-height: 44px;
    box-shadow: 0 3px 10px rgba(3,145,45,0.25);
    transition: transform 0.08s ease;
}
.btn-mini:active { transform: translateY(1px); }
.section-title { font-size: 19px; font-weight: 800; margin: 26px 0 12px; color: var(--navy); }
