/* ============================================================
   Finance statements, in the reference template's tokens.
   Figures are tabular and right-aligned; negatives in brackets (FIN-NFR-008).
   ============================================================ */

.st-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.st-date {
  flex: 0 0 auto;
  min-width: 170px;
}

.st-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.st-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.st-basis,
.st-note,
.st-empty {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.st-card .form-error,
.st-card .form-notice {
  margin: 12px 0 0;
}

.st-table {
  width: 100%;
  max-width: 760px;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 14px;
}

.st-table td,
.st-table th {
  padding: 7px 8px;
  text-align: left;
}

.st-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 160px;
}

.st-section th {
  padding-top: 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.st-line td {
  border-top: 1px solid var(--line);
}

.st-expand {
  display: inline-flex;
  gap: 6px;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
}

.st-expand span {
  width: 12px;
  color: var(--muted);
}

.st-expand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.st-source td {
  padding-left: 30px;
  font-size: 13px;
  color: var(--muted);
}

.st-total td {
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.st-key td {
  border-top: 2px solid var(--ink);
  font-weight: 700;
  font-size: 15px;
}

.st-key small {
  margin-left: 6px;
  font-weight: 500;
  color: var(--muted);
}

.st-derived {
  font-style: italic;
}

/* ---------------- Finance dashboard ---------------- */
.fin-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .fin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.fin-kpis .kpi-num {
  font-size: clamp(26px, 2.4vw, 36px);
}

.fin-charts .spark {
  width: 100%;
  height: auto;
  margin-top: 12px;
}

.fin-table {
  margin-top: 14px;
  font-size: 13px;
}

.fin-table summary {
  cursor: pointer;
  color: var(--muted);
}

.fin-table .st-table {
  margin-top: 6px;
}

/* ---------------- Forecasting ---------------- */
.fe-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.fe-fields select,
.fe-fields input[type="date"],
.fe-fields input[type="number"] {
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1px var(--edge-card);
  font: inherit;
  color: inherit;
}

.fe-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 14px 0 0;
}

.fe-totals dt {
  font-size: 12px;
  color: var(--muted);
}

.fe-totals dd {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* A wide forecast table: scrolls inside its card with the label column fixed (FCS-FR-016). */
.fc-scroll {
  overflow-x: auto;
  margin-top: 14px;
}

.fc-table {
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.fc-table th,
.fc-table td {
  padding: 6px 10px;
}

.fc-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
}

.fc-table .fc-label {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 240px;
  text-align: left;
  background: color-mix(in srgb, var(--soft-2) 92%, #fff);
}

.fc-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line);
}

.fc-table .fc-section th {
  padding-top: 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

.fc-table .fc-key td,
.fc-table .fc-key th {
  border-top: 2px solid var(--ink);
  font-weight: 700;
}

.fc-select {
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1px var(--edge-card);
  font: inherit;
  color: inherit;
}

.fc-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fe-sub {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.fe-derived {
  display: block;
  padding-top: 10px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.fe-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding-top: 22px;
}

.fe-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
