/* Shared VODUM UI helpers extracted from base.html. */
.log-update {
      background: linear-gradient(
        90deg,
        rgba(99,102,241,0.12),
        rgba(99,102,241,0.02)
      );
      border-left: 3px solid rgba(99,102,241,0.6);
    }

    /* Flatpickr dark-ish theme to match VODUM */
    .flatpickr-calendar {
      background: #0b1220 !important;
      border: 1px solid rgba(148,163,184,0.18) !important;
      box-shadow: 0 12px 30px rgba(0,0,0,0.45) !important;
    }
    .flatpickr-months .flatpickr-month,
    .flatpickr-current-month,
    .flatpickr-weekdays,
    .flatpickr-day {
      color: #e2e8f0 !important;
    }
    .flatpickr-weekday {
      color: rgba(226,232,240,0.7) !important;
    }
    .flatpickr-day:hover {
      background: rgba(99,102,241,0.18) !important;
    }
    .flatpickr-day.selected,
    .flatpickr-day.startRange,
    .flatpickr-day.endRange {
      background: rgba(99,102,241,0.75) !important;
      border-color: rgba(99,102,241,0.75) !important;
    }
    .flatpickr-day.today {
      border-color: rgba(99,102,241,0.6) !important;
    }
    .flatpickr-time input,
    .flatpickr-am-pm {
      color: #e2e8f0 !important;
      background: transparent !important;
    }

    /* Flatpickr month/year dropdowns */
    .flatpickr-current-month .flatpickr-monthDropdown-months,
    .flatpickr-current-month input.cur-year {
      color: #e2e8f0 !important;
      background: #0b1220 !important;
      border: 1px solid rgba(148,163,184,0.18) !important;
      border-radius: 0.5rem !important;
    }

    .flatpickr-current-month .flatpickr-monthDropdown-months {
      -webkit-appearance: auto !important;
      -moz-appearance: auto !important;
      appearance: auto !important;
      color-scheme: dark !important;
    }

    .flatpickr-current-month .flatpickr-monthDropdown-months option {
      background: #0b1220 !important;
      color: #e2e8f0 !important;
    }

    .flatpickr-current-month .numInputWrapper span.arrowUp:after {
      border-bottom-color: #94a3b8 !important;
    }

    .flatpickr-current-month .numInputWrapper span.arrowDown:after {
      border-top-color: #94a3b8 !important;
    }

/* Mobile responsive safety */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

main {
  min-width: 0;
}

/* Portal content can contain administrator-defined names, emails and messages.
   Keep long unbroken values inside their cards at desktop and mobile widths. */
.portal-shell,
.portal-shell main,
.portal-shell section,
.portal-shell article,
.portal-shell form,
.portal-shell dl,
.portal-shell div {
  min-width: 0;
}

.portal-shell :where(h1, h2, h3, p, a, span, dt, dd, li, label) {
  overflow-wrap: anywhere;
}

.portal-shell :where(input, select, textarea) {
  min-width: 0;
  max-width: 100%;
}

.portal-shell :where(canvas, img, svg, video) {
  max-width: 100%;
}

.portal-monitoring-legend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

.vodum-navigation-loader {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 99999;
  pointer-events: none;
  overflow: hidden;
  background: rgba(99, 102, 241, 0.15);
}

.vodum-navigation-loader[hidden] { display: none; }
.vodum-navigation-loader__backdrop { display: none; }
.vodum-navigation-loader__panel { width: 100%; height: 100%; }
.vodum-navigation-loader__spinner {
  display: block;
  width: 35%;
  height: 100%;
  background: #818cf8;
  animation: vodum-navigation-progress 1.2s ease-in-out infinite;
}

@keyframes vodum-navigation-progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(386%); }
}

@media (prefers-reduced-motion: reduce) {
  .vodum-navigation-loader__spinner { animation: none; width: 100%; }
}

@media (max-width: 767px) {
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  header h1 {
    font-size: 1.05rem;
    line-height: 1.35rem;
  }

  header [type="submit"],
  header button,
  header a {
    max-width: 100%;
  }

  .grid {
    min-width: 0;
  }
}

