*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-secondary: #f8fafc;
  --text-main: #1e293b;
  --text-heading: #0f291e;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border: #e2e8f0;
  --border-subtle: #f0f4f8;
  --header-bg: linear-gradient(135deg, #092e21 0%, #0f4a35 100%);
  --header-shadow: 0 2px 8px rgba(9, 46, 33, 0.18);
  --brand-green: #0f5940;
  --brand-green-hover: #093d2b;
  --brand-green-subtle: #f0fdf4;
  --brand-emerald: #059669;
  --card-shadow: 0 1px 4px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 4px 14px rgba(15, 89, 64, 0.1);
  --btn-save-bg: #f8fafc;
  --btn-save-text: #334155;
  --btn-save-border: #cbd5e1;
  --btn-save-hover-bg: #fef3c7;
  --btn-save-hover-text: #92400e;
  --btn-save-hover-border: #fcd34d;
  --btn-save-saved-bg: #fef3c7;
  --btn-save-saved-text: #92400e;
  --btn-save-saved-border: #f59e0b;
  --btn-cal-bg: #f8fafc;
  --btn-cal-text: #334155;
  --btn-cal-border: #cbd5e1;
  --btn-cal-hover-bg: #f1f5f9;
  --btn-cal-hover-text: #0f172a;
  --btn-cal-hover-border: #94a3b8;
  --badge-fide-bg: #eff6ff;
  --badge-fide-text: #2563eb;
  --badge-fide-border: #bfdbfe;
  --badge-norm-bg: #ecfdf5;
  --badge-norm-text: #047857;
  --badge-norm-border: #a7f3d0;
  --footer-bg: #ffffff;
  --footer-border: #e2e8f0;
  --footer-text: #94a3b8;
  --footer-disclaimer-border: #edf2f7;
  --backdrop-bg: rgba(15, 23, 42, 0.55);
  --leaflet-tile-filter: none;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #111724;
  --bg-card-hover: #172032;
  --bg-input: #161e2e;
  --bg-secondary: #161e2e;
  --text-main: #f8fafc;
  --text-heading: #f1f5f9;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #222d42;
  --border-subtle: #182234;
  --header-bg: linear-gradient(135deg, #081a13 0%, #0c2b1f 100%);
  --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  --brand-green: #0f7654;
  --brand-green-hover: #128862;
  --brand-green-subtle: rgba(16, 185, 129, 0.08);
  --brand-emerald: #2db884;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  --card-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.45);
  --btn-save-bg: #161e2e;
  --btn-save-text: #e2e8f0;
  --btn-save-border: #26354a;
  --btn-save-hover-bg: #2d2417;
  --btn-save-hover-text: #fbbf24;
  --btn-save-hover-border: #f59e0b;
  --btn-save-saved-bg: rgba(245, 158, 11, 0.18);
  --btn-save-saved-text: #fbbf24;
  --btn-save-saved-border: #d97706;
  --btn-cal-bg: #161e2e;
  --btn-cal-text: #e2e8f0;
  --btn-cal-border: #26354a;
  --btn-cal-hover-bg: #202a3d;
  --btn-cal-hover-text: #ffffff;
  --btn-cal-hover-border: #3b4c63;
  --badge-fide-bg: rgba(59, 130, 246, 0.12);
  --badge-fide-text: #60a5fa;
  --badge-fide-border: rgba(59, 130, 246, 0.25);
  --badge-norm-bg: rgba(16, 185, 129, 0.1);
  --badge-norm-text: #4ade80;
  --badge-norm-border: rgba(74, 222, 128, 0.25);
  --footer-bg: #070a12;
  --footer-border: #182234;
  --footer-text: #64748b;
  --footer-disclaimer-border: #182234;
  --backdrop-bg: rgba(0, 0, 0, 0.72);
  --leaflet-tile-filter: brightness(0.65) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  position: relative;
}

/* ── HEADER ─────────────────────────────────── */
.header {
  background: var(--header-bg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 1005;
  box-shadow: var(--header-shadow);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
}
.logo-colon { color: var(--brand-emerald); }

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

.nav-blog-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 0 11px;
  height: 34px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.nav-blog-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.04);
}
@media (max-width: 480px) {
  .nav-blog-btn span { display: none; }
  .nav-blog-btn { padding: 0; width: 34px; justify-content: center; }
}

/* ── AUTHOR BIO BOX ──────────────────────────── */
.author-bio-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin: 40px 0 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f6e52, #10b981);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}
.author-info {
  flex: 1;
}
.author-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.author-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.author-desc {
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.6;
  margin: 0;
}
@media (max-width: 600px) {
  .author-bio-card { flex-direction: column; gap: 12px; padding: 18px; }
}

/* ── FAQ SECTION ─────────────────────────────── */
.faq-wrap { margin: 32px 0; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 16px 20px;
}
.faq-question {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 8px 0;
}
.faq-answer {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-body);
  margin: 0;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.04);
}
.theme-toggle-btn:active {
  transform: scale(0.96);
}
.theme-toggle-btn .sun-icon { display: none; }
.theme-toggle-btn .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle-btn .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle-btn .moon-icon { display: none; }

/* Language Toggle Button in Header */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 4px 8px;
  height: 34px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
  box-sizing: border-box;
}
.lang-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.lang-toggle-btn:active {
  transform: scale(0.96);
}
.lang-opt {
  opacity: 0.6;
  padding: 1px 3px;
  border-radius: 3px;
  transition: opacity 0.15s, background 0.15s;
}
.lang-opt.active {
  opacity: 1;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.28);
}
.lang-sep {
  opacity: 0.4;
  font-size: 10px;
}

/* Mobile Filter Button in Header */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s;
}
.mobile-filter-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.97);
}

/* Toolbar Filter Button (shown in content toolbar on mobile instead of sort dropdown) */
.toolbar-filter-btn {
  display: none; /* hidden on desktop – shown on mobile via media query */
}

.filter-count-badge {
  background: var(--brand-emerald);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.2;
}
.sidebar-header-mobile {
  display: none;
}
.sheet-handle {
  display: none;
}
.sidebar-footer-mobile {
  display: none;
}
.filter-backdrop {
  display: none;
}

/* ── LAYOUT ─────────────────────────────────── */
.page-wrap {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  box-sizing: border-box;
}

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  position: relative;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
/* Left accent bar — inset with gap */
.sidebar::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 4px;
  background: var(--brand-emerald);
}
.sidebar-inner { padding: 16px 16px 16px 24px; }

.sidebar-search {
  position: relative;
  margin-bottom: 14px;
}
.sidebar-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 32px 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  background: var(--bg-input);
  transition: border-color 0.15s, background 0.2s;
}
.sidebar-search input:focus { border-color: var(--brand-emerald); }
.sidebar-search input::placeholder { color: var(--text-dim); }
.sidebar-search svg {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* Sidebar Sort Section (hidden on desktop, shown inside bottom sheet on mobile) */
.sidebar-sort-section {
  display: none;
  margin-bottom: 10px;
}
.sidebar-sort-section .sort-select {
  width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  background: var(--bg-input);
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.2s, color 0.2s;
  box-sizing: border-box;
}
.sidebar-sort-section .sort-select:focus { border-color: var(--brand-emerald); }

/* Sidebar Map CTA Button */
.sidebar-map-cta {
  margin-bottom: 14px;
}
.sidebar-map-btn {
  width: 100%;
  padding: 8.5px 12px;
  background: var(--brand-green-subtle);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}
.sidebar-map-btn svg {
  flex-shrink: 0;
  transition: stroke 0.15s;
}
.sidebar-map-btn:hover {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 86, 63, 0.25);
}
.sidebar-map-btn:hover svg {
  stroke: #ffffff;
}
.sidebar-map-btn.active {
  background: var(--brand-green);
  border-color: var(--brand-green);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 86, 63, 0.35);
}
.sidebar-map-btn.active svg {
  stroke: #ffffff;
}
[data-theme="dark"] .sidebar-map-btn {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}
[data-theme="dark"] .sidebar-map-btn:hover,
[data-theme="dark"] .sidebar-map-btn.active {
  background: var(--brand-green);
  color: #ffffff;
  border-color: var(--brand-green);
}
[data-theme="dark"] .sidebar-map-btn:hover svg,
[data-theme="dark"] .sidebar-map-btn.active svg {
  stroke: #ffffff;
}

