/* ═══════════════════════════════════════════════════════════════════
   rankedin_new — Theme Extension Styles
   Extends rankedin_prototype.css with CMS-specific layout components
   ═══════════════════════════════════════════════════════════════════ */

/* ── Organization Hero Banner ── */
.rin-hero-banner {
  background: linear-gradient(135deg, var(--teal) 0%, var(--blue) 50%, var(--teal-light) 100%);
  padding: 60px 0;
  margin: -60px -24px 32px;
  position: relative;
  overflow: hidden;
}

.rin-hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="smallSquares" width="20" height="20" patternUnits="userSpaceOnUse"><rect width="2" height="2" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23smallSquares)"/></svg>');
  opacity: 0.3;
}

.rin-hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  color: white;
  padding: 0 24px;
}

.rin-hero-visual {
  position: relative;
  height: 120px;
  margin-bottom: 32px;
}

.rin-hero-shape-1,
.rin-hero-shape-2,
.rin-hero-shape-3 {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
}

.rin-hero-shape-1 {
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.3);
  top: -50px;
  left: -50px;
  animation: float1 6s ease-in-out infinite;
}

.rin-hero-shape-2 {
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.2);
  bottom: -30px;
  right: -30px;
  animation: float2 8s ease-in-out infinite;
}

.rin-hero-shape-3 {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.15);
  top: 20px;
  right: 40%;
  animation: float3 7s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(-20px) translateX(10px); }
}

@keyframes float2 {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(20px) translateX(-10px); }
}

@keyframes float3 {
  0%, 100% { transform: translateY(0px) translateX(0px); }
  50% { transform: translateY(-10px) translateX(20px); }
}

.rin-hero-logo-container {
  position: relative;
  display: inline-block;
  margin-bottom: 24px;
}

.rin-hero-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 2;
}

.rin-hero-logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  filter: blur(30px);
  z-index: 1;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

.rin-hero-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1) 0%, transparent 40%),
                     radial-gradient(circle at 80% 80%, rgba(255,255,255,0.1) 0%, transparent 40%);
  z-index: 0;
}

.rin-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--r-xl);
  padding: 8px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 600;
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rin-hero-badge-icon {
  color: #fbbf24;
  font-size: 18px;
}

.rin-hero-title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 16px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.rin-hero-subtitle {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 40px;
  opacity: 0.95;
  animation: fadeInUp 0.5s ease-out 0.4s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.rin-hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 40px 0 48px;
  flex-wrap: wrap;
  animation: fadeIn 0.5s ease-out 0.6s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rin-hero-stat-item {
  text-align: center;
  min-width: 80px;
}

.rin-hero-stat-number {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rin-hero-stat-label {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 500;
}

.rin-hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  animation: fadeInUp 0.5s ease-out 0.8s both;
}

.rin-hero-btn-primary,
.rin-hero-btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.rin-hero-btn-primary {
  background: white;
  color: var(--teal);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.rin-hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #f0fdfa, #ecfdfa);
}

.rin-hero-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.rin-hero-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.rin-hero-btn-icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .rin-hero-banner {
    margin: -40px -16px 24px;
    padding: 40px 0;
  }
  
  .rin-hero-title {
    font-size: 36px;
  }
  
  .rin-hero-stats {
    gap: 24px;
  }
  
  .rin-hero-stat-item {
    min-width: 60px;
  }
  
  .rin-hero-stat-number {
    font-size: 28px;
  }
  
  .rin-hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .rin-hero-btn-primary,
  .rin-hero-btn-secondary {
    width: 100%;
    max-width: 240px;
  }
}

/* ── Page Layout ── */
.page-content-inner {
  /*padding: 24px;*/
  padding: 0px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-content-wrapper {
  flex: 1;
  min-height: 0;
}

/* ── Pre-paint desktop sidebar state ── */
html.sidebar-collapsed-preload .app-shell {
  grid-template-columns: var(--sidebar-w-mini) 1fr;
}

html.sidebar-collapsed-preload .app-shell .sidebar {
  padding: 28px 12px;
}

html.sidebar-collapsed-preload .app-shell .sidebar-toggle {
  transform: rotate(180deg);
}

html.sidebar-collapsed-preload .app-shell .brand-section {
  justify-content: center;
}

html.sidebar-collapsed-preload .app-shell .brand-text,
html.sidebar-collapsed-preload .app-shell .nav-text,
html.sidebar-collapsed-preload .app-shell .theme-label,
html.sidebar-collapsed-preload .app-shell .sidebar-app-promo {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
}

html.sidebar-collapsed-preload .app-shell .nav-item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}

html.sidebar-collapsed-preload .app-shell .theme-toggle-section {
  padding: 12px 8px;
  justify-content: center;
}

html.sidebar-collapsed-preload .app-shell .nav-text,
html.sidebar-collapsed-preload .app-shell .theme-label,
html.sidebar-collapsed-preload .app-shell .sidebar-app-promo {
  display: none;
}

html.sidebar-collapsed-preload .app-shell .nav-section-label {
  opacity: 0;
}

@media (max-width: 980px) {
  html.sidebar-collapsed-preload .app-shell {
    grid-template-columns: 1fr !important;
  }
}

/* ── Site Footer ── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--surface-border);
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

.footer-cols {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 32px;
  margin-bottom: 32px;
}

@media (max-width: 900px) {
  .footer-cols {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .footer-cols {
    grid-template-columns: 1fr;
  }
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.footer-brand strong {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.footer-col h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col ul li a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-col ul li a:hover {
  color: var(--teal);
}

.footer-col p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-col p a {
  color: var(--teal);
  text-decoration: none;
}

.footer-social {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.footer-social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 16px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.footer-social a:hover {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.footer-social a img {
  display: none;
}

[data-theme="dark"] .footer-social a {
  background: var(--surface);
  border-color: var(--surface-border);
  color: var(--text-muted);
}

[data-theme="dark"] .footer-social a:hover {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.footer-bottom {
  border-top: 1px solid var(--surface-border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.footer-bottom a {
  font-size: 13px;
  color: var(--teal);
  text-decoration: none;
}

/* ── Header Bar ── */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
  gap: 16px;
}

.header-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

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

/* ── Topnav New ── */
.rin-topnav-new {
  display: none;
}

/* ── Sidebar Search ── */
.sidebar-search-wrap {
  position: relative;
  padding: 0 16px 12px;
}

.sidebar-search-input {
  width: 100%;
  padding-right: 32px;
}

.sidebar-search-icon {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

/* ── Brand Link ── */
.brand-link,
.mobile-brand-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Main Content Hero ── */
.main-content-hero {
  background: var(--bg-gradient);
  padding: 60px 24px;
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal);
  margin-bottom: 8px;
}

.hero-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-accent {
  color: var(--teal);
}

.hero-sub {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-cta-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--surface-border);
}

.hero-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.hero-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
  font-size: 13px;
}

.hero-links a {
  color: var(--teal);
  text-decoration: none;
}

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

/* ── Stats Section ── */
.stats-section {
  padding: 40px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-border);
}

.stats-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.kpi-grid--home {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 700px) {
  .kpi-grid--home {
    grid-template-columns: 1fr;
  }
}

