/* Votación de Poetas — paleta pastel, letra grande para lectura cómoda */
:root {
  /* Marca DiEditores en versión pastel. El rojo sólido queda solo para las acciones */
  --brand: #E62B1E;
  --brand-hover: #C9241A;
  --rose-50: #FFF5F4;
  --rose-100: #FDE7E5;
  --rose-200: #F8CFCB;
  --rose-text: #9E1F15;
  --ink: #1F1F1F;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --text: #1F1F1F;
  --muted: #6B6563;
  --line: #EFE3E1;
  --pill: #F3EEEC;
  --primary: var(--brand);
  --primary-hover: var(--brand-hover);
  --danger: var(--rose-100);
  --danger-hover: var(--rose-200);
  --ok: #E4F5EA;
  --ok-text: #1E6B38;
  --warn: #FFF6DB;
  --warn-text: #6B4E00;
  --test: #FFF6DB;
  --tie: #FFF9E8;
  --header: var(--rose-50);
  --radius: 16px;
}

* { box-sizing: border-box; }

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

h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 .75rem; }
a { color: var(--brand); }
code { background: var(--header); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.lead { font-size: 1.05rem; }
.center { text-align: center; }
.num { text-align: right; }

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }

/* Cabecera */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-block: .75rem; }
.site-header__brand { display: inline-flex; align-items: center; gap: .75rem; font-weight: 800; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.site-header__brand img { height: 28px; width: auto; display: block; }
.site-header__title { padding-left: .75rem; border-left: 2px solid var(--line); }
.site-header__user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.site-header__user form { margin: 0; }

.admin-nav { display: flex; gap: .25rem; flex-wrap: wrap; background: var(--pill); border-radius: 999px; padding: .3rem; }
.admin-nav__link { padding: .4rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .95rem; font-weight: 700; }
.admin-nav__link:hover { background: var(--rose-50); }
.admin-nav__link.is-active { background: var(--rose-100); color: var(--rose-text); }

.phase-banner { text-align: center; padding: .6rem 1rem; font-weight: 600; }
.phase-banner--test { background: var(--test); color: var(--warn-text); }
.phase-banner--closed { background: var(--ink); color: #fff; }

/* Tarjetas y alertas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card--narrow { max-width: 480px; margin-inline: auto; margin-top: 2rem; }
.card__links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.card__links form { margin: 0; }

.alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert--ok { background: var(--ok); color: var(--ok-text); }
.alert--error { background: var(--rose-100); color: var(--rose-text); }
.alert--warn { background: var(--warn); color: var(--warn-text); }

/* Formularios */
.form { display: grid; gap: 1rem; }
.form--row { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.field { display: grid; gap: .35rem; }
.field__label { font-weight: 600; font-size: .95rem; }
.input { width: 100%; font: inherit; font-size: 1rem; padding: .6rem .9rem; border: 1px solid #E5D9D6; border-radius: 12px; background: #fff; color: var(--text); }
.input:focus { outline: 3px solid var(--rose-100); border-color: var(--brand); }
.input:disabled { background: #f0f1f5; color: var(--muted); }
.input--lg { font-size: 1.2rem; padding: .8rem 1rem; }
.input--code { text-align: center; letter-spacing: .4em; font-size: 1.6rem; }
textarea.input { resize: vertical; }
.check { display: flex; gap: .5rem; align-items: center; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: 1rem; padding: .65rem 1.3rem; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; color: var(--ink); background: var(--pill); font-weight: 700; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn--primary:disabled { opacity: 1; background: var(--rose-100); color: var(--rose-text); border-color: var(--rose-200); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn--primary:not(:disabled) { box-shadow: 0 2px 0 rgba(158, 31, 21, .18); }
.btn--danger { background: var(--ink); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #333; }
.btn--ghost { background: #fff; border-color: var(--rose-200); color: var(--rose-text); }
.btn--link { background: none; padding: .25rem 0; color: var(--brand); font-weight: 500; text-decoration: underline; }
.btn--sm { font-size: .875rem; padding: .35rem .7rem; }
.btn--lg { font-size: 1.15rem; padding: .85rem 1.4rem; }
.btn--block { width: 100%; }
.btn-icon { font: inherit; width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 1px solid #E5D9D6; background: #fff; cursor: pointer; color: var(--text); }
.btn-icon:hover { background: var(--rose-100); border-color: var(--rose-200); }
.btn-icon--remove:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.actions form { margin: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { background: var(--rose-100); color: var(--rose-text); text-align: left; padding: .6rem .75rem; font-weight: 600; white-space: nowrap; }
.table td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table--form td { padding: .4rem; }
.table__actions { display: flex; gap: .4rem; }
.table__actions form { margin: 0; }
.table--results tr.is-tied td { background: var(--tie); }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; margin-left: .35rem; }
.badge--tie { background: var(--warn); color: var(--warn-text); }
.points { display: inline-block; min-width: 2.4rem; text-align: center; background: var(--rose-100); color: var(--rose-text); border-radius: 999px; padding: 2px 6px; font-weight: 700; }
.tick--yes { color: #1E8A45; font-weight: 800; }
.tick--no { color: #b3b9c8; }

.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; }
.tabs__link { padding: .5rem 1.2rem; border-radius: 999px; font-weight: 700; text-decoration: none; color: var(--text); background: var(--pill); }
.tabs__link.is-active { background: var(--rose-100); color: var(--rose-text); font-weight: 700; }

/* Panel */
.grid { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; display: grid; gap: .25rem; }
.stat__label { color: var(--muted); font-size: .9rem; }
.stat__value { font-size: 1.6rem; font-weight: 800; }
.stat { border-top: 4px solid var(--rose-200); }
.guide dt { font-weight: 700; margin-top: .75rem; }
.guide dd { margin: .2rem 0 0; color: var(--muted); }

/* Boleta */
.steps { padding-left: 1.3rem; margin: 0 0 .5rem; }
.steps li { margin-bottom: .4rem; }
.ballot__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ballot__column-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.ballot__column-head h2 { margin: 0; }
.ballot__column-head .input { max-width: 220px; }
.ballot__column--picks { position: sticky; top: 1rem; }
.ballot__submit { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .5rem; }
.ballot__submit p { margin: 0 0 .5rem; }
.counter { background: var(--rose-100); color: var(--rose-text); border-radius: 999px; padding: 2px 12px; font-size: 1rem; margin-left: .35rem; }
.counter.is-complete { background: var(--ok); color: var(--ok-text); }
.empty { color: var(--rose-text); background: var(--rose-50); text-align: center; padding: 1.5rem; border: 2px dashed var(--rose-200); border-radius: 8px; }

.poet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.poet-list--pool { max-height: 70vh; overflow-y: auto; padding-right: .25rem; }
.poet-list--picks { max-height: 60vh; overflow-y: auto; padding-right: .25rem; }
.poet { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.poet[hidden] { display: none; }
.poet-list--picks .poet { background: var(--rose-50); border-color: var(--rose-200); border-left: 4px solid var(--brand); }
.poet__position { font-weight: 800; color: var(--brand); min-width: 1.8rem; }
.poet__number { color: var(--muted); font-size: .85rem; min-width: 2.2rem; }
.poet__name { flex: 1; display: grid; }
.poet__points { background: var(--rose-100); color: var(--rose-text); border-radius: 999px; padding: 2px 8px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.poet__actions { display: flex; gap: .3rem; }

/* Mostrar solo los controles que corresponden a cada lista */
.poet-list--pool .pick-only { display: none; }
.poet-list--picks .pool-only { display: none; }

/* Diálogo de confirmación */
.dialog { border: none; border-radius: var(--radius); padding: 1.5rem; max-width: 520px; width: calc(100% - 2rem); color: var(--text); }
.dialog::backdrop { background: rgba(31, 42, 68, .45); }
.dialog form { display: grid; gap: .75rem; }
.summary { list-style: none; margin: 0; padding: 0; max-height: 45vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.summary li { padding: .4rem .75rem; border-bottom: 1px solid var(--line); }
.summary li:last-child { border-bottom: none; }
.summary strong { display: inline-block; min-width: 4rem; color: var(--brand); }
.dialog__actions { display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }

/* Teléfono */
@media (max-width: 800px) {
  body { font-size: 17px; }
  .container { padding: .9rem; }
  .ballot__grid { grid-template-columns: 1fr; }
  .ballot__column--picks { position: static; }
  .poet-list--pool, .poet-list--picks { max-height: none; overflow: visible; }
  .ballot__submit { position: sticky; bottom: 0; background: var(--card); padding-bottom: .75rem; margin-inline: -1.5rem; padding-inline: 1.5rem; box-shadow: 0 -4px 12px rgba(31, 42, 68, .08); }
  .poet { flex-wrap: wrap; }
  .poet__actions { margin-left: auto; }
}

/* El botón Agregar siempre en rojo sólido para que resalte */
.poet-list--pool [data-action="add"] { background: var(--brand); color: #fff; min-width: 6rem; }
.poet-list--pool [data-action="add"]:hover:not(:disabled) { background: var(--brand-hover); }
.poet-list--pool.is-full [data-action="add"] { background: var(--rose-100); color: var(--rose-text); opacity: 1; }
.poet-list--pool .poet:hover { border-color: var(--rose-200); background: var(--rose-50); }

/* ---- Edición ---- */
.edition { display: inline-block; margin-left: .5rem; padding: .1rem .6rem; border-radius: 999px; background: var(--rose-100); color: var(--rose-text); font-size: .75rem; font-weight: 800; vertical-align: middle; }
.edition--block { margin: 0 0 .75rem; }

/* ---- Persona que inició sesión ---- */
.user-chip { display: flex; align-items: center; gap: .6rem; }
.user-chip__text { display: grid; line-height: 1.15; }
.user-chip__text small { font-size: .75rem; }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 999px; background: var(--rose-100); color: var(--rose-text); display: inline-grid; place-items: center; font-weight: 800; font-size: .95rem; border: 2px solid var(--rose-200); flex-shrink: 0; }
.avatar--lg { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
.welcome { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.welcome h1 { margin: 0; }
.welcome p { margin: 0; }

/* ---- Poeta: "Poeta 7 · Nombre" y país ---- */
.poet-label { flex: 1; min-width: 0; display: grid; }
.poet-label__main strong { color: var(--ink); }
.poet-label__sep { color: var(--muted); }
.poet-label__country { color: var(--muted); font-size: .85rem; }

/* ---- Selección fija: puntos a la izquierda, sin flechas ---- */
.pts-badge { display: inline-grid; place-items: center; min-width: 4.2rem; height: 2.2rem; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800; font-size: .95rem; flex-shrink: 0; }
.poet-list--picks .poet { gap: .75rem; }
.btn-remove { width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 1px solid var(--rose-200); background: #fff; color: var(--rose-text); font-size: 1rem; cursor: pointer; flex-shrink: 0; }
.btn-remove:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- SweetAlert con la marca ---- */
.swal2-popup { border-radius: 20px !important; font-family: inherit !important; padding: 1.5rem !important; }
.swal2-title { color: var(--ink) !important; font-weight: 800 !important; font-size: 1.4rem !important; }
.swal2-html-container { color: var(--muted) !important; font-size: 1rem !important; }
.swal2-styled { border-radius: 999px !important; font-weight: 700 !important; padding: .7rem 1.4rem !important; }
.swal2-styled.swal2-confirm { background: var(--brand) !important; }
.swal2-styled.swal2-cancel { background: #fff !important; color: var(--rose-text) !important; border: 1px solid var(--rose-200) !important; }
.swal2-icon.swal2-warning { border-color: var(--rose-200) !important; color: var(--brand) !important; }
.swal2-icon.swal2-success { border-color: #BFE6CC !important; color: #1E8A45 !important; }
.swal2-icon.swal2-success [class^='swal2-success-line'] { background-color: #1E8A45 !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: #BFE6CC !important; }
.swal2-loader { border-color: var(--brand) transparent var(--brand) transparent !important; }
.swal-poet { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .25rem 0 1rem; color: var(--ink); text-align: left; }
.swal-poet .poet-label { flex: 0 1 auto; }
.points-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45rem; }
.points-grid button { height: 2.8rem; border-radius: 12px; border: 1px solid var(--rose-200); background: var(--rose-50); color: var(--rose-text); font-weight: 800; font-size: 1.05rem; cursor: pointer; font-family: inherit; }
.points-grid button:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.points-grid button:focus { outline: none; }
.points-grid button:focus-visible { outline: 3px solid var(--rose-200); }
.points-grid button:disabled { background: #F4F1F0; color: #C9C0BD; border-color: #EEE7E5; text-decoration: line-through; cursor: not-allowed; }
.points-hint { font-size: .85rem; margin-top: .75rem; color: var(--muted); }
.swal-summary { list-style: none; margin: .75rem 0 0; padding: 0; text-align: left; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.swal-summary li { display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; border-bottom: 1px solid var(--line); color: var(--ink); font-size: .95rem; }
.swal-summary li:last-child { border-bottom: none; }
.swal-summary b { color: var(--brand); min-width: 3.6rem; }

@media (max-width: 800px) {
  .points-grid { grid-template-columns: repeat(5, 1fr); }
  .site-header__title .edition { display: none; }
}
