* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  color-scheme: dark;
  --bg: #090d18;
  --bg-2: #0d1425;
  --card: rgba(16, 25, 45, .72);
  --card-strong: rgba(21, 32, 56, .9);
  --card-hover: rgba(31, 46, 80, .82);
  --fg: #f5f7fb;
  --fg-soft: #c8d1e6;
  --fg-dim: #8792ad;
  --accent: #8ea7ff;
  --accent-2: #c084fc;
  --accent-3: #41e6c4;
  --danger: #ff6b8a;
  --border: rgba(255, 255, 255, .105);
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body {
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(142, 167, 255, .22), transparent 32rem),
    radial-gradient(circle at 88% 12%, rgba(192, 132, 252, .16), transparent 28rem),
    radial-gradient(circle at 50% 105%, rgba(65, 230, 196, .1), transparent 34rem),
    linear-gradient(140deg, #070a13 0%, #0b1020 42%, #11192b 100%);
}

button,
input {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(16px);
  opacity: .52;
  z-index: 0;
}

.ambient-one {
  width: 34rem;
  height: 34rem;
  top: -18rem;
  right: -12rem;
  background: radial-gradient(circle, rgba(142, 167, 255, .22), transparent 67%);
}

.ambient-two {
  width: 28rem;
  height: 28rem;
  left: -13rem;
  bottom: -16rem;
  background: radial-gradient(circle, rgba(65, 230, 196, .16), transparent 64%);
}

.glass-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .035));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.eyebrow,
.card-kicker {
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.muted {
  color: var(--fg-dim);
}

/* ─── Login ───────────────────────────────────────────────────── */
.login-page {
  display: grid;
  place-items: center;
  padding: max(24px, var(--safe-top)) 20px max(24px, var(--safe-bottom));
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .72fr);
  gap: 22px;
  align-items: stretch;
}

.login-hero,
.login-card {
  border-radius: var(--radius-xl);
}

.login-hero {
  position: relative;
  min-height: 520px;
  padding: clamp(34px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(135deg, rgba(142, 167, 255, .18), rgba(192, 132, 252, .08) 46%, rgba(65, 230, 196, .1)),
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: auto auto -38% -10%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142, 167, 255, .2), transparent 68%);
}

.login-hero h1 {
  position: relative;
  margin-top: 22px;
  max-width: 8ch;
  font-size: clamp(56px, 10vw, 118px);
  line-height: .86;
  letter-spacing: -.08em;
}

.login-hero p {
  position: relative;
  max-width: 520px;
  margin-top: 24px;
  color: var(--fg-soft);
  font-size: clamp(17px, 2vw, 21px);
}

.login-highlights {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.login-highlights span,
.tag,
.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .06);
  color: var(--fg-soft);
  border-radius: 999px;
}

.login-highlights span {
  padding: 9px 12px;
  font-size: 13px;
}

.login-card {
  width: 100%;
  padding: clamp(24px, 4vw, 34px);
  align-self: center;
}

.login-card h2 {
  margin-top: 10px;
  font-size: 34px;
  letter-spacing: -.04em;
}

.login-card .muted {
  margin: 8px 0 24px;
}

.gh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  text-decoration: none;
}

.gh-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  font-size: 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 18px;
  color: var(--fg-dim);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.field {
  display: block;
  margin-bottom: 12px;
  text-align: left;
}

.field span,
.search-box span {
  display: block;
  margin: 0 0 7px 2px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.input,
.search-box input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(4, 8, 18, .5);
  color: var(--fg);
  outline: none;
  padding: 0 16px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.input::placeholder,
.search-box input::placeholder {
  color: rgba(200, 209, 230, .42);
}

.input:focus,
.search-box input:focus {
  border-color: rgba(142, 167, 255, .72);
  box-shadow: 0 0 0 4px rgba(142, 167, 255, .12);
  background: rgba(7, 12, 24, .72);
}

.primary {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #8ea7ff 0%, #a987ff 52%, #41e6c4 130%);
  color: #07101e;
  font-weight: 850;
  letter-spacing: -.01em;
  box-shadow: 0 16px 34px rgba(82, 109, 255, .24);
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.primary:hover {
  filter: brightness(1.06);
}

.primary:active {
  transform: translateY(1px) scale(.99);
}

.primary:disabled {
  opacity: .58;
  cursor: wait;
}

.error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 107, 138, .13);
  border: 1px solid rgba(255, 107, 138, .26);
  color: #ffd4dd;
  font-size: 14px;
}

