/* Терра — единая дизайн-система для всех экранов. */
:root {
  --c-bg: #FAF7F2;
  --c-surface: #FFFFFF;
  --c-surface-2: #F3EFE7;
  --c-text: #1B1814;
  --c-text-2: #5A554C;
  --c-text-3: #908B82;
  --c-line: #E8E1D6;

  --c-primary: #8B2D1F;          /* терракот — ресторанный акцент */
  --c-primary-dark: #6B1F14;
  --c-primary-light: #FDE8E2;

  --c-accent: #C9A86A;            /* тёплая бронза */
  --c-accent-dark: #A88846;
  --c-accent-light: #F5EAD2;

  --c-success: #2D6A4F;
  --c-warning: #F9A825;
  --c-danger:  #C1121F;
  --c-info:    #3D5A80;

  --shadow-sm: 0 1px 2px rgba(40, 30, 20, 0.06);
  --shadow-md: 0 6px 18px rgba(40, 30, 20, 0.10);
  --shadow-lg: 0 16px 40px rgba(40, 30, 20, 0.14);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

h1, h2, h3, h4 { font-family: 'Cormorant Garamond', 'Georgia', serif; font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 44px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }

a { color: var(--c-primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-line);
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--c-surface-2); }
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
  box-shadow: 0 4px 14px rgba(139, 45, 31, 0.28);
}
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn-accent {
  background: var(--c-accent); color: #1B1814; border-color: var(--c-accent);
}
.btn-accent:hover { background: var(--c-accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--c-primary); }
.btn-ghost:hover { background: var(--c-primary-light); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 26px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }

/* ===== Карточки ===== */
.card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-line);
}

/* ===== Бейджи ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #D8F3DC; color: #1B4332; }
.badge-yellow { background: #FFF4D0; color: #856404; }
.badge-red    { background: #FFE0E0; color: var(--c-danger); }
.badge-bronze { background: var(--c-accent-light); color: var(--c-accent-dark); }
.badge-terra  { background: var(--c-primary-light); color: var(--c-primary-dark); }
.badge-gray   { background: var(--c-surface-2); color: var(--c-text-2); }
.badge-info   { background: #D6E4F0; color: var(--c-info); }
.badge-purple { background: #EDDDF6; color: #7209B7; }

/* ===== Утилиты ===== */
.row { display: flex; gap: 12px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.muted { color: var(--c-text-2); }
.dim   { color: var(--c-text-3); }
.small { font-size: 13px; }
.tiny  { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700; }
.bold  { font-weight: 700; }
.mono  { font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.line { height: 1px; background: var(--c-line); margin: 18px 0; }

/* ===== Цена со страйк ===== */
.price-was   { color: var(--c-text-3); text-decoration: line-through; font-size: 14px; margin-right: 6px; }
.price-now   { color: var(--c-primary); font-weight: 700; font-size: 18px; }
.price-now-discount { color: var(--c-success); }

/* ===== Кнопка "+" количества ===== */
.qty { display: inline-flex; align-items: center; gap: 0; background: var(--c-surface-2); border-radius: 999px; padding: 4px; }
.qty button {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c-surface); color: var(--c-text);
  font-weight: 700; font-size: 16px; box-shadow: var(--shadow-sm);
}
.qty button:active { transform: scale(0.92); }
.qty .qty-value { min-width: 26px; text-align: center; font-weight: 700; }

/* ===== Тосты ===== */
.toast-host {
  position: fixed; left: 0; right: 0; top: 16px; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(27, 24, 20, 0.95); color: #fff; padding: 12px 18px;
  border-radius: var(--radius-md); font-size: 14px; max-width: 90%;
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Прогресс-полоска ===== */
.bar { height: 8px; background: var(--c-surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c-primary); border-radius: 999px; transition: width .3s; }
.bar-fill.warn  { background: var(--c-warning); }
.bar-fill.danger { background: var(--c-danger); }
.bar-fill.success { background: var(--c-success); }

/* ===== Inputs ===== */
label.tiny {
  display: block; margin-bottom: 6px;
}

input[type="text"], input[type="number"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}

/* ===== Range slider ===== */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: var(--c-surface-2);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-primary); cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-primary); cursor: pointer; border: none;
}

/* ===== Toggle switch ===== */
.toggle {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--c-text-3); border-radius: 999px;
  transition: background .15s;
}
.toggle .track::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: transform .15s; box-shadow: var(--shadow-sm);
}
.toggle input:checked + .track { background: var(--c-success); }
.toggle input:checked + .track::before { transform: translateX(20px); }

/* ===== Skeleton ===== */
.skeleton {
  background: linear-gradient(90deg, #efe9dd 0%, #f6f1e4 50%, #efe9dd 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Тёмная навигация (для админки/дашборда) ===== */
.app-header {
  background: #1B1814;
  color: #fff;
  padding: 14px 22px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid #2A241D;
  position: sticky; top: 0; z-index: 100;
}
.app-header .brand {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  transition: background .12s;
}
.app-header a.brand:hover { background: rgba(255,255,255,0.06); }
.app-header a.brand:active { background: rgba(255,255,255,0.10); }
.app-header .brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--c-accent); color: #1B1814;
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
  flex-shrink: 0;
}
.app-header .brand-sub { color: rgba(255,255,255,0.45); font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500; }
.app-header .nav {
  display: flex; gap: 2px; margin-left: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-header .nav::-webkit-scrollbar { display: none; }
.app-header .nav a {
  padding: 8px 14px; border-radius: 8px;
  color: rgba(255,255,255,0.7); font-size: 14px; font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.app-header .nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.app-header .nav a.active { background: var(--c-accent); color: #1B1814; }

@media (max-width: 760px) {
  .app-header {
    padding: 10px 12px;
    gap: 10px;
    flex-wrap: nowrap;
  }
  .app-header .brand { font-size: 18px; gap: 8px; }
  .app-header .brand-mark { width: 28px; height: 28px; font-size: 14px; border-radius: 7px; }
  .app-header .brand-sub { display: none; }
  .app-header .nav {
    margin-left: 0;
    flex: 1; min-width: 0;
  }
  .app-header .nav a { padding: 7px 11px; font-size: 13px; }
  .app-header .spacer { display: none; }
  .app-header > button,
  .app-header > .btn { padding: 6px 10px !important; font-size: 12px !important; flex-shrink: 0; }
}

/* Responsive базовая ширина */
.container { max-width: 1280px; margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: 900px; margin: 0 auto; padding: 0 22px; }
@media (max-width: 600px) {
  .container, .container-narrow { padding: 0 14px; }
  h1 { font-size: 34px; }
  h2 { font-size: 24px; }
}
