@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&family=Sora:wght@500;600;700&family=Cairo:wght@400;600;700&display=swap');

:root {
  --tabsH: 54px;
  --font-ar: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f5f7ff;
  --logo-size: 66px;

  /* Glass surfaces */
  --panel: rgba(255, 255, 255, 0.78);
  --panel-2: rgba(237, 243, 255, 0.66);
  --text: #0c1322;
  --muted: #59657a;
  --border: rgba(226, 232, 245, 0.9);

  /* Brand palette (from logo) */
  --brand-cyan: #34d3c4;
  --brand-blue: #3b82f6;
  --brand-violet: #7c5cff;

  --primary: var(--brand-cyan);
  --primary-2: var(--brand-violet);
  --accent-gradient: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-blue) 46%, var(--brand-violet) 100%);
  --accent-gradient-2: linear-gradient(135deg, #27c7b8 0%, #2f76ef 46%, #6f4fff 100%);
  --accent-ring: rgba(52, 211, 196, 0.22);
  --danger: #d23f3f;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --shadow-1: 0 10px 26px rgba(16, 23, 36, 0.08);
  --shadow-2: 0 24px 60px rgba(16, 23, 36, 0.14);
  --surface: var(--panel);
  --surface-2: var(--panel-2);
  --card: var(--panel);
  --accent: var(--primary);
  --accent-2: var(--primary-2);
  --shadow: var(--shadow-2);
  --layout-bg: rgba(255, 255, 255, 0.55);
  --space-1: var(--s1);
  --space-2: var(--s2);
  --space-3: var(--s3);
  --space-4: var(--s4);
  --space-5: var(--s5);
  --space-6: var(--s6);
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Sora", "Avenir", "Futura", sans-serif;
  --vvh: 1vh;
}

body[data-theme="dark"] {
  --bg: #0a0f1a;
  --panel: #0f172a;
  --panel-2: #0b1324;
  --text: #eef2ff;
  --muted: #a7b2c8;
  --border: #24304a;

  --brand-cyan: #48e6d6;
  --brand-blue: #60a5fa;
  --brand-violet: #a78bfa;

  --primary: var(--brand-cyan);
  --primary-2: var(--brand-violet);
  --accent-gradient: linear-gradient(135deg, var(--brand-cyan) 0%, var(--brand-blue) 46%, var(--brand-violet) 100%);
  --accent-gradient-2: linear-gradient(135deg, #38daca 0%, #4f98f6 46%, #9a7cf8 100%);
  --accent-ring: rgba(72, 230, 214, 0.18);
  --danger: #f07a74;
  --shadow-1: 0 14px 30px rgba(0, 0, 0, 0.38);
  --shadow-2: 0 28px 70px rgba(0, 0, 0, 0.6);
  --layout-bg: rgba(11, 16, 24, 0.85);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html[dir="rtl"] body { font-family: var(--font-ar); }
html[dir="rtl"] .brandMark, html[dir="rtl"] .brandWord, html[dir="rtl"] .langBtn { font-family: var(--font-ar); }
body {
  margin: 0;
  font-family: var(--font-body);
  overflow-x: hidden;
  background:
    radial-gradient(900px 520px at 10% 8%, rgba(52, 211, 196, 0.18), transparent 60%),
    radial-gradient(700px 520px at 90% 18%, rgba(124, 92, 255, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 42%),
    var(--bg);
  color: var(--text);
}
body[data-theme="dark"] {
  background:
    radial-gradient(900px 520px at 10% 10%, rgba(72, 230, 214, 0.20), transparent 60%),
    radial-gradient(700px 520px at 90% 20%, rgba(167, 139, 250, 0.18), transparent 55%),
    var(--bg);
}

.view {
  min-height: calc(var(--vvh, 1vh) * 100);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
 * Minimal motion system (professional, subtle)
 * - Reveal on scroll: opacity + translate
 * - Respects prefers-reduced-motion + app "reduceMotion" toggle
 * -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition:
    opacity 260ms ease var(--reveal-delay, 0ms),
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-visible,
.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

body.reduceMotion .reveal {
  transition: none !important;
  transform: none !important;
  opacity: 1 !important;
}

/* Pre-JS view selection:
   - default to landing (guest)
   - if a session token exists, show chat immediately to avoid a landing flash
   JS will validate and either keep chat or clear token and reveal landing. */
#loginView.hidden { display: none; }
#chatView.hidden { display: none; }

html:not(.hasToken) #loginView.hidden { display: flex !important; }
html:not(.hasToken) #chatView { display: none !important; }

html.hasToken #loginView { display: none !important; }
html.hasToken #chatView.hidden { display: flex !important; }

.landing {
  align-items: stretch;
  justify-content: flex-start;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  overflow-y: auto;
}
.landing h1, .landing h2, .landing h3 {
  font-family: var(--font-head);
  letter-spacing: -0.6px;
}
.landing p { line-height: 1.6; }
.landing .sectionLead { font-size: 16px; }
.landing .siteHeader {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  box-shadow: none;
  direction: ltr;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.landing .siteHeader.scrolled {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: var(--border);
  box-shadow: 0 10px 28px rgba(16, 23, 36, 0.08);
}
body[data-theme="dark"] .landing .siteHeader {
  background: rgba(12, 17, 25, 0.9);
}
.siteBrand { display: flex; flex-direction: column; gap: 2px; }
.brandMark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 20px; letter-spacing: -0.4px; }
.brandHomeLink { text-decoration: none; color: inherit; }
.appHomeLink { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.brandWord {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.brandLogo {
  width: var(--logo-size);
  height: var(--logo-size);
  max-width: var(--logo-size);
  max-height: var(--logo-size);
  min-width: var(--logo-size);
  min-height: var(--logo-size);
  display: block;
  padding: 2px;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
  border: none;
}
.siteFooter .brandLogo {
  width: 30px;
  height: 30px;
  max-width: 30px;
  max-height: 30px;
  min-width: 30px;
  min-height: 30px;
  box-shadow: none;
}
.siteNav { display: flex; flex-wrap: wrap; gap: var(--space-3); }
html[dir="rtl"] .landing .siteNav { direction: rtl; }
html[dir="rtl"] .landing .siteNav .navLink { text-align: right; }
.navLink {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
}
.navLink:hover { color: var(--text); }
.siteActions { display: flex; gap: var(--space-2); align-items: center; }
.siteActions .btnSecondary {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
}
.langMenu {
  position: absolute;
  z-index: 120;
  min-width: 160px;
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: var(--space-2) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.langMenu.hidden {
  display: none;
}
.langMenuItem {
  background: transparent;
  border: none;
  padding: var(--space-2) var(--space-4);
  text-align: left;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.langMenuItem.active {
  font-weight: 700;
  color: var(--accent);
}
.langMenuItem:hover,
.langMenuItem:focus-visible {
  background: rgba(52, 211, 196, 0.08);
}
.siteMain { display: flex; flex-direction: column; gap: 0; }
.siteContainer { width: min(1140px, 92vw); margin: 0 auto; }
.siteSection { padding: calc(var(--space-6) * 1.4) 0; }
.siteSection, .authCard { scroll-margin-top: 90px; }
.sectionHeader { display: flex; flex-direction: column; gap: var(--space-2); }
.sectionEyebrow { text-transform: uppercase; letter-spacing: 0.6px; font-size: 12px; color: var(--muted); }
.sectionLead { color: var(--muted); max-width: 520px; font-size: 16px; }
.heroSection { padding-top: calc(var(--space-6) * 2.2); position: relative; overflow: hidden; }
.heroSection::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(560px 320px at 78% 10%, rgba(52, 211, 196, 0.20), transparent 70%);
  pointer-events: none;
}
.heroSection::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), transparent 55%);
  pointer-events: none;
}
.heroGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  align-items: center;
}
.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.heroCopy h1 { font-size: clamp(36px, 5vw, 56px); margin: var(--space-2) 0; letter-spacing: -1px; }
.heroLead { font-size: 18px; color: var(--muted); max-width: 520px; }
.heroBullets {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: grid;
  gap: var(--space-2);
  max-width: 540px;
}
.heroBullets li {
  position: relative;
  padding-left: 26px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.heroBullets li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 800;
}
html[dir="rtl"] .heroBullets li {
  padding-left: 0;
  padding-right: 26px;
}
html[dir="rtl"] .heroBullets li::before {
  left: auto;
  right: 0;
}
html[dir="rtl"] .heroCopy { text-align: start; }
.heroCtas { display: flex; gap: var(--space-3); margin: var(--space-4) 0; flex-wrap: wrap; }
html[dir="rtl"] .heroCtas { flex-direction: row-reverse; }
.heroTrust { font-size: 12px; color: var(--muted); }
.heroMedia { position: relative; display: flex; flex-direction: column; gap: var(--space-3); }
.heroMedia::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.16);
  right: -40px;
  top: -40px;
  filter: blur(2px);
  z-index: 0;
}
.heroMock {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(236, 243, 255, 0.96));
  border-radius: 20px;
  border: 1px solid rgba(52, 211, 196, 0.22);
  box-shadow: var(--shadow-2);
  padding: var(--space-4);
  position: relative;
  z-index: 1;
}
.mockHeader { font-weight: 700; margin-bottom: var(--space-2); }
.mockBubble {
  background: var(--surface-2);
  border-radius: 16px;
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}
.mockBubble.alt { background: rgba(124, 92, 255, 0.10); }
.floatingCards {
  display: grid;
  gap: var(--space-2);
}
.floatCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 14px;
  padding: var(--space-3);
  font-size: 13px;
  box-shadow: var(--shadow-1);
}
.proofStrip {
  background: transparent;
  border: none;
  padding: var(--space-4) 0;
}
.proofInner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.proofLine { font-weight: 600; }
.proofBadges { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.badge { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(16, 23, 36, 0.1); font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, 0.7); }

