:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-soft: #e0eaff;
  --secondary: #22c55e;
  --amber: #f59e0b;
  --table-header: #dbeafe;
  --table-header-text: #0f172a;
  --table-alt: #f6f9ff;
  --table-hover: #eef4ff;
  --danger: #ef4444;
  --shadow-sm: 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow: 0 14px 45px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-lg: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

a {
  color: var(--primary);
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--text);
}

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

.navbar.app-nav,
.navbar.admin-nav {
  background: #1f2937;
  border-bottom: 1px solid #0f172a;
  color: #e5e7eb;
}

.navbar-dark .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.4);
}
.navbar-dark .navbar-toggler-icon {
  filter: invert(1);
  opacity: 0.8;
}

.navbar.admin-nav .navbar-brand,
.navbar.app-nav .navbar-brand {
  font-weight: 700;
  color: #e5e7eb;
}

.nav-brand-small {
  font-size: 15px;
}

.navbar.admin-nav .nav-link,
.navbar.app-nav .nav-link {
  color: #cbd5e1;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
}

.navbar.admin-nav .nav-link:hover,
.navbar.app-nav .nav-link:hover,
.navbar.admin-nav .nav-link:focus,
.navbar.app-nav .nav-link:focus {
  color: #fff;
}

.nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.nav-user {
  color: #cbd5e1;
  font-weight: 600;
}

.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.25);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
  background: #f1f5f9;
}

.btn-success {
  background: var(--secondary);
  border-color: var(--secondary);
}

.btn-admin {
  background: #ffffff;
  color: #111827;
  border: 1px solid #cbd5e1;
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.12);
}

.btn-admin:hover,
.btn-admin:focus {
  background: #ffffff;
  color: #0f172a;
  border-color: #94a3b8;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.16);
}

.btn-amber {
  background: var(--amber);
  color: #0f172a;
  border: none;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--card);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}

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

.page-title {
  font-size: 22px;
  line-height: 1.25;
  margin: 0;
}

.admin-chip {
  display: inline-block;
  background: #fef08a;
  color: #0f172a;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 800;
}

.page-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.messages-stack > .alert {
  border-radius: var(--radius);
}

.input-group-text,
.form-control,
.form-select,
input,
select,
textarea {
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  background: #f9fbff !important;
  color: var(--text) !important;
  padding: 0.65rem 0.85rem !important;
  font-size: 15px !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
  background: #fff !important;
}

.form-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.95rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

.badge-soft {
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
}

