:root {
  /* 1. Typography */
  --bulma-family-primary: "Qualion", sans-serif;
  --bulma-family-secondary: "Qualion", sans-serif;
  --bulma-weight-light: 300;
  --bulma-weight-normal: 400;
  --bulma-weight-medium: 500;
  --bulma-weight-semibold: 600;
  --bulma-weight-bold: 600;
  --bulma-weight-extrabold: 700;

  /* 2. Core colour scheme (DeepSeer Deep Purple) */
  --bulma-scheme-h: 249;
  --bulma-scheme-s: 49%;
  --bulma-scheme-l: 27%;

  /* Primary (DeepSeer Deep Purple) */
  --bulma-primary-h: var(--bulma-scheme-h);
  --bulma-primary-s: var(--bulma-scheme-s);
  --bulma-primary-l: var(--bulma-scheme-l);
  --bulma-primary-invert-l: 96%;

  /* Link (DeepSeer Inky Blue) */
  --bulma-link-h: 226;
  --bulma-link-s: 94%;
  --bulma-link-l: 45%;

  /* Info (DeepSeer Blue) */
  --bulma-info-h: 215;
  --bulma-info-s: 96%;
  --bulma-info-l: 49%;
  --bulma-info-invert-l: 96%;

  /* Success (DeepSeer Green) */
  --bulma-success-h: 162;
  --bulma-success-s: 86%;
  --bulma-success-l: 52%;

  /* Warning (DeepSeer Yellow) */
  --bulma-warning-h: 36;
  --bulma-warning-s: 98%;
  --bulma-warning-l: 65%;

  /* Danger (DeepSeer Red) */
  --bulma-danger-h: 0;
  --bulma-danger-s: 100%;
  --bulma-danger-l: 70%;
  --bulma-danger-invert-l: 96%;

  /* 4. Border radius (bigger, softer corners) */
  --bulma-radius-small: 0.5rem;
  --bulma-radius: 1rem;
  --bulma-radius-medium: 1rem;
  --bulma-radius-large: 1.5rem;

  --ds-mint: hsl(162 86% 52%);
  --ds-blue: hsl(215 96% 49%);
  --ds-accent-gradient: linear-gradient(90deg, var(--ds-mint), var(--ds-blue));

  /* Soft elevation tuned to the deep-purple scheme. */
  --ds-shadow:
    0 1px 2px hsl(249 30% 20% / 0.06), 0 6px 20px hsl(249 30% 25% / 0.07);
  --ds-shadow-hover: 0 10px 30px hsl(249 40% 22% / 0.14);
}

html {
  /* Prevent browsers from resizing text automatically */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.navbar.is-primary {
  position: sticky;
  top: 0;
  z-index: 30;
  transition: transform 0.3s ease;
}

/* Hidden on scroll-down, slid back in on scroll-up (see static/js/navbar.js). */
.navbar.is-primary.navbar--hidden {
  transform: translateY(-100%);
}

.navbar .navbar-dropdown {
  border-radius: 0 0 var(--bulma-radius-small) var(--bulma-radius-small);
  border-top: none;
}

.navbar.is-primary .navbar-dropdown,
.navbar.is-primary .navbar-dropdown a.navbar-item {
  background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), 20%);
  color: var(--bulma-white);
}

.navbar.is-primary .navbar-dropdown .icon-text {
  flex-wrap: nowrap;
}

.navbar.is-primary a.navbar-item:hover,
.navbar.is-primary a.navbar-item:focus,
.navbar.is-primary .navbar-link:hover,
.navbar.is-primary .navbar-link:focus {
  background-color: hsla(0, 0%, 100%, 0.12);
  color: var(--bulma-white);
}

.navbar.is-primary .navbar-dropdown a.navbar-item:hover,
.navbar.is-primary .navbar-dropdown a.navbar-item:focus {
  background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), 30%);
  color: var(--bulma-white);
}

.navbar.is-primary .navbar-dropdown .navbar-divider {
  background-color: hsla(0, 0%, 100%, 0.22);
  margin: 0.5rem 0;
}