@media (min-width: 768px) {
  #desktopSidebar {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 16rem;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  #desktopSidebar + div {
    margin-left: 16rem;
  }

  #desktopSidebar nav {
    min-height: 0;
    overscroll-behavior: contain;
  }

  .md\:flex {
    display: flex !important;
  }
}
@media (max-width: 767px) {
  body {
    width: 100%;
  }

  main,
  main > * {
    max-width: 100%;
    min-width: 0;
  }

  th,
  td,
  a,
  p,
  span,
  code,
  pre {
    overflow-wrap: anywhere;
  }

  form,
  fieldset,
  label,
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    max-width: 100%;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    width: 100%;
  }

  main .flex,
  header .flex,
  header [class*="header_actions"] {
    min-width: 0;
  }

  main .flex.gap-2:not(.flex-col),
  main .flex.gap-3:not(.flex-col),
  main .flex.gap-4:not(.flex-col),
  main .flex.items-center.justify-between:not(.flex-col),
  header .flex.gap-2:not(.flex-col),
  header .flex.gap-3:not(.flex-col),
  header .flex.items-center.justify-between:not(.flex-col) {
    flex-wrap: wrap;
  }

  button,
  [role="button"],
  .inline-flex {
    max-width: 100%;
  }

  [role="dialog"],
  .modal,
  [data-modal] {
    max-width: calc(100vw - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
  }
}

/* Mobile table readability: desktop stays visually unchanged. */
.vodum-modal-viewport {
  max-height: calc(100dvh - 2rem);
}

.vodum-modal-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.vodum-modal-close {
  position: absolute;
  inset: 0.75rem 0.75rem auto auto;
  margin: 0;
  transform: none;
}

.vodum-mobile-table-scroll {
  display: contents;
}

@media (max-width: 767px) {
  .vodum-mobile-table-scroll {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .vodum-mobile-table-scroll > table,
  main .overflow-x-auto > table {
    display: table;
    width: max-content;
    min-width: 100%;
    max-width: none;
    overflow: visible;
    table-layout: auto;
    white-space: nowrap;
  }

  .vodum-mobile-table-scroll th,
  .vodum-mobile-table-scroll td,
  main .overflow-x-auto > table th,
  main .overflow-x-auto > table td {
    white-space: nowrap;
  }

  .vodum-mobile-table-scroll td :where(p, span, a, code),
  .vodum-mobile-table-scroll th :where(p, span, a, code),
  main .overflow-x-auto > table td :where(p, span, a, code),
  main .overflow-x-auto > table th :where(p, span, a, code) {
    overflow-wrap: normal;
    word-break: normal;
  }

  main :where(.rounded-lg, .rounded-xl, .rounded-2xl, .border, .grid, .flex) {
    min-width: 0;
  }

  main :where(p, a, span, code, pre, dd, dt, li) {
    overflow-wrap: anywhere;
  }
}

/* Mobile actions/forms safety: keep desktop classes untouched. */
@media (max-width: 767px) {
  main :where(.inline-flex, .flex):not(.flex-col) {
    min-width: 0;
  }

  main :where(.inline-flex, .flex):not(.flex-col):not(.vodum-mobile-nowrap) {
    flex-wrap: wrap;
  }

  main :where(button, [role="button"], a[class*="px-"], input[type="submit"], input[type="button"]) {
    min-width: 0;
    white-space: normal;
  }

  main :where(div, section, article, form, label, button, a, select, input, textarea)[class*="min-w-"] {
    min-width: 0;
  }

  main :where(div, section, article, form, label, button, a, select, input, textarea)[class*="w-"] {
    max-width: 100%;
  }

  main :where(.fixed.inset-0, [role="dialog"], .modal, [data-modal]) {
    padding-inline: 1rem;
  }

  main :where(.fixed.inset-0 > *, [role="dialog"], .modal, [data-modal]) {
    max-width: min(100%, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
  }

  main :where(pre, code) {
    white-space: pre-wrap;
  }
}

/* Login easter egg visual: desktop uses backdrop, mobile uses poster. */
.login-visual-page {
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}

.login-visual-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #020617;
}

.login-visual-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  transform: scale(1.02);
  filter: saturate(1.08) contrast(1.05);
}

.login-visual-poster {
  display: none;
}

