/* Zorin Assistant — production UI matching design reference */

:root {
  --bg: #07070f;
  --bg-elevated: #0c0c16;
  --panel: #10101c;
  --panel-2: #141422;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f6fb;
  --text-muted: #9aa3b5;
  --text-faint: #6b7385;
  --accent: #7c9cff;
  --accent-2: #a78bfa;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --pink: #f472b6;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --sidebar-w: 288px;
  --toolbar-h: 56px;
  --font: Inter, system-ui, sans-serif;
  --home-max: 920px;
  --composer-max: 720px;
  --glow-blue: rgba(96, 165, 250, 0.35);
  --glow-purple: rgba(167, 139, 250, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 160ms;
  --dur-med: 220ms;
}

[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef0f6;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.icon {
  display: inline-grid !important;
  place-items: center;
  line-height: 0;
  flex-shrink: 0 !important;
  color: inherit;
  opacity: 1 !important;
  visibility: visible !important;
  overflow: visible;
  min-width: 1px;
  min-height: 1px;
}
.icon svg,
.side-nav-icon svg,
.side-section-icon svg,
.app-search-icon svg,
.new-chat-plus svg,
.new-chat-pen svg,
.icon-btn svg,
.quick-access-icon svg,
.home-card-icon svg,
.qa-icon svg,
.send-btn svg,
.footer-link-icon svg,
.disclaimer-icon svg,
.side-collapse-chevron svg {
  display: block !important;
  flex-shrink: 0 !important;
  /* Prefer explicit SVG width/height attributes from icon(); never stretch to a 0% parent. */
  max-width: none;
  max-height: none;
  opacity: 1 !important;
  visibility: visible !important;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--toolbar-h) 1fr;
  height: 100vh;
  background: var(--bg);
}

/* ---- Toolbar ---- */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  height: var(--toolbar-h);
  padding: 0 1.1rem;
  background: rgba(10, 10, 18, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  justify-self: start;
  height: 100%;
}

.brand-mark { display: grid; place-items: center; }
.brand { font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }

.menu-btn { margin-left: 0.15rem; }

.conversation-header {
  justify-self: center;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
  height: 100%;
  padding: 0;
}

.conversation-title-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.38rem;
  line-height: 1;
}

.conversation-title {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  user-select: none;
  line-height: 1.15;
  margin: 0;
  padding: 0;
}

.title-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  opacity: 0.85;
  transform: translateY(0.5px);
  flex-shrink: 0;
}

.conversation-subtitle { display: none !important; }

.toolbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  height: 100%;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: #b6bfd1;
  border-radius: 8px;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transition:
    color var(--dur) var(--ease-soft),
    background var(--dur) var(--ease-soft),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease-soft);
}

.icon-btn:hover {
  color: #f4f6fb;
  background: rgba(255, 255, 255, 0.06);
}
.icon-btn:active { transform: scale(0.96); }
.icon-btn:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.55);
  outline-offset: 2px;
}
.icon-btn.active {
  color: var(--accent);
  background: rgba(124, 156, 255, 0.1);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 32px;
  padding: 0 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  margin-right: 0.35rem;
  transition: border-color var(--dur) var(--ease-soft), background var(--dur) var(--ease-soft);
}
.live-pill:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
}
.live-pill:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.55);
  outline-offset: 2px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.live-pill[data-state="error"] .live-dot,
.live-pill[data-state="offline"] .live-dot { background: var(--amber); box-shadow: none; }

.live-label { font-size: 0.78rem; font-weight: 500; }
.live-chevron { display: grid; color: var(--text-faint); }

.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 0.3rem;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease-soft);
}
.avatar-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35);
}
.avatar-btn:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.55);
  outline-offset: 2px;
}

/* ---- Body ---- */
.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
  overflow: hidden;
}

.app-body.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.app-body.sidebar-collapsed .sidebar {
  overflow: hidden;
  border: none;
  opacity: 0;
  pointer-events: none;
}

/* ---- Sidebar ---- */
.sidebar {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
  background: #090912;
  border-right: 1px solid var(--border);
  transition: opacity 160ms ease;
}

