/* Fallbacks if this file loads without styles.css */
:root {
  --header-logo-size: 60px;
  --header-logo-radius: 14px;
  --header-bar-pad-y: 1.05rem;
  --header-bar-pad-x: 1.5rem;
}

.dashboard-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dash-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset, 0 6px 24px rgba(15, 23, 42, 0.05);
}

.dash-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--header-bar-pad-y, 1.05rem) var(--header-bar-pad-x, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.pt-bootstrap .dash-header-inner.container-xl {
  max-width: 1200px;
}

.registration-form-page .dash-header-inner {
  flex-wrap: wrap;
  row-gap: 0.65rem;
}

/* Event picker: default Pro Tourny mark (tournament poster replaces via JS when set) */
.dash-logo .dash-logo-site-mark {
  width: var(--header-logo-size, 60px);
  height: var(--header-logo-size, 60px);
  object-fit: contain;
  border-radius: var(--header-logo-radius, 14px);
  flex-shrink: 0;
  display: block;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.registration-form-page .dash-logo-icon {
  display: none !important;
}

.pt-bootstrap .td-main {
  padding-left: 0;
  padding-right: 0;
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

/* Match landing (.logo-icon): readable header mark on dashboard / draws / register, etc. */
.dash-logo-icon {
  width: var(--header-logo-size, 60px);
  height: var(--header-logo-size, 60px);
  border-radius: var(--header-logo-radius, 14px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  background-color: #fff;
  background-image: url("public/PRO_TOURNY_LOGO.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

/* Tournament (or other) poster image in header — same footprint as .dash-logo-icon */
.dash-logo img.dash-logo-img {
  width: var(--header-logo-size, 60px);
  height: var(--header-logo-size, 60px);
  object-fit: contain;
  border-radius: var(--header-logo-radius, 14px);
  display: block;
  flex-shrink: 0;
  background: #f3f4f6;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

/* Uploaded tournament poster / logo: often wide or tall; contain() shrinks to a tiny strip in a square */
.dash-logo img.dash-logo-tournament,
.dash-logo img[data-tournament-logo="1"] {
  object-fit: cover;
  object-position: center;
}

.dash-logo-text {
  font-weight: 700;
  font-size: 1.32rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.dash-tagline {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--purple-bg);
  color: var(--purple);
  font-size: 0.8rem;
  font-weight: 500;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.dash-menu-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 0;
}

.dash-menu-dot {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: #0f172a;
}

.dash-menu {
  position: absolute;
  right: 0;
  top: 110%;
  min-width: 140px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  padding: 0.25rem 0;
  z-index: 40;
}

.dash-menu-item {
  width: 100%;
  padding: 0.45rem 0.85rem;
  border: none;
  background: transparent;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  cursor: pointer;
}

.dash-menu-item:hover {
  background: #f1f5f9;
}

.dash-menu-item-danger {
  color: #b91c1c;
}

.dash-user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.dash-user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.dash-user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-logout-btn {
  padding-inline: 0.9rem;
}

.dash-main {
  flex: 1;
  padding: 1.5rem 1.5rem 2rem;
}

.auth-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}

.auth-form .form-group.full {
  grid-column: 1 / -1;
}

.poster-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.poster-preview {
  max-width: 260px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.poster-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.dash-row-manageable {
  cursor: pointer;
  position: relative;
}

.dash-row-manageable:hover {
  background: #e0f2fe;
  box-shadow: inset 2px 0 0 #2563eb;
}

.dash-row-selected {
  background: #dbeafe;
  box-shadow: inset 4px 0 0 #1d4ed8;
}

.dash-manage-container {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dash-manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dash-manage-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: baseline;
}

.dash-manage-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dash-manage-name {
  font-weight: 600;
}

.dash-manage-frame-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.dash-manage-frame {
  width: 100%;
  min-height: 700px;
  border: none;
  background: #f1f5f9;
}

/* Tournament details header card — top: logo (left), poster + counts (right); center: title; then tabs */
.td-main {
  padding: 1.5rem 1.5rem 2.25rem;
}

.td-header-card {
  max-width: 1200px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.35);
  color: #ecfdf5;
  padding: 1rem 1.25rem 1rem;
}

.td-header-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  width: 100%;
}

.td-header-top-bar {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.td-header-bar-left {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-start;
}

.td-header-bar-right {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  min-width: 0;
  flex: 1 1 auto;
  margin-left: auto;
}

.td-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  justify-content: flex-start;
  text-align: left;
}

.td-header-bar-left .td-logo-text {
  text-align: left;
}

.td-logo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  border: none;
  text-decoration: none;
}

.td-logo-circle {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

.td-brand-logo {
  height: var(--header-logo-size, 60px);
  width: auto;
  max-width: min(200px, 40vw);
  display: block;
  object-fit: contain;
  border-radius: var(--header-logo-radius, 14px);
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.td-logo-text {
  margin-top: 0;
  text-align: left;
  min-width: 0;
}

.td-logo-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.td-logo-subtitle {
  font-size: 0.8rem;
  opacity: 0.9;
}

.td-header-center {
  min-width: 0;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.td-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
  max-width: 100%;
  word-wrap: break-word;
}

.td-subtitle {
  font-size: 0.9rem;
  opacity: 0.95;
}

.td-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.td-meta-chip {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.12);
}

.td-view-only {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  opacity: 0.9;
  width: 100%;
  text-align: center;
}

.td-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.td-header-right--topbar {
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}

.td-header-bar-right .td-header-right--topbar .td-count {
  text-align: right;
}

.td-count {
  text-align: right;
}

.td-header-right--topbar .td-count {
  text-align: right;
}

.td-count-number {
  font-size: 1.1rem;
  font-weight: 700;
}

.td-count-label {
  font-size: 0.78rem;
}

.td-header-poster {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.td-header-bar-right .td-header-poster {
  justify-content: flex-end;
}

.td-poster-thumb {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

.td-poster-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.td-tabs {
  margin-top: 0;
  padding-top: 0.35rem;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Tournament details — Draws tab: hide A4 strip print buttons on bracket overlay */
.td-main.td-draws-tab-active .a4-print-slice-btn {
  display: none !important;
}

.td-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: none;
  background: transparent;
  color: #e0f2f1;
  cursor: pointer;
}

.td-tab-active {
  background: rgba(255, 255, 255, 0.18);
  color: #ecfdf5;
}

.td-tab-disabled {
  opacity: 0.6;
}

.td-events-section {
  margin-top: 1rem;
}

.td-events-title {
  margin-bottom: 0.75rem;
}

.td-events-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.td-event-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.td-event-main {
  min-width: 0;
}

.td-event-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.td-event-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.td-event-players-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.td-event-players {
  font-size: 0.8rem;
  color: var(--text);
}

.td-event-players-empty {
  color: var(--text-muted);
}

.td-event-side {
  text-align: right;
  font-size: 0.8rem;
  white-space: nowrap;
}

.td-event-side-meta {
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.td-event-side-count {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .td-main {
    padding: 0.65rem 0.65rem 1.1rem;
  }

  .td-header-card {
    margin-bottom: 0.85rem;
    padding: 0.6rem 0.65rem 0.65rem;
    border-radius: 14px;
  }

  .td-header-shell {
    gap: 0.5rem;
  }

  .td-header-top-bar {
    align-items: flex-start;
  }

  .td-title {
    font-size: 1.12rem;
    line-height: 1.2;
    margin-bottom: 0.1rem;
  }

  .td-subtitle {
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .td-meta-row {
    margin-top: 0.28rem;
    gap: 0.28rem;
  }

  .td-meta-chip {
    font-size: 0.7rem;
    padding: 0.14rem 0.45rem;
  }

  .td-view-only {
    margin-top: 0.22rem;
    font-size: 0.72rem;
  }

  .td-tabs {
    gap: 0.28rem;
    row-gap: 0.32rem;
    padding-top: 0.25rem;
  }

  .td-tab {
    padding: 0.32rem 0.65rem;
    font-size: 0.72rem;
  }

  .td-header-bar-left {
    gap: 0.45rem 0.65rem;
  }

  .td-header-right--topbar {
    gap: 0.65rem;
  }

  .td-logo-title {
    font-size: 0.88rem;
    line-height: 1.2;
  }

  .td-logo-subtitle {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  .td-brand-logo {
    height: 40px;
    max-width: min(120px, 38vw);
  }

  .td-header-poster .dash-btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    min-height: auto;
  }

  .td-count-number {
    font-size: 0.95rem;
  }

  .td-count-label {
    font-size: 0.65rem;
  }

  .td-event-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .td-event-side {
    text-align: left;
  }
}

@media (max-width: 380px) {
  .td-title {
    font-size: 1.02rem;
  }
  .td-tab {
    font-size: 0.68rem;
    padding: 0.28rem 0.55rem;
  }
}

.dash-actions {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.dash-btn:hover {
  transform: translateY(-1px);
}

.dash-btn:active {
  transform: translateY(0);
}

.dash-btn-primary {
  background: var(--primary);
  color: #fff;
}

.dash-btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.dash-btn-draw {
  background: var(--purple);
  color: #fff;
}

.dash-btn-draw:hover {
  background: #6d28d9;
  color: #fff;
}

.dash-btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  min-height: 2.375rem;
  border-radius: 9px;
}

.dash-btn-secondary {
  background: #e0e7ff;
  color: #312e81;
}

.dash-btn-secondary:hover {
  background: #c7d2fe;
  color: #1e1b4b;
}

.dash-btn-ghost {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dash-btn-ghost:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.28);
}

.dash-btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.28);
}

.dash-btn-danger:hover {
  background: #fee2e2;
  color: #991b1b;
}

/**
 * Compact row actions (Draws tab, schedules, court & time).
 * Prefer .dash-btn.dash-btn-sm + variant; this remains for any legacy markup.
 */
.dash-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  min-height: 2.375rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 9px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
  box-sizing: border-box;
}

.dash-link-btn:hover {
  background: #dbeafe;
  border-color: rgba(29, 78, 216, 0.55);
  color: #1e3a8a;
}

.dash-link-btn:active {
  transform: translateY(0);
}

.dash-link-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.dash-section {
  max-width: 1200px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.75rem;
}

/* Profile page layout */
#profileForm {
  max-width: 720px;
  margin: 0 auto;
}

#profileForm .draws-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.75rem;
}

#profileForm .draws-field {
  width: 100%;
}

#profileForm input[type="text"],
#profileForm input[type="email"],
#profileForm input[type="tel"],
#profileForm input[type="date"],
#profileForm input[type="password"] {
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-size: 0.98rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.16);
}