/* ─── Dashboard ───────────────────────────────────────────────── */
.dashboard-page {
  padding: max(16px, var(--safe-top)) 16px max(26px, var(--safe-bottom));
}

.dash-header,
.dash-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin-inline: auto;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 28px);
  border-radius: 24px;
}

.dash-header h1 {
  margin-top: 4px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: -.055em;
}

.hello {
  margin-top: 8px;
  color: var(--fg-dim);
}

.logout {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: var(--fg-soft);
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.logout:hover {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .18);
}

.logout:active {
  transform: scale(.98);
}

.dash-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 230px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  background:
    radial-gradient(circle at 18% 16%, rgba(142, 167, 255, .2), transparent 36%),
    radial-gradient(circle at 78% 18%, rgba(65, 230, 196, .12), transparent 28%);
  pointer-events: none;
}

.hero-copy,
.hero-meta {
  position: relative;
}

.hero-copy h2 {
  max-width: 760px;
  margin-top: 10px;
  font-size: clamp(32px, 5.8vw, 64px);
  line-height: .94;
  letter-spacing: -.07em;
}

.hero-copy p {
  max-width: 650px;
  margin-top: 16px;
  color: var(--fg-soft);
  font-size: 17px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
}

.hero-meta div {
  min-width: 104px;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(5, 10, 22, .34);
}

.hero-meta strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -.04em;
}

.hero-meta span {
  display: block;
  margin-top: 7px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 16px;
  border-radius: 24px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.chip {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 750;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.chip:hover {
  background: rgba(255, 255, 255, .09);
}

.chip.active {
  background: rgba(142, 167, 255, .18);
  border-color: rgba(142, 167, 255, .44);
  color: var(--fg);
}

.chip:active {
  transform: scale(.98);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.app-card {
  position: relative;
  grid-column: span 4;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 20px;
  text-decoration: none;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.028)),
    rgba(16, 25, 45, .62);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .25);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.app-card.featured {
  grid-column: span 6;
  min-height: 220px;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: rgba(142, 167, 255, .36);
  background:
    linear-gradient(145deg, rgba(142, 167, 255, .12), rgba(255,255,255,.035)),
    var(--card-hover);
  box-shadow: 0 24px 58px rgba(0, 0, 0, .34);
}

.app-card:active {
  transform: translateY(-1px) scale(.992);
}

.app-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142, 167, 255, .18), transparent 67%);
  transition: opacity .18s ease, transform .18s ease;
}

.app-card:hover .app-glow {
  opacity: 1;
  transform: scale(1.14);
}

.app-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: 25px;
  line-height: 1;
}

.tag {
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-card h3 {
  position: relative;
  margin-top: auto;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1;
  letter-spacing: -.045em;
}

.app-card p {
  position: relative;
  margin-top: 10px;
  max-width: 34ch;
  color: var(--fg-dim);
  font-size: 14px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, .16);
  border-radius: var(--radius-lg);
  color: var(--fg-dim);
  background: rgba(255, 255, 255, .035);
}

@media (max-width: 980px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 380px;
  }

  .hero-panel,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .hero-meta,
  .chips {
    justify-content: stretch;
  }

  .hero-meta {
    grid-template-columns: repeat(3, 1fr);
  }

  .chips {
    justify-content: flex-start;
  }

  .app-card,
  .app-card.featured {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .dashboard-page {
    padding-inline: 12px;
  }

  .dash-header {
    align-items: flex-start;
    border-radius: 22px;
  }

  .logout {
    min-height: 38px;
    padding-inline: 13px;
  }

  .hero-panel {
    min-height: auto;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card,
  .app-card.featured {
    grid-column: auto;
    min-height: 176px;
  }

  .login-page {
    place-items: stretch;
  }

  .login-shell {
    align-self: center;
  }

  .login-hero {
    min-height: 320px;
    border-radius: 26px;
  }

  .login-card {
    border-radius: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