.whyMiniSection {
  padding-top: var(--space-5);
}
.whyGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.whyCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.whyCard h3 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-head);
}

.trustIntro {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}
.trustPlainCard {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(236, 243, 255, 0.92));
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.trustPlainTitle {
  font-weight: 800;
  margin-bottom: var(--space-2);
}
.trustPlainList {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
}
.goodNotGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.goodNotCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.goodNotTitle {
  font-weight: 800;
  margin-bottom: var(--space-2);
}
.goodNotCard ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.55;
}
.goodNotCard.goodFor {
  border-color: rgba(52, 211, 196, 0.26);
}
.goodNotCard.notFor {
  border-color: rgba(210, 63, 63, 0.18);
}
.stepsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.stepCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.wellbeingSection {
  padding-top: var(--space-5);
}
.wellbeingGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.wellbeingCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.wellbeingCard h3 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-head);
}
.wellbeingCard p {
  margin: 0;
  color: var(--muted);
}
.wellbeingFooter {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wellbeingSource a {
  color: var(--accent);
  text-decoration: none;
}
.wellbeingSource a:hover {
  text-decoration: underline;
}
.stepNum { font-weight: 700; color: var(--accent); margin-bottom: var(--space-2); }
.stepMeta { font-size: 12px; color: var(--muted); margin-top: var(--space-2); }
.ctaBand {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(52, 211, 196, 0.16), rgba(124, 92, 255, 0.10));
  border: 1px solid rgba(124, 92, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.splitSection .splitGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
  align-items: start;
}
.featuresLayout {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.featureGroupsRow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.plansIntro { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-2); }
.plansTitle {
  font-family: var(--font-head);
  font-weight: 900;
  letter-spacing: -0.2px;
}
.plansRow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.featureList { display: grid; gap: var(--space-4); margin-top: var(--space-3); }
.featureGroup {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.featureGroupTitle {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-3);
  font-weight: 700;
}
.featureGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.featureItem {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 16px;
  padding: var(--space-3);
  box-shadow: 0 10px 28px rgba(16, 23, 36, 0.06);
}
.featureItemHeader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.featureItem h4 { margin: 0; }
.featureItem p { margin: 0; color: var(--muted); }
.featureIcon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(52, 211, 196, 0.22), rgba(59, 130, 246, 0.16));
  border: 1px solid rgba(52, 211, 196, 0.22);
  box-shadow: 0 12px 24px rgba(52, 211, 196, 0.10);
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
}
.featureIcon::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 30% 30%, rgba(124, 92, 255, 0.22), transparent 60%);
  transform: rotate(12deg);
}
.featureItem:nth-child(2) .featureIcon { background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(59, 130, 246, 0.16)); border-color: rgba(124, 92, 255, 0.20); }
.featureItem:nth-child(3) .featureIcon { background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(52, 211, 196, 0.16)); border-color: rgba(59, 130, 246, 0.20); }
.featureItem:nth-child(4) .featureIcon { background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(124, 92, 255, 0.14)); border-color: rgba(245, 158, 11, 0.18); }
.featureItem:hover { border-color: rgba(52, 211, 196, 0.28); transform: translateY(-1px); transition: transform 140ms ease, border-color 140ms ease; }
.splitVisual { display: flex; align-items: flex-start; }
.visualCard {
  width: 100%;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 20px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.visualCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px 260px at 18% 0%, rgba(52, 211, 196, 0.18), transparent 55%);
  pointer-events: none;
}
.visualCard::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px 260px at 88% 20%, rgba(59, 130, 246, 0.14), transparent 55%);
  pointer-events: none;
}
.visualKicker {
  position: relative;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.visualContext {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 23, 36, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.visualTitle { position: relative; z-index: 1; font-weight: 800; margin-bottom: var(--space-3); }
.visualSteps { position: relative; z-index: 1; display: grid; gap: var(--space-2); }
.visualStep {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 600;
}
.visualHint { position: relative; z-index: 1; font-size: 12px; color: var(--muted); margin-top: var(--space-3); }
.useGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.useCard {
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 999px;
  padding: var(--space-3) var(--space-4);
  background: var(--card);
  text-align: center;
  box-shadow: var(--shadow-1);
}
.trustSection .accordion { margin-top: var(--space-3); }
.accordion details {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 16px;
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-1);
}
.accordion summary { cursor: pointer; font-weight: 600; }
.trustLink {
  display: block;
  margin-top: var(--space-2);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.trustLink:hover { text-decoration: underline; }
.pricingGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.pricingCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 20px;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.pricingCard.highlight { border-color: rgba(124, 92, 255, 0.35); box-shadow: var(--shadow-2); }
.priceTag { font-size: 11px; text-transform: uppercase; color: var(--accent); }
.priceRibbon {
  position: absolute;
  top: 14px;
  right: -52px;
  transform: rotate(35deg);
  padding: 8px 64px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  box-shadow: 0 14px 28px rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.priceRibbon::before,
.priceRibbon::after {
  content: "";
  position: absolute;
  top: 100%;
  border-style: solid;
  border-width: 8px 8px 0 8px;
  border-color: rgba(16, 23, 36, 0.16) transparent transparent transparent;
  filter: blur(0.2px);
}
.priceRibbon::before { left: 14px; }
.priceRibbon::after { right: 14px; }
.priceName { font-weight: 700; font-size: 16px; }
.priceValue { font-size: 22px; font-weight: 700; }
.priceDesc { margin-top: 6px; font-size: 13px; }
.priceList { margin: 0; padding-left: 16px; color: var(--muted); }
.priceList li { margin-bottom: var(--space-1); }
.pricingPerks {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.pricingPerks .perk {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(16, 23, 36, 0.1);
  background: rgba(255, 255, 255, 0.6);
}
.authSection .authGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.authCard {
  background: var(--card);
  border: 1px solid rgba(16, 23, 36, 0.08);
  border-radius: 18px;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-1);
}
.authTrust { margin-top: var(--space-3); color: var(--muted); }
.siteFooter {
  border-top: 1px solid var(--border);
  padding: var(--space-5) 0 var(--space-4);
  background: var(--surface-2);
}
.footerInner { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.footerLinks { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.footerLinks a { color: var(--muted); text-decoration: none; font-size: 13px; }
.footerLinks a:hover { color: var(--text); }
.emergencyLine {
  margin-top: var(--space-3);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Admin console */
.adminLayout {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.adminSidebar {
  position: sticky;
  top: 98px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-2);
  box-shadow: var(--shadow-1);
}
.adminNavBtn {
  display: inline-flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  min-height: 40px;
  text-align: left;
  justify-content: flex-start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
}
.adminNavLink {
  text-decoration: none;
}
.adminNavBtn.active {
  background: rgba(52, 211, 196, 0.12);
  border-color: rgba(52, 211, 196, 0.28);
  color: var(--text);
}
.adminContent {
  min-width: 0;
}
.adminPanel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.adminPanelHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(226, 232, 245, 0.9);
}
.adminPanelHeaderActions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.adminPanelHeader h2 {
  margin: 0;
}
.adminPanelHeader p {
  margin: 6px 0 0;
}
.adminCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.adminCard h3 {
  margin: 0 0 var(--space-3);
}
.adminGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.adminGrid label {
  margin: 0;
}
.adminGrid label span {
  color: var(--muted);
  font-size: 12px;
}
.adminGridWide {
  grid-column: 1 / -1;
}
.adminActions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.adminMsg {
  margin-top: var(--space-3);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid transparent;
}
.adminMsg.ok {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}
.adminMsg.error {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.24);
}
.adminTableHead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.adminSearch {
  margin: 0;
  min-width: 240px;
}
.adminSearch span {
  color: var(--muted);
  font-size: 12px;
}
.adminTableWrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 245, 0.9);
}
.adminTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
.adminTable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}
.adminTable tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.55);
}
.adminTable tbody tr:hover td {
  background: rgba(52, 211, 196, 0.08);
}
.adminTable th,
.adminTable td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(16, 23, 36, 0.1);
  vertical-align: top;
}
.adminTable th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
}
.adminTableEmpty {
  text-align: center;
  color: var(--muted);
  padding: 14px 8px;
}
.adminRowActions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.adminRowActions .btnSecondary {
  padding: 8px 10px;
  min-height: 34px;
  border-radius: 12px;
}
#plansPanel .adminTable th:nth-child(2),
#plansPanel .adminTable td:nth-child(2),
#plansPanel .adminTable th:nth-child(3),
#plansPanel .adminTable td:nth-child(3) {
  text-align: right;
}
.adminInlineJson {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  max-width: 580px;
}
#createSettingValue,
#editSettingValue {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}
.entityModalCard {
  width: min(620px, 94vw);
}
.entityGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.entityGrid label {
  margin: 0;
}
.entityGrid label span {
  color: var(--muted);
  font-size: 12px;
}
.entityGridSingle {
  grid-template-columns: 1fr;
}

