html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #f7f7f8;
  color: #111827;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Cards ===== */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
  scroll-margin-top: calc(var(--sticky-offset) + 14px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.card-title {
  margin: 0;
  font-size: 16px;
}

.card-subtitle {
  margin: 2px 0 0;
  color: #6b7280;
}

.card-body {
  padding: 16px;
}

.card-head-right {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: #014421;
  color: #fff;
  border: 1px solid #fff;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  margin-top: 12px;
  cursor: pointer;
}

.btn:hover {
  background: #588157;
  color: #fff;
  border-color: #fff;
  text-decoration: none;
}

.btn-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  width: 100%;
}

.btn-intable {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  text-decoration: none;
  color: #111827;
  cursor: pointer;
}

.btn-intable[aria-disabled="true"] {
  opacity: 0.7;
  cursor: default;
}

.btn-intable:hover {
  background: #588157;
  color: #fff;
  border-color: #fff;
  text-decoration: none;
}

/* ===== Flags ===== */
.flag {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex: 0 0 auto;
  display: inline-block;
  margin-right: 1px;
}

.fi.flag {
  width: 18px;
  height: 12px;
  display: inline-block;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06) inset;
  margin-right: 1px;
}

.players td .fi.flag {
  vertical-align: -2px;
}

.nation {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* =========================
   Notifications (namespaced)
   ========================= */
.nt {
  box-sizing: border-box;
}

.nt-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.nt-item {
  display: grid;
  /* dot | date | subject | team | league */
  grid-template-columns: 24px 200px 1fr 200px 200px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}

.nt-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-color: #e5e7eb;
}

/* Unread: inset bar keeps layout stable */
.nt-item.unread {
  background: rgba(230, 239, 230, 0.525);
  box-shadow: inset 4px 0 0 #014421, 0 1px 1px rgba(0, 0, 0, 0.02);
}

.nt-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  justify-self: center;
  background: transparent;
  border: 1px solid #d1d5db;
}

.nt-item.unread .nt-dot {
  background: #014421;
  border-color: #014421;
}

