:root {
  --bg-top: #0c4fcf;
  --bg-bottom: #021c72;
  --panel-bg: rgba(255, 255, 255, 0.16);
  --panel-border: rgba(255, 255, 255, 0.28);
  --text-main: #f7fbff;
  --text-soft: rgba(247, 251, 255, 0.78);
  --input-bg: rgba(255, 255, 255, 0.94);
  --input-text: #14305f;
  --button-text: #0d3a98;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.10) 0 34px, transparent 35px),
    radial-gradient(circle at 82% 22%, rgba(255,255,255,0.07) 0 52px, transparent 53px),
    radial-gradient(circle at 24% 78%, rgba(255,255,255,0.06) 0 46px, transparent 47px),
    radial-gradient(circle at 74% 76%, rgba(255,255,255,0.08) 0 28px, transparent 29px),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.access-panel {
  width: min(100%, 360px);
  padding: 22px 20px 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: rgba(49, 86, 185, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.mail-circle {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4f8cff, #2563eb);
  display: grid;
  place-items: center;
  font-size: 28px;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.45);
}

h1,
h2 {
  margin-top: 0;
}

h1 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 800;
}

.subtitle {
  margin: 0 0 14px;
  text-align: center;
  color: rgba(247, 251, 255, 0.84);
  font-size: 12px;
  line-height: 1.35;
}

.rules-card {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.rule {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 13px;
  color: #ffffff;
}

.rule-icon {
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1;
  margin-top: 2px;
}

.rule h3 {
  margin: 0 0 3px;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 800;
}

.rule p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 700;
}

.warning {
  background: rgba(255, 193, 7, 0.10);
  border-left: 5px solid #FFC107;
}

.info {
  background: rgba(33, 150, 243, 0.14);
  border-left: 5px solid #2196F3;
}

.danger {
  background: rgba(244, 67, 54, 0.14);
  border-left: 5px solid #F44336;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.intro {
  margin: 14px 0 28px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.access-form {
  display: grid;
  gap: 12px;
}

.access-form label,
.admin-dialog label {
  font-weight: 800;
  font-size: 13px;
}

.access-form input,
.admin-dialog input {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  color: var(--input-text);
  background: var(--input-bg);
  outline: 2px solid transparent;
}

.access-form input:focus,
.admin-dialog input:focus {
  outline-color: rgba(140, 200, 255, 0.8);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 16px 20px;
  font-weight: 800;
  color: var(--button-text);
  background: linear-gradient(180deg, #ffffff, #d7e7ff);
  cursor: pointer;
}

#submit-button {
  margin-top: 2px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  box-shadow: 0 12px 30px rgba(37,99,235,.30);
}

#submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(37,99,235,.45);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.is-secondary {
  color: var(--text-main);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.status-message {
  min-height: 24px;
  margin: 4px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: center;
}

.status-message.is-error {
  color: #ffd7d7;
}

.status-message.is-success {
  color: #d8ffe2;
}

.admin-hold {
  position: fixed;
  z-index: 10;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  user-select: none;
  touch-action: none;
  opacity: 0.72;
}

.admin-dialog {
  width: min(92vw, 430px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 26px;
  color: var(--text-main);
  background: linear-gradient(160deg, #0c4fcf, #021c72);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.admin-dialog::backdrop {
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(4px);
}

.admin-dialog form {
  display: grid;
  gap: 14px;
}

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

.menu-title {
  margin-bottom: 24px;
}

.admin-email-form {
  margin-bottom: 20px;
}

.menu-grid {
  display: grid;
  gap: 14px;
}

.menu-card {
  display: block;
  width: 100%;
  margin: 0;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  text-align: left;
}

.menu-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.18);
}

.menu-card-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.loading-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 30px 0;
  text-align: center;
}

.loading-box[hidden],
#mensaje-contenedor[hidden] {
  display: none;
}

.spinner {
  width: 58px;
  height: 58px;
  border: 6px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: girar 0.85s linear infinite;
}

#mensaje-contenedor {
  margin: 24px 0;
}

#mensaje-asunto {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.message-content a {
  color: #ffffff;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

@media (max-width: 540px) {
  .app-shell {
    padding: 18px;
  }

  .access-panel {
    width: min(100%, 360px);
    padding: 22px 20px 24px;
  }

  .button-row,
  .actions-row {
    grid-template-columns: 1fr;
  }
}



/* Página de mensaje: el panel se abre más para que el correo HTML no quede apretado */
.message-panel {
  width: min(100%, 760px);
  max-width: 760px;
}

/* El contenedor del HTML no mete scroll interno */
.message-content.has-html {
  margin: 14px 0 28px;
  padding: 0;
  color: initial;
  white-space: normal;
  overflow: visible;
  width: 100%;
}

/* El iframe crece con JS al alto real del correo */
.email-frame {
  display: block;
  width: 100%;
  height: auto;
  min-height: 180px;
  border: 0;
  border-radius: 18px;
  background: #ffffff;
  overflow: hidden;
}

/* En celular usa todo el ancho disponible */
@media (max-width: 540px) {
  .message-panel {
    width: min(100%, 390px);
    max-width: 390px;
    padding: 18px 14px 20px;
  }

  .message-content.has-html {
    margin-left: -4px;
    margin-right: -4px;
    width: calc(100% + 8px);
  }
}