#profileForm .draws-field-full {
  grid-column: 1 / -1;
}

#profileForm .start-tournament-actions .dash-btn {
  min-width: 160px;
}

@media (max-width: 768px) {
  #profileForm .draws-form-grid {
    grid-template-columns: 1fr;
  }
}

.dash-section-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.dash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.dash-filter-label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dash-filter-label select,
.dash-filter-label input {
  margin-top: 0.25rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.15);
  font-size: 0.85rem;
  min-width: 160px;
}

.dash-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.dash-tab {
  padding: 0.6rem 1.25rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.dash-tab:hover {
  color: var(--text);
}

.dash-tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.dash-alert {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.1em;
  color: var(--live-red);
}

.dash-loading {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dash-empty {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dash-table-wrap {
  margin-top: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tab strip: scroll horizontally on tablets / small laptops */
@media (max-width: 992px) {
  .dash-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0.15rem;
  }

  .dash-tab {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
  }
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.dash-table thead {
  background: #f1f5f9;
}

.dash-table th,
.dash-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.dash-table th.dash-th-stack,
.dash-table td.dash-td-stack {
  white-space: normal;
  vertical-align: top;
  min-width: 7.5rem;
}

.dash-th-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.25;
}

.dash-date-stack {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dash-date-stack-line {
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.dash-table th.dash-th-num,
.dash-table td.dash-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 6.5rem;
}

.dash-table tbody tr:hover {
  background: #f8fafc;
}

.tdb-payment-proof {
  vertical-align: middle;
  white-space: nowrap;
  max-width: 12rem;
}

.tdb-payment-proof-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--primary, #2563eb);
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
}

.tdb-payment-proof-trigger--image {
  padding: 0;
}

.tdb-payment-proof-trigger--image:hover .tdb-payment-proof-thumb {
  box-shadow: 0 0 0 2px var(--primary, #2563eb);
}

.tdb-payment-proof-trigger--file {
  white-space: nowrap;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.tdb-payment-proof-trigger--file:hover {
  border-color: var(--primary, #2563eb);
  background: #eff6ff;
}

.tdb-payment-proof-trigger:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
}

.tdb-payment-proof .tdb-payment-proof-thumb {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  pointer-events: none;
}

.tdb-payment-proof-pdf-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
}

.tdb-payment-proof-trigger--file:hover .tdb-payment-proof-pdf-label {
  color: var(--primary, #2563eb);
}

.tdb-payment-proof-modal-box {
  max-width: min(960px, 96vw);
}

.tdb-payment-proof-modal-body {
  padding: 0 1.25rem 1rem;
  min-height: 200px;
  max-height: min(78vh, 720px);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.tdb-payment-proof-modal-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
}

.tdb-payment-proof-modal-frame {
  display: block;
  width: 100%;
  min-height: min(70vh, 640px);
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.tdb-payment-proof-modal-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* —— Players tab: registrations table —— */
.tdb-players-table th,
.tdb-players-table td {
  vertical-align: top;
}

.tdb-players-table th {
  color: #475569;
  font-weight: 600;
  font-size: 0.8125rem;
  white-space: normal;
  padding-top: 0.75rem;
  padding-bottom: 0.65rem;
}

.tdb-players-table td {
  white-space: normal;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.tdb-players-table .tdb-players-col-event {
  max-width: 14rem;
  min-width: 8.5rem;
  color: #334155;
  font-size: 0.875rem;
  line-height: 1.45;
}

.tdb-players-table .tdb-players-col-payment {
  font-variant-numeric: tabular-nums;
  color: #334155;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: nowrap;
}

.tdb-players-table .tdb-players-actions-cell {
  display: table-cell;
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.tdb-players-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tdb-players-action-btn {
  min-width: 4.5rem;
  min-height: 0;
  padding: 0.4rem 0.95rem;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.25;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.tdb-players-action-btn.dash-btn-secondary {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1d4ed8;
}

.tdb-players-action-btn.dash-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.tdb-players-action-btn.dash-btn-danger {
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: #b91c1c;
}

.tdb-players-action-btn.dash-btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
  box-shadow: 0 2px 4px rgba(185, 28, 28, 0.12);
}

.tdb-players-status-pill {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.tdb-players-status-pill--pending {
  background: #fef9c3;
  color: #854d0e;
}

.tdb-players-status-pill--success {
  background: #dcfce7;
  color: #166534;
}

.tdb-players-status-pill--danger {
  background: #fee2e2;
  color: #991b1b;
}

.tdb-players-stacked-cell {
  vertical-align: top;
  min-width: 16rem;
  max-width: 24rem;
}

.tdb-player-block {
  padding: 0.15rem 0;
}

.tdb-player-block + .tdb-player-block {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: none;
  position: relative;
}

.tdb-player-block + .tdb-player-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
}

.tdb-player-block-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.tdb-player-block-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.tdb-player-block-meta {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #334155;
  margin-bottom: 0.45rem;
}

.tdb-player-block-proof {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
}

.tdb-player-proof-caption {
  color: #64748b;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tdb-payment-proof-inline {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.tdb-player-proof-thumb {
  width: 52px;
  height: 52px;
}

.tdb-players-table .tdb-payment-proof-trigger--image:hover .tdb-player-proof-thumb {
  box-shadow: 0 0 0 2px var(--primary, #2563eb);
}

/* Player add/edit modal */
.tdb-player-modal-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0.35rem 0 0.5rem;
}

.tdb-player-modal-docs {
  margin-top: 0.35rem;
  padding: 0.85rem 0.95rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tdb-player-modal-doc-block {
  margin-top: 0.65rem;
}

.tdb-player-modal-doc-block:first-of-type {
  margin-top: 0.15rem;
}

.tdb-player-modal-doc-block--b {
  padding-top: 0.8rem;
  margin-top: 0.9rem;
  border-top: 1px solid #e2e8f0;
}

.tdb-player-modal-doc-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.tdb-player-modal-doc-thumb-wrap {
  margin-bottom: 0.45rem;
}

.tdb-player-modal-doc-thumb {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.tdb-player-modal-proof-view {
  margin-bottom: 0.55rem;
}

#tdbPlayerModal .tdb-player-modal-b-hidden {
  display: none !important;
}

/* Player modal: fit viewport and scroll form body (header + actions stay visible) */
#tdbPlayerModal.modal[aria-hidden="false"] {
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1rem max(0.75rem, env(safe-area-inset-bottom, 0px));
}

#tdbPlayerModal .modal-box.modal-lg {
  max-height: min(92vh, 52rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: auto;
  margin-right: auto;
}

#tdbPlayerModal .modal-box.modal-lg .modal-header {
  flex-shrink: 0;
}

#tdbPlayerModal .modal-box.modal-lg #tdbPlayerModalError {
  flex-shrink: 0;
}

#tdbPlayerModal #tdbPlayerForm {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#tdbPlayerModal #tdbPlayerForm .form-grid.form-grid-2col {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 0.35rem;
  -webkit-overflow-scrolling: touch;
}

#tdbPlayerModal #tdbPlayerForm .modal-actions {
  flex-shrink: 0;
  padding-top: 0.9rem;
  margin-top: 0.35rem;
  border-top: 1px solid #e2e8f0;
  background: var(--surface, #fff);
}

.dash-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.dash-status-live {
  background: var(--green-bg);
  color: var(--green);
}

.dash-status-upcoming {
  background: #e0f2fe;
  color: #0369a1;
}

.dash-status-completed {
  background: #e5e7eb;
  color: #4b5563;
}

.dash-view-btn {
  padding: 0.35rem 0.75rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.dash-view-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
}

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

.dash-edit-btn {
  padding: 0.35rem 0.75rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, filter 0.2s;
}

.dash-edit-btn:hover {
  filter: brightness(0.92);
}

.dash-pagination {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dash-pagination-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dash-pagination-info strong {
  color: var(--text);
}

.dash-pagination-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dash-pagination-pages {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 5rem;
  text-align: center;
}

.dash-pagination-btn {
  padding: 0.4rem 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.dash-pagination-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: var(--primary);
}

.dash-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* —— Schedule tab (list view, bracket-style rows) —— */
.schedule-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.schedule-panel-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.schedule-panel-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.schedule-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.55rem 2.4rem 0.55rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.9375rem;
  font-family: var(--font);
  min-width: 11rem;
  min-height: 2.5rem;
  line-height: 1.35;
  color: #0f172a;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1.05rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.schedule-select::-ms-expand {
  display: none;
}

.schedule-select:hover {
  border-color: #94a3b8;
}

.schedule-select:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.schedule-search {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  min-width: 14rem;
  background: #fff;
}

.schedule-search::placeholder {
  color: #94a3b8;
}

.schedule-panel-hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.schedule-third-place-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid #238636;
  background: rgba(35, 134, 54, 0.12);
}
.schedule-third-place-banner[hidden] {
  display: none !important;
}
.schedule-third-place-banner__text {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: #e6edf3;
  line-height: 1.45;
}

/* Draws tab: post + regenerate buttons */
.tdb-draw-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem 0.65rem;
}

.tdb-draw-actions-cell .dash-btn-sm,
.tdb-draw-actions-cell .dash-link-btn {
  flex: 0 0 auto;
}

/* Players / tables: paired Edit + Delete */
.tdb-table-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.5rem;
  vertical-align: middle;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.schedule-date-group {
  margin-bottom: 1.25rem;
}

.schedule-date-heading {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.schedule-date-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(220px, 2fr) minmax(120px, 1fr);
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #eef2f7;
  border-left: 3px solid #cbd5e1;
  margin-bottom: 0.5rem;
  background: #fff;
  transition: background 0.15s ease;
}

/* Organiser dashboard schedule: score edit column */
.schedule-row--org {
  grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) minmax(100px, 1fr) minmax(7.5rem, auto);
}

.schedule-cell--actions {
  text-align: right;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.schedule-actions-na {
  font-size: 0.85rem;
}

/* Tournament dashboard — badminton umpire score sheet (blue grid, scrollable point grid) */
#tdbScorecardModal .tdb-scorecard-modal-box {
  max-width: min(1100px, 96vw);
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 960px);
  overflow: hidden;
  padding-bottom: 0;
}

#tdbScorecardModal .tdb-scorecard-modal-box > .modal-header {
  flex-shrink: 0;
}