.badge-soft.primary { color: var(--primary); background: #eff6ff; border-color: #dbeafe; }
.badge-soft.success { color: var(--secondary); background: #ecfdf3; border-color: #bbf7d0; }
.badge-soft.warning { color: var(--amber); background: #fef3c7; border-color: #fde68a; }
.badge-soft.muted { color: var(--muted); background: #f8fafc; border-color: var(--border); }

.match-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: center;
}

.match-card .teams {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
}

.team-badge img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.team-badge .team-name {
  font-weight: 700;
  color: var(--text);
}

.match-meta {
  color: var(--muted);
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.page-tab {
  padding: 10px 14px;
  border-radius: 12px 12px 0 0;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.page-tab.active {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: none;
}

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

/* Match form */
.match-form-card {
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.match-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 16px;
  margin-top: 4px;
}
.match-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.match-form-field label {
  font-weight: 700;
  color: var(--text);
}
.match-form-field input,
.match-form-field select,
.match-form-field textarea {
  width: 100%;
  background: #f8fbff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.match-form-divider {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding: 10px 12px;
  background: #0f172a;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 12px;
  text-transform: uppercase;
  font-size: 13px;
}

/* Tables */
.table {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  margin: 0;
}

.table thead th {
  background: var(--table-header);
  color: var(--table-header-text);
  border: none;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 12px;
}

.table td,
.table th {
  font-size: 14px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  min-width: 0;
}

.table tbody td {
  border-top: 1px solid var(--border);
  padding: 12px;
  background: transparent;
}

.table tbody tr:nth-child(odd) td {
  background: #fff;
}

.table tbody tr:nth-child(even) td {
  background: var(--table-alt);
}

.table tbody tr:hover td {
  background: var(--table-hover);
}

.table thead th:first-child { border-top-left-radius: 14px; }
.table thead th:last-child { border-top-right-radius: 14px; }
.table tbody tr:last-child td:first-child { border-bottom-left-radius: 14px; }
.table tbody tr:last-child td:last-child { border-bottom-right-radius: 14px; }

.table-light {
  color: var(--text);
  background: var(--card);
}

.table-light thead {
  background: var(--table-header);
  color: var(--table-header-text);
}

.hero-card {
  background: linear-gradient(180deg, #ffffff 30%, #eef2ff 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.hero-card--compact {
  padding: 10px 14px;
  border-radius: 12px;
}
.line-grid--tight {
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.match-form-container {
  max-width: 1080px;
  margin: 0 auto;
}

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

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #dbeafe;
}

.pill.green { background: #ecfdf3; color: var(--secondary); border-color: #bbf7d0; }
.pill.amber { background: #fef3c7; color: var(--amber); border-color: #fde68a; }

/* Login */
.auth-body {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 920px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.auth-hero-panel {
  background: linear-gradient(150deg, rgba(59, 130, 246, 0.12), rgba(34, 197, 94, 0.08));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.auth-illustration h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form .form-label {
  color: var(--text);
  font-weight: 600;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-brand img {
  width: 48px;
  height: 48px;
}

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.auth-subtitle {
  margin: 0;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.input-with-icon input {
  padding-left: 38px !important;
}

.auth-input {
  height: 46px;
  font-size: 15px;
}

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

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

/* Dashboard / lists */
.match-grid {
  display: grid;
  gap: 12px;
}

/* Match detail */
.line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-row img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table-responsive {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  background: var(--card);
}

.table-responsive .table {
  border: none;
  box-shadow: none;
}

/* Lineup form redesigned */
.lineup-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.lineup-hero-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lineup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.lineup-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.drop-zone {
  border: 1px dashed var(--border);
  border-radius: 12px;
  min-height: 140px;
  padding: 12px;
  background: #f8fafc;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.available-zone {
  max-height: 520px;
  overflow: auto;
}

.player-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.player-chip:hover {
  border-color: var(--primary);
}

.player-name {
  font-weight: 700;
  color: var(--text);
}

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

.chip-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-actions {
  display: flex;
  gap: 6px;
}

.assign-btn {
  min-width: 54px;
  height: 28px;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  background: #0d1b4c;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.08s ease, box-shadow 0.1s ease;
}

.assign-btn.assign-sub {
  background: #c2410c;
}

.assign-btn:hover,
.assign-btn:focus {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.player-chip .player-actions {
  display: none;
}

.player-chip.in-available .player-actions {
  display: flex;
}

.jersey-input {
  display: inline-block;
  width: 56px !important;
  min-width: 54px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px;
  padding: 6px 8px !important;
  font-weight: 700;
  text-align: center;
  font-size: 14px;
  line-height: 1.25;
  color: #0a0f25 !important;
  background: #fff !important;
  letter-spacing: 0.2px;
}

.jersey-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #e0eaff;
}

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

.lineup-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.search-input {
  border-radius: 10px !important;
}

.lineup-page .section-card {
  padding: 10px;
  border-radius: 12px;
}

.lineup-page .lineup-hero {
  padding: 10px;
  gap: 10px;
}

.lineup-page .page-title {
  font-size: 20px;
}

.lineup-page .page-subtitle {
  font-size: 12px;
}

.lineup-page .lineup-section-head {
  gap: 6px;
}

.lineup-page .section-title {
  font-size: 13px;
}

.lineup-page .lineup-grid {
  gap: 8px;
}

.lineup-page .drop-zone {
  min-height: 100px;
  padding: 8px;
}

.lineup-page .drop-title {
  font-weight: 700;
}

.lineup-page .available-zone {
  max-height: 360px;
}

.lineup-page .player-chip {
  padding: 7px 9px;
  margin-bottom: 6px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.lineup-page .player-name {
  font-size: 14px;
  font-weight: 600;
}

.lineup-page .player-meta {
  font-size: 12px;
}

.lineup-page .jersey-input {
  width: 56px !important;
  min-width: 54px;
  padding: 6px 8px !important;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: #0a0f25 !important;
  background: #fff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px;
}

.lineup-page .assign-btn {
  min-width: 54px;
  height: 28px;
  font-size: 12px;
  border-radius: 6px;
}

.lineup-page .lineup-actions {
  margin-top: 12px;
}

.lineup-page .lineup-section-head .pill.soft {
  background: #0d1b4c;
  color: #fff;
}

@media (max-width: 992px) {
  .auth-card {
    grid-template-columns: 1fr;
  }
  .lineup-panels {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .card-actions {
  justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .page-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  .page-tab {
    width: 100%;
    border-radius: 10px;
  }
  .lineup-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .lineup-hero-meta {
    flex-wrap: wrap;
  }
  .team-row {
    flex-direction: row;
    justify-content: flex-start;
  }
  .hero-card .line-grid,
  .line-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 576px) {
  .navbar-brand.nav-brand-small {
    font-size: 14px;
  }
  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  .page-title {
    font-size: 20px;
  }
  .page-subtitle {
    font-size: 13px;
  }
  .kpi-card {
    padding: 12px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .section-title {
    font-size: 14px;
  }
  .team-row img {
    width: 52px;
    height: 52px;
  }
  .line-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .match-card {
    padding: 12px;
  }
  .page-tabs {
    gap: 6px;
  }
}
