* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: #0f1222;
  color: #e6e8ef;
  line-height: 1.45;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: linear-gradient(135deg, #1a1f3a 0%, #2a1b4a 100%);
  border-bottom: 1px solid #2a2e4a;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.2px; }
.brand .subtitle { margin: 2px 0 0; color: #9aa0b8; font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.year-picker { display: flex; gap: 6px; align-items: center; background: #272b47; padding: 4px 8px; border-radius: 7px; }
.year-picker label { display: flex; gap: 4px; align-items: center; color: #9aa0b8; font-size: 12px; }
.year-picker select {
  background: #0f1222;
  border: 1px solid #2a2f4a;
  color: #e6e8ef;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 13px;
}
.btn-sm { padding: 5px 9px; font-size: 12px; }
.include-toggle {
  display: flex; gap: 6px; align-items: center;
  color: #cfd3e8; font-size: 13px;
  background: #272b47;
  padding: 6px 10px;
  border-radius: 7px;
}
.include-toggle input { margin: 0; }
#last-refresh { font-size: 12px; }

button, .btn-secondary {
  background: #4b6bff;
  color: #fff;
  border: none;
  padding: 9px 16px;
  font-size: 14px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: transform 0.1s, background 0.1s;
}
button:hover { background: #3d58d9; }
button:disabled { opacity: 0.5; cursor: wait; }
.btn-secondary { background: #272b47; }
.btn-secondary:hover { background: #323857; }

nav.tabs {
  display: flex;
  gap: 6px;
  padding: 0 28px;
  background: #10142a;
  border-bottom: 1px solid #252a45;
  position: sticky;
  top: 82px;
  z-index: 9;
}
nav.tabs .tab {
  background: transparent;
  color: #9aa0b8;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
}
nav.tabs .tab:hover { color: #fff; background: transparent; }
nav.tabs .tab.active {
  color: #fff;
  border-bottom-color: #4b6bff;
}

main {
  padding: 24px 28px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: #1a1f3a;
  border: 1px solid #252a45;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label { color: #8f95b2; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 24px; font-weight: 700; color: #fff; }

.target-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.target {
  background: linear-gradient(135deg, #1f2a4d 0%, #3a1f4d 100%);
  border: 1px solid #3d4170;
  border-radius: 12px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.target.charles { border-color: #4b6bff; }
.target.karina { border-color: #d65dd6; }
.target h3 { margin: 0 0 6px; font-size: 18px; }
.target .rank { font-size: 36px; font-weight: 800; color: #fff; margin: 4px 0; }
.target .rank small { font-size: 14px; font-weight: 400; color: #9aa0b8; margin-left: 6px; }
.target .row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: #cfd3e8; }
.target .row > div b { color: #fff; font-size: 15px; }
.target .pctbar { margin-top: 12px; background: #1a1f3a; height: 10px; border-radius: 5px; overflow: hidden; }
.target .pctbar div { height: 100%; background: linear-gradient(90deg, #4b6bff, #d65dd6); }

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.card {
  background: #1a1f3a;
  border: 1px solid #252a45;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; color: #cfd3e8; font-weight: 600; }
canvas { max-height: 260px; }

.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.controls { display: flex; gap: 12px; align-items: center; }
.controls input[type=search] { background: #0f1222; border: 1px solid #2a2f4a; color: #e6e8ef; padding: 7px 10px; border-radius: 6px; min-width: 220px; }
.controls label { color: #9aa0b8; font-size: 13px; display: flex; gap: 6px; align-items: center; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #252a45; }
th { color: #9aa0b8; font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; position: sticky; top: 0; background: #1a1f3a; }
tr.zero { opacity: 0.55; }
tr.charles { background: rgba(75, 107, 255, 0.14); border-left: 3px solid #4b6bff; }
tr.karina { background: rgba(214, 93, 214, 0.14); border-left: 3px solid #d65dd6; }
tr.podium-1 td:first-child { color: #ffd24a; font-weight: 700; }
tr.podium-2 td:first-child { color: #c8cdd8; font-weight: 700; }
tr.podium-3 td:first-child { color: #d59d6a; font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(255,255,255,0.04); }

.tier-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-weight: 700; font-size: 11px; color: #fff; }
.t4s { background: #e53935; }
.t4  { background: #ff9800; }
.t3  { background: #43a047; }
.t2  { background: #1e88e5; }
.t1  { background: #8e24aa; }

.muted { color: #9aa0b8; }

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #272b47;
  color: #fff;
  padding: 10px 16px;
  border-radius: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  max-width: 340px;
}
#toast.show { opacity: 1; }
