@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 [class*="md:ml-72"] {
    max-width: 100%;
    overflow-x: hidden;
    padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  }
  .nexaris-admin main {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
    overflow-x: hidden;
  }
  .nexaris-admin main *:not(table):not(thead):not(tbody):not(tr):not(th):not(td) {
    min-width: 0;
  }
  .nexaris-admin main [class*="grid"] > * {
    max-width: 100%;
  }
  .nexaris-admin main p,
  .nexaris-admin main [class*="leading-relaxed"] {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .nexaris-admin main [class*="truncate"] {
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
    word-break: break-word;
  }
  .nexaris-admin main table {
    width: max-content !important;
    min-width: 720px !important;
    max-width: none !important;
    table-layout: auto !important;
  }
  .nexaris-admin main table,
  .nexaris-admin main table * {
    min-width: auto !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
  .nexaris-admin main table th,
  .nexaris-admin main table td {
    white-space: nowrap !important;
    max-width: none !important;
  }
  .nexaris-admin main table [class*="truncate"] {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    word-break: normal !important;
    max-width: 200px;
    display: inline-block;
    vertical-align: bottom;
  }
  .nexaris-admin main [class*="justify-between"] {
    flex-wrap: wrap !important;
    gap: 6px;
    max-width: 100%;
  }
  .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*="bg-[#090b10]"][class*="items-end"] {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    overflow: visible !important;
    gap: 0 !important;
  }
  .nexaris-admin [class*="bg-[#090b10]"][class*="items-end"] > button {
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    white-space: nowrap !important;
    min-height: 48px !important;
    overflow: hidden;
  }
  .nexaris-admin [class*="bg-[#090b10]"][class*="items-end"] > button > span {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .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;
  }

  /* Inspect: source snippet window */
  .nexaris-admin [class*="rounded-t-lg"][class*="bg-[#090b10]"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .nexaris-admin [class*="rounded-t-lg"][class*="bg-[#090b10]"] .max-w-xs,
  .nexaris-admin [class*="rounded-t-lg"][class*="bg-[#090b10]"] [class*="max-w-xs"] {
    max-width: 100% !important;
  }
  .nexaris-admin pre {
    min-width: 0 !important;
    max-width: 100%;
    white-space: pre-wrap !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .nexaris-admin [class*="max-h-52"] {
    min-width: 0;
    overflow-x: hidden !important;
  }
  .nexaris-admin [class*="border-l-4"][class*="border-l-amber-400"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .nexaris-admin [class*="border-l-4"][class*="border-l-amber-400"] > span:first-child {
    white-space: nowrap;
  }
}

#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;
  }
}
