:root {
  /* ── Палитра: чистая, современная, единая для витрины и кабинета ── */
  --bg: #f5f7fa;
  --bg-tint: #eef2f7;
  --card: #ffffff;
  --line: #e6e9ef;
  --line-strong: #d4dae3;
  --ink: #0f1b2d;
  --ink-soft: #33445a;
  --muted: #6b7a8d;
  --accent: #0e9f6e;
  --accent-strong: #0b8457;
  --accent-soft: #e7f6ef;
  --accent-ink: #ffffff;
  --warn: #b9711b;
  --warn-soft: #fbeede;
  --danger: #c62f26;
  --danger-soft: #fbe6e4;
  --chip: #eef2f7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 6px 20px rgba(15, 27, 45, .06);
  --shadow-lg: 0 10px 30px rgba(15, 27, 45, .12);
  --ring: 0 0 0 3px rgba(14, 159, 110, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar.hidden { display: none; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); font-size: 17px;
}
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong);
}
.tabs { display: flex; gap: 6px; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  padding: 8px 15px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}
.tab:hover { border-color: var(--line-strong); }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.switch-role {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  padding: 7px 13px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.switch-role:hover { border-color: var(--line-strong); color: var(--ink); }
.day-pill { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.day-pill input { font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.day-pill input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ── Layout ── */
main { max-width: 1120px; margin: 0 auto; padding: 22px 20px 48px; }
.loading { padding: 48px; text-align: center; color: var(--muted); }
/* minmax(0,…) вместо 1fr: иначе колонка растёт до min-content и на узком мобильном вылезает за вьюпорт. */
.grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .grid.split { grid-template-columns: minmax(0, 1fr) 372px; align-items: start; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 18px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.muted { color: var(--muted); }

/* ── Онбординг: «вы вошли как… и вот что делать» ── */
.onboarding {
  display: flex; gap: 14px; align-items: flex-start;
  background: linear-gradient(180deg, var(--accent-soft), #fff);
  border: 1px solid #cbe8da; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.onboarding .ic {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: #fff; border: 1px solid #cbe8da;
}
.onboarding .who { font-weight: 700; font-size: 15px; margin: 0 0 2px; color: var(--ink); }
.onboarding .what { font-size: 13.5px; color: var(--ink-soft); margin: 0; }
.onboarding ol { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.onboarding ol li { margin: 2px 0; }

/* ── Forms ── */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 12px 0 5px; }
select, input[type=text], input[type=email], input[type=date], textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

/* ── Buttons ── */
button.btn {
  font: inherit; border: 0; border-radius: var(--radius-sm); padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; letter-spacing: -.01em;
  transition: background .15s, transform .05s, box-shadow .15s;
}
button.btn:hover { background: var(--accent-strong); }
button.btn:active { transform: translateY(1px); }
button.btn.secondary { background: var(--chip); color: var(--ink); }
button.btn.secondary:hover { background: var(--line); }
button.btn.ghost { background: #fff; border: 1px solid var(--line-strong); color: var(--ink-soft); font-weight: 600; }
button.btn.ghost:hover { border-color: var(--muted); background: var(--bg); }
button.btn.warn { background: var(--warn); } button.btn.warn:hover { background: #9c5e12; }
button.btn.danger { background: var(--danger); } button.btn.danger:hover { background: #a82720; }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
button.btn:disabled:hover { background: var(--accent); }
button.btn.sm { padding: 7px 12px; font-size: 13px; }

/* ── Menu items ── */
.menu-list { display: grid; gap: 10px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.menu-item:hover { border-color: var(--line-strong); }
.menu-item .info { flex: 1; min-width: 0; }
.menu-item .name { font-weight: 600; }
.menu-item .cat { font-size: 12px; color: var(--muted); }
.price { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 19px; line-height: 1; cursor: pointer; color: var(--ink-soft);
  transition: border-color .15s, background .15s;
}
.qty button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.qty button:disabled { opacity: .4; cursor: not-allowed; }
.qty span { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ── Cart ── */
.cart-line { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.cart-line:last-of-type { border-bottom: 0; }
.cart-total { display: flex; justify-content: space-between; font-weight: 800; margin-top: 12px; font-size: 17px; }
.empty { color: var(--muted); font-size: 14px; padding: 10px 0; }

/* ── Chips / badges ── */
.chip { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--chip); font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.created { background: #e7eef7; color: #2b4a72; }
.badge.accepted { background: #e2f0e8; color: #1f6b41; }
.badge.assembled { background: #ece4f5; color: #543c83; }
.badge.delivered { background: #d6f0dc; color: #176b30; }
.badge.cancelled { background: #f8e2df; color: #9c2a23; }
.badge.paid { background: #d6f0dc; color: #176b30; }
.badge.pending { background: #fceccd; color: #875612; }
.badge.invoiced { background: #e7eef7; color: #2b4a72; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

/* ── Order cards (canteen) ── */
.order { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 11px; background: #fff; }
.order:last-child { margin-bottom: 0; }
.order .head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.order .meta { font-size: 13px; color: var(--muted); margin: 5px 0; }
.order ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-soft); }
.order .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; max-width: 92vw; z-index: 50;
}
.toast.err { background: var(--danger); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.hint { background: var(--accent-soft); border: 1px solid #cbe8da; color: #1f5c3e; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.consumer-list { display: grid; gap: 8px; margin-top: 8px; }
.consumer { display: flex; gap: 8px; align-items: center; }
.consumer input { flex: 1; }

/* ───────────────────── Экран входа / выбора роли ───────────────────── */
.landing {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; text-align: center;
  background:
    radial-gradient(900px 480px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.landing .hero-logo {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 18px;
  font-size: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: var(--shadow-lg);
}
.landing h1 { font-size: clamp(26px, 4vw, 34px); margin: 0 0 8px; letter-spacing: -.025em; }
.landing .lead { color: var(--muted); font-size: 16px; max-width: 560px; margin: 0 auto 36px; }
.role-grid {
  display: grid; gap: 16px; width: 100%; max-width: 920px;
  grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: left;
}
.role-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s, border-color .15s; font: inherit; color: inherit; text-align: left;
}
.role-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.role-card:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow); }
.role-card .role-ic {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 26px;
  background: var(--accent-soft); margin-bottom: 14px;
}
.role-card .role-name { font-weight: 800; font-size: 17px; margin: 0 0 5px; letter-spacing: -.01em; }
.role-card .role-desc { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; flex: 1; }
.role-card ul { margin: 0 0 16px; padding-left: 17px; font-size: 13px; color: var(--ink-soft); }
.role-card ul li { margin: 3px 0; }
.role-card .role-go { font-weight: 700; color: var(--accent-strong); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.landing .foot { margin-top: 34px; color: var(--muted); font-size: 12.5px; }

@media (max-width: 720px) {
  .role-grid { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
  .landing { padding: 36px 16px; }
  .topbar { padding: 11px 14px; gap: 10px; }
  main { padding: 16px 14px 40px; }
}
