:root {
    color-scheme: dark;
    --bg: #070812;
    --bg-deep: #04050b;
    --surface: rgba(18, 21, 38, .82);
    --surface-solid: #121526;
    --surface-raised: #181c31;
    --surface-soft: rgba(255, 255, 255, .035);
    --line: rgba(168, 181, 255, .14);
    --line-strong: rgba(168, 181, 255, .26);
    --text: #f4f6ff;
    --text-soft: #a9b1c9;
    --text-faint: #707991;
    --violet: #8b7cff;
    --violet-strong: #715cff;
    --cyan: #4ddcff;
    --green: #38df8b;
    --amber: #ffbc5c;
    --red: #ff667d;
    --sidebar: 274px;
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, .42), 0 1px 0 rgba(255, 255, 255, .04) inset;
    --shadow-glow: 0 0 0 1px rgba(139, 124, 255, .16), 0 18px 55px rgba(44, 33, 104, .24);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg-deep); }
body { min-height: 100vh; margin: 0; color: var(--text); background:
    radial-gradient(circle at 76% -10%, rgba(113, 92, 255, .18), transparent 34rem),
    radial-gradient(circle at 16% 88%, rgba(77, 220, 255, .08), transparent 30rem), var(--bg);
    font: 400 15px/1.55 "IBM Plex Sans", system-ui, sans-serif; overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .28; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(circle at 50% 30%, #000, transparent 74%); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.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; }
::selection { color: #fff; background: rgba(139,124,255,.55); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: rgba(169,177,201,.28); background-clip: padding-box; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font: 600 .66rem/1.2 "JetBrains Mono", monospace; letter-spacing: .16em; text-transform: uppercase; }
label { display: block; margin: 18px 0 7px; color: #dce1f2; font-weight: 600; font-size: .84rem; }
label span { color: var(--text-faint); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 46px; padding: 11px 13px; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); outline: 0; background: rgba(5, 7, 16, .72); transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #626b84; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: rgba(77,220,255,.65); background: rgba(8,10,22,.92); box-shadow: 0 0 0 4px rgba(77,220,255,.09); }
.field-hint { margin: 7px 0 0; color: var(--text-faint); font-size: .79rem; }
.path-help { display: flex; align-items: flex-start; gap: 7px; color: #9aa6c8; }
.path-help::before { content: "i"; flex: 0 0 auto; width: 18px; height: 18px; display: inline-grid; place-items: center; margin-top: 1px; color: var(--cyan); border: 1px solid rgba(77,220,255,.34); border-radius: 50%; font: 600 .68rem "JetBrains Mono", monospace; }
.error-summary { margin: 18px 0 4px; padding: 12px 14px; color: #ffd6dc; border: 1px solid rgba(255,102,125,.46); border-radius: var(--radius-sm); background: rgba(255,102,125,.10); }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid label { margin-top: 18px; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 15px; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); font-weight: 600; font-size: .87rem; text-decoration: none; white-space: nowrap; transition: transform 180ms var(--ease), border-color 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-strong); background: rgba(255,255,255,.065); }
.button.primary { color: #fff; border-color: rgba(139,124,255,.72); background: linear-gradient(135deg, var(--violet-strong), #8f6dff 58%, #7772ff); box-shadow: 0 8px 24px rgba(113,92,255,.25), 0 1px 0 rgba(255,255,255,.22) inset; }
.button.primary:hover:not(:disabled) { border-color: #b1a8ff; background: linear-gradient(135deg, #806bff, #9a78ff); box-shadow: 0 12px 30px rgba(113,92,255,.35); }
.button.secondary { background: rgba(20,24,43,.88); }
.button.ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.button.danger { color: #ffcbd3; border-color: rgba(255,102,125,.3); background: rgba(255,102,125,.08); }
.button.full { width: 100%; margin-top: 24px; }
.button.compact { min-height: 34px; padding: 6px 10px; font-size: .78rem; }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; color: var(--text-soft); border: 1px solid transparent; border-radius: 11px; background: transparent; transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms var(--ease); }
.icon-button:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.05); transform: translateY(-1px); }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; isolation: isolate; }
.login-screen::before, .login-screen::after { content: ""; position: fixed; z-index: -1; border-radius: 50%; filter: blur(3px); pointer-events: none; }
.login-screen::before { width: 520px; height: 520px; left: 8%; top: -230px; background: radial-gradient(circle, rgba(139,124,255,.32), transparent 66%); animation: drift 12s ease-in-out infinite alternate; }
.login-screen::after { width: 430px; height: 430px; right: 5%; bottom: -210px; background: radial-gradient(circle, rgba(77,220,255,.18), transparent 66%); animation: drift 14s ease-in-out infinite alternate-reverse; }
.login-card { position: relative; width: min(455px, 100%); padding: 42px; border: 1px solid var(--line-strong); border-radius: 28px; background: linear-gradient(150deg, rgba(27,31,54,.94), rgba(10,12,24,.94)); box-shadow: var(--shadow-lg); overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), var(--violet), transparent); opacity: .8; }
.login-card h1 { margin: 14px 0 8px; font: 700 clamp(2.15rem, 7vw, 3rem)/1 "JetBrains Mono", monospace; letter-spacing: -.07em; }
.login-lead { margin: 0 0 27px; color: var(--text-soft); }
.security-note { margin: 22px 0 0; color: var(--text-faint); font-size: .78rem; text-align: center; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; color: #fff; border: 1px solid rgba(153,141,255,.62); border-radius: 17px; background: linear-gradient(145deg, rgba(113,92,255,.96), rgba(77,220,255,.55)); box-shadow: 0 12px 34px rgba(113,92,255,.28), 0 1px 0 rgba(255,255,255,.28) inset; }
.brand-mark svg { width: 25px; height: 25px; }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px; }
.brand-mark.small svg { width: 20px; height: 20px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); }
.sidebar { position: sticky; top: 0; z-index: 30; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(9,11,22,.97), rgba(7,8,17,.94)); backdrop-filter: blur(18px); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 5px 8px 24px; }
.brand-row strong, .brand-row span { display: block; font-family: "JetBrains Mono", monospace; }
.brand-row strong { font-size: .94rem; letter-spacing: .16em; }
.brand-row span { margin-top: 2px; color: var(--text-faint); font-size: .6rem; letter-spacing: .18em; }
.main-nav { display: grid; gap: 5px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.nav-item { position: relative; min-height: 45px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; color: var(--text-soft); border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms var(--ease); }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); transform: translateX(2px); }
.nav-item.active { color: #fff; border-color: rgba(139,124,255,.2); background: linear-gradient(90deg, rgba(139,124,255,.15), rgba(77,220,255,.045)); }
.nav-item.active::before { content: ""; position: absolute; left: -15px; width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--cyan), var(--violet)); box-shadow: 0 0 14px rgba(77,220,255,.55); }
.nav-item.active svg { color: var(--cyan); }
.sidebar-section { min-height: 0; flex: 1; padding-top: 22px; overflow: hidden; }
.section-label-row { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 11px; }
.section-label { color: var(--text-faint); font: 600 .65rem "JetBrains Mono", monospace; letter-spacing: .16em; text-transform: uppercase; }
.project-list { max-height: calc(100vh - 370px); margin-top: 8px; overflow: auto; }
.project-button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 11px; padding: 9px 11px; color: var(--text-soft); border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left; transition: all 180ms var(--ease); }
.project-button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.project-button.active { color: #fff; border-color: rgba(77,220,255,.17); background: rgba(77,220,255,.065); }
.project-button.active svg { color: var(--cyan); }
.project-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px 6px 0; border-top: 1px solid var(--line); }
.user-chip { min-width: 0; color: var(--text-soft); font: .72rem "JetBrains Mono", monospace; overflow: hidden; text-overflow: ellipsis; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 78px; display: flex; align-items: center; gap: 15px; padding: 13px 26px; border-bottom: 1px solid var(--line); background: rgba(7,8,18,.77); backdrop-filter: blur(22px) saturate(140%); }
.topbar h2 { margin: 0; font: 600 1.03rem "JetBrains Mono", monospace; letter-spacing: -.02em; }
.topbar .eyebrow { margin-bottom: 3px; font-size: .58rem; }
.connection-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; color: var(--text-soft); border: 1px solid var(--line); border-radius: 99px; background: rgba(18,21,38,.62); font-size: .77rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(56,223,139,.08), 0 0 14px rgba(56,223,139,.7); }
.connection-pill.warning .status-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(255,188,92,.08), 0 0 14px rgba(255,188,92,.55); }
.menu-button { display: none; }
.view { display: none; min-height: calc(100vh - 78px); padding: 22px; animation: view-in 280ms var(--ease); }
.view.active { display: block; }

