:root {
  --navy-950: #07111f;
  --navy-900: #0b192b;
  --navy-850: #102239;
  --navy-800: #17304c;
  --surface: rgba(15, 32, 53, 0.88);
  --surface-hover: rgba(19, 42, 68, 0.96);
  --line: rgba(164, 190, 220, 0.14);
  --line-strong: rgba(96, 165, 250, 0.38);
  --text: #f4f8fc;
  --text-secondary: #a8b8ca;
  --text-muted: #718399;
  --blue: #45a7ff;
  --blue-strong: #397af5;
  --cyan: #33c4e8;
  --green: #35d39a;
  --violet: #a78bfa;
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow: 0 20px 60px rgba(0, 7, 18, 0.28);
}

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

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 4%, rgba(48, 161, 255, 0.11), transparent 28rem),
    radial-gradient(circle at 88% 78%, rgba(68, 89, 240, 0.08), transparent 32rem),
    var(--navy-950);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

.admin-gif-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: var(--navy-950);
  pointer-events: none;
}

.admin-gif-background::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    radial-gradient(circle at 12% 4%, rgba(48, 161, 255, 0.1), transparent 28rem),
    linear-gradient(180deg, rgba(7, 17, 31, 0.56), rgba(7, 17, 31, 0.78));
  content: '';
}

.admin-gif-background .tenor-gif-embed {
  position: absolute !important;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: max(100vw, calc(var(--admin-gif-aspect-ratio, 1.76596) * 100vh)) !important;
  max-width: none !important;
  min-width: 100vw;
  min-height: 100vh;
  opacity: 0.48;
  transform: translate(-50%, -50%);
}

