/* ============================================================
   SATFIBRA · ESTILOS DEL PANEL
   Paleta y tipografía heredadas del sitio público.
   ============================================================ */

:root {
    --fondo:      #0a0f1d;
    --panel:      #111827;
    --tarjeta:    #1a2332;
    --linea:      #1f2937;
    --linea-viva: #2b3a52;

    --azul:   #2563eb;
    --azul-h: #1d4ed8;
    --verde:  #10b981;
    --cyan:   #06b6d4;
    --ambar:  #f59e0b;
    --rojo:   #ef4444;

    --texto:  #f3f4f6;
    --suave:  #9ca3af;
    --tenue:  #6b7280;

    --radio:   10px;
    --radio-s: 7px;
    --barra:   250px;

    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ---------- Barra lateral ---------- */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--barra);
    background: var(--panel);
    border-right: 1px solid var(--linea);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 40;
}

.marca {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.marca span { color: var(--azul); }

.marca-sub {
    color: var(--tenue);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 2rem;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: var(--suave);
    text-decoration: none;
    border-radius: var(--radio-s);
    font-size: 0.92rem;
    font-weight: 500;
    border-left: 2px solid transparent;
    transition: background 0.18s, color 0.18s;
}
.nav-item:hover { background: rgba(37, 99, 235, 0.08); color: var(--texto); }
.nav-item.activo {
    background: rgba(37, 99, 235, 0.13);
    color: var(--texto);
    border-left-color: var(--azul);
    font-weight: 600;
}

.nav-item .badge {
    background: var(--azul);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
}

.salir {
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--linea);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.88rem;
}
.salir a { color: var(--suave); text-decoration: none; }
.salir a:hover { color: var(--texto); }
.salir .cerrar { color: var(--rojo); }
.salir .cerrar:hover { opacity: 0.8; color: var(--rojo); }

.menu-toggle {
    display: none;
    position: fixed;
    top: 0.85rem; left: 0.85rem;
    z-index: 60;
    background: var(--panel);
    color: var(--texto);
    border: 1px solid var(--linea);
    border-radius: var(--radio-s);
    width: 42px; height: 42px;
    font-size: 1.1rem;
    cursor: pointer;
}

.velo {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
}

/* ---------- Área principal ---------- */

.principal {
    margin-left: var(--barra);
    padding: 2.25rem 2rem 4rem;
    max-width: 1400px;
}

.encabezado { margin-bottom: 1.75rem; }
.encabezado h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}
.encabezado p { color: var(--suave); font-size: 0.95rem; }

/* ---------- Avisos ---------- */

.aviso {
    padding: 0.8rem 1rem;
    border-radius: var(--radio-s);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    border: 1px solid;
}
.aviso-ok    { background: rgba(16, 185, 129, 0.12); border-color: var(--verde); color: #6ee7b7; }
.aviso-error { background: rgba(239, 68, 68, 0.12);  border-color: var(--rojo);  color: #fca5a5; }
.aviso-info  { background: rgba(6, 182, 212, 0.12);  border-color: var(--cyan);  color: #67e8f9; }

/* ---------- Tarjetas ---------- */

.tarjeta {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.tarjeta > h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}
.tarjeta > .ayuda {
    color: var(--suave);
    font-size: 0.87rem;
    margin-bottom: 1.25rem;
}

/* ---------- Métricas ---------- */

.metricas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.metrica {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-left: 3px solid var(--azul);
    border-radius: var(--radio);
    padding: 1.25rem 1.35rem;
}
.metrica.verde { border-left-color: var(--verde); }
.metrica.ambar { border-left-color: var(--ambar); }
.metrica.rojo  { border-left-color: #ef4444; }
.metrica.cyan  { border-left-color: var(--cyan); }

.metrica .valor {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}
.metrica .etiqueta {
    color: var(--suave);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-top: 0.3rem;
}

/* ---------- Formularios ---------- */

.campo { margin-bottom: 1.1rem; }

.campo label,
label.etiqueta {
    display: block;
    color: var(--suave);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.campo .pista {
    color: var(--tenue);
    font-size: 0.78rem;
    margin-top: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--fondo);
    border: 1px solid var(--linea-viva);
    border-radius: var(--radio-s);
    color: var(--texto);
    font-family: inherit;
    font-size: 0.93rem;
    transition: border-color 0.18s;
}

textarea { resize: vertical; min-height: 110px; line-height: 1.6; }

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

input::placeholder, textarea::placeholder { color: var(--tenue); }

input[type="file"] {
    width: 100%;
    color: var(--suave);
    font-size: 0.85rem;
}
input[type="file"]::file-selector-button {
    background: var(--tarjeta);
    color: var(--texto);
    border: 1px solid var(--linea-viva);
    border-radius: var(--radio-s);
    padding: 0.4rem 0.8rem;
    margin-right: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.fila {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--texto);
    font-size: 0.92rem;
    cursor: pointer;
    padding: 0.35rem 0;
}
.check input[type="checkbox"] {
    width: 17px; height: 17px;
    accent-color: var(--azul);
    cursor: pointer;
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.62rem 1.15rem;
    background: var(--azul);
    color: #fff;
    border: 1px solid transparent;
    border-radius: var(--radio-s);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s, opacity 0.18s;
    white-space: nowrap;
}
.btn:hover { background: var(--azul-h); }

.btn-secundario {
    background: transparent;
    border-color: var(--linea-viva);
    color: var(--suave);
}
.btn-secundario:hover { background: var(--tarjeta); color: var(--texto); }

.btn-peligro { background: transparent; border-color: var(--rojo); color: var(--rojo); }
.btn-peligro:hover { background: var(--rojo); color: #fff; }

.btn-chico { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.acciones {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 1.25rem;
}

/* ---------- Barra de herramientas ---------- */

.herramientas {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.herramientas form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.herramientas input[type="search"], .herramientas select { width: auto; min-width: 190px; }

.filtros { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filtro {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--linea-viva);
    border-radius: 999px;
    color: var(--suave);
    text-decoration: none;
    font-size: 0.83rem;
}
.filtro:hover { color: var(--texto); }
.filtro.activo { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }

/* ---------- Tablas ---------- */

.tabla-envoltorio {
    overflow-x: auto;
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    background: var(--panel);
}

table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: left;
    padding: 0.8rem 1rem;
    background: var(--tarjeta);
    color: var(--suave);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    border-bottom: 1px solid var(--linea);
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--linea);
    font-size: 0.9rem;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

tbody tr.sin-leer { background: rgba(37, 99, 235, 0.06); }
tbody tr.sin-leer:hover { background: rgba(37, 99, 235, 0.1); }

td.numero, .mono { font-family: var(--mono); font-size: 0.83rem; color: var(--suave); }
td.acciones-celda { white-space: nowrap; }
td.acciones-celda form { display: inline; }

.vacio {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--suave);
}
.vacio strong { display: block; color: var(--texto); margin-bottom: 0.3rem; font-size: 1rem; }

/* ---------- Etiquetas de estado ---------- */

.pill {
    display: inline-block;
    padding: 0.12rem 0.6rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 600;
    border: 1px solid;
}
.pill-verde { color: #6ee7b7; border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.1); }
.pill-gris  { color: var(--suave); border-color: var(--linea-viva); background: transparent; }
.pill-azul  { color: #93c5fd; border-color: rgba(37, 99, 235, 0.5); background: rgba(37, 99, 235, 0.12); }
.pill-ambar { color: #fcd34d; border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.1); }

/* ---------- Grilla de imágenes ---------- */

.grilla-imagenes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.1rem;
}

.item-imagen {
    background: var(--tarjeta);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    padding: 0.9rem;
}

.item-imagen .vista {
    height: 130px;
    background: var(--fondo);
    border: 1px dashed var(--linea-viva);
    border-radius: var(--radio-s);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.75rem;
    color: var(--tenue);
    font-size: 0.8rem;
}
.item-imagen .vista img { max-width: 100%; max-height: 100%; object-fit: contain; }

.item-imagen .clave {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--texto);
    word-break: break-all;
    margin-bottom: 0.15rem;
}
.item-imagen .seccion {
    color: var(--tenue);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
}

/* ---------- Miniatura en tablas ---------- */

.miniatura {
    width: 52px; height: 52px;
    border-radius: var(--radio-s);
    object-fit: cover;
    background: var(--fondo);
    border: 1px solid var(--linea);
    display: block;
}
.miniatura-vacia {
    width: 52px; height: 52px;
    border-radius: var(--radio-s);
    border: 1px dashed var(--linea-viva);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tenue);
    font-size: 0.7rem;
}

/* ---------- Detalle de mensaje ---------- */

.mensaje-detalle {
    background: var(--fondo);
    border: 1px solid var(--linea);
    border-radius: var(--radio-s);
    padding: 1rem 1.15rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.92rem;
    line-height: 1.7;
}

.datos-lista { display: grid; gap: 0.55rem; margin-bottom: 1.25rem; }
.datos-lista div { display: flex; gap: 0.75rem; font-size: 0.9rem; flex-wrap: wrap; }
.datos-lista dt { color: var(--suave); min-width: 90px; }
.datos-lista dd { color: var(--texto); }

/* ---------- Paginado ---------- */

.paginado {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}
.paginado a, .paginado span {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--linea-viva);
    border-radius: var(--radio-s);
    color: var(--suave);
    text-decoration: none;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.paginado a:hover { color: var(--texto); border-color: var(--azul); }
.paginado .actual { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }

/* ---------- Bloque de diagnóstico ---------- */

.diagnostico { display: grid; gap: 0.5rem; }
.diagnostico .linea {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--fondo);
    border: 1px solid var(--linea);
    border-radius: var(--radio-s);
    font-size: 0.87rem;
    flex-wrap: wrap;
}
.diagnostico .linea span:first-child { color: var(--suave); }
.diagnostico .linea .valor { font-family: var(--mono); font-size: 0.82rem; text-align: right; word-break: break-all; }
.diagnostico .bien  { color: #6ee7b7; }
.diagnostico .mal   { color: #fca5a5; }
.diagnostico .aviso-txt { color: #fcd34d; }

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

body.login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.caja-login {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: 14px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.caja-login .marca { text-align: center; font-size: 1.6rem; }
.caja-login .marca-sub { text-align: center; margin-bottom: 1.75rem; }
.caja-login .btn { width: 100%; margin-top: 0.5rem; }
.caja-login .nota {
    text-align: center;
    color: var(--tenue);
    font-size: 0.78rem;
    margin-top: 1.5rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        width: 260px;
    }
    .sidebar.abierto { transform: translateX(0); }
    .menu-toggle { display: block; }
    .principal { margin-left: 0; padding: 4.5rem 1.1rem 3rem; }
    .encabezado h1 { font-size: 1.45rem; }
    .metrica .valor { font-size: 1.8rem; }
    .tarjeta { padding: 1.15rem; }
    .herramientas { flex-direction: column; align-items: stretch; }
    .herramientas input[type="search"], .herramientas select { min-width: 0; width: 100%; }
}

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

/* ===== Stock y precios en pesos ===== */
.pill-rojo  { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.1); }
.stock-rapido { display: flex; gap: .3rem; margin-top: .4rem; align-items: center; }
.stock-rapido input {
    width: 58px; padding: .3rem .45rem; font-size: .8rem;
    background: var(--fondo, #0a0f1d); border: 1px solid var(--linea-viva); border-radius: 6px;
    color: inherit; font-family: inherit; text-align: center;
}
.dolar-vigente { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: baseline; margin-bottom: 1rem; }
.dolar-vigente .valor-grande { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.dolar-vigente .detalle { color: var(--suave); font-size: .85rem; line-height: 1.6; }
.faltante { color: #fca5a5; font-size: .78rem; display: block; }

/* ============================================================
   SOPORTE TÉCNICO
   ============================================================ */
.pestanas { display: flex; gap: .35rem; flex-wrap: wrap; border-bottom: 1px solid var(--linea); margin-bottom: 1.5rem; }
.pestanas a { padding: .6rem 1rem; color: var(--suave); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .9rem; }
.pestanas a:hover { color: var(--texto); }
.pestanas a.activa { color: var(--texto); border-bottom-color: var(--azul); }

.orden-cabecera { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.orden-cabecera .codigo { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; }
.orden-cabecera .sub { color: var(--suave); font-size: .87rem; margin-top: .2rem; }
.orden-columnas { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .orden-columnas { grid-template-columns: 1fr; } }

.vencida { color: #f87171; font-weight: 600; }
.sin-asignar { color: var(--tenue); font-style: italic; }

.linea-tiempo { list-style: none; position: relative; padding-left: 1.25rem; }
.linea-tiempo::before { content: ""; position: absolute; left: .3rem; top: .35rem; bottom: .35rem; width: 2px; background: var(--linea-viva); }
.linea-tiempo li { position: relative; padding: 0 0 1.1rem .5rem; }
.linea-tiempo li::before { content: ""; position: absolute; left: -1.2rem; top: .4rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--tarjeta); border: 2px solid var(--suave); }
.linea-tiempo li.estado::before { border-color: var(--azul); background: var(--azul); }
.linea-tiempo li.publica::before { border-color: var(--verde); }
.linea-tiempo .quien { font-size: .78rem; color: var(--tenue); }
.linea-tiempo .texto { white-space: pre-wrap; margin-top: .15rem; font-size: .92rem; }
.etiqueta-publica { font-size: .68rem; color: #6ee7b7; border: 1px solid rgba(16,185,129,.4); border-radius: 99px; padding: 0 .45rem; margin-left: .3rem; }

.totales { width: 100%; font-size: .92rem; }
.totales td { padding: .3rem 0; border: 0; }
.totales td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totales tr.total td { border-top: 1px solid var(--linea-viva); padding-top: .55rem; font-weight: 700; font-size: 1.02rem; }
.totales tbody tr:hover { background: none; }

.enlace-copiar { display: flex; gap: .4rem; }
.enlace-copiar input { font-family: var(--mono); font-size: .78rem; }

.kb-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.kb-ficha { display: block; background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.1rem 1.2rem; color: inherit; transition: border-color .15s; }
.kb-ficha:hover { border-color: var(--linea-viva); }
.kb-ficha h3 { font-size: 1rem; margin-bottom: .35rem; }
.kb-ficha p { color: var(--suave); font-size: .85rem; }
.kb-ficha .meta { font-size: .75rem; color: var(--tenue); margin-top: .6rem; }
.kb-contenido { font-size: .95rem; line-height: 1.7; }
.kb-contenido h3 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
.kb-contenido h4 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
.kb-contenido p { margin: 0 0 .8rem; }
.kb-contenido ul, .kb-contenido ol { margin: 0 0 .9rem 1.4rem; }
.kb-contenido li { margin-bottom: .25rem; }
.kb-contenido code { font-family: var(--mono); background: var(--fondo); border: 1px solid var(--linea); border-radius: 4px; padding: .05rem .35rem; font-size: .85em; }
.kb-contenido pre { font-family: var(--mono); background: var(--fondo); border: 1px solid var(--linea); border-radius: var(--radio-s); padding: .8rem 1rem; overflow-x: auto; font-size: .82rem; margin-bottom: .9rem; }
.kb-contenido a { color: var(--cyan); text-decoration: underline; }
#repuestos td.numero { white-space: nowrap; }

/* Barra de borrado en bloque (cotizaciones) */
.barra-borrar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem;
    padding: .6rem 1rem; border: 1px solid var(--rojo); border-radius: 10px; background: rgba(239, 68, 68, .08); font-size: .88rem; }
.barra-borrar[hidden] { display: none; }
