/* Laboratorio della matrioska. One colour per role, everywhere: code green, model blue, prompt amber,
   consolidation violet, errors red. One accent per section (F1 slate, F2 blue, Analisi violet, Prompt amber). */
:root {
  --bg: #f3f5f4; --panel: #ffffff; --raise: #fbfcfb; --ink: #17212b; --muted: #5f6c77; --rule: #dce3df; --grid: #edf1ee;
  --code: #1f7a4a; --code-bg: #e0f2e7; --model: #2b5cc8; --model-bg: #e4ecfc; --prompt: #9a5b00; --prompt-bg: #fbeed6;
  --cons: #6a45c2; --cons-bg: #eee7fc; --log: #5b6b7c; --log-bg: #e8edf2; --red: #bd3326; --red-bg: #f9e2de; --ok: #1f7a4a; --warn: #9a5b00;
  --f1: #3b4f61; --f2: #2b5cc8; --analisi: #6a45c2; --prompt-sec: #a8640a;
  --accent: var(--f1); --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 20px rgba(20, 30, 40, .06);
  --f-hand: "Kalam", "Segoe Print", cursive; --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --on-accent: #ffffff;
  --run-0: #2a78d6; --run-1: #eb6834; --run-2: #1baf7a; --run-3: #eda100; --run-4: #e87ba4; --run-5: #008300; --run-6: #6250d6; --run-7: #e34948; --ease: cubic-bezier(.2, .7, .2, 1); color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141b1f; --panel: #1c252b; --raise: #212c33; --ink: #e7edf0; --muted: #a2b0b9; --rule: #33424b; --grid: #26323a;
    --code: #7fd3a2; --code-bg: #183a29; --model: #93b4ff; --model-bg: #1f3152; --prompt: #f2c06a; --prompt-bg: #3e3017;
    --cons: #c2a8ff; --cons-bg: #30264d; --log: #a9b8c6; --log-bg: #263239; --red: #ff9384; --red-bg: #4a2420; --ok: #7fd3a2; --warn: #f2c06a;
    --f1: #a9bccb; --f2: #93b4ff; --analisi: #c2a8ff; --prompt-sec: #f2c06a;
    --on-accent: #10161a;
    --run-0: #3987e5; --run-1: #d95926; --run-2: #199e70; --run-3: #c98500; --run-4: #d55181; --run-5: #008300; --run-6: #9085e9; --run-7: #e66767; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
body[data-section="f2"] { --accent: var(--f2); } body[data-section="analisi"] { --accent: var(--analisi); } body[data-section="prompt"] { --accent: var(--prompt-sec); }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 500; transition: border-color .15s, background .15s, transform .1s; }
button:hover:not(:disabled) { border-color: var(--ink); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.danger, .link.danger { color: var(--red); }
button.link { border: 0; background: none; padding: 2px 4px; color: var(--accent); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 34px; height: 34px; }
.ic.spin { animation: spin 1.1s linear infinite; }
code { font-family: var(--f-mono); font-size: 12px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12.5px; margin: 0; }
.lead { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 80ch; }
.msg { margin: 0; font-size: 13px; color: var(--muted); }
.msg.err, .err-t { color: var(--red); } .msg.ok { color: var(--ok); } .msg.warn, .warn-t { color: var(--warn); }
.hand { font-family: var(--f-hand); font-size: 26px; margin: 0; }
.count { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--grid); border-radius: 999px; padding: 0 8px; }
.scroll { overflow-x: auto; }

/* chips and badges */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grid); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--code-bg); color: var(--ok); } .chip.warn { background: var(--prompt-bg); color: var(--warn); }
.chip.err { background: var(--red-bg); color: var(--red); } .chip.live { background: var(--model-bg); color: var(--model); }
.chip.f1 { background: var(--log-bg); color: var(--f1); } .chip.f2 { background: var(--model-bg); color: var(--f2); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.2s ease-in-out infinite; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.who { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.who .ic { width: 13px; height: 13px; }
.who.code { background: var(--code-bg); color: var(--code); } .who.model { background: var(--model-bg); color: var(--model); }
.who.mixed { background: linear-gradient(90deg, var(--model-bg), var(--code-bg)); color: var(--ink); } .who.plain { background: var(--log-bg); color: var(--log); }
.pchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--grid); color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pchip b { font-weight: 600; color: var(--ink); }
.pchip .ic { width: 12px; height: 12px; }
.pchip.mod { background: var(--prompt-bg); color: var(--prompt); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--prompt) 35%, transparent); }
.pchip.mod b { color: var(--prompt); }
.pchip.none { background: var(--code-bg); color: var(--code); } .pchip.old { background: var(--red-bg); color: var(--red); }
.pchip.small { font-size: 11px; }
.sw { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.sw.on { background: var(--model); color: var(--panel); } .sw.off { background: var(--grid); color: var(--muted); text-decoration: line-through; }
.tag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 12px; font-weight: 700; color: var(--panel); vertical-align: middle; }
.tag.a { background: var(--ink); } .tag.b { background: var(--model); }

