/* ===================================================================
   VegaResiduals Ã¢â‚¬â€ product UI on the Intellivega design system (light).
   Consumes tokens from iv-tokens.css. Light is the default theme.
   =================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--iv-page-bg);
  color: var(--iv-fg-1);
  font-family: var(--iv-font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 14px;
}
:root {
  --vr-radius: 12px;
  --vr-row-h: 52px;          /* comfortable density (tweakable) */
  --vr-cell-py: 14px;
  --vr-accent: var(--iv-green-500);
  --vr-accent-weak: rgba(0,178,92,0.10);
  --vr-sidebar-w: 252px;
}
#root { height: 100vh; display: grid; grid-template-columns: var(--vr-sidebar-w) 1fr; overflow: hidden; }
.mono { font-family: var(--iv-font-mono); font-variant-numeric: tabular-nums; }
.num  { font-family: var(--iv-font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
button { font-family: inherit; }
::selection { background: rgba(0,178,92,.18); }

/* scrollbars */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(21,20,31,.16); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: rgba(21,20,31,.28); background-clip: content-box; }

/* =============================== SIDEBAR =============================== */
.vr-side { background: var(--iv-surface-sidebar); border-right: 1px solid var(--iv-line-1);
  display: flex; flex-direction: column; min-height: 0; }
.vr-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.vr-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--iv-grad-green); box-shadow: 0 4px 12px rgba(0,178,92,.28); flex: none; position: relative; }
.vr-mark svg { width: 19px; height: 19px; color: #fff; }
.vr-brand .wm { display: flex; flex-direction: column; line-height: 1.05; }
.vr-brand .wm b { font-family: var(--iv-font-display); font-weight: 800; font-size: 16px; letter-spacing: -.02em; color: var(--iv-fg-1); }
.vr-brand .wm span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--iv-fg-3); font-weight: 600; }

/* workspace switcher */
.vr-ws { margin: 2px 12px 8px; position: relative; }
.vr-ws-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); cursor: pointer; transition: all .18s; text-align: left; }
.vr-ws-btn:hover { border-color: var(--iv-line-green-hi); }
.vr-ws-logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 12px; flex: none; }
.vr-ws-meta { min-width: 0; flex: 1; }
.vr-ws-meta b { display: block; font-size: 13px; color: var(--iv-fg-1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vr-ws-meta span { font-size: 11px; color: var(--iv-fg-3); }
.vr-ws-btn .chev { color: var(--iv-fg-3); flex: none; }
.vr-ws-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--iv-surface-panel); border: 1px solid var(--iv-line-2); border-radius: 12px;
  box-shadow: var(--iv-shadow-card); padding: 6px; backdrop-filter: blur(16px); }
.vr-ws-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 8px; cursor: pointer; }
.vr-ws-item:hover { background: var(--vr-accent-weak); }
.vr-ws-item.sel { background: var(--vr-accent-weak); }
.vr-ws-item .check { margin-left: auto; color: var(--vr-accent); }
.vr-ws-sep { height: 1px; background: var(--iv-line-1); margin: 6px 4px; }
.vr-ws-add { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px; cursor: pointer; color: var(--iv-fg-3); font-weight: 500; }
.vr-ws-add:hover { background: var(--iv-bg-2); color: var(--iv-fg-1); }

.vr-nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; min-height: 0; }
.vr-nav-sec { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--iv-fg-meta);
  font-weight: 700; padding: 16px 10px 6px; }
.vr-nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px;
  color: var(--iv-fg-2); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .15s; user-select: none; position: relative; }
