/* Books: an accounting app inside the showroom frame. Tokens, buttons, tables, tags and the guide come from /_s/shell.css. */
:root { --maxw: 1240px; --nav-w: 208px; }

/* ---------------------------------------------------------------- the app window */
.app { position: relative; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: auto 1fr; margin-top: 26px;
  background: var(--surface); border: 1px solid var(--axis); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: clip; min-height: 640px; }
.app-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px 16px; padding: 12px 18px; border-bottom: 1px solid var(--grid); background: var(--surface); flex-wrap: wrap; }
.app-co { display: flex; align-items: center; gap: 11px; margin-right: auto; min-width: 0; }
.app-co b { display: block; font: 600 1rem var(--serif); line-height: 1.2; }
.app-co small { display: block; font: 500 .72rem var(--mono); color: var(--muted); letter-spacing: .03em; }
.app-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.app-mark svg { width: 18px; height: 18px; }
.ask-open { min-height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 999px; background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.ask-open:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-ink) 88%, #000); border-color: var(--accent-ink); }
.ask-open svg { width: 16px; height: 16px; }

.healthbtn { flex: none; min-height: 38px; padding: 0 2px; border: 0; background: none; border-radius: 999px; }
.healthbtn:hover:not(:disabled) { background: none; }
.health { display: inline-flex; gap: 5px; }
.health > span { position: relative; display: inline-flex; align-items: center; font: 500 .72rem var(--mono); color: var(--ink2); border: 1px solid var(--axis); border-radius: 999px; padding: .28em .7em; background: var(--surface); white-space: nowrap; }
.healthbtn:hover .health > span { border-color: var(--field); }
.health .hw { margin-left: 3px; }

.app-nav { grid-row: 2; display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 20px; background: var(--surface2); border-right: 1px solid var(--grid); }
.app-nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 9px; color: var(--ink2); text-decoration: none; font: 500 .92rem var(--sans); }
.app-nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.app-nav a:hover { background: var(--hover); color: var(--ink); }
.app-nav a.on { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-sm); }
.app-nav a.on svg { color: var(--accent-ink); opacity: 1; }
.nav-h { margin: 16px 12px 4px; font: 500 .66rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-n { margin-left: auto; font: 600 .68rem var(--mono); color: var(--warntext); background: var(--warn-soft); border-radius: 999px; padding: .1em .55em; }

.app-main { grid-row: 2; min-width: 0; padding: 22px 26px 34px; container: main / inline-size; }
.view > .v-head { margin-bottom: 16px; }
.v-head h2 { margin: 0; font: 600 1.45rem/1.2 var(--serif); letter-spacing: -.01em; }
.v-sub { margin: 4px 0 0; color: var(--ink2); font-size: .93rem; max-width: 70ch; }
.v-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.v-tools input[type=search] { flex: 1 1 200px; min-height: 40px; }
.v-tools select { min-height: 40px; }
.card h3, .v-head + .card h3 { margin-top: 0; }
.card + .card, .tiles + .card, .card + .charts { margin-top: 18px; }
.card + .v-tools, .tiles + .v-tools { margin-top: 22px; }

/* segmented switches */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface2); border: 1px solid var(--grid); border-radius: 11px; flex-wrap: wrap; margin-bottom: 12px; }
.v-tools .seg { margin: 0; }
.seg button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 8px; background: none; color: var(--ink2); font: 500 .86rem var(--sans); }
.seg button:hover:not(:disabled) { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-sm); }
.seg-n { font: 600 .7rem var(--mono); color: var(--muted); margin-left: 2px; }

/* lists */
.list table { font-size: .9rem; }
.list td { vertical-align: top; }
.why { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; margin-top: 2px; }
td .tag + .why { display: inline; margin-left: 4px; }
.nowrap { white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin: 10px 0 0; font: 500 .78rem var(--mono); color: var(--muted); }
.pager span { margin-right: auto; }
.pager button { min-height: 34px; padding: 0 12px; font-size: .84rem; }
.empty { padding: 18px 4px; }
tr.on td { background: var(--accent-soft); }
tr.clickable:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -2px; }
.tag.warn, .tag.good, .tag.accent { font-size: .68rem; }

