/* ArthaFinancials (public/stock-financials.js), 2026-09-24.
   Reads the v3.css tokens only: no token block, no :root. The statements read
   like a filed statement: a sticky line-item column, right-aligned tabular
   figures, hairline row rules, key lines in semibold, ratios in muted text,
   losses in the down colour, the data vendor's columns tinted and named, and a
   year that was never filed hatched rather than zeroed. Charts come from
   stock-charts.css. */

.af {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  color: var(--text);
  font: 400 13px/1.45 var(--ui);
}

/* ---- top bar: what these statements are, and the basis switch ---- */
.af-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 2px 2px 0;
}
.af-bar-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.af-kicker { color: var(--brand); font: 600 11px/1.3 var(--ui); letter-spacing: .08em; text-transform: uppercase; }
.af-bar-text { color: var(--muted-readable); font: 500 13px/1.4 var(--ui); }

/* ---- segmented controls ---- */
.af-seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--canvas-wash);
}
.af-seg-b {
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: var(--muted-readable);
  background: transparent;
  font: 600 12px/1 var(--ui);
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.af-seg-b:hover:not(:disabled) { color: var(--text-strong); }
.af-seg-b[aria-pressed="true"] { color: var(--text-strong); background: var(--raised); box-shadow: var(--shadow-seg); }
.af-seg-b:disabled { color: var(--faint); cursor: not-allowed; }
.af-seg-b:focus-visible,
.af-csv:focus-visible,
.af-scroll:focus-visible,
.af-method summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.af-csv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  font: 600 12px/1 var(--ui);
  cursor: pointer;
  appearance: none;
}
.af-csv::before { content: "↓"; color: var(--muted); font-weight: 500; }
.af-csv:hover { border-color: var(--rule-hover); background: var(--paper-sunk); }

/* ---- cards ---- */
.af-card {
  min-width: 0;
  padding: 22px 24px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.af-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
}
.af-title { min-width: 0; }
.af-title h2 { margin: 0; color: var(--text-strong); font: 400 23px/1.2 var(--display); letter-spacing: -.02em; }
.af-sub { margin: 4px 0 0; color: var(--muted); font: 500 12px/1.4 var(--ui); }
.af-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.af-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  color: var(--muted-readable);
  background: var(--paper-sunk);
  font-size: 13px;
  line-height: 1.55;
}

/* ---- the statement table ---- */
.af-scroll {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.af-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font: 400 13px/1.35 var(--ui);
  font-variant-numeric: tabular-nums lining-nums;
}
.af-table th,
.af-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.af-table tbody tr:last-child th,
.af-table tbody tr:last-child td { border-bottom-color: var(--rule-strong); }

/* The line-item column stays put while the years scroll under it. */
.af-stub {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 188px;
  max-width: 240px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
  text-align: left;
  box-shadow: 6px 0 8px -8px color-mix(in srgb, var(--shadow-ink) 28%, transparent);
}
.af-table thead th {
  position: relative;
  padding-top: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule-strong);
  background: var(--paper-sunk);
  vertical-align: bottom;
}
.af-table thead .af-stub { background: var(--paper-sunk); }
.af-unit { color: var(--muted); font: 600 11px/1.2 var(--ui); letter-spacing: .06em; text-transform: uppercase; }

.af-col { text-align: right; }
.af-col-l { display: block; color: var(--text-strong); font: 600 12.5px/1.2 var(--ui); text-decoration: none; }
a.af-col-l { text-decoration: underline; text-decoration-color: var(--rule-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.af-col-l:hover { color: var(--brand); text-decoration-color: currentColor; }
a.af-col-l:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.af-tag { display: block; margin-top: 3px; color: var(--faint); font: 500 10.5px/1.2 var(--ui); letter-spacing: .02em; }
.af-tag.is-vendor { display: inline-block; padding: 1px 6px; border-radius: 999px; color: var(--brass-strong); background: var(--brass-soft); font-weight: 600; }
.af-tag.is-gap { color: var(--muted); }

.af-label { color: var(--text); font-weight: 500; white-space: normal; }
.af-label.is-derived { cursor: help; text-decoration: underline dotted transparent; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color 140ms ease; }
.af-row:hover .af-label.is-derived { text-decoration-color: var(--faint); }
.af-basis { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; color: var(--muted-readable); background: var(--canvas-wash); font: 600 10px/1.3 var(--ui); letter-spacing: .02em; vertical-align: 1px; }

.af-num { color: var(--text); text-align: right; }
.af-num.is-neg { color: var(--negative); }
.af-num.is-null { color: var(--faint); }
.af-num.has-note { position: relative; }
.af-num.has-note::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass);
}
.af-num.is-vendor-cell { text-decoration: underline dotted var(--brass); text-underline-offset: 3px; }

