:root {
  --navy: #173a63;
  --navy-2: #0f2d4f;
  --blue: #245b91;
  --blue-soft: #edf4fb;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ec;
  --paper: #f5f7fa;
  --white: #ffffff;
  --success: #177245;
  --success-bg: #e8f6ef;
  --warning: #9a6700;
  --warning-bg: #fff5d6;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --shadow: 0 10px 30px rgba(16, 34, 56, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--paper); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: white; display: flex; flex-direction: column; padding: 20px 16px; position: fixed; inset: 0 auto 0 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand-mark, .login-brand { width: 42px; height: 42px; border-radius: 12px; background: white; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.brand strong { display: block; font-size: 18px; }
.brand span { display: block; font-size: 12px; opacity: .75; margin-top: 2px; }
.nav-list { display: grid; gap: 5px; padding: 18px 0; overflow-y: auto; }
.nav-link { color: rgba(255,255,255,.82); padding: 11px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.12); color: white; text-decoration: none; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; border-top: 1px solid rgba(255,255,255,.13); padding-top: 16px; }
.sidebar-footer a { color: rgba(255,255,255,.78); font-size: 13px; }
.user-box strong, .user-box span { display: block; }
.user-box span { font-size: 11px; opacity: .7; margin-top: 2px; }
.main-column { margin-left: 250px; width: calc(100% - 250px); min-width: 0; }
.topbar { background: white; border-bottom: 1px solid var(--line); min-height: 88px; padding: 18px 28px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { margin-left: auto; }
.menu-button { display: none; border: 0; background: transparent; font-size: 24px; }
.content { padding: 24px 28px 40px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel.narrow, .narrow { max-width: 620px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; min-height: 112px; }
.kpi span, .kpi small { display: block; color: var(--muted); font-size: 13px; }
.kpi strong { display: block; font-size: 25px; margin-top: 12px; }
.kpi small { margin-top: 5px; font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.align-start { align-items: start; }
.mini-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.mini-stats div { background: var(--blue-soft); border-radius: 12px; padding: 18px; text-align: center; }
.mini-stats strong { display: block; font-size: 24px; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.cash-summary, .cash-open-card { display: grid; gap: 10px; }
.cash-summary strong, .cash-open-card > strong { font-size: 34px; }
.cash-summary small { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; padding: 10px 14px; border: 1px solid transparent; font-weight: 700; font-size: 14px; text-decoration: none; }
.button:hover { text-decoration: none; filter: brightness(.98); }
.button.primary { background: var(--navy); color: white; }
.button.secondary { background: var(--blue-soft); color: var(--navy); border-color: #ccdef0; }
.button.ghost { background: white; color: var(--ink); border-color: var(--line); }
.button.full { width: 100%; }
.button.large { padding: 14px 18px; font-size: 16px; }
.button.small { padding: 7px 9px; font-size: 12px; }
.danger-button { background: var(--danger); color: white; }
.action-group, .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button-row { margin-top: 12px; }
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid transparent; font-weight: 600; font-size: 14px; }
.alert.success { background: var(--success-bg); color: var(--success); border-color: #bce6cf; }
.alert.warning { background: var(--warning-bg); color: var(--warning); border-color: #efd789; }
.alert.error { background: var(--danger-bg); color: var(--danger); border-color: #f2bbb6; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: #eef1f5; color: #485467; white-space: nowrap; }
.status.success { background: var(--success-bg); color: var(--success); }
.status.warning { background: var(--warning-bg); color: var(--warning); }
.status.danger { background: var(--danger-bg); color: var(--danger); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { color: var(--muted); background: #f8fafc; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.empty-cell { text-align: center; color: var(--muted); padding: 30px; }
.block { display: block; margin-top: 4px; color: var(--muted); }
.muted { color: var(--muted); }
.stock-chip { display: inline-block; background: var(--blue-soft); border: 1px solid #d5e4f2; border-radius: 999px; padding: 4px 8px; margin: 2px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-grid.compact { gap: 12px; }
.form-grid.one-column, .form-stack { display: grid; grid-template-columns: 1fr; gap: 14px; }
label { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e1; border-radius: 8px; padding: 10px 11px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,91,145,.12); }
textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.toolbar input, .toolbar select { max-width: 420px; }
.empty-state { text-align: center; color: var(--muted); padding: 20px; }
.empty-state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.sale-layout { display: block; }
.sale-table select, .sale-table input { min-width: 105px; padding: 8px; }
.sale-table .item-product { min-width: 240px; }
.icon-button { border: 0; background: var(--danger-bg); color: var(--danger); border-radius: 7px; width: 30px; height: 30px; font-size: 20px; }
.totals-card { display: grid; gap: 15px; }
.totals-card > div { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.totals-card > div strong { font-size: 19px; }
.totals-card .grand-total { border-top: 1px solid var(--line); padding-top: 16px; }
.totals-card .grand-total strong { font-size: 29px; }
.payment-difference { margin: 14px 0 0; border-radius: 8px; padding: 10px; font-weight: 700; }
.payment-difference.ok { background: var(--success-bg); color: var(--success); }
.payment-difference.pending { background: var(--warning-bg); color: var(--warning); }
.detail-list { margin: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.note { background: #f8fafc; padding: 12px; border-radius: 8px; }
.inline-payment { display: grid; grid-template-columns: 110px 120px 130px auto; gap: 6px; align-items: center; min-width: 470px; }
.inline-payment input, .inline-payment select { padding: 7px; font-size: 12px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef4fa, #dfeaf5); }
.login-card { width: min(410px, 100%); background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; }
.login-brand { background: var(--navy); color: white; margin-bottom: 18px; }
.login-card h1 { margin: 0; }
.login-card > p { color: var(--muted); margin: 6px 0 22px; }
.login-card small { color: var(--muted); display: block; margin-top: 16px; text-align: center; }
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-column { margin-left: 0; width: 100%; }
  .menu-button { display: block; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 16px; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .top-actions { display: none; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr; }
  .panel { padding: 15px; border-radius: 12px; }
  .toolbar { flex-direction: column; }
  .button { width: 100%; }
  .button-row .button, .action-group .button { width: auto; }
}
/* v0.3: auditoría, búsquedas y reportes */
.row-voided { opacity: .62; background: #fff5f4; text-decoration: line-through; }
.row-voided a, .row-voided .status, .row-voided form { text-decoration: none; }
.danger-zone { border-color: #f2bbb6; background: #fffafa; }
.inline-void { display: flex; gap: 6px; align-items: center; min-width: 260px; }
.inline-void input { min-width: 150px; padding: 7px; font-size: 12px; }
.user-actions { display: grid; gap: 7px; min-width: 300px; }
.kpi-link a { margin-top: 8px; font-size: 12px; font-weight: 700; }
.compact-kpis { grid-template-columns: minmax(260px, 380px); }
.sale-table .item-product-search { min-width: 260px; }
.sale-table td { vertical-align: top; }
label small { font-weight: 500; color: var(--muted); }
.note strong { color: var(--ink); }
@media (max-width: 820px) {
  .inline-void { min-width: 220px; flex-direction: column; align-items: stretch; }
  .user-actions { min-width: 240px; }
}

/* v0.4: identidad STEYVER y selectores buscables */
.brand-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; border: 2px solid rgba(255,255,255,.72); box-shadow: 0 3px 12px rgba(0,0,0,.24); }
.login-logo { width: 118px; height: 118px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 18px; box-shadow: 0 8px 24px rgba(15,45,79,.22); }
.login-card h1, .login-card > p { text-align: center; }
.result-count { margin: -4px 0 14px; color: var(--muted); font-size: 12px; }
.product-picker-help { color: var(--muted); font-size: 11px; font-weight: 500; }
.report-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-items: start; }
@media (max-width: 820px) { .report-grid { grid-template-columns: 1fr; } }