.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.new-chat-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.62rem 0.78rem;
  border-radius: 11px;
  border: none;
  background: linear-gradient(180deg, #141426 0%, #0c0c16 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 8px 22px rgba(76, 29, 149, 0.12),
    0 0 28px rgba(59, 130, 246, 0.08);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: filter var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
}

.new-chat-btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 10px 26px rgba(76, 29, 149, 0.16),
    0 0 32px rgba(59, 130, 246, 0.12);
}
.new-chat-btn:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.55);
  outline-offset: 2px;
}

.new-chat-plus,
.new-chat-pen {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #c7d2fe;
  opacity: 1;
  visibility: visible;
}
.new-chat-plus { width: 16px; height: 16px; }
.new-chat-pen { width: 14px; height: 14px; color: #a5b4fc; }
.new-chat-btn:hover .new-chat-plus,
.new-chat-btn:hover .new-chat-pen { color: #e0e7ff; }

.side-section { display: grid; gap: 0.35rem; }

.side-heading {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.2rem;
}

.side-heading.inline {
  padding: 0;
  letter-spacing: 0.06em;
}

.side-collapse-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.32rem 0.25rem;
  text-align: left;
  border-radius: 8px;
  transition: color var(--dur) var(--ease-soft), background var(--dur) var(--ease-soft);
}
.side-collapse-head:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.side-collapse-head:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.45);
  outline-offset: 1px;
}

.side-section-icon {
  display: grid;
  place-items: center;
  color: #9aa3b5;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}

.side-collapse-chevron {
  display: grid;
  place-items: center;
  transition: transform var(--dur-med) var(--ease);
  color: var(--text-faint);
}
.side-section.collapsed .side-collapse-chevron {
  transform: rotate(-90deg);
}

.side-collapse-body {
  display: grid;
  gap: 0.4rem;
  overflow: hidden;
  max-height: 520px;
  opacity: 1;
  transition: max-height var(--dur-med) var(--ease), opacity var(--dur) var(--ease-soft), margin var(--dur) var(--ease-soft);
}
.side-section.collapsed .side-collapse-body {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.recent-list,
.connected-apps-list {
  display: grid;
  gap: 0.15rem;
}

.recent-item,
.connected-app-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--dur) var(--ease-soft), transform var(--dur) var(--ease);
}

.recent-item:hover,
.connected-app-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.recent-item.active {
  background: rgba(124, 156, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(124, 156, 255, 0.12);
}

.recent-item-icon,
.connected-app-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.recent-item-title {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item-meta {
  font-size: 0.68rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.recent-empty,
.empty-state {
  display: grid;
  gap: 0.25rem;
  justify-items: start;
  font-size: 0.78rem;
  color: var(--text-faint);
  padding: 0.65rem 0.6rem;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}
.empty-state-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}
.empty-state-body {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--text-faint);
}

.connected-app-name { font-size: 0.82rem; }
.connected-app-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--green);
}
.connected-app-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.7);
}
.connected-app-launch {
  color: var(--text-faint);
  display: grid;
}

.side-link.subtle {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.75rem;
  text-align: left;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}
.side-link.subtle:hover { color: var(--accent); }

.apps-panel {
  margin-top: 0.35rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  max-height: 220px;
  overflow: auto;
}

.app-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.15rem;
  background: rgba(255,255,255,0.02);
}
.app-search-icon {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: #9aa3b5;
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}
.app-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.8rem;
  color: var(--text);
}

.apps-manager { display: grid; gap: 0.75rem; }
.app-cat-label {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.app-cat-rule {
  height: 1px;
  background: var(--border);
  margin: 0 0 0.35rem;
}
.app-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 0.3rem;
  cursor: default;
  font-size: 0.82rem;
  text-align: left;
  border-radius: 8px;
  transition: background var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft);
}
.app-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.app-item.connected { color: var(--text); }
.app-item-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.app-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-item-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.app-item-status {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  min-width: 1.6rem;
  text-align: right;
}
.app-item.connected .app-item-status {
  color: color-mix(in srgb, var(--green) 55%, var(--text-faint));
}

