:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --paper: #fffaf2;
  --card: #ffffff;
  --soft: #f0e7db;
  --text: #191714;
  --muted: #766d64;
  --line: #e3d8cb;
  --accent: #d62222;
  --accent-dark: #a30f16;
  --olive: #2f332d;
  --tomato: #d62222;
  --green: #2d8c52;
  --danger: #b93838;
  --shadow: 0 10px 26px rgba(24, 21, 16, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --paper: #151515;
  --card: #1d1d1d;
  --soft: #282321;
  --text: #fff8f0;
  --muted: #bfb4aa;
  --line: #33302e;
  --accent: #ff3b30;
  --accent-dark: #ff6a5f;
  --olive: #f0d7b8;
  --tomato: #ff3b30;
  --green: #61c27d;
  --danger: #ff7373;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--soft), var(--bg) 44%) 0, var(--bg) 240px, var(--paper) 100%);
}

body.sheet-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

.mobile-app,
.admin-shell {
  width: min(100%, 620px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 18px 14px max(22px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 98%, transparent);
}

body[data-page="menu"] .mobile-app {
  border-right: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  border-left: 1px solid color-mix(in srgb, var(--line), transparent 20%);
}

.admin-shell {
  width: min(100%, 1120px);
  max-width: 1120px;
}

.app-header,
.admin-header,
.brand,
.header-actions,
.toolbar,
.section-title-row,
.product-row,
.product-meta,
.form-actions,
.switch-row,
.mini-item,
.admin-product {
  display: flex;
  align-items: center;
}

.app-header,
.admin-header,
.section-title-row,
.mini-item {
  justify-content: space-between;
  gap: 12px;
}

.app-header,
.admin-header {
  min-height: 74px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card), var(--paper) 18%);
  box-shadow: 0 4px 16px rgba(24, 21, 16, 0.06);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #111111, var(--accent) 64%, #3a0b0b);
  font-weight: 900;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
}

.brand-mark.has-logo {
  background: var(--card);
}

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

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong {
  font-size: 1.14rem;
}

.brand small {
  max-width: 170px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions,
.toolbar {
  justify-content: flex-end;
  gap: 7px;
}

.preference-toggle {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: 88px;
  height: 42px;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  padding: 3px;
}

.preference-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 5px 12px rgba(50, 34, 12, 0.18);
  transition: transform 160ms ease;
}

.preference-toggle[data-value="en"]::before,
.preference-toggle[data-value="dark"]::before {
  transform: translateX(46px);
}

.preference-toggle button {
  position: relative;
  z-index: 1;
  width: 40px;
  min-width: 40px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  padding: 0;
  font-size: 0;
  font-weight: 900;
  line-height: 1;
}

.preference-toggle button.is-active {
  color: #19130a;
  background: transparent;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.theme-icon {
  display: inline-block;
  vertical-align: middle;
}

.theme-icon {
  position: relative;
  width: 20px;
  height: 20px;
}

.sun-icon {
  border-radius: 50%;
  background: #fff8d8;
  box-shadow:
    0 -8px 0 -6px #fff8d8,
    0 8px 0 -6px #fff8d8,
    8px 0 0 -6px #fff8d8,
    -8px 0 0 -6px #fff8d8,
    6px 6px 0 -6px #fff8d8,
    -6px -6px 0 -6px #fff8d8,
    6px -6px 0 -6px #fff8d8,
    -6px 6px 0 -6px #fff8d8;
}

.moon-icon {
  border-radius: 50%;
  background: #fff8d8;
}

.moon-icon::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
}

.control,
input,
textarea,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--card);
  outline: 0;
}

.control,
input,
textarea,
select {
  width: 100%;
  padding: 0 12px;
}

textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.icon-button,
.soft-button,
.primary-button,
.danger-button,
.text-button,
.text-link {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  background: var(--card);
  font-weight: 800;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 1.1rem;
}

.primary-button {
  border-color: var(--accent);
  color: #19130a;
  background: var(--accent);
}

.danger-button {
  border-color: color-mix(in srgb, var(--danger), transparent 55%);
  color: var(--danger);
}

.text-button,
.text-link {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 0 4px;
}

.danger-text {
  color: var(--danger);
}

