:root {
  --red: #f51e22;
  --blue: #0654a6;
  --ink: #0a0a0a;
  --paper: #f0edea;
  --white: #ffffff;
  --muted: #5c5c5c;
  --line: #0a0a0a;
  --fh: "Century Gothic", Futura, "Trebuchet MS", sans-serif;
  --f: "Jost", Futura, "Century Gothic", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--f);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
a { color: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: rgba(6, 84, 166, 0.72);
  position: relative;
  overflow: hidden;
}
.login-pattern {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.login-wrap {
  position: relative;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.login-wrap .mark { width: 168px; height: auto; }
.login-card {
  position: relative;
  width: 100%;
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 36px 32px 32px;
}
.pill {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.login-card .pill { border-color: var(--blue); color: var(--blue); }
.login-card h1 {
  font-family: var(--fh);
  font-weight: 900;
  font-size: 42px;
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 14px 0 8px;
}
.lede { margin: 0 0 22px; color: var(--muted); font-weight: 500; font-size: 14px; }
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
input, select {
  width: 100%;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 rgba(10, 10, 10, 0.18);
  padding: 14px 14px;
  outline: none;
}
select:disabled {
  background: #e7e2dc;
  color: #8a847c;
  box-shadow: none;
  cursor: not-allowed;
}
label.is-locked { color: #8a847c; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 22px;
  background: var(--white);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 16px 22px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
a.btn { text-decoration: none; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn.slim { width: auto; margin: 0; padding: 10px 16px; font-size: 12px; }
.alert {
  margin-top: 16px;
  background: #fff5f5;
  border: 2px solid var(--red);
  border-radius: 14px;
  padding: 10px 12px;
  color: #8f1216;
  font-size: 13px;
  font-weight: 600;
}

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.shell.is-compact { grid-template-columns: 84px 1fr; }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: rgba(6, 84, 166, 0.78);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.side-pattern {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
  pointer-events: none;
}
.side > *:not(.side-pattern) { position: relative; }
.side .logo { width: 120px; }
.side nav { display: flex; flex-direction: column; gap: 8px; }
.side nav a {
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; }
.side nav a { gap: 10px; }
.side form button { display: inline-flex; align-items: center; gap: 8px; }
.side nav a.active, .side nav a:hover {
  background: var(--white);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.side .who { margin-top: auto; font-size: 13px; font-weight: 600; }
.who-label { display: block; opacity: 0.8; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px; }
.who-email { display: block; overflow-wrap: anywhere; }
.side form button {
  margin-top: 12px;
  background: transparent;
  color: white;
  border: 2px solid white;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.scrim { display: none; }
.main { padding: 28px 36px 56px; min-width: 0; }
.mast { display: flex; align-items: flex-start; gap: 14px; }
.compact-nav, .close-nav, .menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: white;
  border: 2px solid white;
  border-radius: 999px;
  cursor: pointer;
}
.menu-btn {
  display: none;
  background: var(--white);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.close-nav { display: none; }
.compact-nav .nav-icon { transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1); }
.shell.is-compact .compact-nav .nav-icon { transform: rotate(180deg); }
.main h1 {
  font-family: var(--fh);
  font-size: 48px;
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 8px 0 6px;
}
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 26px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.filters a, .mini {
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--white);
}
.filters a.on { background: var(--ink); color: var(--white); }
.mini { background: transparent; cursor: pointer; }
.mini.danger { border-color: var(--red); color: var(--red); }
textarea { width: 100%; min-height: 140px; border: 2px solid var(--ink); border-radius: 14px; padding: 12px; box-shadow: 3px 3px 0 rgba(10,10,10,.18); }
.stat, .panel {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 4px 4px 0 var(--ink);
}
.stat { padding: 16px 18px; }
.stat b { display: block; font-family: var(--fh); font-size: 34px; line-height: 1; margin-top: 6px; }
.stat span { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.panel { padding: 18px; margin-top: 18px; overflow-x: auto; }
.panel h2 { margin: 0 0 14px; font-family: var(--fh); font-size: 22px; letter-spacing: -0.02em; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
table.fit { min-width: 0; }
table.fit td { overflow-wrap: anywhere; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #ece7e1; font-size: 14px; }
th { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
}
.tag.available, .tag.winner, .tag.won, .tag.fact { background: #e9f8ee; }
.tag.used { background: #fff1e8; }
.tag.void, .tag.pending, .tag.open { background: #f3f3f3; }
.tag.non_winner, .tag.wrong_code, .tag.lost, .tag.fiction { background: #fff5f5; }
.lede a { color: var(--blue); font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row label { flex: 1; min-width: 140px; }
.row .btn { width: auto; margin-top: 0; align-self: end; }
code { font-family: "Courier New", monospace; font-weight: 700; letter-spacing: 0.04em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.shell.is-compact .side { padding: 16px 10px; align-items: center; }
.shell.is-compact .side-head { flex-direction: column; align-items: center; }
.shell.is-compact .logo { width: 52px; }
.shell.is-compact .nav-label,
.shell.is-compact .who-label,
.shell.is-compact .who-email { display: none; }
.shell.is-compact nav { width: 100%; }
.shell.is-compact nav a { justify-content: center; padding: 12px 6px; }
.shell.is-compact .who { width: 100%; }
.shell.is-compact .who form button { width: 100%; justify-content: center; padding: 8px 6px; letter-spacing: 0.04em; }

@media (max-width: 860px) {
  .shell, .shell.is-compact { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    height: 100vh;
    height: 100dvh;
    background: #0654a6;
    transform: translateX(-105%);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 8px 0 0 rgba(10, 10, 10, 0.18);
  }
  .shell.is-open .side { transform: translateX(0); }
  .shell.is-compact .side { align-items: stretch; padding: 22px 16px; }
  .shell.is-compact .logo { width: 120px; }
  .shell.is-compact .side-head { flex-direction: row; align-items: flex-start; }
  .shell.is-compact .nav-label,
  .shell.is-compact .who-label,
  .shell.is-compact .who-email { display: block; }
  .shell.is-compact nav a { justify-content: flex-start; padding: 12px 14px; }
  .menu-btn { display: inline-flex; }
  .compact-nav { display: none; }
  .close-nav { display: inline-flex; }
  .scrim {
    display: block;
    position: fixed;
    z-index: 20;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(10, 10, 10, 0.4);
    opacity: 0;
    pointer-events: none;
  }
  .shell.is-open .scrim { opacity: 1; pointer-events: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .main { padding: 18px 16px 40px; }
  .main h1 { font-size: 36px; }
  .mast { align-items: center; }
  .menu-btn { margin-top: 0; }
  .row { flex-direction: column; align-items: stretch; }
  .row label { min-width: 0; }
  .row .btn, .row a.btn { width: 100%; }
  .login { padding: 20px 14px; }
  .login-card { padding: 28px 18px 22px; border-radius: 22px; }
  .login-card h1 { font-size: 34px; }
  .login-wrap .mark { width: 132px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .main h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .side, .scrim { transition: none; }
}

/* "Codes de test" checkbox and test tag */
label.check { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; align-self: flex-end; padding-bottom: 14px; cursor: pointer; }
label.check input { width: 18px; height: 18px; padding: 0; box-shadow: none; border-radius: 4px; accent-color: var(--ink); }
.tag.test { background: #fff4c2; }

/* Quotas page: one form per phase */
form.phase { align-items: flex-end; padding: 10px 0; border-bottom: 1px dashed rgba(10, 10, 10, 0.18); }
form.phase label { min-width: 110px; }
form.phase.is-current { background: #fff4c2; border-radius: 14px; padding: 10px 12px; }
form.phase label:first-child { flex: 2; min-width: 180px; }
