@font-face { font-family: 'JBM'; src: url('fonts/jbm.woff2') format('woff2'); font-weight: 100 800; font-display: swap; }
@font-face { font-family: 'Unageo'; src: url('fonts/unageo.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

/* Catppuccin Mocha, as in the sudoo platform */
:root {
    --base: #1e1e2e; --mantle: #181825; --crust: #11111b;
    --surface0: #313244; --surface1: #45475a; --surface2: #585b70;
    --overlay0: #6c7086; --overlay1: #7f849c; --overlay2: #9399b2;
    --subtext0: #a6adc8; --subtext1: #bac2de; --text: #cdd6f4;
    --blue: #89b4fa; --lavender: #b4befe; --sapphire: #74c7ec; --teal: #94e2d5;
    --green: #a6e3a1; --yellow: #f9e2af; --peach: #fab387; --maroon: #eba0ac;
    --red: #f38ba8; --mauve: #cba6f7; --pink: #f5c2e7; --rosewater: #f5e0dc;
    --line: rgba(205, 214, 244, .08);
    --line-strong: rgba(205, 214, 244, .15);
    --mono: 'JBM', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --brand: 'Unageo', 'JBM', sans-serif;
    --r: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--crust); color: var(--text);
    font: 13px/1.55 var(--mono);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--mauve); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.dim { color: var(--overlay1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail {
    background: var(--mantle); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 18px; padding: 18px 14px 14px; min-height: 0;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; padding: 0 4px; }
.wordmark { font-family: var(--brand); font-weight: 700; font-size: 21px; color: var(--pink); letter-spacing: .01em; line-height: 1; }
.org {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    background: var(--base); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px;
}
.org:hover { border-color: var(--line-strong); }
.org-mark {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
    background: linear-gradient(140deg, #6f8f4e, #3f5a2c); color: #eef5dc; font-weight: 700; font-size: 11px;
}
.org-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.org-text b { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-text small, .me-text small { color: var(--overlay1); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
    background: none; border: 0; color: var(--subtext0); text-align: left; width: 100%;
}
.nav-item:hover { background: rgba(205, 214, 244, .05); color: var(--text); }
.nav-item.is-on { background: rgba(203, 166, 247, .12); color: var(--mauve); }
.nav-item.is-sub { padding-left: 36px; font-size: 12.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot-peach { background: var(--peach); } .dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); } .dot-red { background: var(--red); } .dot-dim { background: var(--overlay0); }
.credits { margin-top: auto; background: var(--base); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.credits-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--subtext0); }
.credits-row b { color: var(--text); }
.bar { height: 4px; border-radius: 4px; background: var(--surface0); margin: 9px 0 7px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--mauve), var(--pink)); border-radius: 4px; }
.credits small { color: var(--overlay1); font-size: 11px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface0); color: var(--rosewater); display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.me-text { display: flex; flex-direction: column; }
.me-text b { font-weight: 600; font-size: 12.5px; }
.mbar { display: none; }

.main { min-width: 0; min-height: 0; background: var(--base); overflow: hidden; display: flex; flex-direction: column; }
.view { min-height: 0; flex: 1; display: flex; flex-direction: column; }

/* ---------- common bits ---------- */
.crumb { color: var(--overlay1); font-size: 12px; margin-bottom: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--subtext0); text-decoration: underline; text-decoration-color: var(--surface2); text-underline-offset: 3px; }
.link:hover { color: var(--text); }
h1 { font-family: var(--brand); font-size: 26px; font-weight: 700; letter-spacing: .005em; line-height: 1.15; }
.badge {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    font-size: 11.5px; line-height: 1; padding: 5px 8px; border-radius: 6px;
}
.badge .i { width: 13px; height: 13px; }
.b-blue { background: rgba(137, 180, 250, .14); color: var(--blue); }
.b-mauve { background: rgba(203, 166, 247, .14); color: var(--mauve); }
.b-green { background: rgba(166, 227, 161, .14); color: var(--green); }
.b-yellow { background: rgba(249, 226, 175, .14); color: var(--yellow); }
.b-peach { background: rgba(250, 179, 135, .14); color: var(--peach); }
.b-red { background: rgba(243, 139, 168, .14); color: var(--red); }
.b-plain { background: var(--surface0); color: var(--subtext1); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
    border-radius: 8px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent;
    transition: transform .15s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--mauve); color: var(--crust); }
