/* Admin dashboard */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  width: 240px;
  height: 100vh;
  flex-shrink: 0;
  background: #111125;
  border-right: 3px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

.admin-brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 1.15rem 1.25rem;
  border-bottom: 3px solid var(--border);
  margin-bottom: 1rem;
}

.admin-logo-link {
  display: block;
  line-height: 0;
  text-decoration: none;
}

.admin-logo-img {
  display: block;
  height: 50px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.nav-logo-text--login {
  font-size: 1.75rem;
}

.ref-avatar {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  background: var(--bg);
  vertical-align: middle;
}

.ref-avatar--sm {
  width: 32px;
  height: 32px;
}

.ref-avatar--lg {
  width: 56px;
  height: 56px;
}

.score-with-avatar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ref-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.score-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.score-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.score-legend-item strong {
  color: var(--text);
  font-weight: 600;
}

.admin-brand .sub {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.65rem;
  flex: 1;
}

.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px 10px 12px;
  font-family: var(--font-heading);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #7878a0;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  box-shadow: none;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(58, 12, 163, 0.12);
}

.nav-btn.active {
  color: #ffd700;
  background: rgba(58, 12, 163, 0.25);
  border-left-color: #ffd700;
}

a.nav-btn-link {
  text-decoration: none;
  display: block;
}

.admin-sidebar-footer {
  padding: 1rem 1.15rem 0;
  border-top: 3px solid var(--border);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2rem 2.5rem;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.85rem;
  margin-bottom: 0.35rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--gold);
  margin: 0 0 1rem;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-grid .stat,
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #1a1a2e;
  border: 2px solid #2a2a45;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #000;
  padding: 1rem 1.15rem;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7878a0;
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 900;
  color: #ffd700;
  line-height: 1.05;
  text-align: center;
}

.stat-value--with-avatar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.stack > .card {
  margin-bottom: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.input,
.select,
.textarea {
  background: var(--bg);
  color: var(--text);
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: inherit;
}

.textarea {
  width: 100%;
  min-height: 120px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid var(--border);
}

th {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: rgba(255, 215, 0, 0.04);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--border);
}

.badge-success {
  background: #22c55e;
  color: #000;
}

.badge-warning {
  background: var(--gold);
  color: #000;
}

.badge-danger {
  background: #ef4444;
  color: #fff;
}

.badge-muted {
  background: var(--surface);
  color: var(--text);
}

.badge-service-role {
  background: #06d6a0;
  color: #000;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  box-shadow: none;
}

.error-banner {
  background: #2a1520;
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.error-banner strong {
  color: #f87171;
}

.loading {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pre-block {
  margin: 0;
  padding: 1rem;
  background: var(--bg);
  border: 3px solid var(--border);
  box-shadow: var(--shadow);
  overflow: auto;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.pre-block.error {
  color: #f87171;
}

.flex-gap {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: min(400px, 100%);
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-card .tagline {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.login-form .input {
  width: 100%;
  margin-bottom: 1rem;
}

.login-form .btn {
  width: 100%;
}

.login-error {
  color: #f87171;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: none;
}

.login-error.visible {
  display: block;
}

.login-message {
  color: #4ade80;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: none;
}

.login-message.visible {
  display: block;
}

.login-link {
  display: block;
  width: 100%;
  margin: -0.25rem 0 1rem;
  padding: 0;
  text-align: right;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-link:hover {
  color: var(--text);
}

.login-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Admin pill buttons (sidebar + toolbars) */
.admin-shell .btn,
.admin-shell button.btn {
  border-radius: 50px;
  border: 2px solid #000;
  box-shadow: 3px 3px 0 #000;
  font-family: var(--font-heading);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-shell .btn:hover:not(:disabled),
.admin-shell button.btn:hover:not(:disabled) {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.admin-sidebar-footer .btn {
  width: 100%;
  text-align: center;
}

.btn-public-site {
  background: #ffd700;
  color: #000;
}

.btn-sign-out {
  background: #f72585;
  color: #fff;
}

.toolbar--filters {
  gap: 0.5rem;
}

.toolbar--filters .input,
.toolbar--filters .select {
  min-width: 8rem;
}

.actions-cell {
  white-space: nowrap;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.toggle-label input {
  accent-color: var(--gold);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-root.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 8px 8px 0 #000;
  border-radius: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 2px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.modal-body {
  padding: 1rem 1.15rem;
  overflow: visible;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.15rem;
  border-top: 2px solid var(--border);
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #7878a0;
}

.form-field .input,
.form-field .select {
  width: 100%;
}

.match-team-fields .team-search {
  margin-bottom: 0.5rem;
}

.match-team-fields .select {
  margin-top: 0;
}

.edge-sync-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.edge-sync-card {
  background: var(--bg);
  border: 2px solid #2a2a45;
  box-shadow: 4px 4px 0 #000;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.edge-sync-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--gold);
}

.edge-sync-meta {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 2.5rem;
}

.edge-sync-meta.success {
  color: #22c55e;
}

.edge-sync-meta.fail {
  color: #f87171;
}

.export-filters {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg);
  border: 2px solid #2a2a45;
  border-radius: 12px;
}

.export-filters h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--gold);
}

.export-filters-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
