:root {
  --primary: #4293E1;
  --bg-hub: #05080f;
  --font: "Segoe UI", "Nunito Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: var(--bg-hub);
  color: #fff;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.view { display: none; }
.view.active { display: flex; }

#hub-view.active {
  position: relative;
  flex-direction: column;
  background: radial-gradient(circle at center, #182742, #0a1220 60%, #05080f);
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

.site-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  flex-shrink: 0;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  text-align: center;
  z-index: 70;
  background: linear-gradient(to top, rgba(5, 8, 15, 0.96) 55%, rgba(5, 8, 15, 0));
  pointer-events: none;
}
.site-footer p {
  margin: 0 auto;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.62rem;
  line-height: 1.3;
  pointer-events: auto;
}
.site-footer a {
  color: #9ec9f5;
  font-weight: 700;
  text-decoration: none;
}
@media (max-width: 600px) {
  .site-footer {
    padding: 4px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .site-footer p {
    font-size: 0.58rem;
    line-height: 1.25;
  }
}

.hub-top {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 14px;
  flex-shrink: 0;
  z-index: 60;
  width: 100%;
}
.hub-top-inner {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hub-brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
}
.hub-brand small {
  display: block;
  opacity: 0.75;
  font-size: 0.75rem;
}
.hub-phone {
  display: block;
  margin-top: 2px;
  color: #9ec9f5;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.hub-phone:hover {
  color: #fff;
  text-decoration: underline;
}
.hub-mark,
.hub-center-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #6bb0f0);
  display: grid;
  place-items: center;
  font-weight: 900;
  flex-shrink: 0;
}
.hub-center-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.hub-logo {
  display: block;
  object-fit: contain;
  flex-shrink: 0;
  background: #000;
}
.hub-logo-sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
}
.hub-logo-center {
  width: min(120px, 58%);
  height: auto;
  aspect-ratio: 1;
  margin: 0 0 4px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.hub-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.hub-clock {
  font-size: 0.85rem;
  opacity: 0.85;
  white-space: nowrap;
}
.hub-auth { display: flex; align-items: center; gap: 8px; }
.hub-auth-btn {
  border: 1px solid rgba(158, 201, 245, 0.45);
  background: rgba(66, 147, 225, 0.18);
  color: #e8f2ff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.hub-auth-btn:hover { background: rgba(66, 147, 225, 0.32); }
.hub-auth-user {
  font-size: 0.8rem;
  color: #9ec9f5;
  font-weight: 700;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-auth-link {
  color: #9ec9f5;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
}
.hub-account {
  position: relative;
}
.hub-account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  padding: 8px;
  border-radius: 14px;
  background: #121a2b;
  border: 1px solid rgba(158, 201, 245, 0.28);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hub-account-menu[hidden] { display: none !important; }
.hub-account-menu .hub-account-name {
  padding: 8px 10px 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #9ec9f5;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-account-menu a,
.hub-account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8f2ff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}
.hub-account-menu a:hover,
.hub-account-menu button:hover {
  background: rgba(66, 147, 225, 0.18);
}
.hub-account-menu .hub-account-logout {
  color: #fca5a5;
}
.hub-modal[hidden] { display: none !important; }
.hub-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 10, 20, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.hub-modal-card {
  width: min(420px, 100%);
  background: #122033;
  border: 1px solid rgba(158, 201, 245, 0.25);
  border-radius: 16px;
  padding: 22px 20px 18px;
  color: #eef5ff;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.hub-modal-x {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: transparent; color: #9ec9f5;
  font-size: 1.1rem; cursor: pointer;
}
.hub-modal-card h2 { margin: 0 0 6px; font-size: 1.25rem; }
.hub-modal-sub { margin: 0 0 14px; color: #a9bdd4; font-size: 0.92rem; line-height: 1.4; }
.hub-auth-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.hub-auth-tabs button {
  flex: 1; border: 1px solid rgba(158,201,245,.25); background: transparent;
  color: #c7d8ec; padding: 8px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 700;
}
.hub-auth-tabs button.active { background: #4293e1; color: #fff; border-color: #4293e1; }
.hub-modal-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.85rem; color: #b7c9de; margin-bottom: 10px;
}
.hub-modal-card input {
  border: 1px solid rgba(158,201,245,.28); background: #0b1624;
  color: #fff; border-radius: 10px; padding: 10px 12px; font: inherit;
}
.hub-auth-submit {
  width: 100%; margin-top: 6px; border: 0; border-radius: 12px;
  background: #4293e1; color: #fff; font: inherit; font-weight: 800;
  padding: 12px; cursor: pointer;
}
.hub-auth-secondary { background: transparent; border: 1px solid rgba(158,201,245,.35); margin-top: 10px; }
.hub-auth-error {
  background: rgba(220, 60, 60, 0.15); border: 1px solid rgba(255,120,120,.35);
  color: #ffb4b4; padding: 8px 10px; border-radius: 10px; margin-bottom: 10px; font-size: 0.88rem;
}
.hub-field-hint {
  display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 500;
  color: #8aa0b8; line-height: 1.3;
}
.hub-wa-btn {
  display: block; text-align: center; margin: 12px 0 4px;
  background: #25d366; color: #07210f; text-decoration: none;
  font-weight: 800; padding: 12px; border-radius: 12px;
}

.radial-menu-container {
  --orbit-radius: 300px;
  --module-size: 118px;
  position: relative;
  flex: 1 1 auto;
  width: calc(var(--orbit-radius) * 2 + var(--module-size));
  height: calc(var(--orbit-radius) * 2 + var(--module-size));
  max-width: min(100vw - 16px, 100%);
  max-height: min(100dvh - 132px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 1;
  overflow: visible;
}
@media (max-width: 600px) {
  .radial-menu-container {
    max-height: min(100dvh - 118px, 100%);
  }
}

.radial-center {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(145deg, #111827, #0a1220);
  border: 2px solid rgba(255,255,255,0.12);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 0 80px rgba(66, 147, 225, 0.35), 0 0 140px rgba(37, 99, 235, 0.15);
  z-index: 50;
  transition: 0.25s ease;
  line-height: 1.2;
  padding: 12px;
  overflow: hidden;
}
.radial-center-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 100%;
}
.radial-center-ico { font-size: 34px; line-height: 1; }
.radial-center small {
  display: block;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 2px;
}

.orbit {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  overflow: visible;
}
.orbit .radial-module {
  pointer-events: auto;
  z-index: 60;
}

.radial-module {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--module-size);
  height: var(--module-size);
  margin-top: calc(var(--module-size) / -2);
  margin-left: calc(var(--module-size) / -2);
  border-radius: 50%;
  clip-path: circle(50% at 50% 50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 7px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.25);
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  color: #fff;
  line-height: 1.05;
  overflow: hidden;
}
.radial-module .rm-ico {
  font-size: 28px;
  margin-bottom: 2px;
  line-height: 1;
  pointer-events: none;
}
.radial-module .rm-label {
  pointer-events: none;
  max-width: 94%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal;
  word-break: break-word;
}
.radial-module:hover,
.radial-module:focus,
.radial-module:active {
  border-color: #fff;
  box-shadow: 0 0 22px rgba(255,255,255,0.25);
  z-index: 100;
}

.rm-blue   { background: rgba(66, 147, 225, 0.95); }
.rm-green  { background: rgba(26, 188, 156, 0.92); }
.rm-orange { background: rgba(255, 140, 0, 0.92); }
.rm-red    { background: rgba(255, 75, 92, 0.92); }
.rm-purple { background: rgba(142, 68, 173, 0.92); }
.rm-cyan   { background: rgba(0, 207, 232, 0.92); }
.rm-teal   { background: rgba(15, 118, 110, 0.95); }
.rm-amber  { background: rgba(217, 119, 6, 0.94); }

/* Vista módulo placeholder */
#module-view.active {
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #f5f7fb;
  color: #152033;
}
.module-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5eaf2;
  position: sticky;
  top: 0;
  z-index: 20;
}
.module-bar h1 {
  margin: 0;
  font-size: 1.05rem;
}
.btn-back {
  border: 1px solid #d7e0ec;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #152033;
}
.module-body {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.module-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(21, 32, 51, 0.06);
}
.module-ico { font-size: 2.4rem; margin-bottom: 8px; }
.module-card h2 { margin: 0 0 8px; }
.module-card p { margin: 0; color: #667085; }

@media (max-width: 900px) {
  .radial-menu-container { --orbit-radius: 188px; --module-size: 80px; }
  .radial-center { width: 128px; height: 128px; font-size: 15px; padding: 10px; }
  .radial-center small { font-size: 11px; }
  .radial-module { font-size: 10px; padding: 5px; border-width: 2px; }
  .radial-module .rm-ico { font-size: 22px; }
  .hub-center-mark { width: 42px; height: 42px; font-size: 1.1rem; border-radius: 12px; }
}
@media (max-width: 720px) {
  .hub-top { padding: 10px 12px; }
  .hub-top-inner {
    gap: 8px;
    align-items: center;
  }
  .hub-brand { flex: 1 1 auto; min-width: 0; }
  .hub-brand > div { min-width: 0; }
  .hub-brand strong {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* En móvil: menos texto a la izquierda */
  .hub-brand small,
  .hub-phone { display: none; }
  .hub-top-right {
    flex: 0 0 auto;
    max-width: 55%;
    justify-content: flex-end;
  }
  .hub-auth { max-width: 100%; }
  /* Desktop links ocultos; se usan en menú Cuenta */
  .hub-auth-desktop { display: none !important; }
  .hub-clock { display: none; }
  .hub-auth-btn { font-size: 0.78rem; padding: 7px 12px; }
}
@media (min-width: 721px) {
  .hub-auth-mobile { display: none !important; }
}
@media (max-width: 600px) {
  .radial-menu-container { --orbit-radius: 152px; --module-size: 74px; }
  .radial-center { width: 104px; height: 104px; font-size: 13px; padding: 8px; }
  .radial-center small { font-size: 10px; }
  .radial-module { font-size: 9.5px; padding: 5px; }
  .radial-module .rm-ico { font-size: 22px; }
  .hub-center-mark { width: 34px; height: 34px; font-size: 0.95rem; }
}
@media (max-width: 380px), (max-height: 620px) {
  .radial-menu-container { --orbit-radius: 132px; --module-size: 66px; }
  .radial-center { width: 90px; height: 90px; font-size: 12px; padding: 6px; }
  .radial-center small { font-size: 9px; }
  .radial-module { font-size: 9px; }
  .radial-module .rm-ico { font-size: 20px; }
}
