/* Financial statements dashboard: tabs, tables, and status styling.
   Uses the shared palette variables from palette.css / style.css
   (--lime for success/primary accents, --red for danger, --surface-2
   for alternate panels, --line for borders, --muted for secondary text). */

.financial-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 2rem;
}
.financial-tabs button {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}
.financial-tabs button.active {
  color: var(--lime);
  border-bottom-color: var(--lime);
}
.financial-tabs button:hover {
  color: var(--text);
}
.statement-container {
  display: none;
}
.statement-container.active {
  display: block;
}
.statement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.statement-table th {
  padding: 0.75rem;
  text-align: left;
  background-color: var(--surface-2);
  font-weight: 600;
  border-bottom: 2px solid var(--line);
}
/* Amount headers sit over right-aligned figures but keep the header font. */
.statement-table th.amount {
  text-align: right;
  font-family: inherit;
}
.statement-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.statement-table tr:hover {
  background-color: var(--surface-2);
}
.invoice-document-link {
  position: relative;
  color: inherit;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 3px;
  border-radius: 3px;
}
.invoice-document-link::after {
  content: " ↗";
  color: var(--lime);
  font-size: 0.8em;
}
.invoice-document-link:hover,
.invoice-document-link:focus-visible {
  color: var(--lime);
  text-decoration: underline;
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}
.invoice-document-link:hover::before {
  content: "Opens in a new tab";
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.45rem);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  pointer-events: none;
}
.amount {
  text-align: right;
  font-family: 'DM Mono', monospace;
}
.balance-positive {
  color: var(--lime);
}
/* Global --red is a neutral grey in style.css, so statements carry their own
   loss colour; a negative figure must not read like muted text. */
.balance-negative {
  color: #F87171;
}
html.theme-light .balance-negative {
  color: #DC2626;
}
.total-row {
  font-weight: 600;
  background-color: var(--surface-2);
  border-top: 2px solid var(--line);
}
.section-header {
  padding: 1rem 0;
  font-weight: 600;
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.indent-1 { padding-left: 2rem; }
.indent-2 { padding-left: 4rem; }
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.line-account td:first-child { padding-left: 3.5rem; color: var(--muted); font-size: 0.92em; }

.statement-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.line-toggle {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.line-toggle::before { content: "▸ "; opacity: 0.6; }
.line-toggle[aria-expanded="true"]::before { content: "▾ "; }
.statement-period { display:flex; flex-wrap:wrap; gap:0.75rem; align-items:end; margin:0.75rem 0; }
.statement-period small { color: var(--muted); }
.back-to-top { position:fixed; right:1.5rem; bottom:1.5rem; z-index:20; padding:0.6rem 0.9rem; border-radius:999px; border:1px solid var(--line); background:var(--surface); color:var(--text); cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.25); }