.login-visual-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(15, 23, 42, 0.18), rgba(2, 6, 23, 0.94) 72%),
    linear-gradient(90deg, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 0.38), rgba(2, 6, 23, 0.9));
}

.login-visual-content {
  position: relative;
  z-index: 1;
}

.login-card {
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.login-quote {
  border-left: 2px solid rgba(99, 102, 241, 0.72);
  padding-left: 0.85rem;
}

/* Log severity counters: make their click target obvious without overpowering it. */
.log-level-counter {
  --log-counter-accent: #6366f1;
}

.log-level-counter--warning {
  --log-counter-accent: #f59e0b;
}

.log-level-counter--error {
  --log-counter-accent: #ef4444;
}

.log-level-counter--critical {
  --log-counter-accent: #d946ef;
}

.log-level-counter:hover,
.log-level-counter:focus-visible {
  border-color: var(--log-counter-accent);
}

.log-level-counter:focus-visible {
  outline: 2px solid var(--log-counter-accent);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .login-visual-backdrop {
    display: none;
  }

  .login-visual-poster {
    display: block;
    object-position: center top;
    opacity: 0.36;
    transform: scale(1.04);
  }

  .login-visual-vignette {
    background:
      linear-gradient(180deg, rgba(2, 6, 23, 0.7), rgba(2, 6, 23, 0.86) 44%, rgba(2, 6, 23, 0.96)),
      radial-gradient(circle at 50% 18%, rgba(15, 23, 42, 0.05), rgba(2, 6, 23, 0.82) 70%);
  }

  .login-card {
    max-width: min(100%, 28rem);
  }
}
/* User portal settings: checks above on narrow screens, dedicated right rail on desktop. */
.portal-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "checks" "main";
  align-items: start;
  gap: 1.5rem;
  width: 100%;
}
.portal-settings-main { grid-area: main; }
.portal-settings-checks { grid-area: checks; }
.portal-readiness-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .5rem;
}
@media (min-width: 40rem) and (max-width: 79.999rem) {
  .portal-readiness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 80rem) {
  .portal-settings-layout {
    grid-template-columns: minmax(0, 56rem) minmax(20rem, 1fr);
    grid-template-areas: "main checks";
  }
  .portal-settings-checks {
    position: sticky;
    top: 1.5rem;
  }
}
@media (min-width: 105rem) {
  .portal-readiness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.monitoring-top-row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) max-content;
  align-items: center;
  gap: 1rem;
}

.monitoring-top-identity { display: contents; }

.monitoring-top-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .monitoring-top-row { gap: .75rem; padding-left: .75rem; padding-right: .75rem; }
  .monitoring-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: .75rem;
    border: 1px solid #1e293b;
    border-radius: .875rem;
    background: #0f172a;
  }
  .monitoring-tabs .monitoring-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: .625rem .5rem;
    border: 1px solid #334155;
    border-radius: .5rem;
    background: #020617;
    text-align: center;
    font-size: .875rem;
    line-height: 1.25;
  }
  .monitoring-tabs .monitoring-tab[aria-current="page"] {
    border-color: #818cf8;
    background: #312e81;
    color: #e0e7ff;
    font-weight: 600;
  }
  .monitoring-tabs .monitoring-tab:focus-visible { outline: 2px solid #818cf8; outline-offset: 2px; }
}

/* Compact account status badge in the user portal. */
.portal-account-status {
  color: #cbd5e1;
  background-color: #0f172a;
  border-color: #475569;
}
.portal-account-status[data-account-status="active"] {
  color: #86efac;
  background-color: #052e16;
  border-color: #166534;
}
.portal-account-status:is([data-account-status="pre_expired"], [data-account-status="invited"], [data-account-status="pending"]) {
  color: #fde047;
  background-color: #422006;
  border-color: #854d0e;
}
.portal-account-status[data-account-status="reminder"] {
  color: #fdba74;
  background-color: #431407;
  border-color: #9a3412;
}
.portal-account-status:is([data-account-status="expired"], [data-account-status="suspended"], [data-account-status="disabled"], [data-account-status="inactive"], [data-account-status="removed"], [data-account-status="unfriended"], [data-account-status="deleted"]) {
  color: #fca5a5;
  background-color: #450a0a;
  border-color: #991b1b;
}
