:root {
  --blue: #1761a3;
  --green: #4daf83;
  --black: #0f2a44;
  --gray: #6b7c8f;
  --gray-light: #e8eef4;
  --gray-mid: #c5d0db;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --bg-deep: #0a1a2e;
  --shadow: 0 12px 40px rgba(15, 42, 68, 0.1);
  --radius: 14px;
  --header-h: 72px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 90% 70% at 50% -20%, rgba(23, 97, 163, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 100% 40%, rgba(77, 175, 131, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(23, 97, 163, 0.1) 0%, transparent 45%),
    linear-gradient(170deg, #dceaf5 0%, #c8dbeb 40%, #b8d0e3 100%);
  color: var(--black);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== SPACE / PARTICLE LAYER ========== */
.particle-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#particleCanvas {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.space-aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform, opacity;
  z-index: 0;
  mix-blend-mode: multiply;
}

.space-aurora--left {
  width: min(60vw, 580px);
  height: min(60vw, 580px);
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, rgba(23, 97, 163, 0.45) 0%, transparent 70%);
  animation: auroraDrift 18s ease-in-out infinite alternate;
}

.space-aurora--right {
  width: min(55vw, 520px);
  height: min(55vw, 520px);
  bottom: -8%;
  right: -8%;
  background: radial-gradient(circle, rgba(77, 175, 131, 0.38) 0%, transparent 70%);
  animation: auroraDrift 24s ease-in-out infinite alternate-reverse;
}

.space-aurora--core {
  width: min(75vw, 700px);
  height: min(50vw, 460px);
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(15, 42, 68, 0.16) 0%, transparent 65%);
  animation: auroraPulse 14s ease-in-out infinite;
  mix-blend-mode: normal;
}

@keyframes auroraDrift {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(5%, 7%) scale(1.12);
    opacity: 1;
  }
  100% {
    transform: translate(-4%, 4%) scale(0.94);
    opacity: 0.8;
  }
}

@keyframes auroraPulse {
  0%,
  100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -46%) scale(1.15);
  }
}

.particle-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse 90% 60% at 10% 15%, rgba(23, 97, 163, 0.1), transparent 50%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(77, 175, 131, 0.09), transparent 48%);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .space-aurora {
    animation: none;
  }
}

/* ========== AUTH LOADING ========== */
body.auth-pending .header,
body.auth-pending .hero,
body.auth-pending .container {
  visibility: hidden;
}

.auth-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f2a44 0%, #1761a3 55%, #1a4d6e 100%);
  color: #fff;
  font-size: 16px;
  font-family: var(--font);
  z-index: 9999;
  padding: 24px;
  text-align: center;
}

.auth-retry-btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: var(--green);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-retry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(77, 175, 131, 0.35);
}

/* ========== HEADER ========== */
.header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 14px 40px;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(197, 208, 219, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-center {
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.branding-part {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-img {
  height: 34px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
}

/* ========== DROPDOWN ========== */
.env-dropdown {
  position: relative;
  width: 120px;
  font-size: 14px;
  user-select: none;
}

.dropdown-selected {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--gray-light);
  border: 1px solid var(--gray-mid);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s ease;
  color: var(--black);
  font-weight: 500;
}

.dropdown-selected img {
  width: 20px;
  transition: 0.2s;
}

.dropdown-selected:hover {
  background: #dfe8f0;
  border-color: var(--blue);
}

.dropdown-menu {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--gray-mid);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 20;
}

.env-dropdown.open .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  padding: 10px;
  cursor: pointer;
  transition: 0.2s ease;
  color: var(--black);
}

.dropdown-item:hover {
  background: rgba(23, 97, 163, 0.08);
}

.dropdown-item.active {
  color: var(--blue);
  font-weight: 600;
}

/* ======== ICON BUTTONS ========= */
.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--gray-light);
  cursor: pointer;
  transition: all 0.25s ease;
}

.icon-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(23, 97, 163, 0.12);
  transform: translateY(-1px);
}

.icon-btn:hover img {
  transform: scale(1.08);
}

.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #e05353;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ========== PROFILE ========== */
.profile {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(23, 97, 163, 0.3);
  border: 2px solid #ffffff;
}

.profile .initials {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.profile:hover {
  box-shadow: 0 8px 20px rgba(23, 97, 163, 0.4);
}

.profile::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--green));
  opacity: 0;
  z-index: -1;
  transition: 0.3s ease;
  filter: blur(6px);
}

.profile:hover::after {
  opacity: 0.4;
}

/* ============ SEARCH ============= */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 280px;
  padding: 11px 14px 11px 42px;
  border-radius: 10px;
  border: 1px solid var(--gray-mid);
  background: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-family: var(--font);
  color: var(--black);
  transition: all 0.25s ease;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  opacity: 0.55;
}

