:root { --fs-parameter-font-size: .75rem; }

.fs-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(700px, .98fr) minmax(600px, 1.12fr);
}

.operator-dashboard .fs-card-header h2 { letter-spacing: 0; }
.operator-dashboard .op-error { color: var(--pastel-coral); }
@media (max-width: 1000px) { .operator-dashboard { overflow-x: auto; } .operator-dashboard .fs-canvas { min-width: 900px; } }

.fs-toolbar[hidden],
.financial-service-dashboard[hidden],
.fs-footer[hidden] { display: none !important; }

.fs-toolbar .filter-frame { min-width: 0; flex-wrap: nowrap; }
.fs-toolbar .filter-frame:first-child { justify-content: center; }
.fs-toolbar .filter-frame:nth-child(2) { justify-content: center; gap: 20px; }
.fs-toolbar .filter-frame:last-child { justify-content: flex-start; gap: 10px; }
.fs-toolbar .filter-frame:last-child .search { min-width: 210px; flex: 1 1 250px; }

:is(#financialServiceToolbar, #operatorToolbar) { grid-template-columns: 210px minmax(700px, .98fr) minmax(600px, 1.12fr); }
.fs-period-frame .control-group { gap: 5px; flex-wrap: nowrap; }
.fs-period-frame .control-label { display: none; }
.fs-period-frame .segment button { padding-inline: 8px; }
.fs-month-label { color: var(--muted); font-size: 12px; }
.fs-month-input {
  width: 42px; height: 32px; min-width: 0; padding: 0 2px;
  text-align: center; font: inherit; font-variant-numeric: tabular-nums;
  font-size: var(--fs-parameter-font-size);
  color: var(--text); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 6px;
}
.fs-month-input::-webkit-inner-spin-button, .fs-month-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.fs-month-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fs-month-input:disabled { opacity: .55; }
.fs-pdf-button {
  position: relative; width: 40px; height: 18px; flex: 0 0 40px;
  display: inline-grid; place-items: center; padding: 0; border: 0;
  color: var(--pastel-mint); background: transparent; cursor: pointer;
}
.fs-pdf-button::after { content: ""; position: absolute; width: 40px; height: 40px; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.fs-pdf-button svg { width: 28px; height: 18px; overflow: visible; }
.fs-pdf-button rect { fill: transparent; stroke: currentColor; stroke-width: 1.2; }
.fs-pdf-button text { fill: currentColor; font: 700 10px Arial, sans-serif; }
.fs-pdf-button:hover rect { fill: color-mix(in oklch, var(--pastel-mint) 12%, transparent); }
.fs-pdf-button:active { transform: scale(.96); }
.fs-pdf-button:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; border-radius: 5px; }
.fs-pdf-button:disabled { opacity: .55; cursor: wait; }

.fs-info-button {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in oklch, var(--accent) 58%, var(--line));
  border-radius: 50%;
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  color: var(--accent-ink);
  font: 800 10px/1 Georgia, serif;
  cursor: pointer;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 120ms var(--ease-out);
}

.fs-info-button:hover,
.fs-info-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 18%, var(--panel));
}

.fs-info-button:active { transform: scale(.96); }

.financial-service-dashboard {
  --fs-row-height: 27.7px;
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 12px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  scrollbar-color: var(--line-strong) transparent;
}

.fs-canvas {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.fs-date-rail,
.fs-table {
  /* The hierarchy/parameter label column needs room for long Russian names.
     Keep month columns fluid so all eight months plus the total remain visible. */
  --fs-first-column: minmax(299px, 26%);
  --fs-period-column: minmax(0, 1fr);
  display: grid;
  grid-template-columns: var(--fs-first-column) repeat(var(--fs-value-columns, 9), var(--fs-period-column));
  width: 100%;
  min-width: 0;
}

.fs-date-rail {
  position: sticky;
  top: 0;
  z-index: 15;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-raised);
  box-shadow: 0 10px 24px color-mix(in oklch, var(--shadow) 46%, transparent);
}

.fs-date-rail > div {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 9px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 880;
  font-variant-numeric: tabular-nums;
  text-transform: capitalize;
}

.fs-date-rail > div:first-child { justify-content: flex-start; color: var(--accent-ink); }
.fs-date-rail > div:last-child {
  border-right: 0;
  background: color-mix(in oklch, var(--accent) 13%, var(--panel-raised));
  color: var(--accent-ink);
}

.fs-date-rail > .fs-month-heading {
  font-size: 13.2px;
  justify-content: center;
  padding: 4px 9px;
}
.fs-inactive-toggle { min-height: 30px; margin-inline-start: auto; font-size: 12px; }
.fs-rates-card .fs-card-header { flex-wrap: wrap; gap: 6px 16px; }