.app-toggle {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease-soft), border-color var(--dur) var(--ease-soft);
}
.app-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c5c9d4;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease-soft);
}
.app-toggle[aria-checked="true"] {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.3);
}
.app-toggle[aria-checked="true"]::after {
  transform: translateX(14px);
  background: var(--green);
}
.app-toggle:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.45);
  outline-offset: 2px;
}

.apps-panel {
  margin-top: 0.35rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  max-height: 220px;
  overflow: auto;
}

.side-nav {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.15rem;
  padding-top: 0.15rem;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.52rem 0.55rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.84rem;
  text-align: left;
  transition: background var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft);
}
.side-nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.side-nav-item:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.45);
  outline-offset: 1px;
}
.side-nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #aeb6c7;
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}
.side-nav-item:hover .side-nav-icon { color: #e8edf7; }
.side-nav-item:hover { color: var(--text); }

.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  margin: 0.65rem 0.85rem 0.95rem;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #131322, #0e0e18);
}

.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  font-size: 0.78rem;
  font-weight: 700;
}

.account-name { font-size: 0.84rem; font-weight: 600; }
.account-plan { font-size: 0.72rem; color: var(--text-faint); margin-top: 0.1rem; }

/* ---- Workspace ---- */
.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(76, 29, 149, 0.22), transparent 55%),
    radial-gradient(700px 380px at 15% 8%, rgba(37, 99, 235, 0.12), transparent 50%),
    radial-gradient(700px 380px at 85% 12%, rgba(192, 38, 211, 0.1), transparent 52%),
    var(--bg);
}

.workspace-main {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.interaction {
  min-height: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* HOME */
.workspace[data-view="home"] .interaction {
  overflow-y: auto;
  align-items: center;
  padding: 0.5rem 1.25rem 1.5rem;
}

.workspace[data-view="home"] .home-view {
  position: relative;
  width: 100%;
  max-width: var(--home-max);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
  padding-top: 1.25rem;
  overflow: visible;
}

.workspace[data-view="home"] .chat-view { display: none !important; }

.workspace[data-view="home"] .composer-area {
  width: 100%;
  max-width: var(--composer-max);
}

.hero-stage {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, 130%);
  height: 320px;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
  -webkit-mask-image:
    radial-gradient(ellipse 58% 52% at 50% 42%, #000 0%, #000 38%, transparent 78%),
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 58%, transparent 92%);
  mask-image:
    radial-gradient(ellipse 58% 52% at 50% 42%, #000 0%, #000 38%, transparent 78%),
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 58%, transparent 92%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.hero-atmosphere {
  position: absolute;
  inset: -10% -5% 10%;
  background:
    radial-gradient(ellipse 42% 38% at 50% 36%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(ellipse 55% 50% at 22% 55%, rgba(192, 38, 211, 0.16), transparent 72%),
    radial-gradient(ellipse 50% 48% at 78% 48%, rgba(37, 99, 235, 0.2), transparent 70%),
    radial-gradient(ellipse 36% 32% at 50% 22%, rgba(99, 102, 241, 0.14), transparent 68%);
  filter: blur(28px);
  opacity: 0.95;
}

.hero-clouds {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 48% at 18% 58%, rgba(192, 38, 211, 0.18), transparent 72%),
    radial-gradient(ellipse 50% 45% at 82% 48%, rgba(37, 99, 235, 0.22), transparent 70%),
    radial-gradient(ellipse 40% 35% at 50% 30%, rgba(99, 102, 241, 0.14), transparent 72%);
  filter: blur(22px);
  opacity: 0.9;
}

.hero-waves {
  position: absolute;
  left: -8%;
  right: -8%;
  top: 48px;
  height: 230px;
  opacity: 0.92;
}

.hero-waves-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-particles {
  position: absolute;
  inset: 8% 12% 18%;
  background-image:
    radial-gradient(1px 1px at 12% 30%, rgba(255,255,255,0.32), transparent),
    radial-gradient(1px 1px at 28% 62%, rgba(255,255,255,0.18), transparent),
    radial-gradient(1.2px 1.2px at 48% 24%, rgba(186,230,253,0.3), transparent),
    radial-gradient(1px 1px at 66% 70%, rgba(255,255,255,0.14), transparent),
    radial-gradient(1px 1px at 78% 38%, rgba(233,213,255,0.24), transparent),
    radial-gradient(1px 1px at 88% 58%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 40% 48%, rgba(255,255,255,0.1), transparent);
  opacity: 0.4;
  animation: particleDrift 22s var(--ease-soft) infinite;
  will-change: transform, opacity;
}

@keyframes particleDrift {
  0% { transform: translate3d(0, 0, 0); opacity: 0.28; }
  50% { opacity: 0.42; }
  100% { transform: translate3d(0, -6px, 0); opacity: 0.28; }
}

.hero-glow {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 150px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.22), transparent 26%),
    radial-gradient(circle at 50% 48%, rgba(56, 189, 248, 0.36), transparent 46%),
    radial-gradient(circle at 50% 56%, rgba(168, 85, 247, 0.28), transparent 60%),
    radial-gradient(circle at 50% 62%, rgba(236, 72, 153, 0.14), transparent 72%);
  filter: blur(14px);
  opacity: 0.92;
}

.hero-fade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, var(--bg) 0%, transparent 22%, transparent 55%, var(--bg) 100%),
    linear-gradient(to right, var(--bg) 0%, transparent 18%, transparent 82%, var(--bg) 100%);
  opacity: 0.85;
  pointer-events: none;
}