#tdbScorecardModal #tdbScorecardForm {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body.tdb-score-card-page .tdb-scorecard-standalone-scroll {
  max-height: none;
  overflow: visible;
}

.tdb-scorecard-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding: 0 0.2rem 0.5rem 0;
}

.tdb-scorecard-modal-actions {
  flex-shrink: 0;
  margin-top: 0 !important;
  padding-top: 0.85rem !important;
  padding-bottom: 1rem !important;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--surface, #fff);
}

.tdb-scorecard-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tdb-sc-umpire-sheet {
  --tdb-sc-blue: #1e40af;
  --tdb-sc-blue-line: #2563eb;
  --tdb-sc-gray: #e8edf5;
  --tdb-sc-gray-strong: #dce3f0;
  border: 2px solid var(--tdb-sc-blue);
  border-radius: 6px;
  padding: 0.85rem 1rem 1rem;
  background: #fff;
  color: var(--tdb-sc-blue);
  margin-bottom: 1rem;
}

.tdb-scorecard-print-area .tdb-sc-sheet-title {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
  margin: 0 0 0.65rem;
  color: var(--tdb-sc-blue);
  border-bottom: 2px solid var(--tdb-sc-blue-line);
  padding-bottom: 0.4rem;
}

.tdb-sc-tournament-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(37, 99, 235, 0.2);
}