.nt-date {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.nt-team,
.nt-league {
  font-size: 13px;
  color: #111827;
}

/* Subject (button) */
.nt-subject {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 10px 12px 10px 0;
  margin-left: 12px;
  cursor: pointer;
  text-align: left;
  justify-self: stretch;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  color: #111827;
}

.nt-subject.unread {
  font-weight: 600;
}

.nt-subject:focus-visible {
  outline: 2px solid #014421;
  outline-offset: 2px;
  border-radius: 6px;
}

/* Expanded body appears only under the subject column */
.nt-body {
  display: none;
  grid-column: 3;     /* ⬅️ subject column */
  grid-row: 2;        /* under the header line */
  padding: 0 12px 12px 0;
  border-top: none;
}

.nt-body.show { display: block; }

/* Chat bubble */
.notif-bubble {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(230, 239, 230, 0.525);
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Responsive */
@media (max-width: 900px){
  .nt-header,
  .nt-item {
    /* dot | date | subject | team | league */
    grid-template-columns: 24px 160px 1fr 180px 160px;
  }
}

@media (max-width: 720px) {
  .nt-header {
    grid-template-columns: 24px 1fr;
  }

  .nt-header .nt-head-col:nth-child(-n + 4) {
    display: none;
  }

  .nt-item {
    grid-template-columns: 24px 1fr;
    align-items: start;
  }

  .nt-date,
  .nt-team,
  .nt-league {
    display: none;
  }

  .nt-subject,
  .nt-body {
    grid-column: 2 / -1;
    padding-right: 0;
  }
}

/* =========================
   Dropdowns (unified)
   ========================= */
.dropdown {
  position: relative;
}

.dropdown-btn {
  cursor: pointer;
  user-select: none;
}

.dropdown-content {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  max-height: 60vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  display: none;
  z-index: 1002;
}

/* toggle (use .open on parent) */
.dropdown.open>.dropdown-content {
  display: block;
}

/* Club card variant */
.dropdown.club-dd .dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.dropdown.club-dd .dropdown-btn:hover {
  background: #f9fafb;
}

.dropdown.club-dd .dropdown-btn:focus {
  outline: 2px solid #d1d5db;
  outline-offset: 2px;
}

.dropdown.club-dd .dropdown-content {
  top: 100%;
  right: 0;
  min-width: 220px;
}

.dropdown.club-dd .dropdown-group-title {
  font-weight: 600;
  color: #374151;
  background: #f9fafb;
  display: block;
  padding: 8px 12px;
  font-size: 14px;
}

.dropdown.club-dd .dropdown-content a {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  color: #111827;
  text-decoration: none;
}

.standard-text {
  font-size: 12px;
  color: #000;
  text-decoration: none;
}

/* Owner notice above pitch */
.round-notice {
  display: none;
  /* default hidden; shown via PHP when relevant */
  margin: 0 auto 12px;
  padding: 12px 14px;
  border: 1px solid #f59e0b;
  /* amber */
  background: #fff7ed;
  /* light amber */
  color: #7c2d12;
  /* dark amber text */
  font-size: 12px;
  border-radius: 10px;
  line-height: 1.35;
  max-width: 100%;
}

.round-notice strong {
  color: #7c2d12;
}

/* in global.css */
.round-notice.show {
  display: block !important;
}

.round-notice.show-pitch {
  display: block !important;
  max-width: 900px !important;
}

/* === Live column (tight) === */
th.col-live,
td.col-live {
  width: 20px;
  /* was 32px */
  text-align: center !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
}

th.col-live {
  color: #6b7280;
  font-weight: 500;
}

.live-dot {
  display: inline-block;
  width: 8px;
  /* was 10px */
  height: 8px;
  border-radius: 9999px;
  background: #93dc5c;
  /* green */
  vertical-align: middle;
  animation: livePulse 1.2s ease-in-out infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.pause-ind {
  display: inline-block;
  line-height: 1;
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
  /* amber */
  transform: translateY(-1px);
}

/* Page-specific (teams only). Notifications are in global.css via .nt-* */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .team-grid {
    grid-template-columns: 1fr;
  }
}

.team-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.team-card .card-head h3 {
  margin: 0;
  font-size: 16px;
}

.team-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.team-meta {
  display: grid;
  gap: 8px;
}

.team-meta .row {
  display: flex;
  gap: 8px;
}

.team-meta .label {
  width: 150px;
  color: #6b7280;
}

.team-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.lb-wrap {
  overflow: auto;
}

.lb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
}

.lb-table thead th {
  text-align: left;
  padding: 6px 12px;
  background: #fafafa;
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.lb-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid #f1f1f1;
  vertical-align: middle;
}

/* Header alignment for points */
.lb-table thead th.lb-points {
  text-align: right;
}

/* === Tight column widths === */
.lb-rank {
  width: 80px;
  /* was 120px */
  font-weight: 700;
  white-space: nowrap;
}

/* Captain col (new explicit width) */
th.col-captain,
td.col-captain {
  width: 30px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.lb-points {
  width: 80px;
  /* was 160px */
  text-align: right;
  white-space: nowrap;
}

.lb-team a {
  color: #111827;
  text-decoration: none;
}

.lb-team a:hover {
  text-decoration: underline;
}

.lb-me {
  background: rgba(230, 239, 230, 0.525);
}

/* Selection column */
.col-select {
  width: 16px;
  text-align: center;
}

.col-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Disabled row (eg: make-admin on already-admin) */
.lb-table tr.disabled-row {
  opacity: 0.5;
}

.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  text-decoration: none;
  color: #111827;
}

.pagination .current {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

/* Inline alerts / confirms */
#inlineAlerts .inline-alert,
#inlineAlerts .confirm-modal {
  all: unset;
  display: block;
  background: #fff;
  color: #111827;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

#inlineAlerts .confirm-modal .actions {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Captain armband — tuned to your 110×66 .position boxes */
.captain-badge {
  /* anchor to the box (card) itself */
  position: absolute;
  z-index: 10;
  /* above crest/points */
  /* sit right on the inner rounded corner */
  top: 35px;
  /* ~equal to your 10px radius + 2px border feel */
  left: -22px;

  /* length & thickness of the ribbon */
  width: 80px;
  /* long enough to cut across the corner */
  padding: 3px 0;
  /* thickness of the band */

  /* look & legibility */
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  color: #fff;
  /* white text */
  -webkit-text-stroke: 1px #000;
  /* black outline */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background:
    /* OPTIONAL: two subtle white stripes like real armbands */
    linear-gradient(transparent 0 42%,
      rgba(255, 255, 255, 0.85) 42% 47%,
      transparent 47% 53%,
      rgba(255, 255, 255, 0.85) 53% 58%,
      transparent 58%),
    linear-gradient(#f6d95b, #eab308);
  border-top: 2px solid rgba(255, 255, 255, 0.95);
  border-bottom: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 2px rgba(0, 0, 0, 0.18);

  /* geometry */
  transform: rotate(-45deg);
  transform-origin: top left;

  pointer-events: none;
  /* never block player link */
}

/* Inline captain band for leaderboard rows (reuses global .captain-badge base styles) */
.col-captain .captain-badge.captain-inline {
  position: static;
  /* inline flow next to the team name */
  display: inline-block;
  width: 25px;
  /* horizontal band width */
  height: 1em;
  /* same height as the text */
  line-height: 1em;
  margin-left: 6px;
  vertical-align: text-bottom;

  /* Flatten to horizontal band */
  transform: none;
  transform-origin: initial;

  /* Keep your armband look */
  background: linear-gradient(transparent 0 42%,
      rgba(255, 255, 255, 0.85) 42% 47%,
      transparent 47% 53%,
      rgba(255, 255, 255, 0.85) 53% 58%,
      transparent 58%),
    linear-gradient(#f6d95b, #eab308);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);

  /* Text styling for the C */
  font-weight: 800;
  font-size: 0.8em;
  color: #fff;
  -webkit-text-stroke: 1px #000;
  /* thin outline */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);

  text-align: center;
  pointer-events: none;
  /* don’t block clicks */
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.field {
  padding: 12px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  background: #fcfcfc;
}

.label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.value {
  font-size: 16px;
}

.value-green {
  color: #16a34a;
  font-weight: 600;
}

.value-red {
  color: #dc2626;
  font-weight: 600;
}

.input {
      width: 100%;
      max-width: 500px;
      padding: 10px 12px;
      border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px;
      background: #fff; color: #111827;
    }
    .input:focus { border-color:#047857; box-shadow:0 0 0 2px rgba(4,120,87,.12); outline:none; }


    /* Row 1: fixed header line */
.nt-dot     { grid-column: 1; }
.nt-date    { grid-column: 2; white-space: nowrap; }
.nt-subject { grid-column: 3; }
.nt-team    { grid-column: 4; }
.nt-league  { grid-column: 5; }

/* When a row is expanded, just reveal the body. Header stays on row 1. */
.nt-item[aria-expanded="true"] .nt-body { display: block; }

/* Keep bubble width scoped to subject column */
.notif-bubble { display: inline-block; }