:root {
  --bg: #0f1424;
  --surface: #1a2138;
  --surface-2: #222a45;
  --border: #2e375a;
  --text: #e8ecf6;
  --muted: #9aa3c0;
  --primary: #4f7cff;
  --primary-dark: #3a63da;
  --green: #2fbf71;
  --red: #e5484d;
  --gold: #f5c451;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 16px; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav-user { color: var(--text); font-weight: 600; font-size: .9rem; }
.inline { display: inline; margin: 0; }

main.container { padding-top: 28px; padding-bottom: 48px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.card.center { text-align: center; }
.card h1, .card h2 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Jackpot */
.jackpot {
  background: linear-gradient(135deg, #2a2050, #1a2138);
  border: 1px solid var(--gold);
  text-align: center;
}
.jackpot .amount {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .5px;
}

/* Stat pills */
.stats { display: flex; flex-wrap: wrap; gap: 12px; }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  min-width: 130px;
}
.stat .label { color: var(--muted); font-size: .8rem; }
.stat .value { font-size: 1.5rem; font-weight: 700; }

/* Forms */
form { margin-bottom: 0; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-block { display: block; width: 100%; text-align: center; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }
.score-input { width: 56px; text-align: center; display: inline-block; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-activa, .badge-finalizado, .badge-abierto { background: rgba(47,191,113,.18); color: var(--green); }
.badge-pendiente_pago, .badge-config { background: rgba(245,196,81,.18); color: var(--gold); }
.badge-anulada { background: rgba(229,72,77,.18); color: var(--red); }
.badge-en_curso, .badge-programado { background: rgba(79,124,255,.18); color: var(--primary); }
.badge-cerrado { background: var(--surface-2); color: var(--muted); }

/* Flash */
.flash-stack { margin-bottom: 18px; display: grid; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 8px; font-size: .95rem; }
.flash-success { background: rgba(47,191,113,.15); border: 1px solid var(--green); }
.flash-error { background: rgba(229,72,77,.15); border: 1px solid var(--red); }

/* Progreso + navegación por días */
.progress { background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; margin: 8px 0 4px; }
.progress-bar { background: var(--green); height: 100%; transition: width .3s; }
.dias-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.diachip {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .8rem;
  white-space: nowrap;
}
.diachip:hover { text-decoration: none; border-color: var(--primary); }
.diachip.actual { border-color: var(--primary); background: rgba(79, 124, 255, .18); font-weight: 600; }

/* Auth */
.auth-wrap { max-width: 400px; margin: 40px auto; }

/* Misc */
.footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.pill-pos { font-weight: 700; color: var(--gold); }
