:root {
  --bg: #f5f6f4; --panel: #ffffff; --ink: #18211d; --muted: #5d6a63; --line: #dfe4e0; --line2: #eef1ef;
  --accent: #1f5c45; --accent-2: #2f7a5d; --accent-soft: #e5efe9; --warn: #9a6200; --warn-soft: #fbf1dc;
  --bad: #a3322a; --bad-soft: #f8e4e1; --info: #2d5d86; --info-soft: #e3edf6; --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111614; --panel: #171e1b; --ink: #e4ebe7; --muted: #9aa8a0; --line: #2a3530; --line2: #1f2824;
    --accent: #5fb38e; --accent-2: #7cc6a4; --accent-soft: #1c2d25; --warn: #e2b155; --warn-soft: #30281a;
    --bad: #ec8a80; --bad-soft: #36201d; --info: #86b4dc; --info-soft: #1a2633; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.45 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* top bar */
.top { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 650; letter-spacing: .2px; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.brand svg { width: 18px; height: 18px; }
.top .spacer { flex: 1; }
.tabs { display: flex; gap: 2px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 9px 13px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 16px 20px 60px; max-width: 1800px; margin: 0 auto; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
select, input[type=text], input[type=date], input[type=number], input[type=password], input[type=search], textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--panel); min-height: 30px; }
textarea { font-family: var(--mono); font-size: 12px; width: 100%; min-height: 160px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 5px 10px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 5px 11px; cursor: pointer; min-height: 30px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 2px 8px; min-height: 24px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }

/* timeline */
.timeline { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 6px; margin-top: 10px; }
.tl-item { flex: 0 0 auto; min-width: 150px; max-width: 220px; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 7px 9px; cursor: pointer; position: relative; }
.tl-item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.tl-item.inrange { background: var(--accent-soft); }
.tl-item .t { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item .d { font-size: 11px; color: var(--muted); }
.tl-item .b { margin-top: 4px; display: flex; gap: 3px; flex-wrap: wrap; }

/* badges */
.badge { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; line-height: 16px; }
.badge.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; }
.card h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.card .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 12px; }
.panel h3 { margin: 0 0 8px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

/* tables */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); max-height: 72vh; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { padding: 5px 8px; border-bottom: 1px solid var(--line2); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-size: 11px; color: var(--muted); font-weight: 600; text-align: left; border-bottom: 1px solid var(--line); }
thead tr.groups th { top: 0; text-transform: uppercase; letter-spacing: .5px; font-size: 10.5px; color: var(--accent); border-bottom: 2px solid var(--accent); text-align: center; }
thead tr.cols th { top: 27px; }
th.sep, td.sep { border-left: 2px solid var(--line); }
tbody tr.reg { background: var(--line2); font-weight: 600; cursor: pointer; }
tbody tr.reg td:first-child::before { content: "▸ "; color: var(--muted); }
tbody tr.reg.open td:first-child::before { content: "▾ "; }
tbody tr.child td:first-child { padding-left: 24px; }
tbody tr.total td { font-weight: 650; border-top: 2px solid var(--line); background: var(--panel); position: sticky; bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
.pos { color: var(--accent); }
.neg { color: var(--bad); }
.unknown { color: var(--warn); font-style: italic; }
.amt { cursor: pointer; border-bottom: 1px dotted var(--muted); }
.mv { font-size: 12px; display: block; white-space: nowrap; }
.mv b { font-weight: 500; color: var(--muted); }
.simple td, .simple th { font-size: 12.5px; }

/* drawer + popover */
.drawer { position: fixed; top: 0; right: 0; width: min(760px, 96vw); height: 100vh; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,.12); z-index: 40; overflow: auto; padding: 16px 18px 40px; }
.drawer h2 { margin: 0 0 4px; font-size: 17px; }
.drawer .close { position: absolute; top: 12px; right: 14px; }
.drawer h3 { font-size: 13px; margin: 18px 0 6px; color: var(--accent); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 10px; font-size: 12.5px; }
.kv div:nth-child(odd) { color: var(--muted); }
.pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 10px 12px; width: 380px; font-size: 12px; }
.pop .step { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.notice { padding: 8px 11px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); margin: 8px 0; font-size: 12.5px; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--accent-soft); color: var(--accent); }

