/* ════════════════════════════════════════════════════════════════════
   Heritage Green & Gold palette — Najdi-inspired, premium, warm.
   Deep green + gold on an ivory/sand background. Tweak the :root tokens
   to re-theme the whole app. All colours are solid (no gradients); the
   --grad-* tokens are kept by name but now hold solid colours.
   ════════════════════════════════════════════════════════════════════ */
:root {
  /* Heritage Green & Gold — Najdi-inspired, premium, warm.
     Token names are kept from the previous theme so existing rules keep
     working; the values now drive a deep-green + gold identity. */
  --violet:        #0F7A52;   /* primary (green) */
  --violet-dark:   #0B5E3F;   /* primary hover */
  --indigo:        #0B6E4F;   /* gradient mid */
  --fuchsia:       #C8A24A;   /* gold accent (user edge, warm pops) */
  --pink:          #A8842F;   /* gold-dark accent */
  --ink:           #2B2118;   /* espresso text */
  /* Green family */
  --green:         #0F7A52;
  --green-dark:    #0B5E3F;
  --green-deep:    #064E3B;
  --green-soft:    #DCEFE6;
  /* Gold family */
  --gold:          #C8A24A;
  --gold-dark:     #A8842F;
  --gold-soft:     #F5E9CC;
  /* Secondary tokens (kept by name) */
  --teal:          #0F7A52;   /* green — assistant edge, distance */
  --teal-soft:     #DCEFE6;
  --emerald:       #0B7A4B;   /* call action */
  --emerald-soft:  #DCEFE6;
  --amber:         #A8842F;   /* prices (gold) */
  --amber-soft:    #F5E9CC;
  --grad-primary:  #0F7A52;   /* solid green (kept name for existing refs) */
  --grad-royal:    #0B5E3F;   /* solid deep green */
  --grad-sidebar:  #064E3B;   /* solid deep green sidebar */
  --grad-soft:     #F1F8F4;   /* solid light green */
  --bg-tint:       #FAF6EE;   /* ivory / sand background */
  --bg-tint-2:     #F1E9D8;   /* deeper sand surface */
  --border-violet: #E6DCC6;   /* sand hairline border */
  --violet-soft:   #DCEFE6;   /* light green fill (user bubble, active) */
}

