/* ==========================================================
   Catering — нэгдсэн theme. Бүх модуль (plugin) энэ токенуудыг ашиглана.
   Шинэ модуль нэмэхдээ өнгө/хэмжээг шууд бичихгүй, var(--...) ашиглана.
   ========================================================== */
:root {
  /* Өнгө */
  --bg: #FBF6EF;
  --surface: #FFFFFF;
  --surface-2: #F6EFE6;
  --ink: #1F1A17;
  --ink-2: #4A413B;
  --muted: #7C7067;
  --line: #ECE2D5;
  --brand: #D8323A;
  --brand-ink: #A8222A;
  --brand-soft: #FCE6E6;
  --good: #1E9A55;  --good-soft: #E3F5EA;
  --avg:  #D99A12;  --avg-soft:  #FDF3DC;
  --bad:  #D93F3F;  --bad-soft:  #FCE6E6;
  --breakfast: #F2A541; --lunch: #E7343B; --dinner: #5B5FC7; --night: #2D3561;

  /* Хэмжээ */
  --r-sm: 10px; --r: 16px; --r-lg: 24px; --r-pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --shadow-1: 0 1px 2px rgb(31 26 23 / .05), 0 1px 3px rgb(31 26 23 / .06);
  --shadow-2: 0 6px 20px -6px rgb(31 26 23 / .14), 0 2px 6px rgb(31 26 23 / .05);
  --shadow-3: 0 20px 40px -12px rgb(31 26 23 / .22);

  /* Үсэг — Кирилл дэмждэг Manrope */
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-base: 1rem;
  --fs-lg: clamp(1.125rem, 1rem + .4vw, 1.3rem);
  --fs-xl: clamp(1.4rem, 1.2rem + .9vw, 1.9rem);
  --fs-2xl: clamp(2rem, 1.6rem + 2vw, 3rem);

  /* Хөдөлгөөн */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 140ms; --t: 240ms; --t-slow: 480ms;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img, svg, video { max-width: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-base); line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.link { color: var(--brand-ink); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.break { word-break: break-all; }
.ico { flex: none; }

/* ---------- Товч ---------- */
.btn {
  --b: var(--surface); --c: var(--ink); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--b); color: var(--c); border: 1px solid var(--bd);
  font-weight: 700; font-size: var(--fs-sm); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:hover { box-shadow: var(--shadow-2); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-primary { --b: var(--brand); --c: #fff; --bd: transparent; }
.btn-primary:hover { --b: var(--brand-ink); }
.btn-soft { --b: var(--brand-soft); --c: var(--brand-ink); --bd: transparent; }
.btn-ghost { --b: transparent; }
.btn-ghost:hover { --b: var(--surface); }
.btn-sm { min-height: 36px; padding: 6px 14px; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: var(--fs-base); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: transparent; border: 0; color: var(--ink-2); cursor: pointer; text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- Форм ---------- */
.stack { display: grid; gap: var(--s-4); }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); }
.field em { color: var(--bad); font-style: normal; font-size: var(--fs-sm); font-weight: 600; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237C7067' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.switch { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 44px; height: 26px; border-radius: var(--r-pill); background: var(--line); position: relative; transition: background var(--t); flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--t) var(--spring); }
.switch input:checked + .switch-ui { background: var(--good); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--brand-soft); }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: var(--fs-sm); }

/* ---------- Карт, тэмдэг ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-1); }
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--surface-2); color: var(--ink-2); vertical-align: middle; }
.badge-accent { background: var(--brand-soft); color: var(--brand-ink); }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.chip:hover { background: var(--brand-soft); color: var(--brand-ink); }

/* Гоё/Дундаж/Муу өнгөт мөр */
.stack-bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-2); }
.stack-bar.lg { height: 14px; }
.stack-bar i, .legend i { display: block; }
.stack-bar .g, .legend .g { background: var(--good); }
.stack-bar .a, .legend .a { background: var(--avg); }
.stack-bar .b, .legend .b { background: var(--bad); }
.score { display: inline-grid; place-items: center; min-width: 44px; padding: 3px 8px; border-radius: var(--r-pill); font-weight: 800; font-size: var(--fs-sm); }
.score-good { color: var(--good); } .score.score-good { background: var(--good-soft); }
.score-avg { color: #A87300; }      .score.score-avg { background: var(--avg-soft); }
.score-bad { color: var(--bad); }   .score.score-bad { background: var(--bad-soft); }
.score-muted { color: var(--muted); }

/* Хөдөлгөөн багасгах тохиргоог хүндэтгэнэ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
