:root {
  --bg: #1c1a17;
  --panel: #242220;
  --panel-2: #2c2a27;
  --border: #3d3830;
  --rivet: #c9622a;
  --rivet-dim: #8a4a22;
  --ice: #6f93ad;
  --text: #ede8df;
  --text-dim: #a39c8f;
  --success: #7fae6a;
  --warning: #d1a13c;
  --danger: #c1503f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: 0.04em; margin: 0; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #211f1c, #1c1a17);
}
.plate { display: flex; align-items: center; gap: 14px; }
.plate-mark { color: var(--rivet); font-size: 20px; }
.plate-text h1 { font-size: 22px; font-weight: 600; }
.plate-text p { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

.rule-btn {
  background: transparent;
  border: 1px solid var(--rivet-dim);
  color: var(--rivet);
  padding: 8px 16px;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
}
.rule-btn:hover { background: var(--rivet-dim); color: var(--text); }

.layout { display: flex; min-height: calc(100vh - 78px); }

.team-nav {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  overflow-y: auto;
}
.division-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  padding: 14px 20px 6px;
  letter-spacing: 0.08em;
}
.team-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-dim);
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.team-link:hover { color: var(--text); background: var(--panel); }
.team-link.active { color: var(--text); border-left-color: var(--rivet); background: var(--panel); font-weight: 500; }

.main { flex: 1; padding: 24px 32px 60px; overflow-y: auto; }

.team-header { margin-bottom: 20px; }
.team-header h2 { font-size: 26px; }
.team-header p { margin: 4px 0 0; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 13px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  position: relative;
}
.card::before, .card::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border);
}
.card::before { left: 10px; }
.card::after { right: 10px; }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.card-name { font-family: 'Oswald', sans-serif; font-size: 17px; font-weight: 600; }
.card-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
}
.badge-high { background: rgba(127,174,106,0.15); color: var(--success); border: 1px solid rgba(127,174,106,0.4); }
.badge-medium { background: rgba(209,161,60,0.15); color: var(--warning); border: 1px solid rgba(209,161,60,0.4); }
.badge-low { background: rgba(193,80,63,0.15); color: var(--danger); border: 1px solid rgba(193,80,63,0.4); }

.card-contract { font-size: 13px; color: var(--text); margin: 10px 0 4px; line-height: 1.5; }
.card-contract .money { font-family: 'JetBrains Mono', monospace; color: var(--ice); }

.ahl-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--rivet);
  border: 1px solid var(--rivet-dim);
  background: rgba(201,98,42,0.1);
  padding: 4px 8px;
  border-radius: 3px;
  margin: 6px 0;
}

.gp-row { margin-top: 10px; }
.gp-label { display: flex; justify-content: space-between; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.gp-bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.gp-fill { height: 100%; border-radius: 3px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { font-size: 11px; padding: 3px 8px; border-radius: 3px; background: var(--panel-2); color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

.notes { font-size: 12.5px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; border-top: 1px solid var(--border); padding-top: 8px; }

.sources { margin-top: 10px; display: flex; gap: 12px; }
.sources a { font-size: 11px; color: var(--ice); text-decoration: none; font-family: 'JetBrains Mono', monospace; }
.sources a:hover { text-decoration: underline; }

.empty, .loading, .error {
  margin-top: 60px;
  text-align: center;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.empty-sub { font-size: 12px; margin-top: 6px; }
.error { color: var(--danger); }
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 520px;
  width: 90%;
  padding: 28px 30px;
  position: relative;
}
.modal-card h2 { font-size: 19px; margin-bottom: 14px; }
.modal-card ul { padding-left: 18px; line-height: 1.7; font-size: 14px; }
.modal-card li { margin-bottom: 8px; }
.rule-source { font-size: 11.5px; color: var(--text-dim); margin-top: 14px; font-family: 'JetBrains Mono', monospace; }
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .team-nav { width: 100%; display: flex; overflow-x: auto; padding: 10px; white-space: nowrap; }
  .division-label { display: none; }
  .team-link { display: inline-block; border-left: none; border-bottom: 3px solid transparent; }
  .team-link.active { border-left: none; border-bottom-color: var(--rivet); }
}