.chat-layout { height: calc(100vh - 122px); display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 14px; }
.chat-main, .task-rail { min-height: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: linear-gradient(155deg, rgba(20,23,41,.86), rgba(10,12,24,.90)); box-shadow: 0 12px 35px rgba(0,0,0,.18); }
.chat-main { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.chat-main::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28; background-image: radial-gradient(circle, rgba(139,124,255,.25) 1px, transparent 1px); background-size: 24px 24px; mask-image: linear-gradient(#000, transparent 64%); }
.empty-state { position: relative; z-index: 1; margin: auto; max-width: 690px; padding: 48px 30px 32px; text-align: center; }
.empty-orbit { position: relative; width: 112px; height: 112px; display: grid; place-items: center; margin: 0 auto 24px; border: 1px solid rgba(139,124,255,.13); border-radius: 50%; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; border-radius: 50%; }
.empty-orbit::before { inset: 12px; border: 1px dashed rgba(77,220,255,.22); animation: spin 16s linear infinite; }
.empty-orbit::after { width: 7px; height: 7px; top: 9px; background: var(--cyan); box-shadow: 0 0 15px var(--cyan); }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; color: #fff; border: 1px solid rgba(139,124,255,.45); border-radius: 18px; background: linear-gradient(145deg, rgba(113,92,255,.82), rgba(77,220,255,.24)); box-shadow: 0 14px 40px rgba(113,92,255,.28); }
.empty-icon svg { width: 27px; height: 27px; }
.empty-state h3 { margin: 5px 0 11px; font: 600 clamp(1.45rem, 3vw, 2.15rem)/1.22 "JetBrains Mono", monospace; letter-spacing: -.055em; }
.empty-state > p:not(.eyebrow) { max-width: 590px; margin: 0 auto; color: var(--text-soft); }
.capability-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 24px; }
.capability-strip span { padding: 6px 10px; color: #bfc7dd; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.025); font-size: .74rem; }
.messages { position: relative; z-index: 1; flex: 1; padding: 26px; overflow: auto; scroll-behavior: smooth; }
.message { max-width: 880px; margin: 0 auto 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 15px 15px 15px 5px; background: rgba(25,29,50,.78); box-shadow: 0 8px 20px rgba(0,0,0,.12); white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { width: fit-content; max-width: min(760px,88%); margin-left: auto; margin-right: max(0px, calc((100% - 880px)/2)); border-color: rgba(139,124,255,.3); border-radius: 15px 15px 5px 15px; background: linear-gradient(135deg, rgba(113,92,255,.21), rgba(77,220,255,.07)); }
.message.system { color: var(--text-soft); border-style: dashed; font: .76rem/1.55 "JetBrains Mono", monospace; }
.message.error { color: #ffd1d8; border-color: rgba(255,102,125,.4); background: rgba(255,102,125,.09); }
.message-tool { position: relative; max-width: 880px; margin: 0 auto 12px; padding: 11px 13px 11px 16px; color: #9da8c7; border: 1px solid rgba(77,220,255,.13); border-radius: 11px; background: rgba(7,11,24,.72); font: .73rem/1.55 "JetBrains Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-tool::before { content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 2px; border-radius: 3px; background: var(--cyan); }
.approval-card { max-width: 880px; margin: 0 auto 15px; padding: 17px; border: 1px solid rgba(255,188,92,.38); border-radius: 15px; background: linear-gradient(135deg, rgba(255,188,92,.12), rgba(255,188,92,.04)); }
.approval-card h4 { margin: 0 0 6px; color: #ffdda3; }
.approval-card p { color: var(--text-soft); }
.approval-card pre { max-height: 230px; overflow: auto; padding: 11px; color: #d8def0; border-radius: 9px; background: rgba(3,5,12,.68); font: .72rem/1.55 "JetBrains Mono", monospace; white-space: pre-wrap; }
.approval-actions { display: flex; gap: 8px; margin-top: 13px; }
.prompt-box { position: relative; z-index: 2; margin: 14px; border: 1px solid var(--line-strong); border-radius: 16px; background: rgba(8,10,21,.9); box-shadow: 0 14px 42px rgba(0,0,0,.34); overflow: hidden; transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms var(--ease); }
.prompt-box:focus-within { border-color: rgba(139,124,255,.7); box-shadow: 0 0 0 4px rgba(139,124,255,.08), 0 16px 48px rgba(0,0,0,.42); transform: translateY(-1px); }
.prompt-box textarea { min-height: 82px; max-height: 220px; padding: 15px 16px 10px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.prompt-footer { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 9px 8px 16px; border-top: 1px solid var(--line); }
.prompt-footer > span { min-width: 0; color: var(--text-faint); font: .71rem "JetBrains Mono", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-rail { overflow: hidden; }
.rail-title { min-height: 54px; display: flex; align-items: center; gap: 9px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.rail-title h3 { margin: 0; font: 600 .81rem "JetBrains Mono", monospace; }
.rail-title svg { color: var(--violet); }
.task-list { height: calc(100% - 54px); padding: 8px; overflow: auto; }
.task-item { width: 100%; padding: 11px; color: var(--text-soft); border: 1px solid transparent; border-radius: 11px; background: transparent; text-align: left; transition: all 170ms ease; }
.task-item:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.035); transform: translateX(-2px); }
.task-item strong { display: block; margin-bottom: 6px; font-size: .81rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--text-faint); font: .63rem "JetBrains Mono", monospace; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.status.completed::before { background: var(--green); box-shadow: 0 0 9px rgba(56,223,139,.5); }
.status.failed::before { background: var(--red); }
.status.running::before, .status.checkpoint::before { background: var(--cyan); animation: pulse 1.6s ease infinite; }
.status.waiting_approval::before { background: var(--amber); }

.page-heading { max-width: 1220px; margin: 5px auto 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-heading h3 { margin: 0; font: 600 clamp(1.45rem,3vw,2rem) "JetBrains Mono", monospace; letter-spacing: -.05em; }
.page-heading p:not(.eyebrow) { max-width: 700px; margin: 8px 0 0; color: var(--text-soft); }
.card-grid { max-width: 1220px; margin: auto; display: grid; grid-template-columns: repeat(auto-fit,minmax(285px,1fr)); gap: 14px; }
.resource-card { position: relative; min-height: 185px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-md); background: linear-gradient(145deg, rgba(26,30,51,.78), rgba(12,14,27,.9)); box-shadow: 0 12px 30px rgba(0,0,0,.16); overflow: hidden; transition: transform 220ms var(--ease), border-color 220ms ease, box-shadow 220ms ease; }
.resource-card::before { content: ""; position: absolute; width: 150px; height: 150px; right: -75px; top: -75px; border-radius: 50%; background: radial-gradient(circle, rgba(139,124,255,.18), transparent 67%); }
.resource-card:hover { transform: translateY(-3px); border-color: rgba(139,124,255,.32); box-shadow: var(--shadow-glow); }
.resource-card h4 { margin: 0 0 7px; font: 600 1rem "JetBrains Mono", monospace; }
.resource-card p { margin: 0; color: var(--text-soft); overflow-wrap: anywhere; }
.resource-card .tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 17px; padding: 5px 8px; color: #b7f8d4; border: 1px solid rgba(56,223,139,.24); border-radius: 99px; background: rgba(56,223,139,.07); font: .62rem "JetBrains Mono", monospace; }
.resource-card .tag.offline { color: #ffd99b; border-color: rgba(255,188,92,.24); background: rgba(255,188,92,.07); }
.card-actions { position: absolute; right: 18px; bottom: 17px; display: flex; justify-content: flex-end; }
.toolbar { max-width: 1220px; margin: 0 auto 14px; display: flex; align-items: end; gap: 11px; }
.toolbar label { margin: 0 0 5px; }
.toolbar select { width: min(430px,100%); }
.table-card { max-width: 1220px; margin: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(18,21,38,.7); box-shadow: 0 12px 30px rgba(0,0,0,.14); overflow: auto; }
.data-row { min-width: 700px; display: grid; grid-template-columns: minmax(170px,1.4fr) minmax(130px,1fr) minmax(130px,.8fr) auto; align-items: center; gap: 16px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.data-row:last-child { border-bottom: 0; }
.data-row.header { color: var(--text-faint); background: rgba(255,255,255,.025); font: .63rem "JetBrains Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.data-row small { color: var(--text-soft); }
.empty-list { padding: 28px; color: var(--text-faint); text-align: center; }
.form-card { max-width: 720px; margin: 0 auto; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: linear-gradient(145deg, rgba(25,29,50,.78), rgba(11,13,25,.92)); box-shadow: var(--shadow-lg); }
.form-card .button { margin-top: 22px; }
.form-status { min-height: 22px; color: var(--green); }

.modal { width: min(730px,calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; color: var(--text); border: 1px solid var(--line-strong); border-radius: 24px; background: linear-gradient(145deg, #171a2e, #0d0f1e); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(2,3,8,.78); backdrop-filter: blur(9px); }
.modal form { padding: 28px; overflow: auto; }
.small-modal { width: min(500px,calc(100% - 30px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font: 600 1.35rem "JetBrains Mono", monospace; letter-spacing: -.045em; }
.modal-head p:not(.eyebrow) { max-width: 530px; margin: 7px 0 0; color: var(--text-soft); font-size: .86rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.source-preview { min-height: 74px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 12px; margin: 18px 0 2px; padding: 12px; border: 1px solid rgba(139,124,255,.22); border-radius: 14px; background: linear-gradient(90deg, rgba(139,124,255,.09), rgba(77,220,255,.035)); }
.source-preview-icon { width: 42px; height: 42px; display: grid; place-items: center; color: var(--cyan); border: 1px solid rgba(77,220,255,.22); border-radius: 12px; background: rgba(77,220,255,.06); }
.source-preview strong, .source-preview span { display: block; }
.source-preview strong { font: 600 .84rem "JetBrains Mono", monospace; }
.source-preview > div > span { margin-top: 4px; color: var(--text-faint); font-size: .75rem; overflow-wrap: anywhere; }
.source-preview .source-state { padding: 4px 8px; color: #b9f8d5; border: 1px solid rgba(56,223,139,.23); border-radius: 99px; background: rgba(56,223,139,.07); font: .61rem "JetBrains Mono", monospace; }
.source-preview .source-state.offline { color: #ffdfa8; border-color: rgba(255,188,92,.25); background: rgba(255,188,92,.07); }
.credential-result { margin-top: 16px; padding: 14px; color: #c9f9dc; border: 1px solid rgba(56,223,139,.3); border-radius: 11px; background: rgba(56,223,139,.07); font: .76rem/1.6 "JetBrains Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(390px,calc(100% - 32px)); }
.toast { padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(24,28,49,.96); box-shadow: var(--shadow-lg); animation: toast-in 220ms var(--ease); }
.toast.error { color: #ffd1d8; border-color: rgba(255,102,125,.44); }

@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; box-shadow: 0 0 10px var(--cyan); } }
@keyframes drift { to { transform: translate3d(30px,25px,0) scale(1.08); } }

@media (max-width: 1120px) {
    .chat-layout { grid-template-columns: minmax(0,1fr) 255px; }
}
@media (max-width: 860px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(310px,88vw); box-shadow: var(--shadow-lg); transition: transform 220ms var(--ease); }
    .sidebar.open { transform: translateX(0); }
    .menu-button { display: inline-grid; }
    .view { padding: 15px; }
    .topbar { padding-inline: 15px; }
    .chat-layout { height: calc(100vh - 108px); grid-template-columns: 1fr; }
    .task-rail { display: none; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .page-heading .button { align-self: flex-start; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar select { width: 100%; }
}
@media (max-width: 600px) {
    .login-card { padding: 30px 22px; }
    .login-card h1 { font-size: 2rem; }
    .view { padding: 8px; }
    .topbar { min-height: 68px; }
    .connection-pill { padding: 8px; }
    .connection-pill span:last-child { display: none; }
    .chat-layout { height: calc(100vh - 84px); }
    .chat-main { border-radius: 14px; }
    .messages { padding: 14px; }
    .empty-state { padding-inline: 18px; }
    .empty-orbit { width: 94px; height: 94px; }
    .prompt-box { margin: 8px; }
    .prompt-footer { align-items: stretch; flex-direction: column; }
    .prompt-footer .button { width: 100%; }
    .form-grid.two { grid-template-columns: 1fr; gap: 0; }
    .modal form { padding: 21px 17px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .button { width: 100%; }
    .source-preview { grid-template-columns: 40px minmax(0,1fr); }
    .source-preview .source-state { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
