:root {
  --bg: #f7f3eb;
  --bg-2: #efe8dc;
  --bg-3: #f8f5ef;
  --ink: #1f2937;
  --muted: #64748b;
  --glass: rgba(255, 255, 255, 0.5);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.28);
  --shadow: 0 22px 58px rgba(15, 23, 42, 0.14);
  --glow: 0 0 26px rgba(250, 204, 21, 0.14);
  --lava-a: rgba(245, 229, 198, 0.52);
  --lava-b: rgba(232, 237, 248, 0.44);
  --lava-c: rgba(244, 220, 201, 0.38);
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --bg-2: #111827;
  --bg-3: #1f2937;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --glass: rgba(30, 41, 59, 0.46);
  --glass-strong: rgba(15, 23, 42, 0.62);
  --border: rgba(148, 163, 184, 0.22);
  --shadow: 0 24px 56px rgba(2, 6, 23, 0.56);
  --glow: 0 0 24px rgba(129, 140, 248, 0.24);
  --lava-a: rgba(51, 65, 85, 0.44);
  --lava-b: rgba(30, 41, 59, 0.42);
  --lava-c: rgba(76, 89, 117, 0.32);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { width: 100vw; height: 100vh; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(120% 120% at 20% 20%, var(--bg-3) 0%, var(--bg-2) 48%, var(--bg) 100%),
    linear-gradient(130deg, rgba(255, 255, 255, 0.08), rgba(15, 23, 42, 0.04));
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: -35%;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(44% 45% at 18% 24%, var(--lava-a), transparent 72%),
    radial-gradient(36% 36% at 74% 34%, var(--lava-b), transparent 73%),
    radial-gradient(42% 40% at 56% 79%, var(--lava-c), transparent 74%),
    radial-gradient(25% 28% at 34% 66%, rgba(255, 255, 255, 0.12), transparent 70%);
  filter: blur(34px) saturate(114%);
  animation: lavaDrift 44s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(860px 440px at 52% 68%, rgba(255, 255, 255, 0.1), transparent 70%),
    radial-gradient(640px 320px at 44% 28%, rgba(148, 163, 184, 0.09), transparent 78%);
}

.ambient-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.ambient-background::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(36% 34% at 24% 24%, rgba(255, 255, 255, 0.17), transparent 70%),
    radial-gradient(28% 30% at 76% 64%, rgba(148, 163, 184, 0.14), transparent 74%),
    radial-gradient(24% 28% at 44% 78%, rgba(255, 255, 255, 0.11), transparent 76%);
  filter: blur(42px);
  animation: cloudDrift 38s ease-in-out infinite alternate;
}

.ambient-background::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.065;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 210px 210px;
  animation: grainDrift 26s linear infinite;
}

@keyframes grainDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(3%, -2%, 0); }
}

@keyframes cloudDrift {
  0% { transform: translate3d(-1.5%, -1%, 0) scale(1.03); }
  100% { transform: translate3d(2.5%, 1.8%, 0) scale(1.08); }
}

@keyframes lavaDrift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1.04); }
  50% { transform: translate3d(1.8%, 1.4%, 0) scale(1.09); }
  100% { transform: translate3d(-1%, 2.2%, 0) scale(1.05); }
}

.layout { min-height: 100vh; position: relative; z-index: 1; }
.main {
  width: 100%;
  min-height: calc(100vh - 56px);
  margin: 0;
  padding: 18px 22px 42px;
}

.menu-edge-zone {
  position: fixed;
  left: 0;
  top: 0;
  width: 16px;
  height: 100vh;
  z-index: 50;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.2), transparent 72%);
}

.menu-edge-zone::after {
  content: "☰";
  position: absolute;
  left: 3px;
  top: 16px;
  font-size: 0.78rem;
  opacity: 0.5;
}

.side-nav {
  position: fixed;
  left: 12px;
  top: 10%;
  width: 308px;
  max-height: 80vh;
  height: auto;
  padding: 16px 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px) saturate(118%);
  box-shadow: var(--shadow);
  border-radius: 24px;
  transform: translateX(-106%);
  transition: transform 280ms ease, opacity 280ms ease;
  opacity: 0.1;
  z-index: 60;
  overflow: hidden auto;
  animation: navGlow 7.5s ease-in-out infinite alternate;
}
body.menu-peek .side-nav,
body.drawer-open .side-nav { transform: translateX(0); opacity: 1; }

