:root {
  color-scheme: light dark;
  --uc-purple: #706892;
  --uc-indigo: #51549d;
  --uc-navy: #16375d;
  --uc-deep: #14375f;
  --uc-mist: #ccdaf1;
  --uc-blue-soft: #8ca7d5;
  --uc-blue: #2e74b8;
  --uc-cyan: #74c5ed;

  --font-title: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Lato", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --bg: #f4f7fb;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #172033;
  --muted: #5f6c80;
  --border: rgba(22, 55, 93, 0.13);
  --shadow: 0 24px 70px rgba(20, 55, 95, 0.16);
  --shadow-soft: 0 12px 34px rgba(20, 55, 95, 0.10);
  --focus: 0 0 0 4px rgba(116, 197, 237, 0.35);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08111d;
  --bg-soft: #0d1a2b;
  --surface: rgba(16, 32, 52, 0.86);
  --surface-strong: #122138;
  --text: #f4f8ff;
  --muted: #b5c3d8;
  --border: rgba(204, 218, 241, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.26);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #08111d;
    --bg-soft: #0d1a2b;
    --surface: rgba(16, 32, 52, 0.86);
    --surface-strong: #122138;
    --text: #f4f8ff;
    --muted: #b5c3d8;
    --border: rgba(204, 218, 241, 0.16);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.26);
  }
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(116, 197, 237, 0.34), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(112, 104, 146, 0.22), transparent 28rem),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, rgba(46, 116, 184, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(20, 55, 95, 0.08), transparent 32%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 85%);
}

a { color: var(--uc-blue); font-weight: 700; }

a:hover { color: var(--uc-indigo); }

button,
input,
select { font: inherit; }

button { cursor: pointer; }

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

.hidden { display: none !important; }

.page-shell {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: clamp(140px, 18vw, 230px);
  max-height: 64px;
  object-fit: contain;
  object-position: left center;
}


.brand-logo--dark { display: none; }
html[data-theme="dark"] .brand-logo--light { display: none; }
html[data-theme="dark"] .brand-logo--dark { display: block; }

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .brand-logo--light { display: none; }
  html[data-theme="auto"] .brand-logo--dark { display: block; }
}


.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  box-shadow: var(--shadow-soft);
}

.theme-toggle:hover { transform: translateY(-1px); }

.theme-toggle__icon { font-size: 1.1rem; }

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(360px, 1.06fr);
  gap: 22px;
  align-items: start;
}

.hero-card { grid-column: 1; grid-row: 1 / span 4; }
.form-card { grid-column: 2; grid-row: 1; }
.result-card { grid-column: 2; }
.privacy-card { grid-column: 2; }

.hero-card,
.form-card,
.result-card,
.privacy-card {
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  position: sticky;
  top: 24px;
  min-height: 522px;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(22, 55, 93, 0.96), rgba(46, 116, 184, 0.82)),
    var(--surface-strong);
  color: #ffffff;
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.hero-card::before {
  width: 340px;
  height: 340px;
  right: -120px;
  top: -110px;
  background: rgba(116, 197, 237, 0.24);
}

.hero-card::after {
  width: 250px;
  height: 250px;
  left: -90px;
  bottom: -100px;
  background: rgba(204, 218, 241, 0.18);
}

.hero-card__content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 522px;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(28px, 5vw, 46px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--uc-cyan);
  font-family: var(--font-title);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-card .eyebrow { color: #ccefff; }

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-title);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h1 { font-size: clamp(2.05rem, 4.3vw, 4.05rem); max-width: 10ch; }

h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); }

.hero-text {
  max-width: 460px;
  margin: 18px 0 0;
  color: rgba(255,255,255,0.86);
  font-size: 1.06rem;
  line-height: 1.65;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.78rem;
  font-weight: 700;
}


.form-card,
.result-card,
.privacy-card { padding: clamp(22px, 3.2vw, 34px); }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.section-heading--compact { margin-bottom: 18px; }

.badge {
  color: var(--uc-deep);
  background: color-mix(in srgb, var(--uc-mist) 80%, white);
  white-space: nowrap;
}

html[data-theme="dark"] .badge { color: #ffffff; background: rgba(116, 197, 237, 0.15); border: 1px solid var(--border); }

.query-form { display: grid; gap: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.field { display: grid; gap: 7px; }

label {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

input,
select {
  min-height: 50px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--uc-cyan);
  box-shadow: var(--focus);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 16px;
  border: 0;
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  width: fit-content;
  min-width: 210px;
  padding: 13px 20px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--uc-indigo), var(--uc-blue));
  box-shadow: 0 12px 24px rgba(46, 116, 184, 0.27);
}

.primary-button:hover,
.secondary-button:hover { transform: translateY(-1px); filter: brightness(1.03); }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.36);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

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

