:root {
  --bg: #0b0c0f; --card: #16181d; --card2: #1c1f26; --border: #262a33;
  --text: #eceef1; --muted: #8a92a3;
  --accent: #3ecf8e; --red: #f0555a; --yellow: #e0b23c; --blue: #4a9eff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, Segoe UI, Roboto, sans-serif; }

.topbar {
  display: flex; align-items: center; gap: 24px; padding: 14px 24px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 17px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab-btn {
  background: none; border: none; color: var(--muted); padding: 8px 14px; border-radius: 8px;
  font-size: 14px; cursor: pointer; font-weight: 500;
}
.tab-btn.active { background: var(--card2); color: var(--text); }
.updated { color: var(--muted); font-size: 12px; }

main { padding: 20px 24px 60px; max-width: 1280px; margin: 0 auto; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card .label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.card .value { font-size: 24px; font-weight: 700; }
.value.pos { color: var(--accent); } .value.neg { color: var(--red); }

.section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.section h2 { font-size: 13px; margin: 0 0 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.section-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .section-row { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.institution { display: flex; align-items: center; gap: 10px; }
.logo { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.acc-name .sub { color: var(--muted); font-size: 12px; }

.bar-bg { background: #262a33; border-radius: 4px; height: 6px; overflow: hidden; margin-top: 6px; }
.bar-fill { background: var(--yellow); height: 100%; }
.bar-fill.blue { background: var(--blue); }

.alert { background: #3a2416; border: 1px solid var(--yellow); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 13.5px; }
.muted { color: var(--muted); }
.error { color: var(--red); }
#loading { color: var(--muted); padding: 40px 0; text-align: center; }

.chart-wrap { position: relative; height: 260px; }

select, input, button.btn {
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 7px 10px; font-size: 13.5px;
}
button.btn { cursor: pointer; }
button.btn.primary { background: var(--accent); color: #0b0c0f; border: none; font-weight: 600; }
button.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-row .field { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }

.badge { font-size: 10.5px; padding: 2px 7px; border-radius: 20px; background: var(--card2); color: var(--muted); }
.badge.internal { background: #2a2e38; color: var(--blue); }
.badge.manual { background: #23331f; color: var(--accent); }

.metric-list { display: flex; flex-direction: column; gap: 10px; }
.metric-list .row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.metric-list .row:last-child { border-bottom: none; }