.side-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.24), transparent 38%, rgba(255, 255, 255, 0.05));
  mix-blend-mode: screen;
}

@keyframes navGlow {
  0% { box-shadow: 0 22px 56px rgba(15, 23, 42, 0.18); }
  100% { box-shadow: 0 28px 62px rgba(15, 23, 42, 0.24); }
}

.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-nav nav { display: grid; gap: 14px; margin-top: 10px; }
.nav-section-title {
  margin: 3px 0 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
  color: var(--muted);
}
.nav-links { display: grid; gap: 7px; }
.side-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 14px;
  transition: transform 160ms ease, background 160ms ease;
}
.side-nav a:hover, .side-nav a.active {
  background: rgba(255, 255, 255, 0.22);
  transform: translateX(5px);
}

.network-list { display: grid; gap: 8px; }
.network-item {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  transition: transform 170ms ease, background 170ms ease;
}
.network-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
}
.network-item:nth-child(1) { animation: networkPulse 6.2s ease-in-out infinite alternate; }
.network-item:nth-child(2) { animation: networkPulse 7.4s ease-in-out infinite alternate; }
.network-item:nth-child(3) { animation: networkPulse 8.1s ease-in-out infinite alternate; }
.network-item:nth-child(4) { animation: networkPulse 6.8s ease-in-out infinite alternate; }
.network-item:nth-child(5) { animation: networkPulse 7.9s ease-in-out infinite alternate; }
.network-item:nth-child(6) { animation: networkPulse 8.7s ease-in-out infinite alternate; }

@keyframes networkPulse {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -2px, 0); }
}
.network-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.18);
}
.network-meta { display: grid; gap: 2px; }
.network-name { font-weight: 600; font-size: 0.9rem; }
.network-type { font-size: 0.75rem; color: var(--muted); }
.network-cap { margin-left: 6px; font-size: 0.72rem; opacity: 0.9; }
.network-badge { font-size: 0.7rem; }
.network-footer { margin-top: 8px; }
.network-more {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.84rem;
  opacity: 0.86;
}
.network-more:hover { opacity: 1; text-decoration: underline; }

html[data-theme="dark"] .side-nav {
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.44));
}
html[data-theme="dark"] .glass-layer,
html[data-theme="dark"] .glass-panel,
html[data-theme="dark"] .floating-panel {
  background: linear-gradient(150deg, rgba(30, 41, 59, 0.54), rgba(15, 23, 42, 0.44));
}
html[data-theme="dark"] .network-item,
html[data-theme="dark"] .contact-item {
  background: rgba(30, 41, 59, 0.45);
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.top-bar h1 {
  font-size: 0.92rem;
  letter-spacing: 0.11em;
  font-weight: 580;
  text-transform: uppercase;
}

.mobile-toggle,
.theme-toggle,
.menu-hide,
.pill-btn,
.ghost-btn {
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
a.pill-btn,
a.ghost-btn { text-decoration: none; display: inline-flex; align-items: center; }

.mobile-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0;
}

.hero-center {
  display: flex;
  min-height: 58vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
}

.floating-search {
  width: min(840px, 95vw);
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: 999px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
  backdrop-filter: blur(20px) saturate(114%);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.08), var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transform: translateY(-2px);
}

.semantic-core {
  animation: breathe 9.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: translateY(-1px) scale(1); }
  50% { transform: translateY(-2px) scale(1.0035); }
}

.floating-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  padding: 12px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: #0f172a;
  transition: box-shadow 200ms ease, background 200ms ease;
}

.floating-input:focus {
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.glass-layer,
.glass-panel,
.floating-panel {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.16));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(18px) saturate(112%);
}

.discovery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: stretch;
}

.update-feed-card {
  flex: 1 1 250px;
  transition: transform 260ms ease, box-shadow 260ms ease, filter 260ms ease;
  animation: discoveryFloat var(--float-time, 10s) ease-in-out infinite alternate;
}

