/* WONS BI components. Tokens only; both themes come from tokens.css. */

/* ---------- icons and logo ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.25em; height: 1.25em; flex: none; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1rem; letter-spacing: 0.06em; text-decoration: none; color: inherit; line-height: 1; }
.logo-mark { width: 26px; height: 22px; flex: none; }
.logo-word { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* an uploaded logo (bi_brand): a fixed height, the width follows. A dark-theme logo, when there is one, takes the place of the light one in the dark theme. */
.logo-img { display: block; height: 26px; width: auto; max-width: 168px; flex: none; object-fit: contain; object-position: left center; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light.has-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light.has-dark { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
/* the small credit that names who made the app: quiet text, never a banner */
.credit { color: var(--ink-2); font-size: 0.72rem; line-height: 1.4; letter-spacing: 0.01em; text-decoration: none; white-space: nowrap; }
.credit b { font-weight: 700; letter-spacing: 0.1em; color: var(--ink); }
.credit:hover b { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 38px; padding: 0 20px; border-radius: var(--r-control);
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 0.875rem; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn .i { width: 1.15em; height: 1.15em; transition: transform var(--t-base) var(--ease); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--page); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--tile-soft); }
.btn-danger { background: var(--neg); color: var(--on-neg); }
.btn-danger:hover { background: var(--neg); filter: brightness(0.92); }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 0.8125rem; }
.btn-lg { min-height: 44px; padding: 0 24px; font-size: 0.9375rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.tile-charcoal .btn:not(.btn-secondary):not(.btn-ghost):not(.btn-danger) { background: var(--accent-on-dark); color: #111111; }
.tile-charcoal .btn-secondary { color: var(--on-charcoal); border-color: var(--on-charcoal); }
.tile-charcoal .btn-secondary:hover { background: var(--on-charcoal); color: var(--charcoal); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r-control); background: var(--tile-soft); color: var(--ink); text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.icon-btn:hover { background: var(--ink); color: var(--page); }
.icon-btn-round { background: var(--charcoal-deep); color: #fff; width: 38px; height: 38px; }
.menu-btn { display: none; }
.flashes { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.logo-link { display: inline-flex; text-decoration: none; color: inherit; }
.icon-btn-round:hover { background: var(--charcoal); color: #fff; }
.link-arrow { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 600; text-decoration: none; }
.link-arrow .i { width: 1.1em; height: 1.1em; transition: transform var(--t-base) var(--ease); }
.link-arrow:hover .i { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; }

/* ---------- pills, segmented control, chips ---------- */
.pill-nav { display: flex; align-items: center; gap: var(--s-1); }
.pill-nav a { padding: 6px 14px; border: 1px solid transparent; border-radius: var(--r-control); text-decoration: none; transition: border-color var(--t-fast) var(--ease); }
.pill-nav a:hover { border-color: var(--line-strong); }
.pill-nav a[aria-current="true"] { border-color: var(--ink); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-control); background: var(--tile-soft); }
.seg label { position: relative; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span, .seg .seg-btn { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 32px; padding: 0 14px; border-radius: var(--r-control); color: var(--ink-2); font-size: 0.9375rem; font-weight: 500; cursor: pointer; border: 0; background: transparent; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg span:hover, .seg .seg-btn:hover { color: var(--ink); }
.seg input:checked + span, .seg .seg-btn[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-text) 28%, transparent); }
.seg input:disabled + span { opacity: 0.4; cursor: not-allowed; }
.seg .i { width: 1.1em; height: 1.1em; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: var(--r-chip); background: var(--tile-soft); color: var(--ink-2); font-size: 0.8125rem; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 24px; padding: 0 10px; border-radius: var(--r-chip); background: var(--tile-soft); color: var(--ink); font-size: 0.8125rem; font-weight: 600; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); }
.pill.yes::before { background: var(--pos); }
.pill.no::before { background: var(--neg); }
.hint { font-size: 0.8125rem; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.tile-charcoal .muted, .tile-charcoal .hint { color: var(--on-charcoal-2); }

/* ---------- surfaces ---------- */
.stage { position: relative; background: var(--stage); border-radius: var(--r-tile); padding: var(--stage-pad); }
.tile { background: var(--tile); border-radius: var(--r-tile); padding: 22px; min-width: 0; }
.tile-soft { background: var(--tile-soft); }
.tile-charcoal { background: var(--charcoal); color: var(--on-charcoal); }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.tile-head h2, .tile-head h3 { font-size: 1rem; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.tile-head h2 a, .tile-head h3 a { text-decoration: none; }
.tile-head h2 a:hover, .tile-head h3 a:hover { text-decoration: underline; }
.tile-sub { font-size: 0.8125rem; color: var(--ink-2); margin-top: 2px; }
.floating { box-shadow: var(--shadow-float); }

/* ---------- forms ---------- */
.field { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); min-width: 0; }
.field > label, .lbl { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.label-text { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: var(--s-2); }
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%; min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--r-input);
  background: var(--tile-soft); color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.stage > .field input, .stage > form > .field input { background: var(--tile); }
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 0.75; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer; background-image: var(--chevron); background-position: right 12px center; background-size: 16px 16px; background-repeat: no-repeat; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
.field-error input, .field-error select { border-color: var(--neg); }
.err { color: var(--neg); font-size: 0.875rem; margin-top: 2px; }
.err-box { background: var(--neg-soft); color: var(--neg); padding: var(--s-4) var(--s-5); border-radius: var(--r-inner); margin-bottom: var(--s-5); font-size: 0.9375rem; }
.notice { display: inline-flex; align-items: center; gap: var(--s-2); padding: 9px 14px; border-radius: var(--r-control); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 0.875rem; }
.check { display: flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; font-weight: 500; }
input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 1px 0 0; border-radius: 8px; background: var(--tile-soft); border: 1.5px solid var(--line-strong); display: inline-grid; place-content: center; cursor: pointer; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
input[type="checkbox"]::after { content: ""; width: 6px; height: 11px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform var(--t-fast) var(--ease); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
input[type="radio"] { accent-color: var(--accent); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s-4); align-items: start; }
.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reqs { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: 6px; color: var(--ink-2); font-size: 0.875rem; }
.reqs li { display: flex; gap: var(--s-2); align-items: center; }
.reqs svg { flex: none; color: var(--pos); }

/* ---------- lists ---------- */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: var(--s-4); padding: 11px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; min-width: 0; }
.rows > .row:first-child, .rows > [hidden] + .row:first-child { border-top: 0; }
a.row { transition: opacity var(--t-fast) var(--ease); }
a.row:hover .row-title { text-decoration: underline; text-underline-offset: 0.2em; }
.row-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-control); background: var(--tile-soft); flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 0.8125rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { flex: none; display: flex; align-items: center; gap: var(--s-2); color: var(--ink-2); }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-width: 100%; max-height: 62vh; border-radius: var(--r-inner); }
table { width: 100%; font-size: 0.875rem; }
th { position: sticky; top: 0; z-index: 1; padding: 10px 14px; text-align: left; font-size: 0.75rem; font-weight: 500; color: var(--ink-2); background: var(--tile); white-space: nowrap; }
th small { display: block; font-size: 0.6875rem; font-weight: 400; opacity: 0.85; }
td { height: 44px; padding: 0 14px; border-top: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
td:first-child { font-weight: 600; }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover td { background: var(--tile-soft); }
td.num, th.num { text-align: right; }
th[draggable="true"] { cursor: grab; }
th.dragging { opacity: 0.5; }
th.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
th.drop-after { box-shadow: inset -2px 0 0 var(--accent); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding-top: var(--s-4); color: var(--ink-2); font-size: 0.875rem; }

/* ---------- states, loading, empty ---------- */
.state { display: grid; place-items: center; align-content: center; gap: var(--s-3); text-align: center; min-height: 180px; padding: var(--s-5); color: var(--ink-2); }
.state.error { color: var(--neg); }
.stat { display: grid; place-items: center; align-content: center; gap: var(--s-2); min-height: 160px; }
.stat strong { font-size: var(--fs-stat); font-weight: 500; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }
.stat span { color: var(--ink-2); font-size: 0.9375rem; text-transform: capitalize; }
.skeleton { min-height: 180px; border-radius: var(--r-inner); background: linear-gradient(100deg, var(--tile-soft) 30%, color-mix(in srgb, var(--tile-soft) 55%, var(--tile)) 50%, var(--tile-soft) 70%); background-size: 300% 100%; animation: shimmer 1.6s var(--ease) infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s-3); padding: var(--s-7) var(--s-5); }
.empty h2, .empty h3 { font-size: 1.125rem; }
.empty p { color: var(--ink-2); }
.empty .actions { display: flex; gap: var(--s-3); flex-wrap: wrap; justify-content: center; margin-top: var(--s-2); }
.chart { position: relative; width: 100%; height: 320px; min-width: 0; }

/* ---------- KPI: the number is the layout ---------- */
.kpi { position: relative; display: grid; align-content: start; gap: var(--s-2); min-width: 0; }
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2); }
.kpi-label { font-size: 0.9375rem; color: var(--ink-2); text-decoration: none; }
.kpi-label:hover { text-decoration: underline; }
.kpi-value { font-size: var(--fs-stat); font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.kpi small { font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- progress ---------- */
.progress { height: 8px; border-radius: var(--r-pill); background: color-mix(in srgb, currentColor 16%, transparent); overflow: hidden; }
.progress > div { width: 100%; height: 100%; border-radius: inherit; background: var(--accent-on-dark); transform: scaleX(0); transform-origin: left; transition: transform var(--t-slow) var(--ease); }
.steps { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-2); }
.steps li { display: flex; align-items: center; gap: var(--s-3); padding: 9px 14px; border-radius: var(--r-inner); background: color-mix(in srgb, currentColor 8%, transparent); }
.steps li .i { color: color-mix(in srgb, currentColor 40%, transparent); }
.steps li[data-done="true"] .i { color: var(--accent-on-dark); }
.steps li[data-done="true"] span { opacity: 0.7; }
.steps a { margin-left: auto; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- dialog, toast, menu, search ---------- */
dialog { border: 0; border-radius: var(--r-tile); padding: var(--s-6); background: var(--tile); color: var(--ink); box-shadow: var(--shadow-float); max-width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font-size: 1.25rem; margin-bottom: var(--s-3); }
dialog p { color: var(--ink-2); margin-bottom: var(--s-5); }
dialog form { margin: 0; }
.dialog-actions, .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.toasts { position: fixed; left: 50%; bottom: var(--s-5); transform: translateX(-50%); display: grid; gap: var(--s-2); z-index: 60; justify-items: center; }
.toast { padding: 11px 20px; border-radius: var(--r-control); background: var(--action); color: var(--action-ink); font-weight: 600; font-size: 0.9375rem; box-shadow: var(--shadow-float); animation: toast-in var(--t-base) var(--ease); }
.toast[data-kind="error"] { background: var(--neg); color: var(--on-neg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.search { position: relative; }
.search .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.search input { padding-left: 42px; border-radius: var(--r-control); background: var(--tile); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30; max-height: 60vh; overflow: auto; padding: var(--s-2); border-radius: var(--r-inner); background: var(--tile); color: var(--ink); box-shadow: var(--shadow-float); }
.search-results a { display: flex; gap: var(--s-3); align-items: center; padding: 10px 14px; border-radius: 12px; text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--tile-soft); }
.search-results small { margin-left: auto; color: var(--ink-2); }
.search-note { padding: 10px 14px; color: var(--ink-2); }

/* ---------- small form helpers ---------- */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.field-head label { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
.field-head a { font-size: 0.875rem; color: var(--ink-2); }
.btn-block { display: flex; width: 100%; }
.center-tile { display: grid; place-items: center; min-height: 56vh; padding: var(--s-6) 0; }
.confirm { position: relative; display: grid; gap: var(--s-4); justify-items: start; width: min(480px, 100%); padding: 32px; }
.confirm h1 { font-size: var(--fs-h2); }

/* segmented control inside a form field: full width, equal columns, icons drop away on small screens */
.field .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.field .seg span { justify-content: center; padding: 0 8px; white-space: nowrap; }
.field > .btn { justify-self: start; }
@media (max-width: 600px) { .field .seg .i { display: none; } }
@media (max-width: 520px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }

/* emphasis without decoration */
.hl { color: var(--accent-text); }
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }
.chart-probe { position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden; }

/* ---------- accent picker ---------- */
.limits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4) var(--s-5); }
.limit-field { margin: 0; align-content: start; }
.limit-input { display: flex; align-items: center; gap: var(--s-2); }
.limit-input input { max-width: 120px; font-variant-numeric: tabular-nums; }
.limit-unit { color: var(--ink-2); font-size: 0.8125rem; }
.limit-error { margin: 0; color: var(--neg); font-size: 0.8125rem; }
.accent-picker { border: 0; padding: 0; margin: 0 0 var(--s-5); min-width: 0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.swatch-opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-control); font-size: 0.875rem; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.swatch-opt:hover { border-color: var(--line-strong); }
.swatch-opt > input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-opt:has(> input[type="radio"]:checked) { border-color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.swatch-opt:has(> input[type="radio"]:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatch-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); }
.swatch-color { flex: none; width: 22px; min-height: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.swatch-color::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.accent-picker .hint { margin-top: var(--s-3); }
/* the theme picker: each theme shows its accent and the colours of its charts as a strip */
.theme-group { margin-top: var(--s-4); }
.theme-mood { margin: 0 0 var(--s-2); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.theme-opt { position: relative; display: grid; align-content: center; gap: 8px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--tile); font-size: 0.8125rem; cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.theme-opt:hover { border-color: var(--line-strong); }
.theme-opt > input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-opt:has(> input[type="radio"]:checked) { border-color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-text); font-weight: 600; }
.theme-opt:has(> input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-opt .swatch-color { justify-self: start; }
.theme-strip { display: block; width: 96px; height: 14px; }
.app-body .theme-opt .swatch-color:not([disabled]):not([readonly]):not([hidden]) { width: 28px; min-height: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; box-shadow: none; }
.theme-name { display: block; }
.theme-opt-default { display: flex; align-items: baseline; gap: 10px; min-height: 0; margin-bottom: var(--s-2); }
.chart-note { margin-top: var(--s-2); }
.chart.clickable svg path, .chart.clickable svg rect { cursor: pointer; }

/* number-style charts: progress toward a goal, trend against the last period, pivot table, table cell colours and mini bars */
.goal-card { display: grid; gap: 8px; align-content: center; width: 100%; padding: var(--s-4); }
.goal-value { font-size: var(--fs-stat); font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.goal-of, .goal-label, .trend-note { font-size: 0.8125rem; color: var(--ink-2); }
.goal-bar { height: 12px; border-radius: var(--r-pill); background: var(--tile-soft); overflow: hidden; }
.goal-fill { height: 100%; border-radius: inherit; background: var(--goal-color, var(--accent)); transition: width var(--t-slow) var(--ease); }
.goal-bar.over .goal-fill { background: var(--pos); }
.stat.trend { gap: 4px; }
.trend-move { font-size: 0.9375rem; font-weight: 600; }
.trend-move.good { color: var(--pos); } .trend-move.bad { color: var(--neg); } .trend-move.flat { color: var(--ink-2); }
.pivot th.total, .pivot td.total { font-weight: 600; background: var(--tile-soft); }
.pivot tr.grand td { font-weight: 600; border-top: 2px solid var(--line-strong); background: var(--tile-soft); }
.pivot td:first-child, .pivot th:first-child { position: sticky; left: 0; background: var(--tile); }
td.cell-pos { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
td.cell-neg { background: color-mix(in srgb, var(--neg) 14%, transparent); color: var(--neg); }
td.cell-warn { background: color-mix(in srgb, #d97706 16%, transparent); color: #b45309; }
td.cell-info { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); }
td a.cell-link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
td.cell-bar { background-image: linear-gradient(to right, color-mix(in srgb, var(--accent) 24%, transparent) var(--bar, 0%), transparent var(--bar, 0%)); }

/* interactive tables, pop-up menus and the row detail dialog */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
.col-menu { float: right; display: inline-grid; place-items: center; width: 22px; height: 22px; margin: -2px 0 -2px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: pointer; }
.col-menu:hover, .col-menu:focus-visible { background: var(--tile-soft); color: var(--ink); }
.col-menu .i { width: 18px; height: 18px; }
.stat.clickable { cursor: pointer; border-radius: var(--r-inner); }
.stat.clickable:hover strong { color: var(--accent-text); }
.stat.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th.sortable[aria-sort="ascending"]::after { content: " ▲"; font-size: 0.65rem; color: var(--accent-text); }
th.sortable[aria-sort="descending"]::after { content: " ▼"; font-size: 0.65rem; color: var(--accent-text); }
tbody td { cursor: pointer; }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding-top: var(--s-3); font-size: 0.8125rem; color: var(--ink-2); }
.table-foot-count { margin-right: auto; }
.app-body .table-foot select { min-height: 30px; width: auto; font-size: 0.8125rem; }
.pop-menu { position: fixed; z-index: 90; min-width: 200px; max-width: 320px; max-height: min(70vh, 460px); overflow-y: auto; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-inner); background: var(--tile); box-shadow: var(--shadow-float); }
.pop-title { padding: 6px 10px; font-size: 0.75rem; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-size: 0.8125rem; text-align: left; cursor: pointer; }
.pop-heading { padding: 8px 10px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.pop-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.drill-value { margin: 0; font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pop-item:hover, .pop-item:focus-visible { background: var(--tile-soft); }
.pop-item:disabled { opacity: 0.45; cursor: not-allowed; }
.row-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.dialog-head h2 { margin: 0; }
.row-dl { display: grid; margin: var(--s-3) 0; }
.row-dl-item { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: var(--s-3); align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.row-dl-item:first-child { border-top: 0; }
.row-dl-item dt { font-size: 0.8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.row-dl-item dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .row-dl-item { grid-template-columns: minmax(0, 1fr) auto; } .row-dl-item dt { grid-column: 1 / -1; } }
.ask-dialog { width: min(420px, calc(100vw - 32px)); }
.colour-dialog { width: min(520px, calc(100vw - 32px)); }
.colour-dialog .ask-form { gap: var(--s-2); }
.colour-dialog .palette-grid { margin-bottom: var(--s-2); }
.dialog-sub { margin: var(--s-4) 0 var(--s-2); font-size: 0.8125rem; font-weight: 600; }
.colour-slots { display: flex; flex-wrap: wrap; gap: 8px; margin: var(--s-2) 0 var(--s-3); }
.app-body input.colour-slot:not([disabled]):not([readonly]):not([hidden]) { width: 32px; min-height: 32px; height: 32px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; box-shadow: none; cursor: pointer; }
.app-body input.colour-slot[data-own="true"] { border-color: var(--ink); }
.colour-slot::-webkit-color-swatch-wrapper { padding: 0; }
.colour-slot::-webkit-color-swatch { border: 0; border-radius: 50%; }
.colour-slot::-moz-color-swatch { border: 0; border-radius: 50%; }
.ask-form { display: grid; gap: var(--s-4); }
.ask-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s-3); }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover .kpi-value { color: var(--accent-text); }
.kpi.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dash-grid[hidden] { display: none; }
.dash-tabs { display: flex; gap: 2px; flex-wrap: wrap; margin: 0 0 var(--s-4); border-bottom: 1px solid var(--line); }
.dash-tab { padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); font: inherit; font-size: 0.875rem; font-weight: 500; cursor: pointer; margin-bottom: -1px; }
.dash-tab:hover { color: var(--ink); }
.dash-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.dash-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
@media print { .dash-tabs { display: none; } }
.tab-editor [data-tab-list] { display: grid; gap: var(--s-2); }
.tab-row { display: flex; align-items: center; gap: var(--s-2); }
.tab-row input { flex: 0 1 280px; min-width: 0; }
.tab-row .icon-btn { width: 30px; height: 30px; background: transparent; color: var(--ink-2); }
.tab-row .icon-btn:disabled { opacity: 0.3; cursor: default; }
.tab-editor .dialog-actions { margin-top: var(--s-2); }
