:root {
  color-scheme: light;
  --navy: #1b3a4b;
  --teal: #0d9488;
  --teal-dark: #0b766d;
  --red: #dc2626;
  --amber: #d97706;
  --bg: #f7faf9;
  --panel: #ffffff;
  --line: #e5e7eb;
  --muted: #64748b;
  --text: #1e293b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: var(--navy);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  letter-spacing: 0;
  width: 34px;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

nav {
  display: flex;
  gap: 4px;
}

nav a {
  border-bottom: 2px solid transparent;
  color: #475569;
  font-size: 14px;
  font-weight: 650;
  padding: 23px 12px 20px;
}

nav a.active {
  border-color: var(--teal);
  color: var(--teal);
}

.shell {
  margin: 0 auto;
  max-width: 1220px;
  padding: 26px 20px 40px;
}

.hidden {
  display: none !important;
}

.page-title {
  margin-bottom: 22px;
}

.page-title h1 {
  color: var(--text);
  font-size: 26px;
  margin: 0;
}

.page-title p {
  color: var(--muted);
  font-size: 14px;
  margin: 5px 0 0;
}

.panel {
  background: var(--panel);
  border: 1px solid #edf2f7;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel.pad {
  padding: 20px;
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 17px;
  margin: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.grid.cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  background: #f8fafc;
  border-radius: 8px;
  min-height: 88px;
  padding: 14px;
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.value {
  font-size: 24px;
  font-weight: 800;
  margin-top: 6px;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.positive {
  color: var(--teal);
}

.negative {
  color: var(--red);
}

.pending {
  color: var(--amber);
}

.card {
  border-left: 4px solid #94a3b8;
  min-height: 168px;
}

.card h3 {
  font-size: 16px;
  margin: 0;
}

.card p {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 14px;
}

.badge {
  background: #e2e8f0;
  border-radius: 999px;
  color: #334155;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
}

.badge.teal {
  background: #ccfbf1;
  color: #0f766e;
}

.badge.green {
  background: #dcfce7;
  color: #15803d;
}

.badge.red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.gray {
  background: #f1f5f9;
  color: #64748b;
}

.toolbar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

input,
select {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  height: 38px;
  min-width: 150px;
  padding: 0 10px;
}

button {
  background: var(--teal);
  border: 0;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  height: 38px;
  padding: 0 16px;
}

button.secondary {
  background: #e2e8f0;
  color: #334155;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 11px 12px;
  text-align: left;
  text-transform: uppercase;
}

td {
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  padding: 11px 12px;
  vertical-align: top;
}

.right {
  text-align: right;
}

.center {
  text-align: center;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.muted {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  background: #e2e8f0;
  color: #334155;
}

.tabs button.active {
  background: var(--teal);
  color: #fff;
}

.chart-panel {
  min-height: 0;
}

.chart-frame {
  height: 260px;
  position: relative;
  width: 100%;
}

.chart-frame > div,
.chart-frame canvas {
  display: block;
  height: 100% !important;
  max-height: 260px;
  overflow: hidden;
  width: 100% !important;
}

#equityChart,
#monthChart {
  height: 100% !important;
  max-height: 260px !important;
}

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: center;
  gap: 10px;
  padding: 18px;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 0;
  }

  nav {
    overflow-x: auto;
  }

  nav a {
    padding: 12px 10px 10px;
  }

  .grid.kpis,
  .grid.cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .grid.kpis,
  .grid.cards {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 18px 12px 32px;
  }

  .chart-frame {
    height: 220px;
  }
}
