@font-face { font-family: "Geist"; font-weight: 100 900; font-display: swap; src: url(../fonts/geist-latin-wght.woff2) format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-display: swap; src: url(../fonts/geist-mono-latin-wght.woff2) format("woff2"); }

:root {
  --tadamoo-950: #0E1114; --tadamoo-900: #151A1F; --tadamoo-700: #2A333C; --tadamoo-500: #56616C; --tadamoo-300: #9AA4AD;
  --ember: #F2662B; --ember-hot: #FFB547; --ember-deep: #B8401A;

  --font-sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: var(--tadamoo-950);
  --panel: var(--tadamoo-900);
  --surface: #1A2128;
  --raised: var(--tadamoo-700);
  --line: #28313A;
  --line-soft: #222A32;
  --fg: #E9ECEE;
  --fg-2: var(--tadamoo-300);
  --fg-3: #8A95A0;
  --accent: #FF7A3D;
  --warn: #E9C341;
  --err: #D93A5B;
  --hit: rgba(255, 122, 61, .22);
  --btn-h: 30px; --btn-fs: 13px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 14px/1.5 var(--font-sans);
  display: flex; flex-direction: column; min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
td, th, .v, .k, .ln, .kv dd, .sub { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--raised); border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--raised) transparent; }

/* Top bar: brand, tabs, then state · address · key */
.bar { display: flex; align-items: center; gap: 8px 24px; min-height: 76px; padding: 0 28px; flex: none; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 38px; height: 38px; display: block; }
.wordmark { font: 700 27px/1 var(--font-sans); letter-spacing: -.035em; }
.model { font: 400 13.5px/1 var(--font-mono); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* nine tabs: a larger text moves the ones that no longer fit to a second row; a label is never split inside a word */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; }
.tab { white-space: nowrap; padding: 8px 16px; color: var(--fg-3); font-weight: 500; font-size: 14.5px; border-radius: 6px; }
.tab:hover { color: var(--fg); }
.tab.attn { color: var(--fg); animation: attn-blink 1.2s ease-in-out infinite; }
.tab.attn::after { content: ""; display: inline-block; flex: none; width: 8px; height: 8px; margin-inline-start: 6px; border-radius: 50%; background: var(--accent); }
@keyframes attn-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tab.attn { animation: none; } }
.tab[aria-selected="true"] { color: var(--fg); background: var(--panel); }
.grow { flex: 1; }
.state { font: 500 13.5px/1 var(--font-mono); color: var(--fg-2); white-space: nowrap; }
.state[data-s="generating"], .state[data-s="reading"], .state[data-s="loading"] { color: var(--accent); }
.state[data-s="offline"] { color: var(--err); }
.where { font: 400 13px/1 var(--font-mono); color: var(--fg-3); white-space: nowrap; margin-left: -8px; }
.state + .where::before, .where + .where::before { content: "·"; margin-right: 16px; color: var(--line); }

/* Panels: flat, softly rounded, one step lighter than the ground */
.sec { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; flex: none; }

/* Key figures with the system readings on a thin line under them, in one card */
.top { margin: 0 28px 16px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; background: var(--panel); }
.strip { display: grid; grid-template-columns: 1.6fr repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.m { background: var(--panel); padding: 20px 24px 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.k { font-size: 13.5px; line-height: 1; color: var(--fg-3); white-space: nowrap; display: flex; justify-content: space-between; gap: 6px; }
.k i { font-style: normal; }
.v { font-size: 32px; line-height: 1.1; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; }
.v small { font-size: 15px; font-weight: 400; color: var(--fg-3); letter-spacing: 0; margin-left: 4px; }
.m-hero .v { font-size: 54px; line-height: 1; color: var(--accent); }
.m-hero .v.idle { color: var(--fg-3); }
.heat { position: relative; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--tadamoo-700) 0%, #5A2A1E 30%, var(--ember-deep) 48%, var(--ember) 64%, var(--ember-hot) 82%, #FFF1D6 100%); margin-top: 4px; }
.heat i { position: absolute; top: -3px; width: 2px; height: 9px; border-radius: 1px; background: var(--fg); left: 0; }
.sub { font-size: 13px; line-height: 1; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys { display: flex; flex-wrap: wrap; gap: 8px 32px; padding: 12px 24px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--fg-3); }
.sys span { white-space: nowrap; }
.sys b { margin-left: 8px; font: 500 13.5px/1 var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }

/* Views */
main { flex: 1; min-height: 0; display: flex; padding: 0 28px 20px; }
.view { flex: 1; min-width: 0; min-height: 0; }
.stats { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 16px; }
.col { display: flex; flex-direction: column; gap: 16px; min-height: 0; min-width: 0; }
.col-l { overflow: auto; }
.col-l > .speed { flex: 1 0 auto; min-height: 330px; }
.sh { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 20px; font: 600 14.5px/1 var(--font-sans); color: var(--fg); border-bottom: 1px solid var(--line-soft); flex: none; }
.sh span { font: 400 13px/1 var(--font-mono); color: var(--fg-3); }
.sh button { font: 400 13px/1 var(--font-mono); color: var(--fg-3); }
.sh button:hover { color: var(--fg); }
.pad { padding: 18px 20px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { font-weight: 400; color: var(--fg-3); text-align: left; padding: 11px 20px; font-size: 13px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--panel); }
td { padding: 12px 20px; border-bottom: 1px solid var(--line-soft); color: var(--fg-2); white-space: nowrap; }
td.n, th.n { text-align: right; }
td.f { color: var(--fg); }
tr:last-child td { border-bottom: 0; }
.tw { overflow-x: auto; }

/* Experts split */
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--raised); gap: 2px; }
.stack i { display: block; height: 100%; }
.s1 { background: var(--fg); } .s2 { background: var(--fg-3); } .s3 { background: var(--tadamoo-500); }
.leg { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; font: 400 13.5px/1.2 var(--font-mono); color: var(--fg-3); }
.leg span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.leg b { color: var(--fg); font-weight: 500; }

