:root {
  --red: #c4122f;
  --gold: #d4af37;
  --green: #00a86b;
  --bg: #090909;
  --surface: #151515;
  --surface2: #202020;
  --line: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --muted: #a8a8a8;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(196, 18, 47, 0.28), transparent 30%),
    radial-gradient(circle at 80% 15%, rgba(212, 175, 55, 0.18), transparent 32%),
    var(--bg);
}

.login-card {
  width: min(100%, 390px);
  padding: 28px;
  background: rgba(21, 21, 21, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.login-logo, .side-logo {
  width: 170px;
  height: auto;
  display: block;
}

.eyebrow {
  margin: 22px 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 22px;
  font-size: 32px;
  line-height: 1;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.panel-head select {
  max-width: 220px;
}

#resultPhaseFilter {
  display: none;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
}

.switch-row input {
  width: 18px;
  height: 18px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: white;
  padding: 12px 16px;
  font-weight: 900;
  cursor: pointer;
}

button.secondary {
  margin-left: 8px;
  background: var(--surface2);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.error { color: #ff596b; min-height: 18px; }

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  background: #101010;
  border-right: 1px solid var(--line);
}

.nav, .logout {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  border: 1px solid transparent;
}

.nav.active {
  background: rgba(196, 18, 47, 0.14);
  color: white;
  border-color: rgba(196, 18, 47, 0.35);
}

.logout {
  margin-top: 28px;
  color: #ff8996;
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar .eyebrow { margin-top: 0; }

.tab { display: none; }
.tab.active { display: block; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.status-box {
  margin-bottom: 14px;
}

.app-grid {
  grid-template-columns: 2fr 1fr 1fr;
}

.table {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.row.four { grid-template-columns: 1fr 1fr 1fr auto; }
.row.three { grid-template-columns: 1.4fr 0.5fr 0.8fr; }
.row.two { grid-template-columns: 1fr auto; }
.row.result { grid-template-columns: minmax(260px, 1.4fr) 74px 74px minmax(150px, 0.8fr) 150px; }
.row.detail { grid-template-columns: 1.2fr 1fr 1fr 90px; }
.row.user { grid-template-columns: 1.3fr 1fr 1fr auto; }
.result-section-title {
  margin: 16px 0 8px;
  padding: 10px 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.08);
}
.result-section-title:first-child { margin-top: 0; }

.row small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.ok { color: var(--green); }
.warn { color: var(--gold); }
.bad { color: #ff596b; }

.mini {
  padding: 8px 10px;
  font-size: 12px;
}

.score-input {
  min-width: 0;
  padding: 9px 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.toast.show { display: block; }

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .cards, .grid-form {
    grid-template-columns: 1fr;
  }

  .control-grid,
  .row, .row.four, .row.three, .row.two, .row.result, .row.detail, .row.user {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head select {
    max-width: none;
  }
}
