:root {
  /* Dark theme alineado al logo: negro cálido + amarillo dorado + blanco hueso */
  --bg-0: #0b0b0d;
  --bg-1: #141416;
  --bg-2: #1c1c1f;
  --bg-3: #262629;
  --border: #37373d;
  --text-0: #f7f4e9;
  --text-1: #cfc9b6;
  --text-2: #948d78;
  --accent: #f5c518;
  --accent-strong: #ffd85a;
  --accent-2: #37d9a0;
  --on-accent: #191712;
  --danger: #ff5c6c;
  --warning: #ffb020;
  --gold: #f5c518;
  --silver: #c9cdd8;
  --bronze: #d08a4e;
  --surface-nav: rgba(11, 11, 13, 0.88);
  --row-hover: rgba(245, 197, 24, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 24px rgba(10, 8, 0, 0.35);
  --font: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Geist", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bg-overlay-1: rgba(245, 197, 24, 0.13);
  --bg-overlay-2: rgba(245, 197, 24, 0.05);
  --auth-overlay-1: rgba(245, 197, 24, 0.20);
  --auth-overlay-2: rgba(245, 197, 24, 0.08);
}

:root[data-theme="light"] {
  /* Light theme: papel cálido, dorado más profundo para contraste sobre blanco */
  --bg-0: #f6f4ec;
  --bg-1: #ffffff;
  --bg-2: #fbf9f1;
  --bg-3: #efeadb;
  --border: #ded7c2;
  --text-0: #1c1a12;
  --text-1: #423e30;
  --text-2: #6a6453;
  --accent: #b8860b;
  --accent-strong: #d9a400;
  --accent-2: #1f9d6b;
  --on-accent: #ffffff;
  --danger: #d6455b;
  --warning: #b9791a;
  --gold: #c79200;
  --silver: #8a94a6;
  --bronze: #b3763f;
  --surface-nav: rgba(255, 255, 255, 0.92);
  --row-hover: rgba(184, 134, 11, 0.08);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 20px rgba(120, 100, 40, 0.10);
  --bg-overlay-1: rgba(184, 134, 11, 0.10);
  --bg-overlay-2: rgba(184, 134, 11, 0.05);
  --auth-overlay-1: rgba(184, 134, 11, 0.14);
  --auth-overlay-2: rgba(184, 134, 11, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 15% 0%, var(--bg-overlay-1), transparent 45%),
    radial-gradient(circle at 85% 10%, var(--bg-overlay-2), transparent 40%),
    var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, .display {
  font-family: var(--font);
  letter-spacing: 0.01em;
  font-weight: 700;
  margin: 0;
}

.ranking-total .num,
.podio-puntos,
.stat-chip .value,
.feed-points,
.ranking-puesto {
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

button {
  font-family: inherit;
}

/* ---------- Layout ---------- */

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-nav);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 8px 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-0);
}

.brand .flame {
  font-size: 1.5rem;
}

.brand-logo {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 8px;
}

.auth-logo-img {
  height: 64px;
  width: 64px;
  object-fit: contain;
  border-radius: 16px;
  margin: 0 auto 10px;
  display: block;
}

.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 70;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-0);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle-inline {
  position: static;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  box-shadow: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-1);
}

.badge-rol {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--accent);
  white-space: nowrap;
}

.btn-logout {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Bottom nav - mobile first, comodo con una mano */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  background: var(--surface-nav);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-2);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
  flex: 1;
  max-width: 90px;
}

/* Contador rojo tipo notificación en un ítem del menú */
.nav-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface-nav);
}

@media (min-width: 900px) {
  .topbar-nav .nav-item .nav-badge {
    position: static;
    display: inline-block;
    margin-left: 4px;
    box-shadow: none;
    vertical-align: middle;
  }
}

.ph {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex-shrink: 0;
  vertical-align: -0.125em;
}

.nav-item .icon {
  font-size: 1.4rem;
  line-height: 0;
}