.fs-card,
.fs-state {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: color-mix(in oklch, var(--panel) 96%, transparent);
  box-shadow: 0 10px 30px color-mix(in oklch, var(--shadow) 42%, transparent);
}

.fs-reconciliation-card { border-color: color-mix(in oklch, var(--pastel-mint) 56%, var(--line-strong)); }
.fs-rates-card { border-color: color-mix(in oklch, var(--accent) 42%, var(--line-strong)); }

.fs-card-header {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
}

.fs-card-title-line { display: flex; align-items: center; gap: 6px; }
.fs-card-header h2 { margin: 0; font-size: 13px; line-height: 1.1; font-weight: 800; letter-spacing: -.01em; }
.fs-card-header p { display: none; }
.fs-card-header .fs-quality-warning {
  display: block;
  margin: 4px 0 0;
  color: var(--pastel-coral);
  font-size: 8px;
  font-weight: 720;
  line-height: 1.25;
}
.fs-card-freshness { color: var(--quiet); font-size: 9px; line-height: 1.35; white-space: nowrap; text-align: right; }

.fs-row { display: contents; }

.fs-cell {
  min-width: 0;
  min-height: var(--fs-row-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 0 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 10px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fs-cell:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  justify-content: flex-start;
  overflow: hidden;
  background: var(--panel);
}

.fs-cell:last-child {
  border-right: 0;
  background: color-mix(in oklch, var(--accent) 7%, var(--panel));
}

.fs-row:last-child .fs-cell { border-bottom: 0; }
.fs-cell.is-zero { color: var(--quiet); font-weight: 520; }
.fs-cell.is-negative { color: var(--pastel-coral); }
.fs-cell.is-positive { color: var(--pastel-mint); }
.fs-actual-toggle { margin-inline-start: auto; min-height: 22px; font-size: 12px; white-space: nowrap; }
.fs-has-accrual { gap: 3px; padding-inline-end: 3px; }
.fs-has-accrual > .fs-amount-trigger { flex: 1; width: auto; min-width: 0; margin: 0; padding-inline: 0; white-space: nowrap; }
/* Dense table rows need a dedicated hit area, not overlapping 40px targets. */
.fs-accrual-status { flex: 0 0 22px; align-self: stretch; display: grid; place-items: center; border: 0; padding: 0; margin: 0;
  background: transparent; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.fs-accrual-status > span { display: grid; place-items: center; width: 13.5px; height: 13.5px; border: 1px solid currentColor; border-radius: 3.6px; }
.fs-accrual-status svg { display: block; width: 11.7px; height: 11.7px; min-width: 0; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fs-accrual-status.is-matched { color: var(--pastel-mint); }
.fs-accrual-status.is-document-pending { color: var(--pastel-blue); }
.fs-accrual-status.is-document-confirmed { color: var(--pastel-mint); }
.fs-accrual-status.is-empty { color: #df9564; }
.fs-accrual-status.is-zero { color: var(--quiet); }
.fs-accrual-status.is-summary { cursor: default; }
.fs-accrual-status.is-summary > span { border-radius: 50%; }
.fs-accrual-status.is-summary:hover { background: transparent; }
.fs-accrual-status:disabled { cursor: default; }
.fs-breakdown-document { display: flex; align-items: center; gap: 8px; }
.fs-breakdown-document > span { flex: 1; }
.fs-breakdown-document .fs-accrual-status { min-height: 32px; }
.fs-accrual-status:not(:disabled):hover { background: color-mix(in oklch, currentColor 12%, transparent); }
.fs-row.is-extra-module > .fs-cell { border-top: 2px solid var(--line-strong); background: color-mix(in oklch, var(--accent) 5%, var(--panel)); }
.fs-check-difference { padding-block: 5px; }
.fs-accrual-status:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; border-radius: 4px; }
.fs-accrual-months { padding: 8px 20px; border-bottom: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.fs-accrual-months > div { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-block: 4px; }
.fs-accrual-months > div > span:first-child { min-width: 70px; }

.fs-amount-trigger {
  width: calc(100% + 18px);
  min-height: var(--fs-row-height);
  margin: 0 -9px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-variant-numeric: inherit;
  cursor: pointer;
  transition: background-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.fs-amount-trigger:hover { background: color-mix(in oklch, var(--accent) 10%, transparent); }
.fs-amount-trigger:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 2px var(--focus);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
}

.fs-row.is-primary > .fs-cell,
.fs-row.is-total > .fs-cell {
  background: color-mix(in oklch, var(--panel-raised) 90%, var(--accent) 3%);
  font-weight: 820;
}

.fs-row.is-primary > .fs-cell:first-child,
.fs-row.is-total > .fs-cell:first-child { background: var(--panel-raised); }
.fs-row.is-module > .fs-cell { background: color-mix(in oklch, var(--panel-raised) 56%, transparent); }
.fs-row.is-module > .fs-cell:first-child { background: color-mix(in oklch, var(--panel-raised) 72%, var(--panel)); }
.fs-row.is-entity > .fs-cell { color: color-mix(in oklch, var(--ink) 86%, var(--quiet)); font-weight: 560; }
.fs-row.is-control > .fs-cell { background: color-mix(in oklch, var(--accent) 7%, var(--panel)); }
.fs-row.is-control > .fs-cell:first-child { background: color-mix(in oklch, var(--accent) 7%, var(--panel)); }
.fs-row.is-delta > .fs-cell { min-height: calc(var(--fs-row-height) + 2px); font-weight: 800; }
.fs-row.is-rate-group > .fs-cell {
  background: color-mix(in oklch, var(--panel-raised) 82%, var(--accent) 4%);
  font-weight: 780;
}
.fs-row.is-rate-group > .fs-cell:first-child { background: var(--panel-raised); }
.fs-row.is-rate-root > .fs-cell {
  min-height: calc(var(--fs-row-height) + 2px);
  background: color-mix(in oklch, var(--accent) 8%, var(--panel-raised));
}
.fs-row.is-rate-root > .fs-cell:first-child { background: color-mix(in oklch, var(--accent) 8%, var(--panel-raised)); }
.fs-empty-cell { color: transparent; }
.fs-rate-group-summary {
  justify-content: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  color: var(--quiet);
  font-size: 8px;
  font-weight: 700;
}
.fs-rate-base-cell {
  color: color-mix(in oklch, var(--ink) 54%, var(--quiet));
  font-size: 9px;
  font-weight: 620;
}
.fs-rate-base-cell.is-zero { color: var(--quiet); font-weight: 520; }
.fs-row.is-receipt-control > .fs-cell {
  background: color-mix(in oklch, var(--panel-raised) 62%, transparent);
}
.fs-row.is-receipt-control > .fs-cell:first-child {
  background: color-mix(in oklch, var(--panel-raised) 76%, var(--panel));
}
.fs-row.is-receipt-control.is-distributed .fs-rate-base-cell:not(.is-zero) {
  color: color-mix(in oklch, var(--pastel-mint) 62%, var(--ink));
}
.fs-row.is-receipt-control.is-unallocated .fs-rate-base-cell:not(.is-zero) {
  color: color-mix(in oklch, var(--pastel-coral) 70%, var(--ink));
}

.fs-tree-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: calc(var(--fs-depth, 0) * 14px);
}

.fs-tree-label > span:not(.fs-badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fs-tree-label.is-wrapped { padding-block: 2px; }
.fs-tree-label.is-wrapped > span:not(.fs-badge) { white-space: normal; overflow-wrap: break-word; }
.fs-expand {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transform: rotate(0deg);
  transition: transform 120ms var(--ease-out);
}

.fs-expand[aria-expanded="true"] { transform: rotate(90deg); }
.fs-expand-placeholder { width: 14px; flex: 0 0 14px; }
.fs-group-count {
  min-width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--quiet);
  font-size: 7px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.fs-badge {
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
  align-items: center;
  gap: 3px;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--quiet);
  font-size: 7px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0;
}

.fs-badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--inactive); }
.fs-badge.is-active { color: color-mix(in oklch, var(--pastel-mint) 76%, var(--ink)); }
.fs-badge.is-active::before { background: var(--pastel-mint); }
.fs-badge.is-control { color: var(--accent-ink); }
.fs-badge.is-control::before { display: none; }

.fs-delta-mark {
  width: 15.3px;
  height: 15.3px;
  display: inline-grid;
  place-items: center;
  border: 1px solid color-mix(in oklch, var(--pastel-coral) 72%, var(--line));
  border-radius: 50%;
  color: var(--pastel-coral);
  font-size: 10px;
  font-weight: 900;
}

.fs-delta-mark.is-negative { border-color: var(--pastel-coral); color: var(--pastel-coral); }
.fs-delta-mark.is-positive { border-color: var(--pastel-mint); color: var(--pastel-mint); }
.fs-delta-mark svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fs-info-button:has(svg) { border: 0; background: transparent; }
.fs-info-button svg { width: 15.3px; height: 15.3px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.fs-document-row { cursor: pointer; }
.fs-document-row:hover { background: color-mix(in oklch, var(--accent) 8%, transparent); }
.fs-document-row a { color: var(--accent-ink); text-underline-offset: 3px; }

.fs-rate-row-label {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.fs-rate-row-label strong,
.fs-rate-row-label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fs-rate-row-label strong { flex: 0 1 43%; }
.fs-rate-row-label span { flex: 1 1 57%; color: var(--muted); font-size: 8px; }
.fs-row.is-rate-start > .fs-cell { border-top: 1px solid var(--line-strong); }
.fs-rates-table .fs-row:first-child > .fs-cell { border-top: 0; }
.fs-rate-cell { padding: 2px 7px; }

.fs-inline-percent {
  width: 100%;
  min-width: 0;
  height: calc(var(--fs-row-height) - 4px);
  min-height: 18px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--panel-raised);
  overflow: hidden;
}

.fs-inline-percent:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.fs-inline-percent input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 3px 0 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  text-align: right;
  font-family: inherit;
  font-size: var(--fs-parameter-font-size);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.fs-inline-percent span { padding-right: 5px; color: var(--quiet); font-size: 8px; }

:is(#financialServiceScaleControl, #operatorScaleControl) {
  grid-template-columns: repeat(3, minmax(47px, 1fr));
}

:is(#financialServiceScaleControl, #operatorScaleControl) button { min-width: 47px; }
.fs-rate-apply-cell { justify-content: center; }
.fs-copy-rate {
  min-width: 0;
  max-width: 100%;
  min-height: 19px;
  padding: 0 6px;
  border: 1px solid color-mix(in oklch, var(--accent) 54%, var(--line-strong));
  border-radius: 4px;
  background: transparent;
  color: var(--accent-ink);
  font-family: inherit;
  font-weight: 760;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
  cursor: pointer;
}
.fs-copy-rate:hover { background: color-mix(in oklch, var(--accent) 12%, var(--panel)); }

.fs-state {
  min-height: 360px;
  display: grid;
  place-items: center;
}

.fs-state > div { width: min(720px, calc(100% - 40px)); text-align: center; }
.fs-state strong { display: block; margin-bottom: 8px; font-size: 17px; }
.fs-state span { color: var(--muted); font-size: 11px; }
.fs-loading-copy { display: grid; gap: 6px; margin-bottom: 14px; }
.fs-loading-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }
.op-loading { width: min(560px, 100%); margin: 0 auto; padding: 18px 0; text-align: center; }
.fs-state > .op-loading { width: min(560px, calc(100% - 40px)); }
.op-loading strong { font-size: 17px; }
.op-loading .fs-loading-copy span { color: var(--muted); font-size: 12px; min-height: 2.8em; line-height: 1.4; }
.op-loading .fs-loading-meta { font-variant-numeric: tabular-nums; gap: 12px; }

.fs-info-popover {
  position: fixed;
  z-index: 80;
  width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid color-mix(in oklch, var(--accent) 54%, var(--line-strong));
  border-radius: 8px;
  background: color-mix(in oklch, var(--panel-raised) 98%, transparent);
  box-shadow: 0 18px 50px color-mix(in oklch, var(--shadow) 64%, transparent);
  color: var(--ink);
}

.fs-info-popover strong { display: block; margin-bottom: 5px; font-size: 12px; }
.fs-info-popover p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

body.fs-dialog-open { overflow: hidden; }

.fs-expense-detail-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}

.fs-expense-detail-dialog[hidden] { display: none; }
.fs-expense-detail-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, #050608 76%, transparent);
  backdrop-filter: blur(5px);
}

