:root {
  --primary-dark: #6d94c5;
  --primary: #c6e7ff;
  --primary-soft: #d4f6ff;
  --surface-soft: #cbdceb;
  --accent-primary: #189ee7;
  --text-strong: #2f3b27;
  --success-strong: #1f7a3a;
  --black:  #111;
  --white:  #fff;
  --icon-size: 15px;
  --icon-stroke: 1.75;
  --orange: var(--primary);
  --orange-light: var(--primary-soft);
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: var(--black);
  background: var(--surface-soft);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 0;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('/fondo.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.60;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,0.50), rgba(255,255,255,0.55));
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    position: absolute;
  }
}

.header {
  --header-brand-offset: 0px;
  background: linear-gradient(
    115deg,
    var(--surface-soft) 0%,
    color-mix(in srgb, var(--surface-soft) 85%, var(--primary)) 32%,
    color-mix(in srgb, var(--surface-soft) 40%, var(--primary)) 42%,
    color-mix(in srgb, var(--primary) 45%, var(--accent-primary)) 70%,
    var(--accent-primary) 100%
  );
  color: var(--white);
  text-shadow: 0 1px 2px rgba(15, 28, 45, 0.25);
  padding: 12px 16px;
  font-weight: 700;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 3vw, 24px);
  position: sticky;
  top: 0;
  z-index: 1200;
  box-shadow: 0 4px 16px rgba(18, 36, 56, 0.16);
}

.header .header-login {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.header-login__text {
  font-weight: 600;
}

.header .header-login.header-login--admin {
  background: color-mix(in srgb, var(--white) 82%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent-primary) 30%, var(--white));
  color: var(--text-strong);
}

.header .header-login.header-login--admin:hover,
.header .header-login.header-login--admin:focus {
  background: color-mix(in srgb, var(--white) 70%, transparent);
}

.header .header-login.header-login--admin .header-login__text {
  color: inherit;
  font-weight: 700;
}


#brandLogo {
  display: inline-block;
  vertical-align: middle;
  border: none;
  border-radius: 0;
  background: transparent;   /* sin fondo */
  cursor: default;           /* que NO parezca link */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  width: auto;
  height: auto;
  max-width: 80px;
  max-height: 80px;
  justify-self: start;
}

button {
  background: var(--primary);
  border: 2px solid var(--primary-dark);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: filter 0.2s ease, transform 0.15s ease;
  color: var(--text-strong);
}

button:hover,
button:focus {
  background: color-mix(in srgb, var(--primary-soft) 70%, var(--accent-primary) 30%);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  stroke-width: var(--icon-stroke);
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon-muted {
  color: rgba(0,0,0,0.55);
}

/* Reemplaza el bloque .header .brand... por este */
#brand,
#brand:link,
#brand:visited,
#brand:hover,
#brand:active,
#brand:focus {
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;        /* aspecto de texto */
  user-select: none;
  display: inline-block;
  text-align: center;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(var(--header-brand-offset));
  max-width: min(320px, 100%);
  padding-inline: clamp(12px, 4vw, 28px);
  margin-inline: auto;
}

.container {
  width: min(calc(100% - clamp(32px, 6vw, 160px)), 1100px);
  margin-inline: auto;
  margin-block: clamp(16px, 4vw, 64px);
  padding: clamp(16px, 3vw, 40px);
  flex: 1 0 auto;
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 24px);
    margin-block: 16px;
    padding: 16px;
  }
}

.card {
  border: 2px solid color-mix(in srgb, var(--primary-dark) 30%, transparent);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 10px 18px rgba(31, 50, 78, 0.08);
  background: var(--white);
}

.card-alt {
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--white));
  border-color: color-mix(in srgb, var(--primary-dark) 45%, transparent);
}

.card-muted {
  background: color-mix(in srgb, var(--primary) 25%, var(--white));
  border-color: color-mix(in srgb, var(--primary-dark) 25%, transparent);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
}

.password-row {
  position: relative;
}

.password-row input {
  flex: 1 1 auto;
}