/* Interruptor de tema: sol en claro, luna en oscuro (sin JS) */
.theme-toggle .ico-sol { display: none; }
:root[data-theme="light"] .theme-toggle .ico-sol { display: block; }
:root[data-theme="light"] .theme-toggle .ico-luna { display: none; }

.nav-item.active {
  color: var(--accent);
  background: rgba(245, 197, 24, 0.12);
}

.nav-item:hover {
  color: var(--text-0);
}

@media (min-width: 900px) {
  .bottom-nav {
    display: none;
  }
  body {
    padding-bottom: 0;
  }
  .topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 16px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar-nav .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    font-size: 0.85rem;
    padding: 6px 8px;
    max-width: none;
  }
  /* Todo en una sola fila: marca | menú | tema + salir.
     El menú absorbe el ancho sobrante y hace wrap interno si hace falta. */
  .topbar-inner {
    flex-wrap: nowrap;
  }
  .brand,
  .topbar-user {
    flex-shrink: 0;
  }
}

@media (min-width: 900px) and (max-width: 1200px) {
  .topbar-nav .nav-item .icon { font-size: 1.1rem; }
  .topbar-nav .nav-item { font-size: 0.8rem; padding: 6px 6px; }
}

@media (max-width: 899px) {
  .topbar-nav {
    display: none;
  }
}

