:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --bg: #f6f3ee;
  --card: #ffffff;
  --line: #e2ddd4;
  --input: #ffffff;
  --text: #1a1f2e;
  --muted: #5c6478;
  --accent: #1e90ff;
  --accent-hover: #1873cc;
  --accent-soft: #1873cc;
  --ok: #1b7f4a;
  --err: #b42318;
  --warn: #b45309;
  --soft: #e8f4ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 90% -10%, #d6ebff 0%, transparent 55%),
    radial-gradient(700px 380px at -10% 110%, #e8f4ff 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.85rem;
  position: relative;
  z-index: 20;
}

.brand-row .session-cluster { margin-left: auto; }

.brand-row > img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(30, 144, 255, 0.28);
}

.brand {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

p.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.45;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 40px rgba(26, 31, 46, 0.06);
}

.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.75rem 1rem;
}

.session-bar strong { color: var(--text); font-weight: 600; }

.progress-wrap { margin: 0 0 1rem; }
.progress-track {
  height: 6px;
  background: #ebe6df;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #14a392, var(--accent));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress-phase {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.progress-label {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.6rem 0 0.25rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--input);
  color: var(--text);
  font: inherit;
}

button, a.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.primary, a.btn.primary {
  background: var(--accent);
  color: #fff;
}
button.primary:hover, a.btn.primary:hover {
  background: var(--accent-hover);
}
button.secondary, a.btn.secondary {
  background: #eef2f7;
  color: var(--text);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.muted { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.ok { color: var(--ok); }
.err { color: var(--err); }
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.hidden { display: none !important; }
a { color: var(--accent); }

.banner {
  background: linear-gradient(135deg, rgba(30, 144, 255, 0.1), rgba(20, 163, 146, 0.05));
  border: 1px solid rgba(30, 144, 255, 0.28);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin: 1rem 0 0;
  color: var(--text);
  line-height: 1.5;
  font-size: 0.95rem;
}
.banner strong { color: var(--accent-soft); }

.banner-trust {
  background: linear-gradient(135deg, rgba(27, 127, 74, 0.1), rgba(30, 144, 255, 0.06));
  border-color: rgba(27, 127, 74, 0.28);
}
.banner-trust strong { color: var(--ok); }

.banner-help {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.1), rgba(30, 144, 255, 0.05));
  border-color: rgba(180, 83, 9, 0.3);
}
.banner-help strong { color: var(--warn); }
.banner-permission {
  background: linear-gradient(135deg, rgba(180, 35, 24, 0.08), rgba(30, 144, 255, 0.05));
  border-color: rgba(180, 35, 24, 0.28);
}
.banner-permission strong { color: var(--err); }

.preview-url {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: #f8f6f2;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  word-break: break-all;
}
.preview-url span {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.name-callout-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* Título del paso = el nombre a pegar (misma escala que h1 #pageTitle) */
h2.project-name-heading,
#manualProjectNameSuggest {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
  color: var(--accent);
  word-break: break-word;
  user-select: all;
}

.help-steps {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  color: var(--text);
  line-height: 1.55;
}
.help-steps li { margin: 0.55rem 0; }
.help-steps strong { color: var(--accent-soft); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 0.25rem;
}
button.choice {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 0.85rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
button.choice.selected,
button.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.2);
}
.check-list {
  margin: 0.75rem 0;
  padding-left: 1.15rem;
  line-height: 1.5;
}
.check-list li { margin: 0.35rem 0; }
.guide-steps {
  margin: 0.75rem 0;
  padding-left: 1.2rem;
  line-height: 1.55;
}
.guide-steps li { margin: 0.45rem 0; }
.unit-field {
  margin: 0.55rem 0;
}
.unit-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.export-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.65rem 0;
  background: #fff;
}
.export-card strong { display: block; margin-bottom: 0.35rem; }
.export-card code {
  display: block;
  word-break: break-all;
  font-size: 0.82rem;
  background: #f4f7fb;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  margin: 0.35rem 0 0.55rem;
}
.channel-step-title {
  margin: 1rem 0 0.35rem;
  font-size: 1rem;
}

.pulse-hint { box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.45); }

.cheer {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, #fff);
  color: var(--text);
  line-height: 1.45;
  font-size: 0.95rem;
}
.cheer strong {
  color: var(--accent);
}

.status {
  margin-top: 0.75rem;
  min-height: 1.4em;
  font-size: 0.9rem;
  font-weight: 600;
}