.home-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  padding: 1.75rem 0 0.35rem;
}

.hero-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  filter:
    drop-shadow(0 0 8px rgba(56, 189, 248, 0.42))
    drop-shadow(0 0 18px rgba(168, 85, 247, 0.32))
    drop-shadow(0 0 28px rgba(236, 72, 153, 0.16));
  animation: heroPulse 5.5s var(--ease-soft) infinite;
  will-change: transform, filter;
}

.hero-logo svg {
  display: block;
  shape-rendering: geometricPrecision;
}

@keyframes heroPulse {
  0%, 100% {
    filter:
      drop-shadow(0 0 7px rgba(56, 189, 248, 0.38))
      drop-shadow(0 0 16px rgba(168, 85, 247, 0.26))
      drop-shadow(0 0 24px rgba(236, 72, 153, 0.12));
    transform: translateY(0);
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(56, 189, 248, 0.52))
      drop-shadow(0 0 22px rgba(168, 85, 247, 0.34))
      drop-shadow(0 0 30px rgba(236, 72, 153, 0.2));
    transform: translateY(-1px);
  }
}

.welcome-title {
  font-size: clamp(1.85rem, 3.4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.welcome-subtitle {
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 34ch;
}

.composer-slot:empty { display: none; }

/* Composer */
.composer-area {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  gap: 0.75rem;
}

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.2rem;
  min-height: 52px;
  padding: 0.35rem 0.35rem 0.35rem 0.45rem;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: rgba(12, 12, 22, 0.88);
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.06),
    0 0 36px rgba(99, 102, 241, 0.1),
    0 10px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  transition: border-color var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
}
.composer:focus-within {
  border-color: rgba(124, 156, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.12),
    0 0 40px rgba(99, 102, 241, 0.14),
    0 12px 36px rgba(0, 0, 0, 0.32);
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.composer-side {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.composer textarea {
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
  max-height: 140px;
  padding: 0.55rem 0.4rem;
  min-height: 32px;
  align-self: center;
}

.composer textarea::placeholder {
  color: var(--text-faint);
  line-height: 1.4;
}

.send-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(135deg, #6366f1, #3b82f6 55%, #22d3ee);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.35);
  transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
  margin-left: 0.1rem;
  opacity: 1;
  visibility: visible;
}
.send-btn .icon,
.send-btn svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
  fill: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.send-btn:hover {
  transform: translateY(-0.5px);
  filter: brightness(1.06);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.42);
}
.send-btn:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.55);
  outline-offset: 2px;
}
.send-btn.is-stop {
  background: #334155;
  box-shadow: none;
  border-radius: 10px;
}

