:root {
  color-scheme: light;
  --brand: #087f8c;
  --brand-strong: #075d68;
  --brand-soft: #e1f3f3;
  --blue: #1265a8;
  --violet: #6d4cf5;
  --bg: #f7fafc;
  --surface: #ffffff;
  --surface-soft: #eef6f7;
  --surface-raised: #ffffff;
  --text: #17324d;
  --text-strong: #0c263f;
  --muted: #5f7182;
  --line: #dce6eb;
  --line-strong: #cbd9e1;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --sidebar: #071a28;
  --sidebar-surface: #0d2637;
  --sidebar-line: rgba(255, 255, 255, .1);
  --sidebar-text: #dbe8ef;
  --shadow-sm: 0 2px 8px rgba(13, 42, 61, .06);
  --shadow-md: 0 16px 48px rgba(13, 42, 61, .1);
  --radius-sm: .65rem;
  --radius: 1rem;
  --radius-lg: 1.4rem;
  --sidebar-width: 17.5rem;
  --topbar-height: 4.75rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08141f;
  --surface: #102332;
  --surface-soft: #122a3b;
  --surface-raised: #142d3f;
  --text: #dbe8ef;
  --text-strong: #f2f8fb;
  --muted: #9cb0bd;
  --line: #243c4b;
  --line-strong: #345365;
  --brand: #4cc7c7;
  --brand-strong: #78dcdc;
  --brand-soft: rgba(76, 199, 199, .12);
  --blue: #62aee8;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, .18);
  --shadow-md: 0 20px 55px rgba(0, 0, 0, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 20rem; background: var(--bg); scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-size: .9375rem; line-height: 1.55; }
body.is-drawer-open { overflow: hidden; }
button, input, textarea, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
a { color: var(--brand-strong); }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 999; top: .5rem; left: .5rem; transform: translateY(-150%); border-radius: .5rem; background: var(--surface); padding: .65rem .85rem; box-shadow: var(--shadow-md); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 65%, transparent); outline-offset: 2px; }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; overflow: hidden; border-right: 1px solid var(--sidebar-line); background: radial-gradient(circle at 10% 3%, rgba(31, 174, 211, .2), transparent 27%), linear-gradient(165deg, #092132 0%, var(--sidebar) 58%, #07131e 100%); color: var(--sidebar-text); transition: width .22s ease, transform .22s ease; }
.sidebar__brand { background-color: white; position: relative; display: flex; min-height: 6rem; align-items: center; justify-content: center; border-bottom: 1px solid var(--sidebar-line); padding: .75rem 1rem; }
.sidebar__brand img { width: 100%; object-fit: cover; object-position: center; border-radius: .65rem; filter: saturate(.94) contrast(1.04); }
.icon-button.sidebar__mobile-close { display: none; position: absolute; top: .65rem; right: .65rem; color: white; }
.icon-button { display: inline-grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 0; border-radius: .7rem; background: transparent; }
.icon-button:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.icon-button svg { width: 1.25rem; height: 1.25rem; }
.new-chat { display: flex; min-height: 2.85rem; align-items: center; justify-content: center; gap: .65rem; margin: 1rem .9rem .75rem; border: 1px solid rgba(76, 199, 199, .35); border-radius: .8rem; background: linear-gradient(135deg, rgba(76, 199, 199, .18), rgba(58, 108, 221, .14)); color: #efffff; font-weight: 750; transition: transform .18s ease, background .18s ease; }
.new-chat:hover { transform: translateY(-1px); background: linear-gradient(135deg, rgba(76, 199, 199, .28), rgba(58, 108, 221, .22)); }
.new-chat svg { width: 1.1rem; }
.main-nav { display: grid; gap: .25rem; padding: .3rem .75rem; }
.main-nav button, .sidebar__footer a, .sidebar__footer button { display: flex; width: 100%; min-height: 2.75rem; align-items: center; gap: .75rem; border: 0; border-radius: .7rem; background: transparent; color: #bcd0dc; padding: .55rem .75rem; text-align: left; text-decoration: none; transition: background .15s ease, color .15s ease; }
.main-nav button:hover, .sidebar__footer a:hover, .sidebar__footer button:hover { background: rgba(255, 255, 255, .065); color: #fff; }
.main-nav button.is-active { background: linear-gradient(90deg, rgba(76, 199, 199, .18), rgba(76, 199, 199, .06)); color: #fff; box-shadow: inset 3px 0 #4cc7c7; }
.main-nav svg, .sidebar__footer svg { width: 1.18rem; height: 1.18rem; flex: 0 0 auto; }
.main-nav span { font-weight: 680; }
.recents { min-height: 0; flex: 1; padding: 1rem .75rem; }
.recents h2 { margin: 0 .7rem .55rem; color: #7891a0; font-size: .69rem; letter-spacing: .11em; text-transform: uppercase; }
.recents__list { display: grid; max-height: 100%; gap: .1rem; overflow: auto; scrollbar-width: thin; }
.recents__list button { display: flex; min-width: 0; align-items: center; gap: .6rem; border: 0; border-radius: .65rem; background: transparent; color: #9db2bf; padding: .55rem .7rem; text-align: left; }
.recents__list button:hover, .recents__list button.is-active { background: rgba(255, 255, 255, .055); color: #edf7fb; }
.recents__list button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recents__list svg { width: .95rem; flex: 0 0 auto; }
.recents__empty { margin: .5rem .7rem; color: #6f8795; font-size: .8rem; }
.sidebar__footer { display: grid; gap: .12rem; border-top: 1px solid var(--sidebar-line); padding: .7rem .75rem .9rem; }
.sidebar--collapsed { width: 5.2rem; }
.sidebar--collapsed .sidebar__brand { padding: .7rem; }
.sidebar--collapsed .sidebar__brand img { width: 3.6rem; object-fit: cover; object-position: 8% center; }
.sidebar--collapsed span, .sidebar--collapsed .recents { display: none; }
.sidebar--collapsed .new-chat { margin-inline: .72rem; }
.sidebar--collapsed .main-nav button, .sidebar--collapsed .sidebar__footer a, .sidebar--collapsed .sidebar__footer button { justify-content: center; padding-inline: .5rem; }

.workspace { grid-column: 2; min-width: 0; transition: margin .22s ease; }
.app-shell:has(.sidebar--collapsed) { grid-template-columns: 5.2rem minmax(0, 1fr); }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; min-height: var(--topbar-height); align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); padding: .65rem 1.4rem; backdrop-filter: blur(14px); }
.topbar__start { display: flex; align-items: center; gap: .75rem; }
.topbar__start > div { display: grid; line-height: 1.25; }
.topbar__eyebrow { color: var(--brand-strong); font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.topbar__start strong { color: var(--text-strong); font-size: .96rem; }
.mobile-menu { display: none; }
.topbar__actions { display: flex; align-items: center; gap: .75rem; }
.context-select { display: flex; align-items: center; gap: .5rem; }
.context-select span { color: var(--muted); font-size: .74rem; font-weight: 700; }
.context-select select, .type-filter select { max-width: 13rem; height: 2.45rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); padding: 0 2rem 0 .75rem; }
.status-chip { display: flex; height: 2.35rem; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 0 .75rem; font-size: .74rem; font-weight: 680; }
.status-chip i { width: .48rem; height: .48rem; border-radius: 50%; background: #d0d5dd; box-shadow: 0 0 0 3px color-mix(in srgb, #d0d5dd 20%, transparent); }
.status-chip.is-up i { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .14); }
.status-chip.is-warning i { background: #f79009; box-shadow: 0 0 0 3px rgba(247, 144, 9, .14); }
.status-chip.is-down i { background: #f04438; box-shadow: 0 0 0 3px rgba(240, 68, 56, .14); }

.views, .view { min-height: calc(100vh - var(--topbar-height)); }
.view--chat { background: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 30%), var(--bg); }
.chat-empty { display: flex; min-height: calc(100vh - var(--topbar-height)); flex-direction: column; align-items: center; justify-content: center; padding: 2.25rem clamp(1rem, 3vw, 2.5rem) 1.5rem; }
.chat-hero { text-align: center; }
.avatar-orbit { position: relative; width: 8rem; height: 8rem; margin: 0 auto 1.15rem; }
.avatar-orbit span { position: absolute; z-index: 2; inset: .45rem; overflow: hidden; border: 3px solid color-mix(in srgb, var(--brand) 58%, #fff); border-radius: 50%; background: #071523; box-shadow: 0 18px 40px rgba(20, 82, 126, .24), 0 0 0 8px color-mix(in srgb, var(--brand) 8%, transparent); }
.avatar-orbit img { width: 100%; height: 100%; object-fit: cover; object-position: center 19%; transform: scale(1.22); }
.avatar-orbit > i { position: absolute; inset: 0; border: 1px solid color-mix(in srgb, var(--brand) 42%, transparent); border-radius: 50%; transform: rotate(-22deg) scaleY(.48); }
.avatar-orbit > b { position: absolute; z-index: 3; top: 54%; left: -.12rem; width: .75rem; height: .75rem; border: 2px solid var(--surface); border-radius: 50%; background: #48d7e3; box-shadow: 0 0 16px #48d7e3; }
.eyebrow { margin: 0 0 .65rem; color: var(--brand-strong); font-size: .72rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.chat-hero h1 { margin: 0; color: var(--text-strong); font-size: clamp(2rem, 5vw, 3.35rem); letter-spacing: -.045em; line-height: 1.05; }
.chat-hero > p:last-child { margin: .65rem 0 1.6rem; color: var(--muted); font-size: 1.03rem; }
.composer { width: min(50rem, 100%); border: 1px solid var(--line-strong); border-radius: 1.15rem; background: var(--surface); box-shadow: var(--shadow-md); transition: border-color .15s ease, box-shadow .15s ease; }
.composer:focus-within { border-color: color-mix(in srgb, var(--brand) 70%, var(--line)); box-shadow: 0 18px 50px rgba(8, 127, 140, .12), 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent); }
.composer textarea { display: block; width: 100%; min-height: 4.1rem; max-height: 11rem; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--text-strong); padding: 1rem 1.05rem .5rem; line-height: 1.55; }
.composer textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.composer__footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem .55rem .55rem 1.05rem; }
.composer__footer > span { color: var(--muted); font-size: .69rem; }
.send-button { display: inline-grid; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; place-items: center; border: 0; border-radius: .75rem; background: linear-gradient(135deg, var(--brand), var(--blue)); color: white; box-shadow: 0 6px 16px rgba(8, 127, 140, .23); }
.send-button svg { width: 1.12rem; }
.suggestions { display: grid; width: min(58rem, 100%); grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; margin-top: 1rem; }
.suggestions button { display: flex; min-height: 6.8rem; align-items: flex-start; gap: .7rem; border: 1px solid var(--line); border-radius: .9rem; background: color-mix(in srgb, var(--surface) 90%, transparent); padding: .85rem; color: var(--text); text-align: left; transition: border .15s ease, transform .15s ease, box-shadow .15s ease; }
.suggestions button:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: var(--shadow-sm); }
.suggestions button > svg { width: 1.1rem; flex: 0 0 auto; color: var(--brand-strong); }
.suggestions button span { display: grid; gap: .3rem; }
.suggestions strong { color: var(--text-strong); font-size: .82rem; line-height: 1.3; }
.suggestions small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.disclaimer { margin: .75rem 0 0; color: var(--muted); font-size: .68rem; text-align: center; }

.conversation { display: flex; min-height: calc(100vh - var(--topbar-height)); flex-direction: column; }
.conversation__messages { width: min(56rem, 100%); flex: 1; margin: 0 auto; padding: 2rem 1.5rem 11.5rem; }
.conversation__bottom { position: fixed; z-index: 20; right: 0; bottom: 0; left: var(--sidebar-width); display: grid; justify-items: center; background: linear-gradient(0deg, var(--bg) 70%, transparent); padding: 2.5rem 1.5rem .75rem; transition: left .22s ease; }
.app-shell:has(.sidebar--collapsed) .conversation__bottom { left: 5.2rem; }
.message { display: flex; gap: .85rem; margin: 0 0 1.8rem; }
.message--user { justify-content: flex-end; }
.message__avatar { width: 2.65rem; height: 2.65rem; flex: 0 0 auto; overflow: hidden; border: 2px solid color-mix(in srgb, var(--brand) 46%, var(--line)); border-radius: 50%; background: #071523; }
.message__avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; transform: scale(1.3); }
.user-avatar { display: grid; width: 2.4rem; height: 2.4rem; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--text-strong); color: var(--surface); font-size: .65rem; font-weight: 750; }
.message__body { min-width: 0; max-width: calc(100% - 3.5rem); }
.message--user .message__body { max-width: min(38rem, calc(100% - 3.4rem)); border-radius: 1.05rem 1.05rem .25rem 1.05rem; background: color-mix(in srgb, var(--brand) 11%, var(--surface)); padding: .8rem 1rem; }
.message--user p { margin: 0; white-space: pre-wrap; }
.message--assistant .message__body { flex: 1; }
.message--error .message__body { border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line)); border-radius: .85rem; background: color-mix(in srgb, var(--danger) 5%, var(--surface)); padding: .75rem 1rem; color: var(--danger); }
.grounded-badge { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .7rem; border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--line)); border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); padding: .22rem .55rem; font-size: .66rem; font-weight: 760; }
.grounded-badge::before { content: ""; width: .36rem; height: .36rem; border-radius: 50%; background: var(--brand); }
.message-actions { display: flex; gap: .35rem; margin-top: .75rem; }
.message-actions button { display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: .5rem; background: transparent; color: var(--muted); padding: .35rem .5rem; font-size: .7rem; }
.message-actions button:hover { background: var(--surface-soft); color: var(--text); }
.message-actions svg { width: .9rem; }
.thinking { display: flex; align-items: center; gap: .7rem; padding-top: .35rem; color: var(--muted); }
.thinking__dots { display: flex; gap: .25rem; }
.thinking__dots i { width: .42rem; height: .42rem; border-radius: 50%; background: var(--brand); animation: bounce 1.1s infinite ease-in-out; }
.thinking__dots i:nth-child(2) { animation-delay: .14s; }
.thinking__dots i:nth-child(3) { animation-delay: .28s; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .38; } 35% { transform: translateY(-.3rem); opacity: 1; } }

.markdown { color: var(--text); font-size: .94rem; line-height: 1.68; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3 { color: var(--text-strong); line-height: 1.25; }
.markdown h1 { margin: 1.6rem 0 .8rem; font-size: 1.45rem; }
.markdown h2 { margin: 1.5rem 0 .65rem; font-size: 1.17rem; }
.markdown h3 { margin: 1.25rem 0 .55rem; font-size: 1rem; }
.markdown p { margin: .7rem 0; }
.markdown ul, .markdown ol { padding-left: 1.45rem; }
.markdown li + li { margin-top: .35rem; }
.markdown a { color: var(--blue); text-underline-offset: .15rem; }
.markdown blockquote { margin: 1rem 0; border-left: 3px solid var(--brand); background: var(--brand-soft); padding: .5rem .9rem; color: var(--muted); }
.markdown code:not(pre code) { border: 1px solid var(--line); border-radius: .35rem; background: var(--surface-soft); padding: .1rem .32rem; color: var(--text-strong); font-family: "Cascadia Code", Consolas, monospace; font-size: .86em; }
.markdown table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1rem 0; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; }
.markdown th { background: var(--surface-soft); color: var(--text-strong); }
.code-block { position: relative; overflow: hidden; margin: 1rem 0; border: 1px solid #243a4b; border-radius: .85rem; background: #07131e; }
.code-block pre { overflow-x: auto; margin: 0; padding: 2.6rem 1rem 1rem; color: #d7e8f2; font-family: "Cascadia Code", Consolas, monospace; font-size: .83rem; line-height: 1.6; }
.code-copy { position: absolute; z-index: 2; top: .45rem; right: .45rem; display: inline-flex; align-items: center; gap: .3rem; border: 1px solid rgba(255, 255, 255, .12); border-radius: .45rem; background: rgba(255, 255, 255, .06); color: #b9ceda; padding: .3rem .5rem; font-size: .66rem; }
.sources { margin-top: 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: color-mix(in srgb, var(--surface-soft) 55%, transparent); }
.sources summary { display: flex; align-items: center; gap: .5rem; padding: .7rem .8rem; color: var(--text-strong); font-size: .77rem; font-weight: 750; list-style: none; cursor: pointer; }
.sources summary::-webkit-details-marker { display: none; }
.sources summary span { margin-left: auto; border-radius: 999px; background: var(--surface); padding: .08rem .42rem; color: var(--muted); font-size: .65rem; }
.sources__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; border-top: 1px solid var(--line); padding: .65rem; }
.source-card { position: relative; display: grid; gap: .2rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); color: inherit; padding: .7rem; text-decoration: none; }
.source-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.source-card strong { display: flex; align-items: center; gap: .4rem; color: var(--text-strong); font-size: .74rem; }
.source-card strong i { color: var(--brand-strong); font-size: .62rem; font-style: normal; }
.source-card > span { color: var(--muted); font-size: .65rem; }
.source-card p { display: -webkit-box; overflow: hidden; margin: .25rem 0 0; color: var(--muted); font-size: .68rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.source-card > svg { position: absolute; top: .7rem; right: .7rem; width: .8rem; color: var(--muted); }

.page-view { background: var(--bg); }
.page-container { width: min(73rem, 100%); margin: 0 auto; padding: clamp(2rem, 4vw, 3.6rem) clamp(1rem, 3vw, 2rem) 4rem; }
.page-heading { max-width: 47rem; margin-bottom: 1.8rem; }
.page-heading h1 { margin: 0; color: var(--text-strong); font-size: clamp(1.75rem, 3vw, 2.55rem); letter-spacing: -.035em; line-height: 1.12; }
.page-heading > p:last-child, .page-heading > div > p:last-child { margin: .7rem 0 0; color: var(--muted); font-size: 1rem; }
.page-heading--split { display: flex; max-width: none; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.secondary-button { display: inline-flex; min-height: 2.65rem; flex: 0 0 auto; align-items: center; gap: .5rem; border: 1px solid var(--line-strong); border-radius: .7rem; background: var(--surface); color: var(--text-strong); padding: .55rem .8rem; font-weight: 700; }
.secondary-button:hover { border-color: var(--brand); color: var(--brand-strong); }
.secondary-button svg { width: 1rem; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) 13rem; gap: .8rem; align-items: end; margin-bottom: 1.5rem; }
.search-field { display: flex; min-height: 3.5rem; align-items: center; gap: .65rem; border: 1px solid var(--line-strong); border-radius: .9rem; background: var(--surface); padding: .4rem .45rem .4rem 1rem; box-shadow: var(--shadow-sm); }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-field > i svg { width: 1.1rem; color: var(--muted); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.search-field button { height: 2.65rem; border: 0; border-radius: .65rem; background: var(--brand-strong); color: #fff; padding: 0 1.15rem; font-weight: 750; }
.type-filter { display: grid; gap: .35rem; }
.type-filter span { color: var(--muted); font-size: .7rem; font-weight: 700; }
.type-filter select { width: 100%; max-width: none; height: 3.5rem; border-radius: .9rem; }
.empty-panel { display: grid; min-height: 20rem; place-items: center; align-content: center; border: 1px dashed var(--line-strong); border-radius: 1.1rem; background: color-mix(in srgb, var(--surface) 55%, transparent); padding: 2rem; text-align: center; }
.empty-panel > span { display: grid; width: 3.5rem; height: 3.5rem; place-items: center; border-radius: 1rem; background: var(--brand-soft); color: var(--brand-strong); }
.empty-panel svg { width: 1.45rem; }
.empty-panel h2 { margin: .9rem 0 .3rem; color: var(--text-strong); font-size: 1.05rem; }
.empty-panel p { max-width: 28rem; margin: 0; color: var(--muted); }
.result-header { display: flex; align-items: center; justify-content: space-between; margin: .4rem 0 .8rem; color: var(--muted); font-size: .78rem; }
.result-header strong { color: var(--text-strong); }
.search-results { display: grid; gap: .7rem; }
.search-result { position: relative; display: grid; grid-template-columns: 2.65rem minmax(0, 1fr) auto; gap: .85rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); padding: 1rem; box-shadow: var(--shadow-sm); }
.search-result__icon { display: grid; width: 2.65rem; height: 2.65rem; place-items: center; border-radius: .7rem; background: var(--brand-soft); color: var(--brand-strong); }
.search-result__icon svg { width: 1.2rem; }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .25rem; }
.result-meta span, .result-meta b { border-radius: 999px; padding: .14rem .46rem; font-size: .62rem; }
.result-meta span { background: var(--brand-soft); color: var(--brand-strong); font-weight: 750; }
.result-meta b { background: var(--surface-soft); color: var(--muted); }
.result-meta small { color: var(--muted); font-size: .63rem; }
.search-result h2 { margin: .2rem 0 0; color: var(--text-strong); font-size: 1rem; }
.search-result h3 { margin: .12rem 0 .4rem; color: var(--brand-strong); font-size: .76rem; font-weight: 700; }
.search-result p { margin: 0; color: var(--muted); font-size: .8rem; }
.search-result code { display: block; overflow: hidden; margin-top: .5rem; color: color-mix(in srgb, var(--muted) 80%, transparent); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.search-result > a { color: var(--muted); padding: .3rem; }
.search-result > a svg { width: 1rem; }
.skeleton-list { display: grid; gap: .7rem; }
.skeleton { height: 8.5rem; border: 1px solid var(--line); border-radius: .9rem; background: linear-gradient(100deg, var(--surface) 20%, var(--surface-soft) 40%, var(--surface) 60%); background-size: 220% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position-x: -220%; } }
.inline-error { border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line)); border-radius: .85rem; background: color-mix(in srgb, var(--danger) 6%, var(--surface)); color: var(--danger); padding: .8rem 1rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.metric-card { border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); padding: 1rem; box-shadow: var(--shadow-sm); }
.metric-card span { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .7rem; font-weight: 680; }
.metric-card span svg { width: .9rem; color: var(--brand-strong); }
.metric-card strong { display: block; margin-top: .4rem; color: var(--text-strong); font-size: 1.65rem; line-height: 1; }
.metric-card small { color: var(--muted); font-size: .66rem; }
.knowledge-panel { margin-top: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.section-heading h2 { margin: 0; color: var(--text-strong); font-size: 1rem; }
.section-heading p { margin: .18rem 0 0; color: var(--muted); font-size: .75rem; }
.section-heading > span { border-radius: 999px; background: var(--surface-soft); color: var(--muted); padding: .25rem .55rem; font-size: .66rem; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.project-card { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: .75rem; border: 1px solid var(--line); border-radius: .8rem; background: color-mix(in srgb, var(--surface-soft) 45%, var(--surface)); padding: .8rem; }
.project-card__mark { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; border-radius: .7rem; background: linear-gradient(135deg, var(--brand), var(--blue)); color: white; font-weight: 850; }
.project-card h3 { overflow: hidden; margin: 0; color: var(--text-strong); font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.project-card p { display: flex; gap: .55rem; margin: .25rem 0; color: var(--muted); font-size: .68rem; }
.project-card small { color: var(--muted); font-size: .62rem; }
.health-panel dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.health-panel dl > div { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem; border-bottom: 1px solid var(--line); padding: .65rem .75rem; }
.health-panel dl > div:nth-child(odd) { border-right: 1px solid var(--line); }
.health-panel dt { color: var(--muted); font-size: .7rem; }
.health-panel dd { overflow-wrap: anywhere; margin: 0; color: var(--text-strong); font-size: .72rem; font-weight: 650; }
.toast-region { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; width: min(23rem, calc(100vw - 2rem)); gap: .5rem; }
.toast { animation: toast-in .22s ease; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: .75rem; background: var(--surface-raised); color: var(--text); padding: .75rem .85rem; box-shadow: var(--shadow-md); }
.toast.is-error { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(.5rem); opacity: 0; } }

@media (max-width: 75rem) {
  .suggestions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .suggestions button:nth-child(n+4) { display: none; }
}

@media (max-width: 64rem) {
  :root { --sidebar-width: 16rem; }
  .context-select span { display: none; }
  .status-chip span { display: none; }
  .status-chip { width: 2.35rem; justify-content: center; padding: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 48rem) {
  .app-shell, .app-shell:has(.sidebar--collapsed) { display: block; }
  .workspace { grid-column: auto; }
  .sidebar, .sidebar--collapsed { width: min(19rem, 88vw); transform: translateX(-105%); box-shadow: var(--shadow-md); }
  .sidebar.is-mobile-open { transform: translateX(0); }
  .sidebar--collapsed span, .sidebar--collapsed .recents { display: initial; }
  .sidebar--collapsed .sidebar__brand { padding: .75rem 1rem; }
  .sidebar--collapsed .sidebar__brand img { width: 100%; object-position: center; }
  .sidebar--collapsed .main-nav button, .sidebar--collapsed .sidebar__footer a, .sidebar--collapsed .sidebar__footer button { justify-content: flex-start; padding-inline: .75rem; }
  .icon-button.sidebar__mobile-close { display: inline-grid; background: rgba(0, 0, 0, .3); }
  .sidebar-backdrop { position: fixed; z-index: 45; inset: 0; display: block; border: 0; background: rgba(2, 12, 20, .56); backdrop-filter: blur(2px); }
  .desktop-only { display: none !important; }
  .mobile-menu { display: inline-grid; }
  .topbar { min-height: 4.25rem; padding: .55rem .75rem; }
  .topbar__start strong { font-size: .85rem; }
  .context-select select { max-width: 9.5rem; }
  .conversation__bottom, .app-shell:has(.sidebar--collapsed) .conversation__bottom { left: 0; padding-inline: .8rem; }
  .conversation__messages { padding: 1.35rem .9rem 11.5rem; }
  .message__body { max-width: calc(100% - 3rem); }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button { min-height: auto; }
  .suggestions button:nth-child(n+3) { display: none; }
  .chat-empty { justify-content: flex-start; padding-top: 2rem; }
  .avatar-orbit { width: 6.5rem; height: 6.5rem; }
  .composer__footer > span { display: none; }
  .composer__footer { justify-content: flex-end; }
  .sources__list { grid-template-columns: 1fr; }
  .search-form { grid-template-columns: 1fr; }
  .search-field { min-height: 3.2rem; }
  .type-filter select { height: 3.2rem; }
  .page-heading--split { align-items: flex-start; }
  .project-grid { grid-template-columns: 1fr; }
  .health-panel dl { grid-template-columns: 1fr; }
  .health-panel dl > div:nth-child(odd) { border-right: 0; }
}

@media (max-width: 35rem) {
  .topbar__eyebrow { display: none; }
  .topbar__actions { gap: .35rem; }
  .context-select select { width: 8.4rem; font-size: .75rem; }
  .chat-hero h1 { font-size: 2rem; }
  .chat-hero > p:last-child { font-size: .9rem; }
  .page-container { padding-top: 2rem; }
  .page-heading--split { flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .search-result { grid-template-columns: 2.3rem minmax(0, 1fr); }
  .search-result > a { position: absolute; top: .7rem; right: .7rem; }
  .health-panel dl > div { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