/* Reset + base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Cairo",
               "Tajawal", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #2B2118;
  background: var(--bg-tint);
  -webkit-font-smoothing: antialiased;
}

/* ─── First-run coach marks (spotlight tour) ────────────────────────────── */
#coach { position: fixed; inset: 0; z-index: 9998; }
.coach-catch { position: fixed; inset: 0; z-index: 9998; }
.coach-hole {
  position: fixed;
  z-index: 9999;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(20, 30, 16, 0.55);
  outline: 3px solid #0F7A52;
  outline-offset: 2px;
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.coach-tip {
  position: fixed;
  z-index: 10000;
  width: 300px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 12px 34px rgba(6, 78, 59, 0.28);
  transition: top 0.2s ease, left 0.2s ease;
}
.coach-tip-step { font-size: 11px; color: #6F6147; margin-bottom: 6px; }
.coach-tip-title { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: #0B5E3F; }
.coach-tip-body { margin: 0 0 14px; font-size: 13.5px; line-height: 1.7; color: #5A4F3C; }
.coach-tip-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.coach-next {
  background: #0F7A52; color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: background 0.15s;
}
.coach-next:hover { background: #0B5E3F; }
.coach-skip {
  background: transparent; border: none; color: #8A8170;
  font-family: inherit; font-size: 13px; cursor: pointer;
}
.coach-skip:hover { color: #5A4F3C; }

/* ─── Intro splash ──────────────────────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-tint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 1;
  transition: opacity 0.45s ease;
  cursor: pointer;
}
.splash.splash-hide { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 116px;
  height: auto;
  /* Gentle container fade/scale-in; the arrow's rotate is animated inside the
     SVG itself (SMIL), which plays on its own when shown as an <img>. */
  animation: splashLogoIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.splash-name {
  font-size: 44px;
  font-weight: 800;
  color: #0B5E3F;
  letter-spacing: 1px;
  animation: splashNameIn 0.7s ease both;
  animation-delay: 0.22s;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: translateY(14px) scale(0.82); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes splashNameIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .splash-logo, .splash-name { animation-duration: 0.01ms; }
}

/* App layout */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  /* Pin the single row to the viewport height so each column scrolls
     INTERNALLY (the sidebar's chat list, the chat's messages). Without an
     explicit row, the implicit `auto` row grows to its tallest content, so
     many conversations push the sidebar past the screen instead of letting
     the chat list scroll. minmax(0,…) lets the flex children shrink. */
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

/* Sidebar — solid deep green for a bold, premium presence */
.sidebar {
  background: var(--grad-sidebar);
  /* Logical property: edge facing the chat, regardless of direction */
  border-inline-end: 1px solid #042B1C;
  display: flex;
  flex-direction: column;
  padding: 12px;
  /* Explicit viewport height (not just the grid stretch) so the chat list
     ALWAYS has a bounded parent and scrolls internally — even when a user has
     hundreds of conversations. dvh keeps it right on mobile browser chrome. */
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  transition: background 0.15s, border-color 0.15s;
}
.new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.4);
}
.sidebar-favorites-btn {
  margin-top: 6px;
  background: transparent;
  border-color: transparent;
  color: #DCEFE6;
}
.sidebar-favorites-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #E2C079;
}
.sidebar-favorites-btn svg { stroke: currentColor; }

/* Chat list (past conversations) */
.chat-list {
  flex: 1 1 0;             /* take the remaining sidebar height, basis 0 */
  min-height: 0;          /* CRITICAL: lets it shrink so overflow scrolls */
  /* Belt-and-suspenders: bind the list height DIRECTLY to the viewport
     (minus the two buttons + paddings above it) so it scrolls even if the
     flex/grid height chain fails to resolve in some browser. Whichever is
     smaller — this cap or the flex height — wins, and both scroll. */
  max-height: calc(100vh - 118px);
  max-height: calc(100dvh - 118px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
}
/* Thin, on-brand scrollbar for the (now scrollable) chat list */
.chat-list::-webkit-scrollbar { width: 9px; }
.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.chat-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5); background-clip: padding-box; }
.chat-list { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent; }
.chat-list-empty {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  padding: 8px 12px;
  text-align: center;
}
.chat-list-item {
  position: relative;
  /* Keep each row at its natural height — in a column flex container the
     default flex-shrink:1 would compress the rows together when the list
     overflows, making the titles look packed on top of each other. */
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: #E8DFC9;
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.chat-list-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.chat-list-item.active {
  background: rgba(255, 255, 255, 0.95);
  color: #064E3B;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.chat-list-item-delete {
  display: none;
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chat-list-item:hover .chat-list-item-delete { display: flex; }
.chat-list-item-delete:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
/* On the active (light) item the delete icon needs dark colors to be visible */
.chat-list-item.active .chat-list-item-delete { color: #7FA38D; }
.chat-list-item.active .chat-list-item-delete:hover { background: #E6DCC6; color: #064E3B; }

/* Account / sign-in (pushed to the trailing edge of the mode-tabs bar) */
.topbar-account {
  display: inline-flex;
  align-items: center;
  margin-inline-start: auto;
}
.topbar-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--grad-primary);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(15,122,82, 0.30);
  transition: filter 0.15s, box-shadow 0.15s;
}
.topbar-account-btn:hover { filter: brightness(1.08); box-shadow: 0 3px 12px rgba(15,122,82, 0.40); }
.topbar-account-btn svg { flex-shrink: 0; }
.topbar-account-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 10px;
  border: 1px solid #E6DCC6;
  border-radius: 7px;
  color: #555;
}
.topbar-account-user > svg { color: #0B5E3F; flex-shrink: 0; }
.account-user-phone {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.account-signout-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.account-signout-btn:hover { background: #FEF2F2; color: #EF4444; }
/* `display` above overrides the `hidden` attribute, so re-assert it —
   otherwise toggling signed-in state never hides either element. */
.topbar-account-btn[hidden],
.topbar-account-user[hidden] { display: none; }

/* Main chat */
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;            /* CRITICAL: allows .messages overflow to scroll */
  background: var(--bg-tint);
  position: relative;       /* anchor for the absolute-positioned composer */
}
.chat-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-violet);
  background: var(--bg-tint);
  display: flex;
  align-items: center;
  justify-content: flex-end;   /* brand moved to the tab bar; keep tools at the end */
  gap: 16px;
  flex-shrink: 0;
}
.chat-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  /* Now lives in the mode-tabs bar, beside the "المحادث" tab — a hairline
     divider separates the brand from the tabs. */
  margin-inline-end: 10px;
  padding-inline-end: 12px;
  border-inline-end: 1px solid var(--border-violet);
}
.chat-brand-logo {
  width: 26px;
  height: 26px;
  display: block;
  flex-shrink: 0;
}
.chat-brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0B5E3F;
  white-space: nowrap;
}

/* Scope bar: city + district dropdowns + "use my location" toggle */
.scope-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pulse on the location + city/neighborhood controls when an unscoped query is
   sent (paired with a transient pop-up toast — see maybeNudgeScope). */
.scope-highlight {
  animation: scopePulse 1s ease 0s 3;
  border-radius: 10px;
}
@keyframes scopePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 162, 74, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(200, 162, 74, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .scope-highlight { animation: none; box-shadow: 0 0 0 3px rgba(200, 162, 74, 0.5); }
}
.scope-select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 28px 6px 10px;     /* extra inline-end room for native arrow */
  border: 1.5px solid #D9CEB6;
  border-radius: 7px;
  background: #fff;
  color: #2B2118;
  cursor: pointer;
  outline: none;
  max-width: 180px;
  text-overflow: ellipsis;
  transition: border-color 0.15s, background 0.15s;
}
.scope-select:hover { border-color: #4FB088; }
.scope-select:focus { border-color: #0F7A52; }
.scope-select:disabled {
  background: #F4EFE3;
  color: #999;
  cursor: not-allowed;
}

/* ─── Searchable dropdown (type-to-filter combobox) ─────────────────────── */
.ss { position: relative; display: inline-block; }
.ss-native-hidden { display: none !important; }
.ss-input {
  cursor: text;
  padding-inline-end: 30px;        /* room for our chevron */
  padding-inline-start: 10px;
}
.ss-input:disabled { background: #F4EFE3; color: #999; cursor: not-allowed; }
.ss-arrow {
  position: absolute;
  inset-inline-end: 9px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: #6F6147;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.ss.ss-open .ss-arrow { transform: translateY(-50%) rotate(180deg); }
.ss-input:disabled ~ .ss-arrow { opacity: 0.4; cursor: not-allowed; }
.ss-panel {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 4px);
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: #fff;
  border: 1px solid #D9CEB6;
  border-radius: 9px;
  box-shadow: 0 8px 22px rgba(6, 78, 59, 0.14);
  max-height: 280px;
  overflow-y: auto;
  z-index: 60;
  padding: 4px;
}
.ss-panel::-webkit-scrollbar { width: 8px; }
.ss-panel::-webkit-scrollbar-thumb { background: #D9CEB6; border-radius: 4px; }
.ss-option {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #2B2118;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-option:hover,
.ss-option.active { background: #DCEFE6; }
.ss-option.selected { color: #0B5E3F; font-weight: 700; }
.ss-empty { padding: 10px 12px; font-size: 13px; color: #999; text-align: center; }

/* Scope-bar sizing: grow to share the row, capped like the old selects */
.scope-bar .ss { display: inline-block; flex: 1 1 140px; min-width: 0; max-width: 180px; }
.scope-bar .ss-input { width: 100%; }
.location-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid #D9CEB6;
  border-radius: 7px;
  background: #fff;
  color: #6F6147;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.location-btn:hover { border-color: #4FB088; background: var(--violet-soft); color: #0B5E3F; }
.location-btn.active {
  background: #E2EFE8;
  border-color: #0F7A52;
  color: #0B5E3F;
}
.location-btn.error {
  background: #FEF2F2;
  border-color: #EF4444;
  color: #DC2626;
}

/* Messages area */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 120px 0;
  scroll-behavior: smooth;
}

/* Welcome screen */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}
.welcome-logo {
  width: 66px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}
.welcome h2 {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 24px;
  color: #0B5E3F;
}
.examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 600px;
}
.example-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border-violet);
  border-radius: 12px;
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(6,78,59, 0.05);
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  color: inherit;
}
.example-card:hover {
  background: var(--violet-soft);
  border-color: #9FD7BD;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15,122,82, 0.14);
}
.example-title {
  font-size: 13px;
  font-weight: 700;
  color: #0B5E3F;
}
.example-text {
  font-size: 13px;
  color: #6F6147;
}

/* Message bubbles */
.message {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  gap: 14px;
}
.message-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.message-user .message-avatar {
  background: #C8A24A;
  color: #2B2118;
  box-shadow: 0 2px 8px rgba(168,132,47,0.32);
}
.message-assistant .message-avatar {
  background: var(--grad-primary);
  box-shadow: 0 2px 8px rgba(15,122,82,0.30);
}
.message-content {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* The user's prompt sits in a soft green bubble so the conversation reads
   clearly on the sand background. The assistant stays open (no bubble) so the
   result cards breathe. No coloured side accents. */
.message-user .message-content {
  background: var(--violet-soft);
  border: 1px solid #CBE3D5;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(15,122,82,0.10);
}
.message-content p { margin: 0 0 10px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol {
  margin: 8px 0;
  padding-right: 22px;
}
.message-content li { margin: 4px 0; }
.message-content code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.9em;
  background: #F3EEE1;
  padding: 2px 5px;
  border-radius: 4px;
}
.message-content pre {
  background: #F3EEE1;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9em;
}

/* Loading indicator */
.message-loading .message-content {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
}
.dot {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 60%, 100% { opacity: 0.3; }
  30%           { opacity: 1;   }
}

/* ─── Restaurant menu (T5 results) ─────────────────────────────────── */
.menu {
  margin-top: 14px;
  border: 1px solid #E6DCC6;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.menu-restaurant {
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--grad-royal);
}
.menu-category {
  padding: 11px 16px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #0B5E3F;
  letter-spacing: 0.2px;
  border-top: 1px solid #EBE3D1;
}
.menu-section:first-of-type .menu-category { border-top: none; }
.menu-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
}
.menu-item:hover { background: #FAF7EF; }
.menu-item-main { display: flex; flex-direction: column; min-width: 0; }
.menu-item-name { font-size: 14px; color: #2B2118; }
.menu-item-desc { font-size: 12px; color: #6F6147; margin-top: 2px; }
.menu-item-price {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: #0B5E3F;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* "Show menu" button on a result card */
.card-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #EDF5EF;
  border: 1px solid #C7E7D6;
  border-radius: 7px;
  color: #0B5E3F;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.card-menu-btn:hover { background: #E2EFE8; border-color: #9FD7BD; }
.card-menu-btn svg { flex-shrink: 0; }

/* Menu modal: a scrollable menu; closing it returns to the results list */
.modal-menu {
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}
.menu-modal-body {
  overflow-y: auto;
  margin-top: 10px;
  min-height: 80px;
}
.menu-modal-body .menu { margin-top: 0; border: none; }
.menu-modal-body .menu-restaurant { border-radius: 10px 10px 0 0; }
.menu-modal-loading,
.menu-modal-empty {
  padding: 40px 16px;
  text-align: center;
  color: #888;
  font-size: 14px;
}
/* Menu image fallback (external reviewer photos) */
.menu-photo-wrap { padding: 8px; text-align: center; }
.menu-photo-caption {
  font-size: 12px; color: #6F6147; margin-bottom: 10px;
}
.menu-photo-img {
  max-width: 100%; height: auto; border-radius: 10px;
  border: 1px solid var(--border-violet);
  box-shadow: 0 2px 10px rgba(6,78,59,0.10);
}
[data-theme="dark"] .menu-photo-caption { color: #A9AFB5; }

/* Place cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

/* Collapse cards beyond the first four behind a toggle.
   Note: these need a two-class selector (.cards .card-collapsed) so they
   outrank the later `.card { display: flex }` rule — a bare
   `.card-collapsed` ties on specificity and loses to it. */
.cards-wrap { margin-top: 14px; }
.cards-wrap .cards { margin-top: 0; }
.cards .card-collapsed { display: none; }
.cards.show-all .card-collapsed { display: flex; }
.cards-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 18px;
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #0B5E3F;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.cards-toggle:hover {
  background: #EDF5EF;
  border-color: #9FD7BD;
  box-shadow: 0 2px 8px rgba(15,122,82,0.12);
}
.cards-toggle-chevron { transition: transform 0.2s ease; }
.cards-toggle.expanded .cards-toggle-chevron { transform: rotate(180deg); }
.card {
  background: #fff;
  border: 1px solid var(--border-violet);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(6,78,59, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  border-color: #0F7A52;
  box-shadow: 0 4px 12px rgba(15,122,82,0.14);
  transform: translateY(-1px);
}
.card-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #E6DCC6;
  display: block;
}
.card-photo-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #EAF3EC;
  border-bottom: 1px solid #DCEFE6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0F7A52;
  font-size: 30px;
}
/* Branded monogram: the place's first letter on a soft green tile — makes a
   missing photo read as intentional rather than broken. */
.placeholder-monogram {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #CBE3D5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #0B5E3F;
  box-shadow: 0 2px 8px rgba(15, 122, 82, 0.10);
}
.card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #2B2118;
  margin: 0;
  line-height: 1.3;
  /* truncate to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-rating {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: #444;
}
.card-rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-stars { color: #C8A24A; font-weight: 600; }   /* overall rating = amber */
.card-rating-hs .card-stars { color: #0F7A52; }      /* delivery rating = green */
.card-review-count { color: #888; font-size: 12px; }
.card-meta {
  font-size: 13px;
  color: #6F6147;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-meta-icon {
  flex-shrink: 0;
  opacity: 0.6;
}
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid #EBE3D1;
}
.card-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  background: #F4EFE3;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.card-action:hover {
  background: #fff;
  border-color: #D9CEB6;
  color: #2B2118;
}
.card-action.primary {
  background: var(--grad-primary);
  color: #fff;
}
.card-action.primary:hover {
  filter: brightness(1.08);
  color: #fff;
  border-color: transparent;
}
/* Colour-coded actions: call = emerald, website = teal (map = violet above) */
.card-action[href^="tel:"] {
  background: var(--emerald-soft);
  color: #0B6E4F;
}
.card-action[href^="tel:"]:hover {
  background: var(--emerald);
  color: #fff;
  border-color: transparent;
}
.card-action:not(.primary):not([href^="tel:"]) {
  background: var(--gold-soft);
  color: #8A6D24;
}
.card-action:not(.primary):not([href^="tel:"]):hover {
  background: var(--gold-dark);
  color: #fff;
  border-color: transparent;
}
.card-extra {
  font-size: 12px;
  color: #6F6147;
  margin-top: 4px;
}
.card-extra strong {
  color: #2B2118;
  font-weight: 600;
}
.card-extra .price {
  color: var(--amber);
  font-weight: 700;
}
.card-extra .distance {
  color: var(--teal);
  font-weight: 600;
}

/* Feedback (thumbs up/down) under each assistant reply */
.feedback {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

/* Follow-up suggestion chips under the latest answer */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  animation: suggestFade 0.25s ease-out;
}
@keyframes suggestFade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.suggestions-label {
  font-size: 12px;
  color: #6F6147;
  margin-inline-end: 2px;
}
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid #CBE3D5;
  border-radius: 999px;
  color: #0B5E3F;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.suggestion-chip::before { content: "＋"; font-weight: 700; opacity: 0.55; }
.suggestion-chip:hover {
  background: var(--violet-soft);
  border-color: #4FB088;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 122, 82, 0.12);
}

/* Streaming text — a subtle blinking cursor on the trailing character
   while text deltas are arriving. Removed after `done` event fires. */
.stream-text {
  display: inline;
  white-space: pre-wrap;
}
.message-assistant .stream-text::after {
  content: "▍";
  display: inline-block;
  margin-inline-start: 2px;
  font-weight: 400;
  color: #0F7A52;
  animation: streamBlink 1s steps(2, end) infinite;
}
.message-assistant.done .stream-text::after { display: none; }
@keyframes streamBlink {
  0%, 50%  { opacity: 1; }
  51%, 100%{ opacity: 0; }
}
.stream-cards-slot { display: contents; }
.message:hover .feedback { opacity: 1; }
.feedback-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  font-family: inherit;
}
.feedback-btn:hover {
  background: #F3EEE1;
  color: #2B2118;
  border-color: #E6DCC6;
}
.feedback-btn.active {
  background: #E2EFE8;
  color: #0F7A52;
  border-color: #0F7A52;
}
.feedback-btn[data-rating="-1"].active {
  background: #FEF2F2;
  color: #EF4444;
  border-color: #EF4444;
}

/* ─── Card overlays: heart (favorite) + checkbox (compare) ─────────── */
/* Both are absolutely positioned on the card photo so they don't shift
   layout. The card already has overflow:hidden + border-radius so they
   stay clipped neatly. */
/* isolation:isolate makes the card its own stacking context, so the
   absolutely-positioned favorite/compare buttons (z-index:2) stay contained
   inside the card and can't paint over the composer when scrolled near it. */
.card { position: relative; isolation: isolate; }

.card-favorite-btn {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;   /* visual-left in LTR, visual-right in RTL */
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #888;
  transition: all 0.15s;
  padding: 0;
  z-index: 2;
}
.card-favorite-btn:hover { background: #fff; color: #EF4444; }
.card-favorite-btn.active {
  color: #EF4444;
  background: #fff;
}
.card-favorite-btn.active svg { fill: currentColor; }

.card-compare-check {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  z-index: 2;
  transition: all 0.15s;
  padding: 0;
}
.card-compare-check:hover { background: rgba(0, 0, 0, 0.5); }
.card-compare-check.checked {
  background: #0F7A52;
  border-color: #0F7A52;
}
.card-compare-check.checked svg { display: block; }
.card-compare-check svg { display: none; }

/* ─── Floating compare bar ─────────────────────────────────────────── */
.compare-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2B2118;
  color: #fff;
  border-radius: 999px;
  padding: 10px 8px 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  z-index: 90;
  animation: compareBarRise 0.2s ease-out;
}
.compare-bar[hidden] { display: none; }
@keyframes compareBarRise {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
.compare-bar-count {
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.compare-bar-btn {
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}
.compare-bar-btn:hover { filter: brightness(1.1); }
.compare-bar-btn:disabled {
  background: #444; cursor: not-allowed;
}
.compare-bar-clear {
  background: transparent;
  color: #ccc;
  border: none;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}
.compare-bar-clear:hover { color: #fff; }

/* ─── Compare modal ────────────────────────────────────────────────── */
.modal-backdrop-wide .modal-wide {
  max-width: 880px;
}
.compare-table-wrap {
  overflow-x: auto;
  margin-top: 8px;
  max-height: 70vh;
}
.compare-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13px;
}
.compare-table th, .compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #EBE3D1;
  text-align: start;
  vertical-align: top;
}
.compare-table thead th {
  background: #F4EFE3;
  border-bottom: 2px solid #E6DCC6;
  text-align: center;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.compare-table tbody th {
  color: #666;
  font-weight: 500;
  font-size: 12px;
  width: 130px;
  background: #FAF7EF;
}
.compare-table td {
  font-weight: 500;
  text-align: center;
}
.compare-table img.compare-photo {
  width: 100%;
  max-width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ─── Welcome tour ────────────────────────────────────────────────── */
.modal-tour {
  max-width: 480px;
}
.tour-step-indicator {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}
.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #D9CEB6;
  transition: background 0.15s, width 0.15s;
}
.tour-dot.active { background: #0F7A52; width: 24px; border-radius: 4px; }
.tour-content h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #2B2118;
  text-align: center;
}
.tour-content p {
  margin: 0 0 16px;
  color: #555;
  line-height: 1.6;
  text-align: center;
}
.tour-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 12px;
}
.tour-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.tour-actions .modal-primary-btn,
.tour-actions .modal-secondary-btn {
  flex: 1;
  margin-top: 0;
}

/* ─── Favorites view (replaces message area when clicked) ──────────── */
.favorites-view {
  padding: 24px;
  max-width: 720px;
  margin: 0 auto;
}
.favorites-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.favorites-view-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #2B2118;
}
.favorites-view-back {
  background: transparent;
  border: 1px solid #D9CEB6;
  border-radius: 7px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #555;
}
.favorites-view-back:hover { background: #F4EFE3; color: #2B2118; }
.favorites-empty {
  text-align: center;
  padding: 60px 24px;
  color: #888;
}
.favorites-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.composer-meta {
  max-width: 720px;
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.composer-hint {
  font-size: 11px;
  color: #999;
}
.char-counter {
  font-size: 11px;
  color: #999;
  font-family: ui-monospace, monospace;
  flex-shrink: 0;
}
.char-counter.warn { color: #A8842F; }
.char-counter.over { color: #EF4444; font-weight: 600; }

/* ─── Modal (auth + share) ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24,30,16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.15s;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(6,78,59, 0.22);
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0B5E3F;
}
.modal-subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  color: #6F6147;
  line-height: 1.55;
}
.modal label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  margin-bottom: 6px;
  margin-top: 10px;
}
.modal input[type="tel"],
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid #D9CEB6;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #2B2118;
  transition: border-color 0.15s;
}
.modal input:focus { border-color: #0F7A52; }

/* Auth tabs (login / register) + forms */
.auth-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 6px;
  background: #F1E9D8;
  padding: 4px;
  border-radius: 10px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #6F6147;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: #fff;
  color: #0B5E3F;
  box-shadow: 0 1px 3px rgba(6, 78, 59, 0.12);
}
.auth-form { display: flex; flex-direction: column; }
.auth-form[hidden] { display: none; }
.auth-form .modal-primary-btn { margin-top: 16px; }
.auth-verify-icon { font-size: 36px; text-align: center; margin: 14px 0 8px; }
.auth-verify-msg {
  font-size: 13.5px; line-height: 1.8; color: #5A4F3C;
  text-align: center; margin: 0 0 16px;
}
.auth-note { background: #DCEFE6 !important; color: #0B5E3F !important; }
.modal-test-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: #888;
  font-style: italic;
}
.modal-primary-btn {
  width: 100%;
  padding: 11px;
  margin-top: 14px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15,122,82,0.30);
  transition: filter 0.15s, box-shadow 0.15s;
}
.modal-primary-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(15,122,82,0.42);
}
.modal-primary-btn:disabled { background: #9FD7BD; cursor: not-allowed; }

.modal-secondary-btn {
  width: 100%;
  padding: 9px;
  margin-top: 8px;
  background: transparent;
  color: #666;
  border: 1px solid #D9CEB6;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-secondary-btn:hover { background: #F4EFE3; color: #2B2118; }
.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  font-size: 15px;
}
.modal-close:hover { background: #EBE3D1; color: #2B2118; }

.modal-error {
  margin-top: 12px;
  padding: 8px 10px;
  background: #FEF2F2;
  color: #DC2626;
  border-radius: 6px;
  font-size: 13px;
}

/* Share URL row */
.share-url-row {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}
.share-url-row input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  direction: ltr;       /* URLs always LTR */
  text-align: left;
}
.share-url-row .modal-primary-btn {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
  padding: 10px 16px;
}

/* ─── Shared view (read-only /share/<token> page) ──────────────────── */
body.shared-view {
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.shared-banner {
  background: #EDF5EF;
  border-bottom: 1px solid #C7E7D6;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #0B5E3F;
}
.shared-brand { display: inline-flex; align-items: center; gap: 8px; }
.shared-brand-logo { width: 20px; height: 20px; display: block; }
.shared-cta {
  background: #0F7A52;
  color: #fff;
  padding: 6px 14px;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
}
.shared-cta:hover { background: #0B5E3F; }
.shared-chat {
  position: static;
  flex: 1;
}
.shared-chat .messages {
  padding: 24px 0 40px 0;   /* no composer to clear */
}
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 24px;
  gap: 14px;
}
.not-found h1 { font-size: 22px; color: #2B2118; margin: 0; }
.not-found p  { color: #6F6147; margin: 0; }
.not-found .modal-primary-btn { width: auto; padding: 10px 24px; }

/* Composer */
/* Composer — anchored to the bottom of .chat (which is position: relative).
   Logical properties so it aligns correctly in both LTR and RTL. */
.composer {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  padding: 12px 24px 18px;
  background: var(--bg-tint);
  z-index: 20;   /* keep the input above scrolling card content/buttons */
}
.composer-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  background: #fff;
  border: 1.5px solid #CBE0D2;
  border-radius: 16px;
  padding: 8px 12px 8px 50px;
  box-shadow: 0 4px 16px rgba(6,78,59, 0.10);
}
.composer-inner:focus-within {
  border-color: #0F7A52;
  box-shadow: 0 4px 18px rgba(15,122,82, 0.20);
}

/* Composer tool buttons (save prompt / saved prompts) */
.composer-tools {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.composer-tool-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #999;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.composer-tool-btn:hover { background: #E2EFE8; color: #0B5E3F; }
.composer-tool-btn.saved { color: #0B5E3F; }   /* brief "saved" flash */

/* Saved-prompts list (in the prompts modal) */
.prompt-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-bottom: 1px solid #EBE3D1;
}
.prompt-item:hover { background: #FAF7EF; }
.prompt-run {
  flex: 1;
  text-align: start;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 14px;
  color: #2B2118;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-run:hover { color: #0B5E3F; }
.prompt-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  font-size: 14px;
}
.prompt-delete:hover { background: #FEF2F2; color: #EF4444; }
.prompts-empty { padding: 30px 16px; text-align: center; color: #888; font-size: 14px; }

/* Add-a-prompt row inside the prompts modal */
.prompt-add {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E2EFE8;
}
.prompt-add-input {
  flex: 1;
  border: 1px solid #D9CEB6;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #2B2118;
  outline: none;
}
.prompt-add-input:focus { border-color: #0F7A52; }
.prompt-add-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  background: #0F7A52;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.prompt-add-btn:hover { background: #0B5E3F; }

/* "Save this prompt" bookmark under a user message */
.msg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 6px;
}
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #A2906A;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.msg-action-btn:hover { background: #fff; color: #0B5E3F; }
.msg-action-btn.copied { color: #0B5E3F; }
.msg-save-btn.saved { color: #0B5E3F; }
.msg-save-btn.saved svg { fill: currentColor; }

#input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 8px 0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  background: transparent;
  max-height: 200px;
  color: inherit;
}
#send-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 32px;
  height: 32px;
  background: var(--grad-primary);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,122,82,0.35);
  transition: filter 0.15s, opacity 0.15s, box-shadow 0.15s;
}
#send-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(15,122,82,0.45);
}
#send-btn:disabled {
  background: #D9CEB6;
  cursor: not-allowed;
  opacity: 0.6;
}
/* Icon switching: idle shows send, sending shows stop. Default both
   shown so JS isn't strictly required, then the .sending class flips. */
#send-btn .icon-stop { display: none; }
.composer.sending #send-btn .icon-send { display: none; }
.composer.sending #send-btn .icon-stop { display: block; }
/* Stop button is always clickable (it's how you abort) and gets the
   default action color so it stands out from a disabled-send button. */
.composer.sending #send-btn {
  background: #2B2118;
  opacity: 1;
  cursor: pointer;
}
.composer.sending #send-btn:hover { background: #000; }
/* Input dims while a response is generating */
.composer.sending #input {
  opacity: 0.5;
  cursor: not-allowed;
}
.composer.sending .composer-inner {
  border-color: #E6DCC6;
  background: #FAF7EF;
}

/* Aborted-message marker (small italic label after a stopped reply) */
.message.stopped .stream-text::after {
  content: " (تم الإيقاف)";
  color: #888;
  font-size: 11px;
  font-style: italic;
}
.composer-hint {
  max-width: 720px;
  margin: 8px auto 0;
  font-size: 11px;
  color: #999;
  text-align: center;
}

/* Mobile (one column) */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .scope-bar { width: 100%; }
  .scope-select { flex: 1; min-width: 0; }
  /* Keep the tab bar compact: show just the logo beside the tab. */
  .chat-brand {
    margin-inline-end: 4px;
    padding-inline-end: 8px;
  }
  .chat-brand h1 { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   MODE TABS — switch between chat and feasibility-study
   ════════════════════════════════════════════════════════════════════ */
.mode-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-violet);
  background: var(--bg-tint);
  flex-shrink: 0;
}
.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #6F6147;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-tab:hover  { background: var(--violet-soft); color: #0B5E3F; }
.mode-tab.active {
  background: var(--grad-royal);
  color: #fff;
  box-shadow: 0 3px 10px rgba(15,122,82,0.38);
}
.mode-tab.active:hover { filter: brightness(1.08); }
.mode-tab svg { flex-shrink: 0; }

.mode-content { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mode-content[hidden] { display: none; }

/* ════════════════════════════════════════════════════════════════════
   FEASIBILITY VIEW
   ════════════════════════════════════════════════════════════════════ */
.feas-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 80px;
  background: #FAF7EF;
}
.feas-form-card {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 12px;
  padding: 24px 24px 20px;
}
/* Shown when the admin disables "دراسة جدوى المكان" */
.feas-disabled-notice {
  max-width: 560px;
  margin: 48px auto;
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 14px;
  padding: 32px 28px;
  text-align: center;
  font-size: 16px;
  line-height: 1.8;
  color: #2B2118;
  box-shadow: 0 4px 16px rgba(6,78,59,0.06);
}
.feas-form-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: #2B2118;
}
.feas-subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  color: #666;
}
.feas-form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.feas-form-field {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}
.feas-form-field label {
  font-size: 12px;
  font-weight: 500;
  color: #444;
  margin-bottom: 6px;
}
.feas-form-field input[type="text"],
.feas-form-field select {
  padding: 9px 12px;
  border: 1px solid #D9CEB6;
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.feas-form-field input:focus,
.feas-form-field select:focus { border-color: #0F7A52; }
/* Searchable combobox inside a feasibility field: full width + chevron room */
.feas-form-field .ss { display: block; width: 100%; }
.feas-form-field .ss-input {
  width: 100%;
  padding-inline-end: 30px;
  padding-inline-start: 12px;
}
.feas-form-field select:disabled {
  background: #F4EFE3;
  color: #999;
  cursor: not-allowed;
}
.feas-checkbox-field { justify-content: flex-end; }
.feas-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
  padding-block: 9px;     /* visually align with adjacent select */
}
.feas-checkbox-label input { width: 16px; height: 16px; cursor: pointer; }

.feas-submit-btn {
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15,122,82,0.30);
  transition: filter 0.15s, box-shadow 0.15s;
}
.feas-submit-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(15,122,82,0.42);
}
.feas-submit-btn:disabled { background: #D9CEB6; cursor: not-allowed; }

/* ── Results ────────────────────────────────────────────────────── */
.feas-results { max-width: 720px; margin: 18px auto 0; }
.feas-results-empty {
  padding: 40px 24px;
  text-align: center;
  color: #888;
  font-size: 14px;
}
.feas-results-loading {
  padding: 40px 24px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

.feas-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .feas-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.feas-stat-tile {
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.feas-stat-tile.accent-green { border-color: #C7E7D6; background: #EDF5EF; }
.feas-stat-tile.accent-amber { border-color: #f4e6c2; background: #fdf8ec; }
.feas-stat-tile-label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
  margin-bottom: 6px;
}
.feas-stat-tile-value {
  font-size: 22px;
  font-weight: 600;
  color: #2B2118;
  font-variant-numeric: tabular-nums;
}
.feas-stat-tile-sub {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.feas-verdict-card {
  background: #EDF5EF;
  border: 1px solid #C7E7D6;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.feas-verdict-label {
  font-size: 11px;
  font-weight: 600;
  color: #0B5E3F;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.feas-verdict-text {
  font-size: 14px;
  line-height: 1.7;
  color: #2B2118;
  white-space: pre-wrap;
}

/* Distribution bars (rating buckets, price buckets) */
.feas-section {
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.feas-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 12px;
}
.feas-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 12px;
}
.feas-bar-label  { color: #666; }
.feas-bar-track  { background: #EBE3D1; height: 8px; border-radius: 4px;
                   overflow: hidden; }
.feas-bar-fill   { height: 100%; background: #0F7A52; border-radius: 4px;
                   transition: width 0.4s ease-out; }
.feas-bar-count  { text-align: end; color: #444; font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════════════
   MAP CONTAINERS
   ════════════════════════════════════════════════════════════════════ */
/* In chat messages — a smaller, toggleable map under cards */
.message-map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid #D9CEB6;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  margin-top: 8px;
}
.message-map-toggle:hover { background: #F4EFE3; color: #2B2118; }
.message-map-container {
  margin-top: 10px;
  border: 1px solid #E6DCC6;
  border-radius: 10px;
  overflow: hidden;
  height: 320px;
}
.message-map-container[hidden] { display: none; }

/* In feasibility — taller, always-visible map */
.feas-map-container {
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #E6DCC6;
  border-radius: 10px;
  overflow: hidden;
  height: 400px;
}

/* Fallback message when the map service is unavailable */
.map-disabled-note {
  padding: 14px 16px;
  text-align: center;
  color: #888;
  font-size: 12px;
  background: #FAF7EF;
  border-radius: 8px;
}

.feas-map-fallback { display: none; }   /* feasibility map fallback note */

/* ════════════════════════════════════════════════════════════════════
   LEAFLET / OSM TWEAKS
   ════════════════════════════════════════════════════════════════════ */
/* Default Leaflet popup is fine; just give the close button a bit more
   breathing room in RTL and tighten font-rendering. */
.leaflet-popup-content { margin: 10px 14px; line-height: 1.4; }
.leaflet-popup-content-wrapper { border-radius: 8px; }
.leaflet-popup-close-button {
  font-size: 18px;
  padding: 4px 8px 0 0 !important;
}
/* Attribution control: smaller and slightly transparent */
.leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.8);
}
.leaflet-control-attribution a { color: #555; }

/* "You are here" marker — Google-style blue dot with a soft halo, shown on
   the results map when the user has activated their location. */
.hs-leaflet-me .hs-me-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hs-leaflet-me .hs-me-core {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4285F4;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ─── One-tap discovery (Surprise me / Hidden gems / Trending) ─────────────── */
/* Compact header buttons that sit in the scope-bar beside the city dropdown. */
.scope-discovery-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1.5px solid #D9CEB6;
  border-radius: 7px;
  background: #fff;
  color: #0B5E3F;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.scope-discovery-btn:hover {
  background: var(--green-soft);
  border-color: #4FB088;
}
.scope-discovery-icon { font-size: 15px; line-height: 1; }
.scope-discovery-gems { color: var(--gold-dark); }
.scope-discovery-gems:hover { background: var(--gold-soft); border-color: #E0C57F; }

/* Trending queries */
.trending {
  width: 100%;
  max-width: 600px;
  margin: 18px auto 0;
  text-align: start;
}
.trending-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #0B5E3F;
  margin-bottom: 8px;
}
.trending-fire { font-size: 15px; }
.trending-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trending-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-violet);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: #4A3F2C;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.trending-chip:hover {
  background: var(--green-soft);
  border-color: #9FD7BD;
  color: #0B5E3F;
}

/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS — gear button, modal controls (dark mode toggle, font size,
   change password), plus the app-wide dark theme and font-size scaling.
   ══════════════════════════════════════════════════════════════════════════ */

/* Gear button in the top bar (always visible, guests included) */
.topbar-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-inline-end: 6px;
  background: transparent;
  border: 1px solid var(--border-violet);
  border-radius: 8px;
  color: #6F6147;
  cursor: pointer;
  transition: transform .1s ease, background .15s, border-color .15s, color .15s;
}
.topbar-settings-btn:hover {
  color: #0B5E3F;
  border-color: #9FD7BD;
  background: var(--violet-soft);
}

/* Settings groups + rows */
.settings-group { margin-bottom: 4px; }
.settings-group + .settings-group,
.settings-group + .settings-guest-hint {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-violet);
}
.settings-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #0B5E3F;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
}
.settings-row-stack { flex-direction: column; align-items: stretch; gap: 10px; }
.settings-row-text { display: flex; flex-direction: column; gap: 2px; }
.settings-row-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.settings-row-desc  { font-size: 12px; color: #8A8170; }
.settings-success {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.settings-guest-hint {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: #6F6147;
}
.settings-guest-hint .modal-secondary-btn { align-self: flex-start; }

/* Toggle switch (dark mode) */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: #D2C6AC;
  cursor: pointer;
  padding: 0;
  transition: background .18s, transform .1s ease;
}
.switch.on { background: var(--green); }
.switch-knob {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.28);
  transition: transform .18s ease;
}
/* RTL: knob rests at the right; sliding "on" moves it to the left end. */
.switch.on .switch-knob { transform: translateX(-20px); }

/* Segmented control (font size) */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-tint-2);
  border-radius: 10px;
}
.seg-btn {
  border: none;
  background: transparent;
  border-radius: 7px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #6F6147;
  cursor: pointer;
  transition: background .15s, color .15s, transform .1s ease;
}
.seg-btn:hover { color: #0B5E3F; }
.seg-btn.active {
  background: #fff;
  color: #0B5E3F;
  box-shadow: 0 1px 3px rgba(6,78,59,0.12);
}

/* ─── Font-size scaling (content + composer) ────────────────────────────────
   Uses `zoom` on the conversation so text AND cards scale together, and a
   matching input font-size so typing feels consistent. "medium" = default
   (no attribute), so the untouched base sizes apply. */
html[data-fontsize="small"]  .messages { zoom: 0.92; }
html[data-fontsize="large"]  .messages { zoom: 1.12; }
html[data-fontsize="xlarge"] .messages { zoom: 1.24; }
html[data-fontsize="small"]  #input { font-size: 14px; }
html[data-fontsize="large"]  #input { font-size: 16.5px; }
html[data-fontsize="xlarge"] #input { font-size: 18px; }

/* ══════════════════════════════════════════════════════════════════════════
   DARK THEME — applied via <html data-theme="dark">. Overrides the shared
   tokens, then the specific surfaces that use hard-coded light colours. The
   sidebar is already deep-green, so it needs little change.
   ══════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-tint:       #14181B;
  --bg-tint-2:     #1B2126;
  --border-violet: #303840;
  --violet-soft:   #17362A;
  --green-soft:    #17362A;
  --teal-soft:     #17362A;
  --emerald-soft:  #17362A;
  --grad-soft:     #16211C;
  --gold-soft:     #2E2716;
  --amber-soft:    #2E2716;
}
[data-theme="dark"] body { color: #E7E2D7; }

/* Light-surface (#fff) components → dark surfaces */
[data-theme="dark"] .card,
[data-theme="dark"] .composer-inner,
[data-theme="dark"] .modal,
[data-theme="dark"] .ss-panel,
[data-theme="dark"] .coach-tip {
  background: #1E252A;
  border-color: #303840;
}
[data-theme="dark"] .composer-inner { border-color: #2E4A3D; }
[data-theme="dark"] .card-photo { background: #232B31; }
[data-theme="dark"] .card-photo-placeholder {
  background: #14251D;
  border-bottom-color: #223228;
  color: #5FC79B;
}
[data-theme="dark"] .placeholder-monogram {
  background: #1E252A;
  border-color: #2E4A3D;
}
[data-theme="dark"] .card-title { color: #E7E2D7; }
[data-theme="dark"] .card-review-count,
[data-theme="dark"] .card-meta,
[data-theme="dark"] .card-meta-item,
[data-theme="dark"] .card-extra { color: #AEB4BA; }
[data-theme="dark"] .card-menu-btn,
[data-theme="dark"] .card-action:not(.primary):not([href^="tel:"]) {
  background: #232B31;
  border-color: #33404A;
  color: #CFE6DA;
}

/* Headings / brand accents that were deep green → lighter green for contrast */
[data-theme="dark"] .welcome h2,
[data-theme="dark"] .chat-brand h1,
[data-theme="dark"] .modal h2,
[data-theme="dark"] .example-title,
[data-theme="dark"] .settings-group-title,
[data-theme="dark"] .coach-tip-title,
[data-theme="dark"] .trending-head { color: #6FD3A6; }

/* Muted text */
[data-theme="dark"] .modal-subtitle,
[data-theme="dark"] .modal label,
[data-theme="dark"] .example-text,
[data-theme="dark"] .settings-row-desc,
[data-theme="dark"] .settings-guest-hint,
[data-theme="dark"] .composer-hint,
[data-theme="dark"] .coach-tip-body { color: #A9AFB5; }
[data-theme="dark"] .settings-row-title { color: #E7E2D7; }

/* Message bubbles */
[data-theme="dark"] .message-user .message-content {
  background: #17362A;
  border-color: #244433;
}
[data-theme="dark"] .message-content code {
  background: #232B31;
  color: #E7E2D7;
}

/* Inputs / selects / dropdowns */
[data-theme="dark"] .scope-select,
[data-theme="dark"] .ss-input,
[data-theme="dark"] .modal input,
[data-theme="dark"] .modal textarea,
[data-theme="dark"] .share-url-row input {
  background: #171D22;
  color: #E7E2D7;
  border-color: #3C464E;
}
[data-theme="dark"] .scope-select:disabled,
[data-theme="dark"] .ss-input:disabled { background: #1A1F23; color: #6B7178; }
[data-theme="dark"] .ss-option { color: #E7E2D7; }
[data-theme="dark"] .ss-option:hover,
[data-theme="dark"] .ss-option.active { background: #233A30; }
[data-theme="dark"] .ss-option.selected { color: #6FD3A6; }

/* Header controls */
[data-theme="dark"] .location-btn,
[data-theme="dark"] .scope-discovery-btn,
[data-theme="dark"] .example-card,
[data-theme="dark"] .trending-chip {
  background: #1B2226;
  border-color: #3C464E;
  color: #CFE6DA;
}
[data-theme="dark"] .example-card,
[data-theme="dark"] .trending-chip { color: #C9CDD2; }
[data-theme="dark"] .scope-discovery-gems { color: #E0BE72; }
[data-theme="dark"] .mode-tab { color: #A9AFB5; }
[data-theme="dark"] .mode-tab:hover { color: #CFE6DA; }
[data-theme="dark"] .topbar-settings-btn { color: #A9AFB5; border-color: #3C464E; }
[data-theme="dark"] .topbar-settings-btn:hover { color: #CFE6DA; }

/* Segmented control + switch on dark */
[data-theme="dark"] .seg-btn { color: #A9AFB5; }
[data-theme="dark"] .seg-btn.active { background: #2A333A; color: #6FD3A6; }
[data-theme="dark"] .switch { background: #3A444C; }
[data-theme="dark"] .switch.on { background: var(--green); }

/* Misc */
[data-theme="dark"] .modal-close { color: #9AA0A6; }
[data-theme="dark"] .char-counter { color: #8A9098; }
[data-theme="dark"] .composer-tool-btn { color: #8A9098; }
[data-theme="dark"] .composer-tool-btn:hover { background: #233A30; color: #CFE6DA; }
[data-theme="dark"] .cards-toggle {
  background: #1B2226;
  border-color: #303840;
  color: #CFE6DA;
}

/* ─── Press feedback (haptic feel) ──────────────────────────────────────────
   A quick scale-down on tap gives a tactile response on every device, pairing
   with navigator.vibrate() where the hardware supports it. */
.scope-discovery-btn:active,
.location-btn:active,
.topbar-settings-btn:active,
.seg-btn:active,
.switch:active,
.trending-chip:active,
.example-card:active,
.card-favorite-btn:active,
.card-menu-btn:active,
.new-chat-btn:active,
.mode-tab:active,
.modal-primary-btn:active,
.modal-secondary-btn:active,
#send-btn:active,
.saved-prompts-btn:active { transform: scale(0.94); }

/* Dark mode — feasibility study view (secondary mode) */
[data-theme="dark"] .feas-form-card,
[data-theme="dark"] .feas-stat-tile {
  background: #1E252A;
  border-color: #303840;
}
[data-theme="dark"] .feas-stat-tile.accent-green,
[data-theme="dark"] .feas-verdict-card {
  background: #17362A;
  border-color: #244433;
}
[data-theme="dark"] .feas-stat-tile.accent-amber { background: #2E2716; border-color: #4A3F23; }
[data-theme="dark"] .feas-stat-tile-value { color: #E7E2D7; }
[data-theme="dark"] .feas-form-field label,
[data-theme="dark"] .feas-stat-tile-label,
[data-theme="dark"] .feas-stat-tile-sub,
[data-theme="dark"] .feas-bar-label,
[data-theme="dark"] .feas-bar-count,
[data-theme="dark"] .feas-results-empty,
[data-theme="dark"] .feas-results-loading { color: #A9AFB5; }
[data-theme="dark"] .feas-form-field input[type="text"],
[data-theme="dark"] .feas-form-field select {
  background: #171D22;
  color: #E7E2D7;
  border-color: #3C464E;
}
[data-theme="dark"] .feas-form-field select:disabled { background: #1A1F23; color: #6B7178; }
[data-theme="dark"] .feas-bar-track { background: #2A333A; }
[data-theme="dark"] .feas-section-title,
[data-theme="dark"] .feas-verdict-label { color: #6FD3A6; }

/* Terms & Conditions link in the composer footer */
.composer-hint-link {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}
.composer-hint-link:hover { text-decoration: underline; }
.composer-hint-sep { opacity: 0.5; margin: 0 2px; }
[data-theme="dark"] .composer-hint-link { color: #6FD3A6; }

/* ─── Focused places (pin 1–2 places to scope the conversation) ───────────── */
.card-focus-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border-violet);
  border-radius: 7px;
  color: #0B5E3F;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s ease;
}
.card-focus-btn:hover { background: var(--green-soft); border-color: #9FD7BD; }
.card-focus-btn:active { transform: scale(0.97); }
.card-focus-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.card-focus-icon { font-size: 14px; line-height: 1; }

/* Chip tags at the bottom of the prompt box (ChatGPT-style) */
.focus-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 720px;
  margin: 6px auto 0;
  padding: 0 4px;
}
.focus-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px 4px 10px;
  background: var(--green-soft);
  border: 1px solid #C7E7D6;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #0B5E3F;
  max-width: 220px;
}
.focus-tag-icon { font-size: 12px; line-height: 1; }
.focus-tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-tag-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #0B5E3F;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  transition: background .15s;
}
.focus-tag-x:hover { background: #C7E7D6; }

.mk-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
}
.mk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Dark mode */
[data-theme="dark"] .card-focus-btn {
  background: #1B2226; border-color: #3C464E; color: #CFE6DA;
}
[data-theme="dark"] .card-focus-btn.active { background: var(--green); border-color: var(--green); color: #fff; }
[data-theme="dark"] .focus-tag { background: #17362A; border-color: #244433; color: #CFE6DA; }
[data-theme="dark"] .focus-tag-x { color: #CFE6DA; }
[data-theme="dark"] .focus-tag-x:hover { background: #244433; }