/* ── Features Section ── */
.features-section {
  padding: 60px 24px;
  background: var(--bg);
}

.features-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
}

@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.feature-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 24px;
  border: 1px solid var(--surface-border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.feature-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.feature-card h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Org Promo Section ── */
.org-promo-section {
  padding: 60px 24px;
  background: var(--surface);
}

.org-promo-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 900px) {
  .org-promo-inner {
    grid-template-columns: 1fr;
  }
}

.org-promo-img img {
  width: 100%;
  border-radius: var(--r-lg);
}

.org-promo-text h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.org-promo-text p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ── Tournament Banner ── */
.tournament-banner-card {
  padding: 0;
  overflow: hidden;
}

.tournament-banner-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .tournament-banner-inner {
    grid-template-columns: 1fr;
  }
}

.tournament-banner-left {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.tournament-logo-wrap {
  flex-shrink: 0;
}

.tournament-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--r-sm);
  border: 1px solid var(--surface-border);
}

.tournament-banner-badges {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tournament-banner-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.tournament-banner-title a {
  color: inherit;
  text-decoration: none;
}

.tournament-banner-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tournament-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tournament-join-box {
  background: var(--surface-hover);
  border-radius: var(--r-md);
  padding: 20px;
  border: 1px solid var(--surface-border);
  text-align: center;
  min-width: 200px;
}

.join-status-big {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--teal);
  display: block;
  margin-bottom: 8px;
}

.tournament-join-count {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.tournament-join-count .count {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.tournament-details-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .tournament-details-grid {
    grid-template-columns: 1fr;
  }
}

.tournament-info-table {
  width: 100%;
  border-collapse: collapse;
}

.tournament-info-table th,
.tournament-info-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-border);
  font-size: 14px;
  vertical-align: top;
}

.tournament-info-table th {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 140px;
  text-align: right;
}

.tournament-info-table td {
  color: var(--text);
}

.tournament-sidebar-logo-img {
  max-width: 160px;
  max-height: 160px;
  object-fit: contain;
  margin-bottom: 16px;
}

/* ── Profile Header ── */
.profile-header-card {
  padding: 24px;
}

.profile-header-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

@media (max-width: 600px) {
  .profile-header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.profile-avatar-lg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.profile-lastname {
  color: var(--teal);
}

.profile-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.profile-club {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.profile-club-name {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.profile-stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Org Header ── */
.org-header-card {
  padding: 24px;
}

.org-header-inner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.org-logo-lg {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--r-sm);
  border: 1px solid var(--surface-border);
  flex-shrink: 0;
}

.org-header-name {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.org-header-location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.org-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.org-ranking-calendar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .org-ranking-calendar-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Admin Panel Grid ── */
.admin-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .admin-panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.admin-panel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: var(--surface-hover);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
  text-decoration: none;
  transition: all var(--transition);
  gap: 8px;
}

.admin-panel-card:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.admin-panel-card-icon {
  font-size: 28px;
}

.admin-panel-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.admin-panel-card-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--teal);
}

/* ── Admin Quick Actions ── */
.admin-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Profile Quick Actions ── */
.quick-actions-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Tournament Launch ── */
.tournament-launch-wrap {
  text-align: center;
  padding: 40px 20px;
}

.tournament-launch-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.tournament-launch-wrap h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.tournament-launch-summary {
  background: var(--surface-hover);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
  padding: 20px;
  margin: 24px auto;
  max-width: 480px;
  text-align: left;
}

.tournament-launch-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-border);
  font-size: 14px;
}

.tournament-launch-summary-row:last-child {
  border-bottom: none;
}

.tournament-launch-summary-row span {
  color: var(--text-muted);
}

.tournament-launch-summary-row strong {
  color: var(--text);
}

.tournament-launch-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Bracket Type Cards ── */
.bracket-type-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  background: var(--surface-hover);
  border-radius: var(--r-sm);
  border: 1px solid var(--surface-border);
  cursor: pointer;
  transition: border-color var(--transition);
}

.bracket-type-card.active,
.bracket-type-card:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-glow);
}

/* ── Groups Monrad Promo ── */
.groups-monrad-promo {
  text-align: center;
  padding: 20px;
  background: var(--surface-hover);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
}

.groups-monrad-promo h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── Registration ── */
.registration-form-wrap,
.create-org-form-wrap,
.feedback-form-wrap,
.gen-draw-form-wrap,
.tournament-join-form-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.registration-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 32px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

.registration-login-link {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Offline Page ── */
.offline-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.offline-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--surface-border);
  max-width: 480px;
  width: 100%;
}

.offline-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.offline-card h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.offline-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.offline-card .btn {
  margin: 0 6px;
}

/* ── Tournament Join Info ── */
.tournament-join-info-card {
  background: var(--surface-hover);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
  padding: 20px;
  margin-bottom: 20px;
}

.tournament-join-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-border);
  font-size: 14px;
}

.tournament-join-info-row:last-child {
  border-bottom: none;
}

.tournament-join-info-label {
  color: var(--text-muted);
}

.tournament-join-info-value {
  color: var(--text);
  font-weight: 500;
}

/* ── Match String ── */
.match-string-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--r-sm);
  border: 1px solid var(--surface-border);
  margin-bottom: 8px;
  gap: 16px;
}

