:root {
  color-scheme: dark;
  --bg-main: #09090b;
  --bg-surface: #111114;
  --bg-surface-elevated: #16161a;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-hover: rgba(168, 85, 247, 0.45);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent-purple: #9333ea;
  --accent-magenta: #db2777;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --shadow-gateway: 0 24px 60px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg-main);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.unni-portal-home {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text-primary);
  font-family: var(--font-sans);
  background: var(--bg-main) !important;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(147, 51, 234, 0.07) 0%, transparent 65%),
    radial-gradient(circle at 85% 90%, rgba(219, 39, 119, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, #09090b 0%, #0d0d11 100%) !important;
  background-attachment: fixed !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1200px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) 0 max(16px, env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}

/* ==========================================================================
   1. TOPBAR FLUTUANTE DE ALTA PRECISÃO (LINEAR / VERCEL STYLE)
   ========================================================================== */
.topbar {
  min-height: 68px;
  padding: 8px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  background: rgba(17, 17, 20, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.brand {
  display: flex;
  align-items: center;
  width: clamp(160px, 18vw, 210px);
  height: 48px;
}

.brand img {
  display: block;
  width: 100%;
  height: 44px;
  object-fit: contain;
  object-position: left center;
}

.topbar-title {
  min-width: max-content;
  margin: 0;
  padding: 0 24px;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

/* Área de Ações à Direita: Dois Elementos Separados e Independentes */
.secure {
  justify-self: end;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* 1º Elemento: Botão do Seletor de Tema */
.unni-theme-switcher {
  display: inline-flex !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.unni-theme-switcher > summary {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  height: 36px !important;
  padding: 0 13px !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 9px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--text-primary) !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  box-shadow: none !important;
  outline: none !important;
  transition: all 160ms ease !important;
}

.unni-theme-switcher > summary:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--border-strong) !important;
}

.unni-theme-switcher__label {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* 2º Elemento: Distintivo Verde de Segurança */
.secure > span:not(.unni-theme-switcher__label) {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  height: 36px !important;
  padding: 0 12px !important;
  background: rgba(16, 185, 129, 0.08) !important;
  border: 1px solid rgba(16, 185, 129, 0.22) !important;
  border-radius: 9px !important;
  color: #34d399 !important;
  font-size: 0.74rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.03em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

.secure > span:not(.unni-theme-switcher__label)::before {
  content: "" !important;
  display: inline-block !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: var(--accent-green) !important;
  box-shadow: 0 0 8px var(--accent-green) !important;
  animation: unniPulse 2s infinite ease-in-out !important;
}

/* ==========================================================================
   2. GATEWAY CENTRAL — BENTO BOX DE PRECISÃO TÉCNICA
   ========================================================================== */
.center {
  display: grid;
  place-items: center;
  padding: 10px 0;
}

.chooser {
  width: 100%;
  min-height: clamp(480px, 58vh, 620px);
  padding: clamp(32px, 4.5vw, 60px);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(180deg, rgba(20, 20, 24, 0.80) 0%, rgba(13, 13, 16, 0.94) 100%);
  box-shadow: var(--shadow-gateway);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
}

/* Linha Laser Superior Fina & Elegante */
.chooser::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(147, 51, 234, 0.6) 35%, rgba(219, 39, 119, 0.5) 65%, transparent 100%);
}

.kicker {
  font-family: var(--font-mono);
  color: #c084fc;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 12px 0 10px;
  font-size: clamp(2.4rem, 4.8vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 750;
  color: #ffffff;
}

.intro {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(0.92rem, 1.4vw, 1.02rem);
  line-height: 1.58;
}

/* Grid de Acesso */
.access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 32px;
}

/* ==========================================================================
   3. CARDS DE ACESSO — TECNOLÓGICOS E TÁTEIS (SPOTLIGHT CARDS)
   ========================================================================== */
.access-card {
  position: relative;
  min-height: 230px;
  padding: clamp(24px, 2.8vw, 32px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  background: rgba(18, 18, 22, 0.72);
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 220ms ease,
              box-shadow 220ms ease,
              background 220ms ease;
}

/* Brilho de Canto Sutil */
.access-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -70px;
  bottom: -70px;
  border-radius: 50%;
  opacity: 0.05;
  transition: opacity 220ms ease, transform 220ms ease;
}

.access-card.client::after { background: radial-gradient(circle, var(--accent-purple), var(--accent-magenta)); }
.access-card.agency::after { background: radial-gradient(circle, var(--accent-gold), var(--accent-magenta)); }

.access-card:hover, .access-card:focus-visible {
  transform: translateY(-3px);
  background: rgba(22, 22, 28, 0.85);
  border-color: var(--border-hover);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(168, 85, 247, 0.2) inset;
  outline: none;
}

.access-card:hover::after {
  opacity: 0.12;
  transform: scale(1.15);
}

.access-label {
  align-self: flex-start;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client .access-label {
  color: #c084fc;
  background: rgba(147, 51, 234, 0.12);
  border: 1px solid rgba(147, 51, 234, 0.25);
}

.agency .access-label {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.access-card h2 {
  margin: 16px 0 6px;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  letter-spacing: -0.025em;
  color: #ffffff;
  font-weight: 700;
}

.access-card p {
  max-width: 330px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.access-action {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.access-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.access-card:hover .access-arrow {
  transform: translateX(3px) scale(1.05);
  box-shadow: 0 6px 18px rgba(219, 39, 119, 0.5);
}

/* ==========================================================================
   4. RODAPÉ TÉCNICO & TRANSIÇÃO
   ========================================================================= */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.footer .unni-pwa-install {
  min-height: 34px;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer .unni-pwa-install:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* ==========================================================================
   4. TRANSIÇÃO 3D DO PORTAL DO CLIENTE (LEVE, RÁPIDA E FUTURISTA)
   ========================================================================== */
.welcome-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text-primary);
  background: rgba(9, 9, 11, 0.97);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  perspective: 1200px;
  transition: opacity 260ms cubic-bezier(0.16, 1, 0.3, 1), visibility 260ms ease;
}

.welcome-transition.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.welcome-transition__content {
  display: grid;
  justify-items: center;
  max-width: 540px;
  text-align: center;
  transform-style: preserve-3d;
}

/* Símbolo do Unicórnio com Apresentação 3D Flutuante & Glow Holográfico */
.welcome-transition__logo {
  display: block;
  width: clamp(140px, 24vw, 210px);
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 20px 40px rgba(147, 51, 234, 0.5)) drop-shadow(0 0 25px rgba(219, 39, 119, 0.35));
  transition: opacity 320ms ease;
}

.welcome-transition.is-visible .welcome-transition__logo {
  opacity: 1;
  animation: unicornFloat3D 2.6s ease-in-out infinite alternate;
}

@keyframes unicornFloat3D {
  0% {
    transform: perspective(1000px) rotateX(12deg) rotateY(-10deg) translateZ(15px) scale(0.97);
  }
  100% {
    transform: perspective(1000px) rotateX(-8deg) rotateY(12deg) translateZ(45px) scale(1.05);
  }
}

/* Tipografia Holográfica de Boas-Vindas */
.welcome-transition h2 {
  margin: 22px 0 8px;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #f4f4f5 55%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.welcome-transition p {
  margin: 0;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.55;
  font-weight: 450;
}

/* Barra de Carregamento Imponente, Tecnológica e Visível */
.welcome-transition__line {
  width: min(340px, 85vw);
  height: 8px;
  margin-top: 28px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 24px rgba(147, 51, 234, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  position: relative;
}

.welcome-transition__line::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9333ea 0%, #db2777 50%, #f59e0b 100%);
  box-shadow: 0 0 18px rgba(219, 39, 119, 0.9);
  transform: translateX(-100%);
}

.welcome-transition.is-visible .welcome-transition__line::after {
  animation: welcomeProgress 1.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes welcomeProgress {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(-35%); }
  100% { transform: translateX(0%); }
}


@keyframes unniPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   5. RESPONSIVIDADE MOBILE IMPECÁVEL
   ========================================================================== */
@media (max-width: 700px) {
  .page {
    width: min(100% - 16px, 1200px);
    padding: max(8px, env(safe-area-inset-top, 0px)) 0 max(8px, env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }
  .topbar {
    min-height: 76px;
    padding: 10px 14px;
    border-radius: 16px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
  }
  .brand { width: 150px; height: auto; justify-content: center; }
  .topbar-title { padding: 0; font-size: 1rem; border: none; }
  .secure { display: none !important; }
  .center { padding: 0; }
  .chooser { min-height: 0; padding: 26px 16px; border-radius: 20px; }
  h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); }
  .access-grid { grid-template-columns: 1fr; margin-top: 20px; gap: 14px; }
  .access-card { min-height: 190px; padding: 20px; border-radius: 16px; }
  .footer { padding: 4px; flex-direction: column; gap: 6px; text-align: center; }
}