.toggle-password {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  background: var(--surface-soft);
  cursor: pointer;
  flex: 0 0 auto;
  gap: 0;
  /* ensure the icon is perfectly centered even if extra (visually-hidden) text exists */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* make the sr-only text position relative to this button so it doesn't affect layout */
  position: relative;
  color: var(--primary-dark);
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.toggle-password svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.toggle-password::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
  opacity: 0.65;
  pointer-events: none;
}

.toggle-password:hover,
.toggle-password:focus {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--primary) 24%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}

.option-label {
  font-weight: 400;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.demographics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 600px) {
  .row.demographics {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

label {
  display: block;
  font-weight: 600;
  margin: 8px 0 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: var(--text-strong);
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--text-strong) 55%, #fff);
}

button.secondary {
  background: var(--primary-soft);
  color: var(--text-strong);
  border: 2px solid var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

button.secondary:hover,
button.secondary:focus {
  background: color-mix(in srgb, var(--primary-soft) 75%, var(--white));
  border-color: color-mix(in srgb, var(--primary) 75%, transparent);
}

button.danger {
  background: #e03131; /* rojo peligro */
  color: #fff;
}

button.danger:hover {
  filter: brightness(0.95);
}

button.danger:active {
  transform: translateY(1px);
}

button.danger:focus {
  outline: 3px solid rgba(224,49,49,0.18);
  outline-offset: 2px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid color-mix(in srgb, var(--primary-dark) 65%, transparent);
  margin-right: 6px;
}

.badge.active  { 
  background: var(--primary-dark);
  color: var(--white);
  border-color: var(--primary-dark);
}

.badge.closed  { 
  background:#fff5f5; 
  color:#e03131; 
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  word-break: break-word;
  white-space: normal;
}

#cities {
  word-break: break-word;
}

.survey-item {
  position: relative;
}

.survey-item__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
  position: relative;
}

.survey-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.survey-item__title strong {
  white-space: normal;
  word-break: break-word;
}

.btn-results-toggle {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--accent-primary) 45%, transparent);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--accent-primary);
  font-weight: 600;
}

.btn-results-toggle:hover {
  background: color-mix(in srgb, var(--accent-primary) 18%, var(--surface-soft));
}

.survey-item__meta {
  margin-top: 4px;
}

.survey-item__controls {
  margin-top: 14px;
  text-align: right;
}

.survey-item__controls .btn-results-toggle {
  padding: 6px 14px;
}

.survey-item__header .menu-btn {
  margin-left: auto;
}

.small {
  font-size: .9rem;
  color: #555;
}

.inline-logo {
  height: 3em;
  vertical-align: -0.85em;
  margin-right: 3px;
  object-fit: contain;
}
.row.wrap {
  flex-wrap: wrap;
}

.chip-wrap {
  display: inline-flex;
  align-items: center;
  margin: 4px 6px 0 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  border-radius: 9999px;
  padding: 6px 10px;
}

.chip-text { line-height: 1; }

/* Botón X pequeño (no naranja) */
.chip-x {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-soft)) !important;
  color: var(--primary-dark);
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  line-height: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 0;
}
.chip-x:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface-soft)) !important; }