.handle,
.muted-small {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.menu-section {
  padding-top: 2px;
}

.section-title-row {
  margin: 4px 0 12px;
}

.section-title-row h1,
.section-title-row h2 {
  margin: 0;
  font-size: 1.25rem;
}

.menu-cover {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px 16px;
  margin: 0 0 14px;
  padding: 14px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.menu-cover h1 {
  grid-column: 1;
  font-size: 2.2rem;
  letter-spacing: 0;
}

.menu-cover .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--accent-dark);
}

.menu-cover .muted-small {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.82rem;
  text-align: right;
}

.category-strip {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  gap: 8px;
  margin: 0 -14px 18px;
  padding: 10px 14px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  box-shadow: none;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.category-strip::-webkit-scrollbar {
  height: 5px;
}

.category-strip::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--accent);
}

.category-chip {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: color-mix(in srgb, var(--card), var(--paper) 14%);
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.category-chip.is-active {
  border-color: var(--accent);
  color: #1a1309;
  background: var(--accent);
}

.product-list {
  display: grid;
  gap: 22px;
}

.menu-category-group {
  display: grid;
  gap: 10px;
}

.menu-category-group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-dark);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu-category-group h2::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: var(--line);
}

.menu-category-items {
  display: grid;
  gap: 10px;
}

.product-row {
  width: 100%;
  min-height: 118px;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 5px 18px rgba(24, 21, 16, 0.06);
  padding: 10px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.product-row:hover,
.product-row:focus-visible {
  border-color: color-mix(in srgb, var(--accent), var(--line) 42%);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(24, 21, 16, 0.09);
  outline: 0;
}

.product-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  padding: 1px 0;
}

.product-copy span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.product-title-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-top: 4px;
}

.product-title-line h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.15;
}

.product-title-line strong {
  align-self: start;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent), transparent 82%);
  font-size: 0.95rem;
  white-space: nowrap;
}

.product-meta-line {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 0.76rem;
  font-weight: 850;
}

.product-copy p {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.36;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-thumb-wrap {
  flex: 0 0 98px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--soft);
  aspect-ratio: 1;
}

.food-photo,
.product-thumb,
.admin-product-media img,
.image-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.food-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 118px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fffaf0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.92) 0 18%, transparent 19%),
    radial-gradient(circle at 46% 47%, rgba(180, 75, 34, 0.92) 0 31%, transparent 32%),
    linear-gradient(145deg, #231c16, #b3481f 55%, #f5a51c);
}

.food-placeholder::before {
  content: "";
  position: absolute;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 10px solid rgba(255, 255, 255, 0.72);
  background: radial-gradient(circle, rgba(245, 165, 28, 0.76), rgba(111, 42, 20, 0.72));
}