code {
  font-size: 0.88em;
  background: #f0ebe3;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* Señal clara: el sistema está trabajando */
.work-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(246, 243, 238, 0.72);
  backdrop-filter: blur(4px);
}
.work-card {
  width: min(22rem, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.35rem 1.25rem;
  box-shadow: 0 18px 40px rgba(26, 31, 46, 0.1);
  text-align: center;
}
.work-spinner {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 1rem;
  border: 3px solid #d6ebff;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.work-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.work-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.work-step-meta {
  margin: 0 0 0.65rem !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.02em;
  color: var(--ink) !important;
  font-weight: 600;
}
.work-progress {
  height: 6px;
  border-radius: 999px;
  background: #e8eef5;
  margin: 0 0 0.85rem;
  overflow: hidden;
}
.work-progress-bar {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s ease;
}
.work-hint {
  margin-top: 0.85rem !important;
  font-size: 0.86rem !important;
  line-height: 1.4 !important;
  color: var(--muted) !important;
}
/* publish-hint-v2 */
body.is-busy { overflow: hidden; }
body.is-busy button.primary,
body.is-busy a.btn.primary {
  pointer-events: none;
  opacity: 0.65;
}

/* Banner flotante de bienvenida (primera pantalla) */
body.welcome-open {
  overflow: hidden;
}
body.welcome-open main {
  pointer-events: none;
}
.welcome-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(26, 31, 46, 0.45);
  /* captura toques en el fondo; el cierre solo lo hace el botón */
  pointer-events: auto;
  touch-action: none;
}
.welcome-backdrop.hidden { display: none !important; }
.welcome-modal {
  width: min(540px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--card);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(26, 31, 46, 0.22);
  padding: 1.35rem 1.35rem 1.2rem;
  scroll-padding-top: 0;
  pointer-events: auto;
}
.welcome-brand {
  margin: 0 0 0.85rem;
}
.welcome-brand .brand {
  font-size: 1.2rem;
}
.welcome-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}
.welcome-modal h2 {
  margin: 0 0 0.85rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.welcome-modal > p {
  margin: 0 0 0.85rem;
  color: var(--text);
  line-height: 1.5;
  font-size: 0.95rem;
}
.welcome-modal > p strong {
  color: var(--text);
  font-weight: 700;
}
.welcome-list {
  margin: 0 0 0.95rem;
  padding-left: 1.15rem;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.welcome-list li {
  margin: 0 0 0.65rem;
}
.welcome-list li:last-child {
  margin-bottom: 0;
}
.welcome-list strong {
  color: var(--text);
  font-weight: 700;
}
.welcome-close {
  margin: 0.35rem 0 1.1rem;
  padding: 0.75rem 0.9rem;
  background: var(--soft);
  border-radius: 10px;
  border: 1px solid #cfe6ff;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
}
.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.welcome-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.welcome-check input {
  width: 1rem;
  height: 1rem;
  margin: 0.2rem 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.welcome-actions button.primary {
  width: 100%;
  text-align: center;
  font-size: 1rem;
}

/* —— Login estilo Gmail (solo mientras #viewLogin está visible) —— */
body:has(#viewLogin:not(.hidden)) {
  background: #f0f4f9;
}

body:has(#viewLogin:not(.hidden)) main {
  max-width: 450px;
  padding: 2.5rem 1rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body:has(#viewLogin:not(.hidden)) #wizardBrandRow,
body:has(#viewLogin:not(.hidden)) #pageTitle,
body:has(#viewLogin:not(.hidden)) #pageLead,
body:has(#viewLogin:not(.hidden)) #progressWrap {
  display: none !important;
}

.login-gmail {
  margin: 0;
  padding: 2rem 1.75rem 1.75rem;
  border-radius: 28px;
  border: 1px solid #dadce0;
  box-shadow: none;
  overflow: visible;
}

.session-cluster {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  z-index: 30;
}
.nav-admin {
  appearance: none;
  border: 0;
  margin: 0 0.35rem 0 0;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  background: #1e90ff;
  color: #fff;
  font: inherit;
  font-weight: 650;
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(30, 144, 255, 0.22);
}
.nav-admin:hover { background: #0b6fd4; }
.nav-admin:disabled {
  opacity: 0.72;
  cursor: wait;
  box-shadow: none;
}
.nav-admin.hidden { display: none !important; }
.account-menu-action {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.35rem;
  margin: 0;
  font: inherit;
  font-weight: 650;
  color: #0b6fd4;
  border-radius: 8px;
  cursor: pointer;
}
.account-menu-action:hover { background: #eff6ff; }
.account-menu-action:disabled {
  opacity: 0.72;
  cursor: wait;
}
.account-menu-action.hidden { display: none !important; }
.account-chip {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #dadce0;
  flex-shrink: 0;
  user-select: none;
  background: #1a73e8;
}
.account-kebab {
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.account-kebab span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #5f6368;
  display: block;
}
.account-kebab:hover,
.account-kebab[aria-expanded="true"] {
  background: rgba(15, 23, 42, 0.08);
}
.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  width: max-content;
  max-width: min(280px, calc(100vw - 2rem));
  padding: 0.85rem 0.8rem 0.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.account-menu-email {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
}
.account-menu-out {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.35rem;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}
.account-menu-out:hover { background: #f1f5f9; }

.login-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.login-back {
  display: inline-block;
  font-size: 0.85rem;
  margin: 0;
  color: var(--muted);
}

.session-logout {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.25rem 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.session-logout:hover { color: var(--text); }

.login-gmail-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.35rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.login-gmail-brand img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(30, 144, 255, 0.28);
}

.login-gmail-title {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-gmail-sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.login-gmail-note {
  font-size: 0.88rem;
  margin: 0 0 1.15rem;
}

.login-legal-box {
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.login-legal-label {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text);
  margin: 0;
  line-height: 1.45;
}

.login-legal-label input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.2rem 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.login-gmail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.login-gmail-actions .login-google-btn,
.login-gmail-actions .login-create-btn,
.login-gmail-actions #btnLegalContinueLoggedIn {
  width: 100%;
  text-align: center;
  border-radius: 24px;
  padding: 0.75rem 1.1rem;
}

.login-help {
  margin: 1.15rem 0 0;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 520px) {
  .login-gmail {
    border: 0;
    border-radius: 0;
    padding: 1.25rem 0.25rem;
    background: transparent;
    box-shadow: none;
  }

  body:has(#viewLogin:not(.hidden)) {
    background: #fff;
  }
}