/* Admin console (chat-style shell). */
.layout.adminChatLayout {
  /* Admin has no right rail; avoid leaving an empty 3rd column. */
  grid-template-columns: 280px minmax(0, 1fr);
}
body.sidebar-collapsed .layout.adminChatLayout {
  grid-template-columns: 0 minmax(0, 1fr);
}
.adminMenuBtn {
  width: 100%;
  justify-content: flex-start;
  position: relative;
  border-style: solid;
  padding-left: 22px;
}
.adminMenuBtn.active {
  padding-left: 30px;
}
html[dir="rtl"] .adminMenuBtn {
  padding-left: var(--space-4);
  padding-right: 22px;
}
html[dir="rtl"] .adminMenuBtn.active {
  padding-right: 30px;
}
.adminMenuBtn.active {
  background: rgba(52, 211, 196, 0.12);
  border-style: solid;
  border-color: rgba(52, 211, 196, 0.28);
  color: var(--text);
}
.adminMenuBtn.active::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: var(--accent-gradient);
}
html[dir="rtl"] .adminMenuBtn.active::before {
  left: auto;
  right: 10px;
}
.adminMessages {
  /* Keep admin panels readable inside the messages scroller. */
  align-items: stretch;
  background: transparent;
}
.adminChatMain .messages {
  max-width: 1160px;
}

