@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #F4F6F3;
  --surface: #FFFFFF;
  --ink: #1C2B26;
  --ink-soft: #5C6B65;
  --ink-faint: #93A19B;
  --pine: #1F5C4D;
  --pine-dark: #15453A;
  --pine-tint: #E3EFEA;
  --amber: #E8842C;
  --amber-tint: #FCEFDF;
  --hot: #D64545;
  --hot-tint: #FBE9E9;
  --line: #E3E8E4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(28,43,38,0.06), 0 6px 18px rgba(28,43,38,0.05);
}

* { box-sizing: border-box; }

body {
  font-family: 'Manrope', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 0 20px 80px;
  font-size: 14px;
  line-height: 1.5;
}

.container { max-width: 1020px; margin: 0 auto; }

/* ---------- Шапка ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--pine);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.brand-name {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 1px;
}

.header-nav a {
  font-size: 13px;
  font-weight: 600;
  color: var(--pine);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--pine-tint);
  transition: background 0.15s;
}
.header-nav a:hover { background: var(--pine-tint); }

h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: 21px;
  font-weight: 500;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

/* ---------- Панели ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

select, input[type="file"], input[type="number"], input[type="text"] {
  height: 38px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--pine);
}

button {
  height: 38px;
  border: none;
  background: var(--pine);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
button:hover { background: var(--pine-dark); }
button:active { transform: scale(0.98); }
button.secondary {
  background: var(--surface);
  color: var(--pine);
  border: 1.5px solid var(--line);
}
button.secondary:hover { background: var(--pine-tint); border-color: var(--pine-tint); }

/* ---------- Таблицы ---------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #FAFBFA; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-danger { background: var(--hot-tint); color: var(--hot); }
.badge-neutral { background: #EFF2F0; color: var(--ink-soft); }

/* ---------- Карточки каталога ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(28,43,38,0.08), 0 12px 28px rgba(28,43,38,0.09);
}

.card .icon-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--pine-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  margin-bottom: 10px;
  overflow: hidden;
  position: relative;
}

.card .discount-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--hot);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.card .branch { font-size: 11px; color: var(--ink-faint); margin-bottom: 3px; }
.card .name { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; min-height: 38px; line-height: 1.35; }
.card .price-line { display: flex; align-items: baseline; gap: 7px; margin-bottom: 8px; }
.card .price-new { font-family: 'Unbounded', sans-serif; font-size: 16px; font-weight: 600; }
.card .price-old { text-decoration: line-through; color: var(--ink-faint); font-size: 12px; }
.card .savings {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--hot);
  background: var(--hot-tint);
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 8px;
  display: inline-block;
}

/* Шкала срока годности — фирменный элемент */
.expiry-meter { margin-bottom: 10px; }
.expiry-meter .meter-track {
  height: 5px;
  border-radius: 3px;
  background: #EDF0EE;
  overflow: hidden;
  margin-bottom: 4px;
}
.expiry-meter .meter-fill { height: 100%; border-radius: 3px; }
.expiry-meter .meter-label { font-size: 11px; font-weight: 600; }
.meter-hot .meter-fill { background: var(--hot); }
.meter-hot .meter-label { color: var(--hot); }
.meter-warm .meter-fill { background: var(--amber); }
.meter-warm .meter-label { color: var(--amber); }
.meter-calm .meter-fill { background: var(--pine); }
.meter-calm .meter-label { color: var(--pine); }

.qty-btn {
  height: 26px !important;
  width: 26px;
  padding: 0 !important;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.card .stock-line {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.card .stock-line.stock-low {
  color: var(--amber);
  font-weight: 700;
}

.card .add-to-cart-btn { width: 100%; margin-top: auto; height: 34px; font-size: 12.5px; }

/* ---------- Корзина ---------- */

.cart-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  height: 50px;
  border-radius: 26px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(31,92,77,0.35);
  z-index: 50;
}
.cart-count {
  display: inline-block;
  background: #fff;
  color: var(--pine);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 12px;
  margin-left: 7px;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,43,38,0.4);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}
.cart-panel {
  width: 380px;
  max-width: 92vw;
  height: 100%;
  background: var(--surface);
  padding: 24px;
  overflow-y: auto;
}
.cart-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cart-panel-header strong {
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  font-weight: 500;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item .cart-item-name { flex: 1; font-size: 13px; font-weight: 600; }
.cart-item .cart-item-name .muted { font-weight: 400; }
.cart-item .cart-item-remove {
  height: 30px;
  width: 30px;
  padding: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

/* ---------- Статусы ---------- */

.status-msg {
  font-size: 13px;
  color: var(--pine);
  font-weight: 600;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--pine-tint);
  border-radius: var(--radius-sm);
}
.status-err {
  font-size: 13px;
  color: var(--hot);
  font-weight: 600;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--hot-tint);
  border-radius: var(--radius-sm);
}
.muted { color: var(--ink-faint); font-size: 12px; }

/* ---------- Пагинация ---------- */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.pagination button {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
}
.pagination button.page-current {
  background: var(--ink);
  color: #fff;
  border: none;
  pointer-events: none;
}
.pagination .page-info {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0 8px;
}

@media (max-width: 560px) {
  body { padding: 0 12px 80px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .site-header { flex-direction: column; gap: 10px; align-items: flex-start; }
}

@media (max-width: 560px) {
  body { padding: 0 10px 80px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .site-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  #searchInput { width: 100% !important; min-width: 0 !important; border: 2px solid var(--pine) !important; height: 44px !important; font-size: 15px !important; }
  .panel .row { flex-direction: column; gap: 8px; }
  .panel .row label { display: none; }
  .panel select { width: 100% !important; height: 42px !important; font-size: 14px !important; }
  .cart-panel { width: 100%; max-width: 100vw; }
  .cart-fab { right: 12px; bottom: 16px; }
}