.match-string-players {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.match-string-player {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.match-string-player.winner {
  font-weight: 700;
  color: var(--teal);
}

.match-string-seed {
  width: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.match-string-name {
  flex: 1;
}

.match-string-score {
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.match-string-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.match-string-round {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Tablo ── */
.tablo-match-card {
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
  padding: 16px;
  margin-bottom: 12px;
}

.tablo-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tablo-court {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.tablo-match-players {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tablo-player {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-hover);
  border-radius: var(--r-sm);
}

.tablo-player.winner {
  background: var(--good-bg);
}

.tablo-player-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tablo-player-score {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.tablo-divider {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.tablo-match-sets {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Gen Draw Progress ── */
.gen-draw-progress {
  margin-bottom: 24px;
}

.gen-draw-progress-bar {
  height: 8px;
  background: var(--surface-border);
  border-radius: 4px;
  overflow: hidden;
}

.gen-draw-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── Tournament Info Admin String ── */
.tournament-info-adminstring {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}

.admin-string-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Org Logo SM ── */
.org-logo-sm,
.rating-logo-sm {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Sidebar Nav ── */
.sidebar-nav .nav-menu {
  padding: 0 8px;
}

/* ── Responsive adjustments ── */
@media (max-width: 768px) {
  .page-content-inner {
    padding: 16px;
  }

  .header-bar {
    padding: 12px 16px;
  }

  .tournament-banner-left {
    flex-direction: column;
  }

  .profile-header-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-stats-row {
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Component Styles — migrated from legacy inline <style> blocks
   ═══════════════════════════════════════════════════════════════════ */

/* ── Avatar Upload Overlay ── */
.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  opacity: 0;
  transition: opacity var(--transition);
  cursor: pointer;
}

.img-wrapper:hover .avatar-upload-overlay {
  opacity: 1;
}

.avatar-upload-overlay .upload-picture {
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  cursor: pointer;
}

.avatar-upload-overlay .icon-upload-avatar {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
}

/* ── Events Tabs ── */
.events-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.events-tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition);
}

.events-tab:hover {
  border-color: var(--teal);
  color: var(--text);
}

.events-tab.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.events-limit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.events-select {
  padding: 6px 28px 6px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-sm);
  cursor: pointer;
}

/* ── Event Cards ── */
.event-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 12px;
  transition: box-shadow var(--transition);
}

.event-card:hover {
  box-shadow: var(--shadow);
}

.event-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.event-card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Load More Button ── */
.load-more-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 24px auto 0;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.load-more-btn:hover {
  border-color: var(--teal);
  background: var(--teal-glow);
}

/* ── Membership Cards ── */
.membership-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition);
}

.membership-card:hover {
  box-shadow: var(--shadow);
}

.membership-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.membership-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.membership-info {
  flex: 1;
  min-width: 0;
}

/* ── Match Rows ── */
.match-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.match-row.win {
  border-left: 3px solid var(--good);
}

.match-row.loss {
  border-left: 3px solid var(--bad);
}

.match-players {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.match-player {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.match-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.match-vs {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 8px;
}

.match-result-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.result-badge {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: var(--r-sm);
}

.match-row.win .result-badge {
  background: var(--good-bg);
  color: var(--good);
}

.match-row.loss .result-badge {
  background: var(--bad-bg);
  color: var(--bad);
}

.match-score {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  min-width: 40px;
  text-align: center;
}

.match-games {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Opponent Detailed Card ── */
.opponent-detailed-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
}

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

.opponent-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.opponent-info {
  flex: 1;
  min-width: 0;
}

.opponent-name {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.opponent-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  font-size: 13px;
  color: var(--text-muted);
}

.stat-item strong {
  color: var(--text);
  margin-right: 4px;
}

/* ── Rating / Skill Charts ── */
.rating-chart {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 16px;
}

#rating-chart,
#skill-chart {
  width: 100%;
  height: 300px;
}

/* ── Career Table ── */
.career-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.career-table th,
.career-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
  text-align: center;
}

.career-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-hover);
}

.career-table td.text-left {
  text-align: left;
  color: var(--text-muted);
}

.career-table td strong {
  color: var(--text);
}

.career-table td small {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   FIX: Last Events Played + Avatar Upload Overlay
   ═══════════════════════════════════════════════════════════════════ */

/* Avatar wrapper fixes */
.img-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 50%;
  overflow: hidden;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-block;
}

/* Ensure overlay fits exactly inside the circular avatar */
.avatar-upload-overlay {
  border-radius: 50%;
  overflow: hidden;
}

/* Last Events Played carousel layout */
.last-events-played-carousel-wrapper {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.desktop-no-carousel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Last match card (backend generated) */
.last-match-item {
  flex: 1 1 280px;
  min-width: 260px;
  max-width: 350px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.last-match-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* Rin card parts */
.last-match-item .rin-card-title {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.last-match-item .rin-card-body {
  padding: 16px;
}

.last-match-item .rin-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--surface-border);
  background: var(--surface-hover);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/* Type label (win/loss) */
.rin-type-label {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rin-type-label.win {
  background: var(--good-bg);
  color: var(--good-text);
}

.rin-type-label.loss {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* Last match players layout */
.last-match-players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.player-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  flex: 1;
  min-width: 0;
}

.player-box a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.player-box.winner {
  color: var(--good-text);
}

.player-box.loser {
  color: var(--danger-text);
}

.player-box span {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* VS divider */
.vs-divider {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-subtle);
  padding: 4px 8px;
  background: var(--surface-hover);
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

/* Match avatar inside last events */
.match-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface-border);
}

.player-box.winner .match-avatar {
  border-color: var(--good-text);
}

.player-box.loser .match-avatar {
  border-color: var(--danger-text);
}

/* Match result in footer */
.match-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.result-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.detailed-results {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.detailed-results span {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--surface-border);
}

/* Event name link */
.event-name {
  color: var(--teal);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.event-name:hover {
  text-decoration: underline;
}

/* Responsive last events */
@media (max-width: 768px) {
  .desktop-no-carousel {
    flex-direction: column;
    align-items: stretch;
  }

  .last-match-item {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .last-match-players {
    gap: 8px;
  }

  .match-avatar {
    width: 40px;
    height: 40px;
  }
}

/* ── Nav Collapsible Section ── */
.nav-section-group {
  margin-bottom: 8px;
}

.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--r-md);
  transition: background-color var(--transition);
  user-select: none;
}

.collapse-toggle:hover {
  background-color: var(--surface-hover);
}

.collapse-toggle .icon-v {
  margin-left: auto;
  transition: transform var(--transition);
}

.collapse-toggle .icon-v.collapsed {
  transform: rotate(180deg);
}

.collapse-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 500px;
  opacity: 1;
}

.collapse-body.collapse-body-collapsed {
  max-height: 0;
  opacity: 0;
}

.collapse-body ul {
  list-style: none;
  padding: 0 0 8px 16px;
  margin: 0;
}

.collapse-body ul li {
  padding: 8px 0;
}

.collapse-body ul li a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition);
}

.collapse-body ul li a:hover {
  color: var(--teal);
}

/* ── Opponent Cards (backend-generated for user_info.tpl) ── */
.opponents-info-cards-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.opponent-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  overflow: hidden;
}

.opponent-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.opponent-card .rin-card-header {
  padding: 16px 16px 8px;
  text-align: center;
}

.opponent-card .rin-card-header a {
  display: inline-block;
}

.opponent-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface-border);
  transition: border-color var(--transition);
}

.opponent-card:hover .opponent-avatar {
  border-color: var(--teal);
}

.opponent-card .rin-card-body {
  padding: 8px 16px 12px;
}

.opponent-card .first-name {
  font-size: 13px;
  color: var(--text-muted);
}

.opponent-card .last-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.opponent-card .rin-card-footer {
  padding: 12px 16px;
  background: var(--surface-hover);
  border-top: 1px solid var(--surface-border);
  text-align: center;
}

.opponents-info-card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.opponents-info-card-footer hr {
  width: 100%;
  border: none;
  border-top: 1px solid var(--surface-border);
  margin: 0 0 8px;
}

.matches-counter {
  font-size: 20px;
  font-weight: 700;
  color: var(--teal);
}

.matches-text {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: lowercase;
}

/* ── Recent Events (backend-generated) ── */
.recent-events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  gap: 12px;
}

.recent-event-row:hover {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.recent-event-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.recent-event-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-event-name:hover {
  color: var(--teal);
}

.recent-event-date {
  font-size: 13px;
  color: var(--text-muted);
}

.recent-event-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--info-bg);
  color: var(--info-text);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   Inline Styles Migration — Tournament Templates
   ═══════════════════════════════════════════════════════════════════ */