@media (max-width: 980px) {
  .adminLayout {
    grid-template-columns: 1fr;
  }
  .adminSidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .adminGrid {
    grid-template-columns: 1fr;
  }
  .adminNavBtn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    text-align: center;
  }
  .entityGrid {
    grid-template-columns: 1fr;
  }
}

body.modalOpen { overflow: hidden; }
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

/* Animate modals without changing existing JS (which toggles .hidden).
   We override .modal.hidden (normally display:none) to keep the fixed overlay
   in the DOM and animate opacity/transform. */
.modal.hidden {
  display: flex !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.modal:not(.hidden) {
  visibility: visible;
  opacity: 1;
}

.modalOverlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 22, 0.58);
  opacity: 1;
  transition: opacity 180ms ease;
}
.modal.hidden .modalOverlay { opacity: 0; }

.modalCard {
  position: relative;
  width: min(420px, 92vw);
  /* Make modals readable: solid surface (not glass). */
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 245, 0.95);
  border-radius: 22px;
  padding: var(--space-5);
  box-shadow: var(--shadow-2);
  z-index: 1;

  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 200ms ease, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.hidden .modalCard {
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(0.985);
}

@media (prefers-reduced-motion: reduce) {
  .modalOverlay,
  .modalCard {
    transition: none !important;
  }
}

