:root {
  --bg: #0d0d0d;
  --bg-soft: #121212;
  --sidebar: #171717;
  --panel: rgba(20, 20, 20, 0.88);
  --panel-solid: #151515;
  --panel-hover: #202020;
  --border: #2a2a2a;
  --border-soft: rgba(255,255,255,.08);
  --text: #ececec;
  --muted: #9b9b9b;
  --faint: #6f6f6f;
  --accent: #2f80ed;
  --accent-2: #39d7ff;
  --accent-soft: rgba(47,128,237,.15);
  --green: #31d27c;
  --red: #ff6262;
  --orange: #f7a34b;
  --purple: #9b6cff;
  --sidebar-width: 280px;
  --topbar-height: 58px;
  --radius: 16px;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --background-dim: .65;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }
.mobile-only, .mobile-menu { display: none; }

.background-layer {
  position: fixed;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: calc(1 - var(--background-dim));
  filter: saturate(.9) contrast(1.05);
  pointer-events: none;
}
.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,8,8,.72), rgba(8,8,8,.93));
}

.app-shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar-width) minmax(0,1fr); height: 100%; }
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(23,23,23,.96);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(22px);
}
.sidebar-top { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; }
.new-chat-button {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #1e1e1e;
  color: var(--text);
  font-weight: 570;
  text-align: left;
}
.new-chat-button:hover { background: #242424; border-color: #363636; }
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 12px 8px;
  padding: 0 11px;
  height: 38px;
  border-radius: 10px;
  background: #111;
  border: 1px solid transparent;
  color: var(--muted);
}
.sidebar-search:focus-within { border-color: rgba(47,128,237,.6); box-shadow: 0 0 0 3px rgba(47,128,237,.12); }
.sidebar-search svg { width: 17px; height: 17px; }
.sidebar-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.primary-nav { padding: 4px 8px 7px; border-bottom: 1px solid var(--border-soft); }
.nav-item {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 9px;
  padding: 0 11px;
  background: transparent;
  color: #d4d4d4;
  text-align: left;
}
.nav-item:hover { background: #222; }
.nav-item.active { background: #292929; color: #fff; }
.nav-item svg { width: 18px; height: 18px; color: #b8b8b8; }
.nav-item.active svg { color: var(--accent-2); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: auto; box-shadow: 0 0 10px var(--green); }
.history-label { padding: 13px 16px 7px; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.conversation-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; scrollbar-width: thin; }
.conversation-item { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 9px; }
.conversation-item:hover, .conversation-item.active { background: #222; }
.conversation-title { flex: 1; min-width: 0; height: 38px; padding: 0 8px 0 10px; border: 0; background: transparent; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: #c8c8c8; }
.conversation-item.active .conversation-title { color: #fff; }
.conversation-menu { width: 32px; height: 32px; opacity: 0; }
.conversation-item:hover .conversation-menu, .conversation-item.active .conversation-menu { opacity: 1; }
.sidebar-footer { padding: 7px 8px 10px; border-top: 1px solid var(--border-soft); }
.account-row { margin-top: 6px; display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 10px; }
.account-row:hover { background: #222; }
.account-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg,#184e99,#2f80ed); font-size: 11px; font-weight: 800; }
.account-copy { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.account-copy strong { font-size: 13px; font-weight: 600; }
.account-copy span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 10px 0; color: var(--faint); font-size: 10px; letter-spacing: .035em; }
.version-row strong { color: #8b8b8b; font-weight: 600; }

.main-stage { min-width: 0; position: relative; display: flex; flex-direction: column; background: rgba(13,13,13,.94); }
.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(13,13,13,.88);
  backdrop-filter: blur(20px);
  z-index: 8;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 5px; font-weight: 630; }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(145deg,#173b74,#2f80ed); color: white; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 18px rgba(47,128,237,.25); }
.model-picker-wrap { min-width: 0; }
.model-select {
  max-width: 300px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #cfcfcf;
  padding: 0 28px 0 8px;
  outline: none;
}
.model-select:hover { background: #1c1c1c; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #bdbdbd; }
.icon-button:hover { background: #222; color: #fff; }
.connection-pill { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 999px; color: var(--muted); font-size: 12px; background: #181818; border: 1px solid var(--border); }
.connection-pill.online { color: #baf7d5; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(255,98,98,.08); flex: 0 0 auto; }
.status-dot.online, .connection-pill.online .status-dot { background: var(--green); box-shadow: 0 0 10px rgba(49,210,124,.8); }
.text-button { border: 0; background: transparent; color: var(--accent-2); padding: 8px 10px; border-radius: 8px; }
.text-button:hover { background: rgba(255,255,255,.06); }
.text-button.danger { color: #ff8a8a; }

.view { display: none; min-height: 0; flex: 1; }
.view.active { display: flex; }
.chat-view { position: relative; flex-direction: column; min-height: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 20px 200px; scrollbar-width: thin; }
.empty-state { min-height: calc(100vh - 260px); display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 820px; margin: 0 auto; text-align: center; }
.hero-orb { position: relative; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 23px; background: radial-gradient(circle at 30% 25%, #4deaff, #2f80ed 47%, #12305e 75%, #0b0b0b); box-shadow: 0 0 32px rgba(47,128,237,.35), inset 0 0 0 1px rgba(255,255,255,.16); font-size: 26px; font-weight: 900; }
.hero-orb i { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--green); border: 3px solid var(--bg); box-shadow: 0 0 12px var(--green); }
.empty-state h1 { font-size: clamp(28px,4vw,40px); letter-spacing: -.035em; margin: 24px 0 7px; font-weight: 650; }
.empty-state > p { margin: 0 0 30px; color: var(--muted); }
.suggestion-grid { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.suggestion { min-height: 72px; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--border); background: #151515; text-align: left; transition: border-color .15s, background .15s, transform .15s; }
.suggestion:hover { background: #1b1b1b; border-color: #414141; transform: translateY(-1px); }
.suggestion strong, .suggestion span { display: block; }
.suggestion strong { font-size: 14px; margin-bottom: 4px; }
.suggestion span { color: var(--muted); font-size: 12px; }
.message-list { max-width: 820px; margin: 0 auto; }
.message { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 14px; padding: 19px 0; }
.message.user { grid-template-columns: minmax(0,1fr); }
.message.user .message-content { justify-self: end; max-width: 78%; padding: 10px 14px; border-radius: 18px; background: #2a2a2a; }
.message-avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(145deg,#173b74,#2f80ed); font-size: 12px; font-weight: 800; }
.message-content { line-height: 1.65; min-width: 0; color: #e4e4e4; }
.message-content p { margin: 0 0 12px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content pre { overflow: auto; border-radius: 12px; padding: 14px; background: #0a0a0a; border: 1px solid #282828; }
.message-content code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .9em; background: #242424; padding: 2px 5px; border-radius: 5px; }
.message-content pre code { background: transparent; padding: 0; }
.message-citations { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.citation-chip { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: #171d26; border: 1px solid rgba(47,128,237,.35); color: #9ec8ff; font-size: 11px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-cursor::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; background: #d5d5d5; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-zone { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 20px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(13,13,13,0), rgba(13,13,13,.92) 25%, rgba(13,13,13,1) 65%); }
.composer { max-width: 820px; margin: 0 auto; border: 1px solid #3a3a3a; border-radius: 22px; background: #212121; box-shadow: 0 12px 50px rgba(0,0,0,.25); padding: 11px 11px 9px; }
.composer:focus-within { border-color: #515151; }
.composer textarea { width: 100%; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent; padding: 3px 7px 9px; line-height: 1.45; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-tools { display: flex; align-items: center; gap: 4px; }
.composer-button { min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; color: #bdbdbd; font-size: 12px; }
.composer-button:hover { background: #2b2b2b; color: #fff; }
.composer-button.active { color: #a9d0ff; background: rgba(47,128,237,.13); }
.composer-button.recording { color: #fff; background: rgba(255,98,98,.25); animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255,98,98,0); } }
.send-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #f3f3f3; color: #161616; }
.send-button:hover { background: #fff; }
.send-button svg { width: 17px; height: 17px; }
.composer-note { margin: 8px auto 0; max-width: 820px; color: var(--faint); text-align: center; font-size: 11px; }
.attachment-tray { max-width: 820px; margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.attachment-chip { display: flex; align-items: center; gap: 8px; max-width: 260px; padding: 7px 9px; border-radius: 10px; background: #242424; border: 1px solid #393939; font-size: 12px; }
.attachment-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content-view { flex-direction: column; overflow-y: auto; padding: 34px clamp(20px,4vw,58px) 70px; }
.content-header { max-width: 1420px; width: 100%; margin: 0 auto 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.content-header h1 { margin: 4px 0 6px; font-size: clamp(28px,4vw,40px); letter-spacing: -.035em; }
.content-header p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--accent-2); font-size: 11px; letter-spacing: .14em; font-weight: 800; }
.header-actions, .button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.primary-button, .outline-button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; padding: 0 14px; font-weight: 590; }
.primary-button { border: 1px solid #4f9dff; background: linear-gradient(180deg,#3588f3,#236bc7); color: #fff; box-shadow: inset 0 1px rgba(255,255,255,.13); }
.primary-button:hover { filter: brightness(1.07); }
.outline-button { border: 1px solid var(--border); background: #181818; color: #d9d9d9; }
.outline-button:hover { background: #202020; border-color: #414141; }
.outline-button svg, .primary-button svg { width: 17px; height: 17px; }
.metrics-grid { max-width: 1420px; width: 100%; margin: 0 auto 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.metric-card { min-height: 124px; padding: 18px; border-radius: 15px; border: 1px solid var(--border); background: linear-gradient(145deg,rgba(25,25,25,.95),rgba(16,16,16,.95)); box-shadow: inset 0 1px rgba(255,255,255,.02); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: 12px 0 4px; font-size: 30px; letter-spacing: -.04em; }
.dashboard-grid { max-width: 1420px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 15px; background: rgba(19,19,19,.92); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 18px 10px; }
.panel-head h2 { margin: 0 0 4px; font-size: 15px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; }
.chart-panel canvas { width: 100%; display: block; padding: 4px 10px 13px; }
.live-badge { display: flex; align-items: center; gap: 6px; color: #b9f7d3; font-size: 11px; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.flow-panel { grid-column: 1 / 2; }
.flow-map { min-height: 330px; display: grid; grid-template-columns: minmax(150px,1fr) 120px minmax(150px,1fr); align-items: center; gap: 28px; padding: 24px; position: relative; }
.flow-column { display: flex; flex-direction: column; gap: 9px; }
.flow-node { position: relative; padding: 10px 12px; border-radius: 10px; border: 1px solid #303846; background: #131923; color: #c7d8ee; font-size: 12px; }
.flow-node::after { content: ""; position: absolute; top: 50%; width: 30px; height: 1px; background: linear-gradient(90deg,var(--accent),transparent); }
.flow-column.left .flow-node::after { right: -31px; }
.flow-column.right .flow-node::after { left: -31px; transform: rotate(180deg); }
.flow-engine { width: 112px; height: 112px; display: grid; place-items: center; justify-self: center; border-radius: 28px; border: 1px solid rgba(47,128,237,.85); background: radial-gradient(circle at 30% 20%,#245da7,#101b2b 60%,#0b0b0b); box-shadow: 0 0 36px rgba(47,128,237,.22), inset 0 0 0 1px rgba(255,255,255,.05); font-size: 27px; font-weight: 900; }
.source-health-panel { grid-column: 2 / 3; grid-row: 2; }
.health-list { padding: 5px 14px 16px; }
.health-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border-soft); }
.health-row:last-child { border-bottom: 0; }
.health-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.health-row.error i { background: var(--red); }
.health-row strong { display: block; font-size: 13px; }
.health-row span { color: var(--muted); font-size: 11px; }

.source-summary { max-width: 1420px; width: 100%; margin: 0 auto 12px; color: var(--muted); font-size: 13px; }
.source-list { max-width: 1420px; width: 100%; margin: 0 auto; display: grid; gap: 10px; }
.source-card { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 15px 16px; border: 1px solid var(--border); border-radius: 13px; background: rgba(20,20,20,.92); }
.source-card:hover { border-color: #3b3b3b; }
.source-state { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(49,210,124,.55); }
.source-card.error .source-state { background: var(--red); box-shadow: none; }
.source-copy { min-width: 0; }
.source-copy strong { display: block; margin-bottom: 4px; }
.source-copy p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-copy small { display: block; color: var(--faint); margin-top: 5px; }
.source-actions { display: flex; align-items: center; gap: 5px; }
.source-actions button { min-height: 34px; }
.file-grid { max-width: 1420px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 12px; }
.file-card { min-height: 150px; padding: 18px; border-radius: 14px; border: 1px solid var(--border); background: rgba(20,20,20,.9); }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: #8ac0ff; margin-bottom: 22px; }
.file-card strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.empty-card { padding: 32px; border: 1px dashed #353535; border-radius: 14px; color: var(--muted); text-align: center; }

.settings-layout { max-width: 1120px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.settings-card { padding: 20px; border: 1px solid var(--border); border-radius: 15px; background: rgba(20,20,20,.93); }
.settings-card h2 { margin: 0 0 18px; font-size: 16px; }
label { display: block; color: #d4d4d4; font-size: 13px; margin-bottom: 14px; }
input, textarea, select { width: 100%; border: 1px solid #333; border-radius: 10px; outline: 0; background: #111; padding: 10px 11px; margin-top: 7px; }
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
input:focus, textarea:focus, select:focus { border-color: rgba(47,128,237,.8); box-shadow: 0 0 0 3px rgba(47,128,237,.12); }
input[type="range"] { padding: 0; border: 0; box-shadow: none; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.5; margin: -5px 0 14px; }
.background-preview { height: 130px; border-radius: 13px; border: 1px solid #333; background: linear-gradient(145deg,#151515,#090909); background-size: cover; background-position: center; display: grid; place-items: center; margin-bottom: 12px; overflow: hidden; }
.background-preview span { padding: 5px 9px; border-radius: 8px; background: rgba(0,0,0,.65); color: #d2d2d2; font-size: 12px; }
.security-card code { color: #9ec8ff; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--border-soft); color: var(--muted); }
.status-row strong { color: var(--green); font-size: 12px; }
.settings-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 4px; }

.floating-orb { position: fixed; z-index: 22; right: 20px; bottom: 20px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(102,214,255,.9); background: radial-gradient(circle at 30% 20%,#55edff,#2f80ed 45%,#12305d 75%,#080808); color: #fff; box-shadow: 0 0 24px rgba(47,128,237,.55), inset 0 0 0 2px rgba(255,255,255,.08); font-weight: 900; }
.floating-orb i { position: absolute; right: -1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid #0d0d0d; box-shadow: 0 0 8px var(--green); }
.floating-orb.offline i { background: var(--red); box-shadow: none; }

.modal { width: min(620px, calc(100vw - 30px)); max-height: min(850px, calc(100vh - 30px)); padding: 0; border-radius: 18px; border: 1px solid #343434; background: #141414; color: var(--text); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.modal form { display: flex; flex-direction: column; max-height: inherit; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 4px 0 0; font-size: 20px; }
.modal-body { overflow-y: auto; padding: 18px 20px 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.inline-check { display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; margin: 0; }
.toast-stack { position: fixed; z-index: 60; top: 72px; right: 18px; display: grid; gap: 8px; width: min(380px,calc(100vw - 36px)); }
.toast { padding: 12px 14px; border-radius: 11px; background: #202020; border: 1px solid #3a3a3a; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { border-color: rgba(255,98,98,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .flow-panel, .source-health-panel { grid-column: 1; grid-row: auto; }
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 54px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(88vw,310px); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; background: rgba(0,0,0,.64); }
  .sidebar-backdrop.show { display: block; }
  .mobile-only, .mobile-menu { display: grid; }
  .topbar { padding: 0 8px; }
  .brand-button span:last-child { display: none; }
  .model-select { max-width: 175px; font-size: 13px; }
  .connection-pill { padding: 0 7px; }
  .connection-pill span:last-child { display: none; }
  .topbar-right { gap: 2px; }
  .chat-scroll { padding: 18px 14px 190px; }
  .empty-state { min-height: calc(100vh - 235px); }
  .empty-state h1 { font-size: 29px; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .suggestion:nth-child(n+3) { display: none; }
  .message { gap: 10px; }
  .message.user .message-content { max-width: 88%; }
  .composer-zone { padding: 20px 10px max(9px,env(safe-area-inset-bottom)); }
  .composer { border-radius: 20px; }
  .composer-note { display: none; }
  .content-view { padding: 24px 13px 70px; }
  .content-header { align-items: flex-start; flex-direction: column; }
  .content-header h1 { font-size: 31px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric-card { min-height: 110px; padding: 14px; }
  .metric-card strong { font-size: 26px; }
  .dashboard-grid { gap: 8px; }
  .flow-map { grid-template-columns: 1fr; gap: 15px; }
  .flow-node::after { display: none; }
  .source-card { grid-template-columns: 10px minmax(0,1fr); }
  .source-actions { grid-column: 2; justify-content: flex-start; }
  .file-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .floating-orb { display: none; }
}

@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 105px; }
  .composer-button span { display: none; }
  .model-select { max-width: 135px; }
}
