/* ═══════════════════════════════════════════════════════════════
   Financial Statement Viewer — Tabbed, scrollable HTML tables
   ═══════════════════════════════════════════════════════════════ */

/* ── Tab Bar ─────────────────────────────────────────────────── */
.stmt-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--green);
  margin-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stmt-tab {
  padding: 0.6rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.stmt-tab:hover {
  color: var(--green);
  background: var(--cream);
}

.stmt-tab--active {
  color: var(--green);
  font-weight: 600;
  border-bottom-color: var(--gold);
  background: var(--cream);
}

/* ── Table Container ─────────────────────────────────────────── */
.stmt-container {
  margin-top: var(--space-lg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
}

.stmt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 70vh;
  overflow-y: auto;
}

/* ── Table ────────────────────────────────────────────────────── */
.stmt-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ── Header ───────────────────────────────────────────────────── */
.stmt-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.stmt-table thead tr:first-child th {
  background: var(--green);
  color: var(--white);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 0.6rem;
  text-align: center;
  border-right: 1px solid var(--green-light);
}

.stmt-table thead tr:first-child th:first-child {
  text-align: left;
  min-width: 220px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--green);
}

.stmt-table thead tr:last-child th {
  background: var(--green-light);
  color: var(--gold-light);
  font-weight: 400;
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  text-align: center;
  border-right: 1px solid var(--green);
  white-space: nowrap;
}

.stmt-table thead tr:last-child th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--green-light);
}

/* ── Body Cells ───────────────────────────────────────────────── */
.stmt-table tbody td {
  padding: 0.3rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  color: var(--charcoal);
  background: var(--white);
}

.stmt-table tbody td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--white);
  font-weight: 400;
  min-width: 220px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Row Types ────────────────────────────────────────────────── */

/* Section header rows */
.stmt-row--section td {
  font-weight: 700;
  background: #F0F0EC !important;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--green);
  font-size: 0.8rem;
}

/* Total rows */
.stmt-row--total td {
  font-weight: 700;
  border-top: 1.5px solid var(--charcoal);
  border-bottom: 1.5px solid var(--charcoal);
  background: #EAEAE6 !important;
}

/* Subtotal rows */
.stmt-row--subtotal td {
  font-weight: 600;
  border-top: 1px solid var(--border);
  font-style: italic;
  background: #F3F3EF !important;
}

/* Item rows — indentation based on depth */
.stmt-row--item td:first-child {
  padding-left: 1.6rem;
}

.stmt-row--item[data-depth="2"] td:first-child {
  padding-left: 2.6rem;
}

.stmt-row--item[data-depth="3"] td:first-child {
  padding-left: 3.6rem;
}

/* ── Total columns (subtle separator, no gold) ───────────────── */
.stmt-col--total {
  font-weight: 600;
  border-left: 1.5px solid var(--border);
}

/* ── Negative values ──────────────────────────────────────────── */
.stmt-val--neg {
  color: var(--error);
}

/* ── Zebra striping (subtle grey) ─────────────────────────────── */
.stmt-table tbody tr.stmt-row--item:nth-child(even) td {
  background: #F7F7F4;
}

.stmt-table tbody tr.stmt-row--item:nth-child(even) td:first-child {
  background: #F7F7F4;
}

/* ── Viewer Wrapper ──────────────────────────────────────────── */
.stmt-viewer {
  margin-top: var(--space-xl);
  text-align: left;
}

.stmt-viewer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.stmt-viewer__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--green);
  font-weight: 600;
}

.stmt-viewer__subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Empty / loading states ───────────────────────────────────── */
.stmt-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .stmt-tabs {
    gap: 0;
  }
  .stmt-tab {
    font-size: 0.72rem;
    padding: 0.5rem 0.8rem;
  }
  .stmt-table {
    font-size: 0.7rem;
  }
  .stmt-table tbody td:first-child {
    min-width: 160px;
  }
}
