body[data-page="tco"] .tco-profit-chart {
  --chart-bg: #141e25;
  --panel-bg: #1c272f;
  --panel-border: #394b56;
  --chart-ink: #f2f6f8;
  --chart-muted: #becdd6;
  --income-bar: #ffcf3c;
  --expense-bar: #9bb5c3;
  --plot-height: 220px;
  min-width: 0;
  min-height: 0;
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid #283a46;
  border-radius: 15px;
  background: var(--chart-bg);
  color: var(--chart-ink);
}

.tco-profit-chart h2 {
  margin: 0;
  color: var(--chart-ink);
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  line-height: 1.25;
}
.tco-period-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 15px 0 12px;
}
.tco-period-totals > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
}
.tco-period-totals > div:last-child { border-color: #8c763c; }
.tco-period-totals dt {
  color: var(--chart-muted);
  font-size: .875rem;
  line-height: 1.35;
}
.tco-period-totals dd {
  margin: 0;
  color: var(--chart-ink);
  font-size: clamp(1.13rem, 2.7vw, 1.95rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.tco-period-totals dd.is-positive { color: #ffe27a; }
.tco-period-totals dd.is-negative { color: #ffad9e; }

.tco-plot-card {
  min-width: 0;
  padding: clamp(12px, 2.4vw, 22px);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: var(--panel-bg);
}
.tco-plot-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.tco-plot-heading h3 { margin: 0; color: var(--chart-ink); font-size: 1.125rem; }
.tco-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin: 0;
  padding: 0;
  color: var(--chart-muted);
  font-size: .875rem;
  list-style: none;
}
.tco-bar-legend li { display: flex; align-items: center; gap: 6px; }
.tco-bar-legend li[hidden] { display: none; }
.tco-bar-key { width: 10px; height: 10px; border-radius: 2px; }
.tco-profit-chart :is(.tco-bar-key, .tco-bar).income { background: var(--income-bar); }
.tco-profit-chart :is(.tco-bar-key, .tco-bar).income.is-historical {
  background: repeating-linear-gradient(135deg, #ffcf3c 0 4px, #9d7835 4px 8px);
}
.tco-profit-chart :is(.tco-bar-key, .tco-bar).expense { background: var(--expense-bar); }

body[data-page="tco"] .tco-profit-chart .cumulative-chart {
  display: grid;
  grid-template-columns: minmax(52px, 76px) minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin: 18px 0 0;
  overflow: visible;
}
.tco-bar-axis {
  display: grid;
  grid-template-rows: repeat(4, 1fr) 0;
  height: var(--plot-height);
  padding-right: 4px;
  color: var(--chart-muted);
  font-size: .75rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tco-bar-axis span { transform: translateY(-.55em); white-space: nowrap; }
.tco-bar-plot {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(var(--groups), minmax(0, 1fr));
  gap: clamp(3px, 1.3vw, 15px);
  background-image: linear-gradient(to bottom, #8299a54d 1px, transparent 1px);
  background-size: 100% calc(var(--plot-height) / 4);
  background-repeat: repeat-y;
}
.tco-bar-group {
  display: grid;
  grid-template-rows: var(--plot-height) auto;
  align-items: end;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: var(--chart-muted);
  background: transparent;
  cursor: pointer;
  text-align: center;
}
.tco-bar-group:hover { background: #9bb5c311; }
.tco-bar-group:focus-visible { outline: 2px solid var(--income-bar); outline-offset: 2px; }
.tco-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(3px, .65vw, 8px);
  height: var(--plot-height);
  border-bottom: 1px solid #8299a54d;
}
.tco-bar { display: block; width: min(38%, 46px); border-radius: 4px 4px 0 0; }
.tco-bar-month {
  display: block;
  padding: 6px 1px 4px;
  background: var(--panel-bg);
  font-size: .8125rem;
  line-height: 1.25;
}
.tco-bar-group[aria-pressed="true"] .tco-bar-month { color: #ffe27a; font-weight: 800; }

.tco-chart-reading {
  margin: 10px 0 0;
  color: var(--chart-ink);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.tco-month-details { margin-top: 10px; border-top: 1px solid var(--panel-border); }
.tco-month-details summary {
  width: fit-content;
  min-height: 36px;
  padding-block: 8px;
  color: var(--chart-muted);
  font-size: .875rem;
  cursor: pointer;
}
.tco-month-details table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tco-month-details :is(th, td) {
  padding: 5px 8px;
  border-bottom: 1px solid var(--panel-border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  color: var(--chart-ink);
}
.tco-month-details th:first-child { text-align: left; }
body[data-page="tco"] .tco-profit-chart :is(.tco-chart-note, .tco-history-toggle) { color: var(--chart-muted); font-size: .875rem; }
body[data-page="tco"] .tco-profit-chart .tco-history-toggle input { accent-color: var(--income-bar); }

@media (max-width: 560px) {
  body[data-page="tco"] .tco-profit-chart { --plot-height: 153px; }
  .tco-period-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .tco-period-totals > div { padding: 9px; }
  .tco-period-totals > div:last-child { grid-column: 1 / -1; }
  .tco-period-totals :is(dt, dd) { overflow-wrap: anywhere; }
  body[data-page="tco"] .tco-profit-chart .cumulative-chart { grid-template-columns: minmax(42px, 60px) minmax(0, 1fr); gap: 4px; }
  .tco-bar-axis { font-size: .6875rem; }
  .tco-bar-month { font-size: .75rem; }
  .tco-month-details :is(th, td) { padding-inline: 3px; font-size: .8125rem; }
}