/* dashboard */
.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@container main (min-width: 1100px) { .tiles:not(.small) { grid-template-columns: repeat(6, minmax(0, 1fr)); } .tiles:not(.small) .tile .value { font-size: 1.3rem; } }
@container main (min-width: 640px) { .tiles.small { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { cursor: default; padding: 16px 18px; box-shadow: none; background: var(--surface2); border-color: transparent; }
.tile .value { font-size: 1.35rem; }
.tile .delta { font-variant-numeric: tabular-nums; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; margin-top: 14px; }
.morecharts { margin: 10px 0 0; }
.card .plot { position: relative; height: 240px; }
.card .legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 500 .74rem var(--mono); color: var(--ink2); margin: .2rem 0 .5rem; }
.swatch { display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: .4em; vertical-align: -1px; }
.card details { margin-top: .6rem; }

/* the path from the files to the figures */
.flow-card-h { margin: 0 0 10px; font-size: .78rem; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: f; }
.flow li { position: relative; min-width: 0; }
.flow li + li::before { content: ""; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px; background: var(--axis); }
.flow a, .flow li > span { display: flex; flex-direction: column; gap: 1px; height: 100%; padding: 13px 14px; border-radius: var(--r-sm); background: var(--surface2); border: 1px solid var(--grid); color: var(--ink); text-decoration: none; }
.flow a:hover { border-color: var(--accent); background: var(--accent-soft); }
.flow b { font: 650 1.05rem var(--sans); font-variant-numeric: tabular-nums; }
.flow span { font-size: .84rem; color: var(--ink2); }
.flow small { font-size: .74rem; color: var(--muted); line-height: 1.35; margin-top: 3px; }
#imp-flow { margin-bottom: 14px; }
.flow.mini { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 12px 0 14px; }
.flow.mini li > span { padding: 8px 10px; } .flow.mini b { font-size: .98rem; }
@container main (max-width: 700px) { .flow, .flow.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); } .flow li + li::before { display: none; } }

/* dashboard stories */
.story { margin-top: 20px; padding: 24px 26px; }
.story > h3 { margin: 0 0 4px; font: 600 1.15rem/1.3 var(--serif); }
.lede { margin: 0 0 18px; color: var(--ink2); font-size: .97rem; line-height: 1.5; max-width: 78ch; }
.lede b { color: var(--ink); font-variant-numeric: tabular-nums; }
.story-h { margin: 24px 0 10px; font: 500 .74rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fixes { display: grid; gap: 8px; }
.fix { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); grid-template-rows: auto auto; gap: 2px 14px; width: 100%; min-height: 0; padding: 12px 14px; text-align: left;
  border: 1px solid var(--grid); border-radius: var(--r-sm); background: var(--surface); font: inherit; color: var(--ink); white-space: normal; justify-content: stretch; align-items: start; }
