:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --ink: #0f172a;
  --muted: #667085;
  --line: #e1e6ee;
  --accent: #0f172a;
  --accent-soft: #eef2f7;
  --danger: #b42318;
  --search-dock-height: 78px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 760px);
  margin: auto;
  padding: env(safe-area-inset-top) 16px calc(var(--search-dock-height) + 22px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.restaurant-heading {
  position: relative;
  min-width: 0;
  flex: 1;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1,
.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar h1::after {
  content: "⌄";
  display: inline-block;
  margin-left: 6px;
  color: #64748b;
  font-size: 15px;
  transform: translateY(-2px);
}

.notify-button {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #f3f5f8;
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}

.notify-button small {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  line-height: 13px;
}

.assistant-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* [hidden] само по себе теряет силу, если у элемента есть display:grid/flex —
   браузерный [hidden]{display:none} проигрывает более специфичному правилу.
   Проверено на баге с баннером — держим это правило рядом с каждым такое
   элементом, который умеет прятаться через hidden. */
.assistant-overlay[hidden] {
  display: none;
}

.assistant-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: #0f172acc;
  backdrop-filter: blur(2px);
}

.assistant-overlay-card {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  padding: 34px 26px 26px;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 30px 90px #0006;
  animation: assistant-overlay-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes assistant-overlay-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.assistant-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 17px;
}

.assistant-overlay-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent);
  font-size: 26px;
}

.assistant-overlay-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 760;
  line-height: 1.2;
}

.assistant-overlay-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.assistant-overlay-cta {
  display: block;
  margin-top: 0;
  text-align: center;
  text-decoration: none;
}

.assistant-overlay-dismiss {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}

.assistant-fab {
  position: fixed;
  z-index: 25;
  top: calc(env(safe-area-inset-top) + 14px);
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  text-decoration: none;
  box-shadow: 0 10px 26px #0f172a40;
  animation: assistant-fab-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.assistant-fab[hidden] {
  display: none;
}

@keyframes assistant-fab-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.search-dock > p {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.search-dock {
  position: fixed;
  z-index: 8;
  right: max(0px, calc((100vw - 760px) / 2));
  bottom: 0;
  left: max(0px, calc((100vw - 760px) / 2));
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #ffffff00, #fff 18%, #fff);
}

.search-box::before {
  content: "⌕";
  flex: none;
  color: #475569;
  font-size: 20px;
  line-height: 1;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 9px 0 13px;
  border: 0;
  border-radius: 12px;
  background: #f5f7fb;
  box-shadow: none;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 420;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.restaurant-select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
}

.menu-rail {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  gap: 7px;
  margin: 0 -16px;
  padding: 6px 16px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, #fff 96%, transparent);
  backdrop-filter: blur(16px);
}

.dept-switch {
  display: flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #f3f5f8;
}

.dept-switch button {
  min-width: 64px;
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 720;
}

.dept-switch button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.chips {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 520;
  scroll-snap-align: start;
}

.chip.active {
  background: #eef2f7;
  color: var(--ink);
  font-weight: 720;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
}

.section-heading h2 {
  font-size: 18px;
  color: var(--muted);
}

.count-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.dish-grid {
  display: grid;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dish-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 11px 6px;
  text-align: left;
}

.dish-card:last-child {
  border-bottom: 0;
}

.dish-card:active {
  background: #f8fafc;
}

.dish-card:focus-visible {
  position: relative;
  outline: 3px solid #f2c94c;
  outline-offset: -3px;
}

.dish-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15.5px;
  font-weight: 470;
  line-height: 1.22;
}

.dish-price {
  flex: none;
  color: #111827;
  font-size: 14.5px;
  font-weight: 760;
  white-space: nowrap;
}

.dish-dialog,
.changes-dialog {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  margin: 0 auto;
  overflow: auto;
  border: 0;
  border-radius: 26px 26px 0 0;
  padding: 34px 0 0;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 -10px 34px #0f172a26;
}

.changes-dialog {
  max-height: 78vh;
  border-radius: 26px 26px 0 0;
  padding-top: 36px;
}

.dish-dialog::backdrop,
.changes-dialog::backdrop {
  background: #0f172a12;
  backdrop-filter: none;
}

.dish-dialog::before,
.changes-dialog::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 58px;
  height: 6px;
  border-radius: 999px;
  background: #d1d5db;
  transform: translateX(-50%);
}

.changes-dialog::before {
  width: 58px;
  height: 6px;
}

.dialog-close {
  position: sticky;
  top: 10px;
  z-index: 2;
  float: right;
  width: 28px;
  height: 28px;
  margin: -25px 12px 0 0;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #fffffff2;
  color: var(--ink);
  font-size: 17px;
  box-shadow: none;
}

.detail-visual {
  height: 188px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef2f7;
  color: #9d7d55;
  font: 48px Georgia, serif;
}

.detail-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-body {
  padding: 18px 18px 22px;
}

.changes-body {
  padding: 0 18px 24px;
}

.changes-body h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.detail-body::after {
  content: "";
  display: block;
  height: env(safe-area-inset-bottom);
}

.detail-body h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: 0;
}

.detail-price {
  color: var(--accent);
  font-size: 18px;
  font-weight: 760;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 11px 0 16px;
}

.detail-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 11px;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.detail-section h3 {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-section p {
  margin: 0;
  color: #334155;
  font-size: 15px;
  line-height: 1.42;
  white-space: pre-line;
}

.ingredient-list {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.ingredient-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f5f7fb;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.25;
}

.allergen-source {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.ingredient-list small,
.missing {
  color: var(--muted);
}

.changes-list {
  display: grid;
  gap: 9px;
}

.change-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 15px;
}

.change-card h3 {
  margin: 0 0 7px;
  font-size: 15px;
}

.change-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.change-card time {
  display: block;
  margin-top: 10px;
  color: #8f6b00;
  font-size: 11px;
}

.empty-state {
  padding: 54px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: none;
}

.empty-state h3 {
  margin-bottom: 5px;
  color: var(--ink);
}

.login-body {
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(100%, 420px);
  padding: 34px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 100px #0002;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 28px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font: 700 32px Georgia, serif;
}

.login-card h1 {
  margin: 0;
  font: 38px/1 Georgia, serif;
}

.login-lead {
  margin: 14px 0 28px;
  color: var(--muted);
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  outline: 0;
}

.primary-button {
  width: 100%;
  margin-top: 10px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  padding: 15px;
  font-weight: 900;
}

.primary-button:disabled {
  opacity: 0.6;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

@media (min-width: 600px) {
  .detail-visual {
    height: 260px;
  }
}