.admin-gif-background iframe {
  width: 100% !important;
  height: 100% !important;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.navbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 31, 0.86);
  box-shadow: 0 8px 30px rgba(0, 7, 18, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand-container {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.brand-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: linear-gradient(145deg, #3db9f3, #4f61e8);
  box-shadow: 0 8px 24px rgba(51, 151, 244, 0.25);
  color: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.company-name {
  color: #fff;
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.35px;
}

.product-name {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.nav-actions,
.user-profile-badge,
.admin-console-link {
  display: flex;
  align-items: center;
}

.nav-actions {
  gap: 12px;
}

.admin-console-link {
  height: 38px;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.1);
  color: #d8ccff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.admin-console-link[hidden] {
  display: none;
}

.admin-console-link:hover {
  border-color: rgba(167, 139, 250, 0.54);
  background: rgba(139, 92, 246, 0.17);
  transform: translateY(-1px);
}

.admin-console-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.user-profile-badge {
  min-height: 40px;
  gap: 9px;
  padding: 4px 6px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.user-avatar {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #22557d, #263e67);
  color: #dcecff;
  font-size: 11px;
  font-weight: 800;
}

.user-email-text {
  max-width: 245px;
  overflow: hidden;
  color: #eaf2fb;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-pill.admin {
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(139, 92, 246, 0.13);
  color: #cdbdff;
}

.role-pill.user {
  border: 1px solid rgba(69, 167, 255, 0.28);
  background: rgba(69, 167, 255, 0.11);
  color: #8ac7ff;
}

.btn-logout {
  height: 29px;
  padding: 0 9px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease;
}

.btn-logout:hover {
  color: #ff8791;
}

.container {
  width: 100%;
  max-width: 1260px;
  flex: 1;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) 26px 84px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.application-directory {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

.directory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  display: block;
  margin-bottom: 4px;
  color: #72bfff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.directory-header h2 {
  color: #f7faff;
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.application-search {
  display: flex;
  width: min(100%, 330px);
  height: 42px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid rgba(164, 190, 220, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.application-search:focus-within {
  border-color: rgba(69, 167, 255, 0.55);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 3px rgba(69, 167, 255, 0.1);
}

.application-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.application-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 500 13px var(--font-body);
}

.application-search input::placeholder {
  color: var(--text-muted);
}

.directory-layout {
  display: grid;
  min-height: 440px;
  grid-template-columns: 228px minmax(0, 1fr);
}

.category-navigation {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: transparent;
}

.category-button {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.category-button:hover {
  background: rgba(255, 255, 255, 0.045);
  color: #e5eef8;
}

.category-button:focus-visible {
  outline: 2px solid rgba(69, 167, 255, 0.65);
  outline-offset: 1px;
}

.category-button.active {
  background: rgba(69, 167, 255, 0.1);
  box-shadow: inset 3px 0 #45a7ff;
  color: #a9d7ff;
}

.apps-directory {
  min-width: 0;
  padding: 12px 26px 30px;
}

.application-group {
  padding-top: 20px;
}

.application-group + .application-group {
  margin-top: 7px;
}

.application-group-title {
  margin-bottom: 9px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.application-list {
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.application-row {
  display: grid;
  min-height: 68px;
  align-items: center;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 10px 10px 10px 4px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.application-row:hover,
.application-row:focus-visible {
  background: rgba(69, 167, 255, 0.055);
  box-shadow: inset 3px 0 rgba(69, 167, 255, 0.72);
  outline: none;
}

.app-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--icon-border, rgba(69, 167, 255, 0.26));
  border-radius: 10px;
  background: var(--icon-bg, rgba(69, 167, 255, 0.11));
  color: var(--icon-color, #73beff);
}

.app-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.application-row[data-tone='cyan'] {
  --icon-bg: rgba(51, 196, 232, 0.1);
  --icon-border: rgba(51, 196, 232, 0.26);
  --icon-color: #67d8ee;
  --app-glow: rgba(51, 196, 232, 0.1);
}

.application-row[data-tone='violet'] {
  --icon-bg: rgba(167, 139, 250, 0.1);
  --icon-border: rgba(167, 139, 250, 0.27);
  --icon-color: #c3b4ff;
  --app-glow: rgba(139, 92, 246, 0.1);
}

.application-row[data-tone='green'] {
  --icon-bg: rgba(53, 211, 154, 0.09);
  --icon-border: rgba(53, 211, 154, 0.24);
  --icon-color: #68deaf;
  --app-glow: rgba(53, 211, 154, 0.09);
}

.application-row[data-tone='amber'] {
  --icon-bg: rgba(245, 171, 53, 0.1);
  --icon-border: rgba(245, 171, 53, 0.27);
  --icon-color: #f5c56f;
  --app-glow: rgba(245, 171, 53, 0.09);
}

.application-name {
  overflow: hidden;
  color: #f6f9fd;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.application-open {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  transition: color 150ms ease;
}

.application-open svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.application-row:hover .application-open,
.application-row:focus-visible .application-open {
  color: #8ac8ff;
}

.empty-state {
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 50px 24px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state span {
  font-size: 12px;
}

@media (max-width: 960px) {
  .user-email-text {
    display: none;
  }

  .directory-layout {
    grid-template-columns: 196px minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .navbar {
    min-height: 68px;
    padding: 10px 16px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .product-name,
  .role-pill,
  .user-avatar {
    display: none;
  }

  .admin-console-link {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .admin-console-link span {
    display: none;
  }

  .user-profile-badge {
    min-height: 38px;
    padding-left: 3px;
  }

  .btn-logout {
    border-left: 0;
  }

  .container {
    padding: 24px 16px 58px;
  }

  .directory-header {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
  }

  .application-search {
    width: 100%;
    max-width: none;
  }

  .directory-layout {
    display: block;
    min-height: 0;
  }

  .category-navigation {
    overflow-x: auto;
    align-items: center;
    flex-direction: row;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }

  .category-navigation::-webkit-scrollbar {
    display: none;
  }

  .category-button {
    width: auto;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid transparent;
    white-space: nowrap;
  }

  .category-button.active {
    border-color: rgba(69, 167, 255, 0.24);
    box-shadow: none;
  }

  .apps-directory {
    padding: 4px 16px 24px;
  }

  .application-row {
    min-height: 64px;
    padding-right: 4px;
  }

  .application-open span {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  .admin-gif-background {
    display: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