.vr-nav-item:hover { background: var(--iv-bg-2); color: var(--iv-fg-1); }
.vr-nav-item.active { background: var(--vr-accent-weak); color: var(--iv-green-600); font-weight: 600; }
.vr-nav-item.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--vr-accent); }
.vr-nav-item svg { width: 17px; height: 17px; flex: none; }
.vr-nav-item .badge-ct { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--iv-bg-3); color: var(--iv-fg-3); font-weight: 700; font-variant-numeric: tabular-nums; }
.vr-nav-item .badge-ct.warn { background: rgba(255,163,72,.16); color: #b5650c; }

.vr-user { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--iv-line-1); }
.vr-user .av { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px; flex: none; }
.vr-user .nm { line-height: 1.2; min-width: 0; flex: 1; }
.vr-user .nm b { display: block; font-size: 13px; font-weight: 600; }
.vr-user .nm span { font-size: 11px; color: var(--iv-fg-3); }
.vr-user .ico { color: var(--iv-fg-3); cursor: pointer; }

/* =============================== MAIN =============================== */
.vr-main { display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: radial-gradient(circle at 100% -10%, rgba(0,178,92,.05) 0%, transparent 42%), var(--iv-page-bg); }
.vr-top { display: flex; align-items: center; gap: 14px; padding: 0 28px; height: 60px; flex: none;
  border-bottom: 1px solid var(--iv-line-1); background: var(--iv-surface-nav); backdrop-filter: blur(10px); }
.vr-top .crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--iv-fg-3); }
.vr-top .crumbs .sep { color: var(--iv-fg-4); }
.vr-top h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--iv-fg-1); }
.vr-top .spacer { flex: 1; }
.vr-search { position: relative; width: 280px; }
.vr-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px;
  background: var(--iv-bg-1); border: 1px solid var(--iv-line-2); color: var(--iv-fg-1); font: 400 13px var(--iv-font-sans); outline: none; transition: all .15s; }
.vr-search input::placeholder { color: var(--iv-fg-4); }
.vr-search input:focus { border-color: var(--vr-accent); box-shadow: 0 0 0 3px var(--vr-accent-weak); }
.vr-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--iv-fg-4); width: 16px; height: 16px; }
.vr-search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 10px var(--iv-font-mono);
  color: var(--iv-fg-4); background: var(--iv-bg-3); border: 1px solid var(--iv-line-2); border-radius: 5px; padding: 2px 5px; }
.vr-icobtn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--iv-bg-1); border: 1px solid var(--iv-line-2); color: var(--iv-fg-2); cursor: pointer; transition: all .15s; position: relative; }
.vr-icobtn:hover { color: var(--iv-green-600); border-color: var(--iv-line-green-hi); }
.vr-icobtn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 999px; background: var(--iv-pink-600); border: 1.5px solid var(--iv-bg-1); }

.vr-content { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; padding: 26px 28px 60px; }
.vr-page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.vr-page-head .ph-l { min-width: 0; }
.vr-page-head h2 { margin: 0 0 5px; font-family: var(--iv-font-display); font-size: 26px; font-weight: 800; letter-spacing: -.025em; color: var(--iv-fg-1); }
.vr-page-head p { margin: 0; font-size: 13.5px; color: var(--iv-fg-3); }
.vr-page-head .ph-actions { margin-left: auto; display: flex; gap: 10px; flex: none; }

/* =============================== BUTTONS =============================== */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px;
  font: 600 13px var(--iv-font-sans); border: 1px solid transparent; cursor: pointer; transition: all .16s var(--iv-ease); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--iv-grad-green); color: #fff; box-shadow: 0 2px 10px rgba(0,178,92,.28); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(0,178,92,.36); transform: translateY(-1px); }
.btn-ghost { background: var(--iv-bg-1); color: var(--iv-fg-2); border-color: var(--iv-line-2); }
.btn-ghost:hover { border-color: var(--iv-line-green-hi); color: var(--iv-fg-1); transform: translateY(-1px); }
.btn-soft { background: var(--vr-accent-weak); color: var(--iv-green-600); }
.btn-soft:hover { background: rgba(0,178,92,.16); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-danger { background: var(--iv-bg-1); color: var(--iv-pink-600); border-color: rgba(195,51,130,.30); }
.btn-danger:hover { background: rgba(195,51,130,.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* =============================== CARDS =============================== */
.card { background: var(--iv-bg-1); border: 1px solid var(--iv-line-2); border-radius: var(--vr-radius); box-shadow: var(--iv-shadow-card); min-width: 0; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--iv-line-1); }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; color: var(--iv-fg-1); }
.card-head .sub { font-size: 12px; color: var(--iv-fg-3); }
.card-head .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--iv-bg-1); border: 1px solid var(--iv-line-2); border-radius: var(--vr-radius); min-width: 0;
  padding: 16px 18px 17px; position: relative; overflow: hidden; box-shadow: var(--iv-shadow-card); transition: all .2s var(--iv-ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--iv-shadow-card-hover); }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--iv-grad-green); opacity: .9; }
