/* ==============================
   Забег ППК ЕЗ 2026 — Styles
   Corporate colors: blue, teal, white
   ============================== */

:root {
  --primary: #2B5EA7;
  --primary-dark: #1B3A5C;
  --primary-light: #3B7DD8;
  --accent: #00A8B5;
  --accent-light: #00C5D4;
  --bg: #F0F4F8;
  --bg-card: #FFFFFF;
  --text: #1A2332;
  --text-muted: #6B7A8D;
  --border: #D0D5DD;
  --success: #2ECC71;
  --danger: #E74C3C;
  --warning: #F39C12;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(27, 58, 92, 0.08);
  --shadow-lg: 0 8px 32px rgba(27, 58, 92, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 2rem 0;
}

main.auth-main {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Navbar */
.navbar {
  background: var(--primary-dark);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: white;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 8px;
  letter-spacing: -1px;
}

.brand-logo.large {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  border-radius: 12px;
}

.brand-logo.admin-logo {
  background: var(--primary);
}

.brand-text {
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.nav-link:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.nav-logout {
  color: rgba(255,255,255,0.6);
}

.nav-user {
  color: var(--accent-light);
  padding: 0.5rem;
  font-weight: 500;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Auth pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--accent) 100%);
  background-attachment: fixed;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(0, 168, 181, 0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(43, 94, 167, 0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(27, 58, 92, 0.1) 0%, transparent 50%);
  animation: authBgMove 20s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes authBgMove {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-2%, -2%) rotate(3deg); }
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-brand h1 {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-top: 1rem;
}

.auth-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.form-select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  width: 100%;
  background: white;
}

.form-group input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 94, 167, 0.1);
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.inline-form.compact {
  align-items: center;
}

.input-inline {
  padding: 0.4rem 0.6rem !important;
  font-size: 0.9rem !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-primary.active {
  background: var(--accent);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.75rem;
  color: var(--primary-dark);
}

/* Admin header */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  color: var(--primary-dark);
}

.admin-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Alerts */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

.alert-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-team {
  background: rgba(0, 168, 181, 0.1);
  color: var(--accent);
}

.badge-warn {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning);
}

.badge-success {
  background: rgba(46, 204, 113, 0.1);
  color: var(--success);
}

.badge-danger {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
}

.badge-processing {
  background: rgba(43, 94, 167, 0.1);
  color: var(--primary);
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody tr:hover {
  background: rgba(0, 168, 181, 0.03);
}

.row-annulled {
  opacity: 0.5;
  background: #fef2f2 !important;
}

.nowrap {
  white-space: nowrap;
}

/* Similarity badges */
.similarity-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
}

.similarity-badge.high {
  background: #d1fae5;
  color: #065f46;
}

.similarity-badge.medium {
  background: #fef3c7;
  color: #92400e;
}

.similarity-badge.low {
  background: #fee2e2;
  color: #991b1b;
}

/* File upload */
.file-upload {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  background: var(--bg);
}