/* top bar, sections, hero */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand b { font-family: var(--f-hand); font-size: 22px; }
.logo { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2; transition: stroke .3s; }
.keys { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.key { display: inline-flex; align-items: center; gap: 5px; } .key i { width: 8px; height: 8px; border-radius: 50%; }
.key.ok i { background: var(--ok); } .key.err i { background: var(--red); } .key.err { color: var(--red); }
.sections { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.sec { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; position: relative; z-index: 1; color: var(--muted); }
.sec i { font-style: normal; font-weight: 700; font-size: 13px; display: grid; place-items: center; min-width: 34px; height: 30px; border-radius: 8px; background: var(--grid); transition: background .25s, color .25s; }
.sec span { display: grid; font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.25; }
.sec small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.sec:hover:not([aria-selected="true"]) { background: var(--grid); border-color: transparent; }
.sec.f1[aria-selected="true"] i { background: var(--f1); color: var(--panel); } .sec.f2[aria-selected="true"] i { background: var(--f2); color: var(--panel); }
.sec.analisi[aria-selected="true"] i { background: var(--analisi); color: var(--panel); } .sec.prompt[aria-selected="true"] i { background: var(--prompt-sec); color: var(--panel); }
.sec-ink { position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transition: transform .35s var(--ease), width .35s var(--ease), background .3s; }
.hero { padding: 16px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left)); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--bg)), var(--bg)); transition: background .4s; }
.hero h1 { margin: 2px 0 2px; font-size: 24px; letter-spacing: -.01em; color: var(--accent); transition: color .3s; }
.hero p { margin: 0; color: var(--muted); max-width: 95ch; }
.crumbs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-height: 19px; }
.crumbs b { color: var(--accent); } .crumbs i { font-style: normal; opacity: .6; }
.crumbs span { animation: fadein .25s var(--ease); }
.view { padding: 4px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
.screen.enter { animation: rise .32s var(--ease); }

/* runs screen */
.runs-screen { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.rail { display: grid; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; padding-right: 2px; }
button.big { padding: 11px 14px; font-size: 15px; display: flex; justify-content: center; align-items: center; gap: 8px; border-radius: 10px; }
.rail-h { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
h2 { margin: 0; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.runcards { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.runcard { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 9px 10px; display: grid; gap: 5px; cursor: pointer; transition: border-color .15s, box-shadow .2s, transform .15s; }
.runcard:hover { border-color: var(--muted); }
.runcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.rc-top { display: flex; justify-content: space-between; gap: 6px; align-items: start; }
.rc-top b { font-size: 13.5px; line-height: 1.3; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.rc-sw { display: flex; flex-wrap: wrap; gap: 4px; }
.x { border: 0; background: none; padding: 2px; color: var(--muted); border-radius: 5px; }
.x:hover { color: var(--red); background: var(--red-bg); }
.none { color: var(--muted); font-size: 12.5px; list-style: none; padding: 8px 2px; }
.rail-box { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; }
.rail-box summary { cursor: pointer; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.rail-box[open] summary { margin-bottom: 8px; }
.limits ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.drop { display: grid; gap: 3px; border: 2px dashed var(--rule); border-radius: 10px; padding: 14px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; position: relative; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop small { color: var(--muted); font-size: 12px; }
.files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; align-items: center; padding: 5px 7px; border: 1px solid var(--rule); border-radius: 7px; font-size: 12.5px; }
.files li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files li small { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.stage { min-width: 0; }
.empty { background: var(--panel); border: 1px dashed var(--rule); border-radius: 14px; padding: 36px 28px; display: grid; gap: 10px; justify-items: center; text-align: center; animation: rise .35s var(--ease); }
.empty p { margin: 0; max-width: 60ch; color: var(--muted); }
.empty-art { width: 110px; height: 110px; fill: none; stroke: var(--accent); stroke-width: 2; opacity: .55; }
.empty-art circle { animation: breathe 4s ease-in-out infinite; transform-origin: 60px 60px; }
.empty-art circle:nth-child(2) { animation-delay: .4s; } .empty-art circle:nth-child(3) { animation-delay: .8s; } .empty-art circle:nth-child(4) { animation-delay: 1.2s; }
.run { display: grid; gap: 14px; }
.run.enter { animation: rise .3s var(--ease); }
.runhead { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.runhead-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.runhead-top input { font-size: 20px; font-weight: 700; border: 0; border-bottom: 1px dashed transparent; background: transparent; min-width: 0; flex: 1 1 260px; padding: 2px 0; }
.runhead-top input:hover, .runhead-top input:focus { border-bottom-color: var(--rule); outline: none; }
.runhead-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; }
.meta { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta > i { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta b { font-weight: 600; }

/* the chain */
.chain { display: grid; grid-template-columns: minmax(0, .8fr) 58px minmax(0, 1fr) 58px minmax(0, 1.5fr) 58px minmax(0, 1.3fr); align-items: stretch; }
.link-card { --c: var(--log); --cb: var(--log-bg); display: grid; gap: 6px; align-content: start; text-align: left; background: var(--panel); border: 1px solid var(--rule); border-top: 4px solid var(--c);
  border-radius: 12px; padding: 11px 12px; min-width: 0; position: relative; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--c); border-top-color: var(--c); }
.link-card.on { box-shadow: 0 0 0 2px var(--c), var(--shadow); }
.lk-chunk { --c: var(--code); --cb: var(--code-bg); } .lk-episodi { --c: var(--model); --cb: var(--model-bg); } .lk-consolidamento { --c: var(--cons); --cb: var(--cons-bg); }
.lk-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.lk-head > .ic { color: var(--c); width: 18px; height: 18px; }
.lk-head > b { font-size: 15px; margin-right: auto; }
.lk-body { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.lk-body em { font-style: normal; font-weight: 700; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.lk-foot { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }
.lk-foot .cost { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.link-card.running { animation: ring 1.6s ease-out infinite; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--model); border-radius: 3px; transition: width .6s var(--ease); }
.connector { display: grid; align-content: center; justify-items: center; gap: 4px; padding: 0 4px; min-width: 0; }
.connector i { display: block; width: 100%; height: 2px; background: var(--rule); position: relative; border-radius: 2px; }
.connector i::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--rule); border-right: 0; }
.connector span { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; font-variant-numeric: tabular-nums; }
.connector.flow i { background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 14px); background-size: 28px 2px; animation: flow .8s linear infinite; }
.totals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.totals div { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 6px 10px; display: grid; }
.totals span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.totals b { font-size: 16px; font-variant-numeric: tabular-nums; }
.totals .cost b { color: var(--accent); }
.stagebar-wrap { display: flex; justify-content: space-between; align-items: end; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
.stagebar { display: flex; gap: 2px; }
.stagebar button { border: 0; border-radius: 8px 8px 0 0; background: none; padding: 9px 14px; color: var(--muted); font-weight: 600; position: relative; }
.stagebar button small { font-weight: 500; color: var(--muted); margin-left: 3px; }
.stagebar button[aria-selected="true"] { color: var(--ink); }
.stagebar button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); animation: grow .25s var(--ease); }
.field { display: grid; gap: 4px; font-size: 12.5px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); font-weight: 400; font-size: 13px; }
.field small { color: var(--muted); font-weight: 400; font-size: 12px; }
.field.inline { grid-template-columns: auto minmax(0, 240px); align-items: center; gap: 8px; color: var(--muted); padding-bottom: 6px; }
.stagepanel { display: grid; gap: 10px; animation: fadein .25s var(--ease); }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.panel-head button { display: inline-flex; align-items: center; gap: 6px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.filters button small { opacity: .75; margin-left: 2px; }
.srow-head, .srow { display: grid; grid-template-columns: 62px 128px minmax(0, 1fr) minmax(0, 220px) 108px 92px 64px; gap: 10px; align-items: center; }
.srow-head { padding: 0 12px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.srows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.srow { background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--rule); border-radius: 9px; padding: 8px 12px; cursor: pointer; font-size: 13px; transition: border-color .15s, transform .15s, box-shadow .15s; animation: fadein .25s var(--ease) both; }
.srow:hover, .srow:focus-visible { border-color: var(--muted); transform: translateX(2px); outline: none; }
.srow.sel { box-shadow: 0 0 0 2px var(--accent); }
.srow.model { border-left-color: var(--model); } .srow.code { border-left-color: var(--code); } .srow.err { border-left-color: var(--red); background: var(--red-bg); }
.srow.busy { border-left-color: var(--prompt); background: linear-gradient(90deg, var(--panel) 0%, var(--prompt-bg) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk { font-weight: 700; font-variant-numeric: tabular-nums; }
.srow .what { min-width: 0; display: grid; }
.srow .what .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .what small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .what .cmp { color: var(--warn); } .srow .what .cmp.same { color: var(--ok); }
.srow .sp { min-width: 0; display: flex; overflow: hidden; }
.num { text-align: right; font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.num.cost { color: var(--ink); font-weight: 500; }
.r { text-align: right; }
.card-in { background: var(--raise); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; }
.card-in.big { padding: 16px 18px; }
.card-in h4, .cname { margin: 0; font-size: 15px; }
.csec h5, h5 { margin: 4px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h6 { margin: 0 0 6px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.pts { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.pts small { color: var(--muted); }
.pts.facts li { font-family: var(--f-mono); font-size: 12px; color: var(--code); }
.pts.dropped li { color: var(--muted); } .pts.dropped s { color: var(--red); }
.loading { display: flex; gap: 8px; align-items: center; color: var(--muted); padding: 18px 4px; }

/* step drawer */
.dr-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 20, .32); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 39; }
body.drawer-open .dr-backdrop { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 100vw); background: var(--panel); z-index: 40; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .18); transform: translateX(104%); transition: transform .3s var(--ease); border-left: 1px solid var(--rule); }
.drawer.open { transform: none; }
.dr-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; }
.dr-head h2 { flex: 1; display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 17px; }
.dr-level { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 7px; text-transform: uppercase; letter-spacing: .05em; }
.dr-level.lv-chunker { background: var(--code-bg); color: var(--code); } .dr-level.lv-episodio { background: var(--model-bg); color: var(--model); } .dr-level.lv-consolidamento { background: var(--cons-bg); color: var(--cons); }
.dr-nav { display: flex; gap: 4px; }
.dr-nav button, .dr-close { padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.dr-sub { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 0 16px 10px; font-size: 12.5px; border-bottom: 1px solid var(--rule); }
.dr-sub .cost { font-weight: 600; font-variant-numeric: tabular-nums; }
.dr-flow { display: flex; gap: 0; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--rule); background: var(--raise); }
.dr-flow button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 10px; border-radius: 8px; text-align: left; position: relative; flex: 1 1 0; min-width: 118px; color: var(--muted); }
.dr-flow button + button::before { content: ""; position: absolute; left: -6px; top: 50%; width: 12px; height: 2px; background: var(--rule); }
.dr-flow button i { font-style: normal; font-weight: 700; font-size: 12px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--rule); flex: none; transition: all .2s; }
.dr-flow button span { display: grid; font-weight: 600; font-size: 13px; line-height: 1.2; }
.dr-flow button small { font-weight: 400; font-size: 11px; color: var(--muted); }
.dr-flow button[aria-selected="true"] { color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
.dr-flow button[aria-selected="true"] i { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.dr-body { overflow: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.dr-body.enter { animation: slidein .25s var(--ease); }
pre.mono { margin: 0; font-family: var(--f-mono); font-size: 12px; line-height: 1.55; background: var(--grid); border-radius: 8px; padding: 10px 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 380px; }
pre.mono.tall { max-height: 60vh; }
.fold { border: 1px solid var(--rule); border-radius: 9px; padding: 8px 12px; background: var(--panel); }
.fold > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.fold > summary small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.fold[open] > summary { margin-bottom: 8px; }
.fold + .fold { margin-top: -4px; }
.callcard { border: 1px solid var(--rule); border-left: 4px solid var(--prompt); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.callhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.callhead .cn { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.nocall { display: flex; gap: 14px; align-items: center; background: var(--code-bg); color: var(--code); border-radius: 12px; padding: 16px 18px; }
.nocall p { margin: 0; color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.kpis > div { background: var(--raise); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.kpis span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpis b { font-size: 17px; font-variant-numeric: tabular-nums; }
.kpis b.txt { font-size: 13px; font-weight: 500; }
.kpis small { color: var(--muted); font-size: 11.5px; }
.kpis.small b { font-size: 14px; }
.kpis .hi b { color: var(--accent); } .kpis .good b { color: var(--ok); } .kpis .bad b { color: var(--red); }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-variant-numeric: tabular-nums; }
table.calls, table.evlist, table.metrics, table.eps { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.calls th, table.calls td, table.evlist th, table.evlist td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.calls th, table.evlist th, table.metrics th, table.eps th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
table.calls .r, table.evlist .r { text-align: right; }
table.evlist td.t { font-family: var(--f-mono); color: var(--muted); }
table.metrics { min-width: 520px; } table.metrics th, table.metrics td { padding: 5px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
table.metrics .r { text-align: right; }
table.metrics td.lvl { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
.lv-chunk { color: var(--code); } .lv-episodi { color: var(--model); } .lv-consolidamento { color: var(--cons); } .lv-rapporti { color: var(--muted); }
table.metrics tr.sep td { border-top: 2px solid var(--rule); }
table.metrics td.chg { font-weight: 600; color: var(--accent); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.pair > div { border: 1px solid var(--rule); border-radius: 10px; padding: 10px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.diff { background: var(--prompt-bg); }

/* new-run wizard */
dialog.wizard { width: min(1100px, calc(100vw - 24px)); max-height: calc(100vh - 32px); border: 0; border-radius: 16px; padding: 0; background: var(--panel); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
dialog.wizard[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; animation: pop .28s var(--ease); }
dialog.wizard[data-section="f2"] { --accent: var(--f2); }
dialog::backdrop { background: rgba(10, 16, 20, .45); backdrop-filter: blur(2px); }
.wz-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 4px; }
.wz-head h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--accent); }
.wz-steps { list-style: none; margin: 0; padding: 8px 14px 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; border-bottom: 1px solid var(--rule); }
.wz-steps button { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 10px; color: var(--muted); }
.wz-steps button i { font-style: normal; font-weight: 700; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--rule); flex: none; transition: all .25s; }
.wz-steps button span { display: grid; font-weight: 600; line-height: 1.2; } .wz-steps small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.wz-steps li.on button { color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.wz-steps li.on button i { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.wz-steps li.done button i { background: var(--code-bg); border-color: var(--code); color: var(--code); }
.wz-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.wz-panels { padding: 16px 18px; overflow: auto; }
.wz-panel { display: grid; gap: 12px; align-content: start; }
.wz-panel.in-r { animation: fromright .28s var(--ease); } .wz-panel.in-l { animation: fromleft .28s var(--ease); }
.wz-summary { border-left: 1px solid var(--rule); background: var(--raise); padding: 16px; overflow: auto; display: grid; gap: 8px; align-content: start; }
.wz-summary h3 { margin: 0 0 4px; font-size: 13px; }
.sm-row { display: grid; gap: 2px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--rule); animation: fadein .2s; }
.sm-row > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sm-row > div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sm-row b.big { font-size: 18px; color: var(--accent); }
.wz-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--rule); }
.wz-foot .grow { flex: 1; } .wz-foot button { padding: 9px 18px; }
button.go { background: var(--ok); border-color: var(--ok); }
.wz-h { margin: 6px 0 0; font-size: 14px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.swcards { display: grid; gap: 8px; }
.swcard { display: grid; grid-template-columns: 44px minmax(0, 1fr) 46px; gap: 12px; align-items: center; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .2s, background .2s; position: relative; }
.swcard input { position: absolute; opacity: 0; pointer-events: none; }
.swc-code { font-weight: 800; font-size: 15px; display: grid; place-items: center; height: 36px; border-radius: 9px; background: var(--grid); color: var(--muted); transition: all .2s; }
.swc-t { display: grid; gap: 2px; } .swc-t small { color: var(--muted); }
.toggle { width: 42px; height: 24px; border-radius: 12px; background: var(--rule); position: relative; transition: background .2s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.swcard:has(input:checked) { border-color: var(--model); background: color-mix(in srgb, var(--model) 6%, transparent); }
.swcard:has(input:checked) .swc-code { background: var(--model); color: var(--panel); }
.swcard:has(input:checked) .toggle { background: var(--model); } .swcard:has(input:checked) .toggle::after { transform: translateX(18px); }
.swcard:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.run-prompts { display: grid; gap: 6px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 10px; }
.prow.mod { border-color: var(--prompt); background: var(--prompt-bg); }
.prow .pn { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 0 8px; align-items: center; } .prow .pn small { grid-column: 2; color: var(--muted); font-size: 11.5px; }
.prow select { padding: 6px 8px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); }
.prow > .muted { font-size: 12.5px; justify-self: end; }
.estimate { display: grid; gap: 10px; }
.est-big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.est-big b { font-size: 34px; color: var(--accent); letter-spacing: -.02em; animation: pop .3s var(--ease); }
.est-big span { color: var(--muted); }
.est-chain { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.est-chain div { border: 1px solid var(--rule); border-top: 3px solid var(--code); border-radius: 10px; padding: 8px 10px; display: grid; }
.est-chain div:nth-child(2) { border-top-color: var(--model); } .est-chain div:nth-child(3) { border-top-color: var(--cons); }
.est-chain span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); } .est-chain b { font-size: 16px; } .est-chain small { color: var(--muted); }

/* analysis */
.analysis-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.a-nav { position: sticky; top: 82px; display: grid; gap: 2px; }
.a-nav button { border: 0; background: none; text-align: left; padding: 6px 10px; border-left: 3px solid var(--rule); border-radius: 0 8px 8px 0; color: var(--muted); font-size: 13px; }
.a-nav button.on { border-left-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 600; }
.a-nav button.hl { color: var(--prompt); }
.analysis-body { display: grid; gap: 14px; min-width: 0; }
.acard { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; scroll-margin-top: 90px; animation: rise .3s var(--ease) both; }
.acard:nth-child(2) { animation-delay: .04s; } .acard:nth-child(3) { animation-delay: .08s; } .acard:nth-child(4) { animation-delay: .12s; }
.acard.hl { border-color: var(--prompt); box-shadow: 0 0 0 1px var(--prompt), var(--shadow); }
.acard h3 { margin: 0; font-size: 16px; }
.dl { color: var(--muted); font-size: 13px; } .dv { font-variant-numeric: tabular-nums; text-align: right; } .dv.b { color: var(--model); text-align: left; }
.dd { font-style: normal; text-align: center; font-weight: 700; color: var(--muted); } .dd.good { color: var(--ok); } .dd.bad { color: var(--red); }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols > div { border: 1px solid var(--rule); border-radius: 10px; padding: 10px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.vals { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.vals li { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 12.5px; }
.vals code { background: var(--grid); padding: 0 5px; border-radius: 4px; } .vals small { color: var(--muted); } .vals i { font-style: normal; color: var(--muted); }
.verdict { display: grid; gap: 10px; }
table.diffs td:first-child { color: var(--muted); }
table.eps { min-width: 620px; } table.eps th, table.eps td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--grid); }
table.eps td.k { font-weight: 700; white-space: nowrap; width: 70px; } table.eps td.k small { display: block; font-weight: 400; color: var(--warn); }
table.eps td span { display: block; } table.eps td small { color: var(--muted); }
table.eps .who { display: inline-flex; margin-bottom: 3px; }
.ep-btn { display: grid; gap: 2px; justify-items: start; width: 100%; text-align: left; border: 0; background: none; padding: 4px 6px; border-radius: 7px; font-weight: 400; }
.ep-btn:hover { background: var(--model-bg); } .ep-btn small { color: var(--muted); }

/* prompts */
.prompt-screen { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.pmap { position: sticky; top: 82px; display: grid; gap: 4px; }
.pgroup { display: grid; gap: 5px; background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 10px; }
.pgroup h2 { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; } .pgroup h2 .ic { color: var(--cons); }
.pgroup:first-child h2 .ic { color: var(--model); }
.pflow { display: grid; place-items: center; color: var(--muted); margin: -2px 0; } .pflow .ic { transform: rotate(90deg); }
.pnode { display: grid; gap: 1px; text-align: left; padding: 7px 10px; border-radius: 9px; }
.pnode span { font-weight: 600; } .pnode small { color: var(--muted); font-size: 11.5px; } .pnode small b { color: var(--prompt); }
.pnode[aria-pressed="true"] { border-color: var(--prompt-sec); background: var(--prompt-bg); box-shadow: 0 0 0 1px var(--prompt-sec); }
.pdetail { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px; display: grid; gap: 12px; min-width: 0; box-shadow: var(--shadow); }
.pdetail.enter { animation: slidein .25s var(--ease); }
.phead { display: grid; gap: 4px; } .phead h3 { margin: 0; font-size: 20px; }
.pgroup-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button { border-radius: 8px; padding: 5px 11px; font-size: 13px; display: grid; text-align: left; line-height: 1.25; }
.seg button small { font-size: 11px; color: var(--muted); font-weight: 400; }
.seg button[aria-pressed="true"] { background: var(--prompt-bg); color: var(--prompt); border-color: var(--prompt); }
.seg.versions button[aria-pressed="true"] small { color: var(--prompt); }
.pshow { display: grid; gap: 8px; animation: fadein .2s; }
.pbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .pbar .danger { margin-left: auto; }
pre.ptext { max-height: 62vh; }
.pdiff { font-family: var(--f-mono); font-size: 12px; line-height: 1.6; background: var(--grid); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 62vh; overflow: auto; }
.pdiff del { background: var(--red-bg); color: var(--red); } .pdiff ins { background: var(--code-bg); color: var(--code); text-decoration: none; }
.editor { border: 1px dashed var(--prompt); border-radius: 12px; padding: 10px 14px; background: color-mix(in srgb, var(--prompt-bg) 40%, transparent); }
.editor > summary { cursor: pointer; font-weight: 600; display: flex; gap: 6px; align-items: center; color: var(--prompt); }
.editor[open] > summary { margin-bottom: 10px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.editor-left { display: grid; gap: 8px; align-content: start; }
.editor-right { display: grid; gap: 6px; align-content: start; min-width: 0; } .editor-right .pdiff { max-height: 470px; }
.editor textarea { font-family: var(--f-mono); font-size: 12px; line-height: 1.5; resize: vertical; min-height: 360px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: rise .25s var(--ease); max-width: 380px; }
.toast.err { background: var(--red); } .toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }

/* motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes fromright { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes fromleft { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes flow { to { background-position: 28px 0; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 45%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(.94); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* narrow screens */
@media (max-width: 1100px) {
  .chain { grid-template-columns: minmax(0, 1fr); }
  .connector { grid-template-columns: 2px auto; justify-content: start; padding: 2px 0 2px 22px; gap: 10px; }
  .connector i { width: 2px; height: 20px; } .connector i::after { right: -4px; top: auto; bottom: -2px; border: 5px solid transparent; border-top-color: var(--rule); border-bottom: 0; }
  .connector.flow i { background: repeating-linear-gradient(180deg, var(--accent) 0 6px, transparent 6px 10px); }
  .srow-head { display: none; }
  .srow { grid-template-columns: 54px minmax(0, 1fr) auto; }
  .srow .who, .srow .num:not(.cost) { display: none; } .srow .sp { grid-column: 2 / -1; grid-row: 2; }
  .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .runs-screen, .analysis-layout, .prompt-screen { grid-template-columns: minmax(0, 1fr); }
  .rail, .a-nav, .pmap { position: static; max-height: none; }
  .runcards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; } .runcard { flex: 0 0 260px; scroll-snap-align: start; }
  .a-nav { display: flex; overflow-x: auto; } .a-nav button { border-left: 0; border-bottom: 3px solid var(--rule); border-radius: 8px 8px 0 0; white-space: nowrap; }
  .a-nav button.on { border-bottom-color: var(--accent); }
  .sections { grid-template-columns: repeat(4, minmax(0, 1fr)); } .sec small { display: none; } .sec { padding: 6px; gap: 6px; } .sec i { min-width: 28px; }
  .wz-main { grid-template-columns: minmax(0, 1fr); } .wz-summary { border-left: 0; border-top: 1px solid var(--rule); max-height: 30vh; }
  .wz-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); } .wz-steps small { display: none; }
  .pair, .cols, .cols.three, .editor-grid, .est-chain { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); } .prow { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .sec span { font-size: 12.5px; } .sec i { display: none; }
  .hero h1 { font-size: 20px; } .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr-flow { gap: 4px; } .dr-flow button { flex: 0 0 auto; min-width: 0; padding: 6px 8px; } .dr-flow button + button::before { display: none; } .dr-flow button small { display: none; } .dr-flow button span { white-space: nowrap; }
}

/* model picker: provider, model, price, reasoning */
.prov { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; letter-spacing: .02em; background: var(--grid); color: var(--muted); }
.prov.p-anthropic { background: #f3e3d6; color: #8a4b1c; } .prov.p-openrouter { background: #e1e6fb; color: #3b4fb8; } .prov.p-openai { background: #dcefe9; color: #19705a; }
@media (prefers-color-scheme: dark) { .prov.p-anthropic { background: #45301f; color: #f2b98d; } .prov.p-openrouter { background: #262f55; color: #aeb9ff; } .prov.p-openai { background: #173a31; color: #8fe0c6; } }
.meta .prov, .sm-row .prov { margin-right: 2px; } .meta small, .sm-row small { color: var(--muted); }
.mpicks { display: grid; gap: 8px; }
.mcard { border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; transition: border-color .2s, box-shadow .2s; }
.mcard.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mc-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 12px; align-items: center; }
.mc-t { display: grid; } .mc-t small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.mc-now { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.mc-now small { color: var(--muted); }
.mc-price { font-size: 12px; font-variant-numeric: tabular-nums; } .mc-price small { display: none; }
.mpicker { display: grid; gap: 8px; animation: fadein .2s; }
.mprov button { display: grid; gap: 2px; justify-items: start; } .mprov small { font-size: 11px; }
.mprov button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 9%, transparent); border-color: var(--accent); color: var(--ink); }
.ok-t { color: var(--ok); }
.mtools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mtools input[type=search] { flex: 1 1 240px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); }
.mtools .field.inline { padding: 0; grid-template-columns: auto minmax(0, 150px); }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 300px; overflow: auto; }
.mrow { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 150px 130px; gap: 10px; align-items: center; text-align: left; border-radius: 8px; padding: 6px 10px; font-weight: 400; }
.mrow.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.mr-n { display: grid; min-width: 0; } .mr-n b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mr-n small { color: var(--muted); font-size: 11px; font-family: var(--f-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-p { font-family: var(--f-mono); font-size: 12px; text-align: right; } .mr-s { font-size: 11.5px; } .mr-s i { font-style: normal; }
@media (max-width: 900px) { .mc-head { grid-template-columns: minmax(0, 1fr) auto; } .mc-now { grid-column: 1 / -1; grid-row: 2; } .mrow { grid-template-columns: minmax(0, 1fr) auto; } .mr-s { display: none; } }

/* series: wizard mode, variants, analysis of many runs */
.runmode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.runmode button { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; }
.runmode button small { color: var(--muted); font-weight: 400; font-size: 12px; }
.runmode button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.variant { border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 12px; padding: 10px; display: grid; gap: 6px; animation: rise .25s var(--ease); }
.vhead { display: flex; align-items: center; gap: 8px; } .vhead .x { margin-left: auto; }
.vletter { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 12px; padding: 0 4px; }
.mcard.compact { padding: 6px 10px; } .mcard.compact .mc-head { grid-template-columns: 130px minmax(0, 1fr) auto; }
.addvar { display: flex; align-items: center; justify-content: center; gap: 6px; border-style: dashed; border-radius: 12px; padding: 10px; }
.vline { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; width: 100%; font-size: 12px; }
table.vtable td { vertical-align: middle; }
.chip.serie { background: var(--cons-bg); color: var(--cons); }
.kgroup { display: grid; gap: 4px; margin-top: 8px; }
.kcheck { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 8px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.kcheck:hover { background: var(--grid); } .kcheck small { grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; color: var(--muted); }
table.kmatrix { border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 100%; }
table.kmatrix th, table.kmatrix td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right; }
table.kmatrix .kname { text-align: left; position: sticky; left: 0; background: var(--panel); min-width: 240px; z-index: 1; }
table.kmatrix .kname small { display: block; color: var(--muted); font-size: 10.5px; }
table.kmatrix th.kcol { text-align: left; vertical-align: top; min-width: 190px; font-weight: 400; }
tr.kgrp td { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); background: var(--raise); padding-top: 10px; }
td.kval.best { background: var(--code-bg); color: var(--code); font-weight: 700; } td.kval.worst { background: var(--red-bg); color: var(--red); font-weight: 600; }
.kcols { display: grid; grid-template-columns: repeat(var(--n), minmax(280px, 1fr)); gap: 12px; }
.kcols > div { border: 1px solid var(--rule); border-radius: 10px; padding: 10px; display: grid; gap: 6px; align-content: start; }
table.kwide { min-width: calc(220px * 3); }
@media (max-width: 900px) { .runmode { grid-template-columns: minmax(0, 1fr); } .mcard.compact .mc-head { grid-template-columns: minmax(0, 1fr) auto; } }

/* behind the scenes: truncations, unreadable answers, reasoning */
.backstage { background: var(--panel); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 14px; display: grid; gap: 10px; }
.backstage.alert { border-color: color-mix(in srgb, var(--warn) 60%, var(--rule)); }
.backstage > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; list-style: none; }
.backstage > summary::-webkit-details-marker { display: none; }
.backstage > summary::before { content: "▸"; color: var(--muted); transition: transform .2s; } .backstage[open] > summary::before { transform: rotate(90deg); }
.backstage > summary b { margin-right: 4px; }
.backstage[open] > summary { margin-bottom: 4px; }
.bs-bar-wrap { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.bs-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--grid); }
.bs-bar i, .bs-legend i { display: block; height: 100%; }
.bs-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; } .bs-legend span { display: inline-flex; align-items: center; gap: 5px; } .bs-legend i { width: 10px; height: 10px; border-radius: 3px; }
i.vis { background: var(--code); } i.think { background: var(--model); } i.cut { background: var(--red); } i.unk { background: var(--warn); } i.other { background: var(--muted); }
.bs-steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.bs-steps > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.bs-steps button { padding: 3px 9px; border-radius: 999px; font-size: 12.5px; }
.srow .sk .cut { margin-left: 5px; font-size: 11px; color: var(--red); font-weight: 700; cursor: help; }
table.calls tr.cut td { background: color-mix(in srgb, var(--red-bg) 70%, transparent); }
table.calls tr.bad td { background: color-mix(in srgb, var(--prompt-bg) 60%, transparent); }
table.calls small.split { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }

/* analysis: one comparison of 2 to 8 runs of one scope */
.cmp-count:not(:empty) { position: absolute; top: 2px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--analisi); color: var(--on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.cmp-head { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; margin-bottom: 14px; box-shadow: var(--shadow); }
.cmp-head > .note, .cmp-head > .msg { margin: 0; }
.cmp-top { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.cmp-top .field.inline { padding-bottom: 0; grid-template-columns: auto minmax(0, 320px); }
label.check { display: inline-flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 600; cursor: pointer; }
label.check input { margin-top: 3px; } label.check span { display: grid; } label.check small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.cmp-chosen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 30px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 4px; border: 1px solid var(--rule); border-radius: 999px; background: var(--raise); font-size: 12.5px; max-width: 100%; }
.cmp-chip > span:not(.vletter) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; color: var(--muted); }
.cmp-chip .x { width: 22px; height: 22px; }
.cmp-pick > summary small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.cmp-series { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.cmp-series button { border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.kcheck.on { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.kcheck.busy { opacity: .6; cursor: default; }
table.cfg th { text-align: left; vertical-align: top; min-width: 170px; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink); }
table.cfg th small { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); font-weight: 400; margin-top: 3px; }
table.cfg td { vertical-align: top; } table.cfg td.cfg-k { color: var(--muted); white-space: nowrap; }
table.cfg tr.diff td { background: color-mix(in srgb, var(--accent) 7%, transparent); } table.cfg tr.diff td.cfg-k { color: var(--ink); font-weight: 600; }
table.cfg .ne { font-style: normal; color: var(--accent); font-weight: 700; margin-left: 4px; }
table.cfg.only tr.same { display: none; }
table.kmatrix th.kdelta { min-width: 120px; text-align: right; }
td.kval.kd { white-space: nowrap; color: var(--muted); } td.kval.kd small { font-size: 11px; }
td.kval.kd.good { color: var(--code); font-weight: 700; } td.kval.kd.bad { color: var(--red); font-weight: 700; }
.kcols > .kcard.real { background: var(--raise); }
table.eps td.real span { display: block; } table.eps td.real { background: var(--raise); }
.rc-act { display: inline-flex; gap: 2px; align-items: center; }
.rc-cmp { width: 24px; height: 24px; padding: 0; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.rc-cmp.on { background: var(--analisi); border-color: var(--analisi); color: var(--on-accent); }
.cmp-btn { display: inline-flex; align-items: center; gap: 6px; }
.cmp-btn.on { border-color: var(--analisi); color: var(--ink); }
.cmp-btn.on .vletter { background: var(--analisi); }

/* a series in the list of runs: one comparison card with its variants */
.runcard.series { gap: 6px; border-left: 3px solid var(--analisi); }
.rc-vars { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.rc-var { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 7px; background: var(--raise); border: 1px solid transparent; font-size: 12px; cursor: pointer; }
.rc-var:hover { border-color: var(--rule); } .rc-var.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.rc-var .vletter { background: var(--analisi); min-width: 20px; height: 20px; font-size: 11px; }
.rc-vm { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; min-width: 0; overflow: hidden; } .rc-vm small { color: var(--muted); display: inline-flex; gap: 3px; align-items: center; }
.rc-vc { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.rc-open { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--analisi); }
.rc-open { justify-self: start; padding: 2px 0; }
.rc-wait { font-size: 12px; color: var(--muted); }
.runcard.series:not([data-series]) { cursor: default; }

/* the case under analysis: one workspace and session for F1, F2 and the Analysis */
.case-bar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 10px; font-size: 12.5px; }
.case-bar:empty { display: none; }
body[data-section="prompt"] .case-bar { display: none; }
.case-pick { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.case-pick select { padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rule)); border-radius: 8px; background: var(--panel); font-weight: 600; font-size: 13px; max-width: min(560px, 80vw); }
.case-info { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); } .case-info b { color: var(--ink); font-weight: 600; }
.case-act { display: inline-flex; gap: 2px; } .case-act button.link { font-size: 12.5px; } .case-act button.del { color: var(--red); }
.rc-case { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--grid); padding-bottom: 4px; }

/* a new case: a session of a log */
dialog.wizard.nc { width: min(640px, calc(100vw - 24px)); }
dialog.wizard.nc[open] { grid-template-rows: auto minmax(0, 1fr) auto; }
.nc-body { padding: 8px 18px 14px; display: grid; gap: 12px; overflow: auto; }
.nc-body .lead { margin: 0; }
.nc-logs { display: grid; gap: 8px; } .nc-logs h5 { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.nc-log { border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; }
.nc-log h6 { margin: 0; font-size: 13px; } .nc-log h6 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.nc-sess { display: grid; grid-template-columns: 18px auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 5px 6px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.nc-sess:hover { background: var(--grid); } .nc-sess.on { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nc-sess small { color: var(--muted); }
.case-new { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); color: var(--accent); }
#nc-msg { color: var(--red); font-size: 12.5px; align-self: center; }

/* analysis charts: small multiples, one bar per run in its color */
.run-0 { --run: var(--run-0); } .run-1 { --run: var(--run-1); } .run-2 { --run: var(--run-2); } .run-3 { --run: var(--run-3); }
.run-4 { --run: var(--run-4); } .run-5 { --run: var(--run-5); } .run-6 { --run: var(--run-6); } .run-7 { --run: var(--run-7); }
.vletter[class*="run-"] { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 2px var(--run); }  /* text in ink, the run color as a ring */
.kb-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.kb-key { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; } .kb-key > span:last-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.kb-pick { display: flex; flex-wrap: wrap; gap: 6px; } .kb-pick button { padding: 4px 12px; border-radius: 999px; font-size: 12.5px; }
.kb-pick button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 600; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.kb-chart { margin: 0; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; align-content: start; }
.kb-chart figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 4px; } .kb-chart figcaption small { color: var(--muted); white-space: nowrap; }
.kb-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 2px 0; cursor: default; }
.kb-row .vletter { min-width: 20px; height: 20px; font-size: 11px; }
.kb-track { height: 10px; border-left: 1px solid var(--rule); }
.kb-track i { display: block; height: 10px; background: var(--run); border-radius: 0 4px 4px 0; }
.kb-row.out .kb-track i { opacity: .4; }
.kb-row:hover .kb-track i { filter: brightness(1.1); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--run); }
.kb-v { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; text-align: right; min-width: 64px; }
.kb-v.best { font-weight: 700; } .kb-v small { font-weight: 400; color: var(--muted); }
.kb-tip { position: absolute; z-index: 50; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; display: grid; gap: 3px; max-width: 360px; pointer-events: none; }
.kb-tip .vletter { min-width: 18px; height: 18px; font-size: 10.5px; }

/* analysis for many runs: ranking table, scatter, strips */
.run-other { --run: var(--muted); }
.cmp-many { font-size: 13px; }
.cmp-list { max-height: 360px; overflow: auto; padding-right: 4px; }
.cmp-series input[type="search"] { padding: 5px 10px; border: 1px solid var(--rule); border-radius: 999px; background: var(--panel); font-size: 12.5px; min-width: 220px; }
.kt-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.kt-tools .field.inline { padding: 0; grid-template-columns: auto minmax(0, 200px); }
.kt-tools input[type="search"] { padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); font-size: 13px; min-width: 200px; }
.kt-wrap { max-height: 72vh; overflow: auto; border: 1px solid var(--rule); border-radius: 10px; }
table.kt { border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 100%; }
table.kt th, table.kt td { padding: 5px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.kt thead th { position: sticky; top: 0; z-index: 2; background: var(--raise); vertical-align: bottom; text-align: right; }
table.kt .kt-run { position: sticky; left: 34px; z-index: 1; background: var(--panel); text-align: left; min-width: 240px; max-width: 320px; }
table.kt thead .kt-run { z-index: 3; background: var(--raise); }
table.kt .kt-f { width: 34px; min-width: 34px; text-align: center; position: sticky; left: 0; z-index: 1; background: var(--panel); }
table.kt thead .kt-f { z-index: 3; background: var(--raise); }
.kt-rc { display: flex; gap: 8px; align-items: center; min-width: 0; }
.kt-name { display: grid; min-width: 0; } .kt-name b { overflow: hidden; text-overflow: ellipsis; font-weight: 600; } .kt-name small { display: flex; gap: 4px; align-items: center; color: var(--muted); }
.kt-sort { border: 0; background: none; padding: 0; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink); text-align: right; cursor: pointer; display: grid; justify-items: end; white-space: normal; max-width: 150px; }
.kt-sort small { font-weight: 400; color: var(--muted); font-size: 10.5px; }
th.kt-run .kt-sort { text-align: left; justify-items: start; }
td.kt-v { text-align: right; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, transparent) var(--w), transparent var(--w)); }
td.kt-v.best { color: var(--code); font-weight: 700; } td.kt-v.worst { color: var(--red); font-weight: 600; }
td.kt-c { text-align: left; } td.kt-c .prov { font-size: 10px; }
table.kt tr.focus td { background-color: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
table.kt tr.focus td.kt-v { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent) var(--w), color-mix(in srgb, var(--accent) 7%, var(--panel)) var(--w)); }
table.kt tr.partial td { opacity: .7; }
table.kt tr:hover td { background-color: var(--grid); }
table.kt tr.kt-diff td { border-top: 2px solid var(--rule); font-weight: 600; }
td.kd.good { color: var(--code); } td.kd.bad { color: var(--red); }
.kb-axes { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.kb-axes .field.inline { padding: 0; grid-template-columns: auto minmax(0, 260px); }
.kb-svg { width: 100%; height: auto; display: block; overflow: visible; }
.kb-gridline { stroke: var(--grid); stroke-width: 1; } .kb-axis { stroke: var(--rule); stroke-width: 1; }
.kb-tick { fill: var(--muted); font-size: 11px; } .kb-axlabel { fill: var(--muted); font-size: 12px; } .kb-dlabel { fill: var(--ink); font-size: 11px; font-weight: 600; }
.kb-dot circle { fill: var(--run); stroke: var(--panel); stroke-width: 2; cursor: pointer; }
.kb-dot.out circle { fill-opacity: .35; }
.kb-dot.on circle { stroke: var(--ink); stroke-width: 2; }
.kb-dot:hover circle { stroke: var(--ink); }
.kb-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--run); }
.kb-key small { color: var(--muted); }
.kb-strips { display: grid; gap: 4px; }
.kb-strip { margin: 0; border-bottom: 1px solid var(--grid); padding: 4px 0; }
.kb-strip figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; } .kb-strip figcaption small { color: var(--muted); }
.kb-strip .kb-dot circle { stroke-width: 1.5; }
.kb-count { fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 2.5px; font-size: 10px; font-weight: 700; pointer-events: none; } .kb-count.small { font-size: 8px; }
.kb-dot:focus { outline: none; } .kb-dot:focus circle { stroke: var(--ink); stroke-width: 3; }
.kb-tip-list { display: grid; gap: 2px; max-height: 220px; overflow: hidden; }

/* the trash: cases, runs and files deleted, restorable for 14 days */
.case-end { margin-left: auto; display: inline-flex; gap: 10px; align-items: center; }
.case-end .del { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; }
.case-bin { padding: 5px 10px; border-radius: 8px; font-size: 12.5px; }
.tb-group { display: grid; gap: 6px; } .tb-group h5 { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.tb-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; }
.tb-item small { color: var(--muted); display: block; } .tb-item .tb-act { display: inline-flex; gap: 6px; }
.tb-item .del { color: var(--red); }

/* JSON exports for analyses: a quiet link-button next to the section's actions */
a.export, button.export { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
a.export:hover, button.export:hover { border-color: var(--ink); }
a.export:focus-visible, button.export:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph-act { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel-tools { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.ahead { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.dr-sub a.export { margin-left: auto; padding: 4px 9px; font-size: 12.5px; }