.kpi.alt::before { background: var(--iv-grad-pink); }
.kpi .lbl { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--iv-fg-meta); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.kpi .lbl svg { width: 13px; height: 13px; color: var(--iv-fg-4); }
.kpi .val { font-family: var(--iv-font-display); font-weight: 800; font-size: 28px; letter-spacing: -.025em; line-height: 1; margin-top: 9px; color: var(--iv-fg-1); }
.kpi .val small { font-size: 16px; color: var(--iv-fg-3); font-weight: 700; }
.kpi .delta { font-size: 11.5px; font-family: var(--iv-font-mono); margin-top: 9px; display: flex; align-items: center; gap: 5px; color: var(--iv-fg-3); }
.kpi .delta b { font-weight: 600; }
.kpi .delta.up b { color: var(--iv-green-600); }
.kpi .delta.dn b { color: var(--iv-danger); }

/* =============================== BADGES =============================== */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .01em;
  padding: 3px 9px 3px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.badge .pip { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: none; }
.badge svg { width: 12px; height: 12px; }
.badge-ok    { color: #0a7a44; background: rgba(0,178,92,.12);  border-color: rgba(0,178,92,.28); }
.badge-warn  { color: #b5650c; background: rgba(255,163,72,.14); border-color: rgba(255,163,72,.34); }
.badge-error { color: #b3261e; background: rgba(246,97,81,.13);  border-color: rgba(246,97,81,.32); }
.badge-info  { color: #1f5fa8; background: rgba(99,150,200,.16); border-color: rgba(99,150,200,.36); }
.badge-neutral { color: var(--iv-fg-3); background: var(--iv-bg-3); border-color: var(--iv-line-2); }
.badge-pink  { color: #a72a6e; background: rgba(195,51,130,.10); border-color: rgba(195,51,130,.28); }

/* =============================== TABLE =============================== */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--iv-fg-meta); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--iv-line-2);
  background: var(--iv-bg-1); position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.tbl thead th.num { text-align: right; }
table.tbl tbody td { padding: var(--vr-cell-py) 14px; border-bottom: 1px solid var(--iv-line-1); color: var(--iv-fg-2); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--vr-accent-weak); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody td.num { text-align: right; font-family: var(--iv-font-mono); font-variant-numeric: tabular-nums; color: var(--iv-fg-1); white-space: nowrap; }
table.tbl tbody td .merch { font-weight: 600; color: var(--iv-fg-1); }
table.tbl tbody td .sub2 { font-size: 11.5px; color: var(--iv-fg-4); }
table.tbl tfoot td { padding: 13px 14px; border-top: 2px solid var(--iv-line-2); font-weight: 700; color: var(--iv-fg-1); }
table.tbl tfoot td.num { text-align: right; font-family: var(--iv-font-mono); }
.neg { color: var(--iv-danger) !important; }
.cell-flex { display: flex; align-items: center; gap: 10px; }

/* mid pill / processor chip */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); color: var(--iv-fg-2); white-space: nowrap; }
.chip .dotc { width: 7px; height: 7px; border-radius: 999px; flex: none; }

/* small avatar */
.av-sm { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 10px; flex: none; border: 1.5px solid var(--iv-bg-1); }
.av-stack { display: flex; } .av-stack .av-sm + .av-sm { margin-left: -7px; }

/* =============================== FORMS =============================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--iv-fg-2); }
.field .hint { font-size: 11.5px; color: var(--iv-fg-4); }
.input, .select { height: 38px; padding: 0 12px; border-radius: 9px; background: var(--iv-bg-1); border: 1px solid var(--iv-line-2);
  color: var(--iv-fg-1); font: 400 13px var(--iv-font-sans); outline: none; transition: all .15s; width: 100%; }
.input:focus, .select:focus { border-color: var(--vr-accent); box-shadow: 0 0 0 3px var(--vr-accent-weak); }
select.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.input.mono { font-family: var(--iv-font-mono); }

/* segmented toggle */
.seg { display: inline-flex; background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; color: var(--iv-fg-3); font: 600 12.5px var(--iv-font-sans); padding: 7px 14px; border-radius: 7px; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 7px; }
.seg button svg { width: 15px; height: 15px; }
.seg button.on { background: var(--iv-bg-1); color: var(--iv-green-600); box-shadow: var(--iv-shadow-1); }

/* =============================== DASHBOARD chart =============================== */
.chart-wrap { padding: 8px 8px 4px; }
.legend { display: flex; gap: 16px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--iv-fg-3); font-weight: 500; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* recent imports list */
.imp-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 13px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--iv-line-1); }
.imp-row:last-child { border-bottom: 0; }
.imp-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--iv-bg-2); color: var(--iv-fg-3); }
.imp-row .nm { font-weight: 600; font-size: 13px; color: var(--iv-fg-1); }
.imp-row .mt { font-size: 11.5px; color: var(--iv-fg-4); display: flex; gap: 8px; }