.add-menu {
  position: absolute;
  left: 0;
  top: calc(100% - 2.5rem);
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.3rem;
  z-index: 8;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.add-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.add-option:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Action capsules */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease-soft), color var(--dur) var(--ease-soft), background var(--dur) var(--ease-soft), transform var(--dur) var(--ease);
}
.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}
.chip.active {
  color: var(--text);
  border-color: rgba(124, 156, 255, 0.45);
  background: rgba(124, 156, 255, 0.1);
}

/* Feature cards */
.home-cards {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: 168px;
  padding: 1rem 1rem 1.05rem;
  text-align: left;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 22, 36, 0.95), rgba(12, 12, 20, 0.92));
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-med) var(--ease), border-color var(--dur-med) var(--ease-soft), box-shadow var(--dur-med) var(--ease-soft);
}

.home-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 48px;
  background: radial-gradient(120px 40px at 30% 0%, var(--card-glow, rgba(96,165,250,0.35)), transparent 70%);
  pointer-events: none;
}

.home-card[data-tone="blue"] { --card-glow: rgba(59, 130, 246, 0.45); }
.home-card[data-tone="purple"] { --card-glow: rgba(167, 139, 250, 0.5); }
.home-card[data-tone="teal"] { --card-glow: rgba(45, 212, 191, 0.45); }
.home-card[data-tone="gold"] { --card-glow: rgba(251, 191, 36, 0.4); }
.home-card[data-tone="pink"] { --card-glow: rgba(244, 114, 182, 0.45); }

