:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding: 24px 28px 48px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
h1 { margin: 0 0 4px; font-size: 28px; }
h2 { margin: 8px 0 8px; font-size: 20px; }
.sub, .caption, footer { color: var(--muted); }
.caption { margin: 0 0 14px; line-height: 1.45; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 18px 0 22px;
}
.controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.controls input, .controls select {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.controls input[type="date"], .controls select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.controls small {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #94a3b8;
  max-width: 220px;
  line-height: 1.35;
}
.explain {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 8px;
}
table.compare {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
}
table.compare th, table.compare td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line);
}
table.compare th:first-child, table.compare td:first-child {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}
table.compare thead th {
  text-align: right;
  color: var(--ink);
}
table.compare tbody tr.section th {
  text-align: left;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 700;
}
.updated {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.metric .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.metric .v { font-size: 20px; font-weight: 650; margin-top: 4px; }
.metric .d { font-size: 12px; margin-top: 4px; color: var(--muted); }
.chart {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 620px;
}
.chart.tall { height: 900px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
footer details { margin-top: 24px; }
footer li { margin: 6px 0; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 18px;
  margin: 18px 0 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.tab-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 4px 10px;
  margin-bottom: -11px;
  font-size: 15px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}
.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab-hl {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  max-width: 280px;
}
.tab-hl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}
.tab-hl small {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #94a3b8;
  line-height: 1.3;
}
.panel { display: none; }
.panel.active { display: block; }

.sum-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(220px, 1.1fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr);
  gap: 12px 14px;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 10px;
}
.sum-name {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.sum-name button {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}
.sum-name .last { font-size: 18px; font-weight: 650; }
.sum-name .when { font-size: 12px; color: var(--muted); }
.sum-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  font-size: 12px;
}
.sum-stats .k { color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; font-size: 10px; }
.sum-stats .v { font-size: 15px; font-weight: 650; margin-top: 2px; }
.sum-stats .d { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sum-z.neg { color: #dc2626; }
.sum-z.pos { color: #16a34a; }
.mini {
  height: 132px;
  min-width: 0;
}
.top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.sign-out {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.login-wrap {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
}
.login-card h1 { font-size: 26px; }
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 18px 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.login-card input {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.login-card button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.login-error {
  color: #b91c1c;
  font-size: 14px;
  margin: 0 0 12px;
}
@media (max-width: 1100px) {
  .sum-row {
    grid-template-columns: 1fr 1fr;
  }
  .mini { height: 140px; }
}
