:root {
  --accent: #4a148c;
  --accent-light: #7b1fa2;
  --accent-soft: #ede7f6;
  --pink: #e91e63;
  --bg: #f3f0f9;
  --bg-card: #ffffff;
  --gold: #ffd54f;
  --text: #1a1a2e;
  --muted: #6b6b8a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(74, 20, 140, 0.08);
  --shadow-hover: 0 8px 28px rgba(74, 20, 140, 0.14);
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.app.has-tabbar {
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
}

a { color: var(--accent-light); text-decoration: none; }

/* —— Top bar —— */
.topbar {
  background: linear-gradient(120deg, #311b92 0%, #6a1b9a 55%, #8e24aa 100%);
  color: #fff;
  padding: max(12px, env(safe-area-inset-top)) 12px 12px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(49, 27, 146, 0.35);
}
.topbar a.back,
.topbar a.home-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.35rem;
  line-height: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar a.back:active,
.topbar a.home-link:active { background: rgba(255,255,255,0.12); }
.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.02em;
}
.topbar .spacer { width: 44px; }

/* —— Hero home —— */
.hero-home {
  background: linear-gradient(155deg, #311b92 0%, #6a1b9a 40%, #e91e63 100%);
  color: #fff;
  padding: 28px 20px 32px;
  border-radius: 0 0 32px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-home::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,213,79,0.25), transparent 45%),
              radial-gradient(circle at 80% 60%, rgba(255,255,255,0.08), transparent 40%);
  pointer-events: none;
}
.hero-home > * { position: relative; z-index: 1; }
.hero-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 0 4px rgba(255,213,79,0.35);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-home h1 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero-home p {
  margin: 0;
  opacity: 0.92;
  font-size: 0.95rem;
  max-width: 320px;
  margin-inline: auto;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: -20px 16px 20px;
  position: relative;
  z-index: 2;
}
.quick-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border: 1px solid rgba(74,20,140,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.quick-card:active { transform: scale(0.98); }
.quick-card strong {
  display: block;
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 4px;
}
.quick-card span { font-size: 0.78rem; color: var(--muted); }
.quick-card .emoji { font-size: 1.5rem; margin-bottom: 6px; }

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.page-intro {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.menu-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 20px 0 10px 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.menu-item:active {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-hover);
}
.menu-item .icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}
.menu-item .meta { flex: 1; min-width: 0; }
.menu-item .meta strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
}
.menu-item .meta span {
  font-size: 0.82rem;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}
.menu-item .arrow {
  color: #c4b5d8;
  font-size: 1.25rem;
  font-weight: 300;
}

.form-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(74,20,140,0.06);
}
.form-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.form-steps span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--accent-soft);
}
.form-steps span.on { background: linear-gradient(90deg, var(--accent), var(--pink)); }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(74, 20, 140, 0.06);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
  transition: transform 0.12s, opacity 0.12s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #6a1b9a 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(74, 20, 140, 0.35);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--accent);
  border: 2px solid var(--accent-soft);
}
.btn-ghost {
  background: transparent;
  color: var(--accent-light);
  border: none;
  font-weight: 600;
}
.btn-primary:disabled { opacity: 0.55; cursor: wait; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input, .field select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e8e4f0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: #faf9fc;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(123, 31, 162, 0.15);
  background: #fff;
}

.loading, .error-box {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.error-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin: 12px 0;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-block {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(74,20,140,0.05);
}
.section-block .section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%);
  border-bottom: 1px solid rgba(74,20,140,0.06);
}
.section-block .section-head .sec-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.section-block h3 {
  margin: 0;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 800;
}
.section-block .body {
  padding: 16px;
  white-space: pre-wrap;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text);
}
.section-block .body.pending {
  color: var(--muted);
  font-style: italic;
}
.section-block .body.loading-text {
  color: var(--accent-light);
}
.section-block .actions {
  padding: 0 16px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.section-block .actions button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  min-height: 40px;
}
.section-block .actions button.primary {
  background: var(--accent);
  color: #fff;
}

.section-block.accent-fortaleza .section-head { background: linear-gradient(90deg, #fff3e0, transparent); }
.section-block.accent-riesgo .section-head { background: linear-gradient(90deg, #ffebee, transparent); }
.section-block.accent-consejo .section-head { background: linear-gradient(90deg, #e8f5e9, transparent); }

.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #2d2d44;
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 0.9rem;
  z-index: 9999;
  max-width: min(90%, 360px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.28);
  animation: toast-in 0.25s ease forwards;
}
body:not(.has-tabbar) .toast { bottom: calc(20px + var(--safe-b)); }
@keyframes toast-in {
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(74,20,140,0.08);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  z-index: 300;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 -4px 24px rgba(74,20,140,0.06);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 8px;
  min-height: 48px;
  justify-content: center;
}
.tabbar a .tab-icon { font-size: 1.35rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active .tab-icon { filter: drop-shadow(0 2px 4px rgba(74,20,140,0.25)); }

.grid-signos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.grid-signos a {
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  transition: transform 0.12s;
}
.grid-signos a:active { transform: scale(0.96); }

.profile-card {
  border: 2px solid #ebe6f2;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.profile-card:active { border-color: var(--accent-light); }
.profile-card.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fff 0%, var(--accent-soft) 120%);
}
.profile-card h4 { margin: 0 0 6px; font-size: 1rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

footer.site {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 8px 20px 24px;
}

.progress-bar {
  height: 6px;
  background: var(--accent-soft);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--pink));
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

@media (min-width: 521px) {
  .tabbar {
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}

/* Dashboard inicio */
.dashboard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(74, 20, 140, 0.08);
}
.dashboard-card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--accent);
}
.triada-signos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.triada-signos .chip { font-size: 0.8rem; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.tabs button {
  flex-shrink: 0;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}
.tabs button.active {
  background: var(--accent);
  color: #fff;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  padding: 8px 6px;
  border-bottom: 1px solid #eee;
}
.data-table td {
  padding: 10px 6px;
  border-bottom: 1px solid #f3f0f9;
}
.data-table tr:last-child td { border-bottom: none; }

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.list-link {
  display: block;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.list-link strong { display: block; color: var(--accent); }

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.wheel-card .natal-wheel {
  max-width: 280px;
  width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.ios-install-hint {
  position: fixed;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: 200;
  background: #fff;
  border: 1px solid #e0d4f0;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}
.ios-install-hint p { margin: 0 0 10px; }
.ios-install-hint button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.seo-sign-hero {
  text-align: center;
  padding: 8px 0 16px;
}
.seo-sign-hero .glyph { font-size: 2.5rem; line-height: 1; }

@media print {
  .tabbar, .topbar, .ios-install-hint, .share-row, .back, .home-link { display: none !important; }
  body { padding: 0; background: #fff; }
  .wrap { max-width: none; }
}