body.reduceMotion .modalOverlay,
body.reduceMotion .modalCard {
  transition: none !important;
}
.closeBtn { position: absolute; top: var(--space-3); right: var(--space-3); }
.inputRow { display: flex; gap: var(--space-2); align-items: center; }
.inputRow input { flex: 1; }
#togglePassword.iconBtn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
}
#togglePassword .eyeIcon { display: block; }
#togglePassword .hidden { display: none; }
.authMeta { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.ssoRow { display: grid; gap: var(--space-2); }
.modalActions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-3); }
.modal textarea { resize: vertical; }
.landing .btnSecondary { border: 1px solid var(--border); background: transparent; }
.landing .btnSecondary:disabled { opacity: 0.6; cursor: not-allowed; }
.landing .btnPrimary { background: var(--accent-gradient); color: #fff; border: 1px solid transparent; box-shadow: 0 10px 24px rgba(59, 130, 246, 0.18); }
.landing .btnPrimary:hover { background: var(--accent-gradient-2); }

@media (max-width: 1000px) {
  .heroGrid, .splitSection .splitGrid { grid-template-columns: 1fr; }
  .whyGrid { grid-template-columns: 1fr; }
  .goodNotGrid { grid-template-columns: 1fr; }
  .stepsGrid, .pricingGrid, .authSection .authGrid, .useGrid { grid-template-columns: 1fr; }
  .featureGrid { grid-template-columns: 1fr; }
  .featureGroupsRow { grid-template-columns: 1fr; }
  .plansRow { grid-template-columns: 1fr; }
  .siteNav { display: none; }
}

/* Mobile spacing: avoid sections feeling like full-screen panels */
@media (max-width: 520px) {
  .siteHeader { padding: var(--space-2) var(--space-4); }
  .landing .siteHeader { gap: var(--space-2); }
  .siteBrand { flex-direction: row; align-items: center; }
  .brandMark { font-size: 18px; gap: 8px; }

  /* Keep the top bar compact on mobile. */
  .landing .siteActions { gap: var(--space-2); }
  .landing .siteActions .btnPrimary,
  .landing .siteActions .btnSecondary {
    padding: 8px 12px;
    min-height: 36px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1;
  }
  .landing .siteActions .iconBtn {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .siteSection { padding: calc(var(--space-6) * 1.0) 0; }
  .heroSection { padding-top: calc(var(--space-6) * 1.5); }
  .heroGrid { gap: var(--space-4); }
  .heroMock { padding: var(--space-3); }
  .mockBubble { padding: var(--space-2) var(--space-3); }
  .floatCard { padding: var(--space-2) var(--space-3); }
  .proofStrip { padding: var(--space-3) 0; }
}

/* RTL typography tweaks */
html[dir="rtl"] .sectionEyebrow,
html[dir="rtl"] .eyebrow {
  text-transform: none;
  letter-spacing: 0;
}

.chatRoot {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.card {
  width: 420px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}
.card h1 {
  margin: 0 0 var(--space-2) 0;
  font-family: var(--font-head);
  font-size: 28px;
}

label { display: block; margin: var(--space-4) 0 0 0; color: var(--muted); font-size: 12px; }

/* Tighter auth modal spacing (login/signup). */
.modalCard label { margin-top: var(--space-2); }
.modalCard input, .modalCard select, .modalCard textarea { margin-top: var(--space-1); }
/* Remove reserved error space inside the modal (was creating big vertical gaps). */
.modalCard .fieldError { min-height: 0; margin-top: 4px; }
.modalCard .tiny { margin-top: 4px; }

input, select, textarea {
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font: inherit;
}
input, select { min-height: 40px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.row { display: flex; align-items: center; gap: var(--space-2); }
.row input { width: auto; margin: 0; }
.row.hidden { display: none; }

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-body);
  min-height: 40px;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.btnPrimary, .btnSecondary, .btnGhost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  min-height: 40px;
}
.btnPrimary:focus-visible,
.btnSecondary:focus-visible,
.btnGhost:focus-visible,
.linkBtn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}
.btnPrimary { background: var(--accent-gradient); color: #fff; border: 1px solid transparent; }
.btnPrimary:hover { background: var(--accent-gradient-2); }
.btnSecondary { background: transparent; border: 1px solid var(--border); }
.btnSecondary:hover { border-color: rgba(20, 32, 46, 0.3); }
.btnGhost { background: transparent; border: 1px dashed var(--border); color: var(--muted); }
.btnGhost:hover { border-color: rgba(20, 32, 46, 0.3); color: var(--text); }
.btnGhost.danger { color: var(--danger); border-color: rgba(198, 40, 40, 0.4); }
.linkBtn {
  background: none;
  border: none;
  padding: 0;
  min-height: auto;
  color: var(--accent);
  font-weight: 600;
}
.linkBtn:hover { text-decoration: underline; }
.termsLink {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.termsLink:hover { text-decoration: underline; }
.fieldError {
  color: var(--danger);
  font-size: 12px;
  margin-top: var(--space-1);
  min-height: 16px;
}

.iconBtn { padding: 10px 12px; min-width: 44px; min-height: 44px; font-size: 18px; line-height: 1; }
.iconBtn.active { background: var(--accent); color: #fff; border: 1px solid transparent; }
.langBtn {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(226, 232, 245, 0.95);
}
.landing .siteActions .langBtn { background: rgba(255, 255, 255, 0.6); }
.langBtn:hover { border-color: rgba(124, 92, 255, 0.25); }
#insightsBtn { display: none; }
.error { color: var(--danger); font-size: 12px; margin: var(--space-2) 0 0 0; min-height: 18px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.whoami { font-weight: 800; font-size: 14px; letter-spacing: -0.2px; }

.guest-only {
  display: inline-flex;
}
.auth-only {
  display: none;
}
body.session-active .guest-only {
  display: none;
}
body.session-active .auth-only {
  display: inline-flex;
}
.welcomeText {
  margin-right: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  align-self: center;
}

.appShell {
  width: 100vw;
  height: calc(var(--vvh, 1vh) * 100);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: var(--layout-bg);
  backdrop-filter: blur(8px);
  box-shadow: none;
  position: relative;
}

.appNav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-4);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
html[dir="rtl"] .appNav {
  border-right: 0;
  border-left: 1px solid var(--border);
}
.appNavHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(226, 232, 245, 0.9);
}
.appNavBrand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.appNavName {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.2px;
}
.navCloseBtn { display: none; }
.appNavUser {
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(226, 232, 245, 0.9);
  margin-bottom: var(--space-3);
}
.navCredits { margin-top: var(--space-2); opacity: 0.9; }
.appNavPrimary,
.appNavSecondary {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.appNavSecondary {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(226, 232, 245, 0.9);
}
.navItem {
  width: 100%;
  text-align: start;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.navItem:hover { background: rgba(52, 211, 196, 0.08); border-color: rgba(52, 211, 196, 0.25); }
.navItem:active { transform: translateY(1px); }
.navItem.active { background: rgba(52, 211, 196, 0.12); border-color: rgba(52, 211, 196, 0.35); }
.navItem.danger { color: var(--danger); }
.navItem.danger:hover { background: rgba(198, 40, 40, 0.08); border-color: rgba(198, 40, 40, 0.25); }
.navItem:focus-visible { outline: 2px solid rgba(52, 211, 196, 0.35); outline-offset: 2px; }

.panelHost {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}
.panel {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
}
.panelTitle {
  margin: 0;
  font-family: var(--font-head);
  font-size: 16px;
}
.panelBody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--space-4);
  background: var(--surface-2);
}
.sessionsPanelList {
  padding-right: 0;
}

.toolsCatalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.toolCatalogCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toolCatalogTitle { font-weight: 800; font-size: 15px; }
.toolCatalogDesc { color: var(--muted); font-size: 13px; line-height: 1.4; }
.toolCatalogActions { display: flex; gap: var(--space-2); margin-top: var(--space-2); flex-wrap: wrap; }

.insightsBody {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.profileRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-3);
}

.settingsSection { margin-top: var(--space-4); }
.settingsSection .sectionTitle { margin-bottom: var(--space-2); }

.upgradeGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.upgradeCard {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-3);
  background: rgba(255, 255, 255, 0.7);
}
.upgradeName { font-weight: 900; }

.memoryChip {
  margin-left: auto;
  border-color: rgba(226, 232, 245, 0.95);
  background: rgba(255, 255, 255, 0.72);
}

.layout {
  width: 100vw;
  height: calc(var(--vvh, 1vh) * 100);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: var(--layout-bg);
  backdrop-filter: blur(8px);
  box-shadow: none;
  position: relative;
}

body.sidebar-collapsed .layout {
  grid-template-columns: 0 minmax(0, 1fr) 320px;
}

body.sidebar-collapsed .railLeft {
  width: 0;
  padding: 0;
  transform: translateX(-120%);
  pointer-events: none;
  opacity: 0;
}

.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  overflow: hidden;
  backdrop-filter: blur(14px);
}
.railRight {
  border-right: none;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  backdrop-filter: blur(14px);
}
.railHeader { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.railHeader {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(226, 232, 245, 0.9);
}
.railSection { margin-bottom: var(--space-4); }
.sectionTitle { font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: var(--space-2); }
.sessions { overflow: auto; padding-right: var(--space-2); flex: 1; }
.sessionsSubhead {
  margin: var(--space-3) 0 var(--space-2) 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  opacity: 0.9;
}
.sessionsSubhead:first-child { margin-top: 0; }
#sessionSearch {
  margin-top: var(--space-2);
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(226, 232, 245, 0.95);
}
#sessionSearch::placeholder { color: rgba(89, 101, 122, 0.9); }
.railHint {
  margin-top: var(--space-2);
  line-height: 1.4;
}
.sessionItem { padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--space-2); background: var(--card); }
.sessionItem {
  box-shadow: 0 6px 18px rgba(16, 23, 36, 0.05);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.sessionItem:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.22);
}
.sessionItem.active { border-color: rgba(52, 211, 196, 0.55); }
.sessionItem.active {
  background: linear-gradient(160deg, rgba(52, 211, 196, 0.12), rgba(255, 255, 255, 0.75));
}
.sessionRow { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.sessionMain { min-width: 0; flex: 1; cursor: pointer; }
.sessionMain:focus { outline: 2px solid rgba(52, 211, 196, 0.35); outline-offset: 2px; border-radius: 8px; }
.sessionTitle { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.sessionTitle span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pinBadge { font-size: 12px; color: var(--accent); }
.sessionPreview { font-size: 12px; color: var(--muted); margin-top: var(--space-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sessionMeta { font-size: 11px; color: var(--muted); margin-top: var(--space-1); }
.sessionActions { display: flex; gap: var(--space-2); opacity: 0; pointer-events: none; transition: opacity 0.15s ease; }
.sessionItem:hover .sessionActions,
.sessionItem:focus-within .sessionActions { opacity: 1; pointer-events: auto; }
.sessionRename, .sessionDelete, .sessionPin {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 6px 8px;
  min-width: 36px;
  min-height: 36px;
}
.sessionRename:hover, .sessionDelete:hover, .sessionPin:hover { color: var(--text); border-color: rgba(20, 32, 46, 0.3); }
.sessionEmptyCta { margin-top: var(--space-2); }

.sessionItem.skeleton {
  background: var(--surface-2);
  border-style: dashed;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.skeletonBar, .skeletonLine {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(20, 32, 46, 0.08), rgba(20, 32, 46, 0.18), rgba(20, 32, 46, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
.skeletonBar { height: 14px; width: 60%; }
.skeletonLine { width: 90%; }
.skeletonLine.short { width: 50%; }

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.toolQuick {
  width: 100%;
  text-align: left;
  margin-bottom: var(--space-2);
  border-style: solid;
  border-color: rgba(226, 232, 245, 0.95);
  background: rgba(255, 255, 255, 0.7);
}
.toolQuick:hover,
.toolQuick:focus-visible {
  border-color: rgba(52, 211, 196, 0.45);
  background: rgba(255, 255, 255, 0.85);
}
.toolQuick:active {
  transform: translateY(1px);
}

.chat { display: flex; flex-direction: column; background: var(--surface); position: relative; z-index: 10; overflow: hidden; min-height: 0; align-items: center; backdrop-filter: blur(14px); }
.chatHeader {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.chatHeader.isScrolled {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(16, 23, 36, 0.08);
  border-bottom-color: rgba(226, 232, 245, 0.95);
}
body[data-theme="dark"] .chatHeader {
  background: rgba(15, 23, 31, 0.92);
}
.chatHeaderInner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%; }
.headerLeft { display: flex; align-items: center; gap: var(--space-2); min-width: 0; flex: 1; }
.headerActions { display: flex; align-items: center; gap: var(--space-2); }
#menuBtn {
  border-color: transparent;
  display: none;
}
body.sidebar-collapsed #menuBtn {
  border-color: var(--accent);
  color: var(--accent);
}
.sessionActionsGroup {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  position: relative;
}
.sessionActionBtn {
  border-width: 1px;
  border-style: solid;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.sessionActionBtn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 246, 255, 0.7);
}
.sessionActionsMenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  min-width: 180px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  padding: var(--space-2) 0;
}
.sessionActionsMenu.hidden {
  display: none;
}
.sessionActionsMenuItem {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  text-align: left;
  font-size: 14px;
  width: 100%;
  cursor: pointer;
}
.sessionActionsMenuItem:hover,
.sessionActionsMenuItem:focus-visible {
  background: rgba(52, 211, 196, 0.1);
}
.sessionActionsMenuBtn {
  display: none;
}
.appLogo {
  width: var(--logo-size);
  height: var(--logo-size);
  max-width: var(--logo-size);
  max-height: var(--logo-size);
  min-width: var(--logo-size);
  min-height: var(--logo-size);
  display: block;
  border-radius: 8px;
  object-fit: contain;
  background: transparent;
  border: none;
}
.headerTitle { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.titleRow { display: flex; align-items: baseline; gap: var(--space-2); }
.sessionTitleHeader { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subRow { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-2); }
.tokenCounters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  min-width: 150px;
}

.tokenBar {
  width: 150px;
  max-width: 48vw;
  height: 6px;
  border-radius: 999px;
  background: rgba(20, 32, 46, 0.12);
  overflow: hidden;
}

.tokenBarFill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
}
.tokenBarLabel { font-size: 12px; line-height: 1; }

.modalFooter {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.modalTokenCounters {
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
}
.modalTokenCounters .tokenBar { width: 100%; max-width: 100%; }

#sessionId {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}
.sessionIdCopy {
  cursor: pointer;
  user-select: none;
}
.sessionIdCopy:hover { opacity: 1; color: rgba(20, 32, 46, 0.92); }
.sessionIdCopy:focus-visible {
  outline: 2px solid rgba(52, 211, 196, 0.38);
  outline-offset: 3px;
  border-radius: 10px;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--surface-2);
  position: relative;
  width: 100%;
}
.messages.adminMessages {
  background: transparent;
  padding: var(--space-5);
  gap: var(--space-4);
  align-items: stretch;
}
.messages.checkinOnly {
  justify-content: center;
  align-items: center;
}
.msg {
  max-width: 70ch;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  line-height: 1.6;
  align-self: flex-start; /* default: left aligned */
}
.msgBody {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msgBody a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.msgBody a:hover { text-decoration: underline; }

body[data-chat-align="right"] .msg {
  align-self: flex-end;
  text-align: right;
}

.msg.user { background: rgba(52, 211, 196, 0.12); border-color: rgba(52, 211, 196, 0.32); }
.msg.assistant {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(226, 232, 245, 0.95);
}
.msg.typing { opacity: 0.7; font-style: italic; }
.msg[data-kind="checkin"] {
  align-self: center;
  text-align: center;
  border-color: rgba(52, 211, 196, 0.55);
  background: rgba(52, 211, 196, 0.08);
}
.msg[data-kind="system"] {
  align-self: center;
  text-align: center;
  max-width: 72ch;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(226, 232, 245, 0.95);
  color: rgba(20, 32, 46, 0.86);
}
.msg[data-kind="system"] .msgActions { opacity: 1; justify-content: center; }
.msgTime {
  margin-top: var(--space-1);
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.msg:hover .msgTime { opacity: 1; }
.msgActions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: var(--space-2);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.msg:hover .msgActions,
.msg:focus-within .msgActions { opacity: 1; }
.msgActionBtn {
  border: 1px solid rgba(20, 32, 46, 0.14);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(20, 32, 46, 0.78);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.msgActionBtn:hover { border-color: rgba(20, 32, 46, 0.26); color: var(--text); }
.msgActionBtn:focus-visible { outline: 2px solid rgba(52, 211, 196, 0.35); outline-offset: 2px; }
.msgActionBtn.iconOnly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}
.msgActionIcon { display: block; }
.typingDots { margin-left: 6px; animation: blink 1.2s infinite; }
@keyframes blink { 0% { opacity: 0.2; } 50% { opacity: 1; } 100% { opacity: 0.2; } }

.toolCard .toolCardBody, .checkinCard .checkinBody {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.checkinShell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-4);
  min-height: 100%;
}
.checkinHero {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(640px, 100%);
  text-align: center;
  align-items: center;
}
.checkinHeroTitle {
  font-family: var(--font-head);
  font-size: 26px;
}
.checkinHeroHint { color: var(--muted); font-size: 13px; }
.checkinCard {
  width: min(560px, 100%);
  text-align: left;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-1);
}
.toolCardTitle, .checkinTitle { font-weight: 700; font-size: 16px; }
.toolCardDesc { color: var(--muted); font-size: 13px; }
.toolCardActions { display: flex; gap: var(--space-2); }

.choiceButtons { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.btnChoice {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
}
.btnChoice:hover { border-color: rgba(20, 20, 20, 0.22); }
.btnChoice:disabled { opacity: 0.6; cursor: default; }

.toolStepLabel { font-weight: 600; font-size: 14px; }
.toolStepMeta { margin-top: -4px; }
.toolStepInput {
  resize: vertical;
  min-height: 70px;
}

.checkinScale { display: flex; gap: var(--space-2); }
.checkinScaleWrap { display: flex; flex-direction: column; gap: var(--space-2); }
.checkinScaleLabel { font-size: 12px; color: var(--muted); }
.checkinScale .btnGhost.active { border-color: var(--primary); color: var(--text); background: rgba(52, 211, 196, 0.12); }
.checkinChips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  min-height: 28px;
}
.chip.active { border-color: var(--primary); color: var(--text); background: rgba(52, 211, 196, 0.12); }
.checkinNote { resize: none; }
.checkinOther { margin-top: var(--space-1); }
.checkinHelper.hidden { display: none; }
.chip.mini { font-size: 11px; padding: 4px 8px; background: var(--surface-2); }
.checkinMiniRow { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.checkinMiniScore { font-weight: 700; }
.checkinMiniChips { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.checkinMiniNote { color: var(--muted); font-size: 12px; margin-top: var(--space-2); }

.jumpToLatest {
  position: absolute;
  right: var(--space-4);
  bottom: calc(64px + var(--space-4));
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px);
  font-size: 20px;
  line-height: 1;
  z-index: 20;
}
.jumpToLatest.hidden { display: none; }

.scrollTopBtn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(10px);
  font-size: 20px;
  line-height: 1;
  z-index: 90;
}
.scrollTopBtn.hidden { display: none; }

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "hint hint"
    "offline offline"
    "input send";
  gap: var(--space-3);
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
  width: 100%;
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
}
.composerHint {
  display: none;
  grid-area: hint;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.offlineBanner {
  grid-area: offline;
  border: 1px solid rgba(198, 40, 40, 0.26);
  background: rgba(198, 40, 40, 0.08);
  color: rgba(126, 24, 24, 0.95);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.35;
}

#sendBtn.sending {
  position: relative;
  padding-right: 44px;
  opacity: 0.92;
}
#sendBtn.sending::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-50%);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { from { transform: translateY(-50%) rotate(0deg); } to { transform: translateY(-50%) rotate(360deg); } }
.composer textarea {
  grid-area: input;
  margin: 0;
  min-width: 0;
  line-height: 1.35;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  min-height: 44px;
  max-height: 170px;
  overflow-y: auto;
}
#sendBtn {
  grid-area: send;
  align-self: end;
  min-height: 44px;
  white-space: nowrap;
}
@media (min-width: 901px) {
  .composerHint { display: block; }
}