/* Header movil: evita que el logo, el año y el tema se amontonen */
@media (max-width: 560px) {
  .topbar-inner {
    flex-wrap: nowrap;
    min-height: 56px;
    gap: 8px;
  }
  .brand {
    font-size: 1rem;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-logo {
    height: 26px;
    width: 26px;
    flex-shrink: 0;
  }
  .brand-year {
    display: none;
  }
  .topbar-user {
    flex: 0 0 auto;
    gap: 8px;
  }
  .btn-logout {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

main {
  padding: 20px 0 40px;
}

/* ---------- Flash messages ---------- */

.flashes {
  position: fixed;
  top: 76px;
  right: 16px;
  left: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.flash {
  pointer-events: auto;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: slide-in 0.25s ease;
}

.flash.success {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.flash.error {
  border-color: var(--danger);
  color: var(--danger);
}
.flash.info {
  border-color: var(--accent);
  color: var(--text-0);
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---------- Cards / generic ---------- */

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-header h2 {
  font-size: 1.4rem;
}

.muted {
  color: var(--text-2);
}

/* ---------- Buttons / forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.03em;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(245, 197, 24, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(245, 197, 24, 0.55);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-2), #6dffcf);
  color: #06251c;
}

.btn-danger {
  background: var(--bg-3);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-1);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text-0);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.pager .disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 0.95rem;
  font-family: var(--font-body);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.28);
}

.field {
  margin-bottom: 16px;
}

.field-help {
  font-size: 0.75rem;
  color: var(--text-2);
  margin-top: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

/* ---------- Auth pages ---------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background:
    radial-gradient(circle at 20% 20%, var(--auth-overlay-1), transparent 45%),
    radial-gradient(circle at 80% 80%, var(--auth-overlay-2), transparent 45%),
    var(--bg-0);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 22px;
}

.auth-logo .flame {
  font-size: 2.6rem;
  display: block;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 14px rgba(245, 197, 24, 0.75));
}

.auth-logo h1 {
  font-size: 1.6rem;
}

.auth-logo p {
  color: var(--text-2);
  font-size: 0.85rem;
  margin-top: 4px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
}

.remember-me input {
  width: auto;
  margin: 0;
  accent-color: var(--accent-2);
}

.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--text-2);
}

.auth-footer a {
  color: var(--accent-2);
  font-weight: 600;
}

.guardia-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.guardia-option {
  position: relative;
}

.guardia-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.guardia-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-0);
  text-transform: none;
  color: var(--text-1);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-size: 0.75rem;
  margin: 0;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.guardia-option label .icon {
  font-size: 1.4rem;
}

.guardia-option input:checked + label {
  border-color: var(--guardia-color, var(--accent));
  color: var(--text-0);
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--guardia-color, var(--accent)) 30%, transparent);
}

/* ---------- Podio / Ranking ---------- */

.podio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 22px;
}

.podio-cols {
  margin-bottom: 28px;
}

.podio-card .podio {
  margin-bottom: 0;
}

.podio-card .podio-puesto {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
}

.podio-puesto {
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  position: relative;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  animation: pop-in 0.5s ease backwards;
  cursor: pointer;
  display: block;
  transition: transform 0.15s ease;
}

.podio-puesto:hover {
  transform: translateY(-3px);
}

.podio-puesto.p1 {
  order: 2;
  padding-top: 30px;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 35%, transparent);
}
.podio-puesto.p2 {
  order: 1;
  border-color: var(--silver);
}
.podio-puesto.p3 {
  order: 3;
  border-color: var(--bronze);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.podio-medalla {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 6px;
}

.podio-icono {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 4px;
}

.podio-nombre {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.podio-puntos {
  font-family: var(--font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--guardia-color, var(--accent-2));
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.ranking-row:hover {
  transform: translateX(2px);
}

.ranking-row.mine {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.ranking-puesto {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-2);
  text-align: center;
}

.ranking-info {
  min-width: 0;
}

.ranking-nombre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-family: var(--font);
  font-size: 1rem;
  margin-bottom: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--guardia-color);
  flex-shrink: 0;
}

.bars {
  display: flex;
  gap: 3px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-0);
}

.bar-seg {
  height: 100%;
  transition: width 0.6s ease;
}

.ranking-meta {
  font-size: 0.72rem;
  color: var(--text-2);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ranking-total {
  text-align: right;
  font-family: var(--font);
}

.ranking-total .num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--guardia-color);
}

.ranking-total .label {
  font-size: 0.65rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ranking-total.pulse .num {
  animation: pulse-up 0.6s ease;
}

@keyframes pulse-up {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35);
    color: var(--accent-2);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- Stat chips ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-chip .value {
  font-family: var(--font);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-chip .label {
  font-size: 0.72rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ---------- Feed ---------- */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-1);
  cursor: pointer;
  animation: fade-slide 0.4s ease backwards;
}

.feed-item:hover {
  border-color: var(--accent);
}

.feed-item:not(.clickable) {
  cursor: default;
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feed-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}

.feed-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar circular pequeño en el menú (reemplaza el ícono 👤) */
.nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

/* La foto y el emoji 👤 deben ocupar EXACTO el mismo alto en el menú
   inferior, si no la palabra "Perfil" queda desalineada de los demás
   ítems al subir una foto. */
.bottom-nav .nav-item > .icon,
.bottom-nav .nav-item > .nav-avatar {
  height: 24px;
  line-height: 24px;
  display: block;
}

.bottom-nav .nav-item > .nav-avatar {
  width: 24px;
}

.bottom-nav .nav-item > .icon {
  font-size: 1.3rem;
  text-align: center;
}

/* Cabecera de perfil con foto */
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  border: 2px solid var(--border, rgba(255, 255, 255, 0.1));
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.profile-avatar-actions input[type="file"] {
  font-size: 0.75rem;
  max-width: 180px;
}

/* Avatar con lápiz para cambiar la foto */
.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}

.avatar-edit-btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--bg-1, #0b0b12);
  background: var(--accent, #f5c518);
  color: #12121a;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: var(--shadow, 0 2px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.12s ease;
}

.avatar-edit-btn:hover {
  transform: scale(1.1);
}

.feed-body {
  flex: 1;
  min-width: 0;
}

.feed-title {
  font-size: 0.88rem;
  font-weight: 600;
}

.feed-title b {
  color: var(--text-0);
}

.feed-sub {
  font-size: 0.72rem;
  color: var(--text-2);
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.feed-points {
  font-family: var(--font);
  font-weight: 700;
  color: var(--accent-2);
  font-size: 1rem;
  flex-shrink: 0;
}

.feed-cuando {
  color: var(--text-2);
  white-space: nowrap;
}

.tag-guardia {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--guardia-color) 20%, transparent);
  color: var(--guardia-color);
}

/* ---------- Fotos de perfil ampliables ---------- */

.zoomable-avatar {
  cursor: zoom-in;
}

/* ---------- Progress / calc preview ---------- */

.calc-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  background: rgba(245, 197, 24, 0.08);
  margin: 18px 0;
}

.calc-preview .big {
  font-family: var(--font);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent);
  transition: transform 0.15s ease;
}

