
/* Layout: sticky brand bar + month stepper, tab strip, one working panel per tab (summary first, detail below) */
:root {
  --bg: #F4F2EC; --surface: #FFFFFF; --surface2: #ECE9E1; --fg: #0E1512; --muted: #4B5550; --line: #D6D2C6;
  --lime: #C8F25A; --on-lime: #0E1512; --lime-text: #2F5A10; --bar-own: #1B2520; --bar-fr: #8DBE24; --icon-handle: #C8F25A;
  --ok: #2F7A3B; --ok-bg: #DFF0DA; --warn: #8A5A00; --warn-bg: #FBEBC5; --bad: #A8321F; --bad-bg: #F8DDD6;
  --display: 'Bricolage Grotesque', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1512; --surface: #1B2520; --surface2: #26332C; --fg: #F4F2EC; --muted: #A9B3AD; --line: #34423A;
  --lime: #C8F25A; --on-lime: #0E1512; --lime-text: #C8F25A; --bar-own: #DCE3DE; --bar-fr: #C8F25A; --icon-handle: #0E1512;
  --ok: #8FD99A; --ok-bg: #1E3A25; --warn: #F2C66B; --warn-bg: #3D3117; --bad: #FF9B86; --bad-bg: #432019; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0E1512; --surface: #1B2520; --surface2: #26332C; --fg: #F4F2EC; --muted: #A9B3AD; --line: #34423A;
  --lime: #C8F25A; --on-lime: #0E1512; --lime-text: #C8F25A; --bar-own: #DCE3DE; --bar-fr: #C8F25A; --icon-handle: #0E1512;
  --ok: #8FD99A; --ok-bg: #1E3A25; --warn: #F2C66B; --warn-bg: #3D3117; --bad: #FF9B86; --bad-bg: #432019; color-scheme: dark }
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 0 48px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h2 { font-size: 22px; }
h3 { font-size: 16px; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.topin { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.brand b { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -0.03em; }
.brand span { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lime-text); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--fg); cursor: pointer; font-size: 16px; }
.stepper button:hover { background: var(--surface2); }
.stepper strong { min-width: 128px; text-align: center; font-weight: 700; text-transform: capitalize; }
nav.tabs { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; overflow-x: auto; }
nav.tabs button { border: 0; background: none; color: var(--muted); font: 600 14px var(--body); padding: 10px 12px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
nav.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--lime); }

