:root {
  --ink: #0b0b0c; --ink-2: #17171a; --ink-3: #26262b;
  --gold: #c9a24b; --gold-2: #e8cf87; --gold-3: #8a6a22;
  --bg: #f5f3ee; --card: #fff; --line: #e6e1d6; --text: #1c1b19; --muted: #77726a;
  --good: #1f8a4c; --bad: #c0392b; --warn: #b7791f;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 16, 4, .05), 0 8px 24px -12px rgba(20, 16, 4, .12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--gold-3); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card > h2:not(:first-child) { margin-top: 22px; }
small { font-size: 12.5px; }
.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); } .good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
[hidden] { display: none !important; }

/* Estructura */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d9d4c7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: var(--gold-2); font: italic 600 20px/1.1 Georgia, "Times New Roman", serif; border-bottom: 1px solid var(--ink-3); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font: 400 11px/1.3 system-ui, sans-serif; color: #8d877a; letter-spacing: .04em; margin-top: 3px; }
.side nav { padding: 8px 10px 16px; flex: 1; }
.nav-group { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #6f6a5f; padding: 16px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #cfc9bb; font-size: 14px; }
.side nav a:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.side nav a.on { background: linear-gradient(135deg, #2a2415, #1c1810); color: var(--gold-2); box-shadow: inset 2px 0 0 var(--gold); }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--ink-3); }
.who b { display: block; font-size: 13.5px; color: #fff; } .who small { color: #8d877a; }
.side .icon-btn { color: #cfc9bb; }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: rgba(245, 243, 238, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-scan { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.top-scan .icon { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--muted); }
.top-scan input[type=search] { padding-left: 36px; border-radius: 999px; }
.content { padding: 22px 24px 60px; max-width: 1440px; }
.only-mobile { display: none !important; }
.backdrop { display: none; }

/* Controles */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
input.money { text-align: right; font-variant-numeric: tabular-nums; }
.w-80 { width: 80px !important; } .w-120 { width: 120px !important; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: #57524a; margin-bottom: 4px; }
.field output { display: block; padding: 9px 0; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--gold-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfc7b3; text-decoration: none; background: #fbfaf7; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: #b08a35; color: #2a1f05; }
.btn-gold:hover { background: linear-gradient(180deg, #f0dba0, #d3ad57); border-color: #b08a35; }
.btn-danger { color: var(--bad); border-color: #ecc8c3; }
.btn-block { width: 100%; } .btn-lg { min-height: 50px; font-size: 16px; } .btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; background: none; border-radius: 9px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--bad); }
.side .icon-btn:hover { background: var(--ink-2); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; align-items: center; }
.card .actions { margin: 14px 0 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.inline-form input[type=text], .inline-form input[type=password], .inline-form select { width: auto; flex: 1; min-width: 120px; }
td .inline-form { margin: 0; flex-wrap: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input, .filters select { width: auto; }
.filters input[type=search] { min-width: 240px; flex: 1; max-width: 360px; }
.spacer { flex: 1; }
.danger-zone { margin-top: 16px; }

/* Tarjetas y rejillas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.empty { text-align: center; padding: 40px 18px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.cols-receipt { grid-template-columns: minmax(0, 520px) 340px; align-items: start; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 0 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.grid-4 .btn { margin-bottom: 12px; }
.span-2 { grid-column: span 2; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 23px; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.kpi-gold { background: linear-gradient(135deg, #17140c, #2b2412); border-color: #3a3018; color: #fff; }
.kpi-gold span, .kpi-gold small { color: #c9bd9b; } .kpi-gold b { color: var(--gold-2); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--gold); }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px; border-bottom: 1px solid #f0ece3; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 7px 6px; }
.table tr.dim td { opacity: .5; }
.table input[type=text], .table input[type=number] { min-height: 34px; padding: 5px 8px; }
.row-actions { white-space: nowrap; text-align: right; } .row-actions a { color: var(--muted); padding: 4px; }
.pyl td { padding: 8px 6px; } .pyl tr.sub td { font-weight: 700; border-top: 1px solid var(--line); background: #faf8f3; }
.pyl tr.total td { font-weight: 800; font-size: 16px; border-top: 2px solid var(--ink); background: #f6f0df; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eee9dd; color: #5c564a; text-transform: capitalize; white-space: nowrap; }
.badge-ok, .badge-pagada { background: #e2f3e8; color: #17693a; } .badge-warn, .badge-credito { background: #fbefd5; color: #8a5a0b; } .badge-bad, .badge-anulada { background: #fbe3e0; color: #9c2b20; }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.alert-success { background: #e8f6ed; border-color: #bfe3cd; color: #14592f; } .alert-error { background: #fdecea; border-color: #f3c6c0; color: #8f241a; } .alert-info { background: #fbf3de; border-color: #ecd9a4; color: #6b4a08; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: #f1ede3; font-size: 13px; font-weight: 600; }
.chip small { color: var(--muted); font-weight: 400; } .chip button { border: 0; background: none; cursor: pointer; color: var(--bad); font-size: 16px; line-height: 1; padding: 0; }
.chip-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #2a1f05; }
.meter { height: 4px; background: #f0ece3; border-radius: 4px; margin-top: 4px; overflow: hidden; } .meter i { display: block; height: 100%; background: var(--gold); }

/* Gráficas de barras */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 18px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 38px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-radius: 5px 5px 0 0; }
.bar span { font-size: 11px; color: var(--muted); } .bar em { font-style: normal; font-size: 11px; font-weight: 700; }
.bars-2 .bar { flex-direction: row; align-items: flex-end; justify-content: center; gap: 3px; position: relative; padding-bottom: 18px; }
.bars-2 .bar span { position: absolute; bottom: 0; } .bars-2 .bar i { max-width: 22px; }
.bar i.alt, .legend i.alt { background: var(--ink); } .bar i.neg { background: var(--bad); }
.legend { font-size: 12.5px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--gold); margin: 0 4px 0 10px; }

/* Productos */
.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.product { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.product:hover { text-decoration: none; border-color: var(--gold); }
.product.dim { opacity: .55; }
.product img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #efece4; }
.product > div { padding: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.product-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; }
.price { font-weight: 800; font-size: 16px; }
.product-form { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.photo-box img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #efece4; margin-bottom: 8px; }

/* Escáner */
.scan-box { background: linear-gradient(135deg, #131109, #241e0e); color: #fff; border-color: #3a3018; }
.scan-box .hint { color: #b9ae8f; }
.scan-form { display: flex; gap: 10px; align-items: center; color: var(--gold-2); }
.scan-form input { font-size: 18px; min-height: 50px; }
.scan-box video { width: 100%; max-width: 420px; border-radius: 12px; margin-top: 12px; }
.found { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.found-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #efece4; }
.found h2 { font-size: 24px; margin: 2px 0 8px; }
.found-var { margin: 0 0 12px; }
.found-nums { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 10px; }
.found-nums span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; } .found-nums b { font-size: 28px; letter-spacing: -.02em; }
.curve { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0ece3; } .curve:last-child { border: 0; }
.curve > b { width: 90px; flex: none; }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.size { display: grid; place-items: center; width: 50px; padding: 5px 0; border: 1px solid var(--line); border-radius: 9px; color: inherit; }
.size:hover { text-decoration: none; border-color: var(--gold); }
.size span { font-weight: 800; } .size i { font-style: normal; font-size: 12px; color: var(--good); font-weight: 700; }
.size.out { background: #f6f4ef; } .size.out span { color: #a9a396; } .size.out i { color: var(--bad); }
.size.on { background: var(--ink); border-color: var(--ink); color: #fff; } .size.on i { color: var(--gold-2); }

/* Punto de venta y líneas */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.pos-pay { position: sticky; top: 76px; }
.picker { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--gold-3); }
.picker input { font-size: 16px; min-height: 46px; }
.picker-results { position: absolute; z-index: 4; left: 32px; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .25); max-height: 320px; overflow-y: auto; }
.picker-results:empty { display: none; }
.assign .picker-results { position: static; box-shadow: none; }
.picker-results button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid #f0ece3; background: none; cursor: pointer; }
.picker-results button:hover, .picker-results button.on { background: #faf5e6; }
.picker-results small { color: var(--muted); white-space: nowrap; }
.empty-hint { text-align: center; padding: 22px 0; }
.line-qty { width: 70px !important; text-align: center; } .line-price { width: 120px !important; }
.totals { margin: 12px 0; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; }
.totals .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 800; }
.totals .total b { color: var(--gold-3); }
.warn-row { color: var(--warn); font-weight: 700; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.flash-row { animation: flash 1s ease; }
@keyframes flash { from { background: #f6e7b8; } to { background: transparent; } }

/* Recibo */
.receipt { max-width: 520px; }
.receipt-head { text-align: center; margin-bottom: 12px; } .receipt-head h2 { display: block; font: italic 600 22px Georgia, serif; margin: 4px 0; }
.receipt-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.receipt-meta span { display: block; font-size: 11.5px; color: var(--muted); }
.receipt-foot { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 8px; }
.receipt-code { max-width: 220px; margin: 0 auto; } .barcode { display: block; width: 100%; height: auto; }

/* Etiquetas */
.labels { display: flex; flex-wrap: wrap; gap: 8px; }
.label { width: 50mm; height: 30mm; padding: 1.5mm 2mm; background: #fff; border: 1px dashed #c9c2b2; border-radius: 4px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: #000; }
.label-top b { display: block; font-size: 8.5pt; line-height: 1.1; white-space: nowrap; overflow: hidden; } .label-top span { font-size: 7pt; }
.label-mid { display: flex; align-items: center; gap: 2mm; } .label-mid .barcode { flex: 1; min-width: 0; height: 13mm; }
.label-size { text-align: center; line-height: 1; } .label-size small { font-size: 5.5pt; display: block; } .label-size b { font-size: 17pt; }
.label-price { font-weight: 800; font-size: 10pt; text-align: right; line-height: 1; }

/* Ingreso */
.auth-body { background: var(--ink); }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px; color: #b9ae8f; text-align: center; background: radial-gradient(circle at 50% 40%, #241e0e, var(--ink) 70%); }
.auth-side img { max-width: 80%; height: auto; }
.auth-main { background: var(--bg); display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(20px, 6vw, 90px); }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; } .auth-card > p { margin-top: 0; }

@media (max-width: 1100px) {
  .cols, .cols-3, .cols-side, .cols-receipt, .pos { grid-template-columns: 1fr; }
  .pos-pay { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; top: 0; width: 264px; translate: -100% 0; transition: translate .2s; }
  .side.open { translate: 0 0; }
  .side.open ~ .backdrop, .shell:has(.side.open) ~ .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 15; }
  .only-mobile { display: inline-grid !important; }
  .top { padding: 10px 14px; gap: 8px; } .top h1 { display: none; } .hide-sm { display: none; }
  .content { padding: 16px 14px 60px; }
  .grid-3, .grid-4, .product-form, .found { grid-template-columns: 1fr; } .span-2 { grid-column: auto; }
  .found-photo, .photo-box { max-width: 220px; }
  .found-nums b { font-size: 22px; }
  .auth { grid-template-columns: 1fr; } .auth-side { padding: 28px 20px; } .auth-side img { max-width: 220px; }
  .scan-form { flex-wrap: wrap; } .scan-form .icon { display: none; }
  .grid-products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media print {
  .side, .top, .no-print, .alert, .backdrop { display: none !important; }
  .shell { display: block; } .content { padding: 0; max-width: none; } body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .label { border: 0; border-radius: 0; break-inside: avoid; } .labels { gap: 0; }
  .cols, .cols-receipt { display: block; }
}