.drift-0 { transform: translateY(0px); }
.drift-1 { transform: translateY(-3px); }
.drift-2 { transform: translateY(2px); }
.drift-3 { transform: translateY(-1px); }

.update-feed-card:nth-child(1) { --float-time: 7.8s; animation-delay: -1.2s; }
.update-feed-card:nth-child(2) { --float-time: 9.2s; animation-delay: -2.7s; }
.update-feed-card:nth-child(3) { --float-time: 8.6s; animation-delay: -0.4s; }
.update-feed-card:nth-child(4) { --float-time: 10.4s; animation-delay: -3.1s; }
.update-feed-card:nth-child(5) { --float-time: 8.1s; animation-delay: -1.9s; }

@keyframes discoveryFloat {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -2px, 0); }
}

.update-feed-card:hover {
  transform: translateY(-5px) scale(1.006);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
  filter: brightness(1.02);
}

.search-layout,
.ask-layout { display: grid; gap: 14px; }
.results-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 18px;
}

.search-core-wrap {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.search-core-wrap .semantic-core {
  width: min(880px, 96vw);
}
.semantic-composer {
  border-radius: 32px;
  width: min(900px, 96vw);
  padding: 11px 12px 7px;
  display: grid;
  gap: 5px;
  position: relative;
}
.semantic-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 13px 15px;
  min-height: 50px;
  max-height: 320px;
  line-height: 1.48;
  font-size: 0.98rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.semantic-toolbar {
  margin-top: 2px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
}
.semantic-left-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.semantic-right-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.semantic-plus-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.02rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.22);
}
.semantic-context-row {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 22px;
}
.semantic-intent-chip {
  font-size: 0.68rem;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.26);
}
.semantic-intent-hint {
  font-size: 0.72rem;
  opacity: 0.7;
  letter-spacing: 0.01em;
}
.semantic-assist-hint {
  justify-self: center;
  font-size: 0.74rem;
  opacity: 0.64;
}
.semantic-plus-menu {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 5px;
  padding: 7px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.14));
  backdrop-filter: blur(12px);
  position: absolute;
  left: 12px;
  top: calc(100% + 6px);
  width: min(320px, calc(100% - 24px));
  z-index: 30;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}
.semantic-plus-item {
  justify-content: flex-start;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 0.73rem;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.14);
}
.semantic-plus-item:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}
.active-action { box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.34) inset; }
.semantic-stream { display: grid; gap: 9px; margin: 16px auto 18px; width: min(900px, 96vw); }
.stream-card {
  animation: floatIn 280ms ease both;
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.14));
  backdrop-filter: blur(14px);
}
.user-card { border-left: 3px solid rgba(59, 130, 246, 0.45); }
.ai-card { border-left: 3px solid rgba(16, 185, 129, 0.45); }
.stream-text { white-space: pre-wrap; overflow-wrap: anywhere; }

.result-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 240ms ease, box-shadow 240ms ease, filter 240ms ease;
  animation: resultDrift var(--drift-time, 11s) ease-in-out infinite alternate;
}
.result-card:nth-child(odd) { --drift-time: 9.6s; }
.result-card:nth-child(even) { --drift-time: 8.2s; }
.result-card:nth-child(3n) { --drift-time: 10.8s; }

@keyframes resultDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -2px, 0); }
}
.result-card:hover {
  transform: translateY(-4px) scale(1.006);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
  filter: brightness(1.015);
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-appear { animation: floatIn 340ms ease both; }

.site-preview { display: grid; gap: 8px; }
.site-preview img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.preview-title { margin: 0; font-weight: 600; }
.result-source-link { margin: 0; }
.result-source-link a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips, .entity-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.34);
  font-size: 0.76rem;
}
.capability-chip { font-size: 0.74rem; opacity: 0.92; }

.answer-surface {
  transition: transform 200ms ease, opacity 200ms ease;
}
body.ask-mode-active .answer-surface {
  transform: translateY(-2px);
}