.contextCard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.contextValue { font-weight: 700; margin-top: var(--space-2); }
.contextHint { color: var(--muted); font-size: 12px; margin-top: var(--space-2); }
#enableMemoryBtn { margin-top: var(--space-2); }

.toastHost { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: var(--space-2); }
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(198, 40, 40, 0.5); }

/* Modal system (final override)
   - Scrolls on small screens
   - Uses visual viewport height via --vvh
*/
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 300;
}
/* Ensure our generic `.hidden` class also hides modals (override `.modal { display: flex }`). */
.modal.hidden { display: none; }
.modalOverlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 22, 0.58);
}
.modalCard {
  position: relative;
  width: min(420px, 92vw);
  max-height: calc(var(--vvh, 1vh) * 100 - var(--space-4) - var(--space-4));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  /* Make modals readable: solid surface (not glass). */
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 245, 0.95);
  border-radius: 22px;
  padding: var(--space-5);
  box-shadow: var(--shadow-2);
  z-index: 1;
  text-align: left;
}
.modalCard h2 { margin: 0 0 var(--space-2) 0; font-family: var(--font-head); }

@media (max-width: 480px) {
  /* Keep modals as popups (not full-screen) on mobile too. */
  .modal { padding: var(--space-4); align-items: center; }
  .modalCard {
    width: min(420px, 92vw);
    max-width: 92vw;
    max-height: calc(var(--vvh, 1vh) * 100 - var(--space-4) - var(--space-4));
    border-radius: 22px;
    padding: var(--space-4);
  }
  .closeBtn { top: 10px; right: 10px; }
}