/* ── Step4 Search Players (newrankedin style) ── */
#window_payers .custom-modal__content,
#window_payers_reg .custom-modal__content {
  max-width: 520px;
}
#search_results {
  margin-top: 16px;
  border-top: 1px solid var(--surface-border);
  padding-top: 12px;
}
.player-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) var(--surface-hover);
}
.player-search-list::-webkit-scrollbar { width: 5px; }
.player-search-list::-webkit-scrollbar-track { background: var(--surface-hover); border-radius: 3px; }
.player-search-list::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 3px; }
.player-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-border);
  transition: background 0.2s;
}
.player-search-item:hover {
  background: var(--surface-hover);
}
.player-search-item:last-child {
  border-bottom: none;
}
.player-search-item .player-avatar-link {
  flex-shrink: 0;
  line-height: 0;
  border-radius: 50%;
}
.player-search-item .player-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-border);
  display: block;
}
.player-search-item .player-avatar-link:hover .player-avatar {
  box-shadow: 0 0 0 2px var(--teal);
}
.player-search-item .player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-search-item .player-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-search-item .player-name:hover {
  color: var(--teal);
}
.player-search-item .player-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.player-search-item .btn-add-player {
  flex-shrink: 0;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--r-sm, 8px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.player-search-item .btn-add-player:hover {
  background: var(--teal-light);
  box-shadow: 0 4px 12px var(--teal-glow-lg);
}
.player-search-item .btn-add-player:active {
  transform: scale(0.97);
}
.player-search-item .btn-add-player.added {
  background: var(--good-bg, #dcfce7);
  color: var(--good-text, #166534);
  border-color: transparent;
  cursor: default;
  pointer-events: none;
}
.player-search-item .player-already-in {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 10px;
  background: var(--surface-hover);
  border-radius: var(--r-sm, 8px);
  border: 1px solid var(--surface-border);
}
.player-search-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Step4 Table Column Widths ── */
#myTable th.cell-num,
#myTable td.cell-num {
  width: 40px;
  text-align: center;
}
#myTable th.cell-flag,
#myTable td.cell-flag {
  width: 40px;
}
#myTable th.cell-name,
#myTable td.cell-name {
  width: auto;
}
#myTable th.cell-action,
#myTable td.cell-action {
  width: 100px;
  text-align: center;
}

/* ── Custom Modal (from tournament_step3.tpl) ── */
.custom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}
.custom-modal__content {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.custom-modal__close {
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted, #a0aec0);
  transition: color 0.2s;
  line-height: 1;
  z-index: 1;
}
.custom-modal__close:hover {
  color: #ff4444;
}
.custom-modal--open {
  display: flex !important;
}

.category-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

/* ── Dates Header (styled table header for "Даты игр") ── */
.dates-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(13,148,136,0.08) 0%, rgba(37,99,235,0.08) 100%);
  color: var(--teal, #0d9488);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.dates-header i {
  font-size: 13px;
}

/* ── RIN Modal Wrapper (from tournament_step7.tpl) ── */
.rin-modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
}
.rin-modal-wrapper.d-none {
  display: none !important;
}
.rin-modal {
  width: 100%;
  max-width: 400px;
  background: #FFF;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  margin: 15% auto;
}
.icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}
.icon-circle--success {
  background: rgba(46, 204, 113, 0.1);
  color: #2ecc71;
}
.icon-circle--error {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

/* ── Form Message Toast (from tournament_step3.tpl) ── */
.form-message-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ff4444;
  color: white;
  padding: 10px 20px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border-radius: 5px;
}

/* ── Wizard Panel Centered (from tournament_step9.tpl) ── */
.wizard-panel--centered {
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface, #ffffff);
  border: 1px solid var(--surface-border, #e2e8f0);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 4px 16px -2px rgba(0,0,0,0.06));
}

/* ── Wizard Nav Bordered (from step7, step8, step9) ── */
.wizard-nav--bordered {
  border-top: 1px solid var(--surface-border, #e2e8f0);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
}
.wizard-nav--bordered-start {
  border-top: 1px solid var(--surface-border, #e2e8f0);
  padding-top: 20px;
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

/* ── Step 9 Status Buttons — visual state indicators ── */
.tournament-status-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--r-md, 14px);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition, 0.25s);
  text-align: center;
}

.tournament-status-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tournament-status-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.tournament-status-btn.btn-current {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.tournament-status-btn .btn-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tournament-status-btn:not(:disabled) .btn-status-dot {
  background: currentColor;
  animation: statusPulse 2s ease-in-out infinite;
}

.tournament-status-btn:disabled .btn-status-dot {
  background: var(--text-subtle, #94a3b8);
  animation: none;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ── Step 9 Tournament Quick Nav ── */
.tournament-quick-nav {
  margin-top: 24px;
}

.tournament-quick-nav-title {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  text-align: center;
}

.tournament-quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 500px) {
  .tournament-quick-nav-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tournament-quick-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-hover, #f8fafc);
  border: 1px solid var(--surface-border, #e2e8f0);
  border-radius: var(--r-sm, 8px);
  text-decoration: none;
  transition: all var(--transition, 0.25s);
}

.tournament-quick-nav-link:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-glow, rgba(13,148,136,0.12));
}

.tournament-quick-nav-link .nav-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Players Modal (from tournament_players.tpl) ── */
.players-confirm-modal {
  position: fixed;
  top: 30%;
  left: 35%;
  width: 30%;
  z-index: 1050;
  background: #242526;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.players-confirm-modal .modal-dialog {
  max-width: 100%;
  margin: 0;
}
.players-confirm-modal .modal-content {
  background: none;
  border: none;
  box-shadow: none;
}
.players-confirm-modal .modal-header {
  border-bottom: 1px solid #444;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.players-confirm-modal .modal-title {
  margin: 0;
}
.players-confirm-modal .modal-body {
  padding: 20px;
}
.players-confirm-modal .modal-footer {
  border-top: 1px solid #444;
  padding: 15px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Draws Modal Dropdown (from tournament_draws.tpl / drawpreview.tpl) ── */
.draws-dropdown-menu {
  position: absolute;
  z-index: 1050;
  display: none;
}
.draws-dropdown-header {
  padding: 5px 15px;
  font-weight: bold;
  color: #777;
}
.draws-dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 5px 0;
}

/* ── Scoring Table (from draws / drawpreview) ── */
.scoring-table-box {
  display: none;
  border: 1px solid #eee;
  padding: 10px;
  border-radius: 6px;
}

/* ── Inline style replacements ── */
.u-pos-relative {
  position: relative;
}
.u-text-right {
  text-align: right;
}
.u-font-italic {
  font-style: italic;
}
.u-font-normal {
  font-weight: normal;
}
.u-border-bottom-section {
  border-bottom: 1px solid var(--surface-border, #e2e8f0);
  padding-bottom: 15px;
}
.u-teal-text {
  color: var(--teal, #0d9488);
}
.u-bg-dark-input {
  background: var(--surface-hover, #f8fafc);
  border-color: var(--surface-border, #e2e8f0);
  font-weight: bold;
  color: var(--teal, #0d9488);
}

/* ── Overlay (from tournament_step7.tpl) ── */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
}

/* ── Modal Monrad (from modal_monrad.tpl) ── */
/* Push overlay behind all modals so it never covers their content */
#overlay {
  z-index: 1999;
}
.modal-overlay .modal-body {
  max-height: 65vh;
  overflow-y: auto;
}
#groupsMonradWizard {
  z-index: 9999;
}
#groupsMonradWizard .modal {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
#groupsMonradWizard .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--surface-border);
}
#groupsMonradWizard .modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
#groupsMonradWizard .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--surface-border);
/*  background: var(--surface);*/
}
#groupsMonradWizard .modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  max-height: 65vh;
  background: var(--surface);
  color: var(--text);
}
#groupsMonradWizard .modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-hover);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition), color var(--transition);
}
#groupsMonradWizard .modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger-text);
}
#groupsMonradWizard table th,
#groupsMonradWizard table td {
  color: var(--text);
  border-color: var(--surface-border);
}
#groupsMonradWizard input[type="text"],
#groupsMonradWizard input[type="number"] {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 14px;
}
#groupsMonradWizard input[type="text"]:focus,
#groupsMonradWizard input[type="number"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
  outline: none;
}
#groupsMonradWizard select {
  background: var(--surface-hover);
  border: 1px solid var(--surface-border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 14px;
}
#groupsMonradWizard label {
  color: var(--text-muted);
}
#groupsMonradWizard .wizard-modal-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 12px;
}
#groupsMonradWizard .wizard-modal-step {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
  padding: 6px;
  cursor: pointer;
}
#groupsMonradWizard .wizard-modal-step.active {
  color: var(--teal);
  font-weight: 700;
  border-bottom: 2px solid var(--teal);
}
#groupsMonradWizard .wizard-modal-step.done {
  color: var(--good-text);
}