.citations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.messages-layout { display: grid; grid-template-columns: 1.05fr 1.6fr 1fr; gap: 16px; align-items: start; }
.messages-env { margin-top: 2px; }
.contacts-column,
.chat-column,
.chat-context-panel {
  min-height: 72vh;
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.18));
}
.contacts-column { display: grid; grid-template-rows: auto 1fr; gap: 10px; }
.contacts-stream { display: grid; gap: 8px; overflow: auto; max-height: 60vh; padding-right: 4px; }
.contact-item {
  width: 100%;
  border: none;
  border-radius: 16px;
  text-align: left;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.2);
  color: var(--ink);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}
.contact-item:hover,
.contact-item.active {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.3);
}
.contact-item:nth-child(odd) { animation: contactFloat 7.2s ease-in-out infinite alternate; }
.contact-item:nth-child(even) { animation: contactFloat 8.6s ease-in-out infinite alternate; }

@keyframes contactFloat {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -2px, 0); }
}
.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.16);
}
.contact-meta { display: grid; gap: 2px; }
.contact-name { font-weight: 600; font-size: 0.9rem; }
.contact-type { color: var(--muted); font-size: 0.75rem; }

.chat-column { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; }
.chat-scroll {
  height: min(56vh, 620px);
  overflow: auto;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
}
.message-bubble {
  width: fit-content;
  max-width: min(80%, 640px);
  border-radius: 18px;
  padding: 11px 13px;
  margin-bottom: 8px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}
.message-bubble.in { background: rgba(96, 165, 250, 0.2); margin-right: auto; }
.message-bubble.out { background: rgba(16, 185, 129, 0.2); margin-left: auto; }
.message-compose-bar {
  position: sticky;
  bottom: 8px;
  margin-top: 10px;
  display: grid;
  grid-template-columns: 190px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
}
.message-compose-bar textarea { min-height: 48px; max-height: 130px; resize: vertical; }
.chat-context-panel { min-height: 70vh; position: sticky; top: 66px; }
.chat-context-panel #messages-context { display: grid; gap: 8px; }

.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; }
.profile-chip { display: flex; justify-content: space-between; align-items: center; }

.notification-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  margin-right: 8px;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 9vh;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(4px);
}
.command-palette.hidden { display: none; }
.command-shell { width: min(740px, 92vw); }
.command-shell input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
}
#command-results { margin-top: 8px; display: grid; gap: 6px; }
.command-item {
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--ink);
  padding: 8px 10px;
}

.status { margin: 8px 2px; color: var(--muted); font-size: 0.88rem; }
.status.error { color: #ef4444; }
.meta { color: var(--muted); font-size: 0.78rem; opacity: 0.85; }
.profile-section { margin-bottom: 14px; }

.semantic-stop-btn {
  margin: 6px auto 2px;
  display: flex;
  width: min(900px, 96vw);
  justify-content: center;
  padding: 8px 10px;
  font-size: 0.76rem;
  opacity: 0.88;
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.16));
  backdrop-filter: blur(12px);
}

.portal-return-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.2));
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(14px);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.portal-return-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.24);
}

.verify-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 28px;
}
.verify-center-panel {
  width: min(860px, 96vw);
  display: grid;
  gap: 12px;
  border-radius: 24px;
}
.selfie-panel {
  border-radius: 18px;
}
.partner-console-layout { display: grid; gap: 14px; }
.partner-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 10px; }

.booking-card {
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.booking-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.24);
  filter: brightness(1.03);
}

#booking-status pre {
  margin: 0;
  max-height: 280px;
  overflow: auto;
}

input, textarea, button { font: inherit; }
input, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
}
label { display: block; margin-top: 8px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 920px) {
  .results-stack { grid-template-columns: 1fr; }
  .messages-layout { grid-template-columns: 1fr; }
  .message-compose-bar { grid-template-columns: 1fr; }
  .citations-grid, .profile-grid { grid-template-columns: 1fr; }
  .side-nav { left: 0; top: 0; width: 84vw; max-height: 100vh; transform: translateX(-104%); border-radius: 0; }
  .main { padding: 14px 12px 30px; }
  .hero-center { min-height: 46vh; }
  .partner-grid { grid-template-columns: 1fr; }
  .semantic-toolbar { grid-template-columns: 1fr; gap: 6px; }
  .semantic-context-row { align-items: flex-start; }
  .semantic-left-tools,
  .semantic-right-tools { justify-content: space-between; width: 100%; }
  .semantic-plus-menu {
    width: calc(100% - 20px);
    left: 10px;
  }
}