.food-placeholder.olive {
  background: linear-gradient(145deg, #1d2117, #657a4f 58%, #f5a51c);
}

.food-placeholder.tomato {
  background: linear-gradient(145deg, #271915, #b4432c 58%, #8bb76c);
}

.food-placeholder.grain {
  color: #241a10;
  background: linear-gradient(145deg, #fff7dc, #d9b56d 55%, #8f6e3f);
}

.food-placeholder.sky {
  background: linear-gradient(145deg, #26313a, #6f9ca7 58%, #fffaf0);
}

.food-placeholder.thumb {
  min-height: 130px;
}

.food-placeholder.small {
  min-height: 64px;
  border-radius: 7px;
}

.food-placeholder span {
  position: relative;
  z-index: 1;
  font-size: 1.6rem;
  font-weight: 950;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.62);
  padding: 0 12px 12px;
}

.detail-overlay[hidden] {
  display: none;
}

.detail-sheet {
  width: min(100%, 540px);
  max-height: min(86svh, 760px);
  margin: 0 auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px 14px 8px 8px;
  background: var(--card);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  touch-action: pan-y;
  transition: transform 180ms ease;
}

.detail-sheet.is-dragging {
  transition: none;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  touch-action: none;
}

.detail-media {
  height: min(42svh, 300px);
  margin: 0 12px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
}

.detail-content {
  padding: 16px 16px 22px;
}

.detail-content h2 {
  margin: 4px 0 10px;
  font-size: 1.7rem;
  line-height: 1.05;
}

.detail-content strong {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 1.1rem;
}

.detail-content p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.detail-info {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.detail-info div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--paper);
}

.detail-info span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-info strong {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
}

.muted {
  color: var(--muted);
}

/* Admin */
.shell {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 16px 12px;
}

.login-panel {
  min-height: calc(100svh - 112px);
  display: grid;
  place-items: center;
}

.panel,
.form-card,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 5px 18px rgba(24, 21, 16, 0.06);
}

.form-card,
.panel {
  padding: 16px;
}

.form-card {
  display: grid;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

label input,
label textarea,
label select {
  color: var(--text);
  font-weight: 650;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.page-notice {
  position: sticky;
  top: 8px;
  z-index: 60;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 850;
}

.page-notice[hidden] {
  display: none;
}

.page-notice.is-success {
  border-color: color-mix(in srgb, var(--green), transparent 45%);
  color: var(--green);
}

.page-notice.is-error {
  border-color: color-mix(in srgb, var(--danger), transparent 45%);
  color: var(--danger);
}

.admin-title-row {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
}

.admin-actions .primary-button,
.admin-actions .soft-button {
  flex: 1 1 150px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  display: grid;
  gap: 2px;
  padding: 14px;
  border-left: 4px solid var(--olive);
}

.stat span {
  font-size: 1.65rem;
  font-weight: 950;
}

.stat small {
  color: var(--muted);
  font-weight: 800;
}

.admin-grid,
.product-form-grid {
  display: grid;
  gap: 14px;
}

.product-editor {
  margin: 0;
}

.wide,
.file-field,
.switch-row {
  grid-column: 1 / -1;
}

.form-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.switch-row {
  grid-template-columns: auto 1fr;
  justify-content: start;
}

.switch-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.mini-list,
.admin-products {
  display: grid;
  gap: 10px;
}

.mini-item {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px 8px 12px;
  background: var(--paper);
}

.image-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed color-mix(in srgb, var(--accent), transparent 35%);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.image-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 2rem;
  font-weight: 900;
}

.brand-logo-editor {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.brand-logo-preview {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #111111, var(--accent) 64%, #3a0b0b);
  font-weight: 950;
}

.brand-logo-preview.has-logo {
  background: var(--card);
}

.brand-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-product {
  align-items: stretch;
  gap: 12px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--paper);
}

.admin-category-group {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--paper), var(--card) 24%);
}

.admin-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.admin-category-head h3 {
  font-size: 1.04rem;
}

.admin-category-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.admin-product-section {
  display: grid;
  gap: 8px;
}

.admin-product-section h4 {
  margin: 0;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-product-section.is-passive h4 {
  color: var(--muted);
}

.admin-product-section.is-passive .admin-product {
  opacity: 0.76;
}

.admin-product-media {
  flex: 0 0 72px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--soft);
}

.admin-product-info {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: center;
  gap: 3px;
}

.admin-product-info span,
.admin-product-info small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-product-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-product-actions {
  display: grid;
  gap: 6px;
  align-content: center;
}

.admin-product-actions .soft-button,
.admin-product-actions .danger-button {
  min-height: 35px;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.54);
}

.admin-modal[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 720px);
  max-height: min(88svh, 820px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  font-size: 1.34rem;
}

@media (min-width: 760px) {
  body {
    background: linear-gradient(180deg, color-mix(in srgb, var(--soft), var(--bg) 44%) 0, var(--bg) 240px, var(--paper) 100%);
  }

  .admin-grid,
  .product-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-category-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-panel .form-card {
    width: min(100%, 420px);
  }
}

@media (max-width: 430px) {
  .mobile-app,
  .admin-shell,
  .shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .app-header,
  .admin-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .header-actions,
  .toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .category-strip {
    padding-right: 10px;
    padding-left: 10px;
  }

  .product-row {
    min-height: 134px;
  }

  .product-thumb-wrap {
    flex-basis: 128px;
  }

  .product-copy h3 {
    font-size: 1.06rem;
  }

  .stats-row {
    gap: 7px;
  }

  .stat {
    padding: 10px 8px;
  }

  .admin-product {
    display: grid;
    grid-template-columns: 70px 1fr;
  }

  .admin-product-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-modal {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    max-height: 90svh;
    border-radius: 14px 14px 8px 8px;
  }
}

@media (max-width: 360px) {
  .product-row {
    display: grid;
  }

  .product-thumb-wrap {
    width: 100%;
    height: 150px;
  }
}
