/* Electrónica LS — estilos de interfaz (paleta aprobada: sidebar oscuro, rojo, dorado) */

:root {
    --negro: #0b0b0b;
    --negro-suave: #161616;
    --rojo: #a3201d;
    --rojo-hover: #c22824;
    --dorado: #c9971f;
    --fondo: #f5f4f1;
    --panel: #ffffff;
    --borde: #e5e2dc;
    --texto: #201f1d;
    --texto-suave: #6b6862;
    --texto-claro: #f4f2ef;
    --exito: #2f7d4f;
    --alerta: #b3541e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    font-size: 15px;
}

a { color: var(--rojo); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; color: var(--texto); }
h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; }

/* ---------- Layout general con sidebar ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--negro);
    color: var(--texto-claro);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.4rem 1.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-logo .marca {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--texto-claro);
}

.sidebar-logo .marca small {
    display: block;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--dorado);
    letter-spacing: 0.04em;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.sidebar nav a {
    color: #cfcac2;
    text-decoration: none;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.sidebar nav a .icono-nav {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--texto-claro);
}

.sidebar nav a.activo {
    background: rgba(163,32,29,0.18);
    border-left-color: var(--rojo);
    color: var(--texto-claro);
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
}

.sidebar-footer .usuario {
    color: #cfcac2;
    margin-bottom: 0.4rem;
}

.sidebar-footer a {
    color: #cfcac2;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
}

.sidebar-footer a:hover {
    color: var(--texto-claro);
}

.sidebar-footer a .icono-nav {
    width: 16px;
    height: 16px;
}

.main {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1100px;
}

/* ---------- Componentes ---------- */

.tarjetas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tarjeta {
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    display: block;
    color: var(--texto);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.tarjeta:hover {
    border-color: var(--rojo);
    text-decoration: none;
    transform: translateY(-2px);
}

.tarjeta .icono { width: 26px; height: 26px; margin-bottom: 0.6rem; display: block; color: var(--rojo); }
.tarjeta.destacada .icono { color: #8a6a10; }
.tarjeta strong { display: block; font-size: 1rem; margin-bottom: 0.2rem; }
.tarjeta span.desc { color: var(--texto-suave); font-size: 0.85rem; }

.tarjeta.destacada {
    background: #fdf8ec;
    border-color: var(--dorado);
    border-width: 1.5px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--rojo);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: var(--rojo-hover); text-decoration: none; color: #fff; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-secundario {
    background: transparent;
    color: var(--texto);
    border: 1px solid var(--borde);
}

.btn-secundario:hover { background: #f0efec; color: var(--texto); }

.btn-dorado {
    background: var(--dorado);
    color: #241d05;
}
.btn-dorado:hover { background: #dba928; color: #241d05; }

.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.82rem; }

/* Botón sutil: para acciones secundarias de barra de herramientas (buscar, escanear, filtrar) */
.btn-sutil {
    background: transparent;
    color: var(--texto-suave);
    border: 1px solid var(--borde);
    font-weight: 500;
}
.btn-sutil:hover {
    background: #f5f3ef;
    color: var(--texto);
    border-color: #d8d4cc;
}
.btn-sutil svg { color: var(--texto-suave); }
.btn-sutil:hover svg { color: var(--rojo); }

/* Campo de búsqueda con lupa */
.campo-buscar {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.campo-buscar svg {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--texto-suave);
    pointer-events: none;
}
.campo-buscar input {
    width: 100%;
    padding: 0.5rem 0.65rem 0.5rem 2.2rem;
    border: 1px solid var(--borde);
    border-radius: 6px;
    font-size: 0.92rem;
}
.campo-buscar input:focus {
    outline: none;
    border-color: var(--rojo);
}

/* Acciones en filas de tabla: botones sutiles con ícono + texto */
.acciones {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
}

/* Envoltorio con scroll horizontal para tablas con columnas angostas
   (evita que las acciones se corten a una segunda línea) */
.tabla-wrap {
    width: 100%;
    overflow-x: auto;
}
.accion {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--texto-suave);
    text-decoration: none;
    font-size: 0.8rem;
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 6px;
    padding: 0.32rem 0.6rem;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}
.accion svg { width: 14px; height: 14px; flex-shrink: 0; }
.accion:hover {
    color: var(--rojo);
    border-color: var(--rojo);
    background: #fbeceb;
    text-decoration: none;
}
.accion.accion-peligro:hover { color: var(--alerta); border-color: var(--alerta); background: #fbeee6; }
.accion.accion-exito:hover { color: var(--exito); border-color: var(--exito); background: #eaf6ee; }

.volver {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--texto-suave);
    font-size: 0.88rem;
}

table.tabla {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 10px;
    overflow: hidden;
}

table.tabla th, table.tabla td {
    padding: 0.65rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--borde);
    font-size: 0.9rem;
}

table.tabla th {
    background: #faf9f7;
    font-weight: 600;
    color: var(--texto-suave);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

table.tabla tbody tr:hover { background: #faf8f6; }
table.tabla tbody tr:last-child td { border-bottom: none; }

form.form-panel {
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 480px;
}

.campo { margin-bottom: 1rem; }
.campo label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--texto);
}

.campo input, .campo select, .campo textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--borde);
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--texto);
}

.campo input:focus, .campo select:focus, .campo textarea:focus {
    outline: none;
    border-color: var(--rojo);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-activo { background: #e4f1e8; color: var(--exito); }
.badge-inactivo { background: #f1e5e0; color: var(--alerta); }

.alerta-error {
    background: #fbeae8;
    border: 1px solid #e3a89f;
    color: #8a231a;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alerta-exito {
    background: #e8f3ec;
    border: 1px solid #a8d3b7;
    color: #205a36;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.metricas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.metrica {
    background: var(--panel);
    border: 1px solid var(--borde);
    border-radius: 10px;
    padding: 1rem 1.2rem;
}

.metrica .valor { font-size: 1.5rem; font-weight: 700; color: var(--texto); }
.metrica .etiqueta { font-size: 0.8rem; color: var(--texto-suave); }

.metrica.destacada {
    border-color: var(--dorado);
    background: #fdf8ec;
}
.metrica.destacada .valor { color: #8a6a10; }

/* ---------- Login ---------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #0a0a0a 45%, #4a3608 75%, #c9971f 100%);
}

.login-caja {
    background: var(--panel);
    border-radius: 12px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.login-caja img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.login-caja h1 {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
}

.login-caja .campo { text-align: left; }

.login-caja .btn { width: 100%; margin-top: 0.5rem; }