.file-upload:hover,
.file-upload.drag-over {
  border-color: var(--accent);
  background: rgba(0, 168, 181, 0.05);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.file-upload-text p {
  color: var(--text);
  font-weight: 500;
}

.file-upload-text small {
  color: var(--text-muted);
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.file-preview img {
  max-height: 80px;
  border-radius: 8px;
  object-fit: cover;
}

.file-name {
  font-weight: 500;
  color: var(--primary);
}

/* Screenshot thumbnail */
.screenshot-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

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

.screenshot-link:hover {
  text-decoration: underline;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--danger);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

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

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

.tab-content {
  display: none;
}

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

/* Podium */
.podium-section {
  margin-bottom: 2rem;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 0;
}

.podium-item {
  text-align: center;
  flex: 0 0 auto;
  width: 180px;
}

.podium-medal {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.podium-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.podium-steps {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.1rem;
}

.podium-steps-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.podium-block {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: white;
  border-radius: 8px 8px 0 0;
  margin: 0 auto;
  width: 100%;
}

.first .podium-block {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  height: 120px;
}

.second .podium-block {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  height: 90px;
}

.third .podium-block {
  background: linear-gradient(135deg, #d97706, #b45309);
  height: 70px;
}

/* Teams grid */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.team-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.team-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.team-rank {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.team-header h3 {
  flex: 1;
  margin-bottom: 0;
}

.team-members {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.team-steps {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.team-entries {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.team-member-list {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.team-member {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
}

.member-pos {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 24px;
}

.member-name {
  flex: 1;
}

.member-steps {
  font-weight: 700;
  color: var(--primary);
}

/* Pagination */
.pagination {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Filter form */
.filter-form .form-row {
  align-items: flex-end;
}

/* Settings form */
.settings-form .form-row {
  margin-bottom: 1rem;
}

/* Helpers */
.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

/* Footer */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 1.25rem 0;
  margin-top: auto;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  main {
    padding: 1rem 0;
  }

  .container {
    padding: 0 0.75rem;
  }

  .card {
    padding: 1rem;
    border-radius: 10px;
  }

  .podium {
    flex-direction: column;
    align-items: center;
  }

  .podium-item {
    width: 100%;
    max-width: 250px;
  }

  .first .podium-block,
  .second .podium-block,
  .third .podium-block {
    height: 60px;
  }

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

  .admin-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .admin-nav::-webkit-scrollbar {
    display: none;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.875rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .form-row {
    flex-direction: column;
  }

  .teams-grid {
    grid-template-columns: 1fr;
  }

  .route-map {
    height: 400px;
  }

  .map-route-info {
    font-size: 0.85rem;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
    border-radius: 14px;
    max-width: 100%;
  }

  .auth-page {
    padding: 0.75rem;
    align-items: center;
  }

  .auth-brand h1 {
    font-size: 1.2rem;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .table th, .table td {
    padding: 0.5rem;
    font-size: 0.85rem;
  }

  .file-upload {
    padding: 1.25rem;
  }

  .file-upload-icon {
    font-size: 2rem;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
  }

  .steps-form .form-group input[type="number"] {
    font-size: 1.25rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .brand-text {
    display: none;
  }

  .auth-card {
    padding: 1.5rem 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }

  .brand-logo.large {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }

  .team-card {
    padding: 1rem;
  }

  .team-steps {
    font-size: 1.25rem;
  }

  .podium-medal {
    font-size: 2rem;
  }

  .podium-name {
    font-size: 1rem;
  }
}

/* Route Map */
.route-map {
  width: 100%;
  height: 550px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--bg);
}

.map-route-info {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.map-route-total {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.map-legend {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}

.map-legend-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.map-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.map-legend-color {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.city-marker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.city-marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-dark);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.city-marker-label {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: white;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.user-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  cursor: pointer;
}

.map-popup {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Home page — responsive layout */
.home-desktop-only {
  display: block;
}

.home-mobile-only {
  display: none;
}

.home-section-wide {
  padding: 2rem;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  width: 100vw;
  border-radius: 0;
  box-sizing: border-box;
}

.home-map {
  height: 600px;
}

@media (max-width: 768px) {
  .home-desktop-only {
    display: none;
  }

  .home-mobile-only {
    display: block;
  }

  .home-section-wide {
    padding: 1rem;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    width: auto;
  }

  .home-map {
    height: 400px;
  }
}

/* Ranking switch */
.home-ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.home-ranking-header h2 {
  margin-bottom: 0;
}

.ranking-switch {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.ranking-switch-btn {
  padding: 0.65rem 2rem;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.ranking-switch-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.ranking-switch-btn:hover:not(.active) {
  color: var(--text);
}

.ranking-panel {
  display: none;
}

.ranking-panel.active {
  display: block;
}

/* Home action button */
.home-action-btn {
  padding: 1.3rem 4rem;
  font-size: 1.35rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.home-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.15rem;
}

/* Histogram */
.histogram {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.histogram-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.histogram-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 160px;
  flex-shrink: 0;
}

.histogram-medal {
  font-size: 1.25rem;
  min-width: 28px;
  text-align: center;
}

.histogram-pos {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.histogram-team-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.histogram-team-name:hover {
  color: var(--primary);
}

.histogram-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.histogram-bar {
  height: 28px;
  border-radius: 6px;
  min-width: 4px;
  transition: width 0.5s ease;
}

.histogram-value {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Quick Entry */
.quick-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.quick-entry-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.quick-entry-form {
  flex: 1;
  min-width: 280px;
}

.quick-entry-fields {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-entry-input {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  width: 140px;
}

.quick-entry-input:focus {
  outline: none;
  border-color: var(--primary);
}

.quick-entry-file {
  cursor: pointer;
}

@media (max-width: 768px) {
  .histogram-label {
    min-width: 100px;
  }

  .histogram-row {
    flex-wrap: wrap;
  }

  .quick-entry {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-entry-fields {
    flex-direction: column;
  }

  .quick-entry-input {
    width: 100%;
  }
}

/* Avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  border: 2px solid var(--border);
}

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

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0;
}

.avatar-sm .avatar-placeholder {
  font-size: 0.55rem;
}

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

.avatar-md .avatar-placeholder {
  font-size: 0.75rem;
}

.avatar-lg {
  width: 100px;
  height: 100px;
  border-width: 3px;
}

.avatar-lg .avatar-placeholder {
  font-size: 1.75rem;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* User link (avatar + name) */
.user-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}

.user-link:hover {
  color: var(--primary);
}

.user-link:hover .member-name {
  text-decoration: underline;
}

/* Profile page */
.profile-page {
  max-width: 600px;
  margin: 0 auto;
}

.profile-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
}

.profile-avatar-section {
  margin-bottom: 1.25rem;
}

.profile-avatar-section .avatar {
  margin: 0 auto;
}

.avatar-upload-form {
  margin-top: 0.75rem;
}

.avatar-upload-btn {
  cursor: pointer;
}

.profile-name {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.profile-name-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.profile-name-input {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
  text-align: center;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.15rem 0.5rem;
  background: transparent;
  transition: border-color 0.2s;
  width: auto;
  max-width: 300px;
}

.profile-name-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.profile-login {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.profile-rank-badge {
  margin-bottom: 1.25rem;
}

.profile-rank-badge .badge {
  font-size: 0.9rem;
  padding: 0.35rem 1rem;
}

.badge-no-team {
  background: rgba(107, 122, 141, 0.1);
  color: var(--text-muted);
}

.profile-team-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.profile-team-link:hover {
  text-decoration-style: solid;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.profile-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.profile-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Team profile page */
.team-profile-page .team-member {
  padding: 0.5rem 0;
}

.team-profile-page .team-member .user-link {
  min-width: 0;
}

/* Team link in admin */
.team-profile-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.team-profile-link:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .profile-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .profile-card {
    padding: 1.25rem;
  }

  .avatar-lg {
    width: 80px;
    height: 80px;
  }
}

/* Large screens */
@media (min-width: 1400px) {
  .container {
    max-width: 1360px;
  }

  .stats-row {
    grid-template-columns: repeat(5, 1fr);
  }

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