.btn-primary:hover { background: var(--lavender); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; background: var(--mauve); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--subtext1); }
.btn-ghost:hover { border-color: var(--overlay0); color: var(--text); }
.btn-peach { background: var(--peach); color: var(--crust); }
.btn-peach:hover { background: #fcc29f; }
.btn-peach:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---------- projects list ---------- */
.view-projects { padding: 28px 32px; overflow-y: auto; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.pj-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    background: var(--mantle); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
    color: var(--subtext0); font-size: 12px;
}
.chip span { color: var(--overlay0); margin-left: 4px; }
.chip.is-on { border-color: rgba(203, 166, 247, .5); color: var(--mauve); background: rgba(203, 166, 247, .08); }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pj {
    text-align: left; background: var(--mantle); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
    display: flex; flex-direction: column; gap: 12px; min-width: 0; transition: border-color .2s, transform .2s;
}
.pj:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.pj.is-archived { opacity: .6; }
.pj-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pj-name { font-family: var(--brand); font-size: 18px; font-weight: 700; }
.pj-desc { color: var(--subtext0); font-size: 12.5px; }
.pj-envs { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.pj-env { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--subtext1); }
.pj-env .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-foot { display: flex; justify-content: space-between; color: var(--overlay1); font-size: 11.5px; }

/* ---------- project workspace ---------- */
.view-project { padding: 18px 22px 18px; gap: 14px; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.p-meta { display: flex; gap: 6px; flex-wrap: wrap; }

.pipe {
    background: var(--mantle); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 8px 22px; align-items: center;
}
.pipe-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; grid-row: span 2; padding-right: 20px; border-right: 1px solid var(--line); }
.pipe-branch { display: flex; align-items: center; gap: 8px; }
.pipe-commit { color: var(--subtext0); font-size: 12px; white-space: nowrap; }
.pipe-mode { color: var(--overlay0); font-size: 11px; }
.pipe-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; min-width: 0; }
.step { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 12px; color: var(--overlay1); }
.step:not(:last-child)::after { content: ''; flex: 1; height: 2px; border-radius: 2px; background: var(--surface0); margin: 0 10px; min-width: 12px; }
.step.is-ok:not(:last-child)::after { background: rgba(166, 227, 161, .45); }
.step-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1.5px solid var(--surface1); }
.step-ic .i { width: 12px; height: 12px; stroke-width: 2.6; }
.step-txt { display: flex; flex-direction: column; line-height: 1.25; }
.step-l { white-space: nowrap; }
.step-t { color: var(--overlay0); font-size: 11px; white-space: nowrap; }
.step.is-ok { color: var(--subtext1); }
.step.is-ok .step-ic { background: var(--green); border-color: var(--green); color: var(--crust); }
.step.is-fail { color: var(--red); }
.step.is-fail .step-ic { background: var(--red); border-color: var(--red); color: var(--crust); }
.step.is-run { color: var(--yellow); }
.step.is-run .step-ic { border-color: var(--yellow); border-top-color: transparent; animation: spin .8s linear infinite; }
.pipe-log { font-size: 11.5px; color: var(--overlay1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pipe-log.is-fail { color: var(--red); }
.pipe-log.is-ok { color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

.p-tabs { display: none; }
.p-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); gap: 14px; }
.panel { background: var(--mantle); border: 1px solid var(--line); border-radius: 12px; min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ph-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ph-left .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-right { font-size: 11.5px; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(166, 227, 161, .15); flex: none; }

/* session */
.chat { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.empty { margin: auto; max-width: 470px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 0; }
.empty-mascot { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.empty h2 { font-family: var(--brand); font-size: 22px; font-weight: 700; color: var(--pink); }
.empty p { color: var(--subtext0); font-size: 12.5px; }
.suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; width: 100%; }
.suggest-btn {
    text-align: left; background: var(--base); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px;
    display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 12.5px;
}
.suggest-btn span { color: var(--overlay1); font-size: 11px; }
.suggest-btn:hover { border-color: rgba(203, 166, 247, .45); }
.suggest-btn[data-prompt="main"] span { color: var(--red); }

.msg { display: flex; gap: 11px; min-width: 0; animation: rise .3s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg-av { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; }
.msg-av img { width: 26px; height: auto; }
.msg-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.msg-text { color: var(--subtext1); white-space: pre-wrap; }
.msg-text code { color: var(--peach); background: rgba(250, 179, 135, .08); padding: 0 4px; border-radius: 4px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--surface0); border-radius: 12px 12px 4px 12px; padding: 9px 13px; max-width: 78%; color: var(--text); }
.caret::after { content: '▍'; color: var(--mauve); animation: blink 1s steps(1) infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }

.tool { border: 1px solid var(--line); border-radius: var(--r); background: var(--base); min-width: 0; overflow: hidden; }
.tool-h {
    width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 11px; background: none; border: 0; text-align: left; font-size: 12px;
}
.tool-h:hover { background: rgba(205, 214, 244, .03); }
.tool-ic { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex: none; background: rgba(137, 180, 250, .14); color: var(--blue); }
.tool-ic .i { width: 12px; height: 12px; }
.tool-name { color: var(--blue); font-weight: 600; }
.tool-args { color: var(--overlay1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool-st { display: inline-flex; align-items: center; gap: 6px; color: var(--overlay1); font-size: 11.5px; white-space: nowrap; }
.tool-st.ok { color: var(--green); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--yellow); border-top-color: transparent; animation: spin .8s linear infinite; }
.chev { transition: transform .2s; color: var(--overlay0); }
.tool-h[aria-expanded="true"] .chev { transform: rotate(90deg); }
.tool-b { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 11.5px; overflow-x: auto; }
.tool-b pre { margin: 0; white-space: pre; color: var(--subtext0); line-height: 1.6; }
.tool-b .k { color: var(--overlay1); }
.tool-b .add { color: var(--green); } .tool-b .rm { color: var(--red); } .tool-b .mod { color: var(--yellow); } .tool-b .hd { color: var(--text); font-weight: 600; }

/* plan */
.plan { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--base); overflow: hidden; min-width: 0; animation: rise .35s ease both; }
.plan-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plan-h h3 { font-size: 13px; }
.plan-h h3 span { color: var(--overlay1); font-weight: 400; }
.plan-sum { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-item { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.plan-item:last-child { border-bottom: 0; }
.plan-item .badge { justify-content: center; align-self: start; }
.plan-t { color: var(--text); }
.plan-t code { color: var(--peach); }
.plan-d { color: var(--overlay2); font-size: 12px; margin-top: 2px; }
.plan-loc { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 5px; }
.loc { font-size: 11px; color: var(--sapphire); background: rgba(116, 199, 236, .08); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

/* diff */
.diff { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--crust); overflow: hidden; min-width: 0; animation: rise .35s ease both; }
.diff-tabs { display: flex; gap: 2px; padding: 6px 6px 0; overflow-x: auto; background: var(--mantle); border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.diff-tab { background: none; border: 0; border-radius: 7px 7px 0 0; padding: 7px 11px; font-size: 11.5px; color: var(--overlay1); white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.diff-tab b { font-weight: 500; color: var(--green); }
.diff-tab em { font-style: normal; color: var(--red); }
.diff-tab.is-on { background: var(--crust); color: var(--text); }
.diff-tab .new { font-size: 10px; color: var(--crust); background: var(--green); border-radius: 4px; padding: 1px 5px; font-weight: 700; }
.diff-note { padding: 8px 14px; font-size: 11.5px; color: var(--overlay1); border-bottom: 1px solid var(--line); }
.diff-code { overflow-x: auto; padding: 8px 0; font-size: 12px; line-height: 1.65; max-height: 330px; overflow-y: auto; }
.dl { display: grid; grid-template-columns: 38px 16px max-content; white-space: pre; padding-right: 16px; }
.dl .n { color: var(--surface2); text-align: right; padding-right: 8px; user-select: none; }
.dl .s { color: var(--overlay0); user-select: none; }
.dl.a { background: rgba(166, 227, 161, .08); } .dl.a .s, .dl.a .c { color: var(--green); }
.dl.r { background: rgba(243, 139, 168, .08); } .dl.r .s, .dl.r .c { color: var(--red); }
.dl .c { color: var(--subtext0); }
.dl.h .c { color: var(--overlay1); font-style: italic; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; animation: rise .35s ease both; }

/* composer */
.composer { display: flex; align-items: flex-end; gap: 8px; margin: 8px 14px 14px; background: var(--base); border: 1px solid var(--line-strong); border-radius: 12px; padding: 7px 7px 7px 13px; }
.composer:focus-within { border-color: rgba(203, 166, 247, .5); }
.composer textarea { flex: 1; min-width: 0; resize: none; background: none; border: 0; outline: none; padding: 6px 0; font-size: 12.5px; line-height: 1.5; max-height: 90px; }
.composer textarea::placeholder { color: var(--overlay0); }
.send { width: 34px; height: 34px; flex: none; border-radius: 9px; border: 0; background: var(--mauve); color: var(--crust); display: grid; place-items: center; }
.send:disabled { opacity: .35; cursor: default; }
.send .i { stroke-width: 2.4; }

/* environments */
.env-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; flex: 1; }
.env { background: var(--base); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 9px; transition: border-color .3s; }
.env.is-flash { border-color: rgba(166, 227, 161, .55); }
.env-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.env-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.env-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; font-size: 12px; }
.env-rows dt { color: var(--overlay1); }
.env-rows dd { margin: 0; color: var(--subtext1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-rows dd.ok { color: var(--green); } .env-rows dd.bad { color: var(--red); } .env-rows dd.run { color: var(--yellow); }
.env-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.env-hint { color: var(--overlay0); font-size: 11.5px; }
.env-foot { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; }
.env-foot div { display: flex; justify-content: space-between; gap: 10px; }
.env-foot b { font-weight: 500; color: var(--subtext1); }

/* dialog + toast */
.dlg { border: 1px solid var(--line-strong); background: var(--mantle); color: var(--text); border-radius: 14px; padding: 0; width: min(500px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(17, 17, 27, .7); }
.dlg-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { font-family: var(--brand); font-size: 20px; font-weight: 700; }
.dlg p { color: var(--subtext0); font-size: 12.5px; }
.dlg-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; color: var(--subtext1); font-size: 12.5px; }
.dlg-steps b { color: var(--peach); font-weight: 600; }
.dlg-check { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--subtext1); padding: 10px; border-radius: 8px; background: var(--base); }
.dlg-check input { accent-color: var(--mauve); width: 15px; height: 15px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
    position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--surface0); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 14px; font-size: 12.5px;
    transition: opacity .25s, transform .25s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.ribbon {
    position: fixed; right: 14px; top: 10px; z-index: 50; text-decoration: none;
    font-size: 11px; padding: 4px 10px; border-radius: 999px;
    background: var(--mantle); border: 1px solid var(--line-strong); color: var(--overlay2);
}
.ribbon:hover { color: var(--text); border-color: var(--mauve); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
    .app { grid-template-columns: 76px minmax(0, 1fr); }
    .rail { padding: 16px 10px; align-items: center; }
    .wordmark, .org-text, .org .i, .credits, .me-text, .nav-item.is-sub { display: none; }
    .org { padding: 6px; justify-content: center; width: auto; }
    .nav-item { font-size: 0; justify-content: center; padding: 10px; }
    .nav-item .i { width: 18px; height: 18px; }
    .p-grid { grid-template-columns: minmax(0, 1.5fr) minmax(290px, 1fr); }
}
@media (max-width: 860px) {
    body { overflow: auto; }
    .app { display: block; height: auto; min-height: 100dvh; }
    .rail { display: none; }
    .mbar {
        display: flex; align-items: center; justify-content: space-between; padding: 10px 16px;
        background: var(--mantle); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
    }
    .mbar .wordmark { display: inline; font-size: 19px; }
    .mbar-btn { background: none; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--subtext1); }
    .main { overflow: visible; }
    .view-project, .view-projects { padding: 14px 16px 60px; }
    h1 { font-size: 22px; }
    .pipe { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .pipe-info { grid-row: auto; border-right: 0; padding-right: 0; flex-direction: row; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
    .pipe-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
    .step:not(:last-child)::after { display: none; }
    .pipe-log { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
    .p-tabs { display: flex; gap: 4px; background: var(--mantle); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
    .p-tab { flex: 1; background: none; border: 0; border-radius: 7px; padding: 7px; font-size: 12.5px; color: var(--subtext0); }
    .p-tab.is-on { background: var(--surface0); color: var(--text); }
    .p-grid { display: block; }
    .panel[data-panel] { display: none; }
    .panel.is-shown { display: flex; }
    .session.is-shown { height: calc(100dvh - 210px); min-height: 520px; }
    .ph-right { display: none; }
    .suggest { grid-template-columns: 1fr; }
    .chat { padding: 14px 12px 6px; }
    .msg { gap: 8px; }
    .msg.user .bubble { max-width: 90%; }
    .tool-h { flex-wrap: wrap; row-gap: 2px; }
    .tool-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .tool-args { flex-basis: 100%; order: 5; padding-left: 43px; font-size: 11px; }
    .msg-av { width: 22px; height: 22px; } .msg-av img { width: 22px; }
    .plan-item { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 12px; }
    .plan-item .badge { justify-self: start; }
    .composer { margin: 6px 10px 10px; }
    .ribbon { bottom: auto; top: 12px; right: 104px; font-size: 10.5px; padding: 3px 8px; }
    .toast { bottom: 16px; }
    .page-head { align-items: center; }
    .pj-grid { grid-template-columns: minmax(0, 1fr); }
}

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