.nav-action-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
}

.nav-action-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateX(5px);
}

.auth-main {
  display: grid;
  place-items: start center;
  padding-top: 40px;
}

.auth-panel {
  width: min(100%, 520px);
  padding: 24px;
}

.compact-panel {
  padding: 20px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.auth-form label {
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.26);
  color: var(--ink);
  font: inherit;
}

.auth-form input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}

.nav-action-btn,
.pill-btn {
  appearance: none;
  border: none;
  cursor: pointer;
}

.nav-action-btn {
  padding: 9px 10px;
  border-radius: 14px;
  text-align: left;
  background: rgba(15, 23, 42, 0.08);
  color: var(--ink);
  font: inherit;
  transition: transform 160ms ease, background 160ms ease;
}

.nav-action-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateX(5px);
}

.shell-overview {
  margin-bottom: 18px;
}

.shell-overview-wide {
  grid-column: 1 / -1;
}

.shell-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 22px;
}

.shell-card h2,
.page-hero h2,
.auth-intro-panel h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  line-height: 1.1;
}

.shell-actions,
.hero-auth-actions,
.auth-benefit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-btn.secondary {
  background: rgba(15, 23, 42, 0.08);
  color: var(--ink);
  text-decoration: none;
}

.hero-home-hero,
.shell-home-hero {
  display: grid;
  gap: 18px;
}

.hero-copy {
  padding: 22px;
  border-radius: 24px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
}

.guest-state-label {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.hero-auth-panel {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.page-hero {
  padding: 18px 20px;
  margin-bottom: 18px;
  border-radius: 22px;
}

.protected-main .page-hero {
  margin-bottom: 16px;
}

.auth-page-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: 18px;
}

.auth-intro-panel,
.auth-form-panel {
  padding: 22px;
  border-radius: 24px;
}

.auth-form-panel .status {
  margin-top: 0;
}

.auth-benefit-list {
  margin-top: 16px;
}

.profile-grid {
  margin-bottom: 16px;
}

.profile-section {
  display: grid;
  gap: 14px;
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

body[data-auth-state="guest"] .protected-main .page-hero {
  opacity: 0.98;
}

@media (max-width: 900px) {
  .shell-card,
  .hero-auth-panel,
  .auth-page-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .shell-actions,
  .hero-auth-actions {
    width: 100%;
  }

  .shell-actions .pill-btn,
  .hero-auth-actions .pill-btn,
  .auth-page-grid .pill-btn {
    width: 100%;
    text-align: center;
  }
}

.top-bar-product {
  padding: 18px 22px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px) saturate(118%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.top-bar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.top-bar-system-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}

.header-system-message {
  margin: 0;
  max-width: min(720px, 100%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: var(--ink);
  font-size: 0.82rem;
}

.header-system-message.error {
  color: #b91c1c;
  background: rgba(254, 226, 226, 0.76);
}

.top-bar-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.top-bar-product h1 {
  margin: 0;
  font-size: clamp(1.1rem, 1.7vw, 1.55rem);
  letter-spacing: 0.14em;
}

.header-session-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 760px;
}

.top-bar-actions,
.header-auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-user-chip.pending {
  background: rgba(254, 249, 195, 0.52);
}

.header-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.12);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.header-user-meta {
  display: grid;
  gap: 2px;
}

.header-user-meta b {
  font-size: 0.82rem;
}

.header-user-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.header-auth-actions .pill-btn,
.top-bar-actions .pill-btn {
  min-height: 40px;
  padding: 10px 16px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

#session-info:empty {
  display: none;
}

.hero-core-only {
  min-height: auto;
  padding-top: 20px;
  padding-bottom: 6px;
}

.portal-main,
.protected-main,
.search-layout,
.ask-layout,
.auth-main {
  display: grid;
  gap: 18px;
}

.page-shell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 2px 0;
}