/* Chat header: mobile + RTL tweaks */
@media (max-width: 520px) {
  .chatHeader { padding: 10px 12px; }
  .chatHeaderInner { gap: var(--space-2); }
  .appLogo { display: none; }

  .sessionTitleHeader { max-width: 58vw; }
  #sessionId { display: none; }
  .subRow { justify-content: flex-start; margin-top: 6px; }
  html[dir="rtl"] .subRow { justify-content: flex-end; }

  .tokenCounters {
    min-width: 0;
    max-width: 76vw;
    padding: 6px 10px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .tokenBar {
    display: block;
    width: 90px;
    max-width: 32vw;
    height: 5px;
  }
  .tokenBarLabel {
    font-size: 11px;
    white-space: nowrap;
  }

  .langBtn { min-width: 34px; min-height: 34px; font-size: 17px; }
  .iconBtn { min-width: 40px; min-height: 40px; }
}

.overlay { position: fixed; inset: 0; background: rgba(20, 32, 46, 0.4); z-index: 140; }

.mobileTabs {
  display: none;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-2);
  gap: var(--space-2);
  justify-content: space-around;
}
.tabBtn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.tabBtn.active { border-color: var(--accent); color: var(--text); }

body.hideProgress #progressSummary,
body.hideProgress #themeSummary {
  display: none;
}