.search-input:hover {
  border-color: var(--gray);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 97, 163, 0.15);
}

.search-input::placeholder {
  color: var(--gray);
}

/* ========== HERO ========== */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 40px;
  padding: 56px 50px 36px;
  max-width: 1280px;
  margin: 0 auto;
  animation: fadeUp 0.75s ease both;
  min-height: min(42vh, 380px);
}

.hero-inner {
  max-width: 620px;
  position: relative;
  z-index: 2;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 16px;
}

.hero-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(77, 175, 131, 0.55);
  animation: livePulse 1.8s ease-out infinite;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(77, 175, 131, 0.55);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(77, 175, 131, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(77, 175, 131, 0);
  }
}

.hero-brand {
  font-size: clamp(2.6rem, 5.5vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
  color: var(--black);
  margin-bottom: 16px;
  text-shadow: 0 2px 30px rgba(23, 97, 163, 0.12);
}

.hero-brand span {
  background: linear-gradient(
    110deg,
    #1761a3 0%,
    #2a8fd4 35%,
    #4daf83 55%,
    #1761a3 75%,
    #4daf83 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brandShimmer 6s linear infinite;
}

@keyframes brandShimmer {
  to {
    background-position: 220% center;
  }
}

.hero-tagline {
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--gray);
  max-width: 460px;
  font-weight: 500;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 22px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  padding: 13px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, #1f7bc4 50%, var(--green) 140%);
  background-size: 160% 160%;
  box-shadow: 0 10px 28px rgba(23, 97, 163, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-position 0.4s ease;
}

.hero-cta:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 14px 36px rgba(23, 97, 163, 0.45);
}

.hero-hint {
  font-size: 13px;
  color: var(--gray);
  font-weight: 500;
}

/* Floating orbit visual */
.hero-orbit {
  position: relative;
  width: min(280px, 32vw);
  height: min(280px, 32vw);
  margin-right: 20px;
  animation: fadeUp 1s 0.2s ease both;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 1.5px solid rgba(23, 97, 163, 0.22);
}

.orbit-ring--1 {
  width: 100%;
  height: 100%;
  animation: spinSlow 28s linear infinite;
  border-color: rgba(23, 97, 163, 0.28);
  border-top-color: var(--green);
  border-right-color: transparent;
}

.orbit-ring--2 {
  width: 72%;
  height: 72%;
  animation: spinSlow 18s linear infinite reverse;
  border-color: rgba(77, 175, 131, 0.25);
  border-bottom-color: var(--blue);
  border-left-color: transparent;
}

.orbit-ring--3 {
  width: 46%;
  height: 46%;
  animation: spinSlow 12s linear infinite;
  border-style: dashed;
  border-color: rgba(15, 42, 68, 0.2);
}

.orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blue), var(--green));
  box-shadow:
    0 0 0 8px rgba(23, 97, 163, 0.12),
    0 0 40px rgba(77, 175, 131, 0.45),
    0 8px 28px rgba(15, 42, 68, 0.25);
  animation: coreGlow 3.5s ease-in-out infinite;
}

.orbit-core::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, transparent 55%);
  opacity: 0.55;
}

.orbit-sat {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(77, 175, 131, 0.8);
  top: 50%;
  left: 50%;
  margin: -5px 0 0 -5px;
}

.orbit-sat--1 {
  animation: orbitPath1 10s linear infinite;
  background: var(--blue);
  box-shadow: 0 0 12px rgba(23, 97, 163, 0.85);
}

.orbit-sat--2 {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  animation: orbitPath2 7s linear infinite reverse;
}

.orbit-sat--3 {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  animation: orbitPath3 5s linear infinite;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

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

@keyframes coreGlow {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 8px rgba(23, 97, 163, 0.12),
      0 0 36px rgba(77, 175, 131, 0.4),
      0 8px 28px rgba(15, 42, 68, 0.25);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 0 12px rgba(23, 97, 163, 0.16),
      0 0 55px rgba(77, 175, 131, 0.55),
      0 10px 32px rgba(15, 42, 68, 0.28);
  }
}