/* ── Checkbox field card variant ── */
.checkbox-field--card {
  border: 1px solid #333;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.checkbox-field--card:hover {
  border-color: #444;
}

/* ═══════════════════════════════════════════════════════════════════
   Inline Styles Migration — User Templates
   ═══════════════════════════════════════════════════════════════════ */

/* ── Events Page (from user_events.tpl) ── */
.events-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.events-tab-content {
  display: none;
}

.events-tab-content.active {
  display: block;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-card-main {
  flex: 1;
  min-width: 0;
}

.event-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-card-title a {
  color: inherit;
  text-decoration: none;
}

.event-card-title a:hover {
  color: var(--teal);
}

.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.event-card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-card-status {
  flex-shrink: 0;
}

.events-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.events-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.events-empty-text {
  font-size: 16px;
}

/* ── Matches Page (from user_matches.tpl) ── */
.matches-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.match-date {
  min-width: 100px;
  text-align: center;
  color: var(--text-muted);
}

.match-day {
  font-weight: 600;
  color: var(--text);
}

.match-time {
  color: var(--text-subtle);
  font-size: 12px;
}

.match-tournament-info {
  text-align: right;
}

.match-tournament-info a {
  color: var(--teal);
  text-decoration: none;
}

/* ── Memberships Page (from user_memberships.tpl) ── */
.memberships-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-membership {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--surface-border);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.empty-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.empty-hint {
  font-size: 14px;
  color: var(--text-subtle);
}

/* ── Opponents Page (from user_opponents.tpl) ── */
.opponents-detailed-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.opponent-detailed-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.opponent-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--surface-border);
}

.opponent-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.opponent-info {
  flex: 1;
}

.opponent-location {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 3px;
}

.opponent-rating {
  color: var(--good-text);
  font-weight: 500;
  font-size: 14px;
}

.opponent-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 15px;
}

.stat-item .stat-value {
  display: block;
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  line-height: 1.15;
}

.stat-item .stat-value.date-value {
  font-size: 16px;
}

.stat-item .stat-value.win {
  color: var(--good-text);
}

.stat-item .stat-value.loss {
  color: var(--danger-text);
}

.stat-item .stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Ratings Page (from user_rankings.tpl) ── */
.rating-chart {
  padding: 20px 0;
}

.rating-history-table th {
  cursor: pointer;
  user-select: none;
}

.rating-history-table th:hover {
  color: var(--teal);
}

.rating-history-table .positive {
  color: var(--good-text);
  font-weight: 600;
}

.rating-history-table .negative {
  color: var(--danger-text);
  font-weight: 600;
}

.current-rating-value {
  font-weight: 700;
  color: var(--teal);
  font-size: 16px;
}

/* ── Skill Page (from user_skill.tpl) ── */
.skill-chart-wrapper {
  padding: 20px 0;
}

.skill-matches-table th {
  cursor: pointer;
  user-select: none;
}

.skill-matches-table th:hover {
  color: var(--teal);
}

.skill-matches-table .match-row.win .result-badge.win {
  background: var(--good-bg);
  color: var(--good-text);
}

.skill-matches-table .match-row.loss .result-badge.loss {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.result-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ── Registration Page (from registration.tpl) ── */
.registration-form-wrap {
  max-width: 600px;
  margin: 0 auto;
}

.registration-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 32px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
}

.regtext {
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .text-danger {
  color: var(--danger-text);
}

.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-subtle);
}