.sidebar-section { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle); }
.sidebar-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

    .section-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    .section-label-text {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-main);
    }
    .section-label svg { color: var(--text-dim); }

    .row-inputs { display: flex; gap: 8px; }
    .row-inputs input {
      flex: 1;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 10px;
      font-family: inherit;
      font-size: 12.5px;
      color: var(--text-main);
      background: var(--bg-input);
      outline: none;
      min-width: 0;
      transition: border-color 0.15s, background 0.2s;
    }
    .row-inputs input:focus { border-color: var(--brand-emerald); }
    .row-inputs input::placeholder { color: var(--text-dim); }

    .sub-label {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 5px;
    }

    .styled-select {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 10px;
      font-family: inherit;
      font-size: 12.5px;
      color: var(--text-main);
      background: var(--bg-input);
      outline: none;
      cursor: pointer;
      margin-bottom: 7px;
      transition: border-color 0.15s, background 0.2s;
    }
    .styled-select:focus { border-color: var(--brand-emerald); }

    /* ── SEARCHABLE COUNTRY PICKER ────────────────── */
    .country-picker-wrap {
      position: relative;
      width: 100%;
      margin-bottom: 7px;
    }
    .country-input-box {
      display: flex;
      align-items: center;
      position: relative;
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--bg-input);
      cursor: text;
      transition: border-color 0.15s, box-shadow 0.15s;
    }
    .country-input-box:focus-within,
    .country-picker-wrap.open .country-input-box {
      border-color: var(--brand-emerald);
      box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
    }
    .country-selected-flag {
      padding-left: 9px;
      padding-right: 4px;
      font-size: 14px;
      line-height: 1;
      pointer-events: none;
      user-select: none;
      flex-shrink: 0;
    }
    .country-search-input {
      flex: 1;
      min-width: 0;
      border: none;
      background: transparent;
      padding: 7px 4px;
      font-family: inherit;
      font-size: 12.5px;
      color: var(--text-main);
      outline: none;
    }
    .country-search-input::placeholder {
      color: var(--text-dim);
    }
    .country-clear-btn {
      background: none;
      border: none;
      color: var(--text-dim);
      font-size: 11px;
      padding: 4px 6px;
      cursor: pointer;
      line-height: 1;
      transition: color 0.15s;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .country-clear-btn:hover {
      color: var(--text-main);
    }
    .country-dropdown-arrow {
      background: none;
      border: none;
      color: var(--text-dim);
      padding: 7px 8px 7px 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.15s, color 0.15s;
    }
    .country-picker-wrap.open .country-dropdown-arrow {
      transform: rotate(180deg);
      color: var(--brand-emerald);
    }
    .country-dropdown-panel {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      max-height: 220px;
      overflow-y: auto;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 6px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
      z-index: 1000;
      padding: 4px;
    }
    .country-option-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 9px;
      border-radius: 4px;
      font-size: 12.5px;
      color: var(--text-main);
      cursor: pointer;
      transition: background 0.1s, color 0.1s;
      user-select: none;
    }
    .country-option-item:hover,
    .country-option-item.highlighted {
      background: var(--bg-card-hover, #f1f5f9);
      color: var(--brand-green);
    }
    .country-option-item.selected {
      background: var(--brand-green-subtle, #ecfdf5);
      font-weight: 700;
      color: var(--brand-green);
    }
    .country-option-flag {
      font-size: 14px;
      line-height: 1;
      flex-shrink: 0;
    }
    .country-option-name {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .country-no-matches {
      padding: 10px 12px;
      font-size: 12px;
      color: var(--text-muted);
      text-align: center;
      font-style: italic;
    }

    .city-wrap { position: relative; }
    .city-wrap input {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 52px 7px 10px;
      font-family: inherit;
      font-size: 12.5px;
      color: var(--text-main);
      background: var(--bg-input);
      outline: none;
      transition: border-color 0.15s, background 0.2s;
    }
    .city-wrap input:focus { border-color: var(--brand-emerald); }
    .city-wrap input::placeholder { color: var(--text-dim); }
    .km-badge {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 4px;
      padding: 2px 7px;
    }

    /* ── DISTANCE SLIDER & GEO BUTTON ────────────────── */
    .distance-value {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-main);
      text-align: center;
      margin-top: 4px;
      transition: color 0.15s ease;
    }

    .geo-btn {
      margin-top: 8px;
      width: 100%;
      padding: 7px 10px;
      font-size: 12px;
      font-weight: 500;
      font-family: inherit;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--bg-card);
      color: var(--text-body);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    }
    .geo-btn svg {
      flex-shrink: 0;
    }
    .geo-btn:hover {
      background: var(--bg-card-hover);
      color: var(--text-main);
      border-color: var(--brand-emerald);
    }
    .geo-btn.active {
      background: var(--brand-green-subtle);
      color: var(--brand-green);
      border-color: var(--brand-emerald);
      font-weight: 600;
    }
    [data-theme="dark"] .geo-btn {
      background: var(--bg-input);
      color: var(--text-main);
      border-color: var(--border);
    }
    [data-theme="dark"] .geo-btn:hover {
      background: var(--bg-card-hover);
      color: #ffffff;
      border-color: var(--brand-emerald);
    }
    [data-theme="dark"] .geo-btn.active {
      background: rgba(16, 185, 129, 0.15);
      color: var(--brand-emerald);
      border-color: var(--brand-emerald);
    }


    .check-item {
      display: flex;
      align-items: center;
      gap: 9px;
      padding: 4px 0;
      cursor: pointer;
    }
    .check-item input[type=checkbox] {
      width: 14px;
      height: 14px;
      accent-color: var(--brand-green);
      cursor: pointer;
      flex-shrink: 0;
    }
    .check-item span {
      font-size: 13px;
      color: var(--text-body);
      user-select: none;
      transition: color 0.1s;
    }
    .check-item:hover span { color: var(--text-main); }

    /* ── FILTER CHIPS ─────────────────────────────── */
    .filter-chips-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 6px;
    }
    .norms-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
    }
    .norms-grid .filter-chip {
      flex: 0 0 auto;
      padding: 4px 8px;
      min-height: 28px;
      height: 28px;
      font-size: 12px;
    }
    .filter-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      cursor: pointer;
      user-select: none;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--bg-input);
      color: var(--text-body);
      font-size: 12px;
      font-weight: 500;
      padding: 6px 10px;
      min-height: 36px;
      transition: all 0.15s ease;
      box-sizing: border-box;
      text-align: center;
    }
    .filter-chip input[type="checkbox"] {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 0;
      height: 0;
      margin: 0;
    }
    .filter-chip:hover {
      border-color: var(--brand-emerald);
      color: var(--text-main);
    }
    .filter-chip:has(input:checked),
    .filter-chip.active {
      background: var(--brand-green-subtle);
      border-color: var(--brand-emerald);
      color: var(--brand-green);
      font-weight: 700;
    }
    [data-theme="dark"] .filter-chip:has(input:checked),
    [data-theme="dark"] .filter-chip.active {
      background: rgba(16, 185, 129, 0.2);
      border-color: var(--brand-emerald);
      color: var(--brand-emerald);
    }

    /* ── Time Control Filter Chips with Bar Colors ── */
    .tc-chip-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      display: inline-block;
      margin-right: 6px;
      flex-shrink: 0;
    }

    .filter-chip.filter-chip-classical,
    .filter-chip:has(input[value="Classical"]) {
      border: 1.5px solid #0f6e52;
    }
    .filter-chip.filter-chip-classical:hover,
    .filter-chip:has(input[value="Classical"]):hover {
      border-color: #0f6e52;
      background: rgba(15, 110, 82, 0.08);
      color: #0f6e52;
    }
    .filter-chip.filter-chip-classical:has(input:checked),
    .filter-chip.filter-chip-classical.active,
    .filter-chip:has(input[value="Classical"]:checked) {
      border: 2px solid #0f6e52;
      background: rgba(15, 110, 82, 0.14);
      color: #0f6e52;
      font-weight: 700;
    }

    [data-theme="dark"] .filter-chip.filter-chip-classical,
    [data-theme="dark"] .filter-chip:has(input[value="Classical"]) {
      border: 1.5px solid #10b981;
    }
    [data-theme="dark"] .filter-chip.filter-chip-classical:hover,
    [data-theme="dark"] .filter-chip:has(input[value="Classical"]):hover {
      border-color: #10b981;
      background: rgba(16, 185, 129, 0.12);
      color: #10b981;
    }
    [data-theme="dark"] .filter-chip.filter-chip-classical:has(input:checked),
    [data-theme="dark"] .filter-chip.filter-chip-classical.active,
    [data-theme="dark"] .filter-chip:has(input[value="Classical"]:checked) {
      border: 2px solid #10b981;
      background: rgba(16, 185, 129, 0.22);
      color: #10b981;
    }

    .filter-chip.filter-chip-rapid,
    .filter-chip:has(input[value="Rapid"]) {
      border: 1.5px solid #dc2626;
    }
    .filter-chip.filter-chip-rapid:hover,
    .filter-chip:has(input[value="Rapid"]):hover {
      border-color: #dc2626;
      background: rgba(220, 38, 38, 0.08);
      color: #dc2626;
    }
    .filter-chip.filter-chip-rapid:has(input:checked),
    .filter-chip.filter-chip-rapid.active,
    .filter-chip:has(input[value="Rapid"]:checked) {
      border: 2px solid #dc2626;
      background: rgba(220, 38, 38, 0.14);
      color: #dc2626;
      font-weight: 700;
    }

    [data-theme="dark"] .filter-chip.filter-chip-rapid,
    [data-theme="dark"] .filter-chip:has(input[value="Rapid"]) {
      border: 1.5px solid #f43f5e;
    }
    [data-theme="dark"] .filter-chip.filter-chip-rapid:hover,
    [data-theme="dark"] .filter-chip:has(input[value="Rapid"]):hover {
      border-color: #f43f5e;
      background: rgba(244, 63, 94, 0.12);
      color: #f43f5e;
    }
    [data-theme="dark"] .filter-chip.filter-chip-rapid:has(input:checked),
    [data-theme="dark"] .filter-chip.filter-chip-rapid.active,
    [data-theme="dark"] .filter-chip:has(input[value="Rapid"]:checked) {
      border: 2px solid #f43f5e;
      background: rgba(244, 63, 94, 0.22);
      color: #f43f5e;
    }

    .filter-chip.filter-chip-blitz,
    .filter-chip:has(input[value="Blitz"]) {
      border: 1.5px solid #0284c7;
    }
    .filter-chip.filter-chip-blitz:hover,
    .filter-chip:has(input[value="Blitz"]):hover {
      border-color: #0284c7;
      background: rgba(2, 132, 199, 0.08);
      color: #0284c7;
    }
    .filter-chip.filter-chip-blitz:has(input:checked),
    .filter-chip.filter-chip-blitz.active,
    .filter-chip:has(input[value="Blitz"]:checked) {
      border: 2px solid #0284c7;
      background: rgba(2, 132, 199, 0.14);
      color: #0284c7;
      font-weight: 700;
    }

    [data-theme="dark"] .filter-chip.filter-chip-blitz,
    [data-theme="dark"] .filter-chip:has(input[value="Blitz"]) {
      border: 1.5px solid #38bdf8;
    }
    [data-theme="dark"] .filter-chip.filter-chip-blitz:hover,
    [data-theme="dark"] .filter-chip:has(input[value="Blitz"]):hover {
      border-color: #38bdf8;
      background: rgba(56, 189, 248, 0.12);
      color: #38bdf8;
    }
    [data-theme="dark"] .filter-chip.filter-chip-blitz:has(input:checked),
    [data-theme="dark"] .filter-chip.filter-chip-blitz.active,
    [data-theme="dark"] .filter-chip:has(input[value="Blitz"]:checked) {
      border: 2px solid #38bdf8;
      background: rgba(56, 189, 248, 0.22);
      color: #38bdf8;
    }

    .prize-inputs { display: flex; gap: 8px; margin-bottom: 0; }
    .prize-input-wrap { flex: 1; position: relative; min-width: 0; }
    .prize-input-wrap span {
      position: absolute;
      left: 9px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 12px;
      color: var(--text-dim);
      pointer-events: none;
    }
    .prize-input-wrap input {
      width: 100%;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 8px 7px 20px;
      font-family: inherit;
      font-size: 12.5px;
      color: var(--text-main);
      background: var(--bg-input);
      outline: none;
      transition: border-color 0.15s, background 0.2s;
    }
    .prize-input-wrap input:focus { border-color: var(--brand-emerald); }
    .prize-input-wrap input::placeholder { color: var(--text-dim); }

    .filter-btn {
      width: 100%;
      background: var(--brand-green);
      color: #ffffff;
      border: none;
      border-radius: 7px;
      padding: 10px 0;
      font-family: inherit;
      font-size: 13.5px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      margin-top: 4px;
      transition: all 0.15s;
      box-shadow: 0 2px 6px rgba(0, 86, 63, 0.25);
    }
    .filter-btn:hover {
      background: var(--brand-green-hover);
      box-shadow: 0 4px 10px rgba(4, 57, 39, 0.35);
    }

    .clear-btn {
      width: 100%;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 7px;
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
      cursor: pointer;
      padding: 9px 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      margin-top: 8px;
      transition: all 0.15s;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    .clear-btn:hover {
      background: var(--bg-card-hover);
      color: var(--text-main);
      border-color: var(--brand-emerald);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    .clear-btn svg {
      opacity: 0.75;
      transition: transform 0.2s ease;
    }
    .clear-btn:hover svg {
      transform: rotate(-60deg);
      opacity: 1;
    }

    /* ── MAIN CONTENT ─────────────────────────────── */
    .main-content {
      flex: 1;
      min-width: 0;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
    }

    .content-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 18px;
      flex-wrap: wrap;
      gap: 10px;
    }
    .content-title {
      font-size: 22px;
      font-weight: 800;
      color: var(--text-main);
      letter-spacing: -0.5px;
    }
    .toolbar { display: flex; align-items: center; gap: 10px; }

    .sort-select {
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 7px 12px;
      font-family: inherit;
      font-size: 12.5px;
      font-weight: 500;
      color: var(--text-body);
      background: var(--bg-input);
      outline: none;
      cursor: pointer;
      box-shadow: var(--shadow-sm);
      transition: border-color 0.15s, background 0.2s, color 0.2s;
    }
    .sort-select:focus { border-color: var(--brand-emerald); }

    .view-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg-input); box-shadow: var(--shadow-sm); }
    .view-btn {
      width: 34px;
      height: 34px;
      background: none;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-dim);
      transition: all 0.15s;
    }
    .view-btn + .view-btn { border-left: 1px solid var(--border); }
    .view-btn.active, .view-btn:hover { background: var(--brand-green); color: #ffffff; }
    .view-btn.view-btn-map {
      width: auto;
      padding: 0 10px;
      gap: 5px;
      font-size: 12px;
      font-weight: 600;
    }
    /* ── SKELETON LOADER ─────────────────────────── */
    .skeleton-list { pointer-events: none; }
    .skeleton-row {
      position: relative;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 18px 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-height: 80px;
    }
    .skeleton-line {
      height: 14px;
      border-radius: 4px;
      background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border) 50%, var(--border-subtle) 75%);
      background-size: 200% 100%;
      animation: skeletonShimmer 1.4s ease-in-out infinite;
    }
    .skeleton-title { width: 60%; height: 16px; }
    .skeleton-subtitle { width: 35%; height: 12px; }
    @keyframes skeletonShimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    /* ── TOURNAMENT ROWS ─────────────────────────── */
    .tournaments-list { display: flex; flex-direction: column; gap: 10px; }

    .tournament-row {
      position: relative;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 14px 16px 14px 26px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      cursor: pointer;
      transition: box-shadow 0.15s, border-color 0.15s, background 0.2s;
    }
    .tournament-row:hover { box-shadow: var(--card-shadow-hover); border-color: var(--brand-green); }

    /* Left colored accent bar — inset with gap */
    .bar {
      position: absolute;
      left: 9px;
      top: 12px;
      bottom: 12px;
      width: 4px;
      border-radius: 4px;
    }
    .bar-classical { background: #0f6e52; }
    .bar-rapid     { background: #dc2626; }
    .bar-blitz     { background: #0284c7; }
    .bar-bullet    { background: #7c3aed; }
    [data-theme="dark"] .bar-classical { background: #10b981; }
    [data-theme="dark"] .bar-rapid     { background: #f43f5e; }
    [data-theme="dark"] .bar-blitz     { background: #38bdf8; }
    [data-theme="dark"] .bar-bullet    { background: #a78bfa; }

    .row-left { flex: 1; min-width: 0; }
    .row-name {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--text-heading);
      margin-bottom: 7px;
      line-height: 1.35;
      display: block;
      text-decoration: none;
      transition: color 0.15s;
    }
    .row-name:hover { text-decoration: underline; color: var(--brand-emerald); }
    .row-name.no-link { color: var(--text-body); cursor: default; pointer-events: none; }

    .row-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0 20px;
      row-gap: 4px;
    }
    .meta-item {
      display: flex;
      align-items: center;
      gap: 5px;
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 500;
    }
    .meta-item svg { color: var(--text-dim); flex-shrink: 0; }

    .row-right {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 5px;
      flex-shrink: 0;
    }
    .location-line {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 12.5px;
      font-weight: 600;
      color: var(--text-body);
    }
    .loc-dash { display: none; }
    .prize-line {
      font-size: 12px;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .prize-line:empty { display: none; }
    .prize-val { font-size: 14.5px; font-weight: 700; color: var(--brand-emerald); }
    .free-badge { padding: 2px 6px; background: var(--brand-green-subtle); color: var(--brand-emerald); border-radius: 4px; font-size: 12px; font-weight: 700; }
    .badge-fee {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 7px;
      background: var(--bg-secondary, #f1f5f9);
      color: var(--text-body, #334155);
      border: 1px solid var(--border, #cbd5e1);
      border-radius: 4px;
      font-size: 11.5px;
      font-weight: 600;
    }
    .badge-fee.fee-free {
      background: var(--brand-green-subtle, #ecfdf5);
      color: #047857;
      border-color: #a7f3d0;
      font-weight: 700;
    }
    [data-theme="dark"] .badge-fee.fee-free {
      background: rgba(16, 185, 129, 0.15);
      color: #34d399;
      border-color: rgba(52, 211, 153, 0.3);
    }
    .fee-prefix {
      color: var(--text-muted, #64748b);
      font-weight: 500;
      font-size: 11px;
    }
    .prize-wrap {
      display: inline-flex;
      align-items: center;
      gap: 3px;
    }
    .prize-prefix {
      color: var(--text-muted, #64748b);
      font-weight: 500;
      font-size: 11px;
    }
    /* ── CARD RESTRUCTURED ELEMENTS ────────────────── */
    .card-main-content {
      flex: 1;
      min-width: 0;
    }
    .card-header-block {
      display: flex;
      flex-direction: column;
      gap: 4px;
      width: 100%;
    }
    .card-pills {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 5px;
      margin-top: 4px;
    }
    .badge-pill.pill-prize {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 7px;
      border-radius: 4px;
      background: rgba(16, 185, 129, 0.12);
      color: #047857;
      border: 1px solid rgba(16, 185, 129, 0.35);
      font-size: 11px;
      font-weight: 700;
    }
    [data-theme="dark"] .badge-pill.pill-prize {
      background: rgba(16, 185, 129, 0.12);
      color: #34d399;
      border-color: rgba(52, 211, 153, 0.25);
    }
    .card-meta-rows {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 6px;
    }
    .meta-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px 6px;
      font-size: 12px;
      color: var(--text-muted);
      font-weight: 500;
      line-height: 1.4;
    }
    .meta-subitem {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .meta-subitem svg {
      color: var(--text-dim);
      flex-shrink: 0;
    }
    .meta-sep {
      color: var(--border);
      font-weight: 700;
      user-select: none;
    }
    [data-theme="dark"] .meta-sep {
      color: #334155;
    }
    .meta-tc {
      font-weight: 600;
      color: var(--text-body);
    }
    .tc-dot {
      display: inline-block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      margin-right: 4px;
      flex-shrink: 0;
    }
    .tc-dot.bar-classical { background: #0f6e52; }
    .tc-dot.bar-rapid     { background: #dc2626; }
    .tc-dot.bar-blitz     { background: #0284c7; }
    [data-theme="dark"] .tc-dot.bar-classical { background: #10b981; }
    [data-theme="dark"] .tc-dot.bar-rapid     { background: #f43f5e; }
    [data-theme="dark"] .tc-dot.bar-blitz     { background: #38bdf8; }
    .meta-loc {
      color: var(--text-body);
      font-weight: 600;
    }
    .badge-dist {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 1px 6px;
      border-radius: 4px;
      background: var(--bg-secondary, #f1f5f9);
      color: var(--text-muted);
      border: 1px solid var(--border);
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
    }
    .badge-dist svg {
      color: var(--text-dim);
      flex-shrink: 0;
    }
    .card-actions-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

    /* ── ACTION BUTTONS ────────────────────────────── */
    .row-actions {
      display: flex;
      gap: 6px;
      margin-top: 6px;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-items: center;
    }
    .card-actions {
      display: flex;
      gap: 6px;
      margin-top: 6px;
      flex-wrap: wrap;
    }
    .card-actions .action-btn {
      flex: 1;
      text-align: center;
      justify-content: center;
    }

    .action-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 4px 8px;
      border-radius: 5px;
      font-size: 11px;
      font-weight: 500;
      text-decoration: none;
      white-space: nowrap;
      cursor: pointer;
      border: 1px solid transparent;
      font-family: inherit;
      line-height: 1.2;
      transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
      box-sizing: border-box;
    }
    .action-btn:hover {
      text-decoration: none;
    }

    /* Save button */
    .btn-save {
      background-color: var(--btn-save-bg);
      color: var(--btn-save-text);
      border-color: var(--btn-save-border);
    }
    .btn-save:hover {
      background-color: var(--btn-save-hover-bg);
      color: var(--btn-save-hover-text);
      border-color: var(--btn-save-hover-border);
    }
    .btn-save.saved {
      background-color: var(--btn-save-saved-bg);
      color: var(--btn-save-saved-text);
      border-color: var(--btn-save-saved-border);
      font-weight: 700;
    }
    .btn-save.saved:hover {
      background-color: #fee2e2;
      color: #991b1b;
      border-color: #f87171;
    }
    [data-theme="dark"] .btn-save.saved:hover {
      background-color: rgba(239, 68, 68, 0.2);
      color: #fca5a5;
      border-color: #ef4444;
    }

    /* Calendar button */
    .btn-calendar {
      background-color: var(--btn-cal-bg);
      color: var(--btn-cal-text);
      border-color: var(--btn-cal-border);
    }
    .btn-calendar:hover {
      background-color: var(--btn-cal-hover-bg);
      color: var(--btn-cal-hover-text);
      border-color: var(--btn-cal-hover-border);
    }

    /* Share button */
    .btn-share {
      background-color: var(--btn-cal-bg);
      color: var(--btn-cal-text);
      border-color: var(--btn-cal-border);
      font-size: 10.5px;
      font-weight: 500;
      padding: 4px 7px;
    }
    .btn-share:hover {
      background-color: var(--btn-cal-hover-bg);
      color: var(--btn-cal-hover-text);
      border-color: var(--btn-cal-hover-border);
    }
    .btn-share.copied {
      background-color: #dcfce7 !important;
      color: #15803d !important;
      border-color: #86efac !important;
    }
    [data-theme="dark"] .btn-share.copied {
      background-color: rgba(34, 197, 94, 0.2) !important;
      color: #86efac !important;
      border-color: #22c55e !important;
    }

    /* Sign Up / Details button */
    .btn-signup {
      background-color: var(--brand-green);
      color: #ffffff !important;
      border-color: var(--brand-green);
      font-size: 11px;
      font-weight: 600;
      padding: 4px 10px;
    }
    .btn-signup:hover {
      background-color: var(--brand-green-hover);
      border-color: var(--brand-green-hover);
      color: #ffffff !important;
    }

    /* Backward compatibility fallback */
    .signup-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      padding: 6px 12px;
      background-color: var(--brand-green);
      color: #ffffff;
      text-decoration: none;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      text-align: center;
      transition: background 0.2s;
      white-space: nowrap;
      border: 1px solid transparent;
      box-sizing: border-box;
    }
    .signup-btn:hover {
      background-color: var(--brand-green-hover);
      color: #ffffff;
    }
    .row-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }

    /* ── GRID VIEW ─────────────────────────────────── */
    .tournaments-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
      gap: 12px;
    }
    .tournament-card {
      position: relative;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 14px 14px 14px 24px;
      cursor: pointer;
      transition: box-shadow 0.15s, border-color 0.15s, background 0.2s;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .tournament-card:hover { box-shadow: var(--card-shadow-hover); border-color: var(--brand-green); }
    .card-name {
      font-size: 14px;
      font-weight: 700;
      color: var(--text-heading);
      line-height: 1.35;
      text-decoration: none;
      display: block;
      transition: color 0.15s;
    }
    .card-name:hover { text-decoration: underline; color: var(--brand-emerald); }
    .card-name.no-link { color: var(--text-body); cursor: default; pointer-events: none; }
    .card-meta { display: flex; flex-direction: column; gap: 5px; }
    .card-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-top: 8px;
      border-top: 1px solid var(--border-subtle);
      margin-top: auto;
    }

    /* ── TABS ─────────────────────────────────────── */
    .tabs-wrap {
      display: flex;
      justify-content: center;
      border-bottom: 1px solid var(--border);
      margin: 22px 0 18px;
    }
    .tab-list { display: flex; gap: 48px; }
    .tab-btn {
      background: none;
      border: none;
      font-family: inherit;
      font-size: 14.5px;
      font-weight: 600;
      color: var(--text-dim);
      padding-bottom: 12px;
      cursor: pointer;
      position: relative;
      transition: color 0.15s;
    }
    .tab-btn:hover { color: var(--brand-emerald); }
    .tab-btn.active { color: var(--brand-emerald); }
    .tab-btn.active::after {
      content: '';
      position: absolute;
      bottom: -1px;
      left: 0;
      right: 0;
      height: 2.5px;
      background: var(--brand-emerald);
      border-radius: 2px 2px 0 0;
    }

    /* ── EMPTY STATE ─────────────────────────────── */
    .empty-state {
      text-align: center;
      padding: 60px 24px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
    }
    .empty-icon { font-size: 40px; opacity: 0.2; margin-bottom: 12px; }
    .empty-title { font-size: 15px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
    .empty-sub { font-size: 13px; color: var(--text-muted); }

    /* ── RESULT COUNT ─────────────────────────────── */
    .result-meta {
      font-size: 12.5px;
      color: var(--text-muted);
      margin-bottom: 12px;
    }
    .result-meta strong { color: var(--text-main); }

    /* ── SCROLLBAR ─────────────────────────────────── */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

    /* ── FOOTER ─────────────────────────────────────── */
    .footer {
      background: var(--footer-bg);
      border-top: 1px solid var(--footer-border);
      padding: 18px 32px;
      font-size: 12px;
      color: var(--footer-text);
      margin-top: 40px;
      transition: background 0.2s, border-color 0.2s;
    }
    .footer-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }
    .footer-logo { font-weight: 800; color: var(--brand-emerald); }
    .footer-logo span { color: var(--text-dim); }
    .footer-disclaimer {
      font-size: 11px;
      color: var(--footer-text);
      line-height: 1.5;
      max-width: 900px;
      border-top: 1px solid var(--footer-disclaimer-border);
      padding-top: 8px;
    }

    /* ── SEO & TRUST FOOTER ─────────────────────────── */
    .footer-contact-bar {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 8px 0 10px;
      font-size: 12px;
    }
    .footer-contact-label {
      font-size: 11.5px;
      font-weight: 600;
      color: var(--text-heading);
    }
    .footer-contact-text {
      color: var(--text-body);
      font-size: 12px;
      font-weight: 500;
      user-select: text;
    }

    .footer-seo-accordion {
      border: none;
      margin: 8px 0;
    }
    .footer-seo-summary {
      display: none; /* Hidden on desktop, grid is shown directly */
    }
    .footer-seo-accordion:not([open]) .footer-nav-grid {
      display: grid;
    }

    .footer-nav-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 24px;
      margin: 14px 0 18px;
      padding: 18px 0;
      border-top: 1px solid var(--footer-disclaimer-border);
      border-bottom: 1px solid var(--footer-disclaimer-border);
    }
    .footer-nav-col {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .footer-nav-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-heading);
      margin: 0 0 4px;
      letter-spacing: -0.2px;
    }
    .footer-nav-links {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .footer-nav-links a {
      color: var(--footer-text);
      text-decoration: none;
      font-size: 12px;
      line-height: 1.4;
      transition: color 0.15s ease;
    }
    .footer-nav-links a:hover {
      color: var(--brand-emerald);
      text-decoration: underline;
    }
    .footer-about-text {
      font-size: 12px;
      line-height: 1.5;
      color: var(--footer-text);
      margin: 0 0 10px;
    }
    @media (max-width: 900px) {
      .footer-nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
      }
    }
    @media (max-width: 768px) {
      .footer-seo-summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 8px 12px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 8px;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-dim);
        cursor: pointer;
        margin: 10px 0 6px;
        box-sizing: border-box;
        list-style: none;
      }
      .footer-seo-summary::-webkit-details-marker {
        display: none;
      }
      .footer-seo-accordion .accordion-arrow {
        transition: transform 0.2s ease;
      }
      .footer-seo-accordion[open] .accordion-arrow {
        transform: rotate(180deg);
      }
      .footer-seo-accordion:not([open]) .footer-nav-grid {
        display: none !important;
      }
      .footer-seo-accordion[open] .footer-nav-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin: 10px 0;
        padding: 12px 0;
        border-top: 1px solid var(--footer-disclaimer-border);
        border-bottom: 1px solid var(--footer-disclaimer-border);
      }
    }

    /* ── SHARE TOAST ─────────────────────────────────── */
    .share-toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      z-index: 10000;
      display: flex;
      align-items: center;
      gap: 8px;
      background: #1e293b;
      color: #ffffff;
      padding: 10px 16px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.1);
      transform: translateY(12px);
      opacity: 0;
      pointer-events: none;
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    }
    .share-toast.show {
      transform: translateY(0);
      opacity: 1;
    }
    [data-theme="dark"] .share-toast {
      background: #0f172a;
      border-color: rgba(255, 255, 255, 0.15);
    }
    @media (max-width: 768px) {
      .share-toast {
        bottom: 20px;
        left: 20px;
        right: 20px;
        justify-content: center;
      }
    }

    /* ── DIRECT HIGHLIGHT PULSE ──────────────────────── */
    @keyframes directHighlightPulse {
      0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); border-color: var(--brand-emerald); }
      50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); border-color: var(--brand-emerald); }
      100% { box-shadow: none; }
    }
    .direct-highlight {
      animation: directHighlightPulse 1.8s ease-out 2;
      border-color: var(--brand-emerald) !important;
    }

    /* ── BADGES & LOAD MORE ───────────────────────────── */
    .badge-fide {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 6px;
      border-radius: 4px;
      background: var(--badge-fide-bg);
      color: var(--badge-fide-text);
      border: 1px solid var(--badge-fide-border);
      font-size: 10.5px;
      font-weight: 700;
      letter-spacing: 0.02em;
    }
    .badge-norm {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      padding: 2px 6px;
      border-radius: 4px;
      background: var(--badge-norm-bg);
      color: var(--badge-norm-text);
      border: 1px solid var(--badge-norm-border);
      font-size: 10.5px;
      font-weight: 700;
      letter-spacing: 0.02em;
    }
    .load-more-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      margin: 24px 0 16px;
    }
    .load-more-btn {
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--brand-emerald);
      font-size: 13.5px;
      font-weight: 600;
      padding: 10px 24px;
      border-radius: 8px;
      cursor: pointer;
      transition: all .2s;
      box-shadow: var(--shadow-sm);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .load-more-btn:hover {
      background: var(--brand-green-subtle);
      border-color: var(--brand-green);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }
    .load-more-count {
      font-size: 12px;
      color: var(--text-muted);
    }

    /* ── RANGE SLIDER STYLING ───────────────────────── */
    input[type=range] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 6px;
      margin-top: 6px;
      margin-bottom: 3px;
      background: var(--border);
      border-radius: 4px;
      outline: none;
      cursor: pointer;
      transition: background 0.2s;
    }
    input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--brand-green);
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
      border: 2px solid #ffffff;
      transition: transform 0.1s;
    }
    input[type=range]::-webkit-slider-thumb:active {
      transform: scale(1.15);
    }
    [data-theme="dark"] input[type=range]::-webkit-slider-thumb {
      background: var(--brand-emerald);
      border-color: #111827;
    }
    input[type=range]::-moz-range-thumb {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--brand-green);
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
      border: 2px solid #ffffff;
    }
    [data-theme="dark"] input[type=range]::-moz-range-thumb {
      background: var(--brand-emerald);
      border-color: #111827;
    }

    /* ── RESPONSIVE (MOBILE) ─────────────────────────── */
    @media (max-width: 768px) {
      /* Prevent iOS Safari auto-zoom on focus by enforcing 16px font size */
      input[type="text"],
      input[type="number"],
      select,
      .styled-select,
      .sort-select,
      .sidebar-search input,
      .city-wrap input,
      .prize-input-wrap input {
        font-size: 16px !important;
      }

      /* Compact Header - Single Line Guarantee */
      .header {
        height: 52px;
        padding: 0 10px;
        gap: 6px;
      }
      .logo {
        font-size: 18px;
        letter-spacing: -0.5px;
      }
      .header-actions {
        gap: 6px;
        flex-shrink: 0;
      }
      .lang-toggle-btn {
        height: 38px;
        min-width: 44px;
        padding: 4px 6px;
        font-size: 11px;
      }
      .theme-toggle-btn {
        width: 38px;
        height: 38px;
        flex-shrink: 0;
      }
      /* Header filter button is now replaced by the toolbar one — hide in header on mobile */
      .mobile-filter-btn {
        display: none;
      }

      /* Toolbar Filter Tile Button (shown only on mobile) */
      .toolbar-filter-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex: 1 1 0;
        min-width: 0;
        height: 36px;
        padding: 0 10px;
        background: var(--bg-input);
        border: 1.5px solid var(--border);
        border-radius: 7px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-body);
        cursor: pointer;
        box-sizing: border-box;
        transition: border-color 0.15s, background 0.15s;
      }
      .toolbar-filter-btn:active {
        border-color: var(--brand-emerald);
        background: var(--brand-green-subtle);
      }

      /* Desktop sort in toolbar is hidden on mobile (sort is inside filter sidebar) */
      .sort-select-desktop {
        display: none;
      }

      /* Sidebar sort is shown only in mobile filter bottom sheet */
      .sidebar-sort-section {
        display: block;
      }

      /* Mobile Bottom Sheet */
      .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 88vh;
        max-height: 88vh;
        z-index: 1020;
        border-radius: 18px 18px 0 0;
        border: none;
        border-top: 1px solid var(--border);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
        transform: translateY(105%);
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.32s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: var(--bg-card);
        visibility: hidden;
        pointer-events: none;
      }
      .sidebar.open {
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
      }
      .sidebar::before {
        display: none;
      }
      .sidebar-header-mobile {
        display: flex;
        flex-direction: column;
        padding: 10px 16px 12px;
        background: var(--header-bg);
        color: #ffffff;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        flex-shrink: 0;
      }
      .sheet-handle {
        display: block;
        width: 38px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.45);
        margin: 0 auto 10px auto;
        flex-shrink: 0;
      }
      .sidebar-header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
      }
      .sidebar-header-title {
        font-size: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        gap: 8px;
      }
      .sidebar-close-btn {
        background: rgba(255, 255, 255, 0.15);
        border: none;
        color: #ffffff;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        font-size: 18px;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s;
        flex-shrink: 0;
      }
      .sidebar-close-btn:active {
        background: rgba(255, 255, 255, 0.3);
      }
      .sidebar-inner {
        padding: 16px 14px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
      }
      /* Hide regular buttons in inner sidebar on mobile */
      .sidebar-inner .filter-btn,
      .sidebar-inner .clear-btn {
        display: none;
      }

      /* Sticky Mobile Bottom Sheet Footer */
      .sidebar-footer-mobile {
        display: flex;
        gap: 8px;
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        position: sticky;
        bottom: 0;
        z-index: 10;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
        flex-shrink: 0;
      }
      .filter-btn-mobile {
        flex: 2;
        background: var(--brand-green);
        color: #ffffff;
        border: none;
        border-radius: 8px;
        min-height: 46px;
        font-family: inherit;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        box-shadow: 0 2px 8px rgba(0, 86, 63, 0.3);
        transition: background 0.15s;
      }
      .filter-btn-mobile:active {
        background: var(--brand-green-hover);
      }
      .clear-btn-mobile {
        flex: 1;
        background: var(--bg-input);
        border: 1px solid var(--border);
        border-radius: 8px;
        min-height: 46px;
        font-family: inherit;
        font-size: 13.5px;
        font-weight: 600;
        color: var(--text-muted);
        cursor: pointer;
        padding: 0 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.15s;
      }
      .clear-btn-mobile:active {
        color: #e53e3e;
        border-color: #e53e3e;
      }

      /* Dim Backdrop */
      .filter-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--backdrop-bg);
        backdrop-filter: blur(2px);
        z-index: 1015;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
      }
      .filter-backdrop.open {
        opacity: 1;
        pointer-events: auto;
      }

      /* Main Page Layout on Mobile - Maximize usable width */
      .page-wrap {
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
        padding: 10px 8px;
        gap: 10px;
      }
      .main-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-x: hidden;
      }
      .content-header {
        margin-bottom: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
      }
      .content-title {
        font-size: 18px;
      }
      .toolbar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        gap: 6px;
      }
      .sort-select {
        flex: 1 1 0;
        min-width: 0;
        width: 0;
        height: 36px;
        padding: 4px 8px;
        font-size: 13px !important;
        box-sizing: border-box;
      }
      .view-toggle {
        flex-shrink: 0;
        display: flex;
      }
      .view-btn {
        min-width: 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .view-btn.view-btn-map {
        width: 36px;
        min-width: 36px;
        padding: 0;
        justify-content: center;
      }
      .view-btn.view-btn-map .map-label {
        display: none;
      }

      /* Tournament Rows & Cards on Mobile - Vertical Mobile-First Redesign */
      .tournaments-grid {
        grid-template-columns: 1fr;
        gap: 10px;
      }
      .tournaments-list {
        gap: 10px;
      }
      .tournament-row,
      .tournament-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        flex-direction: column;
        align-items: stretch;
        padding: 10px 10px 10px 20px;
        gap: 0;
        border-radius: 10px;
        overflow: hidden;
      }
      .tournament-row:hover,
      .tournament-card:hover {
        transform: none;
      }
      .card-main-content {
        width: 100%;
      }
      .card-header-block {
        width: 100%;
      }
      .row-name,
      .card-name {
        font-size: 14.5px;
        font-weight: 700;
        line-height: 1.35;
        word-break: break-word;
        margin-bottom: 4px;
        display: block;
        width: 100%;
      }
      .card-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-top: 4px;
        margin-bottom: 2px;
      }
      .card-meta-rows {
        margin-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 5px;
      }
      .meta-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 6px;
        font-size: 12px;
        color: var(--text-muted);
        line-height: 1.35;
      }
      .meta-row-2 {
        word-break: break-word;
      }
      .meta-loc {
        font-weight: 600;
        color: var(--text-body);
        word-break: break-word;
      }
      .card-actions-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border-subtle);
      }
      .card-actions-bar .btn-save,
      .card-actions-bar .btn-calendar,
      .card-actions-bar .btn-share {
        min-width: 36px;
        min-height: 36px;
        height: 36px;
        padding: 0;
        flex: 0 0 36px;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      .card-actions-bar .btn-save .btn-text,
      .card-actions-bar .btn-calendar .btn-text,
      .card-actions-bar .btn-share .btn-text {
        display: none;
      }
      .card-actions-bar .btn-signup {
        flex: 1;
        min-height: 36px;
        height: 36px;
        padding: 0 12px;
        border-radius: 6px;
        font-size: 11.5px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
      }
      .card-actions-bar:not(:has(.btn-signup)) .btn-save,
      .card-actions-bar:not(:has(.btn-signup)) .btn-calendar,
      .card-actions-bar:not(:has(.btn-signup)) .btn-share {
        flex: 1;
        padding: 0 8px;
        font-size: 11px;
      }
      .card-actions-bar:not(:has(.btn-signup)) .btn-text {
        display: inline;
      }

      /* Tabs horizontal swipeable touch scroll with hidden scrollbar */
      .tabs-wrap {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        justify-content: flex-start;
        padding: 0;
        margin: 10px 0 8px;
        border-bottom: 1px solid var(--border);
      }
      .tabs-wrap::-webkit-scrollbar {
        display: none;
      }
      .tab-list {
        display: flex;
        flex-direction: row;
        gap: 6px;
        width: max-content;
        min-width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
      }
      .tab-btn {
        white-space: nowrap;
        font-size: 13px;
        padding: 8px 12px;
        min-height: 40px;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      /* Mobile Footer */
      .footer {
        padding: 14px 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
      }
      .footer-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        width: 100%;
        max-width: 100%;
      }

      /* Touch Ergonomics on Mobile Form Controls */
      .sidebar-map-btn {
        min-height: 44px;
      }
      .month-picker-trigger {
        min-height: 44px;
      }
      .country-input-box {
        min-height: 44px;
      }
      .filter-chip {
        min-height: 40px;
        font-size: 13px;
        padding: 8px 12px;
      }
      .norms-grid .filter-chip {
        min-height: 30px;
        height: 30px;
        padding: 4px 8px;
        font-size: 12px;
      }
      .geo-btn {
        min-height: 44px;
      }

      /* Map height on mobile */
      #map-wrap {
        height: 340px !important;
        margin-bottom: 14px;
      }
    }

