/* =====================================================================
   TPV · Estructura y componentes. Los colores salen de themes.css.
   ===================================================================== */
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'PlexMono'; src: url('../fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PlexMono'; src: url('../fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --radius-s: 8px; --radius: 12px; --radius-l: 16px;
  --font: 'Plex', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'PlexMono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --top-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { flex: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Estructura: barra superior ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topnav {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 18px;
  padding: 0 20px; background: var(--nav-bg); border-bottom: 1px solid var(--nav-line); color: var(--nav-ink);
}
.brand > div { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); white-space: nowrap; text-decoration: none !important; }
.topnav .brand { color: inherit; }
.topnav .brand > div span { color: var(--nav-active); filter: brightness(1.15); }
[data-theme="claro"] .topnav .brand, [data-theme="nube"] .topnav .brand { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand small { display: block; font-weight: 400; font-size: .72rem; opacity: .75; letter-spacing: .02em; }
.mainnav { display: flex; align-items: stretch; height: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a, .mainnav button {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--nav-ink); font: inherit; font-size: .88rem; font-weight: 500;
  border: none; background: none; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; text-decoration: none !important;
}
.mainnav a svg, .mainnav button svg { width: 18px; height: 18px; opacity: .9; }
.mainnav a:hover, .mainnav button:hover { color: var(--nav-active); background: var(--nav-hover); }
.mainnav a.active { color: var(--nav-active); border-bottom-color: var(--nav-active); }
.mainnav .count { background: var(--accent); color: var(--on-accent); font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 9px; }
.more-wrap { position: relative; display: flex; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.clock { text-align: right; line-height: 1.1; padding: 0 6px; }
.clock small { display: block; font-size: .72rem; opacity: .8; }
.clock b { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.topnav .clock b { color: inherit; filter: brightness(1.3); }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: none; color: inherit;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--nav-hover); }
.modal .icon-btn:hover, .panel .icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.cash-pill { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: .82rem; padding: 7px 12px; border-radius: 20px; border: 1px solid var(--nav-line); color: inherit; background: none; cursor: pointer; white-space: nowrap; }
.cash-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.cash-pill.open i { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 24px; border: 1px solid var(--nav-line); background: none; cursor: pointer; color: inherit; font: inherit; font-size: .88rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 240px; padding: 6px; z-index: 40; }
.dropdown button, .dropdown a { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: var(--radius-s); border: none; background: none; font: inherit; font-size: .92rem; color: var(--ink); cursor: pointer; text-decoration: none !important; }
.dropdown button:hover, .dropdown a:hover { background: var(--surface-3); }
.dropdown a svg, .dropdown button svg { width: 18px; height: 18px; color: var(--ink-3); }
.dropdown .sep { height: 1px; background: var(--line-2); margin: 5px 0; }
.dropdown .grp { padding: 8px 10px 2px; font-size: .75rem; color: var(--ink-3); }
.more-menu { left: 0; right: auto; min-width: 260px; }

.content { padding: 22px 24px 60px; max-width: 1600px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; max-width: 80ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: .85rem; color: var(--ink-3); margin-bottom: 4px; }
.crumb a { color: var(--ink-3); }

/* Barra inferior (móvil) */
.bottomnav { display: none; }

/* Paleta de búsqueda (Ctrl K) */
.cmdk { position: relative; }
.cmdk input { width: 100%; height: 50px; font-size: 1.05rem; padding: 0 14px 0 46px; }
.cmdk > svg { position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; color: var(--ink-3); }
.gresults { margin-top: 10px; max-height: 60vh; overflow-y: auto; }
.gresults a { display: grid; grid-template-columns: 28px 1fr; gap: 1px 10px; padding: 9px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none !important; }
.gresults a:hover, .gresults a.sel { background: var(--accent-soft); }
.gresults a svg { grid-row: span 2; width: 18px; height: 18px; color: var(--ink-3); margin-top: 2px; }
.gresults a span { font-size: .82rem; color: var(--ink-3); }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger-ink); border-color: transparent; background: var(--danger-soft); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 11px; font-size: .86rem; border-radius: 8px; }
.btn.lg { height: 52px; padding: 0 22px; font-size: 1.05rem; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid var(--ink-3); border-right-color: transparent; border-left-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: .84rem; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.field .err { font-size: .8rem; color: var(--danger-ink); }
.input, select.input, textarea.input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 0 12px; font: inherit; color: var(--ink);
}
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.input.invalid { border-color: var(--danger); }
.input.money, .input.num { text-align: right; }
.input:disabled { opacity: .6; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.seg button { border: none; background: none; padding: 0 12px; height: 32px; border-radius: 7px; font: inherit; font-size: .88rem; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); cursor: pointer; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform .15s; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(16px); background: var(--on-accent); }

