/* VIPECON Intelligence · estilos del panel
   Consola de obra: banda de mando oscura y plano técnico claro debajo.
   Colores y medidas tomados del diseño G1.14.0. Sin fuentes externas: todo es local. */

/* ---------- Colores (claro / oscuro) ---------- */
:root {
  --bg: #eceff1; --surface: #ffffff; --surface-2: #f5f7f8; --ink: #142029; --muted: #56636e; --line: #d3dae0;
  --band: #142029; --band-ink: #e8eef2; --band-muted: #9fb0bd;
  --accent: #0b5f86; --accent-ink: #ffffff; --accent-soft: #e2f0f7;
  --help: #f5c518; --help-ink: #2b2200; --help-bg: #fff7cc; --help-line: #e3b500;
  --st-off: #6b7680; --st-off-bg: #eceff1; --st-mock: #6a46b5; --st-mock-bg: #efe9fb; --st-test: #0b6f80; --st-test-bg: #e0f3f5;
  --st-ok: #1c7a3c; --st-ok-bg: #e3f4e8; --st-err: #b42318; --st-err-bg: #fde8e6; --st-warn: #9a5b00; --st-warn-bg: #fdf0db;
  --prop: #d9b44a;
  /* Series de gráficos (validadas: daltonismo y contraste, sobre --surface) y «Otros» en gris */
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-otros: #8a959e;
  --shadow: 0 1px 2px rgba(20, 32, 41, .06), 0 4px 14px rgba(20, 32, 41, .06);
  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f161c; --surface: #17212a; --surface-2: #1c2832; --ink: #e4ebf0; --muted: #98a8b4; --line: #2b3a46;
    --band: #0a1015; --band-ink: #e4ebf0; --band-muted: #8597a5;
    --accent: #4fb3e0; --accent-ink: #06202d; --accent-soft: #15323f;
    --help-bg: #2f2a10; --help-line: #8a7310;
    --st-off: #9aa7b1; --st-off-bg: #24313b; --st-mock: #b9a0f0; --st-mock-bg: #2c2440; --st-test: #5ccbdc; --st-test-bg: #123239;
    --st-ok: #6fd391; --st-ok-bg: #143323; --st-err: #ff8a7d; --st-err-bg: #3d1a17; --st-warn: #f3b65a; --st-warn-bg: #3a2a10;
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-otros: #7d8b96;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }

/* ---------- Banda superior (una fila de 48 px en escritorio) ---------- */
.band { position: sticky; top: 0; z-index: 30; background: var(--band); color: var(--band-ink); }
.topbar { display: flex; align-items: center; gap: 6px 14px; min-height: 48px; padding: 6px 14px; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; flex: none; margin-right: 4px; color: inherit; text-decoration: none; }
.brand span { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--band-muted); white-space: nowrap; }
.marca { display: block; flex: none; -webkit-user-select: none; user-select: none; }
.brand-logo { border-radius: 4px; }
.spaces { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding-left: 10px; border-left: 1px solid #2b3d4b; }
.spaces::-webkit-scrollbar { display: none; }
.sp { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; color: var(--band-muted); font: 600 .88rem/1 var(--f-body); white-space: nowrap; text-decoration: none; }
.sp:hover { color: var(--band-ink); background: rgba(255,255,255,.06); }
.sp[aria-current="true"] { background: #e8eef2; color: #142029; }
.sp i { font-style: normal; color: var(--prop); font-size: .8rem; }
.sp.prop[aria-current="true"] { background: #f1e3b5; color: #2b2200; }
.sp.prop[aria-current="true"] i { color: #8a6a10; }
.spaces > .hi { margin-left: 6px; width: 17px; height: 17px; font-size: 11px; line-height: 15px; }
.sp-more { position: relative; flex: none; }
.sp-more summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 12px; border-radius: 16px; color: var(--band-muted); font: 600 .84rem/1 var(--f-body); cursor: pointer; white-space: nowrap; border: 1px dashed #3c5060; }
.sp-more summary::-webkit-details-marker { display: none; }
.sp-more summary::after { content: "▾"; font-size: .7rem; }
.sp-more summary .n { font-family: var(--f-mono); font-size: .68rem; background: #22323e; color: var(--band-ink); border-radius: 8px; padding: 1px 6px; }
.sp-more.cur summary { background: #e8eef2; color: #142029; border-style: solid; border-color: #e8eef2; }
.sp-more[open] summary { color: var(--band-ink); border-color: #4fb3e0; }
.sp-menu { position: fixed; z-index: 70; margin-top: 6px; min-width: 240px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px; }
.sp-menu a { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.sp-menu a:hover, .sp-menu a[aria-current="true"] { background: var(--accent-soft); }
.sp-menu a b { font-size: .9rem; }
.sp-menu a span { font-size: .75rem; color: var(--muted); }
.bar-tools { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.bar-tools form { margin: 0; }
.bar-tools .hi { width: 17px; height: 17px; font-size: 11px; line-height: 15px; margin-left: -4px; }
.bar-btn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid #34495a; background: transparent; color: var(--band-ink); font: 600 .84rem/1 var(--f-body); cursor: pointer; white-space: nowrap; text-decoration: none; }
.bar-btn:hover { background: rgba(255,255,255,.07); }
.bar-btn.obra { background: #f5c518; border-color: #f5c518; color: #2b2200; }
.bar-btn.obra:hover { filter: brightness(1.05); background: #f5c518; }
.bar-btn.send { background: #2e7d4f; border-color: #2e7d4f; color: #fff; }
.bar-btn.send:hover { filter: brightness(1.08); background: #2e7d4f; }
.bar-btn.pend b { font-family: var(--f-mono); }
.bar-btn.pend.hot { border-color: #f5c518; }
.bar-btn.pend.hot b { color: #f5c518; }
.bar-btn.menu-btn { display: none; font-size: 1.05rem; padding: 0 9px; }
.testtape { display: inline-flex; align-items: center; height: 24px; font-family: var(--f-mono); font-size: .68rem; font-weight: 700; letter-spacing: .06em; padding: 0 8px; border-radius: 3px; color: #fff;
  background: repeating-linear-gradient(-45deg, #0b5f86 0 8px, #0d4c6b 8px 16px); white-space: nowrap; }
.who { font-size: .84rem; color: var(--band-ink); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.hi.guia { width: auto; padding: 0 8px; height: 22px; border-radius: 11px; font: 700 .72rem/20px var(--f-body); font-style: normal; margin-left: 0; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100% - 48px); }
nav.side { border-right: 1px solid var(--line); background: var(--surface); padding: 14px 10px 60px; }
.side h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 10px 6px; font-family: var(--f-body); font-weight: 700; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--r); color: var(--ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--surface-2); }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.side-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; margin-top: 2px; border-radius: var(--r); color: var(--ink); font-weight: 650; cursor: pointer; list-style: none; user-select: none; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex-shrink: 0; }
.side-group[open] > summary::after { transform: rotate(45deg); }
.side-group > summary:hover { background: var(--surface-2); }
.side-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-group.cur > summary { color: var(--accent); }
.side-sub { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.side-sub a { padding: 6px 10px; font-size: .95rem; }
.side-salir { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-salir button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; color: var(--st-err); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.side-salir button:hover { background: var(--st-err-bg); }
.side-salir button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side .count { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.side-space { margin: 2px 6px 6px; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); border-left: 4px solid var(--accent); }
.side-space b { display: block; font-size: 1rem; color: var(--ink); }
.side-space span { font-size: .75rem; color: var(--muted); }
.side-space.prop { background: color-mix(in srgb, var(--prop) 14%, var(--surface)); border-left-color: var(--prop); }
main { padding: 22px 24px 60px; min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .lead { color: var(--muted); max-width: 70ch; margin-top: 6px; }
.crumb { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.title-row { display: flex; align-items: center; gap: 8px; }

/* ---------- Componentes ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel + .panel { margin-top: 14px; }
.panel + .grid, .grid + .panel { margin-top: 14px; }
.barra { position: relative; height: 8px; min-width: 90px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--st-ok); }
.barra.s-warn > i { background: var(--st-warn); }
.barra.s-err > i { background: var(--st-err); }
.barra.s-off > i { background: var(--st-off); }
.consumo { display: flex; align-items: center; gap: 8px; }
.consumo .num { min-width: 4.5em; text-align: right; font-size: .85rem; }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.doc-original { display: block; width: 100%; max-height: 75vh; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.doc-pdf { height: 75vh; }
.texto-literal { margin: 0; max-height: 75vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); font-family: var(--f-mono); font-size: .8rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 12px; border-radius: var(--r); cursor: pointer; font-weight: 600; font-size: .9rem; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--st-err); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-mono); font-size: .7rem; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 3px; white-space: nowrap; text-transform: uppercase; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-off { color: var(--st-off); background: var(--st-off-bg); }
.s-mock { color: var(--st-mock); background: var(--st-mock-bg); }
.s-test { color: var(--st-test); background: var(--st-test-bg); }
.s-ok { color: var(--st-ok); background: var(--st-ok-bg); }
.s-err { color: var(--st-err); background: var(--st-err-bg); }
.s-warn { color: var(--st-warn); background: var(--st-warn-bg); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .78rem; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.field .error { color: var(--st-err); font-size: .82rem; }
.field.invalid input, .field.invalid select { border-color: var(--st-err); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=number], select, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 74px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable:hover td { background: var(--surface-2); }
td a.rowlink { color: var(--ink); text-decoration: none; }
td a.rowlink:hover b { color: var(--accent); text-decoration: underline; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note { border-left: 3px solid var(--line); padding: 6px 10px; color: var(--muted); font-size: .88rem; background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; }
.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 18px; color: var(--muted); }
.kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.kpi > span { font-size: .78rem; color: var(--muted); letter-spacing: .02em; }
.kpi > b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pp-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }

/* ---------- Resumen de construcción ---------- */
.cons-block .cons-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; }
.cons-block .cons-links { margin-top: 12px; flex-wrap: wrap; }
.cons-block ol { margin: 4px 0 0 18px; padding: 0; }

/* ---------- Ayuda: globo amarillo (atributo popover de HTML, sin JavaScript) ---------- */
.hi { flex: none; width: 19px; height: 19px; border-radius: 50%; border: 1px solid var(--help-line); background: var(--help); color: var(--help-ink); font: 700 12px/17px Georgia, "Times New Roman", serif; font-style: italic; text-align: center; padding: 0; cursor: help; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.hi:hover { filter: brightness(1.06); }
.balloon { width: min(360px, calc(100vw - 32px)); background: var(--help-bg); color: var(--ink); border: 1px solid var(--help-line); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; font-size: .9rem; text-align: left; }
.balloon::backdrop { background: rgba(10, 16, 21, .2); }
.balloon h4 { font-family: var(--f-display); font-size: .98rem; display: flex; gap: 8px; align-items: center; margin: 0 22px 6px 0; }
.balloon h4 .hi { cursor: default; }
.balloon .lbl { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 8px; }
.balloon ol { margin: 4px 0 0; padding-left: 18px; }
.balloon li + li { margin-top: 2px; }
.balloon .x { position: absolute; top: 6px; right: 6px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; color: var(--muted); }
@media (max-width: 600px) {
  .balloon { inset: auto 0 0 0; width: 100%; max-width: none; margin: 0; border-radius: 14px 14px 0 0; max-height: 70vh; overflow: auto; }
}

/* ---------- Avisos ---------- */
.flash { border: 1px solid var(--st-ok); background: var(--st-ok-bg); color: var(--ink); border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; }
.denied { border: 1px solid var(--st-err); background: var(--st-err-bg); color: var(--ink); border-radius: var(--r); padding: 16px; }

/* ---------- Paginación ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: .86rem; color: var(--muted); }

/* ---------- Acceso ---------- */
.login-box { max-width: 440px; margin: 6vh auto 0; padding: 0 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) { .brand span, .bar-btn .lbl { display: none; } }
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .spaces { order: 3; flex-basis: 100%; border-left: 0; padding-left: 0; border-top: 1px solid #22323e; padding-top: 6px; }
}
@media (max-width: 980px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .band { position: static; }
  .shell { grid-template-columns: 1fr; }
  nav.side { display: none; position: fixed; top: 0; left: 0; bottom: 0; width: min(290px, 86vw); z-index: 60; overflow-y: auto; box-shadow: var(--shadow); }
  nav.side.open { display: block; }
  .bar-btn.menu-btn { display: inline-flex; }
  .topbar { gap: 6px 8px; padding: 6px 10px; }
  .topbar .testtape, .bar-tools > .hi:not(.guia), .spaces > .hi { display: none; }
  .bar-tools { gap: 6px; }
  main { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .brand-logo { width: 47px; height: 22px; }
  .bar-tools { margin-left: 0; flex: 1; justify-content: flex-end; }
  .bar-btn.obra { padding: 0 8px; }
}
/* ---------- Galería (Recibidos por Telegram) ---------- */
.filtros-galeria { margin: 14px 0 6px; }
.segmentos { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.segmentos a { padding: 6px 12px; font-size: .88rem; font-weight: 600; color: var(--ink); text-decoration: none; border-right: 1px solid var(--line); }
.segmentos a:last-child { border-right: 0; }
.segmentos a:hover { background: var(--surface-2); }
.segmentos a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.galeria-vacia { text-align: center; padding: 36px 18px; display: grid; gap: 8px; justify-items: center; }
.dia-galeria + .dia-galeria { margin-top: 6px; }
.dia-cabecera { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.foto { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.foto:hover, .foto:focus-within { border-color: var(--accent); }
/* La página entera, sobre papel: con sitio arriba para las marcas y abajo para la hora */
.foto-ver { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 38px 10px 32px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: zoom-in; overflow: hidden; }
.foto-ver img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center top; }
.foto-ver:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.foto-ver.sin-vista img { display: none; }
.foto-ver.sin-vista::after { content: "Sin vista previa"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.foto-marcas { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.foto-marcas .chip { box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.foto-hora { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 3px; background: rgba(10, 16, 21, .74); color: #fff; font-family: var(--f-mono); font-size: .72rem; }
.foto-pie { display: grid; gap: 5px; padding: 10px 12px 12px; min-width: 0; }
.foto-nombre { font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foto-nombre:hover { color: var(--accent); text-decoration: underline; }
.foto-linea { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.foto-linea > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto-datos { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .88rem; min-width: 0; }
.foto-datos b { white-space: nowrap; }
.foto-proveedor { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* ---------- Visor a pantalla completa ---------- */
.visor { width: min(1200px, 96vw); height: min(880px, 92vh); max-width: none; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(0, 0, 0, .5); }
.visor::backdrop { background: rgba(6, 10, 14, .8); }
.visor[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.visor-cabecera { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.visor-titulo { flex: 1; min-width: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-cerrar { font-size: 1.1rem; padding: 4px 10px; }
.visor-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.visor-imagen { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: auto; background: #0b1116; }
.visor-imagen img { max-width: calc(100% - 24px); max-height: calc(100% - 24px); object-fit: contain; cursor: zoom-in; background: #fff; box-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
.visor-imagen.ampliada { align-items: flex-start; justify-content: flex-start; }
.visor-imagen.ampliada img { max-width: none; max-height: none; margin: 12px; cursor: zoom-out; }
.visor-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; }
.visor-nav:hover { background: rgba(255, 255, 255, .3); }
.visor-nav:focus-visible { outline: 3px solid var(--accent); }
.visor-nav.anterior { left: 12px; }
.visor-nav.siguiente { right: 12px; }
.visor-nav[hidden] { display: none; }
.visor-imagen.ampliada .visor-nav { position: fixed; }
.visor-pista { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 3px 10px; border-radius: 3px; background: rgba(10, 16, 21, .7); color: #dfe7ec; font-size: .75rem; white-space: nowrap; pointer-events: none; }
.visor-datos { display: grid; align-content: start; gap: 14px; padding: 16px; border-left: 1px solid var(--line); overflow: auto; }
.visor-datos .stack .btn { justify-content: center; }
@media (max-width: 600px) {
  .pp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .visor { width: 100vw; height: 100vh; max-height: 100dvh; border-radius: 0; }
  .visor-cuerpo { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .visor-datos { border-left: 0; border-top: 1px solid var(--line); max-height: 42vh; }
  .visor-pista { display: none; }
}

/* ---------- Almacén de precios: gráfico de evolución ---------- */
.leyenda { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: .86rem; color: var(--ink); }
.leyenda li { display: inline-flex; align-items: center; gap: 6px; }
.serie-1 { --c: var(--serie-1); } .serie-2 { --c: var(--serie-2); } .serie-3 { --c: var(--serie-3); } .serie-otros { --c: var(--serie-otros); }
.leyenda svg { fill: var(--c); }
.grafico { position: relative; }
@media (max-width: 700px) {
  /* En el móvil el gráfico no se encoge hasta no poder leerse: se desliza de lado dentro de su caja. */
  .grafico { overflow-x: auto; overscroll-behavior-x: contain; }
  .grafico svg { min-width: 640px; }
}
.grafico svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--f-body); }
.g-rejilla line { stroke: var(--line); stroke-width: 1; }
.g-rejilla line.g-base { stroke: var(--muted); }
.g-rejilla text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-serie polyline { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.g-serie circle, .g-serie rect, .g-serie polygon { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.g-serie .g-etiqueta { fill: var(--ink); font-size: 11px; font-weight: 650; }
.g-serie .g-valor { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.g-guia { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.g-guia[hidden] { display: none; }
.g-zonas circle { fill: transparent; cursor: pointer; }
.g-zonas circle:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; }
.g-globo { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 5px 9px; font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fila-mejor td { background: var(--st-ok-bg); }
.iva-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.iva-caja select:disabled { opacity: .55; }
@media (forced-colors: active) {
  .g-serie polyline { stroke: CanvasText; }
  .g-serie circle, .g-serie rect, .g-serie polygon, .leyenda svg { fill: CanvasText; }
}

@media (prefers-reduced-motion: no-preference) {
  .foto { transition: border-color .15s, box-shadow .15s, transform .15s; }
  .foto:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(20, 32, 41, .08), 0 10px 24px rgba(20, 32, 41, .12); }
  .visor[open] { animation: rise .16s ease-out; }
  .balloon:popover-open { animation: rise .16s ease-out; }
  @keyframes rise { from { transform: translateY(4px); opacity: .6; } to { transform: none; opacity: 1; } }
}