.fix:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.fix-v { grid-row: 1 / 3; font: 650 1.05rem var(--sans); font-variant-numeric: tabular-nums; text-align: right; padding-top: 1px; }
.fix-t b { display: block; font-size: .93rem; } .fix-t small { display: block; color: var(--ink2); font-size: .82rem; line-height: 1.4; margin-top: 2px; }
.fix-bar { grid-column: 2; height: 5px; border-radius: 3px; background: var(--surface2); overflow: hidden; margin-top: 6px; }
.fix-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
#fixes-foot { margin: 14px 0 0; }
table.channels td { vertical-align: top; }
table.channels td.num b { font-variant-numeric: tabular-nums; }
.mini-bar { display: block; width: 100%; min-width: 70px; height: 5px; margin: 6px 0 0 auto; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: 3px; background: var(--good); }
.mini-bar.days i { background: var(--s2); }
#d-cash .plot { position: relative; height: 230px; margin-bottom: 8px; }
#r-tr .charts { margin-top: 0; }
.charts > .card { margin-top: 0; }
@media (max-width: 600px) {
  .story { padding: 16px; }
  .fix { grid-template-columns: minmax(0, 1fr); }
  .fix-v { grid-row: auto; text-align: left; }
  .fix-bar { grid-column: 1; }
  table.channels, table.channels tbody { display: block; }
  table.channels thead { display: none; }
  table.channels tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--grid); }
  table.channels td { display: block; padding: 0; border: 0; }
  table.channels td:nth-child(3), table.channels td:nth-child(4) { display: none; }
  table.channels td:nth-child(2) { text-align: right; font-weight: 600; }
  table.channels td:nth-child(5), table.channels td:nth-child(6) { grid-column: 1 / -1; display: grid; grid-template-columns: 8.5rem auto minmax(0, 1fr); align-items: center; gap: 8px; text-align: left; font-size: .86rem; }
  table.channels td:nth-child(5)::before { content: "Kept of each €100"; color: var(--muted); font-size: .78rem; }
  table.channels td:nth-child(6)::before { content: "Cash arrives after"; color: var(--muted); font-size: .78rem; }
  table.channels .mini-bar { margin: 0; min-width: 0; }
  table.channels tr.total td:nth-child(6) { display: none; }
}

/* sales */
.aging h3 { font-size: .95rem; }

/* reports */
table.fin td:first-child { min-width: 200px; }
table.fin tr.grand td { border-top: 2px solid var(--axis); }
#pl td button.cell, #bs td button.cell { text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent); }
#pl td button.cell:hover, #bs td button.cell:hover, #pl td button.cell:focus-visible, #bs td button.cell:focus-visible { text-decoration-color: var(--accent); }
td button.cell.on { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: 2px; text-decoration: none; }
.report h3 { margin-top: 0; }

