/* Forja — gestión para ferreterías. Tema oscuro (por defecto) y claro, con acento cobre de forja. */
:root {
  --bg: #0D0C0B;
  --surface: #151311;
  --surface-2: #1C1916;
  --surface-3: #26221E;
  --line: #2C2723;
  --line-strong: #3E3731;
  --text: #F4EFE9;
  --muted: #B4A99D;
  --faint: #7B7167;
  --accent: #F2A65A;
  --accent-2: #F8C28C;
  --accent-ink: #2A1606;
  --alert: #FF6B5E;
  --ok: #5FD3A5;
  --warn: #FFC15E;
  --info: #7FC8E8;
  --violet: #A99BFF;
  --wa: #3DDC84;
  --topbar: rgba(13, 12, 11, .86);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .8);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F2ED;
  --surface: #FFFFFF;
  --surface-2: #F4F0EA;
  --surface-3: #EAE4DB;
  --line: #E6DFD5;
  --line-strong: #D2C8BA;
  --text: #1E1914;
  --muted: #5F564D;
  --faint: #978B7F;
  --accent: #C45F14;
  --accent-2: #DD7424;
  --accent-ink: #FFFFFF;
  --alert: #D93B2B;
  --ok: #178A5B;
  --warn: #B7791F;
  --info: #1F7BA6;
  --violet: #6A55E0;
  --wa: #128C4A;
  --topbar: rgba(245, 242, 237, .88);
  --shadow: 0 24px 60px -28px rgba(60, 40, 20, .35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 450 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }
.ok-t { color: var(--ok); } .alert-t { color: var(--alert); } .warn-t { color: var(--warn); } .accent-t { color: var(--accent); }
h1, h2, h3 { font-weight: 500; }
.linky { cursor: pointer; }
.linky:hover { color: var(--accent); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none !important; }
.brand-mark { width: 38px; height: 38px; flex: none; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font: 600 22px/1 var(--serif); letter-spacing: -.3px; }
.brand-sub { display: block; font: 500 10.5px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-top: 5px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: radial-gradient(120% 40% at 0 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--surface); display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.side .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8.5px 12px; border-radius: 11px; color: var(--muted); text-decoration: none; position: relative; white-space: nowrap; font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--surface-3); color: var(--text); }
.nav a.on::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav .badge { margin-left: auto; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 10px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.me-chip .who { font-weight: 600; line-height: 1.2; }
.me-chip .role { font-size: 12px; color: var(--faint); }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); background: var(--topbar); backdrop-filter: blur(12px); min-height: 60px; }
.topbar .clock { font: 600 17px/1 var(--sans); font-variant-numeric: tabular-nums; }
.topbar .date { color: var(--faint); font-size: 13px; }
.topbar .mobile-brand { display: none; }
.main { min-width: 0; padding: 24px clamp(16px, 3vw, 32px) 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font: 500 clamp(27px, 3vw, 36px)/1.1 var(--serif); margin: 0; letter-spacing: -.6px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mobile-nav { display: none; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 15px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 40%, transparent); background: color-mix(in srgb, var(--alert) 7%, transparent); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.btn.wa { color: var(--wa); border-color: color-mix(in srgb, var(--wa) 40%, transparent); background: color-mix(in srgb, var(--wa) 8%, transparent); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; border-radius: 9px; }
.btn.lg { min-height: 54px; padding: 12px 22px; font-size: 17px; border-radius: 14px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; padding: 0; }
.btn.sm.icon-btn { width: 32px; }
.kbd { font: 600 10.5px/1 var(--sans); padding: 3px 5px; border-radius: 5px; border: 1px solid currentColor; opacity: .6; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.badge.alert { background: var(--alert); color: #fff; }
.badge.gold { background: var(--accent); color: var(--accent-ink); }
.badge.ok { background: var(--ok); color: #06200F; }
.badge.warn { background: var(--warn); color: #2A1B00; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.gold { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.alert { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 45%, transparent); }
.pill.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.pill.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #16110C; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card h2 { font: 500 19px/1.25 var(--serif); margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card h2 .spacer { flex: 1; }
.card h2 small { font: 500 13px var(--sans); color: var(--faint); }
.card.flush { padding: 6px 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; position: relative; overflow: hidden; min-width: 0; }
.kpi .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.kpi .value { font: 500 clamp(22px, 1.9vw, 27px)/1.15 var(--serif); margin-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value small { font: 500 14px var(--sans); color: var(--faint); }
.kpi .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.hl { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--surface); }
.kpi.bad .value { color: var(--alert); }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--line-strong); }
.up { color: var(--ok); } .down { color: var(--alert); }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.row:last-child { border-bottom: 0; }
.row.link { cursor: pointer; border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.row.link:hover { background: var(--surface-2); }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.row .ico.alert { color: var(--alert); background: color-mix(in srgb, var(--alert) 12%, transparent); }
.row .ico.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.row .ico.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.row .ico.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.row .ico.gold { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.empty { padding: 28px 12px; text-align: center; color: var(--faint); }
.note { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); font-size: 14px; }
.note.warn { background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.note.alert { background: color-mix(in srgb, var(--alert) 8%, transparent); border-color: color-mix(in srgb, var(--alert) 32%, transparent); }
.note.info { background: color-mix(in srgb, var(--info) 8%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; max-width: 220px; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 460px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 38px !important; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 11.5px; opacity: .7; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 16px; overflow-x: auto; }
.tabs-line button { border: 0; background: transparent; color: var(--muted); padding: 10px 14px; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; display: inline-flex; gap: 7px; align-items: center; }
.tabs-line button.on { color: var(--text); border-color: var(--accent); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.tbl .nm { font-weight: 600; }
.tbl .sub { font-size: 12.5px; color: var(--faint); }
.tbl input, .tbl select { min-height: 36px; padding: 6px 10px; }
.tbl td.num-in { width: 120px; }
.tbl input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.table-wrap { overflow-x: auto; }
.bar-track { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.level { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.level .bar-track { flex: 1; height: 6px; position: relative; overflow: visible; }
.level .bar-track i { background: var(--ok); }
.level.warn .bar-track i { background: var(--warn); }
.level.alert .bar-track i { background: var(--alert); }
.level .bar-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); border-radius: 1px; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + span { background: color-mix(in srgb, var(--ok) 25%, transparent); border-color: var(--ok); }
.switch input:checked + span::before { transform: translateX(17px); background: var(--ok); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.dl dt { color: var(--faint); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.big-num { font: 500 34px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- Formularios ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form.g3f { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full, .check.full, .form .full { grid-column: 1 / -1; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { color: var(--faint); font-size: 12.5px; }
.form-sec { grid-column: 1 / -1; font: 700 11.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.check small { display: block; color: var(--faint); font-size: 12.5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches input { display: none; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches input:checked + span { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 11px; overflow: hidden; background: var(--bg); }
.stepper button { width: 34px; height: 36px; border: 0; background: var(--surface-2); font-size: 18px; color: var(--muted); display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper input { width: 64px !important; min-height: 36px !important; border: 0 !important; border-radius: 0 !important; text-align: center; padding: 4px !important; box-shadow: none !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.picker-list button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: transparent; border-bottom: 1px solid var(--line); }
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button.hi { background: var(--surface-2); }

/* ---------- Modales y avisos ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(8, 6, 4, .66); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px 16px; overflow-y: auto; animation: fade .15s; }
.modal { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); animation: pop .18s; }
.modal.wide { width: min(880px, 100%); }
.modal.xwide { width: min(1120px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal-head h2 { flex: 1; margin: 0; font: 500 22px/1.2 var(--serif); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); animation: pop .2s; max-width: calc(100% - 32px); }
.toast.err { background: var(--alert); color: #fff; }

/* ---------- Ingreso con PIN ---------- */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(70% 50% at 50% 0, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg); }
.lock-box { width: min(380px, 100%); text-align: center; }
.lock-box .brand-mark { width: 64px; height: 64px; margin: 0 auto; }
.lock-title { font: 600 38px/1.1 var(--serif); margin: 16px 0 4px; letter-spacing: -.6px; }
.lock-sub { color: var(--muted); margin: 0 0 26px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 26px; height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keypad button { height: 66px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font: 500 26px var(--sans); transition: background .1s; }
.keypad button:hover { background: var(--surface-2); }
.keypad button:active { background: var(--surface-3); }
.keypad button.fn { font-size: 15px; color: var(--muted); background: transparent; border-color: transparent; }
.demo-pins { margin-top: 24px; font-size: 13px; color: var(--faint); line-height: 1.8; }
.demo-pins b { color: var(--muted); font-weight: 600; }

/* ---------- Vender ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 16px; align-items: start; }
.pos-search { position: sticky; top: 72px; z-index: 5; background: var(--bg); padding-bottom: 10px; }
.pos-search .search-box { max-width: none; }
.pos-search input { min-height: 54px !important; font-size: 17px; border-radius: 14px !important; }
.pos-search .search-box svg { width: 20px; height: 20px; }
.pos-hint { font-size: 12.5px; color: var(--faint); margin-top: 7px; display: flex; gap: 14px; flex-wrap: wrap; }
.results { display: flex; flex-direction: column; gap: 6px; }
.res { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .12s, background .12s; }
.res:hover, .res.hi { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--surface-2); }
.res .nm { font-weight: 600; line-height: 1.3; }
.res .meta { font-size: 12.5px; color: var(--faint); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.res .st { text-align: right; font-size: 13px; white-space: nowrap; }
.res .pr { text-align: right; font: 600 16px var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 84px; }
.res .pr small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 9px; }
.tile { text-align: left; padding: 11px 12px; min-height: 86px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, background .15s, transform .08s; }
.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tile:active { transform: scale(.97); }
.tile .nm { font-weight: 600; line-height: 1.25; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .pr { margin-top: auto; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; }
.ticket { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 92px); }
.ticket-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.ticket-head .top { display: flex; align-items: center; gap: 8px; }
.ticket-head h2 { margin: 0; font: 500 22px/1.1 var(--serif); flex: 1; }
.cust-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 11px; border: 1px dashed var(--line-strong); background: transparent; text-align: left; }
.cust-btn.set { border-style: solid; background: var(--surface-2); }
.cust-btn .nm { font-weight: 600; }
.cust-btn .meta { font-size: 12.5px; color: var(--muted); }
.ticket-body { overflow-y: auto; flex: 1; min-height: 120px; }
.tline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.tline .nm { font-weight: 600; line-height: 1.3; font-size: 14px; }
.tline .meta { font-size: 12px; color: var(--faint); }
.tline .tot { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tline .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tline .price-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 4px 6px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.tline .price-btn:hover { background: var(--surface-2); color: var(--text); }
.tline .price-btn.disc { color: var(--ok); }
.tline .warn-stock { font-size: 12px; color: var(--warn); }
.ticket-foot { border-top: 1px solid var(--line); padding: 12px 16px 14px; }
.tot-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; font-variant-numeric: tabular-nums; }
.tot-row.big { font: 500 30px/1.2 var(--serif); color: var(--text); margin-top: 4px; align-items: baseline; }
.tot-row.big span:first-child { font: 600 15px var(--sans); color: var(--muted); }
.ticket-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ticket-actions .full { grid-column: 1 / -1; }
.pos-mbar { display: none; }
.parked { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 600; font-size: 13.5px; }
.pay-grid button svg { width: 22px; height: 22px; color: var(--muted); }
.pay-grid button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pay-grid button.on svg { color: var(--accent); }
.pay-grid button:disabled { opacity: .35; }
.pay-total { text-align: center; padding: 6px 0 16px; }
.pay-total .big-num { font-size: 44px; }
.pay-lines .row { padding: 8px 4px; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.change-box { margin-top: 14px; padding: 14px; border-radius: 14px; text-align: center; background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.change-box.due { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.change-box b { display: block; font: 500 32px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.done-box { text-align: center; padding: 10px 0 4px; }
.done-box .ok-circle { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.done-box .ok-circle svg { width: 32px; height: 32px; }

/* ---------- Fichas ---------- */
.sheet-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-head .grow > .muted { font-size: 13.5px; }
.stat-strip { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 16px; background: var(--surface); }
.stat-strip > div { flex: 1 1 130px; padding: 11px 13px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.stat-strip .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.stat-strip .v { font: 600 17px/1.3 var(--sans); font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lines-editor .ln { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 110px 34px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.lines-editor .ln .nm { font-weight: 600; font-size: 14px; line-height: 1.3; }
.lines-editor .ln .sub { font-size: 12px; color: var(--faint); }
.lines-editor .ln .c { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.lines-editor .ln.head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 0 0 6px; }
.count-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.count-row .nm { font-weight: 600; }
.count-row .th { color: var(--faint); font-size: 13px; text-align: right; }
.count-row input { text-align: right; font-size: 17px; min-height: 46px; }
.count-row.done .nm::before { content: '✓ '; color: var(--ok); }
.area-h { font: 700 12px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 20px 4px 6px; }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.denoms label { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.denoms input { text-align: right; }
.alert-list .row .title { white-space: normal; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.label-preview { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--accent); }
.chart .bar.dim { fill: var(--accent); opacity: .42; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 14px; }
.hbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .bar-track { grid-column: 1 / -1; margin-bottom: 8px; }
.hbar b { font-weight: 600; }
.heat { display: grid; grid-template-columns: repeat(auto-fit, minmax(28px, 1fr)); gap: 4px; }
.heat div { border-radius: 6px; padding: 8px 0 6px; text-align: center; font-size: 11px; color: var(--faint); background: var(--surface-2); }
.heat div b { display: block; height: 42px; margin: 0 5px 5px; border-radius: 4px; background: var(--accent); }

/* ---------- Impresión ---------- */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  body { background: #fff !important; }
  #print { display: block; color: #000; background: #fff; }
  #print.ticket { font: 11.5px/1.35 'Courier New', monospace; width: 72mm; margin: 0 auto; }
  #print.ticket h1 { font: 700 15px/1.2 'Courier New', monospace; text-align: center; margin: 0; }
  #print.ticket .biz { text-align: center; margin-bottom: 6px; }
  #print.ticket .biz b { font-size: 14px; display: block; }
  #print .c { text-align: center; }
  #print hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
  #print .l { display: flex; justify-content: space-between; gap: 8px; }
  #print .b { font-weight: 700; }
  #print .big { font-size: 15px; font-weight: 700; }
  #print.sheet { font: 12px/1.45 Helvetica, Arial, sans-serif; width: auto; }
  #print.sheet .doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; }
  #print.sheet .biz b { font-size: 17px; display: block; }
  #print.sheet .doc-box { border: 2px solid #000; padding: 8px 14px; text-align: center; min-width: 190px; }
  #print.sheet .doc-box b { display: block; font-size: 16px; }
  #print.sheet table { width: 100%; border-collapse: collapse; margin: 12px 0; }
  #print.sheet th { text-align: left; border-bottom: 1.5px solid #000; padding: 5px 6px; font-size: 11px; text-transform: uppercase; }
  #print.sheet td { border-bottom: 1px solid #ccc; padding: 5px 6px; vertical-align: top; }
  #print.sheet .r { text-align: right; }
  #print.sheet .totals { margin-left: auto; width: 280px; }
  #print.sheet .totals .l { padding: 3px 0; }
  #print.sheet .totals .l.b { border-top: 1.5px solid #000; font-size: 15px; padding-top: 6px; }
  #print.sheet .meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 20px; }
  #print.sheet .terms { margin-top: 18px; font-size: 11px; color: #333; }
  #print.labels { width: auto; font-family: Helvetica, Arial, sans-serif; }
  #print.labels .sheet-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
  #print.labels .lab { border: 1px dashed #999; padding: 3mm 3.5mm; height: 33mm; overflow: hidden; break-inside: avoid; display: flex; flex-direction: column; }
  #print.labels .lab .n { font-size: 9.5pt; font-weight: 700; line-height: 1.15; max-height: 2.4em; overflow: hidden; }
  #print.labels .lab .s { font-size: 7.5pt; color: #333; }
  #print.labels .lab .p { font-size: 17pt; font-weight: 800; margin-top: auto; }
  #print.labels .lab svg { height: 9mm; width: 100%; }
  #print.labels .thermal .lab { width: 50mm; height: 25mm; border: 0; page-break-after: always; padding: 1.5mm 2mm; }
  #print.labels .thermal .lab .p { font-size: 13pt; }
  #print.labels .thermal .lab svg { height: 7mm; }
  @page { margin: 8mm; }
  body[data-print="ticket"] { width: 80mm; }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1240px) {
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar .mobile-brand { display: flex; }
  .topbar .clock, .topbar .date { display: none; }
  .mobile-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--topbar); backdrop-filter: blur(12px); border-top: 1px solid var(--line); overflow-x: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; }
  .mobile-nav a { flex: 1 0 62px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; position: relative; white-space: nowrap; }
  .mobile-nav a.on { color: var(--accent); background: var(--surface-2); }
  .mobile-nav a svg { width: 21px; height: 21px; }
  .mobile-nav .badge { position: absolute; top: 1px; right: calc(50% - 22px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: static; max-height: none; }
  .pos-search { top: 60px; }
  .pos-hint { display: none; }
  .search-box { min-width: 0; }
  .topbar .nowrap { display: none; }
  .pos-mbar:not([hidden]) { display: flex; align-items: center; gap: 10px; position: fixed; left: 12px; right: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 25; padding: 13px 16px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
  .g2, .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .form, .form.g3f { grid-template-columns: 1fr; }
  .lines-editor .ln { grid-template-columns: minmax(0, 1fr) 90px 34px; }
  .lines-editor .ln .c, .lines-editor .ln .hide-m { display: none; }
  .count-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .count-row .th { display: none; }
  .hide-m { display: none !important; }
}
@media (max-width: 560px) {
  .main { padding-top: 16px; }
  .kpi .value { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res { grid-template-columns: minmax(0, 1fr) auto; }
  .res .st { display: none; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; border: 0; }
  .pay-grid { grid-template-columns: repeat(2, 1fr); }
}