/* =================== MONTH PICKER =================== */
.month-picker-wrap { position: relative; }

.month-picker-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-input); cursor: pointer; font-size: 13px;
  color: var(--text-main); text-align: left; font-family: inherit;
  transition: border-color .15s, background 0.2s;
}
.month-picker-trigger:hover { border-color: var(--brand-emerald); }

.month-picker-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; z-index: 200;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  transition: background 0.2s, border-color 0.2s;
}

.picker-year-toggle {
  width: 100%; font-size: 14px; font-weight: 700; color: var(--brand-emerald);
  background: var(--brand-green-subtle); border: 1px solid var(--brand-green-border, var(--border)); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; margin-bottom: 8px;
  font-family: inherit; transition: background .15s;
}
.picker-year-toggle:hover { background: var(--brand-green-subtle); }

.picker-months-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px;
}

.picker-month-btn {
  padding: 8px 0; border: 1px solid var(--border); border-radius: 5px;
  background: transparent; cursor: pointer; font-size: 12px; font-family: inherit;
  color: var(--text-main); transition: all .15s; font-weight: 500;
}
.picker-month-btn:hover { border-color: var(--brand-emerald); color: var(--brand-emerald); background: var(--brand-green-subtle); }
.picker-month-btn.active { background: var(--brand-green); color: #fff; border-color: var(--brand-green); }
.picker-actions { display: flex; gap: 6px; margin-top: 2px; }
.picker-clear-btn { flex: 1; font-size: 12px; color: var(--text-muted); background: transparent; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; padding: 7px 0; font-family: inherit; transition: color .15s, border-color .15s; }
.picker-clear-btn:hover { color: #e53e3e; border-color: #e53e3e; }
.picker-apply-btn { flex: 1; font-size: 12px; color: #fff; background: var(--brand-green); border: 1px solid var(--brand-green); border-radius: 5px; cursor: pointer; padding: 7px 0; font-family: inherit; font-weight: 600; transition: background .15s; }
.picker-apply-btn:hover { background: var(--brand-green-hover); }

/* =================== MINIMALIST DATE RANGE CALENDAR =================== */
.calendar-range-wrap {
  position: relative;
  margin-top: 8px;
}
.calendar-range-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-main);
  font-family: inherit;
  transition: border-color .15s, background 0.2s;
  box-sizing: border-box;
}
.calendar-range-trigger:hover,
.calendar-range-wrap.open .calendar-range-trigger {
  border-color: var(--brand-emerald);
}
.calendar-range-trigger.has-range {
  border-color: var(--brand-emerald);
  background: var(--brand-green-subtle);
  font-weight: 600;
}
.calendar-range-trigger-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-range-trigger-inner svg {
  flex-shrink: 0;
  color: var(--text-dim);
}
.calendar-range-trigger.has-range .calendar-range-trigger-inner svg {
  color: var(--brand-emerald);
}
.calendar-range-trigger-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.range-clear-btn {
  font-size: 11px;
  color: var(--text-dim);
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.15s;
}
.range-clear-btn:hover {
  color: #e53e3e;
  background: rgba(229, 62, 62, 0.12);
}
.calendar-chevron {
  color: var(--text-dim);
  transition: transform 0.2s ease;
}
.calendar-range-wrap.open .calendar-chevron {
  transform: rotate(180deg);
}

.calendar-range-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 10px 10px 8px;
  box-sizing: border-box;
}
.cal-status-prompt {
  background: var(--brand-green-subtle);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 9px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 29px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}