.c-captcha {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.c-captcha img {
  border-radius: var(--r-sm);
}

.wizard-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.registration-login-link {
  color: var(--text-muted);
  font-size: 14px;
}

.registration-login-link a {
  color: var(--teal);
  text-decoration: none;
}

.registration-login-link a:hover {
  text-decoration: underline;
}

/* ── Responsive Events ── */
@media (max-width: 640px) {
  .events-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .events-tabs {
    justify-content: center;
  }

  .events-tab {
    flex: 1;
    text-align: center;
    padding: 12px 14px;
    font-size: 13px;
  }

  .event-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .event-card-status {
    align-self: flex-start;
  }
}

/* ── Responsive Matches ── */
@media (max-width: 768px) {
  .match-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .match-players {
    justify-content: flex-start;
    width: 100%;
  }

  .match-result-info {
    text-align: left;
    width: 100%;
  }

  .match-tournament-info {
    text-align: left;
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Grid Utilities — migrated from Bootstrap grid
   ═══════════════════════════════════════════════════════════════════ */

.u-grid {
  display: grid;
}

.u-grid-12 {
  grid-template-columns: repeat(12, 1fr);
}

.u-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.u-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.u-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.u-grid-gap-xs { gap: 4px; }
.u-grid-gap-sm { gap: 8px; }
.u-grid-gap-md { gap: 12px; }
.u-grid-gap-lg { gap: 20px; }
.u-grid-gap-xl { gap: 32px; }

.u-col-1 { grid-column: span 1; }
.u-col-2 { grid-column: span 2; }
.u-col-3 { grid-column: span 3; }
.u-col-4 { grid-column: span 4; }
.u-col-5 { grid-column: span 5; }
.u-col-6 { grid-column: span 6; }
.u-col-7 { grid-column: span 7; }
.u-col-8 { grid-column: span 8; }
.u-col-9 { grid-column: span 9; }
.u-col-10 { grid-column: span 10; }
.u-col-11 { grid-column: span 11; }
.u-col-12 { grid-column: span 12; }

@media (min-width: 576px) {
  .u-col-sm-1 { grid-column: span 1; }
  .u-col-sm-2 { grid-column: span 2; }
  .u-col-sm-3 { grid-column: span 3; }
  .u-col-sm-4 { grid-column: span 4; }
  .u-col-sm-5 { grid-column: span 5; }
  .u-col-sm-6 { grid-column: span 6; }
  .u-col-sm-7 { grid-column: span 7; }
  .u-col-sm-8 { grid-column: span 8; }
  .u-col-sm-9 { grid-column: span 9; }
  .u-col-sm-10 { grid-column: span 10; }
  .u-col-sm-11 { grid-column: span 11; }
  .u-col-sm-12 { grid-column: span 12; }
}

@media (min-width: 768px) {
  .u-col-md-1 { grid-column: span 1; }
  .u-col-md-2 { grid-column: span 2; }
  .u-col-md-3 { grid-column: span 3; }
  .u-col-md-4 { grid-column: span 4; }
  .u-col-md-5 { grid-column: span 5; }
  .u-col-md-6 { grid-column: span 6; }
  .u-col-md-7 { grid-column: span 7; }
  .u-col-md-8 { grid-column: span 8; }
  .u-col-md-9 { grid-column: span 9; }
  .u-col-md-10 { grid-column: span 10; }
  .u-col-md-11 { grid-column: span 11; }
  .u-col-md-12 { grid-column: span 12; }
}

@media (min-width: 1024px) {
  .u-col-lg-1 { grid-column: span 1; }
  .u-col-lg-2 { grid-column: span 2; }
  .u-col-lg-3 { grid-column: span 3; }
  .u-col-lg-4 { grid-column: span 4; }
  .u-col-lg-5 { grid-column: span 5; }
  .u-col-lg-6 { grid-column: span 6; }
  .u-col-lg-7 { grid-column: span 7; }
  .u-col-lg-8 { grid-column: span 8; }
  .u-col-lg-9 { grid-column: span 9; }
  .u-col-lg-10 { grid-column: span 10; }
  .u-col-lg-11 { grid-column: span 11; }
  .u-col-lg-12 { grid-column: span 12; }
}

@media (max-width: 767px) {
  .u-col-1, .u-col-2, .u-col-3, .u-col-4,
  .u-col-5, .u-col-6, .u-col-7, .u-col-8,
  .u-col-9, .u-col-10, .u-col-11, .u-col-12,
  .u-col-sm-1, .u-col-sm-2, .u-col-sm-3, .u-col-sm-4,
  .u-col-sm-5, .u-col-sm-6, .u-col-sm-7, .u-col-sm-8,
  .u-col-sm-9, .u-col-sm-10, .u-col-sm-11, .u-col-sm-12,
  .u-col-md-1, .u-col-md-2, .u-col-md-3, .u-col-md-4,
  .u-col-md-5, .u-col-md-6, .u-col-md-7, .u-col-md-8,
  .u-col-md-9, .u-col-md-10, .u-col-md-11, .u-col-md-12,
  .u-col-lg-1, .u-col-lg-2, .u-col-lg-3, .u-col-lg-4,
  .u-col-lg-5, .u-col-lg-6, .u-col-lg-7, .u-col-lg-8,
  .u-col-lg-9, .u-col-lg-10, .u-col-lg-11, .u-col-lg-12 {
    grid-column: span 12;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Inline Styles Migration — Organization / Control / Calendar
   ═══════════════════════════════════════════════════════════════════ */

/* ── Calendar Member Toggle (from calendar.tpl) ── */
.calendar-member-toggle.is-hidden {
  display: none !important;
}

/* ── Create Organization Dropdown (from create_organization.tpl) ── */
.create-org-dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  z-index: 1000;
  padding: 10px;
  list-style: none;
  margin: 5px 0 0 0;
  box-shadow: var(--shadow-lg);
}

.create-org-dropdown-list li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  border-radius: var(--r-sm);
}

.create-org-dropdown-list li:hover:not(.no-hover) {
  background: var(--surface-hover);
  color: var(--text);
}

.create-org-dropdown-list .no-hover {
  padding: 5px 0;
}

.create-org-dropdown-toggle {
  text-align: left;
  height: 42px;
}

.create-org-dropdown-search {
  height: 34px;
}

/* ── Wizard Nav Modifiers ── */
.wizard-nav--end {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--surface-border);
  padding-top: 20px;
}

/* ── Page Flex Layout (from organization.tpl) ── */
.page-flex-layout {
  display: flex;
  flex-flow: column;
  min-height: 100vh;
}

/* ── Organization Modal Grids ── */
.org-modal-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.org-modal-grid--2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.org-modal-grid--input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

/* ── Embed Modal Styles ── */
.embed-modal-body .color-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}

.color-dot:hover,
.color-dot.highlight {
  border-color: var(--text);
  transform: scale(1.1);
}

.embed-modal-body .preview-btn-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
}

.iframe-result-box {
  word-break: break-all;
}

/* ── Share Modal Styles ── */
.share-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.share-btn-item {
  text-align: center;
}

.share-embed-icon {
  width: 48px;
  height: 48px;
}

/* ── Modal Form Grids (from control.tpl) ── */
.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.modal-form-grid--full {
  grid-template-columns: 1fr;
}

.modal-form-grid--2col {
  grid-template-columns: 1fr 1fr;
}

.modal-form-grid--3col {
  grid-template-columns: 1fr auto 1fr;
}

/* ── Admin Modal Custom (from organization_admin.tpl) ── */
.admin-modal-inline {
  position: fixed;
  top: 10%;
  left: 25%;
  width: 50%;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
  .admin-modal-inline {
    left: 5%;
    width: 90%;
  }
}

/* ── Utility: nowrap flex/grid rows ── */
.nowrap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

/* ── Org Footer Grid (from organization.tpl) ── */
.org-footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.org-footer-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .org-footer-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .org-footer-links {
    grid-template-columns: 1fr;
  }

  .org-footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Tournament Controls Grid (from control.tpl) ── */
.container-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.event-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Modal Overlay Utilities ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay .modal {
  position: relative;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
}
.modal--sm  { max-width: 400px; }
.modal--md  { max-width: 600px; }
.modal--lg  { max-width: 900px; }
#groupsMonradWizard .groups-monrad-wizard-form {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Admin tournaments modal compatibility layer (rankedin -> rankedin_new) ── */
#tournamentModal.modal-overlay,
#quickTournamentModal.modal-overlay,
#editCategoryModal.modal-overlay {
  z-index: 3000;
  overflow-y: auto;
  padding: 24px;
}

#tournamentModal .modal-backdrop,
#quickTournamentModal .modal-backdrop,
#editCategoryModal .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

#tournamentModal .modal-dialog,
#quickTournamentModal .modal-dialog,
#editCategoryModal .modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 24px auto;
}

#quickTournamentModal .modal-dialog { max-width: 980px; }
#editCategoryModal .modal-dialog { max-width: 500px; }

#tournamentModal .modal-content,
#quickTournamentModal .modal-content,
#editCategoryModal .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

#tournamentModal .modal-header,
#quickTournamentModal .modal-header,
#editCategoryModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #e5e5e5;
}