@media (max-width: 900px) {
  body.keyboardOpen { --tabsH: 0px; }
  body.keyboardOpen .mobileTabs { display: none; }

  #menuBtn { display: inline-flex; }

  /* Stack layout + bottom tabs vertically for the chat view. */
  #chatView.view {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    flex-direction: column;
    height: calc(var(--vvh, 1vh) * 100);
    min-height: 0;
    overflow: hidden;
  }

  .appShell {
    width: 100%;
    height: calc(var(--vvh, 1vh) * 100 - var(--tabsH, 54px));
    min-height: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .navCloseBtn { display: inline-flex; }
  .appNav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--tabsH, 54px);
    width: 92vw;
    max-width: 360px;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    z-index: 160;
    box-shadow: var(--shadow-2);
  }
  body.navOpen .appNav { transform: translateX(0); }
  html[dir="rtl"] .appNav {
    left: auto;
    right: 0;
    transform: translateX(110%);
  }
  html[dir="rtl"] body.navOpen .appNav { transform: translateX(0); }

  body.reduceMotion .appNav { transition: none !important; }

  .mobileTabs {
    display: flex;
    flex: 0 0 var(--tabsH, 54px);
    height: var(--tabsH, 54px);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: center;
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    z-index: 90;
  }
  .mobileTabs { overflow-x: auto; }
  .tabBtn { min-width: 92px; flex: 0 0 auto; }
  .overlay { left: 0; right: 0; top: 0; bottom: var(--tabsH, 54px); }
  .jumpToLatest { bottom: calc(var(--tabsH, 54px) + 64px); }
  .sessionActionsGroup .sessionActionBtn {
    display: none;
  }
  .sessionActionsMenuBtn {
    display: inline-flex;
  }
  .sessionActionsMenu {
    top: calc(100% + 10px);
    right: 0;
  }

  .toolsCatalog { grid-template-columns: 1fr; }
  .insightsBody { grid-template-columns: 1fr; }
  .upgradeGrid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .card { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .view { padding: 0; }
}

html.i18nPending body { visibility: hidden; }

/* Admin-only pages: hide everything until admin auth is verified (prevents flash). */
html.adminAuthPending body { visibility: hidden; }

/* /chat route: keep the header + language switcher visible, but hide chat content until auth is resolved. */
html.authPending #messages,
html.authPending .composer,
html.authPending #jumpToLatest,
html.authPending #rightRail {
  display: none !important;
}

.authGate {
  display: none;
  padding: var(--space-6) var(--space-4);
}
.authGate.hidden { display: none; }
.authGateCard {
  max-width: 520px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(226, 232, 245, 0.95);
  border-radius: 22px;
  padding: var(--space-5);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(10px);
}
.authGateCard h2 {
  margin: 0 0 var(--space-2) 0;
  font-family: var(--font-head);
}
.authGateActions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
@media (max-width: 520px) {
  .authGate { padding: var(--space-5) var(--space-3); }
  .authGateCard { padding: var(--space-4); }
  .authGateActions .btnPrimary,
  .authGateActions .btnSecondary { width: 100%; }
}


body.reduceMotion *,
body.reduceMotion *::before,
body.reduceMotion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