[data-theme="dark"] .cal-status-prompt {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(45, 184, 132, 0.3);
}
.cal-status-prompt .prompt-placeholder {
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}
.cal-status-prompt .prompt-from {
  color: var(--brand-emerald);
  font-weight: 700;
}
.cal-status-prompt .prompt-connector {
  color: var(--text-dim);
  font-weight: 500;
  margin: 0 1px;
}
.cal-status-prompt .prompt-to {
  color: var(--brand-emerald);
  font-weight: 700;
}
.cal-status-prompt .prompt-to-waiting {
  color: var(--brand-emerald);
  font-weight: 700;
  animation: calPulseWait 1.4s ease-in-out infinite;
}
.cal-status-prompt .prompt-tag {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 2px;
}
@keyframes calPulseWait {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.97); }
}
.cal-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-month-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-heading, var(--text-main));
}
.cal-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s;
}
.cal-nav-btn:hover {
  background: var(--brand-green-subtle);
  border-color: var(--brand-emerald);
  color: var(--brand-emerald);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 4px;
}
.cal-weekdays span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
  column-gap: 0;
  margin-bottom: 8px;
}
.cal-day-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  position: relative;
}
.cal-day-cell.empty {
  pointer-events: none;
}
/* The soft connecting ribbon in the brand palette */
.cal-day-cell.in-range {
  background: rgba(16, 185, 129, 0.14);
}
[data-theme="dark"] .cal-day-cell.in-range {
  background: rgba(45, 184, 132, 0.22);
}
.cal-day-cell.range-start:not(.range-single) {
  background: linear-gradient(to right, transparent 50%, rgba(16, 185, 129, 0.14) 50%);
}
[data-theme="dark"] .cal-day-cell.range-start:not(.range-single) {
  background: linear-gradient(to right, transparent 50%, rgba(45, 184, 132, 0.22) 50%);
}
.cal-day-cell.range-end:not(.range-single) {
  background: linear-gradient(to left, transparent 50%, rgba(16, 185, 129, 0.14) 50%);
}
[data-theme="dark"] .cal-day-cell.range-end:not(.range-single) {
  background: linear-gradient(to left, transparent 50%, rgba(45, 184, 132, 0.22) 50%);
}
.cal-day-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all 0.15s ease;
}
.cal-day-btn:hover {
  background: var(--brand-green-subtle);
  color: var(--brand-emerald);
}
.cal-day-cell.range-start .cal-day-btn,
.cal-day-cell.range-end .cal-day-btn {
  background: var(--brand-green) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(15, 89, 64, 0.35);
}
[data-theme="dark"] .cal-day-cell.range-start .cal-day-btn,
[data-theme="dark"] .cal-day-cell.range-end .cal-day-btn {
  background: var(--brand-emerald) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.cal-day-cell.in-range .cal-day-btn {
  color: var(--brand-green);
  font-weight: 600;
}
[data-theme="dark"] .cal-day-cell.in-range .cal-day-btn {
  color: #6ee7b7;
}
.cal-day-cell.today .cal-day-btn {
  font-weight: 700;
}
.cal-day-cell.today .cal-day-btn::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--brand-emerald);
}
.cal-day-cell.range-start.today .cal-day-btn::after,
.cal-day-cell.range-end.today .cal-day-btn::after {
  background: #ffffff;
}
.cal-footer {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.cal-clear-btn {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  padding: 5px 0;
  font-family: inherit;
  transition: all .15s;
}
.cal-clear-btn:hover {
  color: #e53e3e;
  border-color: #e53e3e;
}
.cal-apply-btn {
  flex: 1;
  font-size: 11px;
  color: #fff;
  background: var(--brand-green);
  border: 1px solid var(--brand-green);
  border-radius: 5px;
  cursor: pointer;
  padding: 5px 0;
  font-family: inherit;
  font-weight: 600;
  transition: background .15s;
}
.cal-apply-btn:hover {
  background: var(--brand-green-hover);
  border-color: var(--brand-green-hover);
}

/* ── LEAFLET DARK MODE & POPUP STYLING ───────────────── */
[data-theme="dark"] .leaflet-tile {
  filter: var(--leaflet-tile-filter);
}
[data-theme="dark"] .leaflet-container {
  background: #0b0f19 !important;
}
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: #1e293b !important;
  color: #f1f5f9 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
  border: 1px solid #334155;
}
[data-theme="dark"] .leaflet-popup-content b {
  color: #34d399 !important;
}
[data-theme="dark"] .leaflet-bar a {
  background-color: #1e293b !important;
  border-bottom: 1px solid #334155 !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .leaflet-bar a:hover {
  background-color: #334155 !important;
}

