:root {
  --bg: #0b1020;
  --panel: #111630;
  --ink: #e9ecff;
  --muted: #a8b2d6;
  --brand: #7c9cff;
  --ok: #22c55e;
  --warn: #facc15;
  --bad: #ef4444;
  --border: #2a3261;
  --hover: #4c5ad4;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 40px 0;
}

.logo {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  margin-bottom: 20px;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

nav {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 30px 0;
}

nav a {
  padding: 10px 20px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

nav a:hover {
  border-color: var(--hover);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.2);
}

.hero {
  text-align: center;
  padding: 60px 20px;
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--border);
  margin: 40px 0;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 20px;
}

.cta-button {
  display: inline-block;
  margin-top: 30px;
  padding: 15px 40px;
  background: var(--brand);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  font-weight: bold;
  transition: transform 0.2s;
}

.cta-button:hover {
  transform: scale(1.05);
}

/* Allergen chips (used across multiple pages) */
.allergen-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 15px 0;
}

.chip {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #12183a;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.chip:hover {
  border-color: var(--hover);
}

.chip.active {
  border-color: var(--brand);
  background: #1a2351;
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.2);
}

/* Panel component */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0;
}

.panel h2, .panel h3 {
  margin-top: 0;
}

/* Restaurant cards (for grid) */
.restaurant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.restaurant-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s;
}

.restaurant-card:hover {
  transform: translateY(-5px);
  border-color: var(--hover);
}

.restaurant-card-media {
  position: relative;
}

.restaurant-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.favorite-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(11, 16, 32, 0.78);
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, 0.85);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
}

.favorite-toggle:hover {
  transform: scale(1.05);
  border-color: var(--hover);
  color: #fff;
}

.favorite-toggle.is-active {
  color: #facc15;
  border-color: #facc15;
  background: rgba(58, 47, 0, 0.88);
}

.favorite-toggle.is-active:hover {
  color: #ffe580;
}

.restaurant-card-content {
  padding: 20px;
}

.restaurant-card h3 {
  margin: 0 0 10px 0;
}

.restaurant-card .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

/* Utility classes */
.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* Shared page shell + topbar */
.page-shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

.simple-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, #101637, #090f27);
  border-bottom: 1px solid #1c2448;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

.simple-topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.simple-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  font-weight: 800;
  font-size: clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
}

.simple-brand img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
}

.simple-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.simple-nav button,
.simple-nav a {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #12183a;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 0.95rem;
}

.simple-nav button:hover:not([disabled]),
.simple-nav a:hover {
  border-color: var(--hover);
  box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.2), 0 6px 14px rgba(15, 26, 80, 0.35);
}

.simple-nav button[disabled] {
  opacity: 0.55;
  cursor: default;
}

.simple-nav button.current-page,
.simple-nav a.current-page {
  border-color: var(--hover);
  box-shadow: 0 0 0 2px var(--brand);
}

.page-main {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 50px 20px 120px;
}

.page-content {
  width: 100%;
  max-width: 1100px;
}

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