.page-shell-head h2 {
  margin: 4px 0 0;
  max-width: 840px;
  font-size: clamp(1.3rem, 2vw, 1.95rem);
  line-height: 1.1;
}

.compact-section-head {
  padding-top: 4px;
}

.updates-section {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.updates-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.updates-head h2 {
  margin: 6px 0 0;
  max-width: 760px;
  font-size: clamp(1.4rem, 2.4vw, 2.25rem);
  line-height: 1.08;
}

.updates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 74px;
  gap: 18px;
}

.brain-overview {
  display: grid;
}

.brain-overview-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
}

.brain-hotline {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.5;
}

.brain-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brain-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid var(--border);
  font-size: 0.76rem;
}

.update-rich-card {
  overflow: hidden;
  padding: 0;
  border-radius: 24px;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
  min-height: 100%;
  opacity: 1;
}

.update-rich-card:hover {
  transform: translateY(-7px) scale(1.015);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  filter: brightness(1.02);
}

.update-rich-card.size-standard {
  grid-row: span 3;
}

.update-rich-card.size-wide {
  grid-column: span 2;
  grid-row: span 3;
}

.update-rich-card.size-tall {
  grid-row: span 4;
}

.update-rich-card.size-feature {
  grid-column: span 2;
  grid-row: span 4;
}

.update-rich-card.is-swapping {
  opacity: 0;
  transform: translateY(16px) scale(0.985);
}

.update-rich-card.is-entering {
  animation: cardSwapIn 420ms ease both;
}

.update-rich-card.is-leaving {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: opacity 240ms ease, transform 240ms ease;
}

@keyframes cardSwapIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.update-image-wrap {
  position: relative;
  height: 210px;
  overflow: hidden;
}

.update-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(15, 23, 42, 0.42) 100%);
}

.update-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.01);
  transition: transform 280ms ease;
}

.update-rich-card:hover .update-image-wrap img {
  transform: scale(1.06);
}

.update-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.update-priority {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 700;
}

.update-content {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.update-domain {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.update-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.update-timestamp {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

.update-content h3 {
  margin: 0;
  font-size: 1.08rem;
}

.update-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
  font-size: 0.92rem;
}

.update-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  text-decoration: none;
}

.update-link::after {
  content: "->";
}

.update-links {
  display: grid;
  gap: 6px;
}

.update-source {
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-inline-links {
  display: flex;
  justify-content: flex-end;
  margin-top: -2px;
}

.auth-inline-links a {
  color: var(--ink);
  font-size: 0.84rem;
}

.auth-divider {
  margin: 18px 0 14px;
  position: relative;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
}

.auth-divider span {
  position: relative;
  padding: 0 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.55));
}

.oauth-grid {
  display: grid;
  gap: 10px;
}

.oauth-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.oauth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 26px rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.38);
}

.oauth-btn.google {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 244, 229, 0.74));
}

.oauth-btn.github {
  background: linear-gradient(135deg, rgba(237, 242, 247, 0.9), rgba(226, 232, 240, 0.72));
}

.oauth-btn.facebook {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.8), rgba(191, 219, 254, 0.62));
}

.status.success {
  color: #0f766e;
}

.verify-email-panel {
  width: min(100%, 560px);
}

.compact-hero {
  margin-bottom: 8px;
}

.auth-page-grid-tight {
  align-items: stretch;
}

@media (max-width: 1350px) {
  .updates-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .updates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .top-bar-product {
    padding: 14px 12px 12px;
  }

  .top-bar-main,
  .top-bar-actions,
  .updates-head {
    flex-direction: column;
    align-items: stretch;
  }

  .top-bar-system-row {
    justify-content: stretch;
  }

  .header-auth-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-auth-actions .pill-btn {
    flex: 1 1 180px;
    justify-content: center;
  }

  .updates-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .update-image-wrap {
    height: 190px;
  }

  .update-rich-card.size-standard,
  .update-rich-card.size-wide,
  .update-rich-card.size-tall,
  .update-rich-card.size-feature {
    grid-column: span 1;
    grid-row: span 1;
  }

  .page-shell-head h2,
  .updates-head h2 {
    max-width: 100%;
  }
}
