/* ===================== EQUUS · Componentes & Layout ===================== */

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--violet-700) 0%, var(--violet-800) 60%, var(--violet-900) 100%);
  color: #fff; padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s2);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s2) var(--s5); }
.brand .logo { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: var(--sh-sm); flex: 0 0 auto; }
.brand .logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand .name { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; line-height: 1; }
.brand .sub { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; opacity: .7; margin-top: 3px; }

.nav-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; opacity: .55; padding: var(--s4) var(--s3) var(--s1); }
.nav-link {
  display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); border-radius: var(--r-md);
  color: rgba(255,255,255,.82); font-weight: 500; font-size: .92rem; cursor: pointer;
  transition: background .18s var(--ease-out), color .18s var(--ease-out), transform .12s var(--ease-out);
  border: none; background: transparent; width: 100%; text-align: left;
}
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: .9; }
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link:active { transform: scale(.98); }
.nav-link.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 var(--celeste-400); }
.sidebar .spacer { flex: 1; }
.side-user { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--r-md); background: rgba(255,255,255,.08); margin-top: var(--s3); }
.side-user .av { width: 34px; height: 34px; border-radius: 50%; background: var(--celeste-400); color: var(--violet-900); display: grid; place-items: center; font-weight: 700; }
.side-user .u-name { font-size: .85rem; font-weight: 600; }
.side-user .u-role { font-size: .68rem; opacity: .7; text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--cream);
  border-bottom: 1px solid var(--line); padding: var(--s4) var(--s6); display: flex; align-items: center; gap: var(--s4);
}
.topbar h1 { font-size: 1.3rem; }
.topbar .sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.content { padding: var(--s6); max-width: 1340px; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 10px 16px; border-radius: var(--r-md); border: 1px solid transparent; background: var(--white);
  color: var(--ink); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
  transition: transform .14s var(--ease-out), background .18s var(--ease-out), box-shadow .18s var(--ease-out), border-color .18s var(--ease-out);
  box-shadow: var(--sh-sm);
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--violet-600); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,.28); }
.btn-primary:hover { background: var(--violet-700); }
.btn-ghost { background: var(--violet-50); color: var(--violet-700); border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--violet-100); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-outline:hover { border-color: var(--violet-300); color: var(--violet-700); }
.btn-danger { background: #fff; color: var(--red); border-color: #f7d4d4; box-shadow: none; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: var(--r-sm); }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards / KPI ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-md); }
.card-pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s5) 0; }
.card-head h3 { font-size: 1.02rem; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: var(--s4); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: var(--s4); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--sh-md); position: relative; overflow: hidden; }
.kpi .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: var(--s3); background: var(--violet-50); color: var(--violet-600); }
.kpi .ic svg { width: 22px; height: 22px; }
.kpi .val { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; line-height: 1; }
.kpi .lbl { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.kpi.accent .ic { background: var(--violet-600); color: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 2px solid var(--line-2); white-space: nowrap; }
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tbody tr { transition: background .14s var(--ease-out); }
table.tbl tbody tr:hover { background: var(--violet-50); }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: none; }
.row-click { cursor: pointer; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--violet-50); color: var(--violet-700); font-weight: 600; font-size: .76rem; padding: 4px 11px; border-radius: var(--r-full); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: var(--r-full); }
.badge.ok { background: #e7f8f1; color: #047857; }
.badge.warn { background: #fef3e2; color: #b45309; }
.badge.danger { background: #fde8e8; color: #b91c1c; }
.badge.info { background: #e6f5fe; color: #0369a1; }
.badge.muted { background: #f1eef9; color: var(--muted); }
.badge.violet { background: var(--violet-100); color: var(--violet-700); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s4); }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .76rem; color: var(--muted); }
input, select, textarea {
  font-family: inherit; font-size: .92rem; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; width: 100%;
  transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet-400); box-shadow: 0 0 0 3px var(--violet-100); }
textarea { resize: vertical; min-height: 72px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s4); }
.check { display: flex; align-items: center; gap: var(--s2); }
.check input { width: auto; }

/* ---------- Search bar ---------- */
.searchbar { position: relative; flex: 1; max-width: 420px; }
.searchbar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.searchbar input { padding-left: 38px; background: #fff; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---------- Modal (centrado, escala suave) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(33,28,50,.5);
  display: grid; place-items: center; z-index: 100; padding: var(--s4);
  opacity: 0; transition: opacity .2s var(--ease-out);
}
.modal-overlay[data-open] { opacity: 1; }
.modal {
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--sh-pop); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; transform: scale(.96); opacity: 0;
  transition: transform .22s var(--ease-spring), opacity .2s var(--ease-out); transform-origin: center;
}
.modal-overlay[data-open] .modal { transform: scale(1); opacity: 1; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s5) var(--s6); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; border-radius: var(--r-xl) var(--r-xl) 0 0; z-index: 2; }
.modal-head h3 { font-size: 1.15rem; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: var(--s6); }
.modal-foot { display: flex; gap: var(--s3); justify-content: flex-end; padding: var(--s4) var(--s6) var(--s6); }
.x-close { width: 34px; height: 34px; border-radius: 10px; border: none; background: var(--violet-50); color: var(--violet-700); cursor: pointer; display: grid; place-items: center; transition: background .16s, transform .12s var(--ease-out); }
.x-close:hover { background: var(--violet-100); } .x-close:active { transform: scale(.94); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 13px 18px; border-radius: var(--r-md); box-shadow: var(--sh-pop);
  font-size: .9rem; font-weight: 500; display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px;
  transform: translateY(12px); opacity: 0; transition: transform .32s var(--ease-out), opacity .32s var(--ease-out);
}
.toast[data-show] { transform: translateY(0); opacity: 1; }
.toast.ok { background: #064e3b; } .toast.error { background: #7f1d1d; } .toast.info { background: var(--violet-800); }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .9; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 4px; background: var(--violet-50); padding: 4px; border-radius: var(--r-md); margin-bottom: var(--s5); }
.tab { padding: 8px 16px; border-radius: var(--r-sm); border: none; background: transparent; color: var(--ink-soft); font-weight: 600; font-size: .88rem; cursor: pointer; transition: all .18s var(--ease-out); }
.tab:active { transform: scale(.97); }
.tab.active { background: #fff; color: var(--violet-700); box-shadow: var(--sh-sm); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: var(--s10) var(--s5); color: var(--muted); }
.empty-state .em-ic { font-size: 2.6rem; margin-bottom: var(--s3); }
.empty-state h4 { color: var(--ink-soft); margin-bottom: 6px; }

/* ---------- POS / Caja ---------- */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: var(--s5); align-items: start; }
.scan-bar { display: flex; align-items: center; gap: var(--s3); background: #fff; border: 2px solid var(--violet-200); border-radius: var(--r-lg); padding: 4px 4px 4px 16px; box-shadow: var(--sh-md); margin-bottom: var(--s4); }
.scan-bar svg { width: 22px; height: 22px; color: var(--violet-500); }
.scan-bar input { border: none; box-shadow: none !important; font-size: 1rem; padding: 12px 0; }
.scan-bar input:focus { outline: none; }
.cart { position: sticky; top: 88px; }
.cart-items { max-height: 46vh; overflow-y: auto; }
.cart-item { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.cart-item .ci-name { flex: 1; font-weight: 600; font-size: .9rem; }
.cart-item .ci-sub { font-size: .76rem; color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.qty button { border: none; background: var(--violet-50); color: var(--violet-700); width: 28px; height: 30px; cursor: pointer; font-size: 1rem; transition: background .15s; }
.qty button:hover { background: var(--violet-100); }
.qty input { width: 54px; text-align: center; border: none; border-radius: 0; padding: 6px 2px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-opt { padding: 11px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: #fff; cursor: pointer; font-weight: 600; font-size: .86rem; text-align: center; transition: all .16s var(--ease-out); }
.pay-opt:active { transform: scale(.97); }
.pay-opt.sel { border-color: var(--violet-500); background: var(--violet-50); color: var(--violet-700); }
.total-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: .9rem; }
.total-line.big { font-size: 1.5rem; font-weight: 800; font-family: var(--font-display); border-top: 2px dashed var(--line); padding-top: 12px; margin-top: 6px; }

/* ---------- Product grid (POS quick add) ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.prod-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; cursor: pointer; transition: all .16s var(--ease-out); text-align: left; }
.prod-tile:hover { border-color: var(--violet-300); box-shadow: var(--sh-md); transform: translateY(-2px); }
.prod-tile:active { transform: scale(.98); }
.prod-tile .pt-name { font-weight: 600; font-size: .84rem; line-height: 1.25; min-height: 2.4em; }
.prod-tile .pt-price { color: var(--violet-700); font-weight: 800; margin-top: 6px; }
.prod-tile .pt-meta { font-size: .72rem; color: var(--muted); }

/* ---------- Misc utils ---------- */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.wrap { flex-wrap: wrap; } .spacer { flex: 1; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .mono { font-variant-numeric: tabular-nums; }
.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}.mt-5{margin-top:20px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}
.text-violet { color: var(--violet-700); } .text-red { color: var(--red); } .text-green { color: var(--mint); }
.fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, var(--violet-50) 50%, var(--line-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.fade-in { animation: fadeIn .28s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) { .pos { grid-template-columns: 1fr; } .cart { position: static; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 252px; z-index: 90; transform: translateX(-100%); transition: transform .26s var(--ease-out); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--sh-pop); }
  .scrim { position: fixed; inset: 0; background: rgba(33,28,50,.4); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .content { padding: var(--s4); }
}
.menu-btn { display: none; }
@media (max-width: 860px) { .menu-btn { display: grid; } }