.fs-expense-detail-panel {
  position: relative;
  width: min(1540px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--accent) 48%, var(--line-strong));
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 26px 90px color-mix(in oklch, var(--shadow) 82%, transparent);
  color: var(--ink);
}

.fs-expense-detail-header {
  min-height: 78px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--panel-raised) 92%, transparent);
}

.fs-expense-detail-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-ink);
  font-size: 9px;
  font-weight: 820;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.fs-expense-detail-header h2 { margin: 0; font-size: 20px; line-height: 1.15; font-weight: 850; letter-spacing: -.015em; }
.fs-expense-detail-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.fs-drilldown-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.fs-export-button {
  min-height: 40px; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: transparent; color: var(--pastel-mint); font-family: inherit; font-size: 12px; font-weight: 750; cursor: pointer;
}
.fs-export-button:hover { border-color: currentColor; background: color-mix(in oklch, var(--pastel-mint) 10%, transparent); }
.fs-export-button svg { display: block; position: static; width: 18px; height: 18px; min-width: 0; min-height: 0; flex: 0 0 18px; }
.fs-export-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fs-export-button:active { transform: scale(.96); }
.fs-export-button:disabled { opacity: .5; cursor: default; }
.fs-export-error { flex-basis: 100%; color: var(--pastel-coral); }
.fs-expense-detail-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.fs-expense-detail-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 400 24px/1 sans-serif;
  cursor: pointer;
}

