/* Общая структура — у всех вариантов одинаковая, отличается только theme.css */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, Arial, sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }

/* ───── Шапка ───── */
.app-header {
  display: flex; align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  gap: 24px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 36px; height: auto; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.shift-info { flex: 1; }
.shift-cashier { font-weight: 600; font-size: 14px; }
.shift-meta {
  font-size: 13px; color: var(--muted); margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
}
.shift-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
}
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ───── Категории ───── */
.categories {
  display: flex; gap: 6px;
  padding: 12px 20px;
  background: var(--bg);
  overflow-x: auto;
}
.cat-tab {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600; font-size: 14px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
  transition: all 0.12s;
}
.cat-tab svg { width: 18px; height: 18px; }
.cat-tab:hover { border-color: var(--text); }
.cat-tab.active {
  background: var(--text);
  color: var(--card);
  border-color: var(--text);
}

/* ───── Тулбар ───── */
.toolbar {
  display: flex; gap: 10px;
  padding: 6px 20px 12px;
  background: var(--bg);
}
.search-wrap {
  flex: 1;
  display: flex; align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  height: 44px;
  gap: 10px;
  color: var(--muted);
}
.search-wrap:focus-within { border-color: var(--text); color: var(--text); }
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--text);
}
.search-input::placeholder { color: var(--muted); }
.spec-modes { display: flex; gap: 8px; }

/* ───── Кнопки ───── */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: all 0.12s;
}
.btn-secondary {
  height: 38px; padding: 0 14px; font-size: 14px;
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--text); }
.btn-icon {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text); border-color: var(--text); }
.btn-spec {
  height: 44px; padding: 0 18px; font-size: 14px;
  background: var(--card);
  border-color: var(--border);
}
.btn-spec.corp { color: var(--corp); }
.btn-spec.corp:hover { border-color: var(--corp); background: var(--corp-soft); }
.btn-spec.defect { color: var(--danger); }
.btn-spec.defect:hover { border-color: var(--danger); background: var(--danger-soft); }

.btn-ghost {
  flex: 1; height: 44px; font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--card); border-color: var(--text); }

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* ───── Основная область ───── */
.main-area {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  padding: 0 20px 20px;
  height: calc(100vh - 60px - 60px - 60px);
  min-height: 600px;
}

/* ───── Каталог ───── */
.catalog {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  overflow-y: auto;
}
.group { border-bottom: 1px solid var(--border); }
.group:last-child { border-bottom: none; }
.group-head {
  display: flex; align-items: center;
  padding: 14px 10px;
  cursor: pointer;
  gap: 12px;
}
.group-head:hover { background: var(--bg); border-radius: 8px; }
.group-bar { width: 4px; height: 18px; border-radius: 2px; }
.group-title {
  font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 1;
}
.group-count {
  text-transform: none; letter-spacing: 0;
  font-weight: 500; color: var(--muted);
  margin-left: 6px;
}
.group-chevron { color: var(--muted); transition: transform 0.15s; }
.group-chevron.collapsed { transform: rotate(-90deg); }
.group:not(.open) .group-body { display: none; }
.group-body { padding: 0 10px 14px; }
/* Плотность плиток — два пресета. Стандартный = бывший compact (140px). */
:root {
  --tile-min: 140px;
  --tile-gap: 8px;
  --tile-padding: 10px;
  --tile-height: 76px;
  --tile-name-size: 13px;
  --tile-price-size: 15px;
  --tile-unit-size: 11px;
}
body[data-density="tight"] {
  --tile-min: 112px;
  --tile-gap: 6px;
  --tile-padding: 8px;
  --tile-height: 64px;
  --tile-name-size: 12px;
  --tile-price-size: 14px;
  --tile-unit-size: 10px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));
  gap: var(--tile-gap);
}
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--tile-padding);
  text-align: left;
  cursor: pointer;
  transition: all 0.12s;
  display: flex; flex-direction: column;
  gap: 4px;
  min-height: var(--tile-height);
}
.tile:hover { border-color: var(--text); transform: translateY(-1px); }
.tile.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tile-name {
  font-weight: 600; font-size: var(--tile-name-size);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-price { font-weight: 700; font-size: var(--tile-price-size); margin-top: auto; }
.tile-unit { font-size: var(--tile-unit-size); color: var(--muted); }

/* Switcher плотности в углу мокапа */
.density-switcher {
  position: fixed; top: 70px; right: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  display: flex; gap: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  z-index: 50;
}
.density-switcher button {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.density-switcher button:hover { background: var(--bg); color: var(--text); }
.density-switcher button.active {
  background: var(--primary);
  color: var(--primary-text);
}
.density-switcher-label {
  font-size: 10px;
  color: var(--muted);
  padding: 6px 4px 6px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ───── Чек ───── */
.receipt {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.receipt-customer {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 9px 11px;
  display: flex; align-items: center; gap: 10px;
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-weight: 700; font-size: 13px; }
.customer-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.customer-points { text-align: right; }
.points-value { font-weight: 700; font-size: 16px; color: var(--primary); }
.points-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.receipt-items {
  flex: 1;
  overflow-y: auto;
  margin: 10px -4px;
  padding: 0 4px;
}
.receipt-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
}
.receipt-item:last-child { border-bottom: none; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 13px; line-height: 1.35; margin-bottom: 6px; }
.item-price-row { display: flex; align-items: center; gap: 10px; }
.item-qty-controls {
  display: flex; align-items: center;
  background: var(--bg);
  border-radius: 7px;
  padding: 2px;
}
.qty-btn {
  width: 24px; height: 24px;
  border: none; background: transparent;
  font-weight: 700; font-size: 15px;
  color: var(--text);
  border-radius: 5px;
}
.qty-btn:hover { background: var(--card); }
.qty-value {
  min-width: 24px; text-align: center;
  font-weight: 600; font-size: 13px;
}
.item-unit { font-size: 12px; color: var(--muted); }
.item-total { font-weight: 700; font-size: 13px; min-width: 64px; text-align: right; }
.item-del {
  background: transparent; border: none;
  color: var(--muted); padding: 4px;
  border-radius: 6px;
}
.item-del:hover { color: var(--danger); background: var(--danger-soft); }

.receipt-mods {
  border-top: 1px solid var(--border);
  padding: 10px 4px;
}
.mod-row {
  display: flex; justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.mod-label { color: var(--muted); }
.mod-value.discount { color: var(--warning); font-weight: 600; }
.mod-value.loyalty { color: var(--primary); font-weight: 600; }

.receipt-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 2px solid var(--text);
  padding: 12px 4px 2px;
  font-weight: 700;
}
.receipt-total > span:first-child { font-size: 13px; letter-spacing: 0.05em; }
.total-value { font-size: 22px; }
.receipt-earn-hint {
  text-align: right;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  padding: 0 4px 12px;
}

.receipt-secondary {
  display: flex; gap: 6px;
  margin-bottom: 8px;
}
.receipt-secondary .btn-ghost { height: 38px; font-size: 13px; }

.btn-pay {
  width: 100%; height: 60px;
  font-size: 17px; font-weight: 700;
  letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.btn-pay-amount { font-weight: 700; }

/* ───── Toast undo ───── */
.toast-undo {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text);
  color: var(--card);
  border-radius: 10px;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 16px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 100;
}
.undo-btn {
  background: transparent;
  color: var(--card);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 13px;
}
.undo-btn:hover { background: rgba(255,255,255,0.1); }
