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

.animate-fadeIn {
  animation: nexarisFadeIn 0.22s ease-out;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.nexaris-admin {
  color-scheme: dark;
  background-color: #08090d;
  color: #e2e8f0;
  min-height: 100dvh;
}

html.light .nexaris-admin,
html.light .nexaris-admin input,
html.light .nexaris-admin textarea,
html.light .nexaris-admin select,
html.light .nexaris-admin button {
  color-scheme: dark;
}

#nexaris-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.nexaris-toast {
  pointer-events: auto;
  background: #0f121a;
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fde68a;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: nexarisFadeIn 0.18s ease-out;
  white-space: pre-wrap;
  word-break: break-word;
}

.nexaris-toast.is-error {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

@media (max-width: 640px) {
  #nexaris-cvss-modal [data-cvss-hero] {
    grid-template-columns: 1fr !important;
  }
  #nexaris-cvss-modal [data-cvss-metrics] {
    grid-template-columns: 1fr !important;
  }
  #nexaris-cvss-modal [data-cvss-breakdown] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* P2: readable labels, iOS input zoom, dvh, safe-area, sidebar density */
.nexaris-admin.min-h-screen,
.nexaris-admin.h-screen {
  min-height: 100dvh;
}

.nexaris-admin aside.fixed {
  top: env(safe-area-inset-top, 0px);
  bottom: 0;
  height: auto;
}

.nexaris-admin [class*="text-[8px]"],
.nexaris-admin [class*="text-[9px]"] {
  font-size: 11px !important;
  line-height: 1.35;
}

.nexaris-admin [class*="text-[10px]"] {
  font-size: 12px !important;
  line-height: 1.4;
}

.nexaris-admin aside button {
  overflow: hidden;
}
.nexaris-admin aside button > div {
  min-width: 0;
  flex: 1;
}
.nexaris-admin aside button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .nexaris-admin input,
  .nexaris-admin select,
  .nexaris-admin textarea {
    font-size: 16px !important;
  }

  .nexaris-admin,
  .nexaris-admin header,
  .nexaris-admin aside,
  .nexaris-admin button {
    -webkit-tap-highlight-color: rgba(245, 158, 11, 0.18);
    touch-action: manipulation;
  }

  .nexaris-admin header {
    padding-top: max(10px, env(safe-area-inset-top, 0px)) !important;
    min-height: 52px;
  }
  .nexaris-admin header button,
  .nexaris-admin header [class*="px-2.5"] {
    min-height: 44px;
    min-width: 44px;
  }
  .nexaris-admin header [class*="border-purple-500/30"],
  .nexaris-admin header [class*="w-7 h-7"] {
    display: none !important;
  }

  .nexaris-admin main {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .nexaris-admin main [class*="grid-cols-2"],
  .nexaris-admin main [class*="grid-cols-3"],
  .nexaris-admin main [class*="grid-cols-4"],
  .nexaris-admin main [class*="lg:grid-cols"],
  .nexaris-admin main [class*="sm:grid-cols"] {
    grid-template-columns: 1fr !important;
  }
  .nexaris-admin main [class*="overflow-x-auto"] {
    -webkit-overflow-scrolling: touch;
  }

  .nexaris-admin aside button {
    min-height: 44px;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  .nexaris-admin form button[type="submit"] {
    min-height: 44px;
    width: 100%;
  }

  .nexaris-admin [class*="flex-wrap"][class*="justify-end"] {
    width: 100%;
  }
  .nexaris-admin [class*="flex-wrap"][class*="justify-end"] > button {
    flex: 1 1 100%;
    justify-content: center;
  }

  .nexaris-admin [class*="no-scrollbar"] {
    width: 100%;
  }
  .nexaris-admin [class*="no-scrollbar"] > button {
    flex: 1 1 0;
    justify-content: center;
    min-height: 44px;
  }

  .nexaris-admin [class*="fixed"][class*="inset-0"][class*="z-[80]"] {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .nexaris-admin [class*="fixed"][class*="inset-0"][class*="z-[80]"] > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 100%) !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
  }

  #nexaris-cvss-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #nexaris-cvss-modal > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 100%);
    overflow: auto;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
  }

  #nexaris-toast-host {
    left: 12px;
    right: 12px;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
}

#nexaris-admin-dock {
  display: none;
}

@media (max-width: 767px) {
  #nexaris-admin-dock {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    background: #0a0c12;
    border-top: 1px solid #1e2536;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    gap: 2px;
  }
  #nexaris-admin-dock button {
    flex: 1;
    min-height: 48px;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    border-radius: 10px;
  }
  #nexaris-admin-dock button.is-active {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
  }
  #nexaris-admin-dock svg {
    width: 20px;
    height: 20px;
  }
}
