:root {
  --bg-color: #1b2233;
  --bg-secondary: #273149;
  --text-main: #ffffff;
  --text-muted: #c6d0e3;
  --accent-cyan: #9a7ae0;
  --accent-purple: #6b3bb8;
  --accent-red: #ff4d67;
  --accent-green: #00ff66;
  --glass-bg: rgba(39, 49, 73, 0.88);
  --glass-border: rgba(255, 255, 255, 0.16);
  --font-main: 'Outfit', sans-serif;
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: radial-gradient(circle at 15% 50%, rgba(107, 59, 184, 0.22), transparent 30%),
    radial-gradient(circle at 85% 30%, rgba(154, 122, 224, 0.16), transparent 30%);
}

a {
  color: inherit;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: rgba(27, 34, 51, 0.92);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
}

.logo-image {
  display: block;
  max-width: 100%;
  width: 321px;
  max-height: 134px;
  object-fit: contain;
  filter: brightness(1.22) contrast(1.08) saturate(1.05);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.25s ease;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.12), transparent);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
}

.user-profile-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--glass-border);
}

.sidebar-footer {
  margin-top: 16px;
}

.sidebar-logout {
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 77, 103, 0.22), rgba(176, 38, 255, 0.18));
}

.sidebar-logout-form {
  width: 100%;
}

.sidebar-logout-form button {
  width: 100%;
}

.sidebar-footer .user-profile-mini {
  padding-top: 0;
  border-top: 0;
  margin-bottom: 12px;
}

.sidebar-footer .inline-actions {
  width: 100%;
}

.sidebar-footer .inline-actions form,
.sidebar-footer .inline-actions button {
  width: 100%;
}

.sidebar-footer .inline-actions button {
  justify-content: center;
}


.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--accent-purple);
}

.user-profile-mini .name {
  font-weight: 600;
  font-size: 14px;
}

.user-profile-mini .role {
  font-size: 12px;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  padding: 32px 48px;
  overflow-y: auto;
}

.view-header {
  margin-bottom: 24px;
}

.view-header h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 800;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
}

.helper-copy {
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-span-2 {
  grid-column: span 2;
}

.account-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.users-edit-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.match-edit-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.badge-admin {
  background: rgba(154, 122, 224, 0.18);
  color: #e1d4ff;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.badge-success {
  background: rgba(0, 255, 102, 0.14);
  color: var(--accent-green);
}

.badge-loss {
  background: rgba(255, 77, 103, 0.14);
  color: #ff9aaa;
}

.message-success {
  background: rgba(0, 255, 102, 0.12);
  color: var(--accent-green);
  border-color: rgba(0, 255, 102, 0.24);
}

.message-error {
  background: rgba(255, 77, 103, 0.14);
  color: #ff9aaa;
  border-color: rgba(255, 77, 103, 0.25);
}

select option:disabled {
  color: #6b7280;
}

input[minlength] {
  letter-spacing: 0.01em;
}

@media (max-width: 960px) {
  .grid-span-2 {
    grid-column: span 1;
  }

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


.helper-actions {
  margin-bottom: 18px;
}

.helper-button {
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(154, 122, 224, 0.28);
}

.bookmarklet-actions {
  align-items: flex-start;
  flex-wrap: wrap;
}

.bookmarklet-plain-link {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1px dashed rgba(154, 122, 224, 0.45);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 700;
  min-height: 50px;
}

.bookmarklet-steps {
  margin: 0 0 18px 18px;
  padding: 0;
}

.bookmarklet-steps li {
  margin-bottom: 8px;
}

.helper-status {
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.helper-status.visible {
  opacity: 1;
  transform: translateY(0);
}

.helper-status.success {
  background: rgba(0, 255, 102, 0.16);
  border-color: rgba(0, 255, 102, 0.35);
}

.helper-status.error {
  background: rgba(255, 77, 103, 0.16);
  border-color: rgba(255, 77, 103, 0.35);
}

.helper-status.loading {
  background: rgba(154, 122, 224, 0.18);
  border-color: rgba(154, 122, 224, 0.35);
}

button[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.import-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

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

.nested-panel {
  margin-top: 16px;
  margin-bottom: 16px;
}

.glass-card,
.panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 24px;
  margin-bottom: 24px;
}

.neon-border {
  position: relative;
}

.neon-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(45deg, var(--accent-cyan), var(--accent-purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.55;
  pointer-events: none;
}

.dashboard-grid,
.nav-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.stat-card h3,
.panel h2 {
  margin-top: 0;
}

.stat-card h3 {
  color: var(--text-muted);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.value {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
}

.profile-summary-value {
  font-size: 28px;
  line-height: 1.1;
}

.trend {
  font-size: 14px;
  font-weight: 600;
}

.trend.positive { color: var(--accent-green); }
.trend.negative { color: var(--accent-red); }
.trend.neutral { color: var(--accent-cyan); }

.fixture-item,
.standings-row,
.assignment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.fixture-item:last-child,
.standings-row:last-child,
.assignment-row:last-child {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.button,
button,
.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.2), rgba(176, 38, 255, 0.2));
  color: var(--text-main);
  padding: 0.85rem 1.1rem;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}

.secondary-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

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

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

input,
select {
  width: 100%;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.04);
  color: var(--text-main);
}

option {
  color: #111827;
}

form.inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.mini-grid {
  display: grid;
  gap: 8px;
}

.mini-grid.two-col {
  grid-template-columns: repeat(2, minmax(110px, 1fr));
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.inline-check input {
  width: auto;
}

.danger-form button {
  background: linear-gradient(90deg, rgba(255, 77, 103, 0.22), rgba(176, 38, 255, 0.18));
}

.message {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(0, 240, 255, 0.12);
  color: var(--accent-cyan);
  margin-bottom: 1rem;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

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

table,
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

tr:hover {
  background: rgba(255,255,255,0.02);
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  flex-wrap: wrap;
}

.highlight-row {
  background: rgba(0, 240, 255, 0.08);
}

.highlight-row:hover {
  background: rgba(0, 240, 255, 0.12);
}

#playerSearch {
  width: 100%;
}

.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-image: url('/avatar1.png');
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(0, 240, 255, 0.35);
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
  font-size: 13px;
  font-weight: 700;
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.4rem;
}

.match-confidence.exact {
  background: rgba(0, 255, 102, 0.16);
  color: var(--accent-green);
}

.match-confidence.likely {
  background: rgba(154, 122, 224, 0.18);
  color: #d9c9ff;
}

.match-confidence.none {
  background: rgba(255, 77, 103, 0.16);
  color: #ff9aaa;
}

.inference-note {
  display: inline-block;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.bookmarklet-link {
  user-select: all;
}

.empty-state {
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .page-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .main-content {
    padding: 24px;
  }

  .dashboard-split {
    grid-template-columns: 1fr;
  }
}