/* =============================== DATA IMPORT =============================== */
.dropzone { border: 2px dashed var(--iv-line-2); border-radius: var(--vr-radius); background: var(--iv-bg-1);
  padding: 30px; text-align: center; transition: all .2s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--vr-accent); background: var(--vr-accent-weak); }
.dropzone .dz-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--vr-accent-weak); color: var(--iv-green-600); display: grid; place-items: center; margin: 0 auto 12px; }
.dropzone .dz-ico svg { width: 26px; height: 26px; }
.dropzone h4 { margin: 0 0 5px; font-size: 15px; color: var(--iv-fg-1); }
.dropzone p { margin: 0; font-size: 12.5px; color: var(--iv-fg-3); }

.profile-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 15px 16px;
  border: 1px solid var(--iv-line-2); border-radius: var(--vr-radius); background: var(--iv-bg-1); transition: all .18s; cursor: pointer; }
.profile-card:hover { border-color: var(--iv-line-green-hi); box-shadow: var(--iv-shadow-card); transform: translateY(-1px); }
.profile-card.warn { border-color: rgba(255,163,72,.45); background: linear-gradient(0deg, rgba(255,163,72,.04), rgba(255,163,72,.04)), var(--iv-bg-1); }
.profile-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.profile-card .pc-nm { font-weight: 700; font-size: 14px; color: var(--iv-fg-1); display: flex; align-items: center; gap: 8px; }
.profile-card .pc-mt { font-size: 12px; color: var(--iv-fg-3); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }

/* remap panel */
.remap { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 0 14px; align-items: center; }
.remap-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--iv-fg-meta); padding-bottom: 10px; }
.remap-col { background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); border-radius: 9px; padding: 11px 13px; margin-bottom: 9px; }
.remap-col .cc-nm { font-family: var(--iv-font-mono); font-size: 12.5px; font-weight: 600; color: var(--iv-fg-1); }
.remap-col .cc-sample { font-size: 11px; color: var(--iv-fg-4); margin-top: 3px; font-family: var(--iv-font-mono); }
.remap-arrow { display: grid; place-items: center; color: var(--iv-fg-4); margin-bottom: 9px; }
.remap-arrow.ok { color: var(--vr-accent); }
.remap-arrow.unmatched { color: var(--iv-warning); }
.remap-target { margin-bottom: 9px; }
.remap-target select { height: 44px; }
.remap-target select.unmatched { border-color: var(--iv-warning); background: rgba(255,163,72,.06); }
.remap-target select.matched { border-color: var(--iv-line-green-hi); }

