:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --ink: #102547;
  --muted: #64748b;
  --line: #dbe3ec;
  --brand: #5bc43f;
  --brand-dark: #4a9e3a;
  --accent: #ef3344;
  --accent-dark: #c1121f;
  --warm: #f97316;
  --gold: #ffd700;
  --ok: #5bc43f;
  --warn: #f97316;
  --shadow-pop: 0 10px 24px rgba(16, 37, 71, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, #5bc43f 0 248px, #f7f8fb 248px 100%);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 40px);
  background: #5bc43f;
  border-bottom: 1px solid rgba(74, 158, 58, 0.9);
  position: sticky;
  top: 0;
  z-index: 4;
}

body.operational-shell .topbar,
body.admin-shell .topbar {
  display: none;
}

body.operational-shell .app-shell,
body.admin-shell .app-shell {
  padding-top: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header-session-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(71, 85, 105, 0.3);
  border-radius: 999px;
  background: #64748b;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  flex: 0 0 auto;
}

.topbar-back {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.brand-logo {
  width: 58px;
  height: 58px;
  padding: 6px;
  border-radius: 999px;
  background: #f4f8f1;
  object-fit: contain;
  flex: 0 0 auto;
  box-shadow: 0 4px 10px rgba(16, 37, 71, 0.16);
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.05;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 800;
}

.subhead {
  margin-top: 22px;
  font-size: 17px;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px clamp(12px, 4vw, 36px) 40px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.tab,
.primary,
.secondary,
.ghost-back,
.switch-chip {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  font-family: inherit;
}

.tab {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tab.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--shadow-pop);
}

.panel {
  display: none;
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 26px;
  padding: clamp(18px, 4vw, 30px);
  box-shadow: 0 22px 54px rgba(16, 37, 71, 0.12);
}

.panel.active {
  display: block;
}

.home-panel {
  overflow: hidden;
  position: relative;
}

.home-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(140deg, rgba(91, 196, 63, 0.08), transparent 38%),
    linear-gradient(320deg, rgba(239, 51, 68, 0.08), transparent 32%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.hero-infographic {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 18px;
  align-content: center;
  min-height: 420px;
}

.hero-title {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.96;
  text-transform: uppercase;
  color: var(--ink);
}

.hero-title::after {
  content: " 7 de junio";
  display: inline-block;
  margin-left: 12px;
  padding: 4px 10px 6px;
  background: var(--brand);
  color: #ffffff;
}

.hero-text {
  max-width: 620px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-button {
  min-width: 240px;
}

.hero-infographic {
  display: grid;
  gap: 14px;
  align-content: center;
}

.info-card {
  border: 1px solid rgba(91, 196, 63, 0.18);
  border-radius: 22px;
  background: #ffffff;
  padding: 20px;
}

.info-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.info-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.info-step {
  display: inline-flex;
  min-width: 56px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(91, 196, 63, 0.14);
  color: var(--brand-dark);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.section-head {
  margin-bottom: 20px;
}

.section-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.guest-panel {
  max-width: 760px;
  margin-inline: auto;
}

.ghost-back {
  margin-bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid rgba(91, 196, 63, 0.42);
  box-shadow: 0 10px 24px rgba(16, 37, 71, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, color 160ms ease, border-color 160ms ease;
}

.ghost-back:hover {
  color: var(--brand);
  border-color: rgba(91, 196, 63, 0.4);
  box-shadow: 0 14px 30px rgba(16, 37, 71, 0.12);
  transform: translateY(-1px);
}

.ghost-back-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(91, 196, 63, 0.14);
  color: var(--brand-strong);
  font-size: 16px;
  line-height: 1;
}

.login-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border-radius: 16px;
  background: #eef3e8;
  border: 1px solid rgba(91, 196, 63, 0.16);
}

.login-role-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-bottom: 18px;
  padding: 10px 18px;
  border-radius: 14px;
  background: #eef3e8;
  border: 1px solid rgba(91, 196, 63, 0.16);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.switch-chip {
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.switch-chip.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(91, 196, 63, 0.24);
}

.login-mode-panel {
  display: none;
}

.login-mode-panel.active {
  display: grid;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
}

#volunteerForm select {
  min-height: 52px;
  position: relative;
  z-index: 1;
  cursor: pointer;
  pointer-events: auto;
  appearance: auto;
  -webkit-appearance: menulist;
  touch-action: manipulation;
}

input::placeholder,
textarea::placeholder {
  color: #8f98a7;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(91, 196, 63, 0.35);
  outline-offset: 1px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.wide,
.checkbox-row {
  grid-column: 1 / -1;
}

.split-field {
  grid-column: span 1;
  width: 100%;
  min-width: 0;
  justify-self: stretch;
}

#volunteerForm .split-field input {
  min-height: 52px;
  height: 52px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.primary,
.secondary {
  min-height: 50px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.primary {
  grid-column: 1 / -1;
  background: var(--brand);
  color: #ffffff;
  box-shadow: var(--shadow-pop);
}

.primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(74, 158, 58, 0.24);
}

.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.secondary.alt {
  background: var(--accent);
  color: #ffffff;
  border-color: rgba(239, 51, 68, 0.3);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.82;
}

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.primary.loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 12px 0;
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.auth-card,
.item,
.metric,
.results-table-wrap {
  border: 1px solid rgba(16, 37, 71, 0.08);
  background: #ffffff;
}

.auth-card {
  margin-top: 18px;
  border-radius: 18px;
  padding: 16px;
  color: var(--muted);
}

.auth-card strong {
  color: var(--ink);
}

.session-table-picker {
  margin-top: 10px;
}

.operational-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 18px;
  background: #ffffff;
}

.operational-bar .session-table-picker {
  margin-top: 0;
}

.operational-bar .session-table-picker span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.operational-bar-actions {
  display: flex;
  justify-content: flex-end;
}

.operational-bar-actions .secondary {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .operational-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .operational-bar-actions {
    justify-content: stretch;
  }

  .operational-bar-actions .secondary {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.admin-only.hidden {
  display: none;
}

.evidence-thumb {
  display: block;
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 10px;
}

.item {
  border-radius: 18px;
  padding: 14px;
}

.item strong {
  display: block;
  margin-bottom: 6px;
}

.item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.assignment-registered-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-left: 6px solid transparent;
}

.assignment-registered-card.is-personero {
  background: linear-gradient(180deg, rgba(91, 196, 63, 0.08), #ffffff);
  border-left-color: #5bc43f;
}

.assignment-registered-card.is-coordinator {
  background: linear-gradient(180deg, rgba(19, 46, 102, 0.08), #ffffff);
  border-left-color: #132e66;
}

.assignment-registered-main {
  min-width: 0;
}

.assignment-delete-button {
  white-space: nowrap;
}

.muted-button {
  background: rgba(239, 68, 68, 0.14);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.countboard {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #f9fbfd);
  box-shadow: 0 14px 30px rgba(16, 37, 71, 0.08);
}

.countboard-head {
  margin-bottom: 14px;
}

.countboard-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.countboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.count-card {
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 20px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.count-total-card {
  background: linear-gradient(180deg, rgba(16, 37, 71, 0.05), #ffffff);
}

.count-candidate-a {
  background: linear-gradient(180deg, rgba(239, 51, 68, 0.08), #ffffff);
}

.count-candidate-b {
  background: linear-gradient(180deg, rgba(91, 196, 63, 0.12), #ffffff);
}

.count-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.count-card-value {
  font-size: 34px;
  line-height: 1;
  text-align: center;
}

.count-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.count-step {
  min-height: 42px;
  border: 1px solid rgba(16, 37, 71, 0.1);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.countboard-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.count-summary-chip {
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 18px;
  background: #ffffff;
  padding: 12px 14px;
}

.count-summary-chip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.count-summary-chip strong {
  font-size: 24px;
}

.countboard-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-count-card {
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 20px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.result-count-input {
  min-height: 58px;
  border-radius: 16px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  padding: 8px 10px;
}

.result-total-card {
  background: linear-gradient(180deg, rgba(16, 37, 71, 0.04), #ffffff);
}

.operativo-shortcuts {
  display: none;
}

.shortcut-card {
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 999px;
  background: #ffffff;
  min-height: 44px;
  padding: 0 16px;
  text-align: center;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16, 37, 71, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcut-card span {
  display: none;
}

.shortcut-card strong {
  font-size: 14px;
  line-height: 1.15;
}

.tabs {
  align-items: stretch;
}

@media (max-width: 760px) {
  .tabs {
    gap: 8px;
    margin-bottom: 12px;
  }

  .tab,
  .shortcut-card {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
  }

  .tab {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .operativo-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .shortcut-card:last-child {
    grid-column: auto;
  }

  .shortcut-card strong {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .shortcut-card span {
    display: none;
  }
}

@media (max-width: 760px) {
  .shortcut-card,
  .tab {
    box-shadow: 0 8px 18px rgba(16, 37, 71, 0.06);
  }
}

.metric {
  border-radius: 18px;
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.metric strong {
  font-size: 30px;
}

#admin .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.desktop-analytics {
  display: block;
  margin-bottom: 20px;
}

.desktop-analytics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-metric strong {
  font-size: 26px;
}

.desktop-analytics-layout {
  grid-template-columns: 1.2fr 1fr;
}

.desktop-analytics-card {
  min-height: 100%;
}

.analytics-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.analytics-province-list {
  display: grid;
  gap: 12px;
}

.analytics-province-row {
  display: grid;
  gap: 8px;
}

.analytics-province-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.analytics-province-head strong {
  font-size: 13px;
}

.analytics-province-head span {
  color: var(--muted);
  font-size: 12px;
}

.analytics-bars {
  display: grid;
  gap: 8px;
}

.analytics-bar-track {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
}

.analytics-bar-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analytics-bar-fill-wrap {
  height: 12px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.analytics-bar-fill.is-jp {
  background: linear-gradient(90deg, #5bc43f, #7ad95a);
}

.analytics-bar-fill.is-k {
  background: linear-gradient(90deg, #ef3344, #ff6775);
}

.analytics-bar-value {
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.admin-view-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.admin-view-chip {
  min-height: 44px;
  border: 1px solid rgba(16, 37, 71, 0.1);
  border-radius: 14px;
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 0 14px;
  transition: 160ms ease;
}

.admin-view-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: rgba(239, 51, 68, 0.22);
  box-shadow: var(--shadow-pop);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#admin .dashboard-grid {
  grid-template-columns: 1fr;
}

.dashboard-card {
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 20px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(16, 37, 71, 0.08);
}

.dashboard-card-wide {
  grid-column: 1 / -1;
}

.dashboard-card.is-admin-view-hidden {
  display: none;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dashboard-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.admin-search-field,
.admin-filter-grid label {
  margin-bottom: 12px;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.admin-assignment-meta {
  display: grid;
  gap: 4px;
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 16px;
  background: #f8fafc;
}

.admin-assignment-meta strong {
  font-size: 15px;
}

.admin-assignment-meta span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.verification-actions {
  display: grid;
  grid-template-columns: max-content minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
}

.verification-code-field {
  margin-bottom: 0;
  min-width: 0;
}

.verification-actions > * {
  min-width: 0;
}

.qr-card {
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(16, 37, 71, 0.08);
  border-radius: 18px;
  background: #ffffff;
}

.qr-card img {
  width: min(260px, 100%);
  height: auto;
  display: block;
}

.whatsapp-gateway-card {
  margin-bottom: 14px;
}

.gateway-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.gateway-status-row .whatsapp-gateway-card {
  margin-bottom: 0;
}

.gateway-disconnect-button {
  align-self: stretch;
  min-height: 100%;
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
}

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

.compact-table th,
.compact-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}

.compact-table th {
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.is-ok {
  background: rgba(91, 196, 63, 0.12);
  color: var(--brand-dark);
}

.status-badge.is-pending {
  background: rgba(16, 37, 71, 0.08);
  color: var(--ink);
}

.status-badge.is-alert {
  background: rgba(239, 51, 68, 0.12);
  color: var(--accent-dark);
}

.wa-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(91, 196, 63, 0.14);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid rgba(91, 196, 63, 0.22);
}

.wa-link-button:hover {
  background: rgba(91, 196, 63, 0.2);
}

.table-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(19, 46, 102, 0.14);
  background: rgba(19, 46, 102, 0.08);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.table-action-button:hover {
  background: rgba(19, 46, 102, 0.14);
}

.table-action-button.is-danger {
  border-color: rgba(239, 51, 68, 0.22);
  background: rgba(239, 51, 68, 0.12);
  color: var(--accent-dark);
}

.table-action-button.is-danger:hover {
  background: rgba(239, 51, 68, 0.18);
}

.assignment-name-cell {
  display: grid;
  gap: 6px;
}

.assignment-name-cell strong {
  color: var(--ink);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-badge.is-personero {
  background: rgba(91, 196, 63, 0.12);
  color: var(--brand-dark);
}

.role-badge.is-coordinator {
  background: rgba(19, 46, 102, 0.12);
  color: #132e66;
}

.results-table-wrap {
  overflow-x: auto;
  border-radius: 18px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

th {
  background: #f8fafc;
  font-size: 12px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.validation {
  margin-top: 14px;
  font-weight: 700;
}

.validation.ok {
  color: var(--ok);
}

.validation.warn {
  color: var(--warn);
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 40px));
  background: #102547;
  color: #fff;
  padding: 22px 24px 18px;
  border-radius: 20px;
  border: 1px solid rgba(91, 196, 63, 0.22);
  opacity: 0;
  transition: 180ms ease;
  width: min(92vw, 560px);
  line-height: 1.55;
  white-space: normal;
  z-index: 20;
  box-shadow: 0 24px 60px rgba(16, 37, 71, 0.34);
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.toast-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

#toastContent {
  padding-right: 18px;
  font-size: 18px;
}

@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
  }

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

  #admin .metric-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-analytics-grid,
  .desktop-analytics-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .header-session-button {
    min-height: 38px;
    padding: 0 14px;
    font-size: 13px;
  }

  .brand-logo {
    width: 50px;
    height: 50px;
    padding: 5px;
  }

  .grid-form,
  .hero-actions,
  .dashboard-grid,
  .admin-view-switch {
    grid-template-columns: 1fr;
  }

  .desktop-analytics {
    display: none;
  }

  #volunteerForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #volunteerForm .split-field {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  #volunteerForm .split-field input {
    min-height: 50px;
    height: 50px;
  }

  #volunteerForm .wide,
  #volunteerForm .checkbox-row,
  #volunteerForm .primary {
    grid-column: 1 / -1;
  }

  .verification-actions {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 8px;
  }

  .verification-actions .secondary {
    width: 100%;
    padding-inline: 12px;
    font-size: 12px;
  }

  .assignment-registered-card {
    grid-template-columns: 1fr;
  }

  .assignment-delete-button {
    width: 100%;
  }

  .gateway-status-row {
    grid-template-columns: 1fr;
  }

  .gateway-disconnect-button {
    width: 100%;
    min-height: 48px;
  }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .tab {
    padding: 0 10px;
    white-space: normal;
    width: auto;
    flex: 0 0 auto;
    font-size: 11px;
  }

  .operativo-shortcuts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .countboard {
    padding: 14px;
    margin-bottom: 14px;
  }

  .countboard-top,
  .countboard-summary,
  .countboard-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .countboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .count-card {
    padding: 12px;
    border-radius: 18px;
  }

  .count-card-value {
    font-size: 28px;
  }

  body.operational-shell .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, 58px);
    gap: 8px;
    align-items: stretch;
  }

  body.operational-shell .tab[data-role="operativo"] {
    width: 100%;
    min-height: 58px;
    padding: 8px 6px;
    border-radius: 16px;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  body.operational-shell .tab[data-tab="operativo-logout"] {
    grid-column: 3;
    grid-row: 2;
    background: #64748b;
    color: #ffffff;
    border-color: rgba(71, 85, 105, 0.28);
    box-shadow: var(--shadow-pop);
  }

  body.operational-shell .tab[data-tab="checkin"] {
    grid-column: 1;
    grid-row: 1;
  }

  body.operational-shell .tab[data-tab="incidentes"] {
    grid-column: 2;
    grid-row: 1;
  }

  body.operational-shell .tab[data-tab="resultados"] {
    grid-column: 1 / span 2;
    grid-row: 2;
  }

  body.operational-shell .tab[data-tab="tablero"] {
    grid-column: 3;
    grid-row: 1;
  }

  body.operational-shell .tab[data-tab="operativo-logout"] {
    grid-column: 3;
    grid-row: 2;
  }

  body.admin-shell .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 58px;
    gap: 8px;
    align-items: stretch;
  }

  body.admin-shell .tab[data-role="admin"] {
    width: 100%;
    min-height: 58px;
    padding: 8px 6px;
    border-radius: 16px;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  body.admin-shell .tab[data-tab="admin-logout"] {
    background: #64748b;
    color: #ffffff;
    border-color: rgba(71, 85, 105, 0.28);
    box-shadow: var(--shadow-pop);
  }

  .shortcut-card:last-child {
    grid-column: auto;
  }

  #resultForm {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .result-count-card {
    padding: 12px;
    border-radius: 18px;
  }

  .result-count-input {
    min-height: 50px;
    font-size: 24px;
    padding: 6px 8px;
  }

  #resultForm label {
    font-size: 12px;
  }

  #resultForm input,
  #resultForm textarea {
    padding: 11px 12px;
  }

  .metric-grid,
  #admin .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  #admin .metric {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  #admin .metric span {
    margin-bottom: 4px;
    font-size: 9px;
    letter-spacing: 0.05em;
  }

  #admin .metric strong {
    font-size: 16px;
    line-height: 1;
  }

  .hero-button {
    width: 100%;
    min-width: 0;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 42px;
  }

  .login-switch {
    width: 100%;
  }

  #admin {
    padding-inline: 16px;
  }

  #admin .section-head {
    margin-bottom: 16px;
  }

  #admin .auth-card {
    margin-top: 0;
    margin-bottom: 16px;
  }

  .admin-view-switch {
    gap: 8px;
  }

  .admin-view-chip {
    min-height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }

  .dashboard-card {
    padding: 14px;
    border-radius: 18px;
  }

  .dashboard-head {
    margin-bottom: 10px;
  }

  .dashboard-head h3 {
    font-size: 16px;
    line-height: 1.2;
  }

  .table-scroll {
    overflow: visible;
  }

  .compact-table {
    min-width: 0;
  }

  .compact-table thead {
    display: none;
  }

  .compact-table tbody,
  .compact-table tr,
  .compact-table td {
    display: block;
    width: 100%;
  }

  .compact-table tr {
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid rgba(16, 37, 71, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f9fbfd);
    box-shadow: 0 10px 24px rgba(16, 37, 71, 0.06);
  }

  .compact-table tr:last-child {
    margin-bottom: 0;
  }

  .compact-table td {
    display: grid;
    grid-template-columns: minmax(88px, 104px) 1fr;
    gap: 10px;
    align-items: start;
    padding: 0;
    border-bottom: 0;
  }

  .compact-table td + td {
    margin-top: 9px;
  }

  .compact-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .compact-table .table-empty-row {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    margin: 0;
  }

  .compact-table .table-empty-row td {
    display: block;
    margin: 0;
    padding: 14px;
    border: 1px dashed rgba(16, 37, 71, 0.12);
    border-radius: 16px;
    background: #fbfcfe;
    color: var(--muted);
  }

  .compact-table .table-empty-row td::before {
    content: none;
  }
}