#tournamentModal .modal-title,
#quickTournamentModal .modal-title,
#editCategoryModal .modal-title {
  margin: 0;
  line-height: 1.42857143;
}

#tournamentModal .modal-body,
#quickTournamentModal .modal-body,
#editCategoryModal .modal-body {
  position: relative;
  padding: 10px;
  overflow-y: auto;
}

#tournamentModal .modal-footer,
#quickTournamentModal .modal-footer,
#editCategoryModal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px;
  text-align: right;
  border-top: 1px solid #e5e5e5;
}

#tournamentModal .tabs,
#quickTournamentModal .tabs {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding-left: 0;
  list-style: none;
  border-bottom: 1px solid #ddd;
}

#tournamentModal .tabs .nav-item,
#quickTournamentModal .tabs .nav-item {
  margin-bottom: -1px;
}

#tournamentModal .tabs .nav-link,
#quickTournamentModal .tabs .nav-link {
  display: block;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 0;
  color: #555;
  text-decoration: none;
}

#tournamentModal .tabs .nav-link:hover,
#quickTournamentModal .tabs .nav-link:hover {
  border-color: #eee #eee #ddd;
  color: #2f3f7d;
}

#tournamentModal .tabs .nav-link.active,
#quickTournamentModal .tabs .nav-link.active {
  color: #555;
  background-color: #fff;
  border: 1px solid #ddd;
  border-bottom-color: transparent;
}

#tournamentModal .modal-close,
#quickTournamentModal .modal-close,
#editCategoryModal .modal-close {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #000;
  line-height: 1;
  font-size: 24px;
  opacity: 1;
  cursor: pointer;
  padding: 0 8px;
}

#tournamentModal .filter-bar-actions .btn i.fa,
#quickTournamentModal .btn i.fa,
#tournamentModal .btn i.fa,
.filter-bar-actions .btn i.fa,
.filter-bar-actions .btn i.fas {
  display: inline-block !important;
  font-style: normal;
  margin-right: 6px;
}

@media (max-width: 768px) {
  #tournamentModal.modal-overlay,
  #quickTournamentModal.modal-overlay,
  #editCategoryModal.modal-overlay {
    padding: 10px;
    align-items: flex-start;
  }

  #tournamentModal .modal-dialog,
  #quickTournamentModal .modal-dialog,
  #editCategoryModal .modal-dialog {
    margin: 10px auto;
  }
}

/* ── H2H Modal Grid ── */
.h2h-stats-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.h2h-stats-label {
  text-align: center;
}

/* ── Confirm Box ── */
.confirmBox {
  padding: 12px;
  background: var(--surface-hover);
  border-radius: var(--r-sm);
}

.confirmBox-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   Admin Dropdown
   ═══════════════════════════════════════════════════════════════════ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 260px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  margin: 0;
  list-style: none;
  z-index: 1000;
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.dropdown.show .dropdown-menu {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.dropdown-menu li a:hover,
.dropdown-menu li a:focus {
  background: var(--teal-glow);
  color: var(--teal);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .dropdown-menu {
    right: auto;
    left: 0;
    min-width: 220px;
    max-width: calc(100vw - 32px);
  }
}

/* ── Custom UI Alignments and Spacing fixes ── */

/* Align header avatar inline with Playrank 2026 title */
.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header-avatar-block {
  display: flex;
  align-items: center;
}

/* Align and space filter-bar action buttons row to wrap nicely */
.filter-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-bar-separator {
  color: var(--text-subtle);
  font-weight: 500;
  font-size: 14px;
  margin: 0 4px;
}

/* 1. Recent Matches status badge font-size override */
.premium-table td .badge {
  font-size: 100% !important;
}

/* 2. Center game scores in Monrad brackets footer */
.match-score {
  justify-content: center !important;
}

/* 3. Adaptive scrollable score entry modals */
html body #results-modal-backdrop.rin-modal-overlay .rin-modal,
html body #results-modal-backdrop.modal-overlay .modal {
  display: block !important;
  margin: auto !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  max-height: 95vh !important;
  height: auto !important;
}

html body #results-modal-backdrop.rin-modal-overlay .rin-modal-body,
html body #results-modal-backdrop.modal-overlay .modal-body {
  max-height: calc(95vh - 160px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* ── Sidebar App Promo ── */
.sidebar-app-promo {
  margin: 16px;
  padding: 20px 16px;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 50%, #115e59 100%);
  border-radius: 16px;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.sidebar-app-promo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.sidebar-app-promo .app-promo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #062c26;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.sidebar-app-promo .app-promo-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.sidebar-app-promo .app-promo-text strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sidebar-app-promo .app-promo-text span {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 500;
}

.sidebar-app-promo .app-promo-download {
  width: 100%;
  padding: 12px 18px;
  background: #ffffff;
  color: #0d9488;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 1;
}

.sidebar-app-promo .app-promo-download:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  background: #f0fdfa;
}

.sidebar-app-promo .app-promo-download:active {
  transform: translateY(0) scale(0.98);
}

[data-theme="dark"] .sidebar-app-promo {
  background: linear-gradient(135deg, #134e4a 0%, #115e59 50%, #0f766e 100%);
  box-shadow: 0 4px 24px rgba(45, 212, 191, 0.2);
  border-color: rgba(45, 212, 191, 0.2);
}

[data-theme="dark"] .sidebar-app-promo .app-promo-icon {
  background: linear-gradient(135deg, #2dd4bf 0%, #5eead4 100%);
  color: #042f2e;
}

[data-theme="dark"] .sidebar-app-promo .app-promo-download {
  background: #2dd4bf;
  color: #042f2e;
}

[data-theme="dark"] .sidebar-app-promo .app-promo-download:hover {
  background: #5eead4;
  box-shadow: 0 6px 24px rgba(45, 212, 191, 0.35);
}

.app-shell.collapsed .sidebar-app-promo {
  width: 50px;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: visible;
  margin: 0 auto;
}

.app-shell.collapsed .sidebar-app-promo .app-promo-text,
.app-shell.collapsed .sidebar-app-promo .app-promo-download span {
  display: none;
}

.app-shell.collapsed .sidebar-app-promo .app-promo-icon {
  width: 40px;
  height: 40px;
  font-size: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(45, 212, 191, 0.4);
}

.app-shell.collapsed .sidebar-app-promo .app-promo-download {
  padding: 6px;
  font-size: 11px;
  width: 36px;
  height: 36px;
}

/* Tooltip on hover when collapsed */
.app-shell.collapsed .sidebar-app-promo::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 1100;
}

.app-shell.collapsed .sidebar-app-promo:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.app-shell.collapsed .sidebar-app-promo:hover {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  box-shadow: 0 4px 20px rgba(13, 148, 136, 0.4);
}

.app-shell.collapsed .sidebar-app-promo:hover .app-promo-icon {
  box-shadow: 0 6px 24px rgba(45, 212, 191, 0.5);
}

/* ── Sidebar Guest Navigation ── */
.sidebar-nav-guest {
  padding: 8px 0;
}

.sidebar-nav-guest .nav-section-label {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.sidebar-nav-guest .nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-guest .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
}

.sidebar-nav-guest .nav-item:hover {
  background: var(--surface-hover);
}

.sidebar-nav-guest .icon-only {
  font-size: 16px;
  width: 24px;
  text-align: center;
}

.sidebar-nav-guest .nav-text {
  font-size: 14px;
  font-weight: 500;
}

.sidebar-social {
  display: flex;
  gap: 12px;
  padding: 16px;
  justify-content: center;
}

.sidebar-social .social-link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 18px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.sidebar-social .social-link:hover {
  background: var(--teal);
  color: #fff;
  transform: translateY(-2px);
}

/* ── User Dropdown in Header ── */
.header-btn--user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn--user img {
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.header-btn--user:hover img {
  border-color: var(--teal);
}

.dropdown-menu-right {
  right: 0;
  left: auto;
}

/* ═══════════════════════════════════════════════
   MOBILE: Avatar in navbar
   ═══════════════════════════════════════════════ */
.mobile-avatar-wrap {
  display: flex;
  align-items: center;
}

.mobile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--teal);
}