.message {
  min-height: 22px;
  font-weight: 700;
  line-height: 1.45;
}

.message--red { color: #c73535; }
.message--orange { color: #c26b16; }
.message--gray { color: var(--muted); }
.message--green { color: #18734b; }

html[data-theme="dark"] .message--red { color: #ff9a9a; }
html[data-theme="dark"] .message--orange { color: #ffbf77; }
html[data-theme="dark"] .message--green { color: #84e5b4; }

.result-card,
.privacy-card { grid-column: 2; }

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

.result-item,
.account-row {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
}

.result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-value {
  display: block;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(1rem, 2vw, 1.22rem);
}

.secondary-button {
  min-height: 40px;
  padding: 10px 13px;
  color: var(--uc-deep);
  background: color-mix(in srgb, var(--uc-mist) 70%, white);
}

html[data-theme="dark"] .secondary-button { color: #ffffff; background: rgba(116, 197, 237, 0.14); border: 1px solid var(--border); }

.note {
  margin-top: 16px;
  color: var(--muted);
  font-weight: 700;
}

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

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.account-info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.account-line {
  color: var(--text);
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
}

.account-line span { color: var(--muted); font-family: var(--font-body); font-weight: 800; }

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.privacy-card {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  box-shadow: var(--shadow-soft);
}

.privacy-card p { margin: 0; }


/* Ajuste puntual v7: en escritorio, el dato consultado debe tener más jerarquía que las acciones. */
@media (min-width: 621px) {
  .account-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 14px;
  }

  .account-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .account-line {
    display: grid;
    gap: 3px;
    font-size: 1rem;
    line-height: 1.38;
  }

  .account-line span {
    display: block;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
  }

  .account-line strong {
    font-size: 1.08rem;
  }

  .account-actions {
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }

  .account-actions .secondary-button,
  .result-item .secondary-button {
    min-height: 34px;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.84rem;
    font-weight: 700;
    opacity: 0.86;
    box-shadow: none;
  }

  .account-actions .secondary-button:hover,
  .result-item .secondary-button:hover {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .page-shell { width: min(100% - 24px, 720px); padding-top: 18px; }

  .main-layout { grid-template-columns: 1fr; }

  .hero-card,
  .form-card,
  .result-card,
  .privacy-card { grid-column: 1; }

  .hero-card,
  .form-card,
  .result-card,
  .privacy-card {
    grid-column: 1;
    grid-row: auto;
  }

  .hero-card { position: relative; top: auto; min-height: auto; }

  .hero-card__content { min-height: 360px; }

  h1 { max-width: 14ch; }
}

@media (max-width: 620px) {
  .site-header {
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .brand-logo {
    width: min(66vw, 230px);
    max-height: 64px;
  }

  .theme-toggle__text { display: none; }

  .form-grid,
  .result-grid,
  .account-row { grid-template-columns: 1fr; }

  .hero-card,
  .form-card,
  .result-card,
  .privacy-card { border-radius: 24px; }

  .hero-card__content { min-height: 310px; padding: 26px; }

  h1 { font-size: clamp(2rem, 12vw, 3rem); }

  .section-heading { flex-direction: column; margin-bottom: 18px; }

  .primary-button { width: 100%; }

  .account-actions { justify-content: stretch; }

  .account-actions .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Ajuste de resultados en escritorio: prioriza el dato sobre la acción. */
@media (min-width: 621px) {
  .result-grid {
    gap: 16px;
  }

  .result-item {
    display: grid;
    grid-template-rows: auto minmax(44px, auto) auto;
    align-content: start;
    min-height: 154px;
    padding: 18px 18px 16px;
  }

  .result-value {
    margin-bottom: 10px;
    color: var(--text);
    font-size: clamp(1.12rem, 1.65vw, 1.36rem);
    line-height: 1.28;
  }

  .result-item .secondary-button {
    justify-self: start;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    font-size: 0.78rem;
    font-weight: 800;
  }

  .result-item .secondary-button:hover {
    color: var(--uc-deep);
    background: color-mix(in srgb, var(--uc-mist) 34%, transparent);
  }

  html[data-theme="dark"] .result-item .secondary-button {
    color: var(--muted);
    background: transparent;
  }

  html[data-theme="dark"] .result-item .secondary-button:hover {
    color: #ffffff;
    background: rgba(116, 197, 237, 0.12);
  }
}

.result-highlight {
  animation: resultPulse 1.6s ease-out;
}

@keyframes resultPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 116, 184, 0.35);
    transform: translateY(0);
  }

  40% {
    box-shadow: 0 0 0 10px rgba(46, 116, 184, 0.14);
    transform: translateY(-2px);
  }

  100% {
    transform: translateY(0);
  }
}

.message--success {
  color: var(--color-success, #157347);
  font-weight: 700;
}