.home-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.home-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.home-card[data-tone="blue"] .home-card-icon { color: #60a5fa; }
.home-card[data-tone="purple"] .home-card-icon { color: #c4b5fd; }
.home-card[data-tone="teal"] .home-card-icon { color: #2dd4bf; }
.home-card[data-tone="gold"] .home-card-icon { color: #fbbf24; }
.home-card[data-tone="pink"] .home-card-icon { color: #f472b6; }

.home-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.home-card-body {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--text-muted);
  flex: 1;
}

.home-card-arrow {
  align-self: flex-end;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.home-card:hover .home-card-arrow {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

/* Quick access */
.quick-access {
  width: 100%;
  display: grid;
  gap: 0.6rem;
  margin-top: 0.15rem;
  padding-bottom: 0.5rem;
}

.quick-access-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 500;
  padding: 0 0.05rem;
  margin: 0;
}

.quick-access-icon {
  display: grid;
  place-items: center;
  color: #aeb6c7;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}

.quick-access-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
}

.qa-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(16, 16, 28, 0.9);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  transition:
    border-color var(--dur) var(--ease-soft),
    transform var(--dur) var(--ease),
    background var(--dur) var(--ease-soft),
    box-shadow var(--dur) var(--ease-soft);
}
.qa-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(22, 22, 36, 0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}
.qa-card:focus-visible {
  outline: 2px solid rgba(124, 156, 255, 0.5);
  outline-offset: 2px;
}
.qa-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 1;
  visibility: visible;
}
.qa-arrow { display: grid; color: var(--text-faint); }

/* Chat */
.workspace[data-view="chat"] .interaction {
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 0 0 0.75rem;
}

.workspace[data-view="home"] .composer-area .quick-actions { display: flex; }

.workspace[data-view="chat"] .home-view { display: none !important; }
.workspace[data-view="chat"] .quick-actions { display: none; }

.workspace[data-view="chat"] .composer-area {
  width: 100%;
  max-width: calc(var(--composer-max) + 2rem);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 0;
}

.chat-view {
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 0;
  overflow: hidden;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.75rem 0 1rem;
}

.msg { display: grid; gap: 0.35rem; }
.msg-role { font-size: 0.72rem; color: var(--text-faint); font-weight: 600; }
.msg.user .msg-body {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  white-space: pre-wrap;
}
.msg.assistant .msg-body {
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}
.msg-body p { margin: 0 0 0.65rem; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body pre {
  background: #0b0b14;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  overflow: auto;
  font-size: 0.82rem;
}
.msg-thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.msg-thinking .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.msg-error {
  color: var(--text-muted);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
}
.retry-btn {
  margin-top: 0.45rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-size: 0.8rem;
}
.retry-btn:hover { border-color: var(--border-strong); }

/* Footer */
.disclaimer-footer {
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid transparent;
}

.disclaimer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.75rem;
  font-size: 0.72rem;
  color: var(--text-faint);
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.45;
}

.disclaimer-icon { display: inline-grid; place-items: center; color: var(--text-faint); }
.disclaimer-text { color: var(--text-faint); }

.disclaimer-links {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.disclaimer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  color: #93c5fd;
  text-decoration: none;
  transition: color var(--dur) var(--ease-soft);
}
.disclaimer-links a:hover { color: #bfdbfe; text-decoration: none; }
.footer-link-icon {
  display: inline-grid;
  place-items: center;
  opacity: 0.85;
}
.disclaimer-sep { color: var(--text-faint); opacity: 0.55; }

/* Model popover */
.model-popover {
  position: fixed;
  z-index: 80;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 2rem));
  max-height: min(460px, 70vh);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 0.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.model-option {
  display: grid;
  gap: 0.3rem;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
}
.model-option:hover { background: rgba(255,255,255,0.04); }
.model-option.active {
  border-color: rgba(124, 156, 255, 0.35);
  background: rgba(124, 156, 255, 0.08);
}
.model-option-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}
.model-option-status { font-size: 0.7rem; color: var(--text-faint); }
.model-option-blurb { font-size: 0.78rem; color: var(--text-muted); }
.model-caps { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.model-cap {
  font-size: 0.65rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.bg-status {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  font-size: 0.72rem;
  color: var(--text-faint);
  background: rgba(12, 12, 20, 0.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
}
.bg-status[data-tone="ok"] { color: var(--green); }
.bg-status[data-tone="warn"] { color: var(--amber); }

.activity-trigger {
  position: relative;
}
.activity-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-elevated);
}

/* Drawer — Acrobat-style slide-in notification panel */
.drawer {
  position: fixed;
  top: var(--toolbar-h);
  right: 0;
  bottom: 0;
  width: min(360px, 100vw);
  background: rgba(12, 12, 22, 0.97);
  border-left: 1px solid var(--border);
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 280ms var(--ease), opacity 220ms var(--ease-soft);
  backdrop-filter: blur(16px);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
}
.drawer.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.drawer[hidden] {
  display: grid !important;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.drawer-body { overflow: auto; padding: 0.85rem 1rem 1.1rem; }
.insight {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition: background var(--dur) var(--ease-soft), border-color var(--dur) var(--ease-soft);
}
.insight:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.05);
}
.insight-text { font-size: 0.86rem; line-height: 1.4; }
.insight-why { font-size: 0.72rem; color: var(--text-faint); }
.insight-meta {
  font-size: 0.66rem;
  color: var(--text-faint);
  opacity: 0.85;
}
.drawer-empty {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  text-align: center;
  padding: 2.25rem 1rem;
  color: var(--text-faint);
}
.drawer-empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.drawer-empty-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
}
.drawer-empty-body {
  font-size: 0.74rem;
  line-height: 1.45;
  max-width: 26ch;
}

.side-hidden-controls { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .hero-particles,
  .hero-logo {
    animation: none !important;
  }
  .drawer,
  .icon-btn,
  .composer,
  .home-card,
  .qa-card,
  .chip,
  .side-collapse-body,
  .side-collapse-chevron {
    transition-duration: 0.01ms !important;
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .home-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-access-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--toolbar-h);
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 88vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .toolbar { grid-template-columns: auto 1fr auto; }
  .brand { display: none; }
}

@media (max-width: 720px) {
  .home-cards { grid-template-columns: 1fr; }
  .quick-access-row { grid-template-columns: 1fr; }
  .welcome-title { font-size: 1.65rem; }
  .live-label { display: none; }
}
