/* ===== Pulse Barra — POS ===== */
:root {
  --bg: #0a0a0a;
  --panel: #161616;
  --panel-2: #1f1f1f;
  --border: #2a2a2a;
  --text: #fff;
  --muted: #888;
  --yellow: #FFCF01;
  --green: #34d399;
  --red: #ff5e3a;
  --blue: #4ecdc4;
  --radius: 12px;
  --font-display: 'Orbitron', sans-serif;
  --font: 'Roboto', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
button { font-family: inherit; }

/* ===== LOGIN GATE ===== */
html.show-login .app-only { display: none !important; }
html:not(.show-login) #barra-login-gate { display: none !important; }

.login-gate {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #050505 0%, #1a1a1a 100%);
  padding: 24px;
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 36px 32px; max-width: 420px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand svg { width: 38px; height: 38px; }
.login-brand span {
  font-family: var(--font-display); font-weight: 900;
  color: var(--yellow); font-size: 24px; letter-spacing: 0.05em;
}
.login-brand em {
  font-style: normal; color: var(--text); font-weight: 500;
  font-size: 12px; letter-spacing: 0.15em; margin-left: 6px;
}
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.login-card label {
  display: block; color: #aaa; font-size: 11px; font-weight: 600;
  margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.05em;
}
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  background: #0e0e0e; border: 1px solid var(--border); color: var(--text);
  font-size: 15px; font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--yellow); }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 12px; }
.btn-login {
  width: 100%; padding: 13px; border-radius: 8px;
  background: var(--yellow); color: #000; border: none;
  font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 18px;
}
.btn-login:hover { background: #ffd933; }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== TOPBAR ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.brand span {
  font-family: var(--font-display); font-weight: 900;
  color: var(--yellow); font-size: 20px; letter-spacing: 0.05em;
}
.brand em {
  font-style: normal; color: var(--text); font-weight: 500;
  font-size: 11px; letter-spacing: 0.18em; margin-left: 6px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--yellow); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--muted); }