.calc-preview .big.bump {
  transform: scale(1.15);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(245, 197, 24, 0.06);
}

.dropzone .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.preview-img {
  max-height: 280px;
  border-radius: var(--radius-sm);
  margin-top: 14px;
  border: 1px solid var(--border);
}

/* ---------- Fiscalizacion queue ---------- */

.queue-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
}

.queue-card-thumb {
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  background: var(--bg-3);
  display: block;
  cursor: zoom-in;
}

.queue-card-zoom {
  align-self: flex-start;
  font-size: 0.8rem;
  padding: 4px 10px;
}

.queue-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.queue-card-actions {
  display: flex;
  gap: 8px;
}

.reject-form {
  display: none;
  gap: 8px;
  flex-direction: column;
  margin-top: 8px;
}

.reject-form.open {
  display: flex;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 560px;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--bg-3);
  color: var(--text-2);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--row-hover);
}

.status-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill.pendiente {
  background: rgba(255, 176, 32, 0.15);
  color: var(--warning);
}
.status-pill.aprobado {
  background: rgba(46, 230, 166, 0.15);
  color: var(--accent-2);
}
.status-pill.rechazado {
  background: rgba(255, 77, 106, 0.15);
  color: var(--danger);
}
.status-pill.eliminado {
  background: rgba(255, 77, 106, 0.22);
  color: var(--danger);
  text-decoration: line-through;
}

.del-corrida summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
}
.del-corrida summary::-webkit-details-marker {
  display: none;
}
.del-corrida textarea {
  margin-bottom: 6px;
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding-bottom: 2px;
}

.tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ---------- Empty / loading states ---------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-2);
}

.empty-state .icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 10px;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 37%, var(--bg-2) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 12, 0.75);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
  animation: fade-slide 0.2s ease;
}

.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-box img {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.modal-box.modal-lightbox {
  max-width: 620px;
}

.modal-box.modal-wide {
  max-width: 640px;
}

.modal-box.modal-lightbox img {
  width: auto;
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  margin: 0 auto 14px;
  background: var(--bg-3);
}

.modal-fisc-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.modal-fisc-reject {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.3rem;
  cursor: pointer;
}

/* ---------- Invitación a instalar la app ---------- */

.instalar-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(4, 2, 12, 0.75);
  backdrop-filter: blur(3px);
  animation: fade-slide 0.2s ease;
}

.instalar-box {
  width: 100%;
  max-width: 420px;
  padding: 22px 20px 18px;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.instalar-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border-radius: 14px;
}

.instalar-box h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.instalar-texto {
  margin: 0 0 14px;
  color: var(--text-1);
  font-size: 0.95rem;
}

.instalar-pasos {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  text-align: left;
  color: var(--text-1);
  font-size: 0.95rem;
  line-height: 1.5;
}

.instalar-ico {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  color: var(--accent);
}

.instalar-acciones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Confetti ---------- */

.confetti-piece {
  position: fixed;
  top: -10px;
  z-index: 200;
  pointer-events: none;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0.3;
  }
}

/* ---------- Aviso "en revisión" tras enviar una corrida ---------- */

.corrida-enviando {
  display: none;
  margin-top: 16px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.corrida-enviando.show {
  display: block;
  animation: corrida-enviando-in 0.25s ease-out;
}

@keyframes corrida-enviando-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.corrida-enviando img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 10px rgba(245, 197, 24, 0.5));
  animation: corrida-enviando-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes corrida-enviando-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.corrida-enviando p {
  margin: 2px 0;
}