.tdb-sc-tournament-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tdb-sc-tournament-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
}

.tdb-sc-tournament-event {
  font-size: 0.72rem;
  font-weight: 500;
  color: #475569;
  line-height: 1.3;
  word-break: break-word;
}

.tdb-sc-tournament-meta {
  flex: 0 1 auto;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  max-width: 58%;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .tdb-sc-tournament-meta {
    max-width: 100%;
    text-align: left;
  }
}

.tdb-sc-fields-hidden {
  display: none;
}

.tdb-sc-line-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tdb-sc-blue);
}

.tdb-sc-line-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px dotted var(--tdb-sc-blue-line);
  border-radius: 0;
  padding: 0.2rem 0.1rem;
  font-size: 0.88rem;
  color: #0f172a;
  background: transparent;
}

.tdb-sc-line-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}

.tdb-sc-players-sets-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 0.75rem;
}

.tdb-sc-name-box {
  border: 2px solid var(--tdb-sc-blue-line);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 5.5rem;
}

.tdb-sc-name-row {
  flex: 1;
  min-height: 1.65rem;
  display: flex;
  align-items: stretch;
}

.tdb-sc-name-row--top {
  background: #fff;
}

.tdb-sc-name-row--mid,
.tdb-sc-name-row--bot {
  background: var(--tdb-sc-gray);
  border-top: 1px solid var(--tdb-sc-blue-line);
}