/* Account page specifics */
.account-layout {
  display: grid;
  gap: 24px;
  max-width: 740px;
  margin: 0 auto;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.auth-card h2 {
  margin: 0;
  font-size: 1.6rem;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row > * {
  flex: 1 1 200px;
}

.auth-card input,
.auth-card textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #101739;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 15px;
  min-height: 44px;
  max-height: 44px;
  height: 44px;
}

.auth-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.primary-btn {
  background: #3651ff;
  border: 1px solid #4e65ff;
  color: #fff;
  padding: 10px 22px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 22px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  align-self: flex-start;
}

.link-btn:hover {
  color: #9eb3ff;
}

.primary-btn:hover,
.secondary-btn:hover {
  box-shadow: 0 6px 20px rgba(54, 81, 255, 0.25);
}

.allergen-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.allergen-select .chip {
  border-radius: 16px;
  color: var(--ink);
}

.allergen-select .chip.active {
  color: var(--ink);
}

.status-text {
  font-size: 0.95rem;
  min-height: 18px;
}

.status-text.error {
  color: var(--bad);
}

.status-text.success {
  color: var(--ok);
}

.mobileInfoPanel {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2200;
  padding: 16px 18px calc(28px + env(safe-area-inset-bottom, 0));
  background: rgba(11, 16, 32, 0.98);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
  pointer-events: none;
  max-height: 60vh;
  overflow-y: auto;
  width: 100vw;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
}

.mobileInfoPanel.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mobileInfoPanel .mobileInfoHeader {
  font-weight: 700;
  margin: 0;
  font-size: 1.05rem;
  text-align: left;
  display: block;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex: 1;
  color: var(--ink);
}

.mobileInfoHeaderRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mobileInfoClose {
  background: rgba(22, 32, 90, 0.9);
  border: 1px solid rgba(76, 90, 212, 0.4);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}

.mobileInfoClose:hover {
  border-color: var(--hover);
  box-shadow: 0 0 8px #3651ff;
}

.mobileInfoClose:focus {
  outline: 2px solid var(--hover);
  outline-offset: 2px;
}

.aiAssistBackdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 11, 28, 0.85);
  z-index: 3600;
}

.aiAssistBackdrop.show {
  display: flex;
}

.aiAssistPanel {
  width: min(960px, calc(100% - 32px));
  max-height: 90vh;
  overflow: auto;
  background: linear-gradient(180deg, #111a3c, #0d132a);
  border: 1px solid #2a3466;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.aiAssistHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aiAssistHead h2 {
  margin: 0;
  font-size: clamp(1.1rem, 1rem + 1vw, 1.6rem);
}

.aiAssistClose {
  background: rgba(22, 32, 90, 0.9);
  border: 1px solid rgba(76, 90, 212, 0.4);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  touch-action: manipulation;
}

.aiAssistClose:hover {
  border-color: var(--hover);
  box-shadow: 0 0 8px #3651ff;
}

.aiAssistClose:focus {
  outline: 2px solid var(--hover);
  outline-offset: 2px;
}

.aiAssistIntro {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.aiAssistInput {
  width: 100%;
  min-height: 140px;
  border-radius: 16px;
  border: 1px solid rgba(76, 90, 212, 0.35);
  background: rgba(10, 16, 36, 0.95);
  color: var(--ink);
  padding: 16px;
  font-size: 1rem;
  resize: vertical;
}

.aiAssistControls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.aiAssistStatus {
  font-size: 0.9rem;
  color: var(--muted);
}

.aiAssistStatus[data-tone="warn"] {
  color: var(--warn);
}

.aiAssistStatus[data-tone="error"] {
  color: var(--bad);
}

.aiAssistStatus[data-tone="success"] {
  color: var(--ok);
}

.aiAssistResults {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.aiAssistResults.show {
  display: flex;
}

.aiAssistTableWrapper {
  overflow-x: auto;
  border: 1px solid rgba(76, 90, 212, 0.35);
  border-radius: 16px;
  background: rgba(9, 13, 30, 0.9);
}

#aiAssistTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.95rem;
}

#aiAssistTable th,
#aiAssistTable td {
  padding: 12px;
  border-bottom: 1px solid rgba(76, 90, 212, 0.2);
  vertical-align: top;
}

#aiAssistTable th {
  text-align: left;
  background: rgba(17, 26, 60, 0.75);
}

.aiAssistTableWrapper tr:last-child td {
  border-bottom: none;
}

.aiIngredientName,
.aiIngredientBrand {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(76, 90, 212, 0.35);
  background: rgba(8, 12, 28, 0.95);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 0.95rem;
}

.aiBrandCell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aiIngredientList {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
}

.aiBrandPreview img {
  max-width: 120px;
  border-radius: 8px;
  border: 1px solid rgba(76, 90, 212, 0.35);
}

.aiAllergenChecklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.aiAllergenChecklist label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.9rem;
}

.aiAssistTableActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.aiAssistTableActions .aiAssistSpacer {
  flex: 1;
}

.aiAssistBrandResults {
  display: none;
  flex-direction: column;
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(76, 90, 212, 0.35);
  background: rgba(8, 12, 28, 0.95);
}

