/* Estilos de la intranet. Colores en variables (azul y rojo del logo). Modo oscuro automático. */
:root {
  --fondo: #eef1f5;
  --hoja: #ffffff;
  --card: #ffffff;
  --suave: #f6f8fb;
  --texto: #1b2433;
  --muted: #6b7686;
  --borde: #e2e7ee;
  --primario: #2f6fd6;
  --primario-osc: #0b3fb0;
  --primario-txt: #ffffff;
  --rojo-marca: #ef2b1d;
  --pos: #15803d;
  --neg: #d42a20;
  --ambar: #c58a12;
  --morado: #7c4dcc;
  --alerta-fondo: #fff6e6;
  --radio: 14px;
  --radio-s: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0f131a;
    --hoja: #161b24;
    --card: #1b212c;
    --suave: #1f2633;
    --texto: #e7ebf1;
    --muted: #9aa5b5;
    --borde: #2c3442;
    --primario: #5d93ee;
    --primario-osc: #8db4ff;
    --pos: #4cc77a;
    --neg: #ff6b62;
    --ambar: #f0b04b;
    --morado: #b393f5;
    --alerta-fondo: #3a2c12;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, sans-serif; }
/* Tipografía igual a la intranet Vive Tu Campo: títulos Archivo, texto IBM Plex Sans, montos IBM Plex Mono */
h1, h2, h3, .nav-principal a, .pestanas a, .btn, legend, .kpi-t, .etiqueta, .tabla thead th, .bienvenida-txt h2, .usuario-txt strong { font-family: "Archivo", system-ui, sans-serif; }
.kpi strong, .tabla .num, .bienvenida-nums strong, .total-compra, .embudo a strong, input[data-money], input[data-miles] { font-family: "IBM Plex Mono", "SF Mono", ui-monospace, monospace; }
a { color: var(--primario); }
h1 { font-size: 1.8rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-wrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.alerta-txt { color: var(--ambar); font-weight: 600; }
.etiqueta { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 1.5rem 0 .6rem; }
.etiqueta:first-child { margin-top: 0; }

/* Estructura */
.pagina { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }
.cabecera { background: var(--hoja); border-radius: var(--radio); padding: 1.2rem 1.5rem .6rem; box-shadow: 0 1px 2px rgba(15, 30, 60, .05); position: relative; overflow: hidden; }
.cabecera::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--rojo-marca), var(--primario-osc) 40%, var(--primario)); }
.cabecera-fila { display: flex; align-items: center; gap: 1.25rem; }
.logo { display: flex; flex-direction: column; text-decoration: none; flex: 0 0 auto; }
.logo img { height: 48px; width: auto; display: block; }
.logo-sub { font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: .1rem; padding-left: .2rem; }
@media (prefers-color-scheme: dark) { .logo img, .login img { filter: drop-shadow(0 0 1px rgba(255, 255, 255, .9)) drop-shadow(0 0 6px rgba(255, 255, 255, .25)); } }
.buscador { flex: 1; max-width: 380px; margin-left: auto; display: flex; align-items: center; gap: .4rem; border: 1px solid var(--borde); border-radius: var(--radio-s); padding: 0 .75rem; background: var(--hoja); }
.buscador span { color: var(--muted); }
.buscador input { border: 0; padding: .6rem 0; background: transparent; outline: none; }
.usuario { display: flex; align-items: center; gap: .75rem; }
.usuario-txt { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.usuario-txt strong { font-size: .9rem; }
.usuario-txt a { font-size: .8rem; text-decoration: none; font-weight: 600; }
.usuario-txt small { font-size: .72rem; color: var(--muted); }
.avatar { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--primario); color: var(--primario); display: grid; place-items: center; font-weight: 700; text-decoration: none; background: var(--suave); flex: 0 0 auto; }
.nav-principal { display: flex; gap: .25rem; margin-top: 1rem; overflow-x: auto; scrollbar-width: none; }
.nav-principal::-webkit-scrollbar { display: none; }
.nav-principal a { padding: .55rem .9rem; border-radius: var(--radio-s); text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.nav-principal a:hover { color: var(--texto); background: var(--suave); }
.nav-principal a.activo { color: var(--texto); background: var(--suave); }
.pestanas { display: flex; gap: .4rem; background: var(--suave); border: 1px solid var(--borde); border-radius: var(--radio); padding: .55rem; margin-top: .9rem; overflow-x: auto; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas a { padding: .55rem 1rem; border-radius: var(--radio-s); text-decoration: none; color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.pestanas a:hover { color: var(--texto); }
.pestanas a.activo { background: var(--hoja); color: var(--texto); border-color: var(--borde); box-shadow: 0 1px 2px rgba(15, 30, 60, .06); }
.hoja { background: var(--hoja); border-radius: var(--radio); padding: 1.75rem 1.75rem 2rem; margin-top: .9rem; box-shadow: 0 1px 2px rgba(15, 30, 60, .05); min-height: 50vh; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.subtitulo { color: var(--muted); margin: .35rem 0 0; }
.botones { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio-s); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card-suave { background: var(--suave); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi { background: var(--card); border: 1px solid var(--borde); border-left: 3px solid var(--primario); border-radius: var(--radio-s); padding: .95rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: var(--texto); min-width: 0; }
a.kpi:hover { box-shadow: 0 2px 8px rgba(15, 30, 60, .08); }
.kpi-t { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: .8rem; }
.kpi-verde { border-left-color: var(--pos); } .kpi-verde strong { color: var(--pos); }
.kpi-rojo { border-left-color: var(--neg); } .kpi-rojo strong { color: var(--neg); }
.kpi-ambar { border-left-color: var(--ambar); }
.kpi-morado { border-left-color: var(--morado); }
.kpi-gris { border-left-color: var(--borde); }
.kpi.alerta { background: var(--alerta-fondo); }
.kpis-chicos .kpi strong { font-size: 1.2rem; }

/* Bienvenida */
.bienvenida { display: flex; align-items: center; gap: 1.25rem; background: linear-gradient(120deg, #e9f1ff, #f4f7fb 60%, #fdeceb); border: 1px solid #cfdcf3; border-radius: var(--radio); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { .bienvenida { background: linear-gradient(120deg, #17233a, #1b212c 60%, #2a1a1d); border-color: #2c3a55; } }
.bienvenida .avatar { width: 64px; height: 64px; font-size: 1.3rem; }
.bienvenida-txt { flex: 1; min-width: 220px; }
.bienvenida-txt small { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primario); }
.bienvenida-txt h2 { font-size: 1.35rem; margin: .2rem 0; color: var(--primario-osc); }
.bienvenida-nums { display: flex; gap: 2rem; }
.bienvenida-nums div { text-align: center; }
.bienvenida-nums strong { display: block; font-size: 1.6rem; color: var(--primario-osc); font-variant-numeric: tabular-nums; }
.bienvenida-nums span { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* Tablas */
.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th, .tabla td { padding: .6rem .6rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
.tabla thead th { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; background: var(--suave); }
.tabla thead th:first-child { border-top-left-radius: 8px; } .tabla thead th:last-child { border-top-right-radius: 8px; }
.tabla tbody tr:hover td { background: var(--suave); }
.tabla tfoot th { border-bottom: 0; border-top: 2px solid var(--borde); }
.tabla .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla tr.inactivo td { color: var(--muted); }
.mini-foto { width: 64px; }
.mini-foto img { width: 60px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }
.acciones-fila { white-space: nowrap; }
.acciones-fila form { display: inline; }

/* Insignias */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .18rem .6rem; border-radius: 999px; background: var(--suave); border: 1px solid var(--borde); vertical-align: middle; white-space: nowrap; }
.est-disponible, .lead-ganado, .badge-ok { background: #e3f6ea; color: #13612f; border-color: #b8e3c8; }
.est-reservado, .lead-negociando, .lead-visita, .badge-alerta { background: #fff3dd; color: #8a5300; border-color: #f2d49c; }
.est-vendido { background: #e6eeff; color: #1f43a3; border-color: #c4d3f7; }
.est-consignacion { background: #f1e8ff; color: #6b2fa8; border-color: #dcc5f6; }
.lead-nuevo { background: #e0f2fe; color: #075985; border-color: #b6dcf5; }
.lead-perdido { background: #f1f3f6; color: #6b7280; }
.badge-ingreso { background: #e3f6ea; color: #13612f; border-color: #b8e3c8; }
.badge-egreso { background: #fdeceb; color: #a1251c; border-color: #f4c6c2; }
.badge-transferencia { background: #e6eeff; color: #1f43a3; border-color: #c4d3f7; }
@media (prefers-color-scheme: dark) {
  .est-disponible, .lead-ganado, .badge-ok, .badge-ingreso { background: rgba(76, 199, 122, .14); color: #8fe0ad; border-color: rgba(76, 199, 122, .35); }
  .est-reservado, .lead-negociando, .lead-visita, .badge-alerta { background: rgba(240, 176, 75, .14); color: #f5c77e; border-color: rgba(240, 176, 75, .35); }
  .est-vendido, .badge-transferencia { background: rgba(93, 147, 238, .16); color: #a9c4ff; border-color: rgba(93, 147, 238, .38); }
  .est-consignacion { background: rgba(179, 147, 245, .15); color: #cdb8fa; border-color: rgba(179, 147, 245, .35); }
  .lead-nuevo { background: rgba(56, 189, 248, .13); color: #8fd6f7; border-color: rgba(56, 189, 248, .35); }
  .lead-perdido { background: rgba(154, 165, 181, .12); color: #b5bfcc; border-color: rgba(154, 165, 181, .3); }
  .badge-egreso { background: rgba(255, 107, 98, .14); color: #ffaaa4; border-color: rgba(255, 107, 98, .35); }
}

/* Formularios */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-weight: 400; color: var(--texto); background: var(--hoja); border: 1px solid var(--borde); border-radius: var(--radio-s); padding: .55rem .7rem; min-width: 0; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primario); outline-offset: -1px; }
input[type=checkbox] { width: auto; accent-color: var(--primario); }
input[type=file] { padding: .4rem; }
.mayus { text-transform: uppercase; }
label.check { flex-direction: row; align-items: center; gap: .45rem; color: var(--texto); font-size: .9rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.form-grid.una-col { grid-template-columns: 1fr; gap: .8rem; }
.form-grid.sub { margin-top: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.form-grid .ancho { grid-column: 1 / -1; }
.angosto { max-width: 440px; }
fieldset { border: 1px solid var(--borde); border-radius: var(--radio-s); padding: .9rem 1.1rem 1.1rem; margin: 0; display: flex; flex-direction: column; gap: .75rem; min-width: 0; background: var(--card); }
legend { font-weight: 700; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 .4rem; }
.form-linea { display: flex; flex-wrap: wrap; gap: .65rem; align-items: flex-end; margin-top: .8rem; }
.form-linea label { flex: 1 1 150px; }
.fila { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.fila input[type=file] { flex: 1; }
.filtros { display: flex; flex-wrap: wrap; gap: .65rem; align-items: flex-end; background: var(--suave); }
.filtros label { flex: 0 1 200px; }
.acciones { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .9rem; padding: .6rem 1.05rem; border-radius: var(--radio-s); border: 1px solid var(--borde); background: var(--hoja); color: var(--texto); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--primario); }
.btn-primario { background: var(--primario); color: var(--primario-txt); border-color: var(--primario); box-shadow: 0 2px 6px rgba(47, 111, 214, .25); }
.btn-primario:hover { background: var(--primario-osc); border-color: var(--primario-osc); }
.btn-peligro { background: var(--neg); color: #fff; border-color: var(--neg); }
.btn-chico { padding: .35rem .7rem; font-size: .8rem; }
button.link { background: none; border: 0; padding: 0; color: var(--primario); cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; }
button.link.peligro, .peligro { color: var(--neg); }

/* Avisos */
.aviso { padding: .75rem 1rem; border-radius: var(--radio-s); margin-bottom: 1rem; border: 1px solid; }
.aviso-ok { background: #e3f6ea; border-color: #b8e3c8; color: #13612f; }
.aviso-error { background: #fdeceb; border-color: #f4c6c2; color: #9b1c1c; }
.aviso-info { background: #e9f1ff; border-color: #c9daf8; color: #1f43a3; }
@media (prefers-color-scheme: dark) {
  .aviso-ok { background: #123222; color: #a6e6bf; border-color: #1f5a37; }
  .aviso-error { background: #3a1616; color: #ffc2c2; border-color: #6a2424; }
  .aviso-info { background: #17233a; color: #b9cdf5; border-color: #2c3a55; }
}

/* Ficha */
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.datos dt { color: var(--muted); font-size: .85rem; }
.datos dd { margin: 0; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.galeria figure { margin: 0; }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; }
.galeria figcaption { display: flex; justify-content: space-between; padding-top: .2rem; }
.archivos { list-style: none; padding: 0; margin: 0; }
.archivos li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .4rem 0; border-bottom: 1px solid var(--borde); }
.historial { list-style: none; padding: 0; margin: 1rem 0; font-size: .9rem; }
.historial li { padding: .45rem 0; border-bottom: 1px solid var(--borde); }
.zona-peligro { border-color: #f4c6c2; }
.progreso { height: 8px; border-radius: 99px; background: var(--suave); border: 1px solid var(--borde); overflow: hidden; margin-top: .4rem; }
.progreso span { display: block; height: 100%; background: var(--pos); }

/* Embudo de leads */
.embudo { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; margin-bottom: 1rem; }
.embudo a { display: flex; flex-direction: column; text-decoration: none; padding: .65rem .8rem; border-radius: var(--radio-s); border: 1px solid var(--borde); color: inherit; }
.embudo a span { font-size: .78rem; font-weight: 600; }
.embudo a strong { font-size: 1.25rem; }
.embudo a.activo { outline: 2px solid var(--primario); }

/* Gráfico de barras simple */
.barras { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 1rem; }
.barra-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.barra-par { display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; height: 100%; }
.barra { width: 100%; max-width: 22px; background: var(--primario); border-radius: 4px 4px 0 0; }
.barra.gamer { background: var(--rojo-marca); }
.barra.neg { opacity: .45; }
.barra-val { font-size: .72rem; color: var(--muted); }
.barra-lbl { font-size: .65rem; color: var(--muted); margin-top: .3rem; white-space: nowrap; }
.leyenda { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); justify-content: flex-end; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* Venta de consolas: lista de productos elegibles */
.elegir { max-height: 420px; overflow: auto; border: 1px solid var(--borde); border-radius: var(--radio-s); }
.elegir .tabla td { padding: .4rem .6rem; }
.elegir input[type=text] { max-width: 140px; }
.items-compra td { padding: .35rem .3rem; }
.items-compra input, .items-compra select { padding: .45rem .5rem; font-size: .88rem; }
.total-compra { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: flex-end; padding: .75rem 0; font-variant-numeric: tabular-nums; }

/* Login */
.sin-sesion .pagina { max-width: 420px; padding-top: 8vh; }
.sin-sesion .hoja { min-height: 0; }
.login { text-align: center; }
.login img { max-width: 240px; margin-bottom: .5rem; }
.login form { text-align: left; display: flex; flex-direction: column; gap: .85rem; border: 0; padding: 0; }

/* Celular */
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .buscador { display: none; }
  .usuario-txt small { display: none; }
}
@media (max-width: 760px) {
  .pagina { padding: .6rem .6rem 3rem; }
  .cabecera { padding: .9rem 1rem .4rem; }
  .logo img { height: 38px; }
  .usuario-txt { display: none; }
  .hoja { padding: 1.1rem 1rem 1.5rem; }
  h1 { font-size: 1.45rem; }
  .embudo { grid-template-columns: repeat(3, 1fr); }
  .filtros label { flex: 1 1 100%; }
  .bienvenida-nums { gap: 1rem; }
  /* Tablas como tarjetas: cada celda muestra su encabezado (data-label lo pone app.js) */
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td, .tabla tfoot, .tabla tfoot tr, .tabla tfoot th { display: block; width: 100%; }
  .tabla tr { border-bottom: 1px solid var(--borde); padding: .55rem 0; }
  .tabla td, .tabla th { border: 0; padding: .15rem 0; text-align: left !important; }
  .tabla td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--muted); font-size: .78rem; }
  .tabla tbody tr:hover td { background: none; }
  .mini-foto img { width: 100%; height: 150px; }
  .barra-lbl { writing-mode: vertical-rl; transform: rotate(180deg); }
  .items-compra td::before { display: block; }
}
[hidden] { display: none !important; }
.items-compra input[name="items[nombre][]"] { min-width: 170px; }
.items-compra select { min-width: 105px; }
.items-compra input[data-money] { min-width: 110px; }
@media (max-width: 860px) { .usuario { margin-left: auto; } }
select.autocompletado { outline: 2px solid var(--pos); transition: outline-color .6s; }
/* Revisión 3: tarjetas más sobrias */
.card-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.card-cab h2 { margin: 0; }
.card-cab > a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.resumen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0; }
.resumen dt { font: 700 .68rem "Archivo", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); grid-row: 1; }
.resumen dd { margin: 0; font: 500 1.25rem "IBM Plex Mono", monospace; grid-row: 2; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bienvenida { background: var(--suave); border-color: var(--borde); }
.bienvenida-txt h2 { color: var(--texto); }
.bienvenida-txt small { color: var(--muted); }
.bienvenida-nums strong { color: var(--texto); }
.foto-perfil { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.foto-perfil .avatar { width: 88px; height: 88px; font-size: 1.6rem; }
.btn-icono { background: none; border: 0; cursor: pointer; color: var(--muted); padding: .2rem; display: inline-grid; place-items: center; }
.btn-icono:hover { color: var(--neg); }
@media (max-width: 760px) { .resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); } .resumen dt, .resumen dd { grid-row: auto; } }

/* Interfaz de gestión: jerarquía simple, color reservado para acciones y estados. */
:root { --fondo: #f3f4f6; --primario: #2455a4; --primario-osc: #163e7c; --radio: 10px; --radio-s: 6px; --muted: #596576; }
.cabecera { padding: 1.25rem 1.5rem 0; border: 1px solid var(--borde); box-shadow: none; }
.cabecera::before { display: none; }
.nav-principal { gap: 1.25rem; }
.nav-principal a { padding: .85rem .25rem; border-radius: 0; border-bottom: 2px solid transparent; }
.nav-principal a.activo { background: transparent; border-bottom-color: var(--primario); color: var(--primario); }
.pestanas { background: transparent; border: 0; padding: .25rem 0; gap: .25rem; }
.pestanas a { font-size: .88rem; padding: .5rem .85rem; }
.pestanas a.activo { box-shadow: none; }
.hoja { box-shadow: none; border: 1px solid var(--borde); padding: 2rem; }
.encabezado { margin-bottom: 1.75rem; }
h1 { font-size: 1.7rem; letter-spacing: -.035em; }
.btn-primario { box-shadow: none; }
.kpi { border-left-width: 1px; padding: 1.15rem 1.25rem; }
.kpi strong { font-size: 1.6rem; }
.kpi-t, .resumen dt { letter-spacing: .02em; text-transform: none; font-size: .8rem; font-weight: 500; }
.kpi-morado, .kpi-ambar { border-left-color: var(--borde); }
.card { padding: 1.25rem; }
.card-cab { margin-bottom: 1.25rem; }
.resumen { grid-template-columns: minmax(0, 1fr) auto; gap: .65rem 1rem; }
.resumen dt, .resumen dd { grid-row: auto; }
.resumen dt { align-self: center; }
.resumen dd { font-size: 1rem; text-align: right; }
.detalle-panel { margin-top: 1.5rem; border-top: 1px solid var(--borde); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; padding: .65rem 0; }
.detalle-panel > .grid-2 { margin-top: 1rem; }
.tabla td { padding-top: .85rem; padding-bottom: .85rem; }
.tabla a { text-decoration: none; }
.tabla a:hover { text-decoration: underline; }
.filtros { background: var(--card); }
.avatar { border: 1px solid var(--borde); }
:focus-visible { outline: 2px solid var(--primario); outline-offset: 3px; }
.buscador:focus-within { outline: 2px solid var(--primario); }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.datos dd, .archivos a { overflow-wrap: anywhere; min-width: 0; }
input, select, textarea, .btn { min-height: 44px; }
input[type=checkbox] { min-height: 22px; min-width: 22px; }
button.link { min-height: 36px; }
@media (prefers-color-scheme: dark) {
  :root { --fondo: #10151d; --primario: #8cb3f2; --primario-osc: #adcaff; --muted: #a8b2c1; }
  .btn-primario { background: #2455a4; border-color: #2455a4; color: #fff; }
  .btn-primario:hover { background: #163e7c; }
}
@media (max-width: 760px) {
  .pagina { padding: .5rem .5rem 2rem; }
  .cabecera { padding: 1rem 1rem 0; }
  .cabecera-fila { flex-wrap: wrap; gap: .75rem; }
  .usuario-txt { display: flex; }
  .usuario-txt strong { display: none; }
  .logo img { height: 34px; max-width: 155px; object-fit: contain; }
  .logo-sub { font-size: .6rem; letter-spacing: .1em; }
  .avatar { width: 40px; height: 40px; }
  .nav-principal { margin-top: .65rem; gap: 1rem; }
  .nav-principal a { font-size: .88rem; }
  .hoja { padding: 1.25rem 1rem; }
  .kpis { grid-template-columns: 1fr; gap: .65rem; }
  .kpi { padding: .85rem 1rem; }
  .kpi strong { font-size: 1.4rem; }
  .kpis-chicos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .botones { width: 100%; }
  .botones > .btn { flex: 1 1 auto; white-space: normal; }
  .encabezado { margin-bottom: 1.25rem; }
  .tabla-wrap { overflow-x: visible; }
  .tabla tbody tr { margin-bottom: .75rem; padding: 1rem; border: 1px solid var(--borde); border-radius: var(--radio-s); }
  .tabla td { padding: .2rem 0; white-space: normal; overflow-wrap: anywhere; }
  .mini-foto:empty { display: none; }
  .mini-foto img { height: 190px; margin-bottom: .5rem; }
  .form-grid, .form-grid.sub { grid-template-columns: 1fr; }
  .items-compra input[name="items[nombre][]"], .items-compra select, .items-compra input[data-money] { min-width: 0; }
  .card-cab { flex-wrap: wrap; }
  .fila input[type=file] { flex-basis: 100%; }
  .datos { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .foto-perfil form { min-width: 0; flex-basis: 100% !important; }
  input, select, textarea { font-size: 16px; }
}
@media print { .detalle-panel > .grid-2 { display: grid; } }
