:root {
  --background: radial-gradient(circle at 20% 20%, #18233a, #05070a);
  --surface: rgba(10, 14, 22, 0.9);
  --surface-alt: rgba(17, 21, 32, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #4dd6a2;
  --accent-muted: rgba(77, 214, 162, 0.15);
  --text: #f4f7fb;
  --muted: #98a5c0;
  --danger: #ff6b6b;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.app-shell {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  width: min(960px, 100%);
}

.auth-split-container {
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

@media (min-width: 768px) {
  .auth-split-container {
    flex-direction: row;
  }
}

.auth-section {
  flex: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

.operator-section {
  background: rgba(255, 255, 255, 0.02);
  justify-content: center;
  align-items: center;
  text-align: center;
}

.admin-section {
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .admin-section {
    border-top: 0;
    border-left: 1px solid var(--border);
  }
}

.operator-pin-input {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  color: var(--accent);
  font-size: 2.5rem;
  font-family: monospace;
  width: 180px;
  text-align: center;
  letter-spacing: 0.5rem;
  margin: 1.5rem 0;
  transition: border-color 0.2s ease;
}

.operator-pin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.operator-pin-input::placeholder {
  color: rgba(255, 255, 255, 0.1);
}

.step-label {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.auth-card h1 {
  margin: 0;
  font-size: 2.25rem;
}

.muted {
  color: var(--muted);
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.role-tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.role-tab.active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.login-form label {
  font-size: 0.9rem;
}

.login-form input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem;
  color: var(--text);
  font-size: 1rem;
}

.password-field {
  position: relative;
}

.password-field input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.password-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

.primary-btn {
  margin-top: 0.5rem;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem;
  background: var(--accent);
  color: #03150b;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(77, 214, 162, 0.85);
  outline-offset: 2px;
}

.error-text {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffcdd2;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-top: 1rem;
}

.intro {
  background: transparent;
}

.team-panel {
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 2rem;
}

.team-workspace {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.team-workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.9rem;
}

.team-workspace-tab {
  border-radius: 999px;
}

.team-workspace-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.role-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--accent);
}

.panel-actions {
  display: flex;
  gap: 0.75rem;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
}

.ghost-btn.danger {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.team-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.team-card {
  background: var(--surface-alt);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.team-card h3 {
  margin: 0 0 0.35rem;
}

.team-card-actions {
  margin-top: 0.85rem;
  display: flex;
}

.secondary-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.secondary-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.loading {
  font-size: 1.1rem;
  color: var(--muted);
}

.small-text {
  font-size: 0.85rem;
}

.head-admin-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.head-admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .head-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-card {
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.head-admin-summary-card {
  gap: 1.25rem;
}

.head-admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.head-admin-metric {
  background: var(--surface-alt);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.75rem;
}

.head-admin-metric-value {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.head-admin-metric-label {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-field-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 0.5rem;
  align-items: end;
}

@media (max-width: 700px) {
  .admin-search-form {
    grid-template-columns: 1fr;
  }
}

.admin-form input,
.admin-form select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.85rem;
  color: var(--text);
  font-size: 1rem;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-user-card {
  background: var(--surface-alt);
  border-radius: 16px;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-user-card h3 {
  margin: 0 0 0.5rem;
}

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

.team-chip-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 0.2rem 0.6rem 0.2rem 0.8rem;
}

.team-chip {
  font-size: 0.85rem;
}

.chip-remove {
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.chip-remove:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.roster-panel {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.track-panel {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.clip-panel {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.clip-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clip-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.clip-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.clip-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.clip-label select,
.clip-label input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.65rem;
  color: var(--text);
  font-size: 0.95rem;
}

.clip-slider {
  width: 100%;
  accent-color: var(--accent);
}

.clip-range-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

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

.clip-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.clip-row {
  background: var(--surface-alt);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clip-row-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.clip-row-header h3 {
  margin: 0;
}

.clip-row-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: flex-start;
}

.clip-row-form select,
.clip-row-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem;
  color: var(--text);
}

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

.track-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.track-upload-form input[type="file"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 0.6rem;
  color: var(--muted);
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.track-card {
  background: var(--surface-alt);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.track-info {
  flex: 1;
  min-width: 220px;
}

.track-info h3 {
  margin: 0 0 0.35rem;
}

.track-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.track-meta-item {
  display: inline-flex;
  align-items: center;
}

.track-hash {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.roster-form-wrapper {
  width: 100%;
}

.roster-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.roster-form input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.7rem;
  color: var(--text);
  font-size: 0.95rem;
}

.roster-goalie-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.roster-goalie-toggle.inline {
  margin-left: 0.25rem;
}

.roster-goalie-toggle input {
  width: 1rem;
  height: 1rem;
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.roster-row {
  background: var(--surface-alt);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.roster-row.goalie {
  border-color: rgba(255, 107, 107, 0.5);
}

.roster-slot {
  min-width: 90px;
  font-weight: 600;
  color: var(--muted);
}

.roster-row-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.roster-row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.roster-input {
  flex: 1;
  min-width: 150px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.7rem;
  color: var(--text);
}

.roster-input.small {
  flex: 0 0 90px;
}

.roster-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.reorder-controls {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
}

.assignment-panel {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.success-text {
  background: rgba(77, 214, 162, 0.12);
  border: 1px solid rgba(77, 214, 162, 0.4);
  color: var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin: 0;
}

.assignment-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.assignment-group {
  background: var(--surface-alt);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.assignment-group-title {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.assignment-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.assignment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.assignment-row-info {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  gap: 0.15rem;
}

.assignment-key {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.assignment-friendly {
  margin: 0;
  font-weight: 600;
}

.assignment-select {
  flex: 1;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
}

.assignment-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Keep closed selects in dark theme, but force readable option list contrast. */
.app-shell select {
  color: var(--text);
}

.app-shell select option,
.app-shell select optgroup {
  color: #111827;
  background-color: #f8fafc;
}

.assignment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.operator-pin-panel {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pin-form input {
  flex: 1;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--text);
}

.pin-result {
  background: rgba(77, 214, 162, 0.12);
  border: 1px solid rgba(77, 214, 162, 0.4);
  color: var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pin-result-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.operator-pin-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.operator-pin-card {
  background: var(--surface-alt);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pin-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pin-card-header h3 {
  margin: 0;
}

.pin-status {
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid transparent;
}

.pin-status.active {
  border-color: rgba(77, 214, 162, 0.5);
  color: var(--accent);
}

.pin-status.expired {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--muted);
}

.pin-status.revoked {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.pin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.pin-meta-item {
  display: inline-flex;
  align-items: center;
}

.pin-actions {
  display: flex;
  justify-content: flex-end;
}