@keyframes orbitPath1 {
  from {
    transform: rotate(0deg) translateX(138px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(138px) rotate(-360deg);
  }
}

@keyframes orbitPath2 {
  from {
    transform: rotate(0deg) translateX(100px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(100px) rotate(-360deg);
  }
}

@keyframes orbitPath3 {
  from {
    transform: rotate(0deg) translateX(64px) rotate(0deg);
  }
  to {
    transform: rotate(360deg) translateX(64px) rotate(-360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInStagger {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== MAIN SECTION ========== */
.container {
  position: relative;
  z-index: 1;
  padding: 8px 50px 64px;
  max-width: 1280px;
  margin: 0 auto;
  background: transparent;
  animation: fadeUp 0.85s 0.12s ease both;
}

.panel-wrapper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.panel-column {
  position: relative;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 22px 16px 18px;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    0 4px 24px rgba(15, 42, 68, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  animation: fadeInStagger 0.55s ease both;
  overflow: hidden;
}

.panel-column::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  opacity: 0.85;
}

.panel-column:nth-child(1) { animation-delay: 0.15s; }
.panel-column:nth-child(2) { animation-delay: 0.25s; }
.panel-column:nth-child(3) { animation-delay: 0.35s; }
.panel-column:nth-child(4) { animation-delay: 0.45s; }

.panel-column:nth-child(2)::before {
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.panel-column:nth-child(3)::before {
  background: linear-gradient(90deg, #2a8fd4, var(--green));
}

.panel-column:nth-child(4)::before {
  background: linear-gradient(90deg, var(--black), var(--blue));
}

.panel-column:hover {
  transform: translateY(-6px);
  border-color: rgba(23, 97, 163, 0.35);
  box-shadow:
    0 18px 40px rgba(15, 42, 68, 0.14),
    0 0 0 1px rgba(23, 97, 163, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.panel-column h4 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(197, 208, 219, 0.7);
}

.panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.22s ease;
  border: 1px solid transparent;
}

.panel-item:hover {
  background: linear-gradient(
    90deg,
    rgba(23, 97, 163, 0.08) 0%,
    rgba(77, 175, 131, 0.08) 100%
  );
  border-color: rgba(23, 97, 163, 0.14);
  transform: translateX(4px);
}

.panel-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.panel-item img {
  object-fit: contain;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 8px;
  box-sizing: border-box;
  background: linear-gradient(145deg, rgba(23, 97, 163, 0.1), rgba(77, 175, 131, 0.12));
  border-radius: 10px;
  transition: all 0.22s ease;
}

.panel-item:hover img {
  transform: scale(1.08) rotate(-3deg);
  background: linear-gradient(145deg, rgba(23, 97, 163, 0.18), rgba(77, 175, 131, 0.2));
  box-shadow: 0 6px 14px rgba(23, 97, 163, 0.18);
}

.panel-item span {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
}

.panel-item:hover span {
  color: var(--blue);
}

.panel-section {
  margin-bottom: 22px;
}

.panel-section:last-child {
  margin-bottom: 0;
}

.panel-divider {
  border: none;
  border-top: 1px solid var(--gray-light);
  margin: 12px 0;
}

.panel-column a {
  display: block;
  text-decoration: none;
  color: var(--gray);
  font-size: 13px;
  margin-bottom: 8px;
  transition: 0.2s;
}

.panel-column a:hover {
  color: var(--blue);
  transform: translateX(3px);
}

.empty-recent {
  font-size: 13px;
  color: var(--gray);
  padding: 8px 10px;
  font-style: italic;
}

/* ========= PROFILE MENU ========= */
.profile-menu {
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--surface-solid);
  border: 1px solid var(--gray-mid);
  border-radius: 10px;
  min-width: 120px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease;
  z-index: 30;
}

.profile.open .profile-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-menu button {
  width: 100%;
  border: none;
  background: none;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--black);
  font-size: 14px;
  font-family: var(--font);
  border-radius: 10px;
}

.profile-menu button:hover {
  background: rgba(23, 97, 163, 0.08);
  color: var(--blue);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .panel-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }

  .header-left,
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-center {
    order: 3;
    width: 100%;
  }

  .search-wrapper {
    width: 100%;
  }

  .search-input {
    width: 100%;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 36px 16px 20px;
    min-height: auto;
    gap: 28px;
  }

  .hero-brand {
    font-size: 2.15rem;
  }

  .hero-orbit {
    width: 200px;
    height: 200px;
    margin: 0 auto;
  }

  @keyframes orbitPath1 {
    from { transform: rotate(0deg) translateX(98px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(98px) rotate(-360deg); }
  }

  @keyframes orbitPath2 {
    from { transform: rotate(0deg) translateX(72px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(72px) rotate(-360deg); }
  }

  @keyframes orbitPath3 {
    from { transform: rotate(0deg) translateX(46px) rotate(0deg); }
    to { transform: rotate(360deg) translateX(46px) rotate(-360deg); }
  }

  .container {
    padding: 8px 16px 40px;
  }

  .panel-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .container,
  .panel-column,
  .hero-brand span,
  .hero-pulse,
  .orbit-ring,
  .orbit-core,
  .orbit-sat {
    animation: none;
  }
}