.aiAssistBrandResults.show {
  display: flex;
}

.aiBrandSuggestion {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(76, 90, 212, 0.25);
  cursor: pointer;
}

.aiBrandSuggestion:hover {
  border-color: var(--hover);
  background: rgba(54, 81, 255, 0.12);
}

.aiBrandSuggestion img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(76, 90, 212, 0.2);
}

.aiBrandSuggestionInfo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.aiAssistHidden {
  display: none !important;
}

.mobileInfoPanel .mobileInfoPlaceholder {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(19, 27, 58, 0.75);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.mobileMenuNotice {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(18, 24, 58, 0.75);
  border: 1px solid rgba(76, 90, 212, 0.4);
  color: var(--ink);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}
.mobileMenuNoticeText {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}
.mobileMenuNotice .mobileMenuOpenBtn {
  min-width: 200px;
}

#mobileViewerChrome {
  position: fixed;
  inset: 0;
  z-index: 3400;
  display: none;
  pointer-events: none;
}

body.mobileViewerActive #mobileViewerChrome {
  display: block;
}

#mobileViewerChrome .chromeTop {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + 18px);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 32px);
  pointer-events: none;
}

#mobileViewerChrome .chromeTop .mobileZoomGroup {
  pointer-events: auto;
}

#mobileViewerChrome button {
  pointer-events: auto;
}

.mobileViewerControlBtn {
  background: rgba(18, 24, 58, 0.9);
  border: 1px solid rgba(76, 90, 212, 0.5);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.mobileZoomGroup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(18, 24, 58, 0.9);
  border: 1px solid rgba(76, 90, 212, 0.4);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.mobileZoomGroup button {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 1.3rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobileZoomGroup span {
  font-weight: 600;
  color: var(--ink);
  min-width: 60px;
  text-align: center;
  font-size: 0.95rem;
}

.mobileInfoPanel .note {
  display: block;
  margin: 10px auto;
  padding: 12px 16px;
  background: rgba(10, 18, 48, 0.82);
  border-radius: 14px;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  max-width: min(520px, 92vw);
}

.mobileInfoPanel .note ul {
  text-align: left;
  margin: 8px auto 0;
  display: inline-block;
}

.content style,
.content script {
  display: none !important;
}

@media (min-width: 769px) {
  .mobileInfoPanel {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .simple-topbar-inner {
    padding: 16px 16px 12px;
    gap: 12px;
  }

  .simple-brand {
    gap: 12px;
  }

  .simple-brand img {
    width: 40px;
    height: 40px;
  }

  .simple-nav button,
  .simple-nav a {
    font-size: 0.9rem;
    padding: 7px 14px;
  }

  .page-main {
    padding: 40px 16px 100px;
  }

  .auth-card {
    padding: 22px;
  }
  .auth-card input,
  .auth-card textarea {
    font-size: 16px;
    line-height: 1.3;
    padding: 12px 14px;
    min-height: 44px;
    max-height: 44px;
    height: 44px;
  }

  .form-row {
    flex-direction: column;
  }
}

body.mobileViewerActive {
  overflow: hidden;
}

body.mobileViewerActive .menuWrap {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  margin: 0;
  border-radius: 0;
  padding: calc(env(safe-area-inset-top, 0) + 120px) clamp(14px, 4vw, 36px) calc(env(safe-area-inset-bottom, 0) + 80px);
  background: rgba(4, 7, 20, 0.96);
  z-index: 3100;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

body.mobileViewerActive .menuWrap .menuInner {
  margin: 0 auto;
}

body.mobileViewerActive .mobileMenuNotice {
  display: none !important;
}
body.mobileViewerActive .topbar,
body.mobileViewerActive #root > :not(.menuWrap),
body.mobileViewerActive .modalBack,
body.mobileViewerActive .photoModal,
body.mobileViewerActive .qrPromoBackdrop,
body.mobileViewerActive .qrBanner {
  display: none !important;
}

.mobileMenuNotice,
#mobileViewerChrome {
  display: none;
}

@media (max-width: 768px) {
  .menuWrap {
    position: relative;
  }
}