/* ── Locale-aware display rules ─────────────────────────── */
/* PZSzach norm category filters and badges are hidden for non-Polish users */
body.lang-en .pzszach-only { display: none !important; }
body.lang-en .badge-norm { display: none !important; }

/* ── AUTH BUTTON IN HEADER ───────────────────────────────── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 4px 10px;
  height: 34px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
  box-sizing: border-box;
}
.auth-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.02);
}
.auth-btn:active {
  transform: scale(0.97);
}
.auth-btn.logged-in {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
  color: #a7f3d0;
}
.auth-btn.logged-in:hover {
  background: rgba(16, 185, 129, 0.35);
}
.auth-btn-label {
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 480px) {
  .auth-btn {
    padding: 4px 8px;
  }
  .auth-btn-label {
    display: none;
  }
}

/* ── AUTH MODAL & TOAST PROMPT ───────────────────────────── */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: authFadeIn 0.2s ease-out;
}

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

.auth-modal-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 24px;
  color: var(--text-main);
  animation: authCardScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.auth-modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 20px;
}
.auth-modal-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.5px;
}
.auth-modal-logo .logo-colon {
  color: var(--brand-emerald);
}
.auth-modal-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--border-subtle);
}
.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.auth-tab-btn:hover {
  color: var(--text-main);
}
.auth-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.auth-field {
  margin-bottom: 14px;
  text-align: left;
}
.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 5px;
}
.auth-field input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-field input:focus {
  border-color: var(--brand-emerald);
  box-shadow: 0 0 0 3px var(--brand-green-subtle);
}
.auth-field-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.auth-alert {
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.auth-alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
[data-theme="dark"] .auth-alert-error {
  background: rgba(185, 28, 28, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.auth-alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
[data-theme="dark"] .auth-alert-success {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--brand-green);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.auth-submit-btn:hover {
  background: var(--brand-green-hover);
}
.auth-submit-btn:active {
  transform: scale(0.98);
}
.auth-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
  display: inline-block;
}
@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* Logged in profile view inside modal */
.auth-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.auth-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-green-subtle);
  color: var(--brand-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.auth-profile-info {
  flex: 1;
  overflow: hidden;
}
.auth-user-email {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  display: inline-block;
}
.auth-logout-btn {
  background: #ef4444;
}
.auth-logout-btn:hover {
  background: #dc2626;
}

/* ── GUEST SAVE TOAST (Unobtrusive prompt) ────────── */
.save-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-emerald);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.save-toast-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.save-toast-icon {
  font-size: 18px;
  line-height: 1;
}
.save-toast-text {
  flex: 1;
}
.save-toast-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-heading);
}
.save-toast-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}
.save-toast-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.save-toast-btn {
  background: var(--brand-green);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.save-toast-btn:hover {
  background: var(--brand-green-hover);
}
.save-toast-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.save-toast-close:hover {
  background: var(--bg-secondary);
  color: var(--text-main);
}

@media (max-width: 600px) {
  .save-toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
}

.country-flag-img {
  vertical-align: middle;
  display: inline-block;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0,0,0,0.3);
}