.fs-expense-detail-close:hover { border-color: var(--accent); color: var(--ink); background: color-mix(in oklch, var(--accent) 10%, transparent); }
.fs-expense-detail-close:focus-visible,
.fs-expense-article-trigger:focus-visible,
.fs-expense-counterparty-trigger:focus-visible,
.fs-expense-more:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.fs-expense-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.fs-expense-detail-summary > div { padding: 10px 18px; border-right: 1px solid var(--line); }
.fs-expense-detail-summary > div:last-child { border-right: 0; }
.fs-expense-detail-summary span { display: block; margin-bottom: 2px; color: var(--quiet); font-size: 9px; }
.fs-expense-detail-summary strong { display: block; font-size: 15px; font-weight: 820; font-variant-numeric: tabular-nums; }

.fs-expense-detail-columns,
.fs-expense-article-trigger {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, .6fr)) minmax(0, 1fr) minmax(0, .5fr);
  align-items: center;
  gap: 10px;
}

.fs-expense-detail-columns {
  padding: 8px 18px 8px 39px;
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
  font-size: 8px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .025em;
}

.fs-expense-detail-columns span:not(:first-child),
.fs-expense-article-trigger > span:not(.fs-expense-drill-chevron):not(.fs-expense-article-name),
.fs-expense-article-trigger > strong { text-align: right; }
.fs-expense-articles { min-height: 120px; overflow: auto; scrollbar-color: var(--line-strong) transparent; }
.fs-expense-article { border-bottom: 1px solid var(--line); }
.fs-expense-article:last-child { border-bottom: 0; }
.fs-expense-article-trigger,
.fs-expense-counterparty-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.fs-expense-article-trigger {
  min-height: 44px;
  padding: 0 18px;
  grid-template-columns: 11px minmax(0, 2fr) repeat(2, minmax(0, .6fr)) minmax(0, 1fr) minmax(0, .5fr);
  font-size: 10px;
}