/* shape explainer */
.shape-ex { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; }
.mini-tbl { border: 1px solid var(--iv-line-2); border-radius: 9px; overflow: hidden; font-size: 11px; }
.mini-tbl .mh { display: flex; background: var(--iv-bg-2); }
.mini-tbl .mr { display: flex; border-top: 1px solid var(--iv-line-1); }
.mini-tbl .mc { padding: 6px 9px; flex: 1; font-family: var(--iv-font-mono); color: var(--iv-fg-2); border-right: 1px solid var(--iv-line-1); white-space: nowrap; }
.mini-tbl .mh .mc { font-weight: 700; color: var(--iv-fg-meta); text-transform: uppercase; letter-spacing: .04em; font-size: 9.5px; }
.mini-tbl .mc:last-child { border-right: 0; }
.shape-mid { display: grid; place-items: center; color: var(--vr-accent); }

/* =============================== FORMULA BUILDER =============================== */
.fb-grid { display: grid; grid-template-columns: 248px 1fr 300px; gap: 16px; align-items: start; }
.fb-source { padding: 6px; }
.fb-col-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--iv-line-2);
  background: var(--iv-bg-1); margin-bottom: 7px; cursor: grab; transition: all .14s; }
.fb-col-item:hover { border-color: var(--iv-line-green-hi); box-shadow: var(--iv-shadow-1); }
.fb-col-item:active { cursor: grabbing; }
.fb-col-item .gi { color: var(--iv-fg-4); }
.fb-col-item .ci-nm { font-family: var(--iv-font-mono); font-size: 12.5px; font-weight: 600; color: var(--iv-fg-1); }
.fb-col-item .ci-ty { margin-left: auto; font-size: 10px; color: var(--iv-fg-4); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.fb-col-item.derived { background: var(--vr-accent-weak); border-color: var(--iv-line-green); }
.fb-col-item.derived .ci-nm { color: var(--iv-green-600); }

.fb-target-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.fb-tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--iv-line-2); background: var(--iv-bg-1);
  font-size: 12.5px; font-weight: 600; color: var(--iv-fg-3); cursor: pointer; transition: all .15s; display: flex; align-items: center; gap: 7px; }
.fb-tab:hover { border-color: var(--iv-line-green-hi); color: var(--iv-fg-1); }
.fb-tab.on { background: var(--iv-fg-1); color: var(--iv-bg-1); border-color: var(--iv-fg-1); }
.fb-tab .t-ty { font-size: 10px; opacity: .6; font-family: var(--iv-font-mono); }

.fb-canvas { min-height: 260px; border: 1.5px dashed var(--iv-line-2); border-radius: var(--vr-radius); background:
  repeating-linear-gradient(0deg, transparent, transparent 27px, var(--iv-line-1) 27px, var(--iv-line-1) 28px), var(--iv-bg-1);
  padding: 18px; position: relative; transition: all .18s; }
.fb-canvas.drag { border-color: var(--vr-accent); background: var(--vr-accent-weak); }
.fb-expr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-token { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: 9px; font-size: 13px; font-weight: 600;
  font-family: var(--iv-font-mono); border: 1px solid transparent; }
.fb-token.col   { background: #fff; border-color: var(--iv-line-2); color: var(--iv-fg-1); box-shadow: var(--iv-shadow-1); }
.fb-token.derived { background: var(--vr-accent-weak); border-color: var(--iv-line-green); color: var(--iv-green-600); }
.fb-token.op    { background: transparent; color: var(--iv-fg-3); font-size: 15px; padding: 9px 4px; }
.fb-token.const { background: rgba(99,150,200,.12); border-color: rgba(99,150,200,.3); color: #1f5fa8; }
.fb-token .x { color: var(--iv-fg-4); cursor: pointer; display: grid; place-items: center; }
.fb-token .x:hover { color: var(--iv-danger); }
.fb-altline { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--iv-line-2); }
.fb-altline .or { font-size: 10px; font-weight: 800; letter-spacing: .1em; color: var(--iv-fg-4); padding: 3px 8px; border: 1px solid var(--iv-line-2); border-radius: 999px; }

.fb-preview .pv-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--iv-line-1); font-size: 12.5px; }
.fb-preview .pv-row .k { color: var(--iv-fg-3); }
.fb-preview .pv-row .v { font-family: var(--iv-font-mono); font-weight: 600; color: var(--iv-fg-1); }
.fb-preview .pv-row.total .v { color: var(--iv-green-600); }

/* =============================== DRAWER (generic) =============================== */
.dw-bd { position: fixed; inset: 0; background: rgba(21,20,31,.28); backdrop-filter: blur(2px); z-index: 800; opacity: 0; pointer-events: none; transition: opacity .25s; }
.dw-bd.open { opacity: 1; pointer-events: auto; }
.dw { position: fixed; top: 0; right: 0; height: 100%; width: 520px; max-width: 96vw; background: var(--iv-bg-1);
  border-left: 1px solid var(--iv-line-2); z-index: 900; transform: translateX(100%); transition: transform .34s var(--iv-ease);
  display: flex; flex-direction: column; box-shadow: var(--iv-shadow-drawer); }
.dw.open { transform: translateX(0); }
.dw .dw-h { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--iv-line-1); }
.dw .dw-h .x { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--iv-line-2); background: var(--iv-bg-1); color: var(--iv-fg-3); cursor: pointer; display: grid; place-items: center; flex: none; }
.dw .dw-h .x:hover { color: var(--iv-fg-1); }
.dw .dw-b { padding: 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 20px; min-height: 0; }
.dw .dw-f { padding: 16px 22px; border-top: 1px solid var(--iv-line-1); display: flex; gap: 10px; }

/* section label */
.sec-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--iv-fg-meta); font-weight: 700; margin-bottom: 12px; }

/* key-value meta grid */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 11px 16px; font-size: 13px; align-items: center; }
.kv .k { color: var(--iv-fg-3); font-weight: 500; }
.kv .v { color: var(--iv-fg-1); font-weight: 600; }

/* plan card */
.plan-card { border: 1px solid var(--iv-line-2); border-radius: 11px; padding: 14px 15px; background: var(--iv-bg-1); }
.plan-card + .plan-card { margin-top: 10px; }
.plan-card .pl-h { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.plan-card .pl-h b { font-size: 13.5px; color: var(--iv-fg-1); }
.plan-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plan-stat { background: var(--iv-bg-2); border-radius: 8px; padding: 9px 11px; }
.plan-stat .ps-l { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--iv-fg-meta); font-weight: 700; }
.plan-stat .ps-v { font-family: var(--iv-font-mono); font-size: 17px; font-weight: 700; color: var(--iv-fg-1); margin-top: 3px; }
.plan-stat .ps-v small { font-size: 11px; color: var(--iv-fg-3); }

/* split / waterfall (mid assignment live calc) */
.split-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--iv-line-2); margin-bottom: 8px; background: var(--iv-bg-1); }
.split-row.lead { border-color: var(--iv-line-green); background: var(--vr-accent-weak); }
.split-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.split-meta .nm { font-weight: 600; font-size: 13px; color: var(--iv-fg-1); }
.split-meta .pl { font-size: 11.5px; color: var(--iv-fg-3); }
.split-amt { text-align: right; }
.split-amt .a { font-family: var(--iv-font-mono); font-weight: 700; font-size: 14px; color: var(--iv-fg-1); }
.split-amt .p { font-size: 11px; color: var(--iv-fg-3); font-family: var(--iv-font-mono); }
.calc-bar { height: 8px; border-radius: 999px; background: var(--iv-bg-3); overflow: hidden; display: flex; }
.calc-bar i { height: 100%; display: block; }

/* waterfall preview */
.flowbox { background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); border-radius: 11px; padding: 15px; }
.flow-step { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 13px; }
.flow-step .fl-k { color: var(--iv-fg-2); display: flex; align-items: center; gap: 8px; }
.flow-step .fl-v { font-family: var(--iv-font-mono); font-weight: 600; color: var(--iv-fg-1); }
.flow-step.minus .fl-v { color: var(--iv-danger); }
.flow-step.total { border-top: 1px solid var(--iv-line-2); margin-top: 4px; padding-top: 11px; font-weight: 700; }
.flow-step.total .fl-v { color: var(--iv-green-600); font-size: 15px; }

/* empty state */
.empty { text-align: center; padding: 50px 20px; color: var(--iv-fg-3); }
.empty .ei { width: 56px; height: 56px; border-radius: 16px; background: var(--iv-bg-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--iv-fg-4); }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 1500;
  background: var(--iv-fg-1); color: var(--iv-bg-1); padding: 12px 18px; border-radius: 11px; font-size: 13px; font-weight: 600;
  box-shadow: var(--iv-shadow-3); display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none; transition: all .28s var(--iv-ease); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 17px; height: 17px; color: var(--iv-green-300); }

/* misc utility */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.gap-sm { gap: 8px; } .gap-lg { gap: 20px; }
.grow { flex: 1; }
.muted { color: var(--iv-fg-3); }
.divider { height: 1px; background: var(--iv-line-1); margin: 4px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.pill-tab { display: inline-flex; gap: 4px; background: var(--iv-bg-2); border: 1px solid var(--iv-line-2); padding: 3px; border-radius: 10px; }
.pill-tab button { border: 0; background: transparent; padding: 6px 13px; border-radius: 7px; font: 600 12.5px var(--iv-font-sans); color: var(--iv-fg-3); cursor: pointer; }
.pill-tab button.on { background: var(--iv-bg-1); color: var(--iv-fg-1); box-shadow: var(--iv-shadow-1); }
.btn.on { border-color: var(--iv-line-green-hi); background: var(--vr-accent-weak); color: var(--iv-green-600); }

/* fade-in for screen transitions Ã¢â‚¬â€ base state is fully visible so a paused
   animation (offscreen iframe) can never hide content; we only animate transform */
@keyframes vrFade { from { transform: translateY(7px); } to { transform: none; } }
@media (prefers-reduced-motion: no-preference){ .vr-screen { animation: vrFade .28s var(--iv-ease); } }

@media (max-width: 1180px){ .kpi-grid { grid-template-columns: repeat(3,1fr);} .fb-grid{ grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- print
   Agent Report statements: hide the app chrome + controls, unclamp the
   scroll containers, and show the .print-only statement header. */
.print-only { display: none !important; }

@media print {
  .print-only { display: revert !important; }

  .vr-side, .vr-top, .toast, #blazor-error-ui,
  .btn, .vr-search, .x-mini, .pill-tab,
  .vr-screen select.select { display: none !important; }

  /* Statement pages carry their own .print-head; drop the app page header. */
  .vr-screen:has(.print-statement) .vr-page-head { display: none !important; }
  .print-statement { width: 100%; }

  html, body { background: #fff !important; }
  #root { display: block; height: auto; overflow: visible; }
  .vr-main { display: block; }
  .vr-content, .scroll { overflow: visible !important; height: auto !important; }
  .vr-content { padding: 0 !important; }
  .vr-screen { padding: 0 !important; max-width: none !important; animation: none !important; }

  .card, .kpi { box-shadow: none !important; border: 1px solid #d5d9d6 !important; break-inside: avoid; }
  .tbl-wrap { overflow: visible !important; }
  .tbl th { background: #fff !important; }

  .print-head { display: block !important; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid #10231a; }
  .print-head .ph-org { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: #3f5148; }
  .print-head .ph-title { font-family: var(--iv-font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 3px 0 6px; color: #10231a; }
  .print-head .ph-meta { font-size: 12px; color: #55665d; }
}