/* Speed charts */
.cb { flex: 1; min-height: 0; display: flex; flex-direction: column; border-bottom: 1px solid var(--line-soft); }
.cb:last-child { border-bottom: 0; }
.read { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.read span { font-size: 13.5px; color: var(--fg-3); }
.read b { font: 500 25px/1 var(--font-mono); letter-spacing: -.02em; }
.read b small { font-size: 13.5px; font-weight: 400; color: var(--fg-3); letter-spacing: 0; margin-left: 4px; }
.chart { position: relative; flex: 1; min-height: 64px; margin: 16px 20px 18px 50px; cursor: crosshair; touch-action: none; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart .g { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line-soft); }
.chart .g span { position: absolute; left: -44px; top: -7px; font: 400 12px/1 var(--font-mono); color: var(--fg-3); }
.chart polyline { fill: none; stroke: var(--fg-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
#line-decode { stroke: var(--accent); }
.cur { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--fg-3); pointer-events: none; }
.cdot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); pointer-events: none; box-sizing: content-box; }
.tip { position: absolute; z-index: 2; transform: translate(12px, -50%); pointer-events: none; background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; display: flex; flex-direction: column; gap: 3px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.tip.flip { transform: translate(calc(-100% - 12px), -50%); }
.tip b { font: 500 14px/1 var(--font-mono); }
.tip span { font: 400 12.5px/1 var(--font-mono); color: var(--fg-3); }

/* Requests and log */
.col-r { min-width: 0; }
.reqs { flex: 3 1 0; }
.reqs .tw { flex: 1; min-height: 0; overflow: auto; }
.reqs tbody tr:hover td { background: var(--surface); }
.reqs tr.live td.f.live { color: var(--accent); }
.reqs td.warn { color: var(--warn); }
.reqs td.err { color: var(--err); }
.tabsec .sh { gap: 4px; padding-left: 8px; }
.tabsec .sh .tab { font: 500 13.5px/1 var(--font-sans); padding: 8px 12px; }
.tabsec .sh .tab[aria-selected="true"], .tabsec .sh .tab[aria-selected="true"]:hover { color: var(--fg); background: var(--raised); }
.tabsec .sh .cnt { margin-left: auto; padding-right: 12px; }
.tabsec [role="tabpanel"] { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.tabsec .phead { display: none; padding-left: 20px; }
.tabsec .phead .cnt { margin-left: auto; padding-right: 0; }
.col-r.single .tabsec > .tabhead { display: none; }
.col-r.single .tabsec .phead { display: flex; }
.col-r.single #pane-req { flex: 1 1 0; min-height: 0; }
.col-r.single #pane-log { flex: 1 1 0; min-height: 0; border-top: 1px solid var(--line-soft); }
.empty { padding: 32px 20px; color: var(--fg-3); font: 400 13.5px/1.4 var(--font-mono); }
.logsec { flex: 2 1 0; }
.tools { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; font: 400 13px/1 var(--font-mono); color: var(--fg-3); }
.seg { display: flex; background: var(--bg); border-radius: 6px; padding: 2px; gap: 2px; }
.seg button { padding: 8px 13px; color: var(--fg-3); border-radius: 4px; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { color: var(--fg); background: var(--raised); }
.tools input { background: var(--bg); border: 1px solid transparent; border-radius: 6px; padding: 9px 12px; width: 240px; color: var(--fg); }
.tools input::placeholder { color: var(--fg-3); }
.tools input:focus { border-color: var(--fg-3); outline: 0; }
.logwrap { position: relative; flex: 1; min-height: 0; display: flex; }
.log { flex: 1; min-height: 0; overflow: auto; font-size: 13px; padding: 8px 0; }
.ln { display: grid; grid-template-columns: 112px 44px 38px minmax(0, 1fr); gap: 0 14px; padding: 1px 20px; line-height: 22px; color: var(--fg-2); }
.ln:hover { background: var(--surface); }
.ln .t, .ln .s, .ln .lv { color: var(--fg-3); }
.ln .msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.ln .msg .n { color: var(--fg); }
.ln.warn .lv { color: var(--warn); }
.ln.err .lv { color: var(--err); }
.ln.err .msg, .ln.warn .msg { color: var(--fg); }
mark { background: var(--hit); color: var(--fg); padding: 0 1px; border-radius: 2px; }
.jump { position: absolute; right: 18px; bottom: 14px; background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 9px 14px; font: 500 13px/1 var(--font-mono); box-shadow: 0 4px 14px rgba(0,0,0,.35); }

/* API key prompt, shown only when the server asks for one */
.auth { display: flex; align-items: center; gap: 12px; margin: 0 28px 16px; padding: 12px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; flex: none; }
.auth label { color: var(--fg-2); }
.auth input { flex: 1; max-width: 360px; background: var(--bg); border: 1px solid transparent; border-radius: 6px; padding: 9px 12px; color: var(--fg); font-family: var(--font-mono); }
.auth input:focus { border-color: var(--fg-3); outline: 0; }
.auth button { padding: 9px 16px; border-radius: 6px; background: var(--raised); }

/* Hardware: a line per device, with its memory, readings and expert tier */
.hw { display: block; overflow: auto; }
.hwgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; align-content: start; padding-bottom: 8px; }
.hwgrid > .wide { grid-column: 1 / -1; }
.devs { min-width: 1040px; }
.dl { display: grid; grid-template-columns: minmax(170px, 1.2fr) minmax(240px, 2fr) repeat(4, minmax(80px, .7fr)) minmax(120px, .9fr); gap: 0 26px; align-items: center; padding: 20px 26px; }
.dl + .dl { border-top: 1px solid var(--line-soft); }
.dl.head { padding-top: 14px; padding-bottom: 12px; font-size: 13px; color: var(--fg-3); }
.dl.head span:nth-child(n+3) { text-align: right; }
.dn b { display: block; font: 600 16px/1.25 var(--font-sans); }
.dn span { display: block; margin-top: 5px; font: 400 13px/1 var(--font-mono); color: var(--fg-3); }
.meter { height: 6px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--fg-2); }
.dm { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: baseline; font: 500 17px/1 var(--font-mono); }
.dm i { font: normal 400 13.5px/1 var(--font-mono); color: var(--fg-3); }
.dm > .meter { grid-column: 1 / -1; }
.dm .lk { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: -2px; }
.dm .lk .meter { height: 3px; }
.dm .lk .meter i { background: var(--fg-3); }
.dv { font: 500 17px/1 var(--font-mono); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dv small { font-size: 13px; font-weight: 400; color: var(--fg-3); margin-left: 4px; }
.dv.none { color: var(--fg-3); }
.dx { text-align: right; white-space: nowrap; }
.dx b { display: block; font: 500 17px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.dx span { display: block; margin-top: 6px; font: 400 13px/1 var(--font-mono); color: var(--fg-3); }
.kv { margin: 0; display: grid; grid-template-columns: 150px minmax(0, 1fr); padding: 8px 0; }
.kv dt, .kv dd { margin: 0; padding: 12px 26px; font-size: 14px; }
.kv dt { color: var(--fg-3); }
.kv dd { color: var(--fg); overflow-wrap: anywhere; }

@media (min-width: 981px) {
  body { height: 100vh; overflow: hidden; }
  .stats { overflow: hidden; }
}
@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr; }
  .col-l { overflow: visible; order: 2; }
  .col-r { order: 1; }
  .logwrap { min-height: 60vh; }
  .hwgrid { grid-template-columns: 1fr; }
  .model, .where { display: none; }
}
@media (max-width: 640px) {
  .top, .auth { margin-inline: 12px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-hero { grid-column: 1 / -1; }
  .sys { gap: 8px 20px; padding: 12px 16px; }
  main { padding-inline: 12px; }
  .bar { gap: 10px; padding: 0 12px; }
  .tools input { width: 100%; }
  .ln { grid-template-columns: 84px 34px minmax(0, 1fr); gap: 0 8px; }
  .ln .lv { display: none; }
}


/* Parallel slots: lanes, queue, aggregate labels. One viewport on desktop; stacked on a phone. */
.chart { margin-left: 56px; margin-bottom: 20px; }
.chart .g span { left: -36px; }
.bar { flex-wrap: wrap; }
.m-hero .sub { color: var(--fg-2); }
.m-hero .sub b { color: var(--fg); font-weight: 500; }
#line-per { stroke: var(--fg-3); stroke-width: 1.25; stroke-dasharray: 4 3; }
.read em { font: normal 400 13px/1 var(--font-mono); color: var(--fg-3); }

.lane { display: grid; grid-template-columns: 56px 112px 120px 112px minmax(190px, 1fr) 56px 200px; gap: 0 20px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-soft); font: 400 13.5px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg-2); }
.lane.head { border-top: 0; padding-block: 11px; font-size: 13px; color: var(--fg-3); font-family: var(--font-sans); }
.lane > * { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane .l-id { color: var(--fg); font-weight: 500; }
.lane .l-st { display: flex; align-items: center; gap: 8px; }
.lane[data-s="decoding"] .l-st { color: var(--accent); }
.lane[data-s="prefill"] .l-st { color: var(--fg); }
.lane[data-s="idle"] .l-st, .lane[data-s="idle"] .l-tok { color: var(--fg-3); }
.lane .l-tps { font: 500 17px/1 var(--font-mono); color: var(--fg); letter-spacing: -.01em; }
.lane[data-s="decoding"] .l-tps { color: var(--accent); }
.lane .l-tps small { font-size: 13px; font-weight: 400; color: var(--fg-3); margin-left: 4px; }
.lane .l-ctx { display: grid; grid-template-columns: minmax(40px, 1fr) auto; gap: 12px; align-items: center; }
.lane .l-ctx .meter i { background: var(--fg-2); }
.lane .l-ctx .meter.hot i { background: var(--warn); }
.lane[data-s="idle"] .l-ctx .meter i { background: var(--tadamoo-500); }
.lane .l-ctx span { color: var(--fg-2); }
.lane .l-ctx > span:last-child { overflow: visible; }
.lane .l-acc { text-align: right; color: var(--fg); }
.lane .l-req b { font-weight: 400; color: var(--fg); }
.lane .l-tok { color: var(--fg); }
.qsec .tw table td, .qsec .tw table th { padding-block: 10px; }
.qsec .empty { padding: 20px; }
/* desktop: one viewport, no page scroll. Slots on top right, Requests and Log side by side under it, speed and queue on the left. */
@media (min-width: 981px) {
  .bar { height: auto; min-height: 56px; padding-block: 6px; row-gap: 6px; padding-inline: 28px; }
  .brand img { width: 32px; height: 32px; }
  .wordmark { font-size: 24px; }
  .top { margin-bottom: 12px; }
  .m { padding: 12px 20px 12px; gap: 7px; }
  .m-hero .v { font-size: 40px; }
  .v { font-size: 26px; }
  .heat { margin-top: 0; }
  .sys { padding: 8px 20px; }
  main { padding-bottom: 16px; }
  .stats { grid-template-rows: minmax(0, 1fr); gap: 12px; grid-template-columns: 380px minmax(0, 1fr); }
  .col { gap: 12px; }
  .col-l { overflow: hidden; }
  .col-l > .speed { flex: 1 1 0; min-height: 0; }
  .col-l > .qsec { flex: 1 1 0; min-height: 0; }
  .col-l > .sec:not(.speed):not(.qsec) { flex: none; }
  .sh { min-height: 42px; padding: 0 16px; }
  .pad { padding: 12px 16px; }
  .read { padding: 10px 16px 0; }
  .read b { font-size: 21px; }
  .chart { margin: 10px 16px 16px 52px; min-height: 40px; }
  .leg { margin-top: 10px; }
  .col-r.single { grid-template-rows: minmax(0, 1fr); }
  .col-r { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; overflow: hidden; }
  .col-r > .slots { grid-column: 1 / -1; }
  .col-r > .tabsec { grid-column: 1 / -1; flex: none; min-height: 0; min-width: 0; }
  .qsec .tw, .reqs .tw { flex: 1; min-height: 0; overflow: auto; }
  th { padding: 8px 12px; }
  td { padding: 8px 12px; }
  th:first-child, td:first-child { padding-left: 16px; }
  .lane { grid-template-columns: 52px 108px 118px 104px minmax(140px, 1fr) 52px minmax(0, 190px); gap: 0 14px; padding: 6px 16px; }
  .lane.head { padding-block: 8px; }
  .lane .l-tps { font-size: 15px; }
  .tools { padding: 8px 16px; gap: 12px; }
  .tools input { width: 150px; padding: 7px 10px; }
  .seg button { padding: 6px 10px; }
  .ln { padding-inline: 16px; grid-template-columns: 96px 36px 32px minmax(0, 1fr); gap: 0 10px; line-height: 20px; }
  .log { padding: 4px 0; }
  .ln .msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tools { flex-wrap: nowrap; gap: 8px; }
  .tools .seg button { padding: 6px 8px; }
  .tools input { min-width: 96px; }
  .tools .grow { display: none; }
  .tools input { flex: 1; min-width: 0; width: auto; }
  .col-l > .qsec { flex: none; }
  .col-l > .speed { flex: 1 1 0; }
  .qsec td { padding-block: 6px; }
  .qsec td:nth-child(3) { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .qsec .empty { padding: 12px 16px; }
  .reqs td { padding-block: 6px; }
  .reqs th, .reqs td { padding-inline: 8px; }
  .reqs th:first-child, .reqs td:first-child { padding-left: 16px; }
  .reqs th:last-child, .reqs td:last-child { padding-right: 16px; }
  .reqs td:nth-child(3) { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .m-hero .v { font-size: 36px; }
  .sys { padding-block: 6px; }
  .lane { padding-block: 5px; }
}
@media (max-width: 980px) {
  .tabsec { flex: none; }
  .reqs .tw { max-height: none; }
  .logwrap { min-height: 0; }
  .log { max-height: 320px; }
  .bar { height: auto; min-height: 76px; padding-block: 10px; row-gap: 10px; }
  .lane.head { display: none; }
  .lane { grid-template-columns: 56px minmax(96px, 1fr) auto; grid-template-areas: "id st tps" "ctx ctx ctx" "tok acc req"; gap: 10px 14px; }
  .lane .l-id { grid-area: id; } .lane .l-st { grid-area: st; } .lane .l-tps { grid-area: tps; text-align: right; }
  .lane .l-ctx { grid-area: ctx; } .lane .l-tok { grid-area: tok; } .lane .l-acc { grid-area: acc; text-align: center; } .lane .l-req { grid-area: req; text-align: right; }
}
@media (max-width: 640px) {
  .lane { padding-inline: 16px; }
}

/* ---- Chat and Settings views (16 px text, 44 px targets; the Monitor keeps its dense type) ---- */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.tab { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.btn { min-height: var(--btn-h); min-width: var(--btn-h); padding: 4px 12px; border-radius: 6px; background: var(--raised); color: var(--fg); font: 500 var(--btn-fs)/1.2 var(--font-sans); border: 1px solid var(--line); }
.btn:hover { background: #34404B; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--tadamoo-950); font-weight: 600; }
.btn.primary:hover { background: var(--ember-hot); border-color: var(--ember-hot); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--fg-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
select, textarea, .fields input { font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
select { min-height: 44px; padding: 8px 10px; }
select:focus, textarea:focus, .fields input:focus { border-color: var(--fg-3); }
code { font-family: var(--font-mono); font-size: .92em; }

.chat { display: flex; flex-direction: column; }
.chatbox { flex: 1; min-height: 0; }
.chathead { flex-wrap: wrap; gap: 6px 8px; padding-block: 6px; }
.chathead select { min-height: var(--btn-h); padding: 3px 8px; font-size: 13px; }
@media (max-width: 1500px) { .chathead .effort > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.chathead > b { font-size: 15px; }
.effort { display: inline-flex; align-items: center; gap: 8px; }
.effort span { font: 400 12.5px/1 var(--font-sans); color: var(--fg-2); }
.chathead .council-on { min-height: 44px; cursor: pointer; }
.chathead .council-on input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.chathead .council-on > span { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; font-size: var(--chat-font, 16px); line-height: 1.6; }
.chat-empty { margin: auto; max-width: 46ch; text-align: center; color: var(--fg-2); display: flex; flex-direction: column; gap: 8px; }
.chat-empty b { color: var(--fg); font-size: 18px; }
.cmsg { display: flex; flex-direction: column; gap: 6px; max-width: 860px; width: 100%; min-width: 0; }
.cmsg.user { align-self: flex-end; align-items: flex-end; }
.arow { display: flex; align-items: flex-start; gap: 10px; min-width: 0; max-width: 100%; }
.arow > .abody, .arow > .ablock, .arow > .answer, .arow > .atool, .arow > .aask, .arow > .ablocked, .arow > .anote, .arow > span:not(.cts) { flex: 1 1 auto; min-width: 0; }
.cts { flex: 0 0 auto; display: flex; flex-direction: column; min-width: 62px; padding-top: 3px; font: 400 11px/1.3 var(--font-sans); color: var(--fg-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cts { font-style: normal; }
.cts b { font-weight: 700; color: var(--fg-2); }
.srcbtn { display: inline-flex; align-items: center; margin: 0 2px 0 6px; padding: 0 7px; min-height: 18px; border: 1px solid var(--line); border-radius: 9px; font: 500 11px/1.4 var(--font-sans); color: var(--fg-2); text-decoration: none; white-space: nowrap; vertical-align: baseline; }
.srcbtn:hover, .answer a.srcbtn:hover { border-color: var(--accent); color: var(--fg); }
.answer a.srcbtn { color: var(--fg-2); text-decoration: none; }
.asrc { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 8px; }
.asrc .srcbtn { margin: 0; }
.cmsg.user .arow { justify-content: flex-end; }
.cmsg.user .arow > .bubble { flex: 0 1 auto; }
.cmsg.user .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 10px 10px 2px 10px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: min(640px, 100%); }
.cmsg .imgs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.cmsg .imgs img { max-width: 180px; max-height: 180px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }
.chip { font: 400 14px/1.4 var(--font-mono); color: var(--fg-2); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.meta { display: flex; align-items: center; gap: 12px; font: 400 13.5px/1.4 var(--font-mono); color: var(--fg-2); min-height: 24px; }
.answer { overflow-wrap: anywhere; min-width: 0; }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p, .answer ul, .answer ol, .answer blockquote { margin: 0 0 12px; }
.answer h3, .answer h4 { margin: 18px 0 8px; font-size: 17px; line-height: 1.4; }
.answer ul, .answer ol { padding-left: 24px; }
.answer li + li { margin-top: 4px; }
.answer a { color: var(--accent); text-underline-offset: 3px; }
.answer blockquote { border-left: 3px solid var(--raised); padding-left: 12px; color: var(--fg-2); }
.answer hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.answer :not(pre) > code { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 5px; }
.answer .code { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.answer .code .lang { display: block; padding: 6px 12px; font: 400 13px/1.4 var(--font-mono); color: var(--fg-2); border-bottom: 1px solid var(--line-soft); }
.answer pre { margin: 0; padding: 12px; overflow-x: auto; font: 400 14px/1.55 var(--font-mono); }
.answer .mdt { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.answer table { font-size: 15px; }
.answer th, .answer td { font-family: var(--font-sans); white-space: normal; padding: 8px 12px; position: static; }
.answer .err { color: #FF8FA3; }
.answer .ctx-notice { color: var(--warn); font-size: .9em; margin: 0 0 .5em; }
.answer .wait { color: var(--fg-2); }
.dots::after { content: "…"; display: inline-block; animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.think { border: 1px solid var(--line-soft); border-left: 3px solid #B38CF0; border-radius: 8px; background: var(--bg); }
.think summary { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; color: var(--fg-2); font-size: 14.5px; list-style: none; }
.think summary::-webkit-details-marker { display: none; }
.think summary::before { content: ""; width: 0; height: 0; border-left: 6px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .15s; }
.think[open] summary::before { transform: rotate(90deg); }
.think-b { padding: 4px 12px 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); font: 400 14px/1.55 var(--font-mono); max-height: calc(20 * 1.55em + 16px); overflow-y: auto; overscroll-behavior: contain; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; background: var(--panel); flex: none; }
.composer textarea { width: 100%; resize: none; padding: 10px 12px; min-height: 52px; max-height: 40vh; display: block; }
.crow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 13.5px; color: var(--fg-2); }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 4px; max-width: 100%; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.att span { font-size: 14px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }

.settings { overflow: auto; }
.setnote { margin: 0; padding: 0 26px 18px; color: var(--fg-2); font-size: 15px; line-height: 1.55; }
.setnote b { color: var(--fg); }
.warnnote { color: var(--warn); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px 24px; padding: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font: 500 15px/1.4 var(--font-sans); }
.fields input { min-height: 44px; padding: 8px 12px; width: 100%; font-family: var(--font-mono); }
.field select { width: 100%; }
.field .help, .field .now, .field .ferr { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-2); }
.field .now { font-family: var(--font-mono); font-size: 13.5px; }
.field .now.pending { color: var(--warn); }
.field .ferr { color: #FF8FA3; }
.fields [aria-invalid="true"] { border-color: var(--err); }
fieldset:disabled input, fieldset:disabled select { opacity: .7; }
.setactions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 16px 20px; border-top: 1px solid var(--line-soft); }
.setstatus { margin: 0 auto 0 0; flex: 1 1 240px; font-size: 15px; color: var(--fg-2); min-width: 0; }
.setstatus[data-kind="ok"] { color: var(--fg); }
.setstatus[data-kind="err"] { color: #FF8FA3; }
.kv dd code, .setnote code { overflow-wrap: anywhere; }

@media (max-width: 980px) {
  .chatbox { overflow: visible; }
  .msgs { overflow: visible; min-height: calc(100dvh - 330px); padding: 16px; }
  .composer { position: sticky; bottom: 0; z-index: 3; border-radius: 0 0 8px 8px; }
}
@media (max-width: 640px) {
  .tabs { order: 5; flex: 1 0 100%; margin-left: 0; gap: 8px; }
  /* on a narrow window the nine tabs share the row equally and a label wraps, hyphenated where the browser can */
  .tabs .tab { flex: 1 1 0; white-space: normal; padding: 8px 4px; min-width: 0; text-align: center; line-height: 1.15; hyphens: auto; overflow-wrap: anywhere; }
  .auth { flex-wrap: wrap; }
  .auth input { min-width: 0; max-width: none; }
  .auth input, .auth button { min-height: 44px; font-size: 16px; }
  .cmsg.user { max-width: 92%; }
  .fields { grid-template-columns: 1fr; padding: 16px; }
  .setnote { padding-inline: 16px; }
  .chathead .effort span { display: none; }
  .hint { display: none; }
  .kv { grid-template-columns: 90px minmax(0, 1fr); }
  .kv dt, .kv dd { padding: 10px 16px; }
}
@media (min-width: 981px) {
  /* the page keeps the window's height: only the messages scroll, the columns at the sides stay in place */
  body[data-view="chat"], body[data-view="agent"] { height: 100vh; height: 100dvh; overflow: hidden; }
  .chatbox { height: 100%; }
  .chat .composer { padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}.sh .btn { font: 500 var(--btn-fs)/1.2 var(--font-sans); color: var(--fg); }
.sh .btn:hover { color: var(--fg); }
@media (max-width: 980px) { .col-r.single #pane-req, .col-r.single #pane-log { flex: none; } }

/* ---- Chat settings, context meter, compacted turns ---- */
.chat.withset { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 16px; align-items: stretch; }
.chatset { min-height: 0; overflow-y: auto; }
.chatset .sh { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.csform { overflow-y: auto; padding: 4px 0 0; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.csgroup { border: 0; margin: 0; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.csgroup legend { padding: 0; margin-bottom: 8px; font: 600 15px/1.4 var(--font-sans); float: left; width: 100%; }
.csgroup > label, .csnum label { font: 500 15px/1.4 var(--font-sans); }
.csgroup textarea, .csgroup input[type=text], .csnum input, .csgroup select { width: 100%; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 44px; }
.csgroup textarea { resize: vertical; min-height: 88px; }
.kn-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kn-field label, .kn-check { font: 500 15px/1.4 var(--font-sans); }
.kn-field input, .kn-field select { width: 100%; max-width: 32rem; min-height: 44px; box-sizing: border-box; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.kn-field textarea { max-width: 32rem; box-sizing: border-box; font-family: var(--font-mono); }
.kn-help.setnote { padding: 0; font-size: 14px; }
.kn-check { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.kn-check input { width: 24px; height: 24px; flex: none; }
.kn-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 18px 0; }
.kn-status, .kn-check.setnote { padding: 8px 18px 0; }
.kn-status[data-bad="1"] { color: var(--warn); }
.csnum input { font-family: var(--font-mono); }
.csrow { display: flex; gap: 8px; align-items: center; min-width: 0; }
.csrow > select, .csrow > input { flex: 1; min-width: 0; }
.csrow.wrap { flex-wrap: wrap; }
.csgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 14px; clear: both; }
.csnum { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.csform .help { margin: 0; font-size: 14px; line-height: 1.5; color: var(--fg-2); }
.csform [aria-invalid="true"] { border-color: var(--err); }
.radio { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; clear: both; }
.radio input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.radio span { display: flex; flex-direction: column; gap: 2px; }
.radio b { font: 500 15px/1.4 var(--font-sans); }
.radio small { font-size: 14px; line-height: 1.45; color: var(--fg-2); }
.csnote { margin: 0; font-size: 14px; line-height: 1.5; color: var(--warn); }
.csform .setactions { position: sticky; bottom: 0; background: var(--panel); }
.ctxm { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 400 13.5px/1.2 var(--font-mono); color: var(--fg-2); }
.ctxm-bar { width: 90px; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; display: inline-block; }
.ctxm-bar i { display: block; height: 100%; width: 0; background: var(--fg-2); }
.ctxm[data-level="high"] .ctxm-bar i { background: var(--warn); }
.ctxm[data-level="full"] .ctxm-bar i { background: var(--err); }
.ctxm[data-level="full"] { color: #FF8FA3; }
.cmsg.outside { opacity: .6; }
.outside-l { font: 400 13px/1.4 var(--font-mono); color: var(--warn); }
.cmsg.summary { max-width: min(860px, var(--chat-width, 860px)); }
.compacted { border: 1px dashed var(--line); border-radius: 8px; background: var(--bg); }
.compacted > summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; color: var(--fg-2); font-size: 15px; }
.compacted > .answer { padding: 4px 14px 12px; font-size: 15px; }
.compacted .orig { margin: 0 14px 12px; }
.compacted .orig > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--fg-2); }
.orig-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding: 4px 0; }
.orig-m { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); }
.orig-m b { display: block; color: var(--fg); font-weight: 600; }
.compacted .undo { margin: 0 14px 14px; }

/* ---- Loader ---- */
.loader { overflow: auto; }
.ldgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; padding-bottom: 8px; }
.ldmodel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ldgroup { border: 0; margin: 0; padding: 0; min-width: 0; border-top: 1px solid var(--line-soft); }
.ldgroup legend { padding: 16px 20px 0; font: 600 15px/1.4 var(--font-sans); float: left; width: 100%; }
.ldgroup .fields { clear: both; padding-top: 12px; }
.ldgroup summary { padding: 0 20px; min-height: 48px; display: flex; align-items: center; cursor: pointer; font: 600 15px/1.4 var(--font-sans); }
.ldgroup summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.field .help.unsup { color: var(--warn); }
.field.check label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.field.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }
.fields select:disabled, .fields input:disabled { opacity: .5; }
.ldprof { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line-soft); }
.pfrow { display: flex; gap: 8px; align-items: center; min-width: 0; }
.pfrow.wrap { flex-wrap: wrap; }
.pfrow label { font: 500 15px/1.4 var(--font-sans); flex: none; }
.pfrow select { flex: 1; min-width: 0; text-overflow: ellipsis; }
.pfrow input[type=text], .pfrow input[type=password] { flex: 1 1 180px; min-width: 0; min-height: 44px; padding: 8px 12px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.pfrow .btn, .ldprof a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.filebtn { position: relative; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.filebtn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.headless code { font-size: 13px; color: var(--fg-2); overflow-wrap: anywhere; min-width: 0; flex: 1 1 200px; }
.headless span { font: 500 14px/1.4 var(--font-sans); }
.ldprof .setnote { padding: 0; font-size: 14px; }
.pfmsg { margin: 0; flex: none; font-size: 15px; }
.pfmsg[data-kind="err"], .ldstate[data-kind="err"] { color: #FF8FA3; }
.pfmsg:empty { display: none; }
.ldsafe { margin: 0; border-top: 1px solid var(--line-soft); }
.ldsafe > summary { min-height: 48px; display: flex; align-items: center; padding: 0 20px; cursor: pointer; font: 600 15px/1.4 var(--font-sans); }
.ldsafe dl { margin: 0; padding: 0 20px 16px; display: grid; gap: 4px; }
.ldsafe dt { margin-top: 8px; font: 500 15px/1.4 var(--font-sans); }
.ldsafe dd { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.ldside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ldside .pad, #st-side .pad { display: flex; flex-direction: column; gap: 18px; padding: 16px 20px; }
.res { display: flex; flex-direction: column; gap: 6px; }
.res-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.res-h b { font: 600 15px/1.4 var(--font-sans); }
.res .fit { font: 600 14px/1.2 var(--font-sans); color: var(--fg); }
.res[data-ok="false"] .fit { color: #FF8FA3; }
.res-n { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 400 14px/1.4 var(--font-mono); color: var(--fg-2); }
.resbar { position: relative; height: 10px; border-radius: 5px; background: var(--raised); overflow: hidden; }
.resbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--fg-2); border-radius: 5px; }
.res[data-ok="false"] .resbar i { background: var(--err); }
.resbar u { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); }
.resbar s { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fg); }
.res-note { margin: 0; font-size: 14px; line-height: 1.45; color: var(--fg-2); }
.res-items { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.res-items li { display: flex; justify-content: space-between; gap: 12px; color: var(--fg-2); }
.res-items b { font: 400 14px/1.4 var(--font-mono); color: var(--fg); }
.spd dd b { font: 600 20px/1.2 var(--font-mono); color: var(--accent); margin-right: 4px; }
.ldspeed .setnote { padding: 0 20px 12px; font-size: 14px; }
.ldgo { padding: 0; }
.ldwhy { margin: 0; padding: 14px 20px 0; color: #FF8FA3; font-size: 15px; line-height: 1.5; }
.ldgo .ldstate { padding: 10px 20px 0; margin: 0; }
.ldgo .ldstate:empty { display: none; }
.ldgo .setactions { border-top: 0; }
#st-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; padding: 0 16px 16px; }
#st-side > .sec { border-color: var(--line-soft); }
@media (max-width: 980px) {
  .chat.withset { display: flex; flex-direction: column; }
  .chatset { order: -1; }
  .ldgrid { grid-template-columns: 1fr; }
  .ctxm-bar { width: 60px; }
}
@media (max-width: 640px) {
  .csgroup { padding: 12px 16px; }
  .ldprof { padding: 12px 16px; }
  .ldgroup legend { padding-inline: 16px; }
  .ldgroup summary { padding-inline: 16px; }
  .pfrow:not(.wrap) { flex-wrap: wrap; }
  .pfrow:not(.wrap) select { flex: 1 1 100%; }
  .ldside .pad, #st-side .pad { padding: 14px 16px; }
  #st-side { grid-template-columns: 1fr; padding: 0 12px 12px; }
  .ctxm-t { font-size: 12.5px; }
  .tabs .tab { font-size: 13.5px; padding-inline: 2px; }
}
@media (min-width: 981px) {
  .chat.withset .chatset { height: 100%; }
}
.filebtn { display: inline-flex; align-items: center; justify-content: center; }
.ldsticky { display: none; }
@media (max-width: 980px) {
  .ldform { overflow: visible; }
  .ldsticky { display: flex; position: sticky; bottom: 0; z-index: 3; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
  .ldsticky:empty { display: none; }
  .stk-parts { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 500 14px/1.4 var(--font-mono); color: var(--fg); min-width: 0; }
  .stk-parts [data-ok="false"] { color: #FF8FA3; }
  .ldsticky .btn { text-decoration: none; display: inline-flex; align-items: center; flex: none; }
}
.csrow a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- Models (models.js): the picker, the folders, the jobs, the conversion dialog ---- */
.ldgpu { padding: 14px 20px; margin-bottom: 16px; font-size: 16px; }
.ldmodels { margin-bottom: 16px; }
.mdl { display: flex; flex-direction: column; gap: 12px; padding: 14px 20px 16px; min-width: 0; }
.mdl-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mdl-pick label { font: 500 15px/1.4 var(--font-sans); }
.mdl-pick select { min-height: 48px; padding: 8px 12px; flex: 1 1 260px; min-width: 0; }
.mdl-ask { display: flex; flex-direction: column; gap: 4px; }
.mdl-ask > .warnnote { padding: 0; font-size: 16px; }
.mdl .setnote { padding: 0; font-size: 15px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font: 400 14px/1.4 var(--font-mono); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 14px/1.3 var(--font-sans); border-radius: 6px; padding: 3px 8px; border: 1px solid currentColor; white-space: nowrap; }
.badge[data-s="ready"] { color: #7EE2A8; }
.badge[data-s="convert"] { color: var(--ember-hot); }
.badge[data-s="incompatible"] { color: #FF8FA3; }
.badge[data-s="att"], .badge[data-s="def"] { color: var(--fg-2); }
.mdl-all > summary, .mdl-inc > summary, .mdl-job details > summary, .mdl-dlg details > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font: 600 15px/1.4 var(--font-sans); }
.mdl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mdl-inc { margin-top: 8px; }
.mdl-dirbox { margin: 8px 0 0; }
.mdl-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); min-width: 0; }
.mdl-card[data-s="ready"] { border-left: 4px solid #7EE2A8; }
.mdl-card[data-s="convert"] { border-left: 4px solid var(--ember-hot); }
.mdl-card[data-s="incompatible"] { border-left: 4px solid var(--tadamoo-500); }
.mdl-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mdl-h b { font: 600 16px/1.4 var(--font-sans); overflow-wrap: anywhere; min-width: 0; }
.mdl-path { margin: 0; font-size: 13.5px; color: var(--fg-2); overflow-wrap: anywhere; }
.mdl-path code { font-size: 13.5px; }
.mdl-why, .mdl-note { margin: 0; font-size: 15px; line-height: 1.5; color: var(--fg-2); }
.mdl-card[data-s="incompatible"] .mdl-why { color: var(--fg); }
.mdl-act { display: flex; flex-wrap: wrap; gap: 8px; }
.mdl-act .btn[aria-pressed="true"] { border-color: var(--accent); }
.mdl-dirs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mdl-dirrows { display: flex; flex-direction: column; gap: 12px; }
.mdl-dirrow .pfrow { flex-wrap: wrap; }
.mdl-dirrow input { flex: 1 1 240px; min-width: 0; min-height: 48px; padding: 8px 12px; font: 400 16px/1.5 var(--font-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.mdl-dirrow input[aria-invalid="true"] { border-color: var(--err); }
.mdl-dirrow label { font: 500 15px/1.4 var(--font-sans); }
.mdl-sugg-h { margin: 4px 0 0; font-size: 15px; color: var(--fg-2); }
.mdl-sugg .btn { overflow-wrap: anywhere; text-align: left; }
.mdl-dirs .setactions { padding: 8px 0 0; border-top: 0; }
.mdl-msg:empty { display: none; }
.mdl-job { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.mdl-job-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mdl-job-h b { font: 600 15px/1.4 var(--font-sans); overflow-wrap: anywhere; }
.mdl-job[data-phase="failed"] .mdl-job-h span { color: #FF8FA3; }
.mdl-job[data-phase="done"] .mdl-job-h span { color: #7EE2A8; }
.mdl-bar { height: 10px; border-radius: 5px; background: var(--raised); overflow: hidden; }
.mdl-bar i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.mdl-job-s, .mdl-job-r { margin: 0; font: 400 14px/1.5 var(--font-mono); color: var(--fg-2); }
.mdl-job-r { color: var(--fg); font-family: var(--font-sans); font-size: 15px; }
.mdl-log { margin: 0; max-height: 260px; overflow: auto; font: 400 13px/1.5 var(--font-mono); color: var(--fg-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.mdl-dlg { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); padding: 0; }
.mdl-dlg::backdrop { background: rgba(5, 7, 9, .72); }
.mdl-dlg form { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); }
.mdl-dlg h2 { margin: 0; font: 600 19px/1.35 var(--font-sans); overflow-wrap: anywhere; }
.mdl-dlg-sum { margin: 0; font-size: 16px; line-height: 1.55; }
.mdl-dlg input { min-height: 48px; padding: 8px 12px; width: 100%; font: 400 16px/1.5 var(--font-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.mdl-dlg .help { margin: 0; font-size: 14px; color: var(--fg-2); overflow-wrap: anywhere; }
.mdl-problems { margin: 0; padding-left: 20px; color: #FF8FA3; font-size: 15px; line-height: 1.5; }
.mdl-problems:empty { display: none; }
.mdl-cmd { display: block; font-size: 13px; color: var(--fg-2); overflow-wrap: anywhere; }
.mdl-dlg .setactions { padding: 8px 0 0; border-top: 0; }
#view-loader[data-blocked] .ldgrid { display: none; }
.stmodels { margin-bottom: 16px; }
.stmodels .mdl-dirs { padding: 14px 20px 16px; }
.stmodels > .warnnote { padding: 14px 20px 0; }
.mdl-defbox { padding: 0 20px 16px; }
.mdl-defbox select { min-height: 48px; padding: 8px 12px; }
.mdl-defbox .setstatus:empty { display: none; }
.mdl-def { color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.mdl-goset { text-decoration: none; display: inline-flex; align-items: center; }

/* the VRAM left free: slider + number, and the live figures under it */
.rsv { gap: 8px; }
.ldgroup .fields .rsv { grid-column: 1 / -1; }
.rx-note { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); font-size: 14px; line-height: 1.5; color: var(--fg-2); }
.rx-note[hidden] { display: none; }
.rx-note p { margin: 0 0 6px; }
.rx-note ul { margin: 0 0 6px; padding-left: 18px; }
.rsv label { font: 600 16px/1.4 var(--font-sans); }
.rsv-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rsv-row input[type=range] { flex: 1 1 220px; min-width: 0; height: 44px; accent-color: var(--accent); margin: 0; }
.rsv-num { display: inline-flex; align-items: center; gap: 6px; font: 500 16px/1 var(--font-sans); }
.rsv-num input { width: 110px; min-height: 44px; padding: 8px 10px; font: 400 16px/1.5 var(--font-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.rsv-figs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 16px; }
.rsv-figs li { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: var(--fg-2); }
.rsv-figs b { font: 600 17px/1.3 var(--font-mono); color: var(--fg); }
.rsv-warn { margin: 0; color: var(--warn); font-size: 15px; line-height: 1.5; }
.rsv-live .help { margin: 6px 0 0; }
@media (max-width: 640px) {
  .mdl { padding: 12px 16px 14px; }
  .ldgpu { padding: 12px 16px; }
  .stmodels .mdl-dirs, .mdl-defbox { padding-inline: 16px; }
  .mdl-act .btn, .mdl-dirs .setactions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .mdl-bar i { transition: none; } }
/* narrow screens: the Loader's column never grows past the screen (a long profile name in a <select> did) */
@media (max-width: 980px) {
  .ldgrid { grid-template-columns: minmax(0, 1fr); }
  .ldform, .ldside, .ldmodels { min-width: 0; max-width: 100%; }
  .ldform select, .ldmodels select, #st-prof select { max-width: 100%; width: 100%; }
}
/* the chat's active preset, the Loader's no-model note */
.csactive { margin: 0 0 6px; font-size: 14px; line-height: 1.5; color: var(--fg-2); }
.ldstandby { padding: 14px 20px; margin-bottom: 16px; font-size: 16px; color: var(--fg); }
@media (max-width: 640px) { .ldstandby { padding: 12px 16px; } }
/* ---- the configuration wizard (wizard.js): a dialog, the whole screen on a phone ---- */
.wz { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); padding: 0; }
.wz::backdrop { background: rgba(5, 7, 9, .72); }
.wz-form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.wz-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px 10px; border-bottom: 1px solid var(--line-soft); }
.wz-head > div { flex: 1; min-width: 0; }
.wz-head h2 { margin: 0; font: 600 19px/1.35 var(--font-sans); }
.wz-stepno { margin: 4px 0 0; font-size: 14px; color: var(--fg-2); }
.wz-body { overflow-y: auto; padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 12px; font-size: 16px; line-height: 1.55; }
.wz-body:focus { outline: none; }
.wz-body h3 { margin: 10px 0 0; font: 600 16px/1.4 var(--font-sans); }
.wz-body .setnote { padding: 0; }
.wz-intro { color: var(--fg) !important; }
.wz-kv { margin: 0; }
.wz-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.wz-det { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.wz-mon { border: 0; margin: 0; padding: 0; min-width: 0; }
.wz-mon legend { font: 600 15px/1.4 var(--font-sans); margin-bottom: 4px; padding: 0; }
.wz-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.wz-check input, .wz-mon input { width: 20px; height: 20px; flex: none; }
.wz-body .field input, .wz-body .field select { min-height: 44px; padding: 8px 12px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.wz-body .field input[type=number] { max-width: 180px; font-family: var(--font-mono); }
.wz-fit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wz-fit li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; }
.wz-fit li[data-ok="false"] { border-color: var(--err); }
.wz-fit li[data-ok="false"] span { color: #FF8FA3; }
.wz-fit b { font: 500 14.5px/1.4 var(--font-mono); }
.wz-speed { margin: 0; font-weight: 600; }
.wz-values { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.wz-values dt { font-weight: 500; margin-top: 8px; overflow-wrap: anywhere; }
.wz-values dd { margin: 0; color: var(--fg-2); font-size: 14.5px; }
.wz-progress { min-height: 24px; color: var(--fg-2); }
.wz-res { margin: 0; }
.wz-res[data-kind="ok"] { color: var(--fg); }
.wz-res[data-kind="err"] { color: #FF8FA3; }
.wz-body .ferr { margin: 0; color: #FF8FA3; }
.wz-body .setactions { padding: 4px 0 0; border-top: 0; justify-content: flex-start; }
.wz-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.wz-msg { margin: 0 auto 0 0; flex: 1 1 160px; }
@media (max-width: 640px) {
  .wz { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .wz-form { max-height: 100dvh; height: 100%; }
  .wz-head { padding: calc(12px + env(safe-area-inset-top)) 16px 10px; }
  .wz-body { padding: 8px 16px 16px; flex: 1; }
  .wz-foot { padding-inline: 16px; }
  .wz-foot .btn { flex: 1 1 0; }
}
@media (max-width: 640px) { .wz-msg { flex-basis: 100%; } .wz-msg:empty { display: none; } }

/* the fork's name beside the wordmark */
.wm-sub { font-weight: 600; font-size: .62em; letter-spacing: 0; color: var(--accent); white-space: nowrap; }

/* Settings: the language */
.stlang { margin-bottom: 16px; }
.stlang-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 20px; }
.stlang-body label { font: 500 15px/1.4 var(--font-sans); flex: 1 1 260px; }
.stlang-body select { min-height: 44px; flex: 0 1 240px; }
.stlang-body .setstatus { flex: 1 1 100%; }
@media (max-width: 640px) { .stlang-body { padding: 12px 16px; } .stlang-body select { flex: 1 1 100%; } }
/* Settings: what runs and a way to the Loader (the loading values themselves are only there), the app's preferences */
.stload, .stprefs { margin-bottom: 16px; }
.stload-body, .stprefs-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px 16px; min-width: 0; }
.stprefs-body { gap: 18px; }
.stload-help, .stload-file { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.stload-run { margin: 0; font: 500 16px/1.5 var(--font-mono); color: var(--fg); overflow-wrap: anywhere; }
.stload-act { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.stprefs-body input[type=number] { width: 120px; min-height: 44px; padding: 8px 12px; font: 400 16px/1.5 var(--font-mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.stprefs-body input[aria-invalid="true"] { border-color: var(--err); }
.stprefs-body .setstatus:empty { display: none; }
@media (max-width: 640px) { .stload-body, .stprefs-body { padding-inline: 16px; } .stload-act .btn { flex: 1 1 auto; justify-content: center; } }


/* ---- LOGS view (reqlog.js): the request log ---- */
.rl-sprite { position: absolute; }
body[data-view="logs"] { height: 100vh; height: 100dvh; overflow-y: auto; }
body[data-view="logs"] main { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.logs { display: flex; flex-direction: column; }
.rl { flex: 1; min-height: 380px; --rl-edge: #6B7782; --rl-mark: #5B4A00; --rl-mark-fg: #FFF2C2; --rl-cur: #FFC247; --rl-cur-fg: #0E1114; }
.rl-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rl-off { padding: 24px 20px; font-size: 16px; line-height: 1.6; }
.rl-off h2 { margin: 0 0 8px; font: 600 18px/1.4 var(--font-sans); }
.rl-off p { margin: 0 0 12px; max-width: 70ch; color: var(--fg-2); }
.rl-off code { display: inline-block; padding: 8px 12px; background: var(--bg); border-radius: 6px; font: 400 15px/1.5 var(--font-mono); color: var(--fg); overflow-wrap: anywhere; }

.rl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex: none; }
.rl-tools .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.rl-ic { width: 20px; height: 20px; flex: none; }
.rl-iconbtn { width: 44px; padding: 0; }
.rl-pause { min-width: 112px; }
.rl-pill { padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--tadamoo-950); font: 600 14px/1.5 var(--font-mono); white-space: nowrap; }
.rl-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rl-save #rl-hide { flex: 1 1 200px; }
.rl-tools select, .rl-tools input { min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--rl-edge); border-radius: 6px; padding: 8px 12px; }
.rl-tools input { flex: 1 1 100px; min-width: 0; }
.rl-tools input::placeholder { color: var(--fg-3); opacity: 1; }
.rl-tools input::-webkit-search-cancel-button { display: none; }
.rl-find { display: flex; align-items: center; gap: 8px; flex: 1 1 300px; min-width: 0; }
.rl-count { min-width: 8ch; font: 500 16px/1.4 var(--font-mono); color: var(--fg-2); white-space: nowrap; }

.rl-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 8px 16px; border-bottom: 1px solid var(--line-soft); font: 400 16px/1.5 var(--font-sans); color: var(--fg-2); flex: none; }
.rl-state { font-weight: 600; color: var(--fg); }
.rl-state::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: currentColor; }
.rl-state[data-s="live"] { color: #8FD9A8; }
.rl-state[data-s="paused"] { color: #E9C341; }
.rl-state[data-s="paused"]::before { border-radius: 2px; }
.rl-state[data-s="off"], .rl-state[data-s="locked"] { color: #FF8FA3; }
.rl-state[data-s="off"]::before, .rl-state[data-s="locked"]::before { border-radius: 0; transform: rotate(45deg) scale(.85); }
.rl-state[data-s="wait"] { color: var(--fg-2); }
.rl-msg { color: var(--fg); }
.rl-msg:empty { display: none; }
.rl-note { display: flex; flex-direction: column; gap: 2px; flex: 1 1 100%; color: var(--fg-2); }
.rl-note:empty { display: none; }

.rl-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.rl-log { flex: 1; min-width: 0; min-height: 220px; overflow-y: auto; overflow-x: hidden; padding: 12px 16px 16px; overscroll-behavior: contain; }
.rl-latest { position: absolute; right: 16px; bottom: 16px; background: var(--accent); border-color: var(--accent); color: var(--tadamoo-950); font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.rl-latest:hover { background: var(--ember-hot); }
.rl-empty { margin: 8px 0; max-width: 60ch; font-size: 16px; line-height: 1.6; color: var(--fg-2); }
.rl-dropnote { margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--rl-edge); border-radius: 6px; font: 400 14px/1.5 var(--font-mono); color: var(--fg-2); overflow-wrap: anywhere; }

.rl-card { margin: 0 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.rl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font: 500 14px/1.5 var(--font-mono); min-width: 0; }
.rl-id { font-weight: 700; color: var(--fg); }
.rl-time, .rl-meta, .rl-bm, .rl-bn { color: var(--fg-2); }
.rl-ep { color: var(--fg); overflow-wrap: anywhere; min-width: 0; }
.rl-chip { padding: 0 10px; border: 1px solid currentColor; border-radius: 999px; font: 600 14px/1.6 var(--font-sans); letter-spacing: .02em; white-space: nowrap; }
.rl-chip[data-s="running"] { color: #FFB547; }
.rl-chip[data-s="done"] { color: #8FD9A8; }
.rl-chip[data-s="error"] { color: #FF8FA3; border-style: double; border-width: 3px; padding: 0 8px; }
.rl-chip[data-s="cancelled"] { color: #C4B5FD; border-style: dashed; }
.rl-blocks { padding: 2px 12px 12px; }
.rl-block { margin-top: 10px; padding-left: 10px; border-left: 3px solid var(--k, var(--rl-edge)); min-width: 0; }
.rl-block[data-k="request"] { --k: #7AA2F7; }
.rl-block[data-k="reasoning"] { --k: #B38CF0; }
.rl-block[data-k="content"] { --k: #8FD9A8; }
.rl-block[data-k="attempt"] { --k: #FFB547; }
.rl-block[data-k="attempt"][data-ok="false"] .rl-bt { color: #FF8FA3; }
.rl-block[data-k="repair"] { --k: #E9C341; }
.rl-block[data-k="error"], .rl-block[data-k="cancel"] { --k: #FF8FA3; }
.rl-block[data-k="error"] .rl-bt { color: #FF8FA3; }
.rl-bh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; font: 600 16px/1.5 var(--font-sans); color: var(--fg); }
.rl-bm, .rl-bn { font: 400 14px/1.5 var(--font-mono); }
.rl-unit { min-width: 0; }
.rl-text { margin-top: 4px; padding: 8px 10px; background: var(--bg); border-radius: 6px; font: 400 14px/1.55 var(--font-mono); color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.rl-text:empty { display: none; }
.rl-text > div { display: block; }
.rl-params .rl-text { color: var(--fg-2); }
.rl-more { margin-top: 6px; }

.rl-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--rl-edge); font: 400 14px/1.55 var(--font-mono); color: var(--fg-2); min-width: 0; }
.rl-row .rl-unit { flex: 1 1 240px; }
.rl-row .rl-text { margin: 0; padding: 0; background: none; }
.rl-row[data-lv="warn"] { border-left-color: #E9C341; }
.rl-row[data-lv="err"] { border-left-color: #FF8FA3; border-left-width: 6px; }
.rl-lv { padding: 0 6px; border: 1px solid currentColor; border-radius: 4px; font-weight: 700; }
.rl-row[data-lv="warn"] .rl-lv { color: #E9C341; }
.rl-row[data-lv="err"] .rl-lv { color: #FF8FA3; }
.rl-rk { color: var(--fg-2); }
.rl mark { padding: 0; border-radius: 2px; background: var(--rl-mark); color: var(--rl-mark-fg); }
.rl mark.rl-cur { background: var(--rl-cur); color: var(--rl-cur-fg); outline: 2px solid #fff; outline-offset: 1px; }

/* nine tabs: three to a row in a very narrow window */
@media (max-width: 520px) {
  .detail { display: none; }
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .rl-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .rl-tools .rl-pause, .rl-tools .rl-save > .btn { width: 100%; }
  .rl-save { display: contents; }
  .rl-save .btn { grid-column: 1; }
  .rl-save select { grid-column: 2; }
  .rl-save #rl-mask, .rl-save #rl-hide { grid-column: 1 / -1; }
  .rl-find { grid-column: 1 / -1; flex-basis: auto; }
  .rl-tools { padding: 8px 12px; }
  .rl-status { padding-inline: 12px; }
  .rl-log { padding-inline: 12px; }
}
@media (max-width: 640px) {
  body[data-view="logs"] main { padding-inline: 8px; }
  .rl-off { padding-inline: 16px; }
}

/* ---- Download models panel (serve/web/download.js) ---- */
.lddownload.sec { display: block; margin-bottom: 16px; min-width: 0; }
.dlpanel > summary { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 20px; cursor: pointer; font: 600 16px/1.4 var(--font-sans); }
.dl-count { color: var(--fg-2); font-weight: 400; font-size: 14px; }
.dl-body { display: flex; flex-direction: column; gap: 12px; padding: 0 20px 16px; min-width: 0; }
.dl-body .setnote, .dl-foot { padding: 0; font-size: 15px; }
.dl-filter select { min-height: 48px; padding: 8px 12px; max-width: 100%; }
.dl-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font: 600 15px/1.4 var(--font-sans); }
.badge[data-s="unc"] { color: var(--warn); }
.dl-warn { color: var(--warn); }
.dl-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.dl-files li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dl-files code { overflow-wrap: anywhere; }
.dl-ack { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.dl-ack input { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.dl-steps { margin: 0; padding-left: 22px; display: grid; gap: 14px; font-size: 15px; line-height: 1.5; }
.dl-cmd { margin: 4px 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font: 400 13px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.mdl-tip { padding: 0; font-size: 14px; }
.dl-list .btn:focus-visible, .dlpanel > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dl-steps li > b { display: block; margin-bottom: 6px; }
.dl-steps a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.dl-steps .field { margin-top: 6px; }

/* the conversations mode of the Chat: what the agent wrote, did and asked, in order */
.amsgs[hidden] { display: none; }
.ablocks { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ablock, .ablocks > .answer { min-width: 0; }
.atool { border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg); font-size: 14.5px; }
.atool summary { min-height: 40px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 4px 12px; cursor: pointer; list-style: none; color: var(--fg-2); }
.atool summary::-webkit-details-marker { display: none; }
.atool-d { flex: 1 1 100%; min-width: 0; color: var(--fg); overflow-wrap: anywhere; }
.atool-n { font-family: var(--font-mono); font-size: 13px; color: var(--fg-2); }
.astop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 8px; background: var(--surface); padding: 8px 12px; font-size: 14.5px; }
.astop span { flex: 1 1 14em; min-width: 0; overflow-wrap: anywhere; }
.astop .btn { min-height: 44px; min-width: 44px; }
.astop .aask-h { flex: 1 1 100%; }
.atool[data-s="running"] .atool-s { color: var(--accent); }
.atool[data-s="failed"] { border-color: var(--bad, #FF8FA3); }
.atool[data-s="failed"] .atool-s { color: var(--bad, #FF8FA3); }
.atool pre { margin: 0; padding: 8px 12px; font: 400 13.5px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; border-top: 1px solid var(--line-soft); color: var(--fg-2); }
.atool .chip { margin: 0 12px 8px; min-height: var(--btn-h); }
/* a background command: a colour of its own, on the left edge, the dot and the name, so its lines can be told from the others */
.ajob { --jc: #4C9AFF; border-left: 4px solid var(--jc); }
.ajob[data-c="1"] { --jc: #E8A23B; }
.ajob[data-c="2"] { --jc: #4CC38A; }
.ajob[data-c="3"] { --jc: #C77DFF; }
.ajob[data-c="4"] { --jc: #FF7A90; }
.ajob[data-c="5"] { --jc: #2EC4C4; }
.ajob-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--jc); flex: none; }
.ajob .atool-n { color: var(--jc); font-weight: 600; }
.ajob .ajob-o { max-height: 320px; border-top-color: var(--jc); }
.ajob-err { color: var(--bad, #FF8FA3); }

.aask, .ablocked { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.ablocked { border-left-color: var(--bad, #FF8FA3); }
.aask-q, .ablocked p { margin: 0; overflow-wrap: anywhere; }
.aask-b { display: flex; flex-wrap: wrap; gap: 8px; }
.aask-b .btn { min-height: var(--btn-h); }
.aask-b .picked { outline: 2px solid var(--accent); }
.aask-h { margin: 0; font-size: 14px; color: var(--fg-2); }
.aask-f { display: grid; gap: 10px; }
.aask-field { display: grid; gap: 4px; }
.aask-field label { font: 500 15px/1.4 var(--font-sans); }
.aask-field input:not([type=checkbox]), .aask-field select { min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; min-width: 0; }
.aask-field input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); }
.aask-quote { margin: 0; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--fg-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.aask-b input { flex: 1 1 240px; min-width: 0; min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; }
/* the card of questions (askcard.js) and the next-message chips */
.aq-card { max-width: 720px; }
.aq-form { display: flex; flex-direction: column; gap: 14px; }
.aq { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.aq-lg { padding: 0; font: 600 15px/1.4 var(--font-sans); overflow-wrap: anywhere; }
.aq-n, .aq-opt-tag { font: 400 13px/1.4 var(--font-sans); color: var(--fg-2); }
.aq-opts { display: flex; flex-direction: column; gap: 8px; }
.aq-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.aq-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; max-width: 100%; padding: 4px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg-2); font: 500 14px/1.3 var(--font-sans); cursor: pointer; }
.aq-tab[aria-selected="true"] { border-color: var(--accent); border-bottom-width: 3px; color: var(--fg); background: var(--surface); }
.aq-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.aq-tn { font-weight: 700; }
.aq-tt { min-width: 0; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-tm { color: var(--accent); font-weight: 700; }
.aq-panel[hidden] { display: none; }
.aq-keys { font-size: 13px; }
.aq-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; }
.aq-row:hover { border-color: var(--fg-2); }
.aq-row:has(input:checked) { border-color: var(--accent); }
.aq-row:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.aq-row input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.aq-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.aq-rec { margin-left: 6px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 10px; font: 600 12px/1.6 var(--font-sans); color: var(--accent); white-space: nowrap; }
.aq-other-text, .aq-free { width: 100%; box-sizing: border-box; min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.aq-free { resize: vertical; }
.aq-foot { align-items: center; }
.aq-foot .btn { min-height: 44px; }
.aq-note { min-height: 1.4em; }
.aq-sum { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.asuggest { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; margin: 6px 0 12px; max-width: 900px; }
.asuggest .btn { min-height: var(--btn-h); max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.asuggest .achip-s { grid-column: 1; min-width: 0; padding: 8px 12px; white-space: normal; line-height: 1.45; }
.asuggest .achip-x { grid-column: 2; grid-row: 1; }
@media (pointer: coarse) { .aq-row, .aq-tab, .aq-foot .btn, .asuggest .btn { min-height: 44px; } .aq-keys { display: none; } }
@media (max-width: 480px) { .aq-tt { max-width: 9ch; } .aq-foot .btn { flex: 1 1 100%; } }
.acap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.acap { border-top: 1px solid var(--line-soft); padding-top: 8px; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.acap-warn { border-left: 3px solid var(--accent); padding-left: 8px; }
.acap-low { font-size: 13px; color: var(--fg-2); }
.anote { font-size: 14px; color: var(--fg-2); font-style: italic; }
.chathead .effort { min-width: 0; max-width: 100%; }
.chathead .effort select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }

/* Chat settings: context patterns */
.pt { display: flex; flex-direction: column; gap: 6px; }
.pt-row { border-bottom: 1px solid var(--line-soft); padding: 4px 0 8px; }
.pt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 48px; }
.pt-line select { flex: 1 1 160px; }
.pt-more { margin: 4px 0 4px 8px; padding: 4px 12px; border-left: 2px solid var(--line); }
.pt-more h4 { margin: 8px 0 4px; font-size: 15px; }
.pt-more .pt-text { margin: 0; padding: 0; border: 0; }
.pt-name { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; min-width: 130px; font-weight: 600; }
.pt-name input { width: 24px; height: 24px; accent-color: var(--accent); }
.pt-line select { min-height: 44px; max-width: 100%; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.pt-info { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--fg-2); font: italic 700 16px/1 var(--font-sans); cursor: pointer; }
.pt-info[aria-expanded="true"] { border-color: var(--accent); color: var(--fg); }
.pt-text { margin: 4px 0 4px 8px; padding: 8px 12px; border-left: 2px solid var(--line); display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 15px; }
.pt-text dt { color: var(--fg-2); }
.pt-text dd { margin: 0; overflow-wrap: anywhere; }
.pt-new { margin: 0 0 0 4px; font-size: 14px; }
.pt-line .pt-info { margin-left: auto; }
@media (max-width: 520px) { .pt-text { grid-template-columns: 1fr; } .pt-text dd { margin-bottom: 6px; } }

/* Models: the two sub-tabs and the Providers page */
.subtabs { display: flex; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.subtab[aria-selected="true"] { background: var(--surface); border-color: var(--accent); color: var(--fg); }
.pv { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pv-strip { padding: 12px 16px; }
.pv-note[data-bad="1"], .pv-bad { color: var(--bad, #FF8FA3); }
.pv-scroll { overflow-x: auto; }
.pv-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.pv-table th, .pv-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pv-table select { min-height: 44px; max-width: 100%; }
.pv-table td { white-space: normal; }
.pv-table td:last-child { min-width: 14em; overflow-wrap: anywhere; }
@media (max-width: 720px) {                                  /* a row becomes a card: no sideways scrolling on a phone */
  .pv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pv-table, .pv-table tbody, .pv-table tr, .pv-table td { display: block; width: 100%; }
  .pv-table tr { border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 10px; padding: 4px 0; }
  .pv-table td { border: 0; padding: 4px 12px; min-width: 0; }
  .pv-table td:last-child { min-width: 0; }
  .pv-table td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--fg-2); }
  .pv-table select { width: 100%; }
}
.pv-table input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.pv-list { list-style: none; margin: 0; padding: 0 16px 8px; display: flex; flex-direction: column; gap: 10px; }
.pv-card { border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pv-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.pv-badge { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--fg-2); }
.pv-meta { margin: 0; overflow-wrap: anywhere; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pv-actions .btn { min-height: var(--btn-h); }
.pv-form { display: grid; gap: 10px; padding: 8px 0; }
.pv-field { display: flex; flex-direction: column; gap: 4px; }
.pv-council { display: grid; gap: 10px; }
.pv-cgrid { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-start; }
.pv-clist { display: flex; flex-direction: column; gap: 6px; }
.pv-crole { border: 1px solid var(--line); border-radius: 8px; min-width: 0; background: var(--bg); }
.pv-crole[data-off="1"] > summary .pv-crole-name { color: var(--fg-2); text-decoration: line-through; }
.pv-crole-sum { min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 10px; cursor: pointer; min-width: 0; }
.pv-crole-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pv-tick { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: -8px; }
.pv-tick input, .pv-consent input { width: 22px; height: 22px; accent-color: var(--accent); }
.pv-crole-body { display: grid; gap: 8px; padding: 4px 12px 12px; }
.pv-consent { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.pv-field textarea { min-height: 64px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 0; resize: vertical; }
.pv-field input[type=number] { max-width: 8em; }
.pv-field input, .pv-field select { min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; min-width: 0; }
.pv-add { padding: 0 16px 12px; }
.pv-add summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.pv-modelrow { display: flex; gap: 8px; align-items: stretch; }
.pv-modelrow input { flex: 1 1 auto; min-width: 0; }
.pv-load { min-height: 44px; min-width: 64px; }
.btn.is-off { opacity: .45; cursor: not-allowed; }
.pv-pickrow .pv-pick { width: 100%; min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.pv-testnote[data-bad="1"] { color: var(--bad, #FF8FA3); }
.pv-primary-row { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-end; padding: 0 16px; }
.pv-primary-row .pv-field { flex: 1 1 260px; min-width: 0; }
.pv-primary-row select { max-width: 100%; }
.pv-fallback { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; }
.pv-now { font-size: 13px; overflow-wrap: anywhere; }
/* what answers now, in the top bar: kept on a narrow screen, where the loaded model's own name is hidden */
.answers { font: 400 13.5px/1.3 var(--font-mono); color: var(--fg-2); overflow-wrap: anywhere; min-width: 0; }
.answers[data-fell="1"] { color: var(--fg); }
.answers[data-local="1"] { display: none; }
@media (max-width: 980px) { .answers, .answers[data-local="1"] { display: block; flex: 1 0 100%; order: 5; } .answers[hidden] { display: none; } }

.pv-import { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* Settings: capabilities */
.stcaps-body { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cp-visual label { display: flex; flex-direction: column; gap: 4px; }
.cp-visual select, .cp-bar input, .cp-actions select { min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; max-width: 100%; min-width: 0; }
.cp-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-bar input { flex: 1 1 200px; }
.cp-note[data-bad="1"] { color: var(--bad, #FF8FA3); }
.cp-root { border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 8px; background: var(--bg); }
.cp-root > summary { min-height: 48px; display: flex; align-items: center; padding: 0 14px; cursor: pointer; font-weight: 600; }
.cp-list { list-style: none; margin: 0; padding: 0 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.cp-entry { border-top: 1px solid var(--line-soft); padding-top: 8px; min-width: 0; }
.cp-cand { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; min-width: 0; overflow-wrap: anywhere; }
.cp-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.cp-badge { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--fg-2); }
.cp-pending { border-color: var(--accent); color: var(--fg); }
.cp-off { opacity: .7; }
.cp-desc { margin: 4px 0; overflow-wrap: anywhere; }
.cp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cp-actions .btn { min-height: var(--btn-h); }
.cp-review { margin-top: 8px; padding: 8px 12px; border-left: 2px solid var(--accent); }
.cp-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font: 400 14px/1.5 var(--font-mono); margin: 6px 0; padding: 8px; background: var(--surface); border-radius: 6px; }
.cp-online { margin: 12px 0; padding: 8px 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.cp-online h3, .cp-online h4 { margin: 4px 0 0; }
.cp-fs { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 14px 10px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cp-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.cp-check input { width: 22px; height: 22px; flex: none; }
.cp-num { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.cp-num input, .cp-field textarea { font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; min-height: 44px; }
.cp-num input { width: 6em; }
.cp-field { display: flex; flex-direction: column; gap: 4px; }
.cp-field textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.cp-weights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; }

/* Chat: attached files and files the agent made */
.aatt { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.aatt-i { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px 2px 12px; background: var(--surface); min-height: 48px; max-width: 100%; min-width: 0; }
.aatt-n { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.aatt-i .btn { min-height: var(--btn-h); }
.achips { font-size: 14px; opacity: .85; margin-bottom: 4px; overflow-wrap: anywhere; }
.asave { margin: 6px 0; min-height: var(--btn-h); }

/* Chat: the conversation's own copy of the folder */
.acopy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 28px; font-size: 14px; }
.acopy[hidden], .acopy-panel[hidden] { display: none; }
.acopy-text { overflow-wrap: anywhere; min-width: 0; }
.acopy .btn, .acopy-panel .btn { min-height: var(--btn-h); }
.acopy-panel { max-height: 45vh; overflow: auto; margin: 0 28px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; }
.acopy-files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.acopy-file { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.acopy-file label { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; overflow-wrap: anywhere; flex: 1 1 14rem; cursor: pointer; }
.acopy-file input[type="checkbox"] { width: 22px; height: 22px; flex: none; }
.acopy-kind { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--fg-2); white-space: nowrap; }
.acopy-diff { flex: 1 1 100%; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; font: 400 13px/1.5 var(--font-mono); margin: 0 0 4px; padding: 8px; background: var(--bg); border-radius: 6px; }
.acopy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.acopy-actions .btn { min-height: var(--btn-h); }
.acopy-msg { margin: 8px 0 0; overflow-wrap: anywhere; }
@media (max-width: 700px) { .acopy { padding: 6px 12px; } .acopy-panel { margin: 0 12px 8px; } }
.aback { min-height: 26px; font-size: 12px; align-self: flex-end; opacity: .85; }

/* the copy choice with its explanation; the attach button as a plus */
.btn.attach { min-width: 34px; min-height: 34px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; }
.btn.attach.attach-dir { border-radius: 17px; padding: 0 10px; font-size: 18px; }
/* The mode the agent works in (Shift+Tab goes through them) and the commands that start with a slash. */
.modechip { align-self: center; display: flex; flex-direction: column; align-items: flex-start; padding: 2px 6px; min-height: 0; border: 0; border-radius: 6px; background: transparent; text-align: left; line-height: 1.2; }
.modechip:hover { background: var(--surface); }
.modechip .mc-hint { font: 400 10.5px/1.25 var(--font-sans); color: var(--fg-3); white-space: nowrap; }
.modechip .mc-mode { font: 700 12px/1.25 var(--font-sans); white-space: nowrap; }
.modechip[data-mode="read_only"] .mc-mode { color: var(--fg-2); }
.modechip[data-mode="default"] .mc-mode { color: #B9A3FF; }
.modechip[data-mode="plan"] .mc-mode { color: #5EEAD4; }
.modechip[data-mode="auto"] .mc-mode { color: #FF8A8A; }
/* the column of earlier conversations, at the left of the chat */
.chatrow { flex: 1; min-width: 0; min-height: 0; display: flex; gap: 12px; }
.chatrow > .chatbox { min-width: 0; }
.convs { flex: 0 0 264px; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.convs[hidden] { display: none; }
.convs.shut { flex-basis: 40px; }
.cv-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 50px; padding: 0 6px 0 14px; border-bottom: 1px solid var(--line-soft); font: 600 13px/1 var(--font-sans); }
.cv-toggle { width: 28px; min-height: 28px; border-radius: 6px; color: var(--fg-2); font: 400 18px/1 var(--font-sans); }
.cv-toggle:hover { background: var(--surface); color: var(--fg); }
.convs.shut .cv-head { justify-content: center; padding: 0; }
.convs.shut .cv-head b, .convs.shut .cv-body { display: none; }
.cv-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 10px; }
.cv-group h3 { margin: 10px 8px 4px; font: 600 10.5px/1.3 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); }
.cv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.cv { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.cv:hover, .cv[aria-current="true"] { background: var(--surface); }
.cv[aria-current="true"] { box-shadow: inset 2px 0 0 var(--accent); }
.cv-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 5px 6px; text-align: left; }
.cv-t { font: 500 13px/1.3 var(--font-sans); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-s { font: 400 11px/1.3 var(--font-sans); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-fav, .cv-del { flex: none; min-width: 24px; min-height: 24px; border-radius: 5px; color: var(--fg-3); font: 400 14px/1 var(--font-sans); }
.cv-fav:hover, .cv-del:hover { background: var(--raised); color: var(--fg); }
.cv-fav[aria-pressed="true"] { color: var(--warn); }
.cv-del.sure { padding: 0 6px; color: #FF8A8A; font-size: 11px; font-weight: 600; }
.cv-empty { margin: 8px; font: 400 12px/1.4 var(--font-sans); color: var(--fg-3); }.slashhost { position: relative; height: 0; order: -1; }
.slashmenu { position: absolute; left: 0; right: 0; bottom: 6px; z-index: 6; max-height: min(46vh, 420px); max-height: min(46dvh, 420px); overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 28px rgba(0, 0, 0, .45); }
.slashitem { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-height: 44px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.slashitem.on { background: var(--raised); }
.slashitem b { font-family: var(--font-mono); font-weight: 600; }
.slashargs { font-family: var(--font-mono); font-size: 13px; color: var(--fg-3); }
.slashd { flex: 1 1 18ch; min-width: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.slashkind { padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; color: var(--fg-2); }
.slres { display: flex; flex-direction: column; gap: 4px; font-style: normal; color: var(--fg); }
.slres ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }
.slres li { overflow-wrap: anywhere; }
.slk { color: var(--fg-2); }

/* personal skills */
.aacts { display: flex; gap: 6px; align-self: flex-end; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.askill-box { flex: none; width: 18px; height: 18px; margin: 6px 4px 0 0; accent-color: var(--accent); }
.pskill-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); font: 400 13px/1.4 var(--font-sans); color: var(--fg-2); }
.pskill-bar span { flex: 1 1 24ch; min-width: 0; overflow-wrap: anywhere; }
#priv-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.learnbadge { align-self: center; padding: 1px 8px; border-radius: 10px; border: 1px solid #FF8A8A; color: #FF8A8A; font: 600 11.5px/1.5 var(--font-sans); white-space: nowrap; }
dialog.psk { width: min(640px, 94vw); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); }
dialog.psk.wide { width: min(860px, 96vw); }
dialog.psk::backdrop { background: rgba(0, 0, 0, .6); }
.psk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.psk-head h2 { margin: 0; font: 600 16px/1.3 var(--font-sans); }
.psk-body { padding: 14px 18px; overflow-y: auto; max-height: calc(90vh - 130px); display: flex; flex-direction: column; gap: 10px; }
.psk-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line-soft); }
.psk-foot .psk-status { flex: 1 1 14ch; margin: 0; text-align: left; }
.psk h3 { margin: 8px 0 0; font: 600 14px/1.3 var(--font-sans); }
.psk-field { display: flex; flex-direction: column; gap: 3px; }
.psk-field label, .psk-keep { font: 500 13px/1.4 var(--font-sans); color: var(--fg-2); }
.psk input[type="text"], .psk select, .psk textarea { width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font: 400 14px/1.4 var(--font-sans); }
.psk textarea { resize: vertical; }
.psk .psk-code, .psk .psk-mono { font-family: var(--font-mono); font-size: 13px; }
.psk-code-view { margin: 0; padding: 8px 10px; max-height: 240px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--bg); font: 400 12.5px/1.5 var(--font-mono); white-space: pre-wrap; }
.psk-help { margin: 0; font: 400 12.5px/1.45 var(--font-sans); color: var(--fg-3); overflow-wrap: anywhere; }
.psk-lead { margin: 0; color: var(--fg-2); }
.psk-warn { margin: 0; font: 500 13px/1.4 var(--font-sans); color: #FFB547; }
.psk-ok { margin: 0; font: 500 13px/1.4 var(--font-sans); color: #7BD88F; }
.psk-hint { margin: 0; min-height: 1.2em; font: 500 12.5px/1.4 var(--font-sans); color: var(--fg-2); }
.psk-hint.bad { color: #FF8A8A; }
.psk-status { margin: 0; font: 400 13px/1.4 var(--font-sans); color: var(--fg-2); }
.psk-row { display: flex; gap: 8px; align-items: center; }
.psk-picker { flex: none; width: auto !important; }
.psk-param { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.psk-param legend { padding: 0 6px; font: 600 13px/1.3 var(--font-sans); }
.psk-keep { display: flex; gap: 6px; align-items: center; }
.psk-params { display: flex; flex-direction: column; gap: 10px; }
.psk-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.psk-itemhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.psk-badge { padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); font: 600 11.5px/1.6 var(--font-sans); }
.psk-badge.warn { border-color: #FFB547; color: #FFB547; }
.psk-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.psk-acts .sure { color: #FF8A8A; }
.psk-list { display: flex; flex-direction: column; gap: 10px; }
.psk-bar { display: flex; gap: 8px; }
.psk-asked summary { cursor: pointer; font: 500 13px/1.6 var(--font-sans); color: var(--fg-2); }

/* the Agentic coding tab: the folders added, each with its conversations, the folder in the header and the changes beside the conversation */
.cv-addfolder { width: calc(100% - 8px); margin: 6px 4px 4px; }
.cv-proj { margin-top: 6px; }
.cv-projhead { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 8px; border-radius: 6px; }
.cv-projhead.here { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
.cv-projname { flex: 1; min-width: 0; padding: 4px 2px; text-align: left; font: 600 13px/1.3 var(--font-sans); color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-proj .cv-list { padding-left: 8px; }
.folderchip { align-self: center; max-width: 260px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg-2); font: 500 12px/1.5 var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chgside { flex: 0 0 min(420px, 34%); min-width: 300px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chgside > .pad { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
dialog.afolder { width: min(640px, 94vw); }
dialog.afolder .brd-b { display: grid; gap: 8px; padding: 12px 16px 16px; }
.ag-msg { min-height: 1.5em; margin: 4px 0 0; color: var(--fg-2); overflow-wrap: anywhere; }
.ag-msg.bad { color: #FF8FA3; }
.ag-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* copy at the end of a prompt, a reasoning window and an answer; Branch from here after an answer */
.aicon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; color: var(--fg-3); }
.aicon:hover, .aicon:focus-visible { background: var(--raised); color: var(--fg); }
.aicon.done { color: var(--pl-done, #4CC66A); }
.aicon-svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.abranch { display: inline-flex; align-items: center; gap: 6px; }
.abranch .aicon-svg { width: 14px; height: 14px; }
.aend { align-self: flex-start; justify-content: flex-start; margin-top: 4px; }
.think-end { display: flex; justify-content: flex-end; padding: 2px 6px 4px; }

/* pictures the agent fetched and diagrams it drew, in an answer */
.afig { display: block; margin: 8px 0; }
.aimg { display: block; max-width: min(100%, 720px); max-height: 460px; height: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.afigc { display: block; margin-top: 4px; font: 400 12.5px/1.4 var(--font-sans); color: var(--fg-3); }
.diagram { margin: 10px 0; }
.diagram-svg { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: auto; }
.diagram-svg svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.diagram-src { margin-top: 4px; }
.diagram-src > summary { cursor: pointer; color: var(--fg-3); font: 500 12px/1.6 var(--font-sans); }
.diagram-err { margin: 4px 0 0; color: #FF8FA3; font: 400 12.5px/1.4 var(--font-sans); }
.csgroup .check { display: flex; align-items: center; gap: 10px; min-height: 36px; margin-top: 6px; cursor: pointer; }
.csgroup .check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }

/* a link to a file in an answer is a button that saves it */
.afile { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 10px; margin: 0 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--fg); font: 500 13px/1.6 var(--font-sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afile:hover, .afile:focus-visible { border-color: var(--accent); }
.afile:disabled { opacity: .6; }

/* the Canary tab: the page of the test fills the view */
.cn-frame { display: flex; flex-direction: column; }
.cn-frame[hidden] { display: none; }
.cn-frame iframe { flex: 1; width: 100%; min-height: calc(100vh - 150px); border: 0; background: transparent; }
.psk-plan { display: grid; gap: 6px; }
.psk-cover { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.psk-chip { padding: 1px 8px; font-size: 11px; color: var(--fg-2); border: 1px solid var(--line); border-radius: 10px; }
.psk-chip.missing { color: var(--warn); border-color: var(--warn); }
.psk-calls { display: grid; gap: 4px; }
.psk-check { display: flex; align-items: flex-start; gap: 8px; min-height: 44px; }
.psk-talk { display: grid; gap: 6px; }
.psk-talk textarea { width: 100%; min-height: 56px; }
.psk-source { margin: 0; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; }
.psk-source legend { padding: 0 4px; font-size: 12px; color: var(--fg-2); }
.psk-param textarea { width: 100%; min-height: 56px; }

/* the inference panel shown for a plan or the machine default: only what is inference, in the page's own flow */
.chatset[data-scope="plan"] .csconv, .chatset[data-scope="machine"] .csconv { display: none; }
.infhost, .plinfhost { margin-top: 12px; }
.infhost:empty, .plinfhost:empty { margin: 0; }
.infhost > .chatset, .plinfhost > .chatset { overflow: visible; max-height: none; }
.infhost .csform, .plinfhost .csform { overflow: visible; }
.plinf-l { font: 500 15px/1.4 var(--font-sans); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plinf-l select { min-height: 44px; font: 400 16px/1.5 var(--font-sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; max-width: 100%; }
.pl-bar .plinf-l, .pl-bar .pl-btn { min-height: 44px; }
.chatset .btn, .chatset select { min-height: 44px; }


/* the settings panels (Chat settings, the plan's inference settings, the fieldsets of the Settings tab) use a readable column, left-aligned, not the whole central column: a label stays
   next to its control. A narrow screen gets the full width. */
.infhost > .chatset, .plinfhost > .chatset, .chat.withset .chatset { max-width: 720px; margin-inline-end: auto; }
.chatset .csform, .csgroup { max-width: 720px; }
.chatset .csrow > select, .chatset .csrow > input, .chatset .pfrow select, .plinf-l select { flex: 0 1 420px; max-width: 100%; }
.plinf-l { justify-content: flex-start; }
@media (max-width: 720px) {
  .infhost > .chatset, .plinfhost > .chatset, .chat.withset .chatset, .chatset .csform, .csgroup { max-width: none; }
  .chatset .csrow > select, .chatset .csrow > input, .chatset .pfrow select, .plinf-l select { flex: 1 1 100%; }
}


/* ---- the top bar is compact and stays at the top: brand, tabs and state on as few rows as fit ---- */
.bar { min-height: 0; padding: 4px 12px; gap: 2px 14px; }
.brand img { width: 24px; height: 24px; }
.wordmark { font-size: 20px; }
.tabs { gap: 2px; margin-left: 0; }
.tab { padding: 5px 10px; font-size: 13.5px; }
.model { font-size: 12.5px; }
@media (pointer: coarse) { .tab { padding: 10px 12px; min-height: 44px; } }
@media (max-width: 720px) { .bar { padding: 4px 8px; } .tab { padding-inline: 8px; } }

@media (max-width: 800px) {
  .bar { flex-wrap: wrap; }
  .bar .tabs { display: flex; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; order: 5; gap: 2px; }
  .bar .tabs .tab { flex: none; white-space: nowrap; padding: 8px 12px; min-height: 40px; }
  .bar .pal-open { padding: 4px 8px; }
}