.tdb-sc-name-input {
  width: 100%;
  border: none;
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
  background: transparent;
  color: #0f172a;
  box-sizing: border-box;
}

.tdb-sc-name-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: -2px;
}

.tdb-sc-sets-box {
  border: 2px solid var(--tdb-sc-blue-line);
  border-radius: 4px;
  padding: 0.35rem 0.5rem 0.45rem;
  min-width: 9.5rem;
  background: #fff;
}

.tdb-sc-sets-title {
  text-align: center;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--tdb-sc-blue);
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--tdb-sc-blue-line);
}

.tdb-sc-sets-row {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto 1fr;
  align-items: center;
  gap: 0.25rem 0.35rem;
  margin-top: 0.25rem;
}

.tdb-sc-set-num {
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  color: var(--tdb-sc-blue);
}

.tdb-sc-set-colon {
  font-weight: 700;
  color: var(--tdb-sc-blue);
}

.tdb-sc-set-inp {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--tdb-sc-blue-line);
  border-radius: 3px;
  padding: 0.15rem 0.25rem;
  font-size: 0.85rem;
  text-align: center;
}

.tdb-sc-grid-hint {
  font-size: 0.78rem;
  margin: 0 0 0.35rem;
}

.tdb-sc-grid-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-height: 8rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border: 1px solid var(--tdb-sc-blue-line);
  border-radius: 4px;
  background: #fafbff;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--tdb-sc-blue-line) #e8edf5;
}

.tdb-sc-grid-scroll::-webkit-scrollbar {
  height: 10px;
}

.tdb-sc-grid-scroll::-webkit-scrollbar-track {
  background: #e8edf5;
  border-radius: 6px;
}

.tdb-sc-grid-scroll::-webkit-scrollbar-thumb {
  background: var(--tdb-sc-blue-line);
  border-radius: 6px;
}

.tdb-sc-point-grid-inner {
  width: max-content;
  min-width: 100%;
  padding: 0.45rem 0.5rem;
}

.tdb-sc-strip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  margin-bottom: 0.5rem;
}

.tdb-sc-strip:last-child {
  margin-bottom: 0;
}

.tdb-sc-strip-grid-cols {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tdb-sc-g-row-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
}

.tdb-sc-g-row-wrap--plain {
  background: #fff;
}

.tdb-sc-g-row-wrap--shade {
  background: var(--tdb-sc-gray-strong);
}

.tdb-sc-row-label {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 7.5rem;
  width: 7.5rem;
  max-width: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--tdb-sc-blue-line);
  border-right: 2px solid var(--tdb-sc-blue);
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  box-shadow: 4px 0 10px -4px rgba(30, 64, 175, 0.2);
}

.tdb-sc-row-label--pair {
  flex: 0 0 8rem;
  width: 8rem;
  max-width: 11rem;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.4rem;
  align-self: stretch;
}

.tdb-sc-row-label--pair .tdb-sc-grid-pname[data-side="b"] {
  padding-top: 0.35rem;
  border-top: 1px solid var(--tdb-sc-blue-line);
  margin-top: 0.05rem;
}

.tdb-sc-grid-pname {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  word-break: break-word;
}

.tdb-sc-sr-flag {
  flex: 0 0 auto;
  width: 1.65rem;
  min-width: 1.65rem;
  height: 1.55rem;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tdb-sc-blue-line);
  border-left: 1px solid var(--tdb-sc-blue-line);
  border-radius: 0;
  background: #fff;
  color: var(--tdb-sc-blue);
  font-size: 0.72rem;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  line-height: 1;
  cursor: pointer;
  text-align: center;
}

.tdb-sc-g-row-wrap--shade .tdb-sc-sr-flag {
  background: var(--tdb-sc-gray-strong);
}

.tdb-sc-sr-spacer {
  flex: 0 0 auto;
  width: 1.65rem;
  min-width: 1.65rem;
  height: 1.55rem;
  box-sizing: border-box;
  border: 1px solid var(--tdb-sc-blue-line);
  border-left: 1px solid var(--tdb-sc-blue-line);
  border-top: none;
  background: #fff;
}

.tdb-sc-g-row-wrap--shade .tdb-sc-sr-spacer {
  background: var(--tdb-sc-gray-strong);
}