/* Key lines carry weight; ratio lines step back. */
.af-row.is-emphasis th,
.af-row.is-emphasis td { border-top: 1px solid var(--rule-strong); }
.af-row.is-emphasis .af-label,
.af-row.is-emphasis .af-num { color: var(--text-strong); font-weight: 600; }
.af-row.is-emphasis .af-num.is-neg { color: var(--negative); }
.af-row.is-muted .af-label { color: var(--muted-readable); font-weight: 400; }
.af-row.is-muted .af-num { color: var(--muted-readable); font-size: 12.5px; }
.af-row.is-muted .af-num.is-neg { color: var(--negative); }
.af-row.is-muted .af-num.is-null { color: var(--faint); }
.af-table tbody tr:hover th,
.af-table tbody tr:hover td { background-color: var(--paper-sunk); }

/* Column kinds: the vendor's years tinted, a year never filed hatched, TTM set apart. */
.af-num.is-vendor,
.af-col.is-vendor { background-color: color-mix(in srgb, var(--brass) 6%, transparent); }
.af-table thead .af-col.is-vendor { background-color: var(--brass-soft); }
.af-num.is-gap,
.af-col.is-gap {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--text-strong) 4.5%, transparent) 5px 6px);
}
.af-col.is-gap .af-col-l { color: var(--muted); font-weight: 500; }
.af-num.is-ttm,
.af-col.is-ttm { border-left: 1px solid var(--rule-strong); }
.af-table thead .af-col.is-ttm { background-color: var(--brand-soft); }
.af-col.is-ttm .af-tag { color: var(--brand-strong); }

.af-table tfoot th,
.af-table tfoot td { padding-top: 7px; padding-bottom: 8px; border-bottom: 0; color: var(--faint); font: 500 11px/1.2 var(--ui); }
.af-table tfoot .af-stub { color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* ---- charts ---- */
.af-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.af-chart { min-width: 0; margin: 0; }
.af-chart figcaption { margin: 0 0 8px; color: var(--muted-readable); font: 600 12px/1.35 var(--ui); }
.af-chart-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

/* ---- compounded growth: Screener's small tables, one per line ---- */
.af-growth-wrap { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--rule); container: af-growth / inline-size; }
.af-h3 { margin: 0 0 12px; color: var(--muted); font: 600 11px/1.3 var(--ui); letter-spacing: .08em; text-transform: uppercase; }
.af-growth { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@container af-growth (min-width: 520px) { .af-growth { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container af-growth (min-width: 900px) { .af-growth { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.af-g-box { min-width: 0; padding: 12px 14px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk); }
.af-g-box h3 { margin: 0 0 8px; color: var(--text-strong); font: 600 12.5px/1.3 var(--ui); }
.af-g-box h3 span { color: var(--muted); font-weight: 500; }
.af-g-box dl { margin: 0; }
.af-g-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid var(--rule); }
.af-g-row:first-child { border-top: 0; }
.af-g-row dt { color: var(--muted-readable); font-size: 12px; }
.af-g-row dd { margin: 0; color: var(--text-strong); font: 600 13px/1.3 var(--ui); font-variant-numeric: tabular-nums; white-space: nowrap; }
.af-g-row dd.is-neg { color: var(--negative); }
.af-g-row dd.is-null { color: var(--faint); font-weight: 500; }
.af-fn { margin-left: 2px; color: var(--muted); font: 600 9.5px/1 var(--ui); vertical-align: 5px; }
.af-fn.is-caution { color: var(--warning); }
.af-g-notes { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.af-g-notes li { padding-left: 2px; }
.af-g-caution { margin: 6px 0 0; color: var(--warning); font-size: 11.5px; line-height: 1.5; }

/* ---- notes and method ---- */
.af-foot:empty { display: none; }
.af-foot { margin-top: 14px; }
.af-notes { display: flex; flex-direction: column; gap: 5px; max-width: 86ch; margin: 0; padding-left: 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.af-method { max-width: 86ch; margin-top: 10px; }
.af-method summary { display: inline-flex; align-items: center; min-height: 28px; color: var(--brand); font: 600 12px/1.3 var(--ui); cursor: pointer; }
.af-method dl { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 6px 16px; margin: 8px 0 0; font-size: 12px; line-height: 1.5; }
.af-method dl div { display: contents; }
.af-method dt { color: var(--text-strong); font-weight: 600; }
.af-method dd { margin: 0; color: var(--muted-readable); }
.af-general { padding: 16px 18px; border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg); background: var(--paper-sunk); }
.af-general .af-h3 { margin-bottom: 8px; }

/* ---- narrow screens ---- */
@media (max-width: 759px) {
  .af-card { padding: 18px 16px 18px; }
  .af-title h2 { font-size: 21px; }
  .af-head { align-items: flex-start; }
  .af-tools { width: 100%; }
  .af-stub { min-width: 116px; max-width: 128px; }
  .af-table { font-size: 12.5px; }
  .af-table th,
  .af-table td { padding: 8px 9px; }
  .af-table thead th { padding-top: 9px; padding-bottom: 8px; }
  .af-method dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .af-method dd { margin-bottom: 8px; }
}
@media (max-width: 759px), (pointer: coarse) {
  .af-seg-b { min-height: 44px; min-width: 44px; padding: 0 12px; }
  .af-csv { min-height: 44px; padding: 0 14px; }
  .af-method summary { min-height: 44px; }
}
.af-g-span { margin: 10px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