.mobile-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ═══════════════════════════════════════════════
   MOBILE: Nav menu in drawer
   ═══════════════════════════════════════════════ */
.mobile-nav-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  border-radius: 8px;
  transition: background 0.15s;
}

.mobile-nav-item:hover {
  background: var(--surface-hover);
}

.mobile-nav-item--referee {
  order: -1;
}

.mobile-nav-item--referee a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--teal);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--teal-glow);
}

.mobile-nav-item--logout {
  color: var(--danger-text);
}

.mobile-nav-divider {
  height: 1px;
  background: var(--surface-border);
  margin: 8px 16px;
}

/* ═══════════════════════════════════════════════
   MOBILE: Referee board → card layout
   ═══════════════════════════════════════════════ */
@media (max-width: 980px) {
  .tournament-refereeboard .table-responsive table,
  .table-responsive table#players {
    display: block;
    width: 100%;
  }

  .tournament-refereeboard .table-responsive thead,
  .table-responsive table#players thead {
    display: none;
  }

  .tournament-refereeboard .table-responsive tbody,
  .table-responsive table#players tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .tournament-refereeboard .table-responsive tbody tr,
  .table-responsive table#players tbody tr {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .tournament-refereeboard .table-responsive tbody tr td,
  .table-responsive table#players tbody tr td {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border: none;
    white-space: normal;
    width: 100%;
  }

  .tournament-refereeboard .table-responsive tbody tr td:before,
  .table-responsive table#players tbody tr td:before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 65px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }

  .tournament-refereeboard .table-responsive tbody tr td:last-child:before,
  .table-responsive table#players tbody tr td:last-child:before {
    content: "";
    display: none;
  }

  .tournament-refereeboard .table-responsive tbody tr td:last-child,
  .table-responsive table#players tbody tr td:last-child {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--surface-border);
    justify-content: center;
  }
}

/* ── Login Popup ── */
.login-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.login-popup {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  position: relative;
  margin: 16px;
}

.login-popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.login-popup-close:hover {
  color: var(--text);
}

.login-popup-content h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 600;
}

.login-popup-content form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.login-popup-content form input[type="text"],
.login-popup-content form input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 16px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.login-popup-content form input:focus {
  border-color: var(--teal);
}

.login-popup-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-popup-submit:hover {
  background: var(--teal-light);
}

.login-popup-foot {
  margin-top: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-popup-foot a {
  color: var(--teal);
  font-size: 14px;
}

.login-popup-foot .forgot-password {
  font-size: 13px;
  color: var(--text-muted);
}

.login-popup-foot .forgot-password:hover {
  color: var(--teal);
}

/* ── Login Error Banner ── */
.login-error-banner {
  margin: 0;
  padding: 14px 20px;
  background: #fee2e2;
  border-bottom: 1px solid #fecaca;
  display: flex;
  align-items: center;
  gap: 12px;
}

[data-theme="dark"] .login-error-banner {
  background: rgba(239,68,68,0.15);
  border-bottom: 1px solid rgba(239,68,68,0.25);
}

.login-error-icon {
  width: 28px;
  height: 28px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.login-error-text strong {
  display: block;
  font-size: 14px;
  color: #991b1b;
}

.login-error-text span {
  display: block;
  font-size: 13px;
  color: #b91c1c;
  margin-top: 2px;
}

[data-theme="dark"] .login-error-text strong,
[data-theme="dark"] .login-error-text span {
  color: #fca5a5;
}

/* ═══════════════════════════════════════════════
   MOBILE: Maximize content width
   ═══════════════════════════════════════════════ */
@media (max-width: 980px) {
  .page-content-inner {
    padding: 0 !important;
  }

  .section-wrapper {
    padding: 16px 12px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border-left: none !important;
    border-right: none !important;
  }

  .page-content-wrapper {
    padding: 0 !important;
  }

  .main-content {
    padding: 12px 0 !important;
  }

  .app-shell .main-content {
    padding: 12px 0 !important;
  }

  .page-content-inner > div,
  .page-content-inner > .section-wrapper {
    border-radius: 0;
    margin: 0;
  }
}

/* ── User Avatar Fallback & Dropdown Positioning ── */
.user-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal-glow, rgba(13, 148, 136, 0.1));
  color: var(--teal, #0d9488);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  font-family: 'Outfit', sans-serif;
  border: 2px solid var(--surface-border, #d8dde4);
  text-transform: uppercase;
  user-select: none;
  box-sizing: border-box;
}

.mobile-avatar-fallback {
  width: 32px;
  height: 32px;
  font-size: 12px;
  border-width: 2px;
}

button.user-avatar-section {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

button.user-avatar-section:hover,
a.user-avatar-section:hover {
  opacity: 0.85;
  box-shadow: 0 0 0 3px var(--teal, #0d9488) !important;
}

.header-user-dropdown .dropdown-menu,
.mobile-user-dropdown .dropdown-menu {
  right: auto !important;
  left: 0 !important;
}

.user-dropdown .dropdown-menu {
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--surface-border, #d8dde4) !important;
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1)) !important;
  padding: 6px !important;
}

.user-dropdown .dropdown-item {
  color: var(--text, #1e293b) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: var(--r-sm, 6px) !important;
}

.user-dropdown .dropdown-item i {
  color: var(--text-muted, #64748b) !important;
  width: 16px !important;
  text-align: center !important;
}

.user-dropdown .dropdown-item:hover {
  background: var(--surface-hover, #f1f5f9) !important;
  color: var(--teal, #0d9488) !important;
}

.user-dropdown .dropdown-item:hover i {
  color: var(--teal, #0d9488) !important;
}

/* === Глобальная стилизация скроллбара (Всегда зеленоватый) === */

/* 1. Поддержка Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--teal-light) transparent;
}

/* 2. Поддержка WebKit */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  /* Используем ваш цвет --teal с прозрачностью 40% для мягкого зеленого оттенка */
  background: rgba(13, 148, 136, 0.4); 
  border-radius: 3px;
  transition: background var(--transition);
}

/* При наведении становится полностью насыщенным зеленым (Teal) */
::-webkit-scrollbar-thumb:hover {
  background: var(--teal);
}