.tdb-sc-g-cell-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0;
}

.tdb-sc-g-cell-stack .tdb-sc-g-row-cells + .tdb-sc-g-row-cells {
  border-top: 1px solid rgba(37, 99, 235, 0.35);
}

.tdb-sc-g-row-cells {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
}

.tdb-sc-g-row-wrap--shade .tdb-sc-g-row-cells {
  background: var(--tdb-sc-gray-strong);
}

.tdb-sc-g-cell {
  width: 1.65rem;
  min-width: 1.65rem;
  height: 1.55rem;
  box-sizing: border-box;
  border: 1px solid var(--tdb-sc-blue-line);
  border-left: none;
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  background: transparent;
  color: #0f172a;
}

.tdb-sc-g-row-cells .tdb-sc-g-cell:first-of-type {
  border-left: 1px solid var(--tdb-sc-blue-line);
}

.tdb-sc-g-cell--tick {
  border-left: 2px solid var(--tdb-sc-blue) !important;
  box-shadow: inset 2px 0 0 rgba(30, 64, 175, 0.15);
}

.tdb-sc-result-block {
  margin: 0.85rem 0;
  padding: 0.75rem;
  border: 1px dashed var(--tdb-sc-blue-line);
  border-radius: 8px;
  background: #f8fafc;
}

.tdb-sc-result-title {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.55rem;
  color: var(--tdb-sc-blue);
}

.tdb-sc-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 2.5rem;
}

.tdb-sc-footer-sigs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.65rem 1rem;
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 2px solid var(--tdb-sc-blue-line);
}

.tdb-sc-footer-cell {
  min-width: 0;
}

@media (max-width: 720px) {
  .tdb-sc-players-sets-row {
    grid-template-columns: 1fr;
  }
  .tdb-sc-footer-sigs {
    grid-template-columns: 1fr;
  }
}

@media print {
  body.tdb-printing-scorecard * {
    visibility: hidden;
  }
  body.tdb-printing-scorecard #tdbScorecardModal,
  body.tdb-printing-scorecard #tdbScorecardModal * {
    visibility: visible;
  }
  body.tdb-printing-scorecard #tdbScorecardModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
  }
  body.tdb-printing-scorecard .modal-backdrop,
  body.tdb-printing-scorecard .tdb-scorecard-no-print {
    display: none !important;
  }
  body.tdb-printing-scorecard .tdb-scorecard-modal-box {
    box-shadow: none;
    max-width: none;
    margin: 0;
    border-radius: 0;
  }
  body.tdb-printing-scorecard .tdb-sc-grid-scroll {
    overflow: visible !important;
    max-width: none !important;
  }
  body.tdb-printing-scorecard .tdb-sc-point-grid-inner {
    width: max-content !important;
  }
}

.schedule-row:hover {
  background: #f8fafc;
}

.schedule-cell--meta {
  text-align: left;
}

.schedule-round {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.schedule-when {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-family: ui-monospace, monospace;
}

.schedule-court-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.schedule-cell--players {
  text-align: center;
}

.schedule-vs {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
}

.schedule-category {
  font-size: 0.82rem;
  margin-top: 0.28rem;
  color: var(--text-muted);
}

.schedule-cell--result {
  text-align: right;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .schedule-row {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .schedule-cell--players,
  .schedule-cell--result {
    text-align: left;
  }

  .schedule-cell--actions {
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 768px) {
  .dash-header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-brand {
    align-self: flex-start;
  }

  .dash-user {
    align-self: stretch;
    justify-content: space-between;
    width: 100%;
  }

  .dash-user-text {
    align-items: flex-start;
    text-align: left;
    min-width: 0;
    flex: 1;
  }

  .dash-user-menu {
    flex-shrink: 0;
    margin-left: 0.5rem;
  }

  /* Match desktop: action buttons in a horizontal row / 2×2 grid (not one per row) */
  .dash-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0.55rem;
  }

  .dash-actions .dash-btn {
    flex: 1 1 calc(50% - 0.3rem);
    max-width: calc(50% - 0.3rem);
    min-width: 0;
    font-size: 0.82rem;
    padding: 0.55rem 0.7rem;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
  }

  .dash-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-filters {
    width: 100%;
  }

  .dash-filters .dash-filter-label input,
  .dash-filters .dash-filter-label select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .dash-main {
    padding: 1rem;
  }

  .dash-section {
    padding: 1.1rem 1.1rem 1.3rem;
  }

  .schedule-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-panel-tools {
    width: 100%;
  }

  .schedule-select,
  .schedule-search {
    flex: 1;
    min-width: 0;
  }
}

/* Dashboard: four action buttons in one row when width allows (closer to laptop layout) */
@media (min-width: 560px) and (max-width: 900px) {
  .dash-actions .dash-btn {
    flex: 1 1 calc(25% - 0.45rem);
    max-width: calc(25% - 0.45rem);
    min-width: 0;
    font-size: 0.78rem;
    padding: 0.5rem 0.45rem;
  }
}

/* —— Tournament details: public knockout bracket (Draws tab) —— */
.td-bracket-root {
  margin-top: 0.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

.td-bracket-knockout {
  margin-bottom: 2.25rem;
}

.td-bracket-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.td-bracket-iframe-wrap {
  width: 100%;
  min-height: 480px;
  height: min(78vh, 920px);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.td-bracket-iframe {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: 0;
  display: block;
  vertical-align: top;
}

.td-bracket-event-title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
}

.td-bracket-subtitle {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.td-bracket-columns {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  min-width: min-content;
}

.td-bracket-round {
  flex: 0 0 auto;
  width: 318px;
  padding-right: 4px;
}

.td-bracket-round-matches {
  position: relative;
}

.td-bracket-connector-gap {
  width: 22px;
  flex: 0 0 22px;
  align-self: stretch;
  min-height: 120px;
  border-right: 1px solid #d1d5db;
  margin-top: 28px;
  margin-right: 2px;
}

.td-bracket-round-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  color: #374151;
  margin-bottom: 0.65rem;
  text-align: center;
}

.td-bracket-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.3rem 0.42rem 0.28rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.td-bracket-player-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 7.25rem;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.82rem;
}

.td-bracket-player-row:last-of-type {
  border-bottom: none;
}

.td-bracket-seed {
  color: #9ca3af;
  font-size: 0.78rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.td-bracket-name {
  font-weight: 500;
  color: #111827;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  overflow: visible;
  line-height: 1.35;
}

.td-bracket-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 0.32rem;
  width: 100%;
  min-width: 0;
  align-self: center;
}

.td-bracket-scores:has(.td-bracket-wo) {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.td-bracket-score-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 1.65rem;
  box-sizing: border-box;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.77rem;
  font-weight: 600;
  color: #1f2937;
  padding: 0.18rem 0.2rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  line-height: 1.15;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.td-bracket-wo {
  font-size: 0.78rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.td-bracket-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: #1f2937;
}

.td-bracket-meta {
  font-size: 0.65rem;
  color: #6b7280;
  margin-top: 0.28rem;
  padding-top: 0.22rem;
  border-top: 1px solid #f3f4f6;
  line-height: 1.35;
}

.td-bracket-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-top: 0.25rem;
}

.td-bracket-third-wrap {
  margin-top: 1.5rem;
  max-width: 320px;
}

/* Round robin — tournament details Draws tab */
.td-rr-lead {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.td-rr-round-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.td-rr-round-panel--flat {
  background: #fff;
}

.td-rr-round-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e2e8f0;
}

.td-rr-round-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.td-rr-round-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.td-rr-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.td-rr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.td-rr-table thead th {
  text-align: left;
  padding: 0.55rem 0.65rem;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.td-rr-table tbody td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
}

.td-rr-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.9);
}

.td-rr-td-num {
  width: 2.5rem;
  font-variant-numeric: tabular-nums;
  color: #64748b;
}

.td-rr-td-name {
  font-weight: 500;
  color: #1e293b;
  min-width: 7rem;
}

.td-rr-td-result {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  white-space: nowrap;
}

.td-rr-td-time {
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
}

.td-rr-td-court {
  font-size: 0.85rem;
  color: #475569;
}

.td-rr-cards-wrap {
  display: none;
}

.td-rr-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.td-rr-match-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.td-rr-match-card-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.td-rr-match-vs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.td-rr-match-p {
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}

.td-rr-match-vs-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.td-rr-match-result {
  font-size: 0.85rem;
  color: #334155;
  margin-bottom: 0.35rem;
}

.td-rr-match-meta {
  font-size: 0.75rem;
  color: #64748b;
}

@media (max-width: 768px) {
  .td-rr-table-wrap {
    display: none;
  }

  .td-rr-cards-wrap {
    display: block;
  }
}

@media (min-width: 769px) {
  .td-rr-table-wrap {
    display: block;
  }

  .td-rr-cards-wrap {
    display: none;
  }
}

.td-bracket-rr-block {
  margin-bottom: 2rem;
}

.td-rr-standings-above-matches {
  margin-bottom: 1.35rem;
}

.td-bracket-rr {
  margin-bottom: 2rem;
}

/* Tournament details — tab filters (Schedule, Draws, Players) */
.td-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.td-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.td-filter-label--grow {
  flex: 1;
  min-width: min(100%, 14rem);
}

.tdb-bracket-player-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem 0.75rem;
}

.tdb-bracket-player-tools .td-filter-search {
  flex: 1;
  min-width: 8rem;
}

/* —— Tournament dashboard: Winners tab —— */
.tdb-winners-panel {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tdb-winners-note {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
}

.tdb-winner-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.tdb-winner-match-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: #f8fafc;
}

.tdb-winner-match-card h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.tdb-winner-match-lines {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #0f172a;
}

.tdb-winner-match-lines .tdb-winner-vs {
  color: #64748b;
  font-weight: 600;
  margin: 0 0.35rem;
}

.tdb-winner-placements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.tdb-winner-placements li strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.tdb-winner-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
}

.tdb-winner-photo-slot {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 0.85rem;
  background: #fff;
}

.tdb-winner-photo-slot h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.tdb-winner-photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
  display: block;
  margin-bottom: 0.5rem;
}

.tdb-winner-photo-slot .tdb-winner-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tdb-winner-photo-slot input[type="file"] {
  font-size: 0.8rem;
  max-width: 100%;
}

.td-filter-label-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.td-filter-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 0.55rem 2.35rem 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.9375rem;
  font-family: var(--font);
  min-width: 11rem;
  min-height: 2.5rem;
  line-height: 1.35;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 1.05rem;
  color: #0f172a;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.td-filter-select::-ms-expand {
  display: none;
}

.td-filter-select:hover {
  border-color: #94a3b8;
}

.td-filter-search {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  background: #fff;
  color: #0f172a;
  width: 100%;
  min-width: 0;
}

.td-filter-select:focus,
.td-filter-search:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* ----- Tournament dashboard: modals (Add event, player, draw, etc.) ----- */
.modal-box.modal-lg {
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
  padding: 1.35rem 1.5rem 1.5rem;
  box-sizing: border-box;
}

