/* LuisERP — "workshop notebook": warm technical paper, graphite ink, one safety-orange signal colour. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fuentes/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fuentes/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../fuentes/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fuentes/barlow-condensed-700.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../fuentes/ibm-plex-mono-500.woff2") format("woff2"); }

:root {
    --papel: #f4f1ea;
    --papel-2: #ebe6da;
    --hoja: #fbfaf6;
    --tinta: #1d1f22;
    --tinta-2: #565b62;
    --tinta-3: #8b8f94;
    --linea: #d8d1c2;
    --linea-fuerte: #b9b09d;
    --senal: #e8590c;
    --senal-osc: #b8440a;
    --senal-suave: #fbe3d4;
    --ok: #2f7d4f;
    --error: #b3261e;
    --error-suave: #f8e1df;
    --grafito: #1d1f22;
    --grafito-2: #2a2d31;

    --f-texto: "Barlow", "Segoe UI", sans-serif;
    --f-rotulo: "Barlow Condensed", "Arial Narrow", sans-serif;
    --f-cifra: "IBM Plex Mono", Consolas, monospace;

    --radio: 3px;
    --menu: 232px;
    --barra-movil: 64px;
    --sombra: 0 1px 0 rgba(29, 31, 34, .06), 0 6px 18px -10px rgba(29, 31, 34, .25);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
    font-family: var(--f-texto);
    font-size: 16px;
    line-height: 1.45;
    color: var(--tinta);
    background-color: var(--papel);
    /* Technical paper: a faint dot grid */
    background-image: radial-gradient(rgba(29, 31, 34, .09) 1px, transparent 1.2px);
    background-size: 22px 22px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
    font-family: var(--f-rotulo);
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.1;
    margin: 0;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--senal); outline-offset: 2px; }

.cifra { font-family: var(--f-cifra); font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tenue { color: var(--tinta-2); }
.oculto { display: none !important; }

/* ---------- boot screen (before WASM starts) ---------- */
.arranque {
    min-height: 100vh; display: grid; place-content: center; gap: 18px; justify-items: center;
    background: var(--grafito); color: var(--papel);
}
.arranque-marca { font-family: var(--f-rotulo); font-weight: 700; font-size: 44px; letter-spacing: .08em; }
.arranque-marca span { color: var(--senal); }
.arranque-barra { width: 160px; height: 3px; background: var(--grafito-2); overflow: hidden; }
.arranque-barra i { display: block; height: 100%; width: 40%; background: var(--senal); animation: carga 1.1s ease-in-out infinite; }
@keyframes carga { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

#blazor-error-ui {
    display: none; position: fixed; inset: auto 0 0 0; z-index: 1000; padding: 14px 18px;
    background: var(--error); color: #fff; font-weight: 600;
}
#blazor-error-ui a { color: #fff; margin-left: 8px; }

/* ---------- shell ---------- */
.marco { min-height: 100vh; display: grid; grid-template-columns: var(--menu) 1fr; }

.menu {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
    background: var(--grafito); color: #e9e5dc; padding: 22px 14px 18px;
}
.marca { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; text-decoration: none; }
.marca img { width: 38px; height: 38px; border-radius: var(--radio); }
.marca b { display: block; font-family: var(--f-rotulo); font-size: 24px; letter-spacing: .08em; color: #fff; }
.marca b span { color: var(--senal); }
.marca small { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9a9ea4; margin-top: -2px; }

.menu nav { display: grid; gap: 2px; }
.menu nav a {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: var(--radio); text-decoration: none; color: #c9c5bd;
    font-family: var(--f-rotulo); font-weight: 600; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
    transition: background .15s, color .15s;
}
.menu nav a svg { width: 20px; height: 20px; flex: none; opacity: .8; }
.menu nav a:hover { background: var(--grafito-2); color: #fff; }
.menu nav a.active { background: var(--grafito-2); color: #fff; }
.menu nav a.active::before {
    content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; background: var(--senal);
}
.menu nav a.active svg { opacity: 1; color: var(--senal); }
.menu-pie { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #34383d; font-size: 13px; color: #9a9ea4; }
.menu-pie b { display: block; color: #e9e5dc; font-weight: 600; }

.principal { min-width: 0; padding: 30px clamp(16px, 3.4vw, 44px) 60px; }

.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.cabecera h1 { font-size: clamp(30px, 4vw, 42px); text-transform: uppercase; }
.cabecera h1::after { content: ""; display: block; width: 46px; height: 4px; background: var(--senal); margin-top: 8px; }
.cabecera .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.volver { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--tinta-2); text-decoration: none; margin-bottom: 6px; }
.volver:hover { color: var(--senal-osc); }
.volver svg { width: 16px; height: 16px; }

.barra-movil { display: none; }
.cabecera-movil { display: none; }

/* ---------- buttons ---------- */
.boton {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
    border: 1px solid var(--tinta); border-radius: var(--radio); background: var(--hoja); color: var(--tinta);
    font-family: var(--f-rotulo); font-weight: 600; font-size: 16px; letter-spacing: .07em; text-transform: uppercase;
    text-decoration: none; cursor: pointer; transition: transform .08s, background .15s, box-shadow .15s;
    box-shadow: 0 2px 0 var(--tinta);
}
.boton svg { width: 18px; height: 18px; }
.boton:hover { background: #fff; }
.boton:active { transform: translateY(2px); box-shadow: 0 0 0 var(--tinta); }
.boton.principal-b { background: var(--senal); border-color: var(--senal-osc); color: #fff; box-shadow: 0 2px 0 var(--senal-osc); }
.boton.principal-b:hover { background: #f06519; }
.boton.peligro { color: var(--error); border-color: var(--error); box-shadow: 0 2px 0 var(--error); }
.boton.plano { border-color: transparent; box-shadow: none; background: transparent; }
.boton.plano:hover { background: var(--papel-2); }
.boton:disabled { opacity: .55; cursor: default; transform: none; }

/* ---------- panels, forms ---------- */
.hoja { background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.hoja + .hoja { margin-top: 18px; }
.hoja-titulo {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 18px; border-bottom: 1px solid var(--linea);
    font-family: var(--f-rotulo); font-weight: 700; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--tinta-2);
}
.hoja-cuerpo { padding: 18px; }

.campos { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.campo { grid-column: span 6; display: grid; gap: 5px; min-width: 0; }
.campo.c3 { grid-column: span 3; } .campo.c4 { grid-column: span 4; } .campo.c8 { grid-column: span 8; } .campo.c12 { grid-column: span 12; } .campo.c2 { grid-column: span 2; }
.campo > span { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--tinta-2); }
.entrada {
    width: 100%; min-height: 42px; padding: 9px 11px; background: #fff;
    border: 1px solid var(--linea-fuerte); border-radius: var(--radio);
    transition: border-color .15s, box-shadow .15s;
}
textarea.entrada { min-height: 90px; resize: vertical; }
.entrada:focus { outline: none; border-color: var(--senal); box-shadow: 0 0 0 3px var(--senal-suave); }
.entrada.cifra { text-align: right; }

.marcas { display: flex; flex-wrap: wrap; gap: 8px; }
.marca-op {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; cursor: pointer;
    border: 1px solid var(--linea-fuerte); border-radius: 40px; background: #fff; font-weight: 600; font-size: 15px; user-select: none;
}
.marca-op input { position: absolute; opacity: 0; pointer-events: none; }
.marca-op::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--linea-fuerte); transition: .15s; }
.marca-op:has(input:checked) { border-color: var(--tinta); background: var(--tinta); color: #fff; }
.marca-op:has(input:checked)::before { border-color: var(--senal); background: var(--senal); }

.aviso { padding: 11px 14px; border-radius: var(--radio); font-weight: 600; margin-bottom: 16px; border-left: 4px solid; }
.aviso.error { background: var(--error-suave); color: var(--error); border-color: var(--error); }
.aviso.ok { background: #e3f1e8; color: var(--ok); border-color: var(--ok); }

/* ---------- lists ---------- */
.filtros { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.buscador { position: relative; flex: 1 1 260px; max-width: 460px; }
.buscador svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--tinta-3); }
.buscador .entrada { padding-left: 38px; }
.pestanas { display: inline-flex; border: 1px solid var(--linea-fuerte); border-radius: var(--radio); overflow: hidden; background: #fff; }
.pestanas button {
    border: 0; background: transparent; padding: 0 14px; min-height: 40px; cursor: pointer;
    font-family: var(--f-rotulo); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; font-size: 15px; color: var(--tinta-2);
}
.pestanas button + button { border-left: 1px solid var(--linea); }
.pestanas button.si { background: var(--tinta); color: #fff; }

.lista { list-style: none; margin: 0; padding: 0; }
.fila {
    display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; align-items: center; gap: 14px;
    padding: 13px 18px; border-bottom: 1px solid var(--linea); text-decoration: none; position: relative;
    transition: background .12s; animation: entra .28s ease-out both;
}
.fila:last-child { border-bottom: 0; }
.fila:hover { background: #fff; }
.fila:hover::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--senal); }
.fila b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila small { display: block; color: var(--tinta-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .derecha { text-align: right; }
.fila.inactiva { opacity: .55; }
.lista > :nth-child(1) { animation-delay: .02s; } .lista > :nth-child(2) { animation-delay: .04s; }
.lista > :nth-child(3) { animation-delay: .06s; } .lista > :nth-child(4) { animation-delay: .08s; }
.lista > :nth-child(5) { animation-delay: .10s; } .lista > :nth-child(6) { animation-delay: .12s; }
@keyframes entra { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.etiqueta {
    display: inline-block; padding: 2px 8px; border-radius: 2px; font-family: var(--f-rotulo); font-weight: 600;
    font-size: 13px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--linea-fuerte); color: var(--tinta-2); background: var(--papel);
}
.etiqueta.cli { border-color: var(--tinta); color: var(--tinta); }
.etiqueta.pro { border-color: var(--senal); color: var(--senal-osc); background: var(--senal-suave); }
.etiquetas { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

.vacio { padding: 46px 20px; text-align: center; color: var(--tinta-2); }
.vacio b { display: block; font-family: var(--f-rotulo); font-size: 22px; letter-spacing: .05em; text-transform: uppercase; color: var(--tinta); margin-bottom: 4px; }
.cargando { padding: 40px; text-align: center; color: var(--tinta-3); font-family: var(--f-rotulo); letter-spacing: .14em; text-transform: uppercase; }

/* ---------- home ---------- */
.indicadores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
.indicador {
    position: relative; padding: 18px 20px 16px; text-decoration: none; overflow: hidden;
    background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra);
    animation: entra .35s ease-out both;
}
.indicador:nth-child(2) { animation-delay: .06s; } .indicador:nth-child(3) { animation-delay: .12s; }
.indicador::after { content: ""; position: absolute; right: 0; top: 0; width: 34px; height: 4px; background: var(--senal); }
.indicador span { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--tinta-2); }
.indicador strong { display: block; font-family: var(--f-cifra); font-size: 44px; font-weight: 500; line-height: 1.1; margin-top: 6px; }
.indicador:hover { border-color: var(--linea-fuerte); }
.atajos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.atajo {
    display: flex; align-items: center; gap: 12px; padding: 16px; text-decoration: none;
    border: 1px dashed var(--linea-fuerte); border-radius: var(--radio); background: rgba(251, 250, 246, .7);
    font-family: var(--f-rotulo); font-weight: 600; font-size: 18px; letter-spacing: .05em; text-transform: uppercase;
}
.atajo svg { width: 22px; height: 22px; color: var(--senal); }
.atajo:hover { border-style: solid; border-color: var(--tinta); background: #fff; }
.nota-pie { margin-top: 26px; font-size: 14px; color: var(--tinta-2); }

/* ---------- contacts ---------- */
.contacto { border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px; background: #fff; position: relative; }
.contacto + .contacto { margin-top: 12px; }
.contacto .quitar { position: absolute; top: 6px; right: 6px; }

/* ---------- login ---------- */
.entrar { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.05fr) 1fr; }
.entrar-lado {
    position: relative; overflow: hidden; background: var(--grafito); color: var(--papel);
    padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between;
}
.entrar-lado::before {
    content: ""; position: absolute; inset: 0; opacity: .5;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 44px 44px;
}
.entrar-lado > * { position: relative; }
.entrar-lema { font-family: var(--f-rotulo); font-weight: 700; font-size: clamp(48px, 7.5vw, 104px); line-height: .9; letter-spacing: .01em; text-transform: uppercase; }
.entrar-lema span { color: var(--senal); }
.entrar-lema::after { content: ""; display: block; width: 90px; height: 6px; background: var(--senal); margin-top: 22px; }
.entrar-lado small { font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: #9a9ea4; }
.entrar-form { display: grid; place-content: center; padding: 40px 24px; }
.entrar-caja { width: min(380px, 100%); display: grid; gap: 16px; animation: entra .35s ease-out both; }
.entrar-caja h2 { font-size: 30px; text-transform: uppercase; }
.entrar-caja p { margin: 0; color: var(--tinta-2); }
.entrar-caja .boton { width: 100%; min-height: 48px; }
.codigo { font-family: var(--f-cifra); font-size: 30px; letter-spacing: .4em; text-align: center; padding-left: .4em; }
.qr { width: 220px; margin: 0 auto; padding: 8px; background: #fff; border: 1px solid var(--linea); }
.qr svg { display: block; width: 100%; height: auto; }
.secreto { font-family: var(--f-cifra); font-size: 13px; word-break: break-all; text-align: center; color: var(--tinta-2); background: var(--papel-2); padding: 8px; border-radius: var(--radio); }
.pasos { display: flex; gap: 6px; }
.pasos i { flex: 1; height: 4px; background: var(--linea); }
.pasos i.si { background: var(--senal); }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
    .marco { display: block; padding-bottom: calc(var(--barra-movil) + env(safe-area-inset-bottom)); }
    .menu { display: none; }
    .cabecera-movil {
        display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
        padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--grafito); color: #fff;
    }
    .cabecera-movil img { width: 28px; height: 28px; border-radius: 2px; }
    .cabecera-movil b { font-family: var(--f-rotulo); letter-spacing: .08em; font-size: 20px; }
    .cabecera-movil b span { color: var(--senal); }
    .principal { padding: 18px 14px 30px; }
    .cabecera { margin-bottom: 16px; }
    .cabecera h1 { font-size: 30px; }
    .barra-movil {
        display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30;
        height: calc(var(--barra-movil) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: var(--grafito); border-top: 1px solid #34383d;
    }
    .barra-movil a {
        position: relative; display: grid; place-content: center; justify-items: center; gap: 3px; text-decoration: none; color: #a9adb3;
        font-family: var(--f-rotulo); font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
    }
    .barra-movil a svg { width: 23px; height: 23px; }
    .barra-movil a.active { color: #fff; }
    .barra-movil a.active svg { color: var(--senal); }
    .barra-movil a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--senal); }

    .campo, .campo.c3, .campo.c4, .campo.c8, .campo.c2 { grid-column: span 12; }
    .campo.m6 { grid-column: span 6; }
    .entrada { min-height: 46px; font-size: 16px; }
    .fila { grid-template-columns: minmax(0, 1fr) auto; padding: 13px 14px; }
    .fila .solo-pc { display: none; }
    .indicadores { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .indicador { padding: 12px 12px 10px; }
    .indicador strong { font-size: 30px; }
    .indicador span { font-size: 10px; letter-spacing: .1em; }
    .hoja-cuerpo { padding: 14px; }
    .barra-guardar {
        position: sticky; bottom: calc(var(--barra-movil) + env(safe-area-inset-bottom) + 8px); z-index: 10;
        display: flex; gap: 8px; margin-top: 16px;
    }
    .barra-guardar .boton { flex: 1; min-height: 50px; }
    .cabecera .acciones .boton.solo-pc { display: none; }

    .entrar { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .entrar-lado { padding: calc(28px + env(safe-area-inset-top)) 24px 26px; }
    .entrar-lema { font-size: 52px; }
    .entrar-lema::after { margin-top: 14px; height: 5px; }
    .entrar-lado small { display: none; }
    .entrar-form { place-content: start center; padding-top: 28px; }
}

@media (min-width: 861px) {
    .barra-guardar { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
}

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