@import url('/base.css');

:root {
  --bg: #eef0f5;
  --dark: #14151a;
  --ink: #1e2028;
  --muted: #6c7080;
  --line: #dcdfe8;
  --amber: #f2b705;
  --amber-dark: #d99b00;
  --green: #1f8a4c;
  --red: #c2313d;
}

body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 'Segoe UI', Arial, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.loading { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

.pos-topbar {
  background: var(--dark);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pos-brand { display: flex; align-items: center; gap: 10px; }
.pos-brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--amber); }
.pos-brand strong { color: var(--amber); font-size: 15px; display: block; }
.pos-brand small { color: #9ea3b4; font-size: 11px; }

.pos-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pos-controls select {
  background: #222530;
  color: #fff;
  border: 1px solid #383c4c;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
}
.shift-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}
.shift-pill.open { background: rgba(31, 138, 76, 0.25); color: #84f2b0; border: 1px solid rgba(51, 196, 110, 0.45); }
.shift-pill.closed { background: rgba(194, 49, 61, 0.25); color: #ffb3ba; border: 1px solid rgba(224, 83, 93, 0.45); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid #d5d8e2;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.btn.primary { background: var(--amber); border-color: var(--amber); color: #121007; }
.btn.primary:hover { background: #ffd036; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.dark { background: #262936; border-color: #3a3f52; color: #fff; }
.btn.danger { color: var(--red); border-color: #ebc2c6; }

.pos-shell {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1680px;
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

.catalog-pane, .ticket-pane {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-bar { display: flex; gap: 8px; }
.search-bar input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #cfd3df;
  border-radius: 9px;
  font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: var(--amber-dark); }

.cat-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-pill {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f8fb;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.cat-pill.active { background: var(--dark); border-color: var(--dark); color: var(--amber); }

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
  overflow: auto;
  align-content: start;
}
.pos-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pos-card:hover:not(:disabled) { border-color: var(--amber-dark); background: #fffdf5; }
.pos-card:disabled { opacity: 0.55; cursor: not-allowed; }
.pos-card:disabled .pos-card-media img { filter: grayscale(0.65); }
.pos-card-media {
  position: relative;
  width: 100%;
  height: 92px;
  background: #ffffff;
  border-bottom: 1px solid #f0f1f6;
  overflow: hidden;
  flex: none;
}
.pos-card-media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; display: block; }
.pos-card-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: #eef0f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.pos-card-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: var(--dark);
  color: var(--amber);
}
.pos-card-badge.promo { background: var(--green); color: #fff; }
.pos-card-body {
  padding: 10px 11px 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  flex: 1;
}
.pos-card strong { font-size: 13px; line-height: 1.3; display: block; }
.pos-card small { font-size: 11px; color: var(--muted); }
.pos-card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pos-card-price { font-size: 16px; font-weight: 800; color: #121007; }
.pos-card-stock { font-size: 10.5px; font-weight: 700; color: var(--green); }
.pos-card-stock.out { color: var(--red); }

.ticket-items {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
}
.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ticket-item-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ticket-thumb {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line);
}
.ticket-row strong { font-size: 12.5px; display: block; }
.ticket-row small { font-size: 11px; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 5px; }
.qty-ctrl button { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }

.club-box {
  background: #f7faf8;
  border: 1px solid #d3e7da;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px;
}
.club-box-head { display: flex; gap: 8px; align-items: center; }
.club-box input {
  flex: 1;
  padding: 6px 9px;
  border: 1px solid #cfd8d3;
  border-radius: 7px;
  font-size: 12px;
}

.pay-box {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}
.pay-row { display: grid; grid-template-columns: 1fr 110px 30px; gap: 7px; align-items: center; }
.pay-row select, .pay-row input, .pay-extras input {
  padding: 7px 9px;
  border: 1px solid #d4d8e2;
  border-radius: 7px;
  font-size: 12.5px;
}
.pay-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11.5px; color: var(--muted); }
.pay-extras label { display: grid; gap: 4px; }

.total-banner {
  background: var(--dark);
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.total-banner strong { font-size: 26px; color: var(--amber); }

.recent-sales {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 12px;
}
.recent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f0f1f6;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(460px, calc(100% - 24px));
  padding: 0;
}
dialog::backdrop { background: rgba(12, 13, 17, 0.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.icon-close { border: 1px solid var(--line); background: #fff; width: 32px; height: 32px; border-radius: 7px; }
.modal-body { padding: 16px 18px; }
.ticket-print { font-family: Consolas, monospace; font-size: 12px; line-height: 1.5; }
.ticket-print hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.shortcut-bar { font-size: 11px; color: var(--muted); background: #f7f8fb; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.cortez-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; }
.cortez-table td { padding: 4px 0; border-bottom: 1px dotted #ddd; }
.cortez-table td:last-child { text-align: right; font-weight: 700; }

#toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 90;
  background: #1d2a22;
  color: #fff;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 12.5px;
  display: none;
}
#toast.show { display: block; }
#toast.error { background: #9c1f2c; }

@media (max-width: 960px) {
  .pos-shell { grid-template-columns: 1fr; }
}
.quick-bills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.quick-bill {
  border: 1px solid #d4d8e2;
  background: #f6f7fb;
  color: var(--ink);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}
.quick-bill:hover { border-color: var(--amber-dark); background: #fff9e6; }
.btn.alert-pulse { background: var(--amber); border-color: var(--amber); color: #121007; font-weight: 800; }
.pos-order-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: #fafbfe;
  display: grid;
  gap: 8px;
}
.held-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9fc;
}
@media print {
  @page { margin: 4mm; }
  body > *:not(dialog[open]) { display: none !important; }
  dialog[open] {
    position: static;
    width: 100%;
    max-width: 80mm;
    border: 0;
    box-shadow: none;
    margin: 0;
  }
  body[data-ticket-width="58mm"] dialog[open] { max-width: 56mm; }
  body[data-ticket-width="58mm"] .ticket-print { font-size: 10.5px; }
  .no-print, .modal-head { display: none !important; }
}