/* Cookie consent banner (see consent.js) */
.cookie-consent[hidden] {
  display: none;
}

.notification.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}

.cookie-consent .container {
  row-gap: 0.5rem;
}

/* Message toasts (see messages_toast.html) */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: calc(100% - 2rem);
  max-width: 22rem;
}

/* lift the toasts clear of the cookie consent bar while it is visible */
body:has(#cookie-consent:not([hidden])) .toast-container {
  bottom: 5.5rem;
}

.toast-container .notification {
  margin-bottom: 0;
  box-shadow: 0 0.5em 1em -0.125em rgba(10, 10, 10, 0.2);
  transition: opacity 0.4s ease;
}

.toast-container .notification.toast--leaving {
  opacity: 0;
}

/* Auth pages (allauth entrance layout) */
.auth-logo {
  height: 48px;
}

.auth-card {
  width: 100%;
  max-width: 26rem;
}

/* --- Branded page header band --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--bulma-border-weak, #ededed);
}

.page-header .page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bulma-link);
  margin-bottom: 0.35rem;
}

/* A thin gradient hairline for brand flavour under section headers etc. */
.brand-rule {
  height: 3px;
  width: 2.5rem;
  border-radius: 999px;
  background-image: var(--ds-accent-gradient);
}

/* --- Elevated surfaces --- */
.box {
  box-shadow: var(--ds-shadow);
  border: 1px solid var(--bulma-border-weak, #f0f0f0);
}

a.box,
.box-link {
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

a.box:hover,
.box-link:hover {
  transform: translateY(-3px);
  box-shadow: var(--ds-shadow-hover);
  border-color: hsl(
    var(--bulma-link-h) var(--bulma-link-s) var(--bulma-link-l) / 0.4
  );
}

/* --- Stat cards (KPI strip) --- */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-image: var(--ds-accent-gradient);
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--bulma-text-weak, #7a7a7a);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

/* --- Footer bottom bar: copied directly from deepseer.ai (.footer-bottom) --- */
.footer-bottom {
  background: #211a4d;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-family: "Qualion", sans-serif;
}

.footer-bottom__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
}

.footer-bottom a {
  margin-left: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: #fff;
  text-decoration: underline;
}

.has-background-inky-purple {
  background-color: #402cbf;
}

/* DeepSeer Inky Blue -> DeepSeer Red */
.has-background-gradient-red {
  background-image: linear-gradient(45deg, #ff6666, #073ae0);
}

/* DeepSeer Inky Blue -> DeepSeer Green */
.has-background-gradient-green {
  background-image: linear-gradient(45deg, #1aeeae, #073ae0);
}

/* DeepSeer Inky Blue -> DeepSeer Soft Pink */
.has-background-gradient-pink {
  background-image: linear-gradient(45deg, #ffcccc, #073ae0);
}

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 1rem;
}

.gap-4 {
  gap: 1.5rem;
}

.gap-5 {
  gap: 3rem;
}

.is-absolute {
  position: absolute;
}

.overflow-visible {
  overflow: visible;
}

.overflow-auto {
  overflow: auto;
}

.plotly-container {
  overflow-x: auto;
}

.plotly-body {
  min-width: 560px;
}

.width-fill {
  width: max-content;
  min-width: 100%;
}

.dropdown.is-focusable:focus-within .dropdown-menu {
  display: block;
}

.fullwidth {
  width: 100%;
}

.fullheight {
  height: 100%;
}

.rotate {
  display: inline-block;
  animation: spinner 1.5s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.hx-indicator::before {
  content: " ";
  width: 0.75em;
  height: 0.75em;
}

.hx-indicator.htmx-request::before {
  border: 1px solid var(--bulma-primary-bold);
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.narrative-node:hover {
  background-color: var(--bulma-text-soft);
  transition: transform 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.narrative-node:has(input:checked) {
  background-color: var(--bulma-primary-soft);
  transition: transform 0.2s;
  text-decoration: none;
  cursor: pointer;
}

.text-nowrap {
  white-space: nowrap;
}

.border-none {
  border: none !important;
}

.sigma-renderer {
  aspect-ratio: 16/9;
}

.sigma-overlay:fullscreen .sigma-renderer {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
}

.sigma-overlay-actions {
  z-index: 20;
  position: absolute;
  top: 0;
  left: 0;
  padding: 1em;
  display: flex;
  gap: 0.5em;
}

.sigma-overlay-communities {
  z-index: 20;
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 1em;
  overflow: auto;
  max-height: 100%;
}

.sigma-overlay-settings {
  z-index: 30;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1em;
  overflow: auto;
  max-height: 100%;
  background: var(--bulma-background);
}

.sigma-node-details-container {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
}

.sigma-node-details {
  max-width: 240px;
  max-height: 100%;
  overflow: auto;
  z-index: 3;
  word-break: break-word;
}

.chart-container {
  aspect-ratio: 16/9;
  width: 100%;
}

body {
  min-height: 100vh;
}

.autocomplete .dropdown-content {
  max-height: 50vh;
}

.autocomplete .textarea {
  cursor: text;
  overflow: auto;
}

.autocomplete .textarea .input {
  width: auto;
  border: none;
  outline: none;
  box-shadow: none;
  height: 2em;
}

.is-editable {
  position: relative;
}

.is-editable .box {
  margin-bottom: -0.25rem;
}

.is-editable a:last-of-type {
  --bulma-button-text-decoration: none;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.inline-checkboxes div {
  height: 100%;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.custom-icon {
  vertical-align: -0.4em;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.stats > *:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  background: #ccc;
  margin: 0 0.25rem;
  vertical-align: middle;
}

.wrap-anywhere {
  overflow-wrap: anywhere;
}

.card-header.is-hoverable:hover {
  cursor: pointer;
  background-color: var(--bulma-background-hover);
}

/* Stretch the dashboard layout so the sidebar rail runs the full height down
   to the footer, even on short pages. Scoped to pages that have a real
   `.sidebar` so auth / legal pages are untouched. */
main:has(.sidebar) {
  display: flex;
}

main:has(.sidebar) > .sidebar-container {
  flex: 1;
  min-width: 0;
}

.sidebar-container {
  display: flex;
}

/* The `.sidebar-container > .container` flex rule keeps wide tables / Plotly in
   the content column from overflowing. */
.sidebar-container > .container {
  flex: 1 1 0;
  min-width: 0;
}

/* Sidebar rail: no fill - lifted off the white content by a soft right-edge
   shadow. Full height comes from main:has(.sidebar) above. */
.sidebar {
  overflow-x: auto;
  width: 16rem;
  flex-shrink: 0;
  box-shadow: 6px 0 18px -8px hsl(249 30% 20% / 0.18);
  position: relative;
  z-index: 2;
}

.sidebar.is-toggled {
  display: none;
}

@media (max-width: 1024px) {
  .sidebar-container {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .sidebar.is-toggled {
    display: block;
    width: 100%;
    box-shadow: none;
    border-bottom: 1px solid var(--bulma-border-weak, #ededed);
  }
}

.white-space-pre-wrap {
  white-space: pre-wrap;
}

.modal.is-large .modal-content {
  width: 90vw;
  max-height: 80vh;
}

table > thead.is-sticky {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--bulma-scheme-main-ter);
}

@media (max-width: 1024px) {
  .navbar.is-primary .navbar-item.has-dropdown .navbar-dropdown {
    overflow: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
    opacity: 0;
    transition:
      max-height var(--bulma-duration) ease,
      padding var(--bulma-duration) ease,
      opacity var(--bulma-duration) ease;
  }

  .navbar.is-primary .navbar-item.has-dropdown.is-active .navbar-dropdown {
    max-height: 30rem;
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    opacity: 1;
  }

  .navbar.is-primary .navbar-item.has-dropdown .navbar-link::after {
    transition: transform var(--bulma-duration) ease;
  }

  .navbar.is-primary .navbar-item.has-dropdown.is-active .navbar-link::after {
    transform: rotate(135deg);
  }

  /* Bulma toggles the menu with display:none/block, which can't animate, so
       keep it in layout and drive height/opacity instead. */
  .navbar.is-primary .navbar-menu {
    display: block;
    overflow: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    transition:
      max-height var(--bulma-duration) ease,
      padding var(--bulma-duration) ease,
      opacity var(--bulma-duration) ease;
  }

  .navbar.is-primary .navbar-menu.is-active {
    max-height: calc(100vh - var(--bulma-navbar-height));
    overflow: auto;
    overscroll-behavior: contain;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    opacity: 1;
  }

  .navbar.is-primary .navbar-brand .fa-chevron-down {
    transition: transform var(--bulma-duration) ease;
  }

  .navbar.is-primary:has(.navbar-menu.is-active)
    .navbar-brand
    .fa-chevron-down {
    transform: rotate(180deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .navbar.is-primary,
  .navbar.is-primary .navbar-item.has-dropdown .navbar-dropdown {
    transition: none;
  }
}

.navbar.is-primary .navbar-dropdown,
.navbar.is-primary .navbar-dropdown .navbar-item {
  background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), 20%);
  color: var(--bulma-white);
}

.navbar.is-primary .navbar-dropdown a.navbar-item:hover {
  background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), 30%);
}

/* Active tab: white underline on the selected entry, or on a dropdown trigger whose menu
   holds the active item (not on the dropdown items themselves, or in the mobile menu). */
.navbar-item.active,
.navbar-link.active,
.navbar-item.has-dropdown:has(.navbar-dropdown .navbar-item.active)
  > .navbar-link {
  box-shadow: inset 0 -3px 0 #fff;
  font-weight: var(--bulma-weight-semibold);
}

.navbar.is-primary .navbar-dropdown a.navbar-item.active {
  box-shadow: none;
}

/* Avatar fills the standard navbar .icon box (so it aligns with icon+text entries); square -> circle. */
.navbar .navbar-link .navbar-user-avatar {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
}

/* Mobile menu: show group-separator dividers (Bulma hides them off-dropdown) and lay rows out
   as centred flex lines so glyph and avatar entries align. */
@media screen and (max-width: 1023px) {
  .navbar.is-primary .navbar-menu .navbar-divider {
    display: block;
    height: 1px;
    margin: 0.6rem 1rem;
    background-color: hsla(0, 0%, 100%, 0.12);
  }

  .navbar.is-primary .navbar-menu .navbar-item {
    border-radius: var(--bulma-radius-small);
  }

  /* Leaf links + dropdown triggers only -- not has-dropdown containers, which must stack. */
  .navbar.is-primary .navbar-menu a.navbar-item,
  .navbar.is-primary .navbar-menu .navbar-link {
    display: flex;
    align-items: center;
  }

  /* The underline indicator looks wrong in the stacked mobile menu. */
  .navbar-item.active,
  .navbar-link.active,
  .navbar-item.has-dropdown:has(.navbar-dropdown .navbar-item.active)
    > .navbar-link {
    box-shadow: none;
  }
}

/* LLM Intelligence: utility classes replacing static inline styles (djlint H021). */
.report-chart {
  min-height: 500px;
}

.report-chart-sm {
  min-height: 300px;
}

.report-chart-fixed {
  height: 500px;
}

.is-h-full {
  height: 100%;
}

.is-w-full {
  width: 100%;
}

.scroll-y-480 {
  max-height: 480px;
  overflow: auto;
}

.scroll-y-300 {
  max-height: 300px;
  overflow: auto;
}

.scroll-y-32 {
  max-height: 32rem;
  overflow: auto;
}

.scroll-y-24 {
  max-height: 24rem;
  overflow: auto;
}

.is-struck {
  text-decoration: line-through;
  opacity: 0.5;
}

.tag.is-vivid-positive {
  background-color: #00c951;
}

.tag.is-vivid-negative {
  background-color: #fb2c36;
}

.tag.is-vivid-neutral {
  background-color: #ffdf20;
}

.log-pre {
  height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Sticky save dock (_usage_bar.html); sits under the navbar (z-index 30). */
.usage-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
}
