/* ===== Tax & P&L page — mirrors TaxPnL.dc.html on the app's design tokens ===== */

/* Top bar: back chevron + year segmented + actions */
.tx-topbar { gap: 10px; flex-wrap: wrap; }
.tx-topbar h1 { display: inline-flex; align-items: center; gap: 10px; }
.tx-back { display: inline-flex; align-items: center; color: var(--text-dim); }
.tx-back svg { display: block; }
.tx-actions { flex-wrap: wrap; }
.tx-seg { display: inline-flex; }
.tx-seg button { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }
.tx-topbar .btn svg, .tx-assume .btn svg, .tx-head-right .btn svg { flex-shrink: 0; display: block; }
.tx-btn-xs { padding: 2px 10px; font-size: 11px; min-height: 28px; }

/* Page column */
.tx-page { display: flex; flex-direction: column; gap: 14px; }
.tx-page .card { margin-bottom: 0; }
.tx-hide { display: none !important; }

/* Assumptions strip (market-clock look) */
.tx-assume {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 14px;
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.tx-assume-title { font-weight: 700; color: var(--text); letter-spacing: 0.3px; }
.tx-assume-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tx-assume-item svg { flex-shrink: 0; display: block; }
.tx-assume-item b { color: var(--text); }
.tx-assume-item b.on { color: var(--green); }
.tx-assume-item b.off { color: var(--red); }
.tx-assume-edit { margin-left: auto; }

/* KPI cards */
.tx-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.tx-kpi { padding: 16px 18px; min-width: 0; }
.tx-kpi .k-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.tx-kpi .k-value { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-kpi .k-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Sign colors */
.tx-pos { color: var(--green) !important; }
.tx-neg { color: var(--red) !important; }
.tx-dim { color: var(--text-dim) !important; }

/* Two-column rows */
.tx-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.tx-row-start { align-items: start; }
.tx-row > .card { min-width: 0; }
.tx-card { padding: 20px 22px; }
.tx-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tx-card-head .card-title { margin-bottom: 0; }
.tx-head-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tx-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tx-hint { font-size: 12px; color: var(--text-dim); }

/* Monthly chart */
.tx-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-dim); }
.tx-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tx-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tx-chart-wrap { position: relative; height: 210px; margin-top: 10px; }
.tx-chart-foot { display: flex; gap: 22px; margin-top: 8px; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tx-chart-foot b { color: var(--text); }
.tx-chart-foot .tx-note { margin-left: auto; }

/* Tables — scroll inside the card on narrow screens, never the body */
.tx-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; margin-top: 4px; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tx-table th {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  text-align: right; padding: 8px 0 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tx-table td { padding: 9px 0 9px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; vertical-align: middle; }
.tx-table th:first-child, .tx-table td:first-child { padding-left: 0; }
.tx-table th.l, .tx-table td.l { text-align: left; }
.tx-table .sym { font-weight: 700; }
.tx-table .name { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.tx-table .sub { color: var(--text-dim); font-size: 11px; font-weight: 400; }
.tx-table .pct { font-weight: 500; font-size: 11px; }
.tx-table .b { font-weight: 700; }
.tx-table td.holding { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.tx-table td.tx-empty { text-align: center; white-space: normal; }
.tx-ledger { min-width: 380px; }
.tx-ledger td { padding-top: 7px; padding-bottom: 7px; }
.tx-trades { min-width: 860px; }
.tx-trades .chev-col { width: 24px; }
.tx-unreal { min-width: 640px; }
.tx-empty { padding: 22px 0; text-align: center; color: var(--text-dim); font-size: 13px; }

/* Expandable trade rows (FIFO lots consumed) */
.tx-trade-row { cursor: pointer; }
.tx-trade-row .chev { display: inline-block; color: var(--text-dim); transition: transform 0.15s; }
.tx-trade-row .chev svg { display: block; }
.tx-trade-row.open .chev { transform: rotate(90deg); }
.tx-lots-row td { background: rgba(148, 163, 184, 0.06); font-size: 12px; color: var(--text-dim); text-align: left; white-space: normal; padding: 8px 10px; }
.tx-lots-row b { color: var(--text); font-weight: 600; }

/* Card footers */
.tx-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; font-size: 13px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tx-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--blue); cursor: pointer;
  background: none; border: none; padding: 0; font-family: inherit;
}
.tx-link svg { transition: transform 0.15s; }
.tx-link.open svg { transform: rotate(180deg); }
.tx-totals { display: flex; gap: 18px; color: var(--text-dim); flex-wrap: wrap; }
.tx-totals b { color: var(--text); }
.tx-sell-all b { color: var(--text); }

/* Ledger explanatory lines */
.tx-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.tx-note-line { display: flex; align-items: flex-start; gap: 8px; }
.tx-note-line svg { flex-shrink: 0; display: block; margin-top: 1px; }
.tx-note-line b { color: var(--text); }

/* Loss-harvest candidates */
.tx-harvest-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tx-harvest-row .sym { font-weight: 700; min-width: 56px; }
.tx-harvest-row .meta { flex: 1 1 0; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-harvest-row .loss { font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.tx-harvest-row .saves { font-size: 12px; color: var(--green); font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.tx-info { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.tx-info svg { flex-shrink: 0; display: block; margin-top: 1px; }

/* Responsive */
@media (max-width: 1100px) {
  .tx-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tx-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tx-page { gap: 12px; }
  .tx-topbar { padding-left: 14px; padding-right: 14px; }
  .tx-topbar .actions { width: 100%; justify-content: flex-start; }
  .tx-assume { gap: 8px 14px; padding: 8px 12px; font-size: 12px; }
  .tx-assume-item { white-space: normal; }
  .tx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tx-kpi { padding: 14px; }
  .tx-kpi .k-value { font-size: 20px; }
  .tx-card { padding: 16px; }
  .tx-chart-wrap { height: 180px; }
  .tx-chart-foot { gap: 12px 18px; }
  .tx-chart-foot .tx-note { margin-left: 0; width: 100%; }
}