.corrida-enviando-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
}

/* ---------- Login-required avatars / misc ---------- */

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}

.check-item input {
  width: auto;
}

.pagehead {
  margin-bottom: 20px;
}

.pagehead h1 {
  font-size: 1.7rem;
  margin-bottom: 4px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  .podio {
    grid-template-columns: repeat(3, 1fr);
  }
  .podio-puesto {
    padding: 14px 8px;
  }
}

/* ---------- Reporte de coordinación ---------- */

.reporte-filtros {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

.reporte-filtros .field {
  margin-bottom: 0;
}

.reporte-sheet {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 100%;
  overflow: hidden;
}

.reporte-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 10% -20%, var(--bg-overlay-1), transparent 55%),
    radial-gradient(circle at 100% 120%, var(--bg-overlay-2), transparent 50%),
    var(--bg-2);
}

.reporte-banner .titulo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.reporte-banner .titulo img {
  height: 46px;
  width: 46px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 0 10px rgba(245, 197, 24, 0.55));
}

.reporte-banner h1 {
  font-size: 1.35rem;
  margin: 0;
  line-height: 1.15;
}

.reporte-banner .periodo {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-2);
  flex-shrink: 0;
}

.reporte-banner .periodo .pill {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
}

.reporte-mvp-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.reporte-mvp {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--guardia-color, var(--accent));
  background: var(--bg-2);
  min-width: 0;
}

.reporte-mvp .emoji {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.reporte-mvp .info {
  min-width: 0;
}

.reporte-mvp .info .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
}

.reporte-mvp .info .nombre {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reporte-mvp .info .detalle {
  font-size: 0.75rem;
  color: var(--accent-2);
  font-weight: 700;
}

.reporte-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 22px;
  min-width: 0;
}

.reporte-stats .stat-chip {
  padding: 12px 6px;
  min-width: 0;
  overflow: hidden;
}

.reporte-stats .stat-chip .stat-icon {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.reporte-stats .stat-chip .value {
  font-size: 1.3rem;
  white-space: nowrap;
}

.reporte-stats .stat-chip .label {
  font-size: 0.6rem;
}

.reporte-section-title {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reporte-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
  min-width: 0;
}

.reporte-cols > div {
  min-width: 0;
}

.reporte-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.reporte-rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reporte-rank-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}

.reporte-rank-row::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--bar-pct, 0%);
  background: var(--guardia-color, var(--accent));
  opacity: 0.16;
  z-index: 0;
}

.reporte-rank-row > * {
  position: relative;
  z-index: 1;
}

.reporte-rank-row .puesto {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.85rem;
  width: 22px;
  flex-shrink: 0;
  text-align: center;
}

.reporte-rank-row .nombre {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reporte-rank-row .nombre .sub {
  color: var(--text-2);
  font-weight: 400;
  font-size: 0.7rem;
}

.reporte-rank-row .pts {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--guardia-color, var(--accent-2));
  flex-shrink: 0;
}

.reporte-chart-wrap {
  margin-bottom: 8px;
}

.reporte-chart {
  overflow: visible;
}

.reporte-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-1);
}

.reporte-chart-legend .item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.reporte-chart-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot-color, var(--accent));
  flex-shrink: 0;
}

.reporte-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: space-between;
}

