/* Объяснитель кредитных отказов — web UI. Light and dark themes share one set of tokens. */
:root {
  color-scheme: light;
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --field: #F2F4F7;
  --field-hover: #E8EBEF;
  --ink: #1F1F22;
  --ink-2: #44484E;
  --ink-3: #676D74;
  --line: #E4E7EB;
  --line-2: #D3D8DE;
  --green: #21A038;
  --green-btn: #1A8B30;
  --green-btn-hover: #157A28;
  --green-ink: #107A28;
  --green-tint: #E5F4E8;
  --bubble-out: #DDF1E1;
  --amber: #E88A00;
  --amber-ink: #8F5300;
  --amber-tint: #FFF2DD;
  --red: #E5332A;
  --red-ink: #B4231C;
  --red-tint: #FDECEA;
  --code-key: #8F5300;
  --code-str: #107A28;
  --code-num: #2259C7;
  --scrim: rgba(31, 31, 34, .36);
  --shadow: 0 1px 2px rgba(31, 31, 34, .04), 0 8px 24px -12px rgba(31, 31, 34, .10);
  --shadow-pop: 0 2px 4px rgba(31, 31, 34, .06), 0 24px 48px -16px rgba(31, 31, 34, .28);
  --font: "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-card: 24px;
  --r-ctl: 12px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111214;
  --card: #1B1C1F;
  --field: #26282C;
  --field-hover: #2F3136;
  --ink: #F1F2F4;
  --ink-2: #C5C8CD;
  --ink-3: #959BA3;
  --line: #2C2E33;
  --line-2: #3A3D43;
  --green: #2BB24C;
  --green-btn: #21A038;
  --green-btn-hover: #2BB24C;
  --green-ink: #5BD177;
  --green-tint: #1A2F21;
  --bubble-out: #1E3A27;
  --amber: #F5A524;
  --amber-ink: #FFC468;
  --amber-tint: #382A14;
  --red: #FF5A4F;
  --red-ink: #FF8E86;
  --red-tint: #3A1D1C;
  --code-key: #FFC468;
  --code-str: #7DDB92;
  --code-num: #8DB5FF;
  --scrim: rgba(0, 0, 0, .55);
  --shadow: none;
  --shadow-pop: 0 24px 48px -16px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
::selection { background: color-mix(in srgb, var(--green) 32%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
button, select, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.ico { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; height: 100dvh; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 20px; height: 64px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.brand-logo { display: block; height: 28px; width: auto; }
.brand-div { width: 1px; height: 28px; background: var(--line-2); }
.brand b { display: block; font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand small { color: var(--ink-3); font-size: 13px; }
.tabs { display: flex; gap: 4px; background: var(--field); padding: 4px; border-radius: 999px; }
.tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.conn { display: grid; grid-template-columns: 8px auto; column-gap: 10px; align-items: center; padding-right: 16px; margin-right: 6px; border-right: 1px solid var(--line); white-space: nowrap; line-height: 1.25; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.conn.live i { background: var(--green); }
.conn b { display: block; font-size: 13px; font-weight: 500; color: var(--ink); }
.conn small { display: block; font-size: 12px; color: var(--ink-3); }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--field); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.iconbtn:hover { background: var(--field-hover); color: var(--ink); }

.view { min-height: 0; overflow: auto; }

/* ---------- chat screen ---------- */
.demo { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; padding: 20px 24px 24px; height: 100%; min-height: 640px; }
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); border: 1px solid transparent; }
:root[data-theme="dark"] .card { border-color: var(--line); }

.chat { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-h { display: flex; align-items: center; gap: 12px; padding: 14px 20px 14px 24px; border-bottom: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--green-tint); color: var(--green-ink); display: grid; place-items: center; flex: none; }
.chat-h .who { min-width: 0; }
.chat-h b { display: block; font-weight: 600; }
.chat-h small { display: block; color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-h .r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
select { appearance: none; background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23878D95' stroke-width='1.8'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 14px center; border: 0; border-radius: var(--r-ctl); padding: 10px 38px 10px 14px; cursor: pointer; font-size: 14px; font-weight: 500; max-width: 280px; color: var(--ink); }
select:hover { background-color: var(--field-hover); }
select option { background: var(--card); color: var(--ink); }
.btn { height: 40px; padding: 0 16px; border-radius: var(--r-ctl); border: 0; background: var(--field); font-weight: 500; font-size: 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center; white-space: nowrap; color: var(--ink); }
.btn:hover { background: var(--field-hover); }
.btn.primary { background: var(--green-btn); color: #fff; }
.btn.primary:hover { background: var(--green-btn-hover); }
.btn.ghost { background: none; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.ghost:hover { background: var(--field); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--field); color: var(--ink-2); white-space: nowrap; }
.pill.g { background: var(--green-tint); color: var(--green-ink); }
.pill.r { background: var(--red-tint); color: var(--red-ink); }
.pill.a { background: var(--amber-tint); color: var(--amber-ink); }
.pill.sm { height: 24px; padding: 0 10px; font-size: 12px; }

.thread { flex: 1; overflow: auto; padding: 20px 24px 12px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.note { align-self: center; font-size: 12px; color: var(--ink-3); background: var(--field); padding: 5px 12px; border-radius: 999px; margin: 10px 0; display: flex; gap: 6px; align-items: center; text-align: center; }
.note.a { background: var(--amber-tint); color: var(--amber-ink); }
.note.r { background: var(--red-tint); color: var(--red-ink); }
.note.g { background: var(--green-tint); color: var(--green-ink); }
.msg { max-width: min(78%, 680px); padding: 12px 16px; border-radius: 20px; line-height: 1.55; overflow-wrap: anywhere; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 2px 0 8px; padding-left: 20px; } .msg li { margin-bottom: 6px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-bottom-right-radius: 6px; margin-top: 10px; }
.msg.in { align-self: flex-start; background: var(--field); border-bottom-left-radius: 6px; margin-top: 10px; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; transition: box-shadow .15s; }
.msg.in:hover { box-shadow: inset 0 0 0 1.5px var(--line-2); }
.msg.in.sel { box-shadow: inset 0 0 0 2px var(--green); }
.msg.in.leak { background: var(--red-tint); }
.msg.in.leak.sel { box-shadow: inset 0 0 0 2px var(--red); }
.msg.in.leak .body { font: 13px/1.6 var(--mono); white-space: pre-wrap; color: var(--red-ink); }
.msg.err { align-self: flex-start; background: var(--red-tint); color: var(--red-ink); border-bottom-left-radius: 6px; margin-top: 10px; display: flex; gap: 12px; align-items: center; cursor: default; }
.msg .foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; margin-top: 4px; padding: 0 6px; }
.meta.out { align-self: flex-end; }
.meta.in { align-self: flex-start; }
.meta .warn { color: var(--amber-ink); display: inline-flex; gap: 4px; align-items: center; }
.typing { align-self: flex-start; background: var(--field); border-radius: 20px; border-bottom-left-radius: 6px; padding: 12px 16px; font-size: 14px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--green); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome { align-self: flex-start; max-width: 560px; background: var(--field); border-radius: 20px; border-bottom-left-radius: 6px; padding: 14px 16px; }
.welcome b { font-weight: 600; }
.sugg { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 24px 0; }
.chip { text-align: left; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px 6px 10px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink); display: flex; gap: 8px; align-items: center; }
.chip .ico { color: var(--green); }
.chip:hover { border-color: var(--green); color: var(--green-ink); }
.chip.atk .ico { color: var(--red); }
.chip.atk:hover { border-color: var(--red); color: var(--red-ink); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.composer { display: flex; gap: 10px; align-items: center; padding: 12px 24px 20px; }
.composer input { flex: 1; min-width: 0; height: 48px; border: 0; background: var(--field); border-radius: 999px; padding: 0 20px; font-size: 15px; color: var(--ink); }
.composer input::placeholder { color: var(--ink-3); }
.composer input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--green); background: var(--card); }
.send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--green-btn); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.send:hover { background: var(--green-btn-hover); }
.send:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.side-h { display: flex; align-items: center; gap: 8px; padding: 0 6px; color: var(--ink-3); font-size: 13px; font-weight: 500; min-height: 20px; }
.side-h .pill { margin-left: auto; }
.sc { padding: 16px 20px; }
.sc h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sc h3 span { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--ink-3); }
.ctlrow { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.ctlrow + .ctlrow { margin-top: 8px; }
.ctlrow .lbl { font-size: 14px; font-weight: 500; }
.ctlrow .lbl small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.ctlrow .push { margin-left: auto; }
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; border: 0; background: var(--line-2); cursor: pointer; padding: 0; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.seg { display: flex; background: var(--field); padding: 3px; border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button:hover:not(:disabled) { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.keyline { font-size: 12px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--green-ink); font-size: 12px; font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.risk { display: flex; align-items: flex-end; gap: 12px 14px; flex-wrap: wrap; }
.risk .big { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.risk .big.r { color: var(--red-ink); }
.risk .cap { font-size: 13px; color: var(--ink-3); padding-bottom: 3px; white-space: nowrap; }
.risk .pill { margin-left: auto; margin-bottom: 2px; }
.segs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin-top: 14px; }
.segs div { height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; }
.segs i { display: block; height: 100%; border-radius: 999px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.segs div:nth-child(1) i { background: var(--green); } .segs div:nth-child(2) i { background: var(--amber); } .segs div:nth-child(3) i { background: var(--red); }
.seglbl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.seglbl .on { color: var(--ink); font-weight: 600; }
.hist { display: flex; align-items: flex-end; gap: 5px; height: 36px; margin-top: 12px; }
.hist i { flex: 1; max-width: 20px; border-radius: 5px 5px 2px 2px; background: var(--green); min-height: 4px; transition: height .3s; }
.hist i.cautious { background: var(--amber); } .hist i.locked { background: var(--red); }
.hist-l { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.xtabs { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: hidden; }
.xtabs .seg { margin: 14px 20px 0; }
.xtabs .seg button { flex: 1; }
.xbody { flex: 1; overflow: auto; padding: 14px 20px 18px; min-height: 0; }
.hint { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.step { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--field); color: var(--ink-3); font-size: 13px; font-weight: 600; transition: background .2s, color .2s; }
.step.good .dot { background: var(--green-tint); color: var(--green-ink); }
.step.warn .dot { background: var(--amber-tint); color: var(--amber-ink); }
.step.bad .dot { background: var(--red-tint); color: var(--red-ink); }
.step.active .dot { background: var(--green); color: #fff; }
.step b { display: block; font-weight: 600; font-size: 14px; }
.step small { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.step .st { font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.step.good .st { color: var(--green-ink); } .step.warn .st { color: var(--amber-ink); } .step.bad .st { color: var(--red-ink); }
.flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.sr { display: grid; grid-template-columns: 1fr 112px 50px; gap: 12px; align-items: center; padding: 5px 0; font-size: 14px; }
.sr .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.sr.masked .n { color: var(--red-ink); }
.sr .bar { height: 8px; border-radius: 999px; background: var(--field); position: relative; overflow: hidden; }
.sr .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--green); transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.sr .bar i.ABSTRACTED { background: var(--amber); } .sr .bar i.FORBIDDEN { background: var(--red); }
.sr .bar i.relief { opacity: .35; }
.sr .v { text-align: right; color: var(--ink-3); font-size: 13px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--green); }
.legend i.a { background: var(--amber); } .legend i.f { background: var(--red); }
.vault { margin-top: 14px; background: var(--field); border-radius: 16px; padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.vault span { font-size: 12px; color: var(--ink-3); }
.vault b { display: block; font-size: 18px; font-weight: 600; }
.vault p { grid-column: 1 / -1; margin: 8px 0 0; font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
pre.json { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--field); font: 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
pre.json .k { color: var(--code-key); } pre.json .s { color: var(--code-str); } pre.json .n { color: var(--code-num); }
.llm-cap { font-size: 13px; margin-bottom: 10px; display: flex; gap: 8px; align-items: flex-start; }
.llm-cap.g { color: var(--green-ink); } .llm-cap.r { color: var(--red-ink); }

/* ---------- sheet: own application ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(460px, calc(100vw - 24px)); background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-pop); z-index: 21; display: flex; flex-direction: column; animation: slide .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { margin: 0; font-size: 18px; font-weight: 600; }
.sheet-h .iconbtn { margin-left: auto; }
.sheet-b { flex: 1; overflow: auto; padding: 8px 20px 16px; }
.sheet-f { padding: 14px 20px 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.fgroup { margin-top: 14px; }
.fgroup h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.fgroup h4 .pill { margin-left: auto; }
.fgroup p { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-3); }
.field { padding: 10px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field .top-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.field output { font-weight: 600; white-space: nowrap; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 6px 0 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--green) var(--p, 50%), var(--field) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--field); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--green); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); border: 0; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); border: 0; }
.fgroup.forbidden input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--red) var(--p, 50%), var(--field) var(--p, 50%)); }
.fgroup.forbidden input[type="range"]::-moz-range-progress { background: var(--red); }
.fgroup.abstracted input[type="range"]::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--amber) var(--p, 50%), var(--field) var(--p, 50%)); }
.fgroup.abstracted input[type="range"]::-moz-range-progress { background: var(--amber); }
.offline-note { font-size: 13px; color: var(--amber-ink); background: var(--amber-tint); border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: flex-start; }
.offline-note code { font: 12px var(--mono); }
.form-err { font-size: 13px; color: var(--red-ink); }

/* ---------- benchmark & policy ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-h h2 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.page-h p { margin: 4px 0 0; color: var(--ink-3); }
.page-h .r { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 20px; display: flex; flex-direction: column; }
.kpi .t { font-size: 14px; color: var(--ink-2); min-height: 42px; }
.kpi .p { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; margin: 8px 0 12px; }
.kpi .b { font-size: 13px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.kpi .b s { color: var(--red-ink); }
.two { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.two .sc { padding: 20px; }
.two .sc p { color: var(--ink-2); margin: 0 0 12px; }
.curve { width: 100%; height: auto; display: block; }
.cv-grid { stroke: var(--line); } .cv-tick { fill: var(--ink-3); font: 11px var(--font); }
.cv-target { stroke: var(--amber); stroke-dasharray: 4 4; stroke-width: 1.5; } .cv-target-label { fill: var(--amber-ink); font: 500 11px var(--font); }
.cv-chance { stroke: var(--line-2); stroke-dasharray: 1 4; }
.cv-base { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linejoin: round; } .cv-prot { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; }
.cv-base-dot { fill: var(--card); stroke: var(--red); stroke-width: 2; } .cv-prot-dot { fill: var(--green); }
.cv-end { font: 600 12px var(--font); } .cv-end-base { fill: var(--red-ink); } .cv-end-prot { fill: var(--green-ink); }
.cv-x { fill: var(--ink-3); font: 12px var(--font); }
.tbl-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; flex-wrap: wrap; }
.tbl-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.filters button { border: 0; background: var(--field); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.rt-wrap { overflow-x: auto; }
.rt { width: 100%; border-collapse: collapse; font-size: 14px; }
.rt th, .rt td { padding: 10px 20px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.rt th { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.rt td:first-child { color: var(--ink-3); white-space: nowrap; }
.rt td.prompt { min-width: 320px; }
.rt td.nowrap { white-space: nowrap; }
.bench-err { font-size: 13px; color: var(--red-ink); white-space: pre-wrap; background: var(--red-tint); border-radius: 14px; padding: 12px 14px; }
.pol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.pol .sc { padding: 20px; }
.pol .it { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.pol .it code { display: block; color: var(--ink-3); font: 12px var(--mono); margin-top: 2px; }
.pol .d { color: var(--ink-3); font-size: 13px; margin: -4px 0 10px; }
details.card > summary { cursor: pointer; list-style: none; padding: 18px 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .ico { transition: transform .2s; color: var(--ink-3); }
details[open].card > summary .ico { transform: rotate(90deg); }
pre.yaml { margin: 0; padding: 0 20px 20px; font: 12px/1.6 var(--mono); color: var(--ink-2); max-height: 480px; overflow: auto; }
.credits { font-size: 12px; color: var(--ink-3); }
.credits a { color: inherit; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .demo { grid-template-columns: minmax(0, 1fr) 380px; }
  .conn small { display: none; }
}
@media (max-width: 980px) {
  .top { flex-wrap: wrap; height: auto; padding: 12px 16px; row-gap: 10px; }
  .top-r { margin-left: 0; width: 100%; }
  .demo { grid-template-columns: 1fr; height: auto; padding: 16px; }
  .chat { min-height: 70vh; }
  .side { min-height: auto; }
  .xtabs { overflow: visible; }
  .two, .pol, .kpis { grid-template-columns: 1fr; }
  .chat-h { flex-wrap: wrap; }
  .chat-h .r { margin-left: 0; width: 100%; min-width: 0; }
  .chat-h select { flex: 1; min-width: 0; max-width: none; }
  .sugg { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .sugg .chip { white-space: nowrap; flex: none; }
  #customBtn .lbl-txt { display: none; }
  #customBtn { width: 40px; padding: 0; }
  .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.welcome-try { display: block; margin-top: 8px; color: var(--ink-2); }