.fs-expense-article-trigger:hover,
.fs-expense-counterparty-trigger:hover { background: color-mix(in oklch, var(--accent) 8%, transparent); }
.fs-expense-article-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 780; }
.fs-expense-article-trigger strong { font-size: 11px; font-weight: 820; }
.fs-expense-detail-columns.is-receipts {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .5fr) minmax(0, 1fr) minmax(0, .4fr);
}
.fs-expense-article-trigger.is-receipt {
  grid-template-columns: 11px minmax(0, 1.55fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .5fr) minmax(0, 1fr) minmax(0, .4fr);
}
.fs-expense-article-trigger.is-receipt .fs-receipt-mapped-module {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  color: var(--muted);
  font-weight: 650;
}
.fs-expense-drill-chevron { color: var(--accent-ink); font-size: 17px; line-height: 1; transform: rotate(0); transition: transform 120ms var(--ease-out); }
[aria-expanded="true"] > .fs-expense-drill-chevron { transform: rotate(90deg); }

.fs-expense-counterparties { background: color-mix(in oklch, var(--panel-raised) 58%, transparent); }
.fs-expense-counterparty { border-top: 1px solid var(--line); }
.fs-expense-counterparty-trigger {
  min-height: 38px;
  display: grid;
  grid-template-columns: 11px minmax(0, 2fr) minmax(0, .6fr) minmax(0, 1fr) minmax(0, .5fr);
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 38px;
  color: color-mix(in oklch, var(--ink) 88%, var(--quiet));
  font-size: 9px;
}

.fs-expense-counterparty-trigger > span:not(.fs-expense-drill-chevron):not(.fs-expense-counterparty-name),
.fs-expense-counterparty-trigger > strong { text-align: right; }
.fs-expense-counterparty-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; font-weight: 700; }
.fs-expense-counterparty-trigger strong { font-size: 10px; }
.fs-expense-transactions { padding: 0 18px 10px 59px; }
.fs-expense-transactions.is-receipt { padding-left: 39px; background: color-mix(in oklch, var(--panel-raised) 55%, transparent); }
.fs-expense-table-scroll { overflow: auto; max-height: 330px; border: 1px solid var(--line); border-radius: 6px; scrollbar-color: var(--line-strong) transparent; }
.fs-expense-transaction-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 9px; line-height: 1.35; }
.fs-expense-transaction-table.is-receipts { min-width: 0; }
.fs-expense-transaction-table th, .fs-expense-transaction-table td { overflow-wrap: anywhere; }
.fs-expense-detail-columns > *, .fs-expense-article-trigger > *, .fs-expense-counterparty-trigger > * { min-width: 0; overflow-wrap: anywhere; }
.fs-expense-transaction-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-raised);
  color: var(--quiet);
  text-align: left;
  font-size: 8px;
  font-weight: 780;
  white-space: nowrap;
}