/* steps */
.stepper { display: flex; gap: 4px; margin: 8px 0 12px; flex-wrap: wrap; }
.stepper span { padding: 3px 10px; border-radius: 12px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.stepper span.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.stepper span.cur { background: var(--accent); color: #fff; border-color: var(--accent); }

/* login */
.login { max-width: 360px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px; }
.login h1 { font-size: 18px; margin: 0 0 4px; color: var(--accent); }
.login .field { margin-top: 12px; }
.login input { width: 100%; }
.err { color: var(--bad); margin-top: 10px; min-height: 18px; }

/* chart */
.chart text { font-size: 11px; fill: var(--muted); }
.chart .lbl { fill: var(--ink); }
.bar-open { fill: var(--line); }
.bar-close { fill: var(--accent); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 80; }
details > summary { cursor: pointer; color: var(--accent); }
.legs td { font-size: 12px; }
@media print {
  .top, .tabs, .controls, .timeline, .noprint, .drawer { display: none !important; }
  .tablewrap { max-height: none; overflow: visible; border: 0; }
  body { background: #fff; }
}
tbody tr.reg-lt { cursor: pointer; }
tbody tr.reg-lt td:first-child::before { content: "▸ "; color: var(--muted); }
tbody tr.reg-lt.open td:first-child::before { content: "▾ "; }
tbody tr.lt td { font-style: italic; background: var(--line2); }
tbody tr.lt td:first-child { padding-left: 24px; }
tbody tr.lt-note td { font-size: 12px; color: var(--muted); padding-left: 24px; }

/* ---------- Overview / Transactions screens ---------- */
:root { --x-orange: #eb6834; --x-dark: #0d0d10; --x-dark-ink: #f4f4f5; --x-soft: #f7f7f8; }
@media (prefers-color-scheme: dark) { :root { --x-dark: #000000; --x-soft: #1c2420; } }
.x-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 18px; }
.x-kicker { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.x-kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--x-orange); }
.x-title { font-size: clamp(34px, 5vw, 58px); line-height: 1; margin: 6px 0 8px; font-weight: 800; letter-spacing: -1.5px; }
.x-sub { font-size: clamp(17px, 2vw, 23px); font-weight: 600; letter-spacing: -.3px; }
.x-sub .muted { font-weight: 600; }
.x-right { display: flex; gap: 10px; align-items: center; }
.x-pill { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: var(--panel); font-size: 12px; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-root { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .x-root { grid-template-columns: minmax(0, 1fr); } .x-side { position: static !important; } }
.x-main { min-width: 0; }
.x-side { position: sticky; top: 112px; }
/* the side panel scrolls on its own when its content is taller than the screen (the page behind stays put) */
@media (min-width: 1101px) {
  .x-side:not(.x-side-float) { max-height: calc(100vh - 124px); overflow-y: auto; overscroll-behavior: contain; border-radius: 14px; scrollbar-width: thin; }
}
.x-side.x-side-float { overscroll-behavior: contain; scrollbar-width: thin; }
.x-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.x-card.pinned { border-color: var(--ink); }
.x-cardh { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.x-big { font-size: 42px; font-weight: 800; letter-spacing: -1px; color: var(--x-orange); line-height: 1.1; font-variant-numeric: tabular-nums; }
.x-mid { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.x-mini { margin-top: 10px; display: grid; gap: 3px; }
.x-minirow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 12.5px; }
.x-minirow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-minirow:not(:has(.sw)) { grid-template-columns: minmax(0, 1fr) auto; }
.x-minirow .sw { width: 9px; height: 9px; border-radius: 2px; }
.x-route { padding: 7px 0; border-top: 1px solid var(--line2); font-size: 12px; display: grid; gap: 2px; }
.x-chain { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.x-chain .ar { color: var(--muted); }

.x-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.x-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; cursor: pointer; position: relative; }
.x-kpi .v { font-size: 27px; font-weight: 800; letter-spacing: -.6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-kpi.long .v { font-size: 21px; letter-spacing: -.3px; white-space: normal; }
.x-kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.x-kpi .l2 { font-size: 11.5px; color: var(--muted); margin-top: 4px; opacity: .85; }
.x-kpi.dark { background: var(--x-dark); border-color: var(--x-dark); }
.x-kpi.dark .v { color: var(--x-orange); }
.x-kpi.dark .l, .x-kpi.dark .l2 { color: #c9c9cf; }
.x-hisel { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.x-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.x-sech { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 17px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 14px; }
.x-sech .n { font-size: 12px; color: var(--x-orange); font-weight: 600; }
.x-sech .muted { font-size: 12.5px; font-weight: 400; letter-spacing: 0; }
.x-band { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 26px; align-items: start; }
.x-band .x-ringw { position: sticky; top: 120px; }
@media (max-width: 760px) { .x-band { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.x-ringw { position: relative; width: 300px; height: 300px; }
.x-ring { width: 300px; height: 300px; overflow: visible; }
.x-ringc { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 90px; }
.x-ringc .t { font-size: 15px; font-weight: 700; line-height: 1.2; }
.x-ringc .v { font-size: 30px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.x-ringc .s { font-size: 11.5px; color: var(--muted); }
.x-rank { display: grid; gap: 2px; width: 100%; }
.x-rrow { display: grid; grid-template-columns: 26px minmax(0, 1.3fr) minmax(60px, 1fr) 68px; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.x-rrow .rk { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.x-rrow .nm { min-width: 0; }
.x-rrow .a { font-weight: 600; white-space: nowrap; display: flex; align-items: center; min-width: 0; }
.x-rrow .a .t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }      /* the name shortens, the "layer off" tag stays whole */
.x-rrow .a .x-laytag { flex: none; }
.x-rrow .b { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-rrow .barw { height: 9px; }
.x-rrow .bar { height: 9px; border-radius: 5px; }
.x-rrow .pc { font-weight: 700; }

.x-flowwrap { position: relative; overflow: hidden; touch-action: pan-y; border-radius: 10px; }
.x-flowwrap.zoomed { cursor: grab; touch-action: none; }
.x-flowwrap.dragging { cursor: grabbing; user-select: none; }
.x-flowwrap.dragging * { pointer-events: none; }
.x-flowstage { transform-origin: 0 0; min-width: 760px; }
.x-flow { width: 100%; height: auto; display: block; }
.x-ztools { position: absolute; top: 6px; right: 6px; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .08); cursor: default; }
.x-ztools button { border: 0; background: none; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; color: var(--ink); font-size: 16px; line-height: 1; }
.x-ztools button:hover { background: var(--line2); }
.x-zlab { font-size: 11.5px; color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.x-flowwrap:fullscreen { background: var(--panel); padding: 24px; overflow: hidden; }
.x-flowwrap:fullscreen .x-flowstage { width: 100%; }
.x-rib { opacity: .32; }
.x-lbl-top { pointer-events: none; }    /* labels above a holder never block the bands passing beneath */
.x-node rect { cursor: pointer; }
.x-lbl { font-size: 12.5px; fill: var(--ink); font-weight: 500; }
.x-lbls { font-size: 11.5px; fill: var(--muted); font-weight: 400; }
.x-tgt { font-size: 30px; font-weight: 800; fill: var(--ink); letter-spacing: -.8px; }
.x-colh { font-size: 10.5px; fill: var(--muted); letter-spacing: .8px; font-weight: 600; }
.x-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.x-legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.x-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* focus: the hovered/pinned item grows a little, everything unrelated goes pale */
/* hover / pinned focus: the item (and the parts of the charts it stands for) grow slightly and stand out;
   nothing else is dimmed */
.x-kpi, .x-rrow, .x-legend span, .x-hrow, .x-stack .segm, .x-tli { transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.x-seg, .x-node, .x-rib, .x-otb { transition: opacity .16s ease, transform .16s ease, filter .16s ease; transform-box: fill-box; transform-origin: center; }
.x-seg { cursor: pointer; }
.focusing .x-kpi.hot { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 26px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06); z-index: 1; }
.focusing .x-rrow.hot, .focusing .x-hrow.hot { transform: scale(1.015); background: var(--panel); box-shadow: 0 4px 14px rgba(0, 0, 0, .10); position: relative; z-index: 1; }
.focusing .x-legend span.hot { transform: scale(1.06); }
.focusing .x-seg.hot { transform: scale(1.05); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25)); }
.focusing .x-node.hot { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.focusing .x-rib.hot { opacity: .62; }
.focusing .x-otb.hot { transform: scaleX(1.12); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2)); }
.focusing .x-stack .segm.hot { transform: scaleY(1.3); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
@media (prefers-reduced-motion: reduce) { .x-kpi, .x-rrow, .x-hrow, .x-seg, .x-otb, .x-stack .segm { transition: none; } }
.x-kpi:hover, .x-rrow:hover { transform: scale(1.025); }

/* transactions */
.x-tl { position: relative; display: flex; gap: 4px; overflow-x: auto; padding: 4px 2px 10px; margin-bottom: 10px; outline: none; }
.x-tlline { position: absolute; left: 0; right: 0; top: 42px; height: 2px; background: var(--line); }
.x-tli { flex: 1 0 70px; max-width: 150px; border: 0; background: none; cursor: pointer; padding: 4px 2px; border-radius: 10px; position: relative; color: inherit; }
.x-tli:hover { transform: scale(1.08); background: var(--panel); box-shadow: 0 4px 14px rgba(0, 0, 0, .10); z-index: 1; }
.x-tli .d.und { font-style: italic; opacity: .8; }
.x-tli .d { font-size: 11px; color: var(--muted); height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-tli .dotw { height: 30px; display: flex; align-items: center; justify-content: center; }
.x-tli .dot { border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.x-tli .t { font-size: 11.5px; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.x-tli.sel { background: var(--panel); box-shadow: 0 0 0 1.5px var(--ink) inset; }
.x-tli.sel .t { color: var(--ink); font-weight: 600; }
.x-evh { margin-bottom: 14px; }
.x-evh h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 8px; }
.x-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: color-mix(in srgb, var(--k) 14%, transparent); color: var(--k); }
.x-kind::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--k); }
.x-stack { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 10px; margin: 6px 0; }
.x-stack .lab { font-size: 12px; color: var(--muted); }
.x-stack .track { display: flex; gap: 2px; height: 28px; }
.x-stack .segm { border-radius: 4px; min-width: 2px; cursor: pointer; }
.x-hl { display: grid; gap: 1px; }
.x-hrow { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(80px, 1.4fr) 70px 70px 84px; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.x-hrow.hd { cursor: default; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.x-hrow:not(.moved):not(.hd) { color: var(--muted); }
.x-hrow.moved .nm { font-weight: 600; }
.x-hrow .nm { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-hrow .nm i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.x-hrow .db { position: relative; height: 14px; }
.x-hrow .db .ln { position: absolute; top: 5.5px; height: 3px; border-radius: 2px; }
.x-hrow .db .d0, .x-hrow .db .d1 { position: absolute; top: 2.5px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; }
.x-hrow .db .d0 { background: #9a9890; width: 7px; height: 7px; top: 3.5px; margin-left: -3.5px; }
.x-otw { overflow-x: auto; }
.x-ot { width: 100%; min-width: 600px; display: block; }
.x-otc { cursor: pointer; }
.x-otl { font-size: 12px; fill: var(--muted); cursor: pointer; }
.x-otl.sel { fill: var(--ink); font-weight: 700; }
.x-spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 6px; }
.x-spark .col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: pointer; border-radius: 3px; }
.x-spark .col.cur { box-shadow: 0 0 0 1.5px var(--ink); }
.x-spark .b { width: 100%; border-radius: 3px 3px 0 0; }

.x-switch { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: inherit; padding: 4px 11px 4px 5px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.x-switch .knob { position: relative; width: 26px; height: 15px; border-radius: 999px; background: var(--line); transition: background .15s; }
.x-switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.x-switch.on .knob { background: var(--accent); }
.x-switch.on .knob::after { transform: translateX(11px); }

/* ---------- Ask the cap table (floating chat) ---------- */
.ai-ball { position: fixed; right: 22px; bottom: 22px; z-index: 60; width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(15, 40, 30, .28), 0 2px 6px rgba(0, 0, 0, .12); transition: transform .18s ease, box-shadow .18s ease; }
.ai-ball:hover { transform: scale(1.07); box-shadow: 0 12px 30px rgba(15, 40, 30, .34), 0 2px 6px rgba(0, 0, 0, .14); }
.ai-ball:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.ai-ball > svg { grid-area: 1 / 1; transition: opacity .15s, transform .2s; }
.ai-ball .ai-ico-x { opacity: 0; transform: rotate(-45deg); }
.ai-ball.on .ai-ico-chat { opacity: 0; transform: rotate(45deg); }
.ai-ball.on .ai-ico-x { opacity: 1; transform: none; }
.ai-panel { position: fixed; right: 22px; bottom: 92px; z-index: 60; width: min(440px, calc(100vw - 32px)); height: min(620px, calc(100vh - 130px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08); transform-origin: bottom right; animation: ai-pop .18s ease-out; }
.ai-panel[hidden] { display: none; }
@keyframes ai-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.ai-title { font-weight: 700; font-size: 15px; }
.ai-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ai-lock { color: var(--accent); font-size: 9px; vertical-align: 1px; }
.ai-x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.ai-x:hover { color: var(--ink); }
.ai-log { position: relative; flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.ai-msg.me { align-items: flex-end; }
.ai-bubble { border-radius: 14px; padding: 9px 12px; max-width: 100%; overflow-wrap: anywhere; }
.ai-msg.me .ai-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; max-width: 85%; }
.ai-msg.bot .ai-bubble { background: var(--line2); border-bottom-left-radius: 4px; }
.ai-bubble p { margin: 0 0 6px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul { margin: 2px 0 6px; padding-left: 18px; }
.ai-note { font-size: 11.5px; color: var(--muted); }
.ai-link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-align: left; font: inherit; }
.ai-link:hover { text-decoration: underline; }
.ai-tw { overflow-x: auto; margin: 4px 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.ai-t { border-collapse: collapse; width: 100%; font-size: 12px; }
.ai-t th, .ai-t td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--line2); vertical-align: top; }
.ai-t th { font-weight: 600; color: var(--muted); font-size: 11px; white-space: nowrap; }
.ai-t tr:last-child td { border-bottom: 0; }
.ai-t .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip { border: 1px solid var(--line); background: var(--panel); color: var(--accent); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.ai-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.ai-dots { display: inline-flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ai-blink 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ai-panel textarea.ai-in { flex: 1; width: auto; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px;
  box-sizing: border-box; font-family: var(--sans); font-size: 13px; line-height: 1.4; min-height: 38px; height: 38px; max-height: 110px; background: var(--bg); color: var(--ink); }
.ai-panel textarea.ai-in:focus { outline: none; border-color: var(--accent); }
.ai-send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.ai-send:hover { background: var(--accent-2); }
@media (max-width: 560px) {
  .ai-panel { right: 8px; left: 8px; width: auto; bottom: 84px; height: calc(100vh - 110px); }
  .ai-ball { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ai-panel, .ai-dots i { animation: none; } .ai-ball, .ai-ball > svg { transition: none; } }

/* ---------- layer switches (Overview) ---------- */
.x-layers { margin: 0 0 18px; padding: 12px 16px; }
.x-layh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.x-layall a { color: var(--accent); text-decoration: none; }
.x-layall a:hover { text-decoration: underline; }
.x-layrow { display: flex; align-items: center; gap: 6px; margin: 4px 0; padding-left: calc(var(--d, 0) * 22px); }
.x-laysep { display: none; color: var(--muted); font-size: 12px; }
.x-laysentinel { height: 1px; }
.x-layers { position: sticky; z-index: 15; transition: box-shadow .15s ease; }
.x-layers.stuck { padding: 8px 14px; box-shadow: 0 8px 22px rgba(0, 0, 0, .10); }
.x-layers.stuck .x-layh { margin-bottom: 4px; }
.x-layers.stuck .x-layrows { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.x-layers.stuck .x-layrow { margin: 0; padding-left: 0; gap: 4px; }
.x-layers.stuck .x-laycon { display: none; }
.x-layers.stuck .x-laysep { display: inline; }
.x-layers.stuck .x-lay .bh { display: none; }
.x-laycon { color: var(--muted); font-size: 12px; }
.x-lay { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px 3px 4px;
  background: var(--panel); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.x-lay:hover:not(.dis) { transform: scale(1.04); box-shadow: 0 3px 10px rgba(0, 0, 0, .08); }
.x-lay .knob { position: relative; width: 24px; height: 14px; border-radius: 999px; background: var(--line); transition: background .15s; flex: none; }
.x-lay .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.x-lay.on .knob { background: var(--accent); }
.x-lay.on .knob::after { transform: translateX(10px); }
.x-lay .pc { color: var(--muted); font-variant-numeric: tabular-nums; }
.x-lay .bh { color: var(--muted); font-size: 11px; }
.x-lay.dis { border-style: dashed; color: var(--muted); cursor: not-allowed; }
.x-lay.dis .knob { background: var(--line2); }
.x-laytag { font-size: 10.5px; font-weight: 500; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }

/* ---------- pinned (clicked) holder: outlined so it stands out ---------- */
.x-rib-pin { fill-opacity: 1; stroke: none; pointer-events: none; }   /* same solid colour as its bar: one shape */
.x-rib-edge { stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.pinned .x-seg.hot { stroke-width: 2px; stroke-linejoin: round; }

/* ---------- company logo next to the name ---------- */
.x-titlerow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 8px; }
.x-titlerow .x-title { margin: 0; }
.x-logo { display: inline-flex; align-items: center; height: 54px; padding: 10px 16px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, .05); box-sizing: border-box; }
.x-logo img { height: 100%; width: auto; max-width: 240px; object-fit: contain; display: block; }

/* ---------- select multiple ---------- */
.x-picks { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.x-pick .sw { width: 10px; height: 10px; border-radius: 2px; }
.x-pick { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 22px; gap: 8px; align-items: center; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.x-pick .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-unpick { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; border-radius: 6px; }
.x-unpick:hover { background: var(--line2); color: var(--ink); }

.x-legrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.x-legrow .x-legend { flex: 1 1 400px; }
.x-legrow .x-switch { margin-top: 8px; flex: none; }

/* selected holders' legend entries get a thin rectangular outline (space reserved, so nothing shifts) */
.x-legend span { padding: 2px 7px; border: 1.5px solid transparent; border-radius: 4px; transition: transform .16s ease, border-color .15s ease; }

/* the legend (and Select multiple) stays in view at the bottom of the screen while you move around the chart */
.x-legrow { position: sticky; bottom: 0; z-index: 6; background: var(--panel); padding: 6px 0 8px; margin-top: 4px;
  box-shadow: 0 -10px 14px -12px rgba(0, 0, 0, .18); }
.x-legrow .x-legend { margin-top: 4px; }
.x-sec:fullscreen { background: var(--panel); padding: 20px 24px; display: flex; flex-direction: column; overflow: hidden; }
.x-sec:fullscreen .x-flowwrap { flex: 1 1 auto; min-height: 0; }
.x-sec:fullscreen .x-flowstage { width: 100%; }

/* full screen: side panel floats over the chart and can be hidden */
.x-flowsec:fullscreen { position: relative; }
.x-side.x-side-float { position: absolute; top: 70px; right: 24px; width: 320px; max-height: calc(100vh - 170px); overflow: auto; z-index: 8;
  border-radius: 16px; box-shadow: 0 12px 34px rgba(0, 0, 0, .18); transition: transform .25s ease, opacity .25s ease; }
.x-side.x-side-float.hidden-float { transform: translateX(110%); opacity: 0; pointer-events: none; }
.x-sidehide { position: absolute; top: 80px; right: 36px; z-index: 9; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 8px; font-size: 12px; padding: 3px 9px; cursor: pointer; }
.x-sidehide:hover { color: var(--ink); border-color: var(--ink); }
.x-side-float .x-card { padding-top: 36px; }
.x-sidetab { position: absolute; top: 70px; right: 0; z-index: 8; border: 1px solid var(--line); border-right: 0; background: var(--panel);
  color: var(--ink); border-radius: 10px 0 0 10px; padding: 8px 12px; font-size: 12.5px; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.x-sidetab:hover { background: var(--line2); }

/* full screen with the panel open: the chart (and its legend) make room for the panel instead of sitting under it */
.x-flowsec:fullscreen .x-flowwrap, .x-flowsec:fullscreen .x-legrow { transition: margin-right .25s ease; }
.x-flowsec:fullscreen.with-float .x-flowwrap, .x-flowsec:fullscreen.with-float .x-legrow { margin-right: 344px; }