/* Fila de fecha: que el input mande y el boton no se desborde */
.date-row { 
  display: grid; 
  grid-template-columns: 1fr auto; 
  gap: 8px; 
  align-items: center; 
}
.date-row .date-input { 
  min-width: 0;        /* permite encoger en pantallas estrechas */
}
.btn-add-date,
.btn-add-city {
  width: auto !important;
  padding: 10px 12px;
  border-radius: 8px;
  white-space: nowrap;
  gap: 6px;
  background: color-mix(in srgb, #d8f0c9 80%, var(--primary));
  border: 1px solid color-mix(in srgb, #7aa061 70%, transparent);
  color: var(--text-strong);
}

.btn-add-date:hover,
.btn-add-date:focus,
.btn-add-city:hover,
.btn-add-city:focus {
  background: color-mix(in srgb, #cde7bf 65%, var(--primary));
  border-color: color-mix(in srgb, #64884a 75%, transparent);
}

.city-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.city-row .city-input {
  min-width: 0;
}

/* Lista de fechas como chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 8px 0 0 0;
  list-style: none;
}

/* Acciones como menu de 3 puntos */
.actions { position: relative; margin-top: 8px; }

.menu-btn {
  background: var(--surface-soft);
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-strong);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.menu-btn::after { content: '⋮'; font-size: 18px; line-height: 1; }
.menu-btn:hover,
.menu-btn:focus {
  background: color-mix(in srgb, var(--primary) 20%, var(--surface-soft));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}
.menu-btn[aria-expanded="true"] {
  background: color-mix(in srgb, var(--primary) 28%, var(--surface-soft));
}

.menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 1000;
}
.menu.open { display: block; }
.menu__item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--text-strong);
}
.menu__item:hover, .menu__item:focus {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface-soft));
  color: var(--text-strong);
  outline: none;
}
.menu__item.danger {
  color: #fff;
  background: #e03131;
}
.menu__item.danger:hover,
.menu__item.danger:focus {
  color: #fff;
  background: #c92a2a;
}
.menu__sep {
  border: 0; border-top: 1px solid color-mix(in srgb, var(--primary) 12%, transparent); margin: 6px 4px;
}

.survey-results {
  display: none;
  margin-top: 8px;
}

.survey-results.open {
  display: block;
}

.survey-results__card {
  margin-top: 8px;
}

.survey-results__summary {
  margin-top: 8px;
}

.survey-results__loading {
  padding: 12px 0;
  font-size: 0.95rem;
  color: #555;
}

.survey-results__loading .loading {
  margin-right: 8px;
}

/* Badges de estado (si no los tienes ya) */
.badge { display:inline-block; padding:4px 8px; border-radius:999px; background:var(--primary-soft); margin-right:6px; color: var(--primary-dark); border:1px solid color-mix(in srgb, var(--primary-dark) 65%, transparent); }
.badge.active  { background:var(--primary-dark); color: var(--white); border:1px solid var(--primary-dark); }
.badge.closed  { background:#fff5f5; color:#e03131; }

/* En pantallas estrechas, que no se descuadre */
@media (max-width: 480px) {
  .menu { min-width: 180px; }
}

.loading {
  display:inline-block; width:16px; height:16px;
  border:2px solid #0002; border-top:2px solid #0008;
  border-radius:50%; animation:spin .8s linear infinite;
  vertical-align:middle; margin-right:8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner.error {
  background:#fff5f5; color:#e03131; border:1px solid #ffe3e3;
  padding:12px; border-radius:8px; margin:12px 0;
}

.banner { padding:12px; border-radius:8px; margin:12px 0; }
.banner.ok { background: color-mix(in srgb, var(--primary) 18%, var(--surface-soft)); color: var(--primary-dark); border:1px solid color-mix(in srgb, var(--primary) 26%, transparent); }

/* TOASTS (flotantes arriba-derecha) */
.toast-root{
  position:fixed; top:16px; right:16px; z-index:9999;
  display:flex; flex-direction:column; gap:8px;
  pointer-events:none; /* no bloquea clics detrás salvo el propio toast */
}

.toast{
  min-width:240px; max-width: min(420px, 90vw);
  background:#fff; color:#111; border:1px solid #eee;
  border-radius:12px; padding:12px 14px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  opacity:0; transform: translateY(-8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events:auto;  /* permite cerrar con click */
  font-size: 0.95rem;
}
.toast.ok{
  background: color-mix(in srgb, var(--primary) 18%, var(--surface-soft));
  border-color: color-mix(in srgb, var(--primary) 25%, transparent);
  color: var(--primary-dark);
}
.toast.error{
  background:#fff5f5; border-color:#ffe3e3; color:#e03131;
}
.toast.show{ opacity:1; transform: translateY(0); }
.toast.hide{ opacity:0; transform: translateY(-8px); }

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

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.45);
  backdrop-filter: blur(2px);
  padding: 16px;
  z-index: 2000;
}

.modal[data-open="true"] {
  display: flex;
}

.modal__dialog {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  position: relative;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__body h3,
.modal__body p {
  margin: 0;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  background: var(--surface-soft);
  padding: 16px 0;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

.site-footer__inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus {
  text-decoration: underline;
}