/* imports */
.sim { margin-top: 16px; }
.sim .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sim .card-head h3 { margin: 0; }
.sim-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
@container main (max-width: 700px) { .sim-list { grid-template-columns: minmax(0, 1fr); } }
.sim-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface2); }
.sim-row > div { flex: 1; min-width: 0; display: grid; gap: 2px; } .sim-row b { font-size: .9rem; } .sim-row .muted { font-size: .8rem; line-height: 1.35; }
.sim-row button { flex: none; min-height: 36px; padding: 0 12px; font-size: .84rem; }
#breakresult { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--axis); }
#breakresult h3 { margin-top: 0; }
#breakstate { margin: 10px 0 0; }
.back { margin-bottom: 10px; }
.file-head { display: flex; gap: 12px 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.file-head h3 { margin: 0; font-size: 1.1rem; }
.file-head select { min-height: 40px; max-width: 100%; }
.file-meta { margin: 6px 0 0; font-size: .84rem; color: var(--muted); }
.rfs { display: flex; flex-wrap: wrap; gap: 4px; }
.rf { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 7px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--grid); font: 400 .78rem var(--mono); max-width: 100%; overflow-wrap: anywhere; }
.rf i { font-style: normal; font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.rf em { font-style: normal; color: var(--warntext); }

/* data explorer */
.layers { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.layers li + li button::before { content: "→"; position: absolute; left: -9px; top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-size: .8rem; }
.layers li:last-child button::before { content: ""; }
.layers button { position: relative; display: grid; justify-content: stretch; justify-items: start; gap: 1px; width: 100%; height: 100%; min-height: 0; padding: 10px 11px; text-align: left; align-content: start; border-radius: var(--r-sm); background: var(--surface2); border: 1px solid var(--grid); font: inherit; color: var(--ink); }
.layers button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.layers b { font-size: .88rem; } .layers small { font: 500 .7rem var(--mono); color: var(--muted); } .layers span { font-size: .74rem; color: var(--ink2); line-height: 1.3; }
@container main (max-width: 1000px) { .layers { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .layers li + li button::before { content: none; } }
@container main (max-width: 520px) { .layers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dx { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
@container main (max-width: 700px) { .dx { grid-template-columns: minmax(0, 1fr); } .dx-tables ul { max-height: 260px; overflow: auto; } }
.dx-tables ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.dx-tables, .dx-tables ul, .dx-tables li { min-width: 0; }
.dx-tables button { width: 100%; min-width: 0; gap: 10px; overflow: hidden; min-height: 34px; justify-content: space-between; padding: 0 10px; border: 0; border-radius: 7px; background: none; font: inherit; color: var(--ink2); }
.dx-tables button code { background: none; border: 0; padding: 0; font-size: .8rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-tables button small { font: 500 .7rem var(--mono); color: var(--muted); }
.dx-tables button[aria-pressed="true"] { background: var(--surface2); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
.dx-table { min-width: 0; border: 1px solid var(--grid); border-radius: var(--r); padding: 16px 18px; }
.dx-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dx-head h3 { margin: 0; } .dx-head code { font-size: .95rem; }
.dx-cols { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 8px 0 12px; }
.dx-cols span { display: inline-flex; gap: 5px; align-items: baseline; font-size: .76rem; } .dx-cols i { font: italic 400 .7rem var(--mono); color: var(--muted); }
.dx-table .list table { font: 400 .78rem var(--mono); } .dx-table .list td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.sqlform { display: flex; gap: 10px; align-items: flex-start; }
.sqlform textarea { flex: 1; min-height: 80px; }
#sqlout table { font: 400 .78rem var(--mono); }

/* checks */
.check { display: grid; grid-template-columns: 5.6rem 1fr; gap: .2rem .7rem; padding: .75rem .4rem; border-bottom: 1px solid var(--grid); }
.check:last-child { border-bottom: 0; }
.check .detail { grid-column: 2; color: var(--ink2); font-size: .9rem; overflow-wrap: anywhere; }
.check.changed { background: var(--warn-soft); border-radius: var(--r-sm); }
.check .tag { white-space: normal; }
#checks .row { margin: 0 0 16px; }
#published { margin-top: 14px; }
#published p { margin: 0; max-width: 90ch; }
.verdict .dot { width: .75em; height: .75em; }

/* ---------------------------------------------------------------- the side panel: lineage and ask */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(540px, 100vw); display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--axis); box-shadow: -24px 0 60px -24px rgba(28, 26, 24, .35); animation: drawer-in .22s var(--ease, ease-out); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--grid); }
.drawer-head h2 { margin: 0 auto 0 0; font: 600 1.1rem var(--serif); }
.drawer-x { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; }
.drawer-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; overscroll-behavior: contain; }
.fig { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--grid)); }
.fig small { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.fig b { font: 650 1.5rem var(--sans); font-variant-numeric: tabular-nums; }
.fig-lines { max-height: 240px; border: 1px solid var(--grid); border-radius: var(--r-sm); }
.fig-lines table, .drawer table { font-size: .84rem; }
.chain-h { margin: 18px 0 4px; }
.chain { list-style: none; margin: 14px 0 0; padding: 0; }
.chain > li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.chain > li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--grid); }
.chain .n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--axis); font: 600 .78rem var(--mono); color: var(--ink2); }
.chain h4 { margin: 3px 0 6px; font: 650 .95rem var(--sans); }
.chain p { margin: .2rem 0; font-size: .9rem; }
.rawrow { display: grid; gap: 3px; margin-bottom: 8px; } .rawrow small { font: 500 .7rem var(--mono); color: var(--muted); }
.cleanrow { margin-bottom: 6px; font-size: .9rem; } .cleanrow .why { display: inline; margin-left: 4px; }
.lands { margin: 0; padding-left: 1.1rem; font-size: .9rem; } .lands li { margin: .2rem 0; }
.ask-top { display: flex; gap: 12px; align-items: flex-start; } .ask-top p { margin: 0; flex: 1; }
.field-inline select { min-height: 38px; }
#answer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grid); }
#answer h3 { margin-top: 0; }
.answer-text { font-size: 1.08rem; line-height: 1.5; margin: .4rem 0 .6rem; }
.cite { margin: 0 0 .8rem; font: 400 .72rem/1.4 var(--mono); color: var(--muted); }
#answer .plot { position: relative; height: 220px; margin-bottom: 8px; }
.askwhat { margin-top: 1rem; }
#askform { margin: 12px 0 0; flex-wrap: nowrap; } #askform input { flex: 1 1 120px; min-width: 0; }
#curated button { min-height: 34px; padding: 0 13px; font-size: .86rem; }
.qtabs { display: flex; gap: 18px; margin: 14px 0 10px; border-bottom: 1px solid var(--grid); }
.qtabs button { position: relative; padding: 0 0 8px; min-height: 0; background: none; border: 0; border-radius: 0; font: 600 .74rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.qtabs button[aria-selected="true"] { color: var(--ink); }
.qtabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
@media (pointer: coarse) { .qtabs button { padding: 12px 0; } }
@media (hover: none) { .chips button:hover:not(:disabled) { background: var(--surface); border-color: var(--axis); } }

/* ---------------------------------------------------------------- tablets and phones: the sidebar becomes a row of tabs, the panel a full sheet */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; border-radius: var(--r); margin-inline: -8px; }
  .app-nav { grid-row: 2; flex-direction: row; overflow-x: auto; scrollbar-width: none; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--grid); gap: 2px; position: sticky; top: var(--bar-h, 0px); z-index: 5; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav a { flex: none; min-height: 38px; padding: 0 11px; font-size: .86rem; gap: 7px; }
  .app-nav a svg { width: 16px; height: 16px; }
  .nav-h { display: none; }
  .app-main { grid-row: 3; padding: 16px 14px 28px; }
  .drawer { width: 100vw; border-left: 0; }
  html:has(.sr-guide:not([hidden])) .drawer-body { padding-bottom: 170px; }
  #trace, #breakresult, #answer, #sim, #imp-file, .chain-h { scroll-margin-top: calc(70px + var(--bar-h, 0px)); }
}
@media (max-width: 600px) {
  .app-top { padding: 10px 12px; }
  .app-co small { font-size: .66rem; }
  .ask-open { padding: 0 12px; }
  .health .hw { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tiles, .tiles.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 11px 12px; } .tile .value { font-size: 1.15rem; }
  .card { padding: 16px; }
  .card .plot { height: 210px; }
  .check { grid-template-columns: 1fr; } .check .detail { grid-column: 1; }
  .sqlform { flex-direction: column; align-items: stretch; }
  .v-head h2 { font-size: 1.25rem; }
  .list table { font-size: .84rem; } .list th, .list td { padding: .45rem .5rem; }
}
.scroll.x { max-height: none; overflow-y: visible; }
/* phones: list rows become small cards, words on the left and figures on the right; the data explorer keeps a real table */
@media (max-width: 600px) {
  .list:not(#dx-rows) table, .list:not(#dx-rows) tbody { display: block; }
  .list:not(#dx-rows) thead { display: none; }
  .list:not(#dx-rows) tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: dense; gap: 3px 12px; padding: 11px 4px; border-bottom: 1px solid var(--grid); }
  .list:not(#dx-rows) td { display: block; border: 0; padding: 0; min-width: 0; }
  .list:not(#dx-rows) td:not(.num) { grid-column: 1; }
  .list:not(#dx-rows) td.num { grid-column: 2; text-align: right; }
  .list:not(#dx-rows) td.nowrap { font: 500 .74rem var(--mono); color: var(--muted); }
  .flow.mini { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .flow.mini li > span { padding: 7px 6px; } .flow.mini b { font-size: .9rem; } .flow.mini small { font-size: .64rem; margin: 0; }
}

/* ---------------------------------------------------------------- who this is: the identity intro with its first-visit veil (as on the chat page) */
/* who the visitor is talking to: the bot's identity leads the page */
.bot-kicker { font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); margin: 0 0 12px !important; }
.bot-id { display: flex; align-items: center; gap: 16px; }
.bot-id h1 { margin: 0; line-height: 1.1; }
.bot-avatar { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.bot-avatar svg { width: 30px; height: 30px; }
.bot-avatar.sm { width: 28px; height: 28px; box-shadow: none; }
.bot-avatar.sm svg { width: 15px; height: 15px; }
.sr-intro .bot-role { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: .98rem; color: var(--muted); }
.bot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.sr-intro .bot-you { margin-top: 16px; }
@media (max-width: 600px) {
  .bot-avatar { width: 48px; height: 48px; } .bot-avatar svg { width: 24px; height: 24px; }
  .bot-id { gap: 12px; }
  .sr-intro .bot-role { font-size: .9rem; }
  .sr-intro .bot-you { margin-top: 12px; }
}
.card-head .restart { min-height: 0; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: none; border: 1px solid var(--axis); color: var(--ink2); }
.card-head .restart:hover { background: var(--hover); }
.card-head .restart svg { width: 17px; height: 17px; }

/* first visit in a tab session: one blurred veil covers the page and the bot's introduction sits above it (intro.js).
   Nothing moves: the layout is the same before and after, the button floats, and the reveal fades the single veil out. */
.bot-intro { position: relative; }
.intro-go { display: none; }
html.intro-on .intro-go:not([hidden]), html.intro-reveal .intro-go { display: inline-flex; }
.intro-go { position: absolute; left: 0; top: calc(100% + 18px); align-items: center; gap: 10px; min-height: 50px; padding: 0 22px 0 24px; border-radius: 999px;
  font-size: 1rem; white-space: nowrap; background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent);
  box-shadow: 0 10px 28px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.intro-go svg { width: 18px; height: 18px; transition: transform var(--dur) var(--ease); }
.intro-go:hover svg { transform: translateX(3px); }
@media (hover: hover) and (pointer: fine) { html { scrollbar-gutter: stable; } }   /* desktop: the page does not shift sideways when scrolling comes back */
html.intro-on, html.intro-on body { overflow: hidden; }
html.intro-on body::before, html.intro-reveal body::before { content: ""; position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background: color-mix(in srgb, var(--page) 62%, transparent); -webkit-backdrop-filter: blur(12px) saturate(.7); backdrop-filter: blur(12px) saturate(.7); }
html.intro-on .bot-intro, html.intro-reveal .bot-intro { z-index: 1001; }
html.intro-on .bot-kicker { opacity: .35; }
html.intro-reveal body::before { opacity: 0; -webkit-backdrop-filter: blur(0) saturate(1); backdrop-filter: blur(0) saturate(1);
  transition: opacity 1s cubic-bezier(.37, 0, .63, 1), backdrop-filter 1s cubic-bezier(.37, 0, .63, 1), -webkit-backdrop-filter 1s cubic-bezier(.37, 0, .63, 1); }
html.intro-reveal .bot-kicker { opacity: 1; transition: opacity 1s cubic-bezier(.37, 0, .63, 1); }
html.intro-reveal .intro-go { opacity: 0; transform: translateY(6px) scale(.96); pointer-events: none; transition: opacity .35s ease, transform .35s ease; }
@media (max-width: 600px) { .intro-go { right: 0; justify-content: center; } }

/* A table wider than a phone scrolls sideways: a soft shadow at the edge says there is more. */
.scroll.x { background: linear-gradient(to left, var(--surface) 30%, transparent) right center / 36px 100% no-repeat local,
  radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .16), transparent) right center / 12px 100% no-repeat scroll; }
@media (max-width: 600px) { .scroll table { font-size: .82rem; } .scroll th, .scroll td { padding-left: 7px; padding-right: 7px; } }