.btn { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; }
.btn:hover { background: #2a2a2a; }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.btn-ghost { background: transparent; }
.btn-yellow { background: var(--yellow); color: #000; border-color: var(--yellow); font-weight: 700; }
.btn-yellow:hover { background: #ffd933; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; }

/* ===== APP LAYOUT ===== */
main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.pos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.link-btn { background: none; border: none; color: var(--yellow); cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ===== STEP ===== */
.step { margin-bottom: 22px; }
.step:last-child { margin-bottom: 0; }
.lbl {
  display: block; color: #aaa; font-size: 11px; font-weight: 600;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ===== SEARCH ===== */
.search-wrap {
  position: relative; display: flex; align-items: center;
  background: #0e0e0e; border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px;
}
.search-wrap svg { color: var(--muted); flex-shrink: 0; }
.search-wrap input {
  flex: 1; padding: 12px 8px; background: transparent;
  border: none; color: var(--text); font-size: 14px; font-family: inherit;
}
.search-wrap input:focus { outline: none; }

.cust-results {
  list-style: none; padding: 0; margin: 6px 0 0;
  max-height: 280px; overflow-y: auto;
}
.cust-results li {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
}
.cust-results li:hover { background: var(--panel-2); }
.cust-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--yellow); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.cust-info { flex: 1; min-width: 0; }
.cust-info .name { font-weight: 600; font-size: 13px; }
.cust-info .sub { color: var(--muted); font-size: 11px; }

/* ===== Customer card ===== */
.cust-card {
  background: var(--panel-2); border-radius: 10px; padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.cust-card .avatar-lg {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--yellow); color: #000;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.cust-card .grow { flex: 1; }
.cust-card .name { font-weight: 700; font-size: 15px; }
.cust-card .pkg-info { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cust-card .pkg-info b { color: var(--yellow); }

/* ===== Package grid ===== */
.pkg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.pkg-opt {
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px; cursor: pointer; text-align: left;
  color: var(--text); transition: all 0.15s;
}
.pkg-opt:hover { border-color: var(--yellow); }
.pkg-opt.active { border-color: var(--yellow); background: rgba(255, 207, 1, 0.08); }
.pkg-opt .pkg-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pkg-opt .pkg-price { font-size: 18px; color: var(--yellow); font-weight: 800; }
.pkg-opt .pkg-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ===== Payment ===== */
.pay-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.pay-opt {
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 16px 10px; cursor: pointer;
  color: var(--text); display: flex; flex-direction: column; align-items: center;
  gap: 6px; font-weight: 600; font-size: 13px;
}
.pay-opt span { font-size: 24px; }
.pay-opt:hover { border-color: var(--yellow); }
.pay-opt.active { border-color: var(--yellow); background: rgba(255, 207, 1, 0.08); color: var(--yellow); }

/* ===== Confirm ===== */
textarea {
  width: 100%; background: #0e0e0e; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; color: var(--text);
  font-family: inherit; font-size: 13px; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--yellow); }
.confirm-summary {
  background: var(--panel-2); border-radius: 10px; padding: 14px;
  margin: 12px 0; font-size: 14px;
}
.confirm-summary .row { display: flex; justify-content: space-between; margin: 4px 0; }
.confirm-summary .total {
  font-size: 18px; font-weight: 700; color: var(--yellow);
  border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px;
}

/* ===== Sales list ===== */
.sales-summary {
  background: var(--panel-2); border-radius: 10px; padding: 14px;
  margin-bottom: 14px;
}
.sales-summary .big {
  font-family: var(--font-display); font-size: 30px; font-weight: 900;
  color: var(--yellow); letter-spacing: 0.02em;
}
.sales-summary .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.method-pills { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.method-pill {
  background: #0e0e0e; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; color: var(--muted); border: 1px solid var(--border);
}
.method-pill b { color: var(--text); }

.sales-list { list-style: none; padding: 0; margin: 0; max-height: 540px; overflow-y: auto; }
.sales-list li {
  padding: 12px; border-radius: 8px; background: var(--panel-2);
  margin-bottom: 8px; display: flex; gap: 10px; align-items: center;
}
.sales-list .sale-info { flex: 1; min-width: 0; }
.sales-list .sale-info .title { font-weight: 600; font-size: 13px; }
.sales-list .sale-info .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sales-list .amount {
  font-weight: 800; font-size: 16px; color: var(--yellow);
  white-space: nowrap;
}
.sales-list .badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  background: #0e0e0e; border: 1px solid var(--border);
}
.sales-list .badge-efectivo { color: var(--green); border-color: var(--green); }
.sales-list .badge-tarjeta { color: var(--blue); border-color: var(--blue); }
.sales-list .badge-transferencia { color: var(--yellow); border-color: var(--yellow); }
.sales-list .empty {
  text-align: center; color: var(--muted); padding: 40px 12px;
  background: transparent; display: block;
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #161616; border: 1px solid var(--yellow); color: var(--yellow);
  padding: 12px 16px; border-radius: 8px; font-weight: 600;
  opacity: 0; transform: translateY(8px); transition: all 0.2s;
  z-index: 9999; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== REGISTER LAYOUT ===== */
main { padding: 18px; max-width: 1600px; margin: 0 auto; }

.topbar-left { display: flex; align-items: center; gap: 14px; }
.studio-select {
  background: #0e0e0e; border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: 8px 10px; font-family: inherit; font-size: 13px;
  margin-left: 8px;
}
.studio-select:focus { outline: none; border-color: var(--yellow); }

.view-tab { display: none; }
.view-tab.active { display: block; }

.btn-ghost[data-tab].active,
.btn-ghost[data-tab][aria-pressed="true"] {
  background: rgba(255, 207, 1, 0.12);
  border-color: var(--yellow);
  color: var(--yellow);
}

.register-grid {
  display: grid;
  grid-template-columns: 380px 1fr 220px;
  gap: 16px;
  height: calc(100vh - 90px);
}

.reg-cart, .reg-products, .reg-cats {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column;
  min-height: 0;
}

/* ===== LEFT: Cart panel ===== */
.reg-customer {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--panel-2);
  border-radius: 8px; margin-bottom: 12px;
  font-size: 13px;
}
.reg-customer-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.reg-customer-active { display: flex; align-items: center; gap: 10px; flex: 1; }
.reg-customer-active b { color: var(--text); font-weight: 700; }

.cart-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; flex: 1 1 auto;
  display: block; overflow-y: auto;
}
.cart-table thead, .cart-table tbody, .cart-table tr { display: table; width: 100%; table-layout: fixed; }
.cart-table thead {
  background: var(--panel-2);
}
.cart-table th, .cart-table td {
  padding: 8px 6px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.cart-table th {
  font-size: 10px; text-transform: uppercase;
  color: var(--muted); letter-spacing: 0.05em;
  font-weight: 600;
}
.cart-table th.num, .cart-table td.num { text-align: right; }
.cart-table th:nth-child(1), .cart-table td:nth-child(1) { width: 40%; }
.cart-table th:nth-child(2), .cart-table td:nth-child(2) { width: 18%; }
.cart-table th:nth-child(3), .cart-table td:nth-child(3) { width: 18%; }
.cart-table th:nth-child(4), .cart-table td:nth-child(4) { width: 18%; }
.cart-table th:nth-child(5), .cart-table td:nth-child(5) { width: 6%; }
.cart-table td .cart-item-name { font-weight: 600; }
.cart-table td .cart-item-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }

.cart-empty td {
  text-align: center !important; color: var(--muted);
  padding: 50px 12px !important; font-size: 13px;
}

.qty-ctl { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.qty-btn {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.qty-btn:hover { background: #2a2a2a; border-color: var(--yellow); color: var(--yellow); }
.qty-val { min-width: 22px; text-align: center; font-weight: 700; }

.cart-remove {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}
.cart-remove:hover { color: var(--red); }

.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 6px; margin-top: 8px;
  border-top: 2px solid var(--border);
  font-size: 14px;
}
.cart-total b {
  font-family: var(--font-display); font-size: 22px;
  color: var(--yellow); font-weight: 900;
}
.cart-total > span { color: var(--muted); font-size: 12px; }
.cart-total #cart-customer-name { color: var(--text); font-weight: 600; }

.cart-search { position: relative; margin-top: 10px; }
.cart-search input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: #0e0e0e; border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 13px;
}
.cart-search input:focus { outline: none; border-color: var(--yellow); }
#search-results {
  position: absolute; left: 0; right: 0; top: 100%;
  margin-top: 4px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; max-height: 260px; overflow-y: auto;
  z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
#search-results:empty { display: none; }
.search-item {
  padding: 10px 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--panel-2); }
.search-item .search-item-name { font-weight: 600; }
.search-item .search-item-cat { color: var(--muted); font-size: 11px; margin-top: 2px; }
.search-item .search-item-price { color: var(--yellow); font-weight: 700; }

.btn-take-payment {
  width: 100%; padding: 16px; margin-top: 10px;
  background: var(--yellow); color: #000; border: none;
  border-radius: 10px; font-weight: 800;
  font-family: var(--font-display); font-size: 16px;
  letter-spacing: 0.06em; cursor: pointer;
  transition: all 0.15s;
}
.btn-take-payment:hover:not(:disabled) { background: #ffd933; transform: translateY(-1px); }
.btn-take-payment:disabled {
  background: #2a2a2a; color: var(--muted);
  cursor: not-allowed;
}

/* ===== MIDDLE: Products grid ===== */
.reg-products h3 {
  margin: 0 0 14px; font-family: var(--font-display);
  font-size: 18px; font-weight: 700; color: var(--yellow);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.prods-grid {
  flex: 1; overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
}
.prod-card {
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px;
  cursor: pointer; transition: all 0.15s;
  color: var(--text); text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  font-family: inherit; position: relative;
  min-height: 88px;
}
.prod-card:hover {
  border-color: var(--yellow);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255,207,1,0.08);
}
.prod-card:active { transform: translateY(0); }
.prod-name {
  font-weight: 700; font-size: 13px; line-height: 1.25;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.prod-price {
  font-family: var(--font-display); font-size: 16px;
  color: var(--yellow); font-weight: 800;
  margin-top: auto;
}
.prod-meta { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.prod-star { position: absolute; top: 6px; right: 8px; color: var(--yellow); font-size: 12px; }
.prod-card.variable .prod-price::after {
  content: " *";
  color: var(--muted);
}

.pkg-card {
  background: var(--panel-2); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 14px;
  cursor: pointer; transition: all 0.15s;
  color: var(--text); text-align: left;
  display: flex; flex-direction: column; gap: 6px;
  font-family: inherit;
}
.pkg-card:hover { border-color: var(--yellow); }
.pkg-card .pkg-card-name { font-weight: 700; font-size: 14px; }
.pkg-card .pkg-card-price {
  font-family: var(--font-display); font-size: 18px;
  color: var(--yellow); font-weight: 800;
}
.pkg-card .pkg-card-meta { font-size: 11px; color: var(--muted); }

.prods-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
  color: var(--muted); font-size: 14px;
}

/* ===== RIGHT: Category sidebar ===== */
.reg-cats { padding: 12px; }
.reg-cats ul {
  list-style: none; padding: 0; margin: 0;
  flex: 1; overflow-y: auto;
}
.cat-link {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 4px;
  background: transparent; border: none; border-radius: 8px;
  color: var(--text); cursor: pointer;
  font-size: 12px; font-weight: 600;
  font-family: inherit; letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.12s;
}
.cat-link:hover { background: var(--panel-2); color: var(--yellow); }
.cat-link.active {
  background: rgba(255, 207, 1, 0.14);
  color: var(--yellow);
  border-left: 3px solid var(--yellow);
  padding-left: 9px;
}
.cats-divider {
  height: 1px; background: var(--border);
  margin: 8px 0;
}

/* ===== POS MODALS ===== */
.pos-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.pos-modal[hidden] { display: none; }
.pos-modal-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px;
  max-width: 460px; width: 100%;
  max-height: 86vh; overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.pay-modal-card { max-width: 520px; }
.pos-modal-card h3 {
  margin: 0 0 14px; font-family: var(--font-display);
  font-size: 18px; color: var(--yellow);
}
.pos-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 26px; cursor: pointer; line-height: 1;
  padding: 0; width: 28px; height: 28px;
}
.pos-modal-close:hover { color: var(--text); }
.pos-modal-card input[type="text"],
.pos-modal-card input[type="number"] {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  background: #0e0e0e; border: 1px solid var(--border);
  color: var(--text); font-family: inherit; font-size: 14px;
  margin-bottom: 12px;
}
.pos-modal-card input:focus { outline: none; border-color: var(--yellow); }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 14px;
}

.pay-total {
  background: var(--panel-2); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.pay-total span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.pay-total b {
  font-family: var(--font-display); font-size: 26px;
  color: var(--yellow); font-weight: 900;
}

/* ===== SALES PAGE ===== */
.sales-page { padding: 0; }
.sales-page .panel { background: var(--panel); }

/* ===== MOBILE ===== */
@media (max-width: 1100px) {
  .register-grid {
    grid-template-columns: 320px 1fr 180px;
  }
}
@media (max-width: 900px) {
  .register-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .reg-cart, .reg-products, .reg-cats { height: auto; max-height: none; }
  .reg-cats ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .cat-link { flex: 1 1 auto; }
  .pos-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-left { flex-wrap: wrap; }
  main { padding: 12px; }
  .panel { padding: 16px; }
  .pay-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Stripe card element ============ */
.stripe-card {
  background: #1a1a1a;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  padding: 12px;
  transition: border-color 0.15s ease;
}
.stripe-card.StripeElement--focus { border-color: var(--yellow); }
.stripe-card.StripeElement--invalid { border-color: #ff6b6b; }
#card-wrap { margin-top: 12px; }
