:root {
  --bg:  #111111;
  --s1:  #1e1e1e;
  --s2:  #282828;
  --bd:  #333333;
  --tx:  #f0f0f0;
  --mu:  #888888;
  --di:  #2e2e2e;
  --bl:  #b07cff;
  --pu:  #7c3aed;
  --re:  #ef4444;
  --or:  #f59e0b;
  --gr:  #10b981;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--tx);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: var(--bl); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ── Spinner ── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--bd);
  border-top-color: var(--bl);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ── */
.btn {
  padding: 7px 16px; border-radius: 7px;
  border: 1px solid var(--bd); background: var(--s2);
  color: var(--tx); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn:hover { border-color: var(--bl); }
.btn-primary { background: var(--pu); border-color: var(--pu); color: #fff; }
.btn-primary:hover { background: #6d28d9; border-color: #6d28d9; }

/* ── Login screen ── */
#screen-login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, #2a005a 0%, var(--bg) 65%);
}
.login-box {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 44px 40px 36px;
  text-align: center;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.login-logo { height: 60px; margin-bottom: 24px; }
.login-title { font-size: 1.25rem; font-weight: 800; color: var(--tx); margin-bottom: 8px; }
.login-sub { font-size: 0.85rem; color: var(--mu); line-height: 1.5; margin-bottom: 4px; }

/* ── Pending screen ── */
#screen-pending {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pending-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 66px;
  background: #3c0070;
  flex-shrink: 0;
}
.pending-topbar-logo { display: flex; align-items: center; gap: 12px; }
.pending-topbar-logo img { height: 40px; }
.pending-topbar-logo span {
  font-size: 0.72rem; font-weight: 700; color: rgba(255,255,255,0.5);
  letter-spacing: 0.18em; text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,0.25); padding-left: 12px;
}
.pending-scroll { flex: 1; overflow-y: auto; }
.pending-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.pending-hero {
  background: linear-gradient(135deg, #1e0a3c 0%, #180c28 100%);
  border: 1px solid #4a1a8a;
  border-radius: 16px;
  padding: 44px 40px;
  margin-bottom: 40px;
  text-align: center;
}
.pending-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(240,180,40,0.12); border: 1px solid rgba(240,180,40,0.35);
  color: #f0c040; border-radius: 20px;
  padding: 4px 14px; font-size: 0.73rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 18px;
}
.pending-hero h1 {
  font-size: 2rem; font-weight: 800; color: #fff; margin-bottom: 12px;
}
.pending-hero p {
  font-size: 0.92rem; color: rgba(255,255,255,0.65);
  line-height: 1.65; max-width: 500px; margin: 0 auto 24px;
}
.pending-info-row {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.pending-info-chip {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 6px 14px;
  font-size: 0.8rem; color: rgba(255,255,255,0.65);
}

.pending-apps-label {
  font-size: 0.78rem; font-weight: 700; color: var(--mu);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 16px;
}

/* ── Header ── */
#top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  height: 66px;
  background: #3c0070;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}
.app-logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.app-logo-img { height: 42px; width: auto; object-fit: contain; }
.app-logo-sub {
  font-size: 0.72rem; font-weight: 700; color: rgba(255,255,255,0.5);
  letter-spacing: 0.18em; text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,0.25); padding-left: 12px;
}
.sp { flex: 1; }

#user-menu-wrap { position: relative; }
#btn-user-menu {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 5px; border-radius: 8px;
  border: 1px solid transparent; background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85); font-size: 0.8rem; cursor: pointer; transition: all 0.15s;
}
#btn-user-menu:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); }
#user-name { color: #fff; }
#user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--s1); border: 1px solid var(--bd); border-radius: 8px;
  min-width: 150px; padding: 4px; box-shadow: 0 8px 28px rgba(0,0,0,0.55); z-index: 9999;
}
.udrop-item {
  display: flex; align-items: center; width: 100%; padding: 7px 10px;
  border-radius: 5px; border: none; background: transparent;
  color: var(--tx); font-size: 0.8rem; text-align: left; cursor: pointer; transition: background 0.1s;
}
.udrop-item:hover { background: var(--s2); }
.udrop-signout { color: var(--re); }
.udrop-signout:hover { background: #200808; }

.hamburger {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 7px; cursor: pointer; flex-shrink: 0; padding: 0;
}
.hamburger span { display: block; width: 18px; height: 2px; background: #fff; border-radius: 2px; transition: all 0.2s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#mobile-menu {
  position: absolute; top: 100%; left: -24px; right: -24px;
  background: #2a0050; border-bottom: 1px solid rgba(255,255,255,0.12);
  z-index: 200; display: flex; flex-direction: column;
  padding: 8px 0; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.mob-menu-divider { height: 1px; background: rgba(255,255,255,0.12); margin: 6px 0; }
.mob-menu-item {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 0.85rem; padding: 11px 20px; text-align: left;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.mob-menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.mob-signout { color: #f87171; }
.mob-signout:hover { background: rgba(248,113,113,0.1); color: #fca5a5; }

/* ── User avatar ── */
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; }
.user-avatar-initials {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--pu); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Main content ── */
#screen-app { overflow: hidden; }
#main-content { flex: 1; overflow-y: auto; padding: 28px 24px; }

/* ── Dashboard ── */
.dashboard { max-width: 1000px; margin: 0 auto; }
.welcome-row { margin-bottom: 32px; }
.welcome-heading { font-size: 1.6rem; font-weight: 800; }
.welcome-sub { font-size: 0.9rem; color: var(--mu); margin-top: 5px; }

.dash-section { margin-bottom: 36px; }
.dash-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.75rem; font-weight: 700; color: var(--mu);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 14px;
}

/* ── Action items ── */
.action-list { display: flex; flex-direction: column; gap: 10px; }
.action-item {
  display: flex; align-items: center; gap: 14px;
  background: rgba(240,180,40,0.05); border: 1px solid rgba(240,180,40,0.22);
  border-radius: 10px; padding: 14px 16px;
}
.action-item-icon { font-size: 1.6rem; flex-shrink: 0; }
.action-item-body { flex: 1; min-width: 0; }
.action-item-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 3px; }
.action-item-desc { font-size: 0.78rem; color: var(--mu); line-height: 1.45; }
.action-cta { flex-shrink: 0; white-space: nowrap; text-decoration: none; }

/* ── App grid ── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.app-card {
  background: var(--s1); border: 1px solid var(--bd);
  border-radius: 12px; display: flex; flex-direction: column;
  overflow: hidden; transition: all 0.15s;
}
.app-card:not(.app-card-locked):hover {
  border-color: #9b72cc;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.app-card-locked { opacity: 0.55; }
.app-card-header {
  display: flex; align-items: center; justify-content: center;
  height: 72px; border-bottom: 1px solid var(--bd);
}
.app-card-emoji { font-size: 2rem; }
.app-card-body { padding: 14px 14px 10px; flex: 1; }
.app-card-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; }
.app-card-desc { font-size: 0.77rem; color: var(--mu); line-height: 1.5; }
.app-card-footer { padding: 10px 14px 14px; }
.btn-app-open {
  display: block; text-align: center;
  padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--bd); background: var(--s2);
  color: var(--tx); font-size: 0.79rem; font-weight: 600;
  transition: all 0.15s; text-decoration: none;
}
.btn-app-open:hover { border-color: var(--bl); background: rgba(176,124,255,0.08); color: var(--bl); }

/* ── Mobile ── */
@media (max-width: 768px) {
  #top-bar { height: 52px; padding: 0 14px; }
  #mobile-menu { left: -14px; right: -14px; }
  .app-logo-img { height: 32px; }
  .app-logo-sub { display: none; }
  #user-menu-wrap { display: none; }
  .hamburger { display: flex; }

  .pending-topbar { height: 52px; padding: 0 14px; }
  .pending-topbar-logo img { height: 32px; }
  .pending-topbar-logo span { display: none; }
  .pending-hero { padding: 28px 20px; }
  .pending-hero h1 { font-size: 1.5rem; }

  #main-content { padding: 20px 14px; }
  .app-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .action-item { flex-wrap: wrap; }
  .action-cta { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
  .app-grid { grid-template-columns: 1fr; }
}
