html, body {
  height: 100%;
}

html {
  font-size: 14px;
}

/* Sticky footer — content pushes footer to bottom; overflow scrolls it off screen. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* The content wrapper between nav and footer grows to fill available space. */
body > .container,
body > .container-wide {
  flex: 1;
}

/* Footer height comes from its content only — remove Bulma's generous default padding. */
.footer {
  padding: 0.75rem 1.5rem;
}

/* bulma-calendar date popup ships with a low z-index and can slip under nearby cards/controls. */
.datetimepicker {
  z-index: 50;
}

/* bulma-calendar doesn't follow the app's dark theme — paint its surfaces with the scheme vars. */
html[data-theme="dark"] .datetimepicker,
html[data-theme="dark"] .datetimepicker-container,
html[data-theme="dark"] .datepicker-body,
html[data-theme="dark"] .datetimepicker-footer,
html[data-theme="dark"] .timepicker,
html[data-theme="dark"] .datetimepicker-dummy .datetimepicker-dummy-wrapper {
  background-color: var(--bulma-scheme-main);
  color: var(--bulma-text);
}
html[data-theme="dark"] .datetimepicker-container::before,
html[data-theme="dark"] .datetimepicker-container::after {
  border-bottom-color: var(--bulma-scheme-main);
}
html[data-theme="dark"] .datepicker-date .date-item,
html[data-theme="dark"] .datepicker-dates,
html[data-theme="dark"] .datepicker-weekdays,
html[data-theme="dark"] .timepicker-input {
  color: var(--bulma-text);
}
html[data-theme="dark"] .datepicker-date .date-item:hover {
  background-color: var(--bulma-scheme-main-bis);
}
/* Selected/today day: a clear highlight so it doesn't read as greyed-out/disabled. */
html[data-theme="dark"] .datepicker-date .date-item.is-active,
html[data-theme="dark"] .datepicker-date .date-item.is-selected {
  background-color: var(--bulma-link);
  color: var(--bulma-link-invert, #fff);
  border-color: var(--bulma-link);
}
html[data-theme="dark"] .datepicker-date .date-item.is-today {
  border-color: var(--bulma-link);
  color: var(--bulma-text);
}
html[data-theme="dark"] .datepicker-date .date-item.is-disabled {
  color: var(--bulma-text-weak);
}
html[data-theme="dark"] .datetimepicker-footer,
html[data-theme="dark"] .datetimepicker-header {
  border-color: var(--bulma-border);
}
/* The closed field is bulma-calendar's read-only "dummy" input — readonly inputs get greyed in
   dark mode, so it reads as disabled. Force scheme colours + full opacity. */
html[data-theme="dark"] .datetimepicker-dummy .datetimepicker-dummy-input,
html[data-theme="dark"] input.datetimepicker-dummy-input,
html[data-theme="dark"] .input.js-datepicker {
  background-color: var(--bulma-scheme-main) !important;
  color: var(--bulma-text) !important;
  -webkit-text-fill-color: var(--bulma-text);
  border-color: var(--bulma-border) !important;
  opacity: 1 !important;
}
html[data-theme="dark"] .datetimepicker-dummy .datetimepicker-dummy-input::placeholder,
html[data-theme="dark"] .input.js-datepicker::placeholder {
  color: var(--bulma-text-weak);
  -webkit-text-fill-color: var(--bulma-text-weak);
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Navbar brand logo: swap between light and dark variants by theme */
.brand-logo-dark {
  display: none;
}

html[data-theme="dark"] .brand-logo-light {
  display: none;
}

html[data-theme="dark"] .brand-logo-dark {
  display: inline-block;
}

/* Mobile burger menu: section separator (Bulma's .navbar-divider only renders inside dropdowns)
   and a little breathing room so the stacked nav + account actions read as one connected menu. */
.navbar-mobile-sep {
  border: none;
  border-top: 1px solid var(--bulma-border-weak, #ededed);
  margin: 0.4rem 0.75rem;
}

@media screen and (max-width: 1023px) {
  .navbar-menu.is-active {
    box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1);
    padding-bottom: 0.5rem;
  }

  .navbar-menu.is-active .navbar-item {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }
}

/* Mega menu + mobile nav link colour.
   Browsers ignore var()-based colours on :visited links (a privacy protection), so Bulma's
   hsl(var(--bulma-menu-item-…)) colour only applies to UNvisited links — visited ones fall back
   to the default link blue. That made some items white and others blue depending on history.
   Pin an explicit (non-var) colour for both states so the menu reads uniformly. */
#megaMenuPanel .menu-list a,
#megaMenuPanel .menu-list a:visited,
#megaMenuPanel .menu-list button,
.navbar-start.is-hidden-desktop .navbar-item,
.navbar-start.is-hidden-desktop .navbar-item:visited {
  color: #4a4a4a;
}

html[data-theme="dark"] #megaMenuPanel .menu-list a,
html[data-theme="dark"] #megaMenuPanel .menu-list a:visited,
html[data-theme="dark"] #megaMenuPanel .menu-list button,
html[data-theme="dark"] .navbar-start.is-hidden-desktop .navbar-item,
html[data-theme="dark"] .navbar-start.is-hidden-desktop .navbar-item:visited {
  color: #dbdbdb;
}

/* Mega menu + mobile nav icon alignment: give every leading icon the same fixed width and a
   consistent gap so the labels line up in a neat column regardless of glyph width. */
#megaMenuPanel .menu-list .icon-text,
.navbar-start.is-hidden-desktop .navbar-item .icon-text {
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

#megaMenuPanel .menu-list .icon-text > .icon,
.navbar-start.is-hidden-desktop .navbar-item .icon-text > .icon {
  width: 1.25rem;
  margin: 0;
}

/* Dark theme: a *colourless* .tag.is-light renders near-invisible (Bulma's is-light light-l
   background + light-invert text both land dark). Give only the colourless variant a visible
   neutral; the coloured is-*-light tags (is-danger is-light, etc.) keep their own treatment. */
html[data-theme="dark"] .tag.is-light:not(.is-primary):not(.is-link):not(.is-info):not(.is-success):not(.is-warning):not(.is-danger):not(.is-dark):not(.is-black):not(.is-white):not(.is-text) {
  --bulma-tag-background-l: 26%;
  --bulma-tag-color-l: 86%;
}

/* Compact pending-count badge (PendingUsersBadge) — a smaller pill next to the nav label. */
.tag.is-count {
  font-size: 0.62rem;
  height: auto;
  padding: 0.1em 0.5em;
}

/* Disabled look for anchor "buttons" (<a class="button">) — anchors can't take the disabled
   attribute, so the reader card toggles this class when the device is offline. */
.button.is-disabled-link {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Data-grid pages opt into full width via ViewData["FullWidth"] (adds .container-wide). Bulma caps
   the centred .container at 1152px from the widescreen breakpoint up, leaving dead space on wide
   monitors; from >=1216px we widen it to calc(100vw - 3rem). It stays centred (margin auto), just
   wider — no misalignment, no page scroll. */
@media screen and (min-width: 1216px) {
  /* !important because Bulma's own .container rule uses a higher-specificity :not() chain that
     would otherwise keep the 1152px/1344px cap. */
  .container.container-wide {
    max-width: calc(100vw - 3rem) !important;
  }
}

/* ── Nav account trigger (avatar + email + chevron) ── */
.nav-account-trigger {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem !important;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-account-trigger:hover { background: rgba(0,0,0,0.06) !important; }
html[data-theme="dark"] .nav-account-trigger:hover { background: rgba(255,255,255,0.08) !important; }

.nav-account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-account-avatar-fallback {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.75rem;
}
html[data-theme="dark"] .nav-account-avatar-fallback {
  background: #334155;
  color: #cbd5e1;
}

.nav-account-email {
  font-size: 0.8rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4a4a4a;
}
html[data-theme="dark"] .nav-account-email { color: #dbdbdb; }

.nav-account-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #94a3b8;
}