/* surfaces */
.panel { display: grid; gap: 18px; padding-top: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.kpi .lab { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpi .val { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 5vw, 26px); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.hero { background: var(--fg); color: var(--bg); border-color: var(--fg); position: relative; overflow: hidden; }
.kpi.hero .lab, .kpi.hero .sub { color: color-mix(in srgb, var(--bg) 72%, var(--fg)); }
.kpi.hero::after { content: ""; position: absolute; top: 0; right: 0; width: 34px; height: 28px; background: var(--lime); border-radius: 0 var(--r) 0 0; }

/* tables */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 800; border-top: 2px solid var(--fg); }
.code { font-weight: 800; font-family: var(--display); letter-spacing: -0.01em; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: var(--surface2); color: var(--fg); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.lime { background: var(--lime); color: var(--on-lime); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* forms */
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
input, select, textarea { font: 500 14px var(--body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 100%; min-width: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--lime-text); outline-offset: 2px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.btn { font: 700 13px var(--body); border-radius: 10px; padding: 9px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--lime); color: var(--on-lime); border-color: var(--lime); }
.btn.primary:hover { filter: brightness(0.96); }
.btn.dark { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
td input.money { width: 140px; text-align: right; font-variant-numeric: tabular-nums; }
td select { width: auto; padding: 5px 8px; font-size: 13px; }

/* banners and states */
.banner { border-radius: var(--r); padding: 12px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.banner .btn { margin-left: auto; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h3 { color: var(--fg); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart .cv { overflow-x: auto; }
.chart svg { width: 100%; min-width: 520px; height: auto; display: block; }
.chart text { fill: var(--muted); font: 600 11px var(--body); }
.chart .tot { fill: var(--fg); font: 800 11px var(--body); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 700; font-size: 13px; z-index: 20; }
.note { font-size: 12px; color: var(--muted); }
.hint { font-size: 12px; color: var(--lime-text); font-weight: 700; }
.sect-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) { .btn, nav.tabs button { transition: background .15s, border-color .15s; } }

/* ---- PWA: barra superior siempre oscura (bajo la barra de estado del iPhone) ---- */
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.top { background: #0E1512; color: #F4F2EC; border-bottom: 0; top: 0; padding-top: env(safe-area-inset-top, 0px); }
.top .brand b { color: #F4F2EC; }
.top .brand span { color: #C8F25A; }
.top .stepper { background: #1B2520; border-color: #34423A; }
.top .stepper button, .top .stepper strong { color: #F4F2EC; }
.top .stepper button:hover { background: #26332C; }
.top nav.tabs button { color: #A9B3AD; }
.top nav.tabs button[aria-selected="true"] { color: #F4F2EC; border-bottom-color: #C8F25A; }
.userbtn { background: transparent; border: 1px solid #34423A; color: #F4F2EC; border-radius: 99px; padding: 7px 12px; font: 700 12px var(--body); cursor: pointer; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbtn:hover { background: #1B2520; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top, 0px)) 16px 24px; background: #0E1512; }
.auth .box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px; padding: 26px 22px 22px; display: grid; gap: 14px; position: relative; overflow: hidden; }
.auth .box::after { content: ""; position: absolute; top: 0; right: 0; width: 64px; height: 52px; background: #C8F25A; border-radius: 0 20px 0 0; }
.auth h1 { font-size: 26px; line-height: 1.05; }
.auth .lockup { display: flex; align-items: center; gap: 9px; }
.auth .lockup b { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.linkbtn { background: none; border: 0; color: var(--lime-text); font: 700 13px var(--body); cursor: pointer; padding: 4px 0; text-align: left; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; }
.kpi.hero .lab { padding-right: 34px; }

/* Indicadores que se pueden tocar para cambiar el gráfico */
.kpi.kpi-sel { cursor: pointer; text-align: left; -webkit-user-select: none; user-select: none; }
.kpi.kpi-sel:not(.hero):hover { border-color: var(--fg); }
.kpi.kpi-sel:focus-visible { outline: 2px solid var(--lime-text); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .kpi.kpi-sel { transition: background .18s, color .18s, border-color .18s; } }

/* Que se sienta como app: sin zoom por doble toque, sin zoom al escribir, sin destello gris al tocar */
html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 860px) { input, select, textarea { font-size: 16px; } }
button, nav.tabs, .kpi, .stepper { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Como app nativa: la barra de arriba queda fija y solo se desplaza el contenido (sin el "rebote" de toda la página) */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; padding-bottom: 0; }
.top { position: relative; top: auto; flex: none; }
#auth { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.auth { min-height: 100%; }
main#main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  max-width: none; width: 100%; margin: 0; padding-inline: max(16px, calc((100% - 1148px) / 2)); padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }

/* Fondo blanco (modo claro) */
:root:not([data-theme="dark"]) { --bg: #FFFFFF; --surface: #FFFFFF; --surface2: #F2F2EF; --line: #E5E3DD; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1512; --surface: #1B2520; --surface2: #26332C; --line: #34423A; } }
html { background: var(--bg); }

/* iPhone (app web): la pantalla ocupa todo el alto, sin franja vacía abajo */
body { position: fixed; top: 0; left: 0; right: 0; bottom: auto; height: var(--app-h, 100dvh); }

/* Alto completo en iPhone: nada recorta la pantalla (sin overflow hidden en la raíz) */
html, body { overflow: visible; }
@media (display-mode: standalone) { body { height: var(--app-h, 100vh); } }

/* Ajustes · Mi cuenta */
.acc { gap: 14px; display: grid; }
.acc-head { display: flex; gap: 14px; align-items: center; }
.acc-av { width: 56px; height: 56px; flex: none; border-radius: 16px; background: #0E1512; color: #F4F2EC; display: grid; place-items: center; font: 800 20px var(--display); letter-spacing: -0.02em; position: relative; overflow: hidden; }
.acc-av::after { content: ""; position: absolute; top: 0; right: 0; width: 18px; height: 15px; background: #C8F25A; }
.acc-list { display: grid; }
.acc-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.acc-row b { text-align: right; font-weight: 700; }
.btn.block { width: 100%; }
.btn.logout { color: var(--bad); border-color: var(--line); font-weight: 800; }

/* iOS 26: las capas "fixed" se recortan a un alto más corto que la pantalla.
   El cuerpo va en flujo normal (no fixed) con el alto real de la pantalla. */
html { height: auto; overflow: visible; overscroll-behavior: none; }
body { position: relative; top: auto; left: auto; right: auto; bottom: auto; width: 100%; overflow: visible; height: var(--app-h, 100dvh); }
@media (display-mode: standalone) { body { height: var(--app-h, 100vh); } }

/* Selector de período (como Bsale) */
.perwrap { position: relative; }
.perbtn { display: flex; align-items: center; gap: 10px; background: #1B2520; border: 1px solid #34423A; color: #F4F2EC; border-radius: 14px; padding: 7px 12px; cursor: pointer; font: 600 13px var(--body); text-align: left; }
.perbtn span { display: grid; line-height: 1.2; }
.perbtn b { font-weight: 800; font-size: 14px; }
.perbtn small { color: #A9B3AD; font-size: 12px; }
.perbtn i { font-style: normal; color: #C8F25A; margin-left: 2px; }
.perpop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(320px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 14px 40px rgba(14,21,18,.18); padding: 8px; display: grid; gap: 2px; }
.perpop > button { text-align: left; background: none; border: 0; border-radius: 10px; padding: 11px 12px; font: 600 15px var(--body); color: var(--fg); cursor: pointer; }
.perpop > button:hover { background: var(--surface2); }
.perpop > button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
.percustom { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 4px 4px; display: grid; gap: 8px; }
.percustom input { min-width: 0; }
@media (max-width: 560px) { .perwrap { flex: 1 1 100%; } .perbtn { width: 100%; } .perbtn i { margin-left: auto; } .perpop { left: 0; right: 0; width: auto; } }
.perhead { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; }
.perhead .note { font-size: 13px; }

/* Indicadores: variación vs período anterior y margen en % + $ */
.dchip { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--surface2); color: var(--muted); margin-right: 4px; white-space: nowrap; }
.dchip.up { background: var(--ok-bg); color: var(--ok); }
.dchip.down { background: var(--bad-bg); color: var(--bad); }
.kpi.hero .dchip { background: rgba(255,255,255,.12); color: #F4F2EC; }
.kpi.hero .dchip.up { color: #C8F25A; } .kpi.hero .dchip.down { color: #FF9B86; }
.val2 { display: block; font-size: 15px; letter-spacing: -0.01em; margin-top: 2px; opacity: .85; }

/* Gráficos al tamaño real de la pantalla: valores en el eje izquierdo */
.cv2 { overflow: hidden; }
.chart .cv2 svg { width: 100%; min-width: 0; height: auto; display: block; }
.loading { display: flex; align-items: center; gap: 12px; padding: 22px 16px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--lime-text); animation: rot .8s linear infinite; flex: none; }
@keyframes rot { to { transform: rotate(360deg); } }

/* =====================================================================
   Teléfono vs computador
   Teléfono: barra de arriba con logo y tu cuenta, períodos en chips, navegación abajo, tablas como tarjetas.
   Computador: menú lateral, título y período arriba, tablas completas.
   ===================================================================== */
.app { flex: 1; min-height: 0; display: flex; }
.col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.side { display: none; }
.toptitle { display: none; margin: 0; }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 12px; background: #1B2520; border: 1px solid #34423A; color: #F4F2EC; font: 800 14px var(--display); letter-spacing: -0.02em; display: inline-grid; place-items: center; position: relative; overflow: hidden; cursor: pointer; padding: 0; }
.avatar::after { content: ""; position: absolute; top: 0; right: 0; width: 11px; height: 9px; background: #C8F25A; }
.chip.empresa { font-size: 12px; vertical-align: middle; margin-left: 4px; font-family: var(--body); letter-spacing: 0; }

/* chips de período (teléfono) */
.perchips { padding: 0 0 12px; }
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chiprow::-webkit-scrollbar { display: none; }
.pchip { flex: none; border: 1px solid #34423A; background: #1B2520; color: #DCE3DE; border-radius: 99px; padding: 8px 14px; font: 700 14px var(--body); cursor: pointer; white-space: nowrap; }
.pchip[aria-pressed="true"] { background: #C8F25A; border-color: #C8F25A; color: #0E1512; }
.perpop.chipspop { position: static; width: auto; margin: 10px 16px 0; box-shadow: none; }

/* barra de navegación inferior (teléfono) */
.bnav { flex: none; display: grid; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 6; }
.bnav button { background: none; border: 0; display: grid; justify-items: center; gap: 3px; padding: 4px 2px; color: var(--muted); font: 700 11px var(--body); cursor: pointer; -webkit-user-select: none; user-select: none; }
.bnav button svg { width: 44px; height: 30px; padding: 3px 10px; border-radius: 99px; box-sizing: border-box; transition: background .15s; }
.bnav button[aria-current="page"] { color: var(--fg); }
.bnav button[aria-current="page"] svg { background: #C8F25A; color: #0E1512; }

/* hoja "Más" */
.sheet-bg { position: absolute; top: 0; left: 0; right: 0; height: 100%; background: rgba(14,21,18,.5); z-index: 40; display: grid; align-items: end; }
.sheet { background: var(--surface); border-radius: 24px 24px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); justify-self: center; }
.morelist { display: grid; }
.morelist button { display: flex; align-items: center; gap: 14px; background: none; border: 0; border-top: 1px solid var(--line); padding: 14px 4px; font: 700 16px var(--body); color: var(--fg); cursor: pointer; text-align: left; }
.morelist button span { flex: 1; }
.morelist button i { font-style: normal; color: var(--muted); font-size: 20px; }
.morelist button[aria-current="page"] svg { color: var(--lime-text); }

/* formularios plegables */
details.addbox > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; font: 800 16px var(--display); letter-spacing: -0.01em; -webkit-user-select: none; user-select: none; }
details.addbox > summary::-webkit-details-marker { display: none; }
details.addbox .plus { width: 28px; height: 28px; flex: none; border-radius: 9px; background: #C8F25A; color: #0E1512; display: grid; place-items: center; font: 800 20px/1 var(--body); transition: transform .15s; }
details.addbox[open] .plus { transform: rotate(45deg); }

@media (max-width: 899px) {
  .perwrap { display: none !important; }
  .topin { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .topin .brand { margin-right: auto; }
  .topin .stepper { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis > .kpi:first-child { grid-column: 1 / -1; }
  .kpi .val { font-size: 22px; }
  .panel { gap: 14px; padding-top: 16px; }
  .perhead h2 { font-size: 24px; }
  /* tablas como tarjetas */
  .tbl { overflow: visible; }
  .tbl table, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { border-top: 1px solid var(--line); padding: 12px 0; }
  .tbl tbody tr:first-child { border-top: 0; }
  .tbl tfoot tr { background: var(--surface2); border-radius: 12px; padding: 10px 12px; margin-top: 6px; border: 0; }
  .tbl td { position: relative; border: 0; padding: 4px 0 4px 46%; text-align: right; min-height: 24px; white-space: normal; }
  .tbl td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 44%; text-align: left; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
  .tbl td:first-child { padding-left: 0; text-align: left; font-size: 15px; font-weight: 800; padding-bottom: 6px; }
  .tbl td:first-child::before { display: none; }
  .tbl td:first-child .small, .tbl td:first-child .muted { font-weight: 500; }
  .tbl td[data-label=""] { padding-left: 0; }
  .tbl td select, .tbl td input { max-width: 100%; }
  .tbl td .row { justify-content: flex-end; }
}

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; gap: 6px; width: 248px; flex: none; background: #0E1512; color: #F4F2EC; padding: calc(18px + env(safe-area-inset-top, 0px)) 14px 16px; overflow-y: auto; overscroll-behavior: contain; }
  .side-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; }
  .side-brand b { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -0.03em; }
  .side-brand span { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; color: #C8F25A; }
  .side-nav { display: grid; gap: 2px; }
  .side-nav button { display: flex; align-items: center; gap: 12px; background: none; border: 0; border-radius: 12px; padding: 10px 12px; color: #A9B3AD; font: 700 14px var(--body); cursor: pointer; text-align: left; }
  .side-nav button:hover { background: #1B2520; color: #F4F2EC; }
  .side-nav button[aria-current="page"] { background: #1B2520; color: #F4F2EC; }
  .side-nav button[aria-current="page"] svg { color: #C8F25A; }
  .side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; background: none; border: 1px solid #26332C; border-radius: 14px; padding: 10px; color: #F4F2EC; cursor: pointer; text-align: left; }
  .side-user:hover { background: #1B2520; }
  .side-user span:last-child { display: grid; min-width: 0; }
  .side-user b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user small { color: #A9B3AD; font-size: 12px; }
  .side-user .avatar { pointer-events: none; }
  .bnav, .perchips, .top .brand, #avatarBtn { display: none !important; }
  .top { background: var(--surface); color: var(--fg); border-bottom: 1px solid var(--line); padding-top: 0; }
  .topin { max-width: none; padding: 14px max(24px, calc((100% - 1148px) / 2)); }
  .toptitle { display: block; margin-right: auto; font-size: 22px; }
  .top .stepper { background: var(--surface); border-color: var(--line); }
  .top .stepper button, .top .stepper strong { color: var(--fg); }
  .top .stepper button:hover { background: var(--surface2); }
  .perbtn { background: var(--surface); border-color: var(--line); color: var(--fg); }
  .perbtn small { color: var(--muted); }
  .perbtn i { color: var(--lime-text); }
}

/* Mejores máquinas */
.top3 { display: grid; gap: 8px; margin-top: 10px; }
.t3 { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; color: var(--fg); font: inherit; }
.t3:hover { border-color: var(--fg); }
.t3n { width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--fg); color: var(--bg); display: grid; place-items: center; font: 800 15px var(--display); }
.t3:first-child .t3n { background: #C8F25A; color: #0E1512; }
.t3i { flex: 1; min-width: 0; display: grid; gap: 2px; }
.t3i b { font-family: var(--mono, inherit); }
.t3i > .muted { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t3i small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.t3v { display: grid; justify-items: end; gap: 4px; }
.t3v .dchip { margin: 0; }
.dot.ok, .dot.warn, .dot.bad { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: #D9A521; } .dot.bad { background: var(--bad); }

/* Filtros de máquinas */
.filtros { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 12px 0 6px; align-items: end; }
.filtros .search input { padding-left: 36px; background: var(--surface2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%234B5550' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; border-color: transparent; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 899px) { .filtros { grid-template-columns: 1fr 1fr; } .filtros .search { grid-column: 1 / -1; } }
.tbl tr[hidden], .tbl tfoot[hidden] { display: none !important; }

/* Selector barras / línea */
.seg { display: inline-flex; background: var(--surface2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; border-radius: 8px; padding: 5px 9px; font: 700 12px var(--body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(14,21,18,.12); }
.legend .ln { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--fg); vertical-align: middle; margin-right: 6px; border-radius: 0; background: none; }
.legend .ln.dash { border-top: 2px dashed var(--muted); }
.legend .ln.dash.lime { border-top-color: var(--lime-text); }
.chart .seg svg { width: 16px; min-width: 0; height: 16px; display: inline-block; }

/* Productos con foto, precios con margen al tiro, recepción y stock */
.thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface2); display: inline-grid; place-items: center; font: 800 13px var(--display); color: var(--muted); border: 1px solid var(--line); }
.prodcell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.prodcell b { display: block; }
input.pin { width: 110px; text-align: right; font-weight: 800; }
tr.inactivo td { opacity: .55; }
.btn.icon { padding: 6px 9px; line-height: 1; }
.filtros.one { grid-template-columns: 1fr; }
.reclines { display: grid; gap: 10px; }
.recline { position: relative; display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1.2fr); gap: 10px; align-items: end; background: var(--surface2); border-radius: 14px; padding: 12px 40px 12px 12px; }
.rl-prod { display: flex; gap: 10px; align-items: end; min-width: 0; }
.rl-prod .f { flex: 1; min-width: 0; }
.rl-foto { position: relative; cursor: pointer; flex: none; }
.rl-foto i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 12px; background: var(--surface); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); }
.rl-tot { display: grid; justify-items: end; gap: 2px; padding-bottom: 6px; }
.rl-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 8px; border: 0; background: var(--surface); color: var(--muted); font-size: 18px; cursor: pointer; }
.rectot { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; padding: 12px 14px; background: var(--fg); color: var(--bg); border-radius: 14px; font-size: 14px; }
.rectot b { font-family: var(--display); font-size: 17px; margin-left: 6px; }
.rectot span:last-child b { color: #C8F25A; }
.stk { display: inline-grid; place-items: center; min-width: 40px; padding: 3px 10px; border-radius: 99px; font-weight: 800; }
.stk.ok { background: var(--ok-bg); color: var(--ok); } .stk.warn { background: var(--warn-bg); color: var(--warn); } .stk.bad { background: var(--bad-bg); color: var(--bad); }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 899px) {
  .split2 { grid-template-columns: 1fr; }
  .recline { grid-template-columns: 1fr 1fr; padding: 12px; }
  .recline .rl-prod { grid-column: 1 / -1; padding-right: 30px; }
  .rl-tot { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; padding: 0; }
  .rectot { justify-content: space-between; }
  .tbl td:first-child .prodcell { min-width: 0; }
  input.pin { width: 120px; }
}

/* Stock por ubicación y archivos */
.locchips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; margin-top: 8px; scrollbar-width: none; }
.locchips::-webkit-scrollbar { display: none; }
.locchip { flex: none; display: grid; gap: 1px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 12px; cursor: pointer; color: var(--fg); font: inherit; }
.locchip b { font-size: 13px; } .locchip small { color: var(--muted); font-size: 12px; font-weight: 700; }
.locchip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.locchip[aria-pressed="true"] small { color: #C8F25A; }
input[type="file"] { font: 600 13px var(--body); color: var(--muted); padding: 6px; }
input[type="file"]::file-selector-button { border: 0; background: var(--fg); color: var(--bg); border-radius: 8px; padding: 8px 12px; margin-right: 10px; font: 700 13px var(--body); cursor: pointer; }
@media (min-width: 900px) { .solo-tel { display: none; } }

/* Actualizar datos */
.refbtn { width: 38px; height: 38px; flex: none; border-radius: 12px; display: inline-grid; place-items: center; cursor: pointer; background: #1B2520; border: 1px solid #34423A; color: #F4F2EC; padding: 0; }
.refbtn.girando svg { animation: rot .8s linear infinite; }
.refhora { display: none; }

/* Computador: barra superior compacta (título + fechas en una sola línea) y menú plegable */
@media (min-width: 900px) {
  .perhead { display: none !important; }
  .topin { padding: 10px max(24px, calc((100% - 1148px) / 2)); gap: 12px; flex-wrap: nowrap; align-items: center; }
  .toptitle { display: grid; gap: 1px; margin-right: auto; min-width: 0; }
  .toptitle h1 { font-size: 20px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toptitle h1 .chip { font-size: 12px; }
  #topSub { font-size: 12.5px; }
  .refbtn { background: var(--surface); border-color: var(--line); color: var(--fg); }
  .refbtn:hover { background: var(--surface2); }
  .refhora { display: inline; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .perbtn { padding: 6px 12px; }
  .side { transition: width .2s ease, padding .2s ease; }
  .side-brand { position: relative; }
  .side-min-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 9px; border: 0; background: transparent; color: #A9B3AD; display: grid; place-items: center; cursor: pointer; transition: transform .2s; }
  .side-min-btn:hover { background: #1B2520; color: #F4F2EC; }
  body.side-min .side { width: 76px; padding-left: 12px; padding-right: 12px; }
  body.side-min .side-brand { flex-direction: column; gap: 10px; padding: 4px 0 14px; }
  body.side-min .side-brand b, body.side-min .side-brand .brandtag, body.side-min .side-nav button span, body.side-min .side-user span:last-child { display: none; }
  body.side-min .side-min-btn { margin: 0; transform: rotate(180deg); }
  body.side-min .side-nav button { justify-content: center; padding: 11px 0; }
  body.side-min .side-user { justify-content: center; padding: 8px 0; border-color: transparent; }
}