@media (max-width: 900px) {
  .reporte-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .reporte-cols {
    grid-template-columns: 1fr;
  }
  .reporte-mvp-row {
    grid-template-columns: 1fr;
  }
  .reporte-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .reporte-banner .periodo {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .reporte-sheet {
    padding: 14px;
    border-radius: var(--radius-sm);
  }
  .reporte-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .reporte-banner {
    padding: 14px;
  }
  .reporte-banner h1 {
    font-size: 1.1rem;
  }
}

/* Geometría de página para Guardar como PDF: márgenes propios y definidos
   en vez de depender de lo que el navegador traiga por defecto (que es lo
   que hace que el PDF final se vea como una captura recortada de la web). */
@page {
  size: A4;
  margin: 14mm 10mm;
}

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  html, body {
    width: auto;
    height: auto;
  }
  .topbar,
  .bottom-nav,
  .flashes,
  .theme-toggle,
  .reporte-filtros,
  .no-print {
    display: none !important;
  }
  body {
    padding: 0;
    background: var(--bg-0);
  }
  main.container {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  main {
    padding: 0;
  }
  .reporte-sheet {
    box-shadow: none;
    border: none;
    /* No depende solo del margen de @page: algunos navegadores ignoran esos
       márgenes si el usuario elige "Sin márgenes" en el diálogo de impresión,
       así que el espacio lateral también se garantiza con padding propio. */
    padding: 0 8mm;
  }

  /* El gráfico no debe recortarse al ancho de pantalla: en la hoja impresa
     no hay scroll horizontal, así que tiene que encajar en el ancho real. */
  .reporte-scroll {
    overflow: visible;
  }
  .reporte-chart-wrap .reporte-chart {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Evita que el salto de página parta secciones, filas o el título de
     "Top 10 individual" separado de su lista. El espacio de arriba se da
     con padding (no margin): los navegadores colapsan el margin-top de un
     bloque que queda primero en una página nueva y lo dejan pegado al borde. */
  .reporte-cols {
    display: block;
  }
  .reporte-banner,
  .reporte-mvp-row,
  .reporte-stats,
  .reporte-cols > div,
  .reporte-chart-wrap {
    padding-top: 6mm;
    margin-bottom: 16px;
  }
  .reporte-banner:first-child {
    padding-top: 0;
  }
  .reporte-banner,
  .reporte-mvp-row,
  .reporte-mvp,
  .reporte-stats,
  .reporte-cols > div,
  .reporte-rank-list,
  .reporte-rank-row,
  .reporte-chart-wrap,
  .reporte-footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .reporte-section-title {
    break-after: avoid;
    page-break-after: avoid;
    padding-top: 2mm;
  }

  .ranking-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ---------- Premio Guardia ganadora ---------- */

.premios-mes {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.premios-mes-oculto {
  display: none !important;
}

.premios-mes-titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.premios-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.premios-subtitulo {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.premios-subtitulo.ok {
  color: var(--success, #37d9a0);
}

.premios-subtitulo.no {
  color: var(--text-2);
}

.premios-list {
  column-width: 170px;
  column-gap: 16px;
  font-size: 0.78rem;
}

.premios-list div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  break-inside: avoid;
}

.premios-list b {
  font-family: var(--font);
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .premios-cols {
    grid-template-columns: 1fr;
  }
}

@media print {
  .premios-sheet {
    font-size: 0.85em;
  }
  .premios-mes {
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  .premios-mes-titulo {
    margin-bottom: 6px;
    padding-bottom: 4px;
  }
  .premios-cols {
    gap: 12px;
  }
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Inicio: pista de carriles ---------- */

.inicio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  margin-bottom: 8px;
}

/* En movil el podio del mes va primero, la pista despues y el feed al final */
.inicio-aside { display: contents; }
.inicio-aside .mes-franja { order: -1; }
.inicio-aside .rail { order: 2; }

@media (min-width: 1000px) {
  .inicio-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 40px;
    align-items: start;
  }
  .inicio-aside {
    display: block;
    position: sticky;
    top: 84px;
  }
  .inicio-aside .mes-franja,
  .inicio-aside .rail { order: 0; }
}

.pista {
  display: flex;
  flex-direction: column;
}

.carril {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

.carril:hover {
  background: var(--row-hover);
}

.carril.mine {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.carril-puesto {
  font-family: var(--font);
  font-weight: 800;
  font-size: 2.6rem;
  line-height: 1;
  text-align: center;
  color: var(--text-2);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.carril.p1 .carril-puesto { color: var(--gold); opacity: 1; }
.carril.p2 .carril-puesto { color: var(--silver); opacity: 1; }
.carril.p3 .carril-puesto { color: var(--bronze); opacity: 1; }

.carril-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.carril-nombre {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}

.carril-racha {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

.carril-racha .ph {
  color: var(--accent);
}

.carril-pista {
  height: 14px;
  border-radius: 7px;
  background: var(--bg-2);
  overflow: hidden;
}

.carril-barra {
  display: flex;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(var(--avance, 0));
  transition: transform 0.9s var(--ease-out);
  animation: carril-entra 1s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 80ms);
}

@keyframes carril-entra {
  from { transform: scaleX(0); }
}

.carril-barra .seg {
  height: 100%;
  background: var(--guardia-color);
}

.carril .ranking-total .num {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.ranking-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Franja lateral: podio del mes + cinta de resultados */

.mes-franja {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.aside-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.aside-cab h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
}

.aside-cab h2 .ph {
  color: var(--accent);
}

.aside-cab .muted {
  font-size: 0.75rem;
}

.mes-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mes-item a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--guardia-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background-color 0.2s ease;
}

.mes-item a:hover {
  background: var(--row-hover);
}

.mes-puesto {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-2);
}

.mes-item.p1 .mes-puesto { color: var(--gold); }
.mes-item.p2 .mes-puesto { color: var(--silver); }
.mes-item.p3 .mes-puesto { color: var(--bronze); }

.mes-nombre {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mes-puntos {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.mes-cierre {
  margin: 10px 0 0;
  font-size: 0.75rem;
}

.empty-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
}

.rail .feed-list {
  gap: 0;
}

@media (min-width: 1000px) {
  .rail .feed-list {
    max-height: 56vh;
    overflow-y: auto;
  }
}

.rail .feed-item {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 10px 2px;
}

.rail .feed-item:hover {
  background: var(--row-hover);
}

.rail .feed-points {
  color: var(--accent);
}

@media (max-width: 560px) {
  .carril {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 4px;
  }
  .carril-puesto { font-size: 2rem; }
  .carril-nombre { font-size: 1.1rem; }
  .carril .ranking-total .num { font-size: 1.7rem; }
}

/* ---------- Ranking individual: dorsales ---------- */

.dorsales {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}

.dorsal {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--guardia-color);
}

.dorsal.mine {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.dorsal-puesto {
  font-family: var(--font);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  text-align: center;
  color: var(--text-2);
  opacity: 0.6;
}

.dorsal.p1 .dorsal-puesto { color: var(--gold); opacity: 1; }
.dorsal.p2 .dorsal-puesto { color: var(--silver); opacity: 1; }
.dorsal.p3 .dorsal-puesto { color: var(--bronze); opacity: 1; }

.dorsal-nombre {
  display: block;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorsal-nombre:hover {
  color: var(--accent);
}

.dorsal-total {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dorsal-total small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.65rem;
  color: var(--text-2);
  margin-top: 3px;
}

@media (max-width: 800px) {
  .dorsales {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Iconos en titulos, botones y vacios ---------- */

h1 .ph,
h2 .ph,
.card-title .ph,
.reporte-section-title .ph {
  color: var(--accent);
  margin-right: 2px;
}

.empty-state .icon .ph {
  width: 2.2rem;
  height: 2.2rem;
  color: var(--text-2);
}

.btn .ph {
  margin-right: 4px;
}

.medalla-1 { color: var(--gold); }
.medalla-2 { color: var(--silver); }
.medalla-3 { color: var(--bronze); }

.tag-guardia .ph,
.premios-subtitulo .ph {
  margin-right: 2px;
}

.premios-subtitulo.ok .ph { color: var(--accent-2); }
.premios-subtitulo.no .ph { color: var(--danger); }

.profile-avatar .ph,
.reporte-mvp .emoji .ph,
.stat-icon .ph {
  width: 1em;
  height: 1em;
}

.inicio-main .section {
  margin-top: 36px;
}

.inicio-main .dorsales {
  grid-template-columns: minmax(0, 1fr);
}
