:root {
  --primary: #1a3a5c;
  --primary-light: #2563a8;
  --accent: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

/* NAV */
.navbar {
  background: var(--primary);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.3px;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; }

/* Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 56px;
  margin-left: 1.5rem;
}
.nav-dropdown-toggle {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-dropdown-toggle.open { color: #fff; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 160px;
  z-index: 200;
  padding: 0.35rem 0;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1.1rem;
  color: var(--text) !important;
  text-decoration: none;
  font-size: 0.88rem;
  margin: 0 !important;
  white-space: nowrap;
  transition: background 0.1s;
}
.nav-dropdown-menu a:hover {
  background: #f1f5f9;
  color: var(--primary) !important;
}

/* MAIN */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* FLASH MESSAGES */
.flash-messages { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* CARDS */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

/* PAGE TITLE */
.page-header { margin-bottom: 1.75rem; }
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}
.page-subtitle { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.95rem; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-muted   { background: #f1f5f9; color: #64748b; }

/* PROGRESS BAR */
.progress-wrap { margin-bottom: 1.5rem; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.progress-bar-bg {
  background: var(--border);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s;
}
.progress-bar-fill.complete { background: var(--success); }

/* TEAM GRID (index + admin) */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.team-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
}
.team-card.confirmed { border-left: 4px solid var(--success); }
.team-card.pending   { border-left: 4px solid var(--warning); }
.team-card-name { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.team-card-leader { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.team-card-meta { font-size: 0.82rem; color: var(--text-muted); }
.team-card-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* TABLES */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  background: #f8fafc;
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* FORMS */
.form-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input[type="text"].sm { width: 110px; }
input[type="text"].md { width: 180px; }
input[type="text"].lg { width: 240px; }

/* BUTTONS */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* TABS */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* PICK INTERFACE */
.pick-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 700px) { .pick-layout { grid-template-columns: 1fr; } }

.pick-column { display: flex; flex-direction: column; }
.pick-column-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.player-item:hover { border-color: var(--accent); }
.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 500; font-size: 0.92rem; }
.player-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* CONFIRM AREA */
.confirm-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
}
.confirm-box p { font-size: 0.9rem; margin-bottom: 0.75rem; color: #78350f; }
.confirmed-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  text-align: center;
  color: #166534;
  font-weight: 500;
}

/* REPORT */
.report-header { margin-bottom: 2rem; }
.report-team { margin-bottom: 2.5rem; }
.report-team-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.report-team-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.not-ready-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: #9a3412;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.print-btn-wrap { margin-bottom: 1.5rem; }
@media print {
  .navbar, .print-btn-wrap, .not-ready-banner { display: none; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
}

/* LOGIN */
.login-wrap {
  max-width: 380px;
  margin: 4rem auto;
}

/* TOKEN LINK */
.token-link {
  font-family: monospace;
  font-size: 0.78rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  word-break: break-all;
  color: var(--text-muted);
}

/* SCORE BUTTONS */
.score-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.score-btn:hover { background: var(--bg); color: var(--text); }
.score-btn-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* UTILS */
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }
.text-center { text-align: center; }