/* ---------- Paneles y tablas ---------- */
.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-l); }
.panel-h { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-h h2, .panel-h h3 { font-size: 1rem; }
.panel-h .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.panel-b { padding: 18px; }
.panel + .panel, .stack > * + * { margin-top: 16px; }
.cols > .panel, .cols-even > .panel, .cols-side > .panel, .grid > .panel, .tags-grid > .panel { margin-top: 0 !important; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols-side { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.toolbar .input { width: auto; min-width: 140px; height: 38px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 380px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
.t th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: .8rem; padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--ink); }
.t th .arr { font-size: .7rem; margin-left: 3px; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: none; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: var(--surface-2); }
.t td.num, .t th.num { text-align: right; white-space: nowrap; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); padding: 11px 14px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-2); font-size: .86rem; color: var(--ink-3); }
.pager .btns { margin-left: auto; display: flex; gap: 6px; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 1.02rem; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.loading { padding: 40px; text-align: center; color: var(--ink-3); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 12px; font-size: .76rem; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--accent-soft); color: var(--accent-ink); }
.badge.amber { background: var(--warn-soft); color: var(--warn-ink); }
.badge.rust { background: var(--danger-soft); color: var(--danger-ink); }
.badge.blue { background: var(--info-soft); color: var(--info-ink); }
.status-dot { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; white-space: nowrap; }
.status-dot i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: none; background: none; padding: 10px 14px; font: inherit; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button .n { font-size: .78rem; color: var(--ink-3); margin-left: 4px; }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-l); padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: center; }
.kpi > *:not(.k-ico) { grid-column: 2; }
.kpi:not(:has(.k-ico)) > * { grid-column: 1 / -1; }
.kpi .k-ico { grid-row: 1 / span 3; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.kpi .k-ico svg { width: 22px; height: 22px; }
.kpi .k-ico.amber { background: var(--warn-soft); color: var(--warn-ink); }
.kpi .k-ico.blue { background: var(--info-soft); color: var(--info-ink); }
.kpi .k-ico.rust { background: var(--danger-soft); color: var(--danger-ink); }
.kpi.hl { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kpi .k-label { font-size: .84rem; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.kpi .k-foot { font-size: .8rem; color: var(--ink-3); margin-top: 1px; }
.kpi .up { color: var(--accent-ink); } .kpi .down { color: var(--danger-ink); }
.info { cursor: help; color: var(--ink-3); display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line); font-size: .64rem; font-weight: 700; }
.alerts-list a { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none !important; }
.alerts-list a:last-child { border-bottom: none; }
.alerts-list a:hover { background: var(--surface-2); }
.alerts-list a svg { width: 18px; height: 18px; color: var(--ink-3); }
.alerts-list .n { margin-left: auto; font-weight: 700; font-size: 1.05rem; }
.alerts-list .n.warn { color: var(--warn-ink); } .alerts-list .n.bad { color: var(--danger-ink); }
.chart-box { position: relative; height: 260px; }
.toplist { list-style: none; margin: 0; padding: 6px 0; }
.toplist li { display: flex; align-items: center; gap: 12px; padding: 8px 18px; }
.toplist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist b { font-weight: 700; }

/* ---------- Miniaturas de producto ---------- */
.thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--c, var(--ink-3)); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb svg { width: 55%; height: 55%; }
.thumb.ph { background: color-mix(in srgb, var(--c, var(--ink-3)) 16%, var(--surface-2)); }

/* ---------- Etiqueta de taller ---------- */
.tag-card { position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px 14px 46px; display: block; color: var(--ink); border-left: 6px solid var(--st, var(--ink-3)); text-decoration: none !important; }
.tag-card::before { content: ''; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--line); }
.tag-card:hover { border-color: var(--line); border-left-color: var(--st); background: var(--surface-2); }
.tag-card .tag-no { font-family: var(--mono); font-weight: 500; font-size: 1.02rem; }
.tag-card .tag-dev { font-weight: 600; margin-top: 2px; }
.tag-card .tag-meta { font-size: .84rem; color: var(--ink-3); margin-top: 2px; }
.tag-card .tag-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-card .tag-top .status-dot { margin-left: auto; }
.tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 16px; }
.repair-hero { background: var(--surface); border: 1px solid var(--line-2); border-left: 8px solid var(--st); border-radius: var(--radius-l); padding: 18px 20px 18px 56px; position: relative; margin-bottom: 16px; display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.repair-hero::before { content: ''; position: absolute; left: 20px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--line); }
.repair-hero .no { font-family: var(--mono); font-size: 1.7rem; font-weight: 500; }
.repair-hero .dev { font-size: 1.05rem; font-weight: 600; }
.repair-hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: color-mix(in srgb, var(--st) 18%, transparent); color: var(--ink); font-weight: 600; font-size: .9rem; }
.status-chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--st); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: .9rem; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 3px; background: var(--c, var(--ink-3)); }
.timeline li::after { content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--ink-3); font-size: .8rem; }
.board { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.board button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 18px; padding: 5px 12px; font: inherit; font-size: .86rem; cursor: pointer; color: var(--ink-2); }
.board button i { width: 8px; height: 8px; border-radius: 2px; }
.board button b { font-weight: 700; color: var(--ink); }
.board button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- TPV ---------- */
.pos { display: grid; grid-template-columns: 210px minmax(0, 1fr) 390px; gap: 16px; align-items: start; height: calc(100vh - var(--top-h) - 44px); }
.pos-cats { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 100%; padding-right: 2px; }
.cat-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-align: left; min-height: 54px;
}
.cat-btn:hover { background: var(--surface-2); }
.cat-btn .ci { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.cat-btn .ci svg { width: 19px; height: 19px; }
.cat-btn .cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-btn .cc { font-size: .75rem; color: var(--ink-3); }
.cat-btn.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.pos-main { display: flex; flex-direction: column; gap: 12px; min-height: 0; height: 100%; }
.pos-scan { position: relative; }
.pos-scan input { height: 52px; font-size: 1.05rem; padding-left: 48px; border-radius: 12px; background: var(--surface); }
.pos-scan > svg { position: absolute; left: 15px; top: 15px; width: 22px; height: 22px; color: var(--ink-3); }
.pos-results { position: absolute; z-index: 15; left: 0; right: 0; top: 58px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 380px; overflow-y: auto; }
.pos-results button { display: grid; grid-template-columns: 1fr auto; gap: 1px 14px; width: 100%; text-align: left; padding: 10px 14px; border: none; border-bottom: 1px solid var(--line-2); background: none; font: inherit; color: var(--ink); cursor: pointer; }
.pos-results button:hover, .pos-results button.sel { background: var(--accent-soft); }
.pos-results .pr-price { font-weight: 700; text-align: right; }
.pos-results .pr-meta { font-size: .82rem; color: var(--ink-3); }
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; overflow-y: auto; align-content: start; padding: 2px 2px 8px; flex: 1; min-height: 0; }
.ptile {
  position: relative; display: flex; flex-direction: column; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface);
  padding: 10px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); transition: transform .08s, border-color .12s;
}
.ptile:hover { border-color: var(--accent); }
.ptile:active { transform: scale(.97); }
.ptile .pimg { aspect-ratio: 4 / 3; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; margin-bottom: 9px; color: var(--c, var(--ink-3)); }
.ptile .pimg img { width: 100%; height: 100%; object-fit: contain; }
.ptile .pimg.ph { background: color-mix(in srgb, var(--c, var(--ink-3)) 14%, var(--surface-2)); }
.ptile .pimg svg { width: 38%; height: 38%; }
.ptile .pn { font-size: .9rem; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.ptile .pp { font-size: 1.08rem; font-weight: 700; margin-top: 4px; }
.ptile .pb { position: absolute; top: 14px; right: 14px; }
.ptile.out { opacity: .6; }

.ticket { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-l); overflow: hidden; }
.ticket-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.ticket-h h2 { font-size: 1.05rem; }
.ticket-h .btn { margin-left: auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.ticket-lines { flex: 1; overflow-y: auto; min-height: 120px; }
.tl { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.tl.locked { background: var(--info-soft); }
.tl .nm { font-size: .92rem; font-weight: 500; cursor: pointer; min-width: 0; }
.tl .nm small { display: block; font-size: .76rem; color: var(--ink-3); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl .am { font-weight: 600; text-align: right; white-space: nowrap; }
.tl .am small { display: block; font-weight: 400; font-size: .75rem; color: var(--warn-ink); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface-2); }
.qty button { width: 28px; height: 30px; border: none; background: none; cursor: pointer; font-size: 1rem; color: var(--ink); }
.qty button:hover { background: var(--surface-3); }
.qty input { width: 34px; height: 30px; border: none; text-align: center; font: inherit; font-size: .9rem; background: none; color: var(--ink); }
.ticket .notes { padding: 10px 14px; border-top: 1px solid var(--line-2); }
.ticket .notes textarea { min-height: 52px; }
.ticket .sums { padding: 8px 16px; font-size: .88rem; border-top: 1px solid var(--line-2); }
.ticket .sums div { display: flex; justify-content: space-between; padding: 2px 0; color: var(--ink-2); }
.ticket .total { padding: 10px 16px 12px; display: flex; justify-content: space-between; align-items: baseline; }
.ticket .total span:first-child { font-size: 1.15rem; font-weight: 600; }
.ticket .total .amt { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.ticket .pay-actions { padding: 0 16px 16px; display: grid; gap: 8px; }
.ticket .pay-actions .btn.primary { height: 56px; font-size: 1.15rem; border-radius: 12px; }
.ticket-bar { display: none; }

/* Cobro */
.pay-total { text-align: center; padding: 6px 0 16px; }
.pay-total small { display: block; color: var(--ink-3); font-size: .95rem; }
.pay-total b { font-size: 2.6rem; font-weight: 700; letter-spacing: -.02em; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.pay-methods button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; height: 92px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.pay-methods button svg { width: 28px; height: 28px; color: var(--ink-2); }
.pay-methods button:hover { border-color: var(--accent); }
.pay-methods button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.pay-methods button.on svg { color: var(--accent-ink); }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.pay-row label { font-size: 1rem; color: var(--ink-2); }
.pay-row .input { max-width: 200px; height: 52px; font-size: 1.25rem; font-weight: 600; }
.pay-change { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; padding: 4px 0; }
.pay-change span { font-size: 1.05rem; font-weight: 600; }
.pay-change b { font-size: 2.2rem; color: var(--accent-ink); font-weight: 700; }
.pay-change.neg b { color: var(--danger-ink); }
.cash-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.cash-keys button { height: 46px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.cash-keys button:hover { background: var(--surface-3); border-color: var(--accent); }
.pay-lines .pl { display: grid; grid-template-columns: 1fr 130px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-due { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); margin: 12px 0; }
.pay-due .v { font-size: 1.6rem; font-weight: 700; }
.pay-due.ok { background: var(--accent-soft); color: var(--accent-ink); }
.pay-due.change { background: var(--warn-soft); }
.pay-foot { display: grid; gap: 10px; margin-top: 20px; }
.pay-foot .btn { height: 54px; font-size: 1.05rem; }

/* Temas: selector */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: 14px; padding: 0; overflow: hidden; cursor: pointer; background: none; font: inherit; color: var(--ink); text-align: left; }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .tp { height: 84px; padding: 10px; display: grid; grid-template-rows: 12px 1fr; gap: 8px; background: var(--bg); }
.theme-card .tp i { display: block; border-radius: 4px; background: var(--nav-bg); border: 1px solid var(--line-2); }
.theme-card .tp div { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
.theme-card .tp span { border-radius: 6px; background: var(--surface); border: 1px solid var(--line-2); }
.theme-card .tp span:last-child { background: var(--accent); border-color: var(--accent); }
.theme-card .tn { padding: 9px 12px; font-weight: 600; font-size: .9rem; background: var(--surface); display: flex; justify-content: space-between; }
.theme-card .tn small { font-weight: 400; color: var(--ink-3); }

/* ---------- Modal, avisos ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 12, .62); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 560px; animation: pop .14s ease-out; }
.modal.wide { max-width: 860px; } .modal.xwide { max-width: 1100px; } .modal.pay { max-width: 480px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-h h2 { font-size: 1.15rem; }
.modal-h .icon-btn { margin-left: auto; }
.modal-b { padding: 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--surface-3); color: var(--ink); border: 1px solid var(--line); padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: .92rem; animation: pop .16s ease-out; }
.toast.ok { border-left: 4px solid var(--accent); }
.toast.err { border-left: 4px solid var(--danger); }
.toast.warn { border-left: 4px solid var(--warn); }
.toast ul { margin: 4px 0 0; padding-left: 18px; }
.notice { padding: 12px 14px; border-radius: var(--radius); font-size: .9rem; margin-bottom: 14px; border: 1px solid transparent; }
.notice.amber { background: var(--warn-soft); color: var(--warn-ink); }
.notice.rust { background: var(--danger-soft); color: var(--danger-ink); }
.notice.blue { background: var(--info-soft); color: var(--info-ink); }
.notice.green { background: var(--accent-soft); color: var(--accent-ink); }
.notice a { color: inherit; font-weight: 600; text-decoration: underline; }
.sig { border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; touch-action: none; width: 100%; height: 170px; display: block; cursor: crosshair; }

/* ---------- Acceso ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.login-wrap svg.traces { position: fixed; inset: 0; width: 100%; height: 100%; opacity: .16; color: var(--accent); pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 380px; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.login-logo .brand-mark { width: 62px; height: 62px; border-radius: 18px; }
.login-logo .brand-mark svg { width: 34px; height: 34px; }
.login-logo b { font-size: 1.6rem; letter-spacing: .02em; }
.login-logo small { color: var(--ink-3); }
.login-form { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.login-form form { display: grid; gap: 14px; }
.login-form h2 { text-align: center; font-size: 1.25rem; margin-bottom: 4px; }
.iconf { position: relative; }
.iconf svg { position: absolute; left: 13px; top: 12px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.iconf .input { padding-left: 40px; height: 46px; }
.login-foot { text-align: center; color: var(--ink-3); font-size: .82rem; margin-top: 18px; }

/* ---------- Adaptación a pantallas ---------- */
@media (max-width: 1640px) {
  .clock { display: none; }
  .cash-pill span { display: none; }
  .cash-pill { padding: 9px; }
  .brand > div { max-width: 170px; }
}
@media (max-width: 1500px) {
  .mainnav a > span:not(.count), .mainnav button > span { display: none; }
  .mainnav a, .mainnav button { padding: 0 12px; }
  .mainnav a.active > span { display: inline; }
}
@media (max-width: 1360px) {
  .pos { grid-template-columns: 180px minmax(0, 1fr) 350px; }
}
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr); height: auto; }
  .pos-cats { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 4px; scrollbar-width: thin; }
  .cat-btn { width: auto; flex: none; min-height: 46px; padding: 6px 12px 6px 8px; }
  .cat-btn .cc { display: none; }
  .pos-main { height: auto; }
  .pgrid { overflow: visible; padding-bottom: 96px; }
  .ticket { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: min(86vh, 720px); border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .22s ease-out; box-shadow: var(--shadow); }
  .ticket.open { transform: none; }
  .ticket-bar { display: flex; position: fixed; z-index: 44; left: 12px; right: 12px; bottom: 12px; align-items: center; gap: 12px; padding: 0 8px 0 18px; height: 62px; border-radius: 16px; background: var(--accent); color: var(--on-accent); border: none; font: inherit; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
  .ticket-bar b { margin-left: auto; font-size: 1.2rem; }
  .ticket-bar i { font-style: normal; padding: 4px 10px; border-radius: 10px; background: rgba(0, 0, 0, .14); }
  .ticket-close { display: grid !important; }
}
.ticket-close { display: none !important; }
@media (max-width: 900px) {
  .topnav { padding: 0 12px; gap: 10px; }
  .mainnav { display: none; }
  .cash-pill span, .user-btn .uname { display: none; }
  .user-btn { padding: 3px; }
  .content { padding: 16px 14px 96px; }
  .g2, .g3, .g4, .cols-even, .cols-side { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .panel { overflow-x: auto; }
  .page-head .actions { margin-left: 0; width: 100%; }
  dl.kv { grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); }
  .repair-hero { padding-left: 46px; }
  .repair-hero .no { font-size: 1.3rem; }
  .repair-hero .actions { margin-left: 0; }
  .t { font-size: .88rem; }
  .t .hide-sm { display: none; }
  .t td, .t th { padding-left: 8px; padding-right: 8px; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: 64px; background: var(--nav-bg); border-top: 1px solid var(--nav-line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a, .bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: .7rem; color: var(--nav-ink); background: none; border: none; text-decoration: none !important; cursor: pointer; }
  .bottomnav svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--nav-active); }
  .has-ticketbar .bottomnav { display: none; }
  .ticket-bar { bottom: 12px; }
  .pos-cats { margin: 0 -14px; padding: 0 14px 4px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
}
@media (max-width: 520px) {
  .topnav { gap: 6px; padding: 0 10px; }
  .topnav .brand { min-width: 0; flex: 1 1 auto; gap: 8px; font-size: .98rem; }
  .brand > div { max-width: none; min-width: 0; }
  .top-actions { gap: 4px; flex: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; grid-template-columns: 1fr; }
  .kpi .k-ico { display: none; }
  .kpi > * { grid-column: 1 !important; }
  .kpi .k-value { font-size: 1.2rem; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cash-keys { grid-template-columns: repeat(3, 1fr); }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .pay-methods button { height: 72px; flex-direction: row; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 94vh; overflow-y: auto; }
}
@media print { .topnav, .bottomnav, .no-print { display: none !important; } }
.thumb-lg .thumb { width: 72px; height: 72px; border-radius: 14px; }
.thumb-lg .thumb svg { width: 30px; height: 30px; }