.modal-box.modal-lg .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
  padding-right: 0;
}

.modal-box.modal-lg .modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
  padding-right: 0;
  flex: 1;
  min-width: 0;
}

.modal-box.modal-lg .modal-header .modal-close {
  position: static;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.modal-box.modal-lg .error-msg {
  margin: 0.35rem 0 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.modal-box.modal-lg .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.25rem;
  align-items: start;
}

.modal-box.modal-lg .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.modal-box.modal-lg .form-group.full {
  grid-column: 1 / -1;
}

.modal-box.modal-lg .form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  line-height: 1.3;
}

.modal-box.modal-lg .form-group .required {
  color: #dc2626;
  font-weight: 700;
}

.modal-box.modal-lg .form-optional-hint {
  font-weight: 500;
  color: #6b7280;
  font-size: 0.8125rem;
}

.modal-box.modal-lg .form-group input[type="text"],
.modal-box.modal-lg .form-group input[type="email"],
.modal-box.modal-lg .form-group input[type="tel"],
.modal-box.modal-lg .form-group input[type="number"],
.modal-box.modal-lg .form-group input[type="date"],
.modal-box.modal-lg .form-group input[type="datetime-local"],
.modal-box.modal-lg .form-group select,
.modal-box.modal-lg .form-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.72rem 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font);
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-box.modal-lg .form-group input::placeholder,
.modal-box.modal-lg .form-group textarea::placeholder {
  color: #9ca3af;
}

.modal-box.modal-lg .form-group input:hover,
.modal-box.modal-lg .form-group select:hover,
.modal-box.modal-lg .form-group textarea:hover {
  border-color: #94a3b8;
}

.modal-box.modal-lg .form-group input:focus,
.modal-box.modal-lg .form-group select:focus,
.modal-box.modal-lg .form-group textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.modal-box.modal-lg .form-group select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.72rem center;
  background-size: 1.1rem;
  padding: 0.72rem 2.6rem 0.72rem 0.9rem;
  min-height: 2.875rem;
  line-height: 1.4;
}

.modal-box.modal-lg .form-group select::-ms-expand {
  display: none;
}

.modal-box.modal-lg .modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e5e7eb;
}

.modal-box.modal-lg .modal-actions .btn {
  min-width: 6.5rem;
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
  border-radius: 10px;
}

.modal-box.modal-lg .tdb-modal-actions-wrap {
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Generate draw modal — type-specific panels */
.tdb-draw-intro-block {
  margin-top: 0.25rem;
}

.tdb-draw-panel-hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #475569;
  padding: 0.65rem 0.85rem;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.tdb-draw-type-panel {
  margin-top: 0.35rem;
}

.tdb-draw-type-panel .tdb-draw-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.65rem;
  letter-spacing: -0.01em;
}

.tdb-draw-type-panel .form-group.full {
  margin-bottom: 0;
}

/* Draw participants summary: scroll long included / excluded lists */
#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-box {
  max-height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-box .modal-header,
#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-intro {
  flex-shrink: 0;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(calc(90vh - 11rem), 640px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.35rem;
  margin-right: -0.05rem;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-scroll .tdb-draw-summary-heading:first-child {
  margin-top: 0;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-box .modal-actions {
  flex-shrink: 0;
  margin-top: 0.75rem;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

#tdbDrawExcludedPlayersModal .tdb-draw-summary-modal-actions #tdbDrawSummaryModalBackBtn {
  margin-right: auto;
}

/* Hybrid generate modal: scroll when content is tall (pools + hints + stage 2) */
#tdbGenerateDrawModalHybridS1.modal .modal-box.modal-lg,
#tdbGenerateDrawModalHybridS2.modal .modal-box.modal-lg {
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

#tdbGenerateDrawModalHybridS1 .modal-box.modal-lg > .modal-header,
#tdbGenerateDrawModalHybridS1 .modal-box.modal-lg > .error-msg,
#tdbGenerateDrawModalHybridS2 .modal-box.modal-lg > .modal-header,
#tdbGenerateDrawModalHybridS2 .modal-box.modal-lg > .error-msg {
  flex-shrink: 0;
}

#tdbGenerateDrawModalHybridS1 .modal-box.modal-lg form,
#tdbGenerateDrawModalHybridS2 .modal-box.modal-lg form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#tdbGenerateDrawModalHybridS1 .tdb-modal-body-scroll,
#tdbGenerateDrawModalHybridS2 .tdb-modal-body-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(calc(90vh - 8rem), 640px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.2rem;
  margin-right: -0.05rem;
}

#tdbGenerateDrawModalHybridS1 .modal-actions,
#tdbGenerateDrawModalHybridS2 .modal-actions {
  flex-shrink: 0;
  margin-top: 0;
}

/* Schedule: round robin points tables */
.tdb-rr-standings-section {
  margin-bottom: 1.25rem;
}
.tdb-rr-standings-block {
  margin-bottom: 1.5rem;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.tdb-rr-standings-block h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.tdb-rr-standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.tdb-rr-standings-table th,
.tdb-rr-standings-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.tdb-rr-standings-table th {
  font-weight: 600;
  color: #475569;
  background: #fff;
}
.tdb-rr-standings-table tbody tr:last-child td {
  border-bottom: none;
}
.tdb-rr-standings-name {
  font-weight: 600;
  color: #0f172a;
}

@media (max-width: 520px) {
  .modal-box.modal-lg .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-box.modal-lg .form-group.full {
    grid-column: 1;
  }

  .modal-box.modal-lg {
    padding: 1.15rem 1.1rem 1.25rem;
  }
}