.fs-expense-transaction-table td { padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; }
.fs-expense-transaction-table tr:last-child td { border-bottom: 0; }
.fs-expense-transaction-table th:last-child,
.fs-expense-transaction-table td:last-child { border-right: 0; }
.fs-expense-transaction-amount { text-align: right; font-weight: 780; white-space: normal; font-variant-numeric: tabular-nums; }
.fs-expense-finansist-article { min-width: 0; font-weight: 720; color: var(--ink); }
.fs-receipt-finansist-module { min-width: 0; font-weight: 780; color: var(--ink); }
.fs-receipt-identifiers { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.fs-expense-purpose { min-width: 0; color: var(--muted); white-space: normal; }
.fs-expense-transaction-table th, .fs-expense-transaction-table .fs-expense-match { white-space: normal; }
.fs-expense-match {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  color: var(--quiet);
  font-size: 8px;
  font-weight: 760;
}
.fs-expense-match.is-confirmed { border-color: color-mix(in oklch, var(--pastel-mint) 55%, var(--line)); color: var(--pastel-mint); }
.fs-expense-match.is-warning { border-color: color-mix(in oklch, var(--pastel-coral) 55%, var(--line)); color: var(--pastel-coral); }
.fs-expense-more {
  display: block;
  margin: 8px auto 0;
  padding: 6px 12px;
  border: 1px solid color-mix(in oklch, var(--accent) 50%, var(--line-strong));
  border-radius: 5px;
  background: transparent;
  color: var(--accent-ink);
  font: 760 9px/1 inherit;
  cursor: pointer;
}

.fs-expense-more:hover { background: color-mix(in oklch, var(--accent) 10%, transparent); }
.fs-expense-all-shown { padding-top: 7px; color: var(--quiet); text-align: center; font-size: 8px; }
.fs-expense-empty { padding: 30px; color: var(--quiet); text-align: center; font-size: 11px; }

@media (max-width: 1700px) {
  .fs-toolbar { grid-template-columns: 160px minmax(610px, 1.2fr) minmax(510px, 1fr); }
  :is(#financialServiceToolbar, #operatorToolbar) { grid-template-columns: 210px minmax(590px, 1.2fr) minmax(510px, 1fr); }
  .fs-toolbar .filter-frame { gap: 8px; }
  .fs-toolbar .control-label { display: none; }
}

@media (max-width: 1320px) {
  .fs-toolbar { display: grid; grid-template-columns: 120px minmax(0, 1fr); }
  :is(#financialServiceToolbar, #operatorToolbar) { grid-template-columns: 210px minmax(0, 1fr); }
  .fs-toolbar .filter-frame { flex-wrap: wrap; }
  .fs-toolbar .filter-frame:last-child { grid-column: 1 / -1; }
  .financial-service-dashboard { padding-inline: 10px; }
  .fs-expense-detail-dialog { padding: 10px; }
  .fs-expense-detail-panel { max-height: calc(100dvh - 20px); }
  .fs-cell { padding-inline: 5px; white-space: normal; overflow-wrap: anywhere; flex-wrap: wrap; }
  .fs-amount-trigger { min-width: 0; width: calc(100% + 10px); margin-inline: -5px; padding-inline: 5px; white-space: normal; overflow-wrap: anywhere; }
  .fs-date-rail, .fs-table { --fs-first-column: minmax(240px, 26%); }
  .fs-inline-percent { min-width: 0; max-width: 100%; }
  .fs-copy-rate { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .fs-info-button,
  .fs-expand,
  .fs-amount-trigger,
  .fs-expense-drill-chevron { transition: none; }
}
/* Spend compact desktop height on data, not card gutters. Keep content
   scrollable when rows are expanded, zoomed, or a warning needs room. */
@media (min-width: 851px) and (max-height: 800px) {
  .financial-service-dashboard { padding-block: 6px; }
  .fs-canvas { gap: 2px; }
  .fs-card-header { min-height: 22px; padding: 2px 10px; }
  .fs-inactive-toggle { min-height: 18px; }
  .fs-actual-toggle { min-height: 18px; }
  .fs-tree-label.is-wrapped { padding-block: 1px; }
  .fs-date-rail > .fs-month-heading { padding-block: 3px; }
}
@media (min-width: 851px) {
  .is-compact-overview .fs-canvas { gap: 3px; }
  .is-compact-overview .fs-card-header { min-height: 24px; padding-block: 2px; gap: 8px; }
  .is-compact-overview .fs-inactive-toggle, .is-compact-overview .fs-actual-toggle { min-height: 20px; }
  .is-compact-overview .fs-tree-label.is-wrapped { padding-block: 0; }
  .is-compact-overview .fs-date-rail > div { min-height: 26px; padding-block: 2px; }
}
@media (max-width: 850px) {
  .fs-expense-detail-header { flex-wrap: wrap; gap: 10px; }
  .fs-drilldown-actions { margin-inline-start: auto; }
  .fs-expense-transactions, .fs-expense-transactions.is-receipt { padding-inline: 10px; }
  .fs-expense-transaction-table, .fs-expense-transaction-table.is-receipts { min-width: 1100px; }
  .fs-date-rail { position: static; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fs-date-rail > div:first-child, .fs-date-rail > div:last-child { grid-column: 1 / -1; min-height: 30px; }
  .fs-date-rail > .fs-month-heading { flex-direction: row; min-height: 44px; }
  .fs-table { display: block; }
  .fs-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .fs-row > .fs-cell:first-child { grid-column: 1 / -1; position: static; min-height: 40px; }
  .fs-row > .fs-cell:last-child { grid-column: 1 / -1; }
  .fs-cell { min-height: 40px; font-size: 12px; justify-content: space-between; gap: 4px; padding: 4px 8px; }
  .fs-cell[data-period-label]::before { content: attr(data-period-label); font-size: 12px; font-weight: 500; color: var(--muted); }
  .fs-row > .fs-empty-cell { display: none; }
  .fs-amount-trigger { width: auto; min-height: 36px; margin: 0; padding: 0; }
  .fs-rate-cell .fs-inline-percent { flex: 1; }
  .fs-card-header { flex-wrap: wrap; }
  .fs-actual-toggle { margin-inline-start: 0; white-space: normal; }
  .fs-accrual-status { flex-basis: 40px; min-height: 40px; }
  .fs-card-title-line { flex-wrap: wrap; }
  .fs-rates-card .fs-inactive-toggle { margin-inline-start: 0; }
  .fs-rate-group-summary { white-space: normal; }
}
.fs-expense-control { color: var(--pastel-coral); }
.fs-control-status { display: inline-flex; align-items: center; gap: 6px; color: var(--pastel-sand, #e0d09a); font-size: 13px; font-weight: 400; line-height: 1.5; }
.fs-expense-control { font-size: 13px; line-height: 1.5; }
.fs-personnel-scroll { max-height: 60vh; overflow: auto; }
.fs-personnel-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; color: var(--text); }
.fs-personnel-table th, .fs-personnel-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: top; }
.fs-personnel-table th { font-weight: 600; }
.fs-personnel-table .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.fs-personnel-table th:nth-child(1), .fs-personnel-table th:nth-child(2) { width: 25%; }
.fs-personnel-table th:nth-child(3) { width: 9%; }
.fs-personnel-table th:nth-child(4), .fs-personnel-table th:nth-child(5) { width: 13%; }
.fs-quality-warning { font-size: 13px; line-height: 1.5; padding: 0 16px; }
.fs-expense-control summary { padding: 12px 16px; cursor: pointer; line-height: 1.5; }
.fs-expense-control .fs-table { color: var(--text); }
.fs-document-panel { width: min(920px, 100%); min-height: 0; }
.fs-document-panel > .fs-expense-detail-header { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; }
.fs-document-panel .fs-expense-detail-close { width: 44px; height: 44px; }
.fs-document-panel .fs-expense-detail-header h2,
.fs-document-panel .fs-expense-detail-kicker { letter-spacing: 0; }
.fs-document-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior: contain;
}
.fs-document-body button,
.fs-document-actions button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  user-select: none;
  transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 120ms var(--ease-out);
}
.fs-document-body button:hover,
.fs-document-actions button:hover { color: var(--ink); background: color-mix(in oklch, var(--ink) 7%, transparent); }
.fs-document-body button:disabled,
.fs-document-actions button:disabled { opacity: .5; cursor: default; }
.fs-document-body button:focus-visible,
.fs-document-actions button:focus-visible,
.fs-document-body input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fs-document-body button:not(:disabled):active,
.fs-document-actions button:not(:disabled):active { transform: scale(.96); }
.fs-document-body a { color: var(--pastel-mint); text-underline-offset: 3px; overflow-wrap: anywhere; }
.fs-document-card { padding: 16px; margin-block: 16px; border: 1px solid var(--line); border-radius: 8px; }
.fs-document-card h3 { margin: 0 0 12px; font-size: 17px; line-height: 1.2; }
.fs-document-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin: 0; }
.fs-document-card dt, .fs-document-text > span { color: var(--muted); font-size: 13px; }
.fs-document-card dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.fs-document-text { margin-top: 16px; }
.fs-document-text p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fs-document-options { display: grid; gap: 4px; }
.fs-document-options label { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.fs-document-options input { width: 18px; height: 18px; accent-color: var(--accent); }
.fs-document-options > span { margin-inline-start: 28px; color: var(--muted); font-size: 13px; }
.fs-document-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: color-mix(in oklch, var(--panel-raised) 96%, transparent);
}
.fs-document-actions .is-primary {
  border-color: color-mix(in oklch, var(--pastel-mint) 72%, transparent);
  background: color-mix(in oklch, var(--pastel-mint) 10%, transparent);
  color: var(--pastel-mint);
}
.fs-document-actions .is-primary:hover { border-color: var(--pastel-mint); background: color-mix(in oklch, var(--pastel-mint) 17%, transparent); color: var(--ink); }
.fs-document-warning { color: var(--pastel-coral); }
.fs-document-existing { color: var(--pastel-mint); }
.fs-document-note { color: var(--muted); margin-top: 0; }
.fs-document-results li { padding-block: 8px; }
.app.is-operator-view { grid-template-columns: minmax(0, 1fr); }
.operator-dashboard { min-width: 0; }
@media (max-width: 850px) {
  .is-operator-view .topbar { grid-template-columns: minmax(0, 1fr); }
  .is-operator-view .topbar > div { min-width: 0; }
  .is-operator-view .view-switch { max-width: 100%; overflow-x: auto; }
  :is(#financialServiceToolbar, #operatorToolbar) .filter-frame { flex-wrap: wrap; }
  :is(#financialServiceToolbar, #operatorToolbar) .filter-frame > .label-toggle { white-space: normal; }
  :is(#financialServiceToolbar, #operatorToolbar) .search { flex-basis: 160px; }
  .operator-dashboard .fs-canvas { min-width: calc(240px + var(--fs-value-columns) * 150px); }
  .operator-dashboard .fs-table, .operator-dashboard .fs-date-rail { display: grid; grid-template-columns: minmax(240px, 26%) repeat(var(--fs-value-columns), minmax(150px, 1fr)); }
  .operator-dashboard .fs-row { display: contents; }
  .operator-dashboard .fs-cell:first-child, .operator-dashboard .fs-cell:last-child,
  .operator-dashboard .fs-date-rail > div:first-child, .operator-dashboard .fs-date-rail > div:last-child { grid-column: auto; }
}
@media (max-width: 600px) {
  :is(#financialServiceToolbar, #operatorToolbar) { grid-template-columns: minmax(0, 1fr); }
  :is(#financialServiceToolbar, #operatorToolbar) .filter-frame { justify-content: flex-start; }
  :is(#financialServiceToolbar, #operatorToolbar) .filter-frame:last-child { grid-column: auto; }
}
@media (max-width: 650px) {
  .fs-document-card dl { grid-template-columns: 1fr; }
  .fs-document-body { padding: 12px; font-size: 16px; }
  .fs-document-actions { flex-wrap: wrap; padding: 10px 12px; }
}
.op-breakdown-scroll { overflow: auto; max-height: 65vh; }
.op-breakdown-scroll table { min-width: 880px; width: 100%; }
.op-breakdown-scroll th:nth-child(2), .op-breakdown-scroll td:nth-child(2) { width: auto; min-width: 85px; }
.op-breakdown-scroll th:nth-child(3), .op-breakdown-scroll td:nth-child(3) { width: auto; min-width: 130px; }
.op-document-group table { min-width: 680px; }
.op-document-group th:nth-child(1) { width: 34%; }
.op-document-group th:nth-child(2), .op-document-group th:nth-child(3) { width: 17%; }
.op-document-group th:nth-child(4) { width: 32%; }
.op-source-meta { margin: 8px 0 0; font-size: inherit; }
.op-source-meta summary { cursor: pointer; }
.op-source-meta dt { font-weight: 700; margin-top: 6px; }
.op-source-meta dd { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fs-document-batch-row { border-bottom: 1px solid var(--line); padding: 12px 0; }
.fs-document-batch-row summary { cursor: pointer; overflow-wrap: anywhere; line-height: 1.5; min-height: 44px; align-content: center; }
.fs-document-batch-row .fs-document-card { margin-top: 12px; }
.fs-document-batch-row > .fs-document-note { margin: 12px 0; }
.fs-document-batch-filter { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.fs-document-batch-filter input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent); }
.fs-document-batch-filter input:focus-visible,
.fs-document-batch-row summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fs-document-batch-top { flex: 0 0 auto; padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.fs-document-batch-top p { margin: 0; }
.fs-document-batch-progress > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.fs-document-batch-progress progress { display: block; appearance: none; width: 100%; height: 6px; overflow: hidden; border: 0; border-radius: 3px; background: var(--line); accent-color: var(--accent); }
.fs-document-batch-progress progress::-webkit-progress-bar { background: var(--line); }
.fs-document-batch-progress progress::-webkit-progress-value { background: var(--accent); }
.fs-document-batch-progress progress::-moz-progress-bar { background: var(--accent); }
.fs-document-batch-project { padding-block: 8px 16px; border-bottom: 1px solid var(--line); }
.fs-document-batch-project > h3 { margin: 0 0 12px; font-size: 16px; overflow-wrap: anywhere; }
.fs-document-card dd { overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 650px) {
  .fs-document-batch-top { padding: 10px 12px; }
  .fs-document-actions button { min-height: 44px; max-width: 100%; white-space: normal; }
}
