:root {
  --bg: #f3efe7;
  --ink: #202020;
  --muted: #756f66;
  --card: #fffaf1;
  --line: #ddd2c0;
  --dark: #151515;
  --good: #1f7a4d;
  --warn: #a45b00;
  --bad: #9c2f2f;
  --shadow: 0 12px 30px rgba(0,0,0,0.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.topbar {
  min-height: 74px;
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
}
.brand { font-size: 26px; font-weight: 850; letter-spacing: 0.3px; }
.subtle { color: #d6ccbb; font-size: 14px; }
.status-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 750;
  background: #294b37;
  color: white;
}
.pill.offline { background: var(--warn); }
.pill.muted { background: #343434; }
.shell {
  height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: 210px minmax(360px, 1fr) 370px;
  gap: 14px;
  padding: 14px;
}
.category-panel, .product-panel, .basket-panel, .admin-screen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.category-panel, .basket-panel { padding: 14px; }
.product-panel { padding: 14px; min-width: 0; }
.start-button {
  width: 100%;
  min-height: 82px;
  border-radius: 20px;
  background: #151515;
  color: white;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 14px;
}
.category-buttons { display: grid; gap: 10px; }
.category-button {
  min-height: 66px;
  border-radius: 18px;
  color: white;
  font-size: 17px;
  font-weight: 850;
  text-align: left;
  padding: 10px 12px;
  box-shadow: inset 0 -18px 25px rgba(0,0,0,0.12);
}
.category-button.active { outline: 4px solid rgba(0,0,0,0.25); transform: translateX(4px); }
.panel-heading, .basket-header, .admin-header, .admin-actions, .summary-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
h1, h2, p { margin-top: 0; }
.panel-heading h1 { margin-bottom: 10px; font-size: 30px; }
.small-button {
  min-height: 44px;
  border-radius: 14px;
  padding: 8px 14px;
  background: #eee4d4;
  color: #201a12;
  font-weight: 800;
}
.small-button.primary, .primary { background: var(--good); color: white; }
.small-button.danger, .danger { background: var(--bad); color: white; }
.danger-outline { background: #fff0ed; color: var(--bad); border: 2px solid var(--bad); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
  overflow: auto;
  height: calc(100vh - 160px);
  padding-right: 4px;
}
.product-button {
  min-height: 104px;
  border-radius: 22px;
  background: white;
  border: 3px solid transparent;
  padding: 12px;
  text-align: left;
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.product-button strong { font-size: 21px; line-height: 1.05; }
.product-button span { font-size: 20px; font-weight: 900; }
.product-button:active, .pay:active, .start-button:active, .qty-button:active { transform: scale(0.98); }
.idle-card {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 3px dashed var(--line);
}
.basket-panel { display: flex; flex-direction: column; min-width: 0; }
.basket-header h2 { margin: 0; }
.basket-items {
  flex: 1;
  overflow: auto;
  margin: 14px 0;
  display: grid;
  align-content: start;
  gap: 8px;
}
.basket-items.empty { color: var(--muted); display: grid; place-items: center; text-align: center; }
.basket-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  background: white;
  border-radius: 16px;
  padding: 10px;
  border: 1px solid var(--line);
}
.basket-line strong { font-size: 17px; }
.basket-line .line-meta { color: var(--muted); font-size: 14px; }
.qty-controls { display: flex; align-items: center; gap: 6px; }
.qty-button {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: #eee4d4;
  color: #251c13;
  font-size: 22px;
  font-weight: 900;
}
.qty-button.remove { background: #ffe6df; color: var(--bad); }
.basket-total {
  border-top: 3px solid var(--dark);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 22px;
}
.basket-total strong { font-size: 42px; }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.pay {
  min-height: 78px;
  border-radius: 20px;
  color: white;
  font-size: 24px;
  font-weight: 900;
}
.cash { background: #1f7a4d; }
.card { background: #2459a7; }
.today-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.today-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  min-height: 80px;
}
.today-card span, .today-card small { display: block; color: var(--muted); }
.today-card strong { display: block; font-size: 19px; margin: 3px 0; }
.hidden { display: none !important; }
.admin-screen {
  margin: 14px;
  padding: 18px;
  min-height: calc(100vh - 102px);
}
.admin-header h1 { margin-bottom: 4px; }
.admin-header p { margin-bottom: 0; color: var(--muted); }
.summary-strip {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.summary-strip div { min-width: 160px; }
.summary-strip strong { font-size: 24px; }
.summary-strip span { color: var(--muted); margin-left: 4px; }
.admin-actions { justify-content: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.table-wrap { max-height: calc(100vh - 260px); overflow: auto; border-radius: 18px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #efe3cf; position: sticky; top: 0; z-index: 1; }
td input, td select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
td input[type="checkbox"] { width: 28px; min-height: 28px; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-card {
  width: min(440px, 100%);
  background: var(--card);
  border-radius: 26px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.price-display {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  font-size: 42px;
  font-weight: 900;
  text-align: right;
  margin-bottom: 12px;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button, .modal-actions button {
  min-height: 70px;
  border-radius: 18px;
  font-size: 24px;
  font-weight: 900;
  background: white;
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #151515;
  color: white;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 74px); }
  .category-buttons { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .product-grid { height: auto; max-height: none; }
  .basket-panel { min-height: 420px; }
}

/* v3 additions */
.last-sale {
  background: #eaf7ee;
  border: 2px solid var(--good);
  color: #163d28;
  border-radius: 18px;
  padding: 12px 14px;
  margin: 0 0 12px 0;
  font-weight: 850;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.last-sale small { color: #315a42; font-weight: 700; }
.admin-tabs { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.sales-list {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px 0;
}
.sales-list.empty {
  background: white;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 18px;
  color: var(--muted);
}
.sale-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.sale-row strong { font-size: 18px; }
.sale-row small { color: var(--muted); display: block; margin-top: 3px; }
.sale-row .sale-total { font-size: 22px; font-weight: 900; }
.sale-row.pending { border-left: 7px solid var(--warn); }
.sale-row.synced { border-left: 7px solid var(--good); }
.pin-card .hint { color: var(--muted); }
.pin-input {
  width: 100%;
  min-height: 62px;
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  font-size: 30px;
  text-align: center;
  letter-spacing: 6px;
  margin: 8px 0 12px 0;
}
code { background: #eee4d4; padding: 2px 6px; border-radius: 8px; }
@media (max-width: 980px) {
  .last-sale { display: block; }
  .sale-row { grid-template-columns: 1fr; }
}

/* CHAT_EDIT v4 — 2026-04-24 — fix Admin PIN modal buttons contrast */
.modal-actions button {
  border: 2px solid var(--line);
  color: var(--ink);
}
.modal-actions button.primary {
  background: var(--good);
  color: #ffffff;
  border-color: var(--good);
}
.modal-actions button.danger {
  background: var(--bad);
  color: #ffffff;
  border-color: var(--bad);
}
.modal-actions button:hover {
  filter: brightness(0.96);
}
.modal-actions button:active {
  transform: translateY(1px);
}


/* CHAT_EDIT v6 — 2026-04-25 — live catalogue admin layout */
#productsAdminPanel h2 {
  margin: 20px 0 10px;
}
.compact-table table {
  min-width: 520px;
}
.admin-actions .primary {
  border-color: var(--good);
}

/* CHAT_EDIT v6.1 — 2026-04-25 — make newly added admin category obvious */
.new-row-highlight {
  outline: 3px solid #2b2b2b;
  outline-offset: -3px;
  background: #fff7d6;
}
