:root {
  --primary: #135bec;
  --primary-hover: #0f4fd0;
  --primary-active: #0c40b0;
  --bg: #f6f6f8;
  --text: #0d121b;
  --muted: #4c669a;
  --placeholder: #93adc8;
  --border: #cfd7e7;
  --surface: #ffffff;
  --danger: #dc2626;
  --radius: 0.5rem;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow-btn: 0 4px 14px rgba(19, 91, 236, 0.2);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

.site-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 246, 248, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(207, 215, 231, 0.6);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.7rem;
  background: rgba(19, 91, 236, 0.12);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}

.lang-select {
  position: relative;
  z-index: 30;
}

.lang-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.3rem 0.55rem 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.lang-select-trigger:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 91, 236, 0.15);
}

.lang-select-caret {
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.1rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  translate: 0 -0.1rem;
}

.lang-select.is-open .lang-select-caret {
  transform: rotate(-135deg);
  translate: 0 0.1rem;
}

.lang-select-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 11.5rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px rgba(13, 18, 27, 0.12);
}

.lang-select-menu[hidden] {
  display: none;
}

.lang-select-menu [role="option"] {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.55rem;
  cursor: pointer;
  color: var(--text);
}

.lang-select-menu [role="option"]:hover,
.lang-select-menu [role="option"]:focus {
  outline: none;
  background: rgba(19, 91, 236, 0.08);
}

.lang-select-menu [role="option"][aria-selected="true"] {
  background: rgba(19, 91, 236, 0.12);
}

.lang-select-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
}

.lang-select-code {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.lang-select-trigger .lang-select-code {
  color: var(--text);
}

.lang-flag {
  width: 1.35rem;
  height: 1rem;
  border-radius: 0.15rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(13, 18, 27, 0.12);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.lang-flag[data-lang-flag="es"] {
  background-image: linear-gradient(
    to bottom,
    #c60b1e 0 25%,
    #ffc400 25% 75%,
    #c60b1e 75% 100%
  );
}

.lang-flag[data-lang-flag="ca"] {
  background-image: repeating-linear-gradient(
    to bottom,
    #fcd111 0,
    #fcd111 12.5%,
    #da121a 12.5%,
    #da121a 25%
  );
}

.lang-flag[data-lang-flag="gb"] {
  /* The Union Flag (Union Jack) — SVG inline, sin dependencias */
  background-color: #012169;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M0 0v30h60V0z'/%3E%3C/clipPath%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6' clip-path='url(%23a)'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23C8102E' stroke-width='4' clip-path='url(%23a)'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/svg%3E");
  background-size: cover;
}

.page {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 0 1.25rem;
}

.hero-logo {
  width: 5rem;
  height: 5rem;
  border-radius: 1rem;
  background: rgba(19, 91, 236, 0.1);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-size: 2rem;
}

.hero-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--muted);
  pointer-events: none;
  font-size: 1.15rem;
  line-height: 1;
}

.input {
  width: 100%;
  height: 3.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 0 1rem 0 2.75rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 91, 236, 0.15);
}

.input::placeholder {
  color: var(--placeholder);
}

.input.has-toggle {
  padding-right: 3rem;
}

.toggle-pass {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.toggle-pass:hover {
  color: var(--primary);
}

.link-muted {
  font-size: 0.875rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.7;
  pointer-events: none;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
}

.btn-danger-outline {
  width: auto;
  background: transparent;
  color: var(--danger, #dc2626);
  border: 1.5px solid var(--danger, #dc2626);
  box-shadow: none;
}

.btn-danger-outline:hover {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #b91c1c;
}

.btn.btn-danger-outline {
  border: 1.5px solid var(--danger, #dc2626);
}

.form-error {
  display: none;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.form-error.is-visible {
  display: block;
}

.form-ok {
  display: none;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

.form-ok.is-visible {
  display: block;
}

.footer-wave {
  margin-top: auto;
  height: 6rem;
  background: linear-gradient(to top, rgba(19, 91, 236, 0.06), transparent);
}

.admin-steps {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.25rem 0 0.35rem;
}

.admin-step-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #cfd7e7;
}

.admin-step-dot.is-active {
  background: var(--primary);
  transform: scale(1.15);
}

.admin-step-dot.is-done {
  background: rgba(19, 91, 236, 0.45);
}

.admin-login-step {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.admin-login-step[hidden] {
  display: none !important;
}

.admin-login-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.25rem;
}

.admin-login-step .btn-primary,
.admin-login-step .btn-ghost {
  width: 100%;
}

.admin-login-step .btn-ghost {
  margin-top: 0;
}

.admin-otp-field {
  align-items: center;
  gap: 0.85rem;
}

.admin-otp-label {
  display: block;
  width: 100%;
  text-align: center;
}

.admin-otp-group {
  display: flex;
  justify-content: center;
  gap: clamp(0.4rem, 2.5vw, 0.65rem);
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
}

.admin-otp-digit {
  flex: 1 1 0;
  min-width: 0;
  max-width: 3.25rem;
  height: 3.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: clamp(1.15rem, 4.5vw, 1.45rem);
  font-weight: 700;
  text-align: center;
  padding: 0;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -moz-appearance: textfield;
}

.admin-otp-digit::-webkit-outer-spin-button,
.admin-otp-digit::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.admin-otp-digit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 91, 236, 0.15);
}

.admin-login-step-totp .admin-login-actions {
  margin-top: 0.5rem;
}

.landing-main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.landing-hero {
  text-align: center;
  padding: 1.5rem 0 2rem;
}

.landing-hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.landing-hero p {
  margin: 0.85rem auto 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.feature-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 2rem;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem 1.1rem;
}

.feature h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.925rem;
}

@media (min-width: 720px) {
  .page {
    max-width: 26rem;
    padding-top: 2.5rem;
  }

  .cta-row {
    flex-direction: row;
    justify-content: center;
  }

  .btn-primary {
    width: auto;
    min-width: 11rem;
  }

  .admin-login-step .btn-primary {
    width: 100%;
    min-width: 0;
  }

  .landing-main .btn-primary {
    width: auto;
  }

  .feature-list {
    grid-template-columns: 1fr 1fr;
  }
}
