/*
Bootstrap theme overrides.
Customize these tokens to apply project-wide brand colors and fonts.
*/
@font-face {
  font-family: "Ubuntu";
  src: url("../vendor/ubuntu/Ubuntu-Light.025b624d20d5.ttf") format("truetype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu";
  src: url("../vendor/ubuntu/Ubuntu-Regular.b3488e8486d2.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu";
  src: url("../vendor/ubuntu/Ubuntu-Medium.335cc443917a.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Ubuntu";
  src: url("../vendor/ubuntu/Ubuntu-Bold.d0fc30856a54.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Bootstrap 5 / Jaustukas theme colours (Figma) */
  --bs-primary: #3c71f7;
  --bs-primary-rgb: 60, 113, 247;
  --bs-secondary: #6c757d;
  --bs-secondary-rgb: 108, 117, 125;
  --bs-success: #198754;
  --bs-success-rgb: 25, 135, 84;
  --bs-info: #30b9d5;
  --bs-info-rgb: 48, 185, 213;
  --bs-warning: #ffc107;
  --bs-warning-rgb: 255, 193, 7;
  --bs-danger: #ee402e;
  --bs-danger-rgb: 238, 64, 46;
  --bs-light: #f8f9fa;
  --bs-light-rgb: 248, 249, 250;
  --bs-dark: #212529;
  --bs-dark-rgb: 33, 37, 41;
  --bs-white: #ffffff;
  --bs-black: #000000;

  /* Derived semantic tokens (tint/shade of theme colours) */
  --bs-primary-text-emphasis: #182d63;
  --bs-primary-bg-subtle: #d8e3fd;
  --bs-primary-border-subtle: #b1c6fc;
  --bs-info-text-emphasis: #134a55;
  --bs-info-bg-subtle: #d6f1f7;
  --bs-info-border-subtle: #ace3ee;
  --bs-danger-text-emphasis: #5f1a12;
  --bs-danger-bg-subtle: #fcd9d5;
  --bs-danger-border-subtle: #f8b3ab;

  --bs-body-color: #212529;
  --bs-body-color-rgb: 33, 37, 41;
  --bs-body-bg: #ffffff;
  --bs-body-bg-rgb: 255, 255, 255;
  --bs-secondary-color: rgba(33, 37, 41, 0.75);
  --bs-secondary-bg: #e9ecef;
  --bs-secondary-bg-rgb: 233, 236, 239;
  --bs-tertiary-color: rgba(33, 37, 41, 0.5);
  --bs-tertiary-bg: #f8f9fa;
  --bs-tertiary-bg-rgb: 248, 249, 250;
  --bs-emphasis-color: #000000;
  --bs-border-color: #899299;
  --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
  --bs-border-radius: 0.375rem;
  --bs-border-radius-lg: 0.5rem;
  --bs-card-cap-bg: rgba(var(--bs-body-color-rgb), 0.03);

  --bs-link-color: var(--bs-primary);
  --bs-link-color-rgb: var(--bs-primary-rgb);
  --bs-link-hover-color: #305ac6;
  --bs-link-hover-color-rgb: 48, 90, 198;
  --bs-focus-ring-color: rgba(var(--bs-primary-rgb), 0.25);
  --bs-focus-ring-opacity: 0.25;

  --app-shell-brand-bg: #000;
  --app-shell-header-height: 4.5rem;
  --app-sidebar-width: 255px;
  --app-sidebar-collapsed-width: 5.5rem;
  --app-sidebar-item-height: 3.5rem;
  --app-sidebar-item-padding-x: 1.25rem;
  --app-sidebar-item-gap: 0.75rem;
  --app-sidebar-accent: #ff6b6b;
  --app-sidebar-active-dot-size: 0.6rem;
  --app-sidebar-collapsed-active-dot-size: 0.5rem;
  --app-sidebar-trailing-slot-width: 1rem;
  --app-shell-footer-height: 3.65rem;
  --app-shell-inline-padding: 2rem;
  --app-dropdown-border-color: rgba(15, 23, 42, 0.14);
  --app-dropdown-divider-color: rgba(15, 23, 42, 0.06);
  --app-dropdown-hover-bg: #e9ecef;
  --app-dropdown-radius: 0.5rem;
  /*
    Overlay stack. Adjust here rather than scattering new z-index literals.
    List tabs sit above the card seam; an open kebab lifts the card host
    above those tabs but stays below chrome (action bar / header / sidebar).
  */
  --app-z-list-tab: 1;
  --app-z-list-tab-active: 2;
  --app-z-dropdown-host: 10;
  --app-z-action-bar: 90;
  --app-z-header: 100;
  --app-z-sidebar: 120;
  --app-z-dropdown: 1080;
  --app-z-toast: 1090;
  --app-z-sidebar-popup: 1300;
  --app-z-skip-link: 2000;
  --bs-dropdown-zindex: var(--app-z-dropdown);
  --app-header-icon-bg: #e9ecef;
  --app-header-icon-color: #495057;
  --app-header-icon-hover-bg: #e9ecef;
  --app-header-icon-hover-color: #212529;
  --app-header-avatar-bg: #fecba1;
  --app-header-avatar-color: #ca6510;
  --app-header-avatar-hover-bg: #f9c396;
  --app-header-avatar-hover-color: #ca6510;
  --app-header-counter-border-color: #fff;

  --app-sidebar-bg: #183680;
  --app-sidebar-active: #2f62e9;
  /* Bootstrap 5 Subset Colors/Blue/700 */
  --app-sidebar-hover: #084298;
  --app-surface-muted: #f1f3f5;
  --app-auth-panel-bg: #0e1f3f;
  --app-form-border-color: var(--bs-border-color);

  --bs-body-font-family:
    "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --bs-font-sans-serif: var(--bs-body-font-family);
}

/*
  Buttons (Figma component → Bootstrap .btn).

  Labels are Body/Regular: Ubuntu 400, 1rem, line-height 1.5. Do not bump
  this to 500/Medium on .btn or with fw-medium — that is what made success
  and wizard actions look heavy versus the handoff.

  Variant blocks below only retarget compiled Bootstrap colour literals to
  theme tokens. Do not restyle weight/size per feature.
*/
.btn {
  --bs-btn-font-weight: 400;
  --bs-btn-line-height: 1.5;
  font-weight: 400;
  line-height: 1.5;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #3360d2;
  --bs-btn-hover-border-color: #305ac6;
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #305ac6;
  --bs-btn-active-border-color: #2d55b9;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--bs-primary);
  --bs-btn-disabled-border-color: var(--bs-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-hover-border-color: var(--bs-primary);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--bs-primary);
  --bs-btn-active-border-color: var(--bs-primary);
  --bs-btn-disabled-color: var(--bs-primary);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--bs-primary);
}

.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--bs-danger);
  --bs-btn-border-color: var(--bs-danger);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #ca3627;
  --bs-btn-hover-border-color: #be3325;
  --bs-btn-focus-shadow-rgb: var(--bs-danger-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #be3325;
  --bs-btn-active-border-color: #b23022;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--bs-danger);
  --bs-btn-disabled-border-color: var(--bs-danger);
}

.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--bs-info);
  --bs-btn-border-color: var(--bs-info);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #299db5;
  --bs-btn-hover-border-color: #2694aa;
  --bs-btn-focus-shadow-rgb: var(--bs-info-rgb);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #2694aa;
  --bs-btn-active-border-color: #248ba0;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--bs-info);
  --bs-btn-disabled-border-color: var(--bs-info);
}

.btn-dark {
  --bs-btn-color: #fff;
  --bs-btn-bg: #212529;
  --bs-btn-border-color: #212529;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #424649;
  --bs-btn-hover-border-color: #373b3e;
  --bs-btn-focus-shadow-rgb: 66, 70, 73;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #4d5154;
  --bs-btn-active-border-color: #373b3e;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #212529;
  --bs-btn-disabled-border-color: #212529;
}

/* Filled buttons: edge matches the fill. `.border-primary` is for cards/rules,
   not a second ring around a solid CTA. */
.btn-primary.border-primary,
.btn-dark.border-primary,
.btn-danger.border-primary,
.btn-info.border-primary {
  border-color: var(--bs-btn-border-color) !important;
}

.btn:focus {
  outline: 0;
}

.btn:focus:not(:focus-visible) {
  box-shadow: none;
}

.nav-pills {
  --bs-nav-pills-link-active-bg: var(--bs-primary);
}

.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--bs-primary);
}

.pagination {
  --bs-pagination-color: var(--bs-primary);
  --bs-pagination-hover-color: var(--bs-link-hover-color);
  --bs-pagination-focus-color: var(--bs-link-hover-color);
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
  --bs-pagination-active-bg: var(--bs-primary);
  --bs-pagination-active-border-color: var(--bs-primary);
}

.badge {
  --bs-badge-font-size: 0.875em;
  --bs-badge-font-weight: 500;
  border-radius: var(--bs-border-radius-pill);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: var(--app-z-skip-link);
  background: #fff;
  color: #111;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Align form borders / focus rings with the shared Bootstrap Jaustukas tokens.
   Bootstrap's compiled CSS hardcodes default blue (#0d6efd); retarget to --bs-primary. */
.form-control:not(.is-valid):not(.is-invalid),
.form-select:not(.is-valid):not(.is-invalid),
.input-group-text,
.form-check-input:not(.is-valid):not(.is-invalid) {
  border-color: var(--app-form-border-color);
}

.form-control::placeholder {
  color: var(--bs-secondary-color);
  opacity: 1;
}

.form-control:not(.is-valid):not(.is-invalid):focus,
.form-select:not(.is-valid):not(.is-invalid):focus,
.form-check-input:not(.is-valid):not(.is-invalid):focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-check-input:checked,
.form-check-input:checked:focus {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.form-check-input:checked:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* SearchableSelect / SlimSelect. Keep this next to form-control tokens.
   Never put Bootstrap .form-select on .ss-main: that class draws a second
   chevron. SlimSelect also squares corners via .ss-dir-below/.ss-dir-above
   (meant to join an attached menu); our menu is a floating panel. */
.ss-main {
  --ss-primary-color: var(--bs-primary);
  --ss-focus-color: var(--bs-primary);
  --ss-border-color: var(--app-form-border-color);
  --ss-font-color: var(--bs-body-color);
  --ss-font-placeholder-color: var(--bs-secondary-color);
  --ss-bg-color: var(--bs-body-bg, #fff);
  --ss-main-height: calc(1.5em + 0.75rem + 2px);
  --ss-border-radius: var(--bs-border-radius);
  min-height: var(--ss-main-height);
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  background-image: none;
  border-radius: var(--ss-border-radius);
}

.ss-main.form-select {
  background-image: none;
  padding-right: 0.75rem;
}

.ss-main.ss-dir-below,
.ss-main.ss-dir-above,
.ss-main.ss-open {
  border-radius: var(--ss-border-radius);
}

.ss-main:focus,
.ss-main:focus-visible {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
  outline: 0;
}

.ss-content {
  --ss-primary-color: var(--bs-primary);
  --ss-focus-color: var(--bs-primary);
  --ss-border-color: var(--app-form-border-color);
  --ss-font-color: var(--bs-body-color);
  --ss-bg-color: var(--bs-body-bg, #fff);
  --ss-border-radius: var(--bs-border-radius);
  border-radius: var(--ss-border-radius);
}

.ss-content:not(.ss-open) {
  visibility: hidden;
  pointer-events: none;
}

.ss-content.ss-dir-below,
.ss-content.ss-dir-above {
  border-radius: var(--ss-border-radius);
}

.ss-content .ss-search input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Sectioned forms: page template owns the card; {{ form }} is sections only */
.app-form {
  max-width: 100%;
  min-width: 0;
}

.app-form-card {
  background-color: var(--bs-card-bg, #fff);
  border: 1px solid rgba(15, 23, 42, 0.24);
  border-radius: var(--bs-border-radius, 0.375rem);
  box-shadow: var(--bs-box-shadow-sm);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

.app-form-section {
  border-bottom: 1px solid var(--bs-light-border-subtle, #e9ecef);
}

.app-form-card > .app-form-section:last-of-type {
  border-bottom: 0;
}

.app-form-section-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.5rem 0.5rem 0.75rem 1.5rem;
  max-width: 100%;
}

.app-form-section-title {
  font-weight: 700;
  color: var(--bs-body-color, #212529);
  line-height: 1.5;
}

.app-form-section-subtitle {
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  line-height: 1.5;
}

.app-form-section-fields {
  padding: 1.5rem;
  min-width: 0;
}

.app-form-section-fields .app-form-field:last-child {
  margin-bottom: 0 !important;
}

.app-yes-no-switch {
  min-height: 1.5rem;
  padding-left: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-avatar-crop-frame {
  position: relative;
  width: 100%;
  max-width: 25rem;
  aspect-ratio: 1;
  overflow: hidden;
  background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.app-avatar-crop-stage {
  position: absolute;
  inset: 0;
}

.app-avatar-crop-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-avatar-crop-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

.app-avatar-crop-placeholder-image {
  display: block;
  width: 10rem;
  height: 10rem;
  object-fit: contain;
  flex-shrink: 0;
}

.app-avatar-crop-placeholder-text {
  margin: 0;
  max-width: 16rem;
  font-size: var(--bs-body-font-size, 1rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-avatar-crop-file-row {
  min-width: 0;
}

.app-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.24);
  background-color: var(--bs-card-bg, #fff);
}

.app-inline-formset {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-inline-form-row-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-inline-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 2.25rem;
  column-gap: 0.75rem;
  align-items: end;
  align-content: start;
}

.app-inline-form-row-3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 12rem) minmax(0, 12rem) 2.25rem;
}

.app-inline-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.app-inline-form-field-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.5rem;
}

.app-inline-form-field-label .form-label {
  margin-bottom: 0;
}

.app-inline-form-field .form-select,
.app-inline-form-field > .form-control,
.app-inline-form-field > .input-group {
  width: 100%;
}

.app-inline-form-field .input-group {
  flex-wrap: nowrap;
}

.app-inline-form-field .input-group > .form-control {
  /* Keep the icon prefix on the same row as the control (Bootstrap input-group). */
  width: 1%;
  min-width: 0;
}

.app-inline-form-row-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(1.5em + 0.75rem + 2px);
}

@media (max-width: 767.98px) {
  .app-inline-form-row,
  .app-inline-form-row-3 {
    grid-template-columns: minmax(0, 1fr) 2.25rem;
  }

  .app-inline-form-row > .app-inline-form-field {
    grid-column: 1;
  }

  .app-inline-form-row-delete {
    grid-column: 2;
    grid-row: 1 / -1;
  }
}

.app-formset-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(1.5em + 0.75rem + 2px);
  font-size: 1.25rem;
  line-height: 1;
}

.app-formset-delete .ph {
  transform: translateY(2px);
}

.app-inline-form-row-errors .invalid-feedback {
  display: block;
}

#add-parent-contact.btn-link,
.app-formset-delete.btn-link {
  --bs-btn-hover-decoration: none;
  --bs-link-decoration: none;
  text-decoration: none;
}

.app-form-success-card {
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.app-form-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 33.125rem;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.app-form-success-icon {
  width: 6.25rem;
  height: 6.25rem;
  margin-bottom: 1.5rem;
}

.app-form-success-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-form-success-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.app-form-success-body {
  margin-bottom: 1.5rem;
  color: var(--bs-body-color, #212529);
}

/* Success CTAs use global .btn (Regular). Do not set a heavier weight here. */
.app-form-success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .app-form-section-meta {
    padding: 1.5rem 0.5rem 1.5rem 1.5rem;
    max-width: 21.25rem;
  }

  .app-form-section-fields {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
}

/* Prefixed fields: Bootstrap input-group + Phosphor icon */
.input-group-text {
  background-color: var(--bs-tertiary-bg, #f8f9fa);
  color: var(--bs-secondary-color);
}

.input-group-text .ph {
  font-size: 1.125rem;
  line-height: 1;
}

.input-group-lg > .input-group-text .ph {
  font-size: 1.25rem;
}

.input-group:focus-within {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
  border-radius: var(--bs-border-radius);
}

.input-group-lg:focus-within {
  border-radius: var(--bs-border-radius-lg);
}

.input-group:focus-within > .form-control:not(.is-invalid):not(.is-valid),
.input-group:focus-within > .input-group-text {
  border-color: var(--bs-primary);
  box-shadow: none;
}

.input-group:has(.is-invalid) > .input-group-text {
  border-color: var(--bs-form-invalid-border-color, #dc3545);
}

.input-group:has(.is-invalid):focus-within {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.25);
}

.input-group > input[type="date"]::-webkit-calendar-picker-indicator,
.input-group > input[type="time"]::-webkit-calendar-picker-indicator,
.input-group > input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  display: none;
}

.input-group.app-datetime {
  position: relative;
  flex-wrap: nowrap;
}

.input-group.app-datetime > .input-group-text {
  cursor: pointer;
}

.input-group.app-datetime:has(input:disabled) > .input-group-text {
  cursor: default;
}

.input-group.app-datetime > .app-datetime-value,
.input-group.app-datetime > .app-datetime-value.form-control {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-datetime-popover {
  position: fixed;
  z-index: calc(var(--app-z-header) + 10);
  min-width: 16.5rem;
  padding: 0.75rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--app-dropdown-border-color, rgba(15, 23, 42, 0.14));
  border-radius: var(--app-dropdown-radius, 0.5rem);
  box-shadow: var(--bs-box-shadow-sm);
}

.app-datetime-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.app-datetime-heading {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-width: 0;
  font-weight: 600;
  text-align: center;
  text-transform: capitalize;
}

.app-datetime-heading .form-select {
  width: auto;
  max-width: 100%;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-right: 1.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.app-datetime-month-wrap,
.app-datetime-year-wrap {
  position: relative;
  min-width: 0;
}

.app-datetime-month-wrap {
  flex: 1 1 auto;
}

.app-datetime-year-wrap {
  flex: 0 0 auto;
}

.app-datetime-month,
.app-datetime-year {
  width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.app-datetime-menu {
  position: absolute;
  z-index: 2;
  top: calc(100% + 0.25rem);
  display: flex;
  flex-direction: column;
  max-height: 12rem;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0.25rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--app-dropdown-border-color, rgba(15, 23, 42, 0.14));
  border-radius: var(--app-dropdown-radius, 0.5rem);
  box-shadow: var(--bs-box-shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.app-datetime-month-menu {
  left: 0;
  min-width: 100%;
}

.app-datetime-year-menu {
  right: 0;
  width: 5.5rem;
}

.app-datetime-menu-option {
  border: 0;
  border-radius: var(--bs-border-radius);
  background: transparent;
  color: var(--bs-body-color);
  padding: 0.25rem 0.5rem;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.app-datetime-menu-option:hover,
.app-datetime-menu-option:focus-visible,
.app-datetime-menu-option.is-selected {
  background: var(--bs-primary);
  color: #fff;
}

.app-datetime-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--bs-border-radius);
  background: transparent;
  color: var(--bs-body-color);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.app-datetime-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.app-datetime-nav:hover,
.app-datetime-nav:focus-visible {
  background: var(--app-dropdown-hover-bg, #e9ecef);
}

.app-datetime-weekdays,
.app-datetime-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.125rem;
  text-align: center;
}

.app-datetime-weekdays {
  margin-bottom: 0.25rem;
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
}

.app-datetime-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--bs-border-radius);
  background: transparent;
  color: var(--bs-body-color);
  cursor: pointer;
  touch-action: manipulation;
}

.app-datetime-day:disabled {
  opacity: 0.35;
  cursor: default;
}

.app-datetime-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--bs-primary);
}

.app-datetime-day:hover:not(:disabled),
.app-datetime-day:focus-visible:not(:disabled) {
  background: var(--app-dropdown-hover-bg, #e9ecef);
}

.app-datetime-day.is-selected {
  background: var(--bs-primary);
  color: #fff;
}

.app-datetime-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-datetime-time-field {
  flex: 1 1 0;
  margin: 0;
}

.app-datetime-time-menu {
  position: static;
  width: 100%;
  max-height: 12rem;
}

.app-datetime-time-sep {
  font-weight: 600;
}

[data-formset-add].btn-link,
[data-formset-delete].btn-link {
  --bs-btn-hover-decoration: none;
  text-decoration: none;
}

.auth-body {
  margin: 0;
  min-height: 100dvh;
  background: #fff;
}

html:has(.auth-body) {
  min-height: 100%;
}

.auth-layout {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 45%) minmax(0, 1fr);
  background: #fff;
}

.auth-brand-panel {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  height: 100dvh;
  padding: 1.5rem;
  background: #fff;
}

.auth-brand-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: linear-gradient(140deg, var(--app-auth-panel-bg), #080d1a);
}

.auth-brand-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.auth-brand-content {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  left: clamp(1.5rem, 5vw, 3.25rem);
  right: clamp(1.5rem, 5vw, 3.25rem);
  bottom: clamp(1.5rem, 5vw, 3rem);
  max-width: 28rem;
  color: #fff;
}

.auth-brand-logo {
  width: min(18.8rem, 100%);
  height: auto;
  margin-bottom: 0.5rem;
}

.auth-brand-kicker {
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.auth-brand-divider {
  width: 100%;
  max-width: 27rem;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  opacity: 1;
  margin: 1.5rem 0;
}

.auth-brand-headline {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  line-height: 1.2;
  font-weight: 500;
}

.auth-form-panel {
  display: flex;
  min-height: 100dvh;
  padding: 1.5rem 1.5rem 0;
  background: #fff;
}

.auth-form-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: min(100%, 37.5rem);
  max-width: 37.5rem;
  margin-inline: auto;
  min-height: 100%;
}

.auth-form-content {
  --auth-space-xs: clamp(0.5rem, 1.25vh, 0.75rem);
  --auth-space-sm: clamp(0.75rem, 1.75vh, 1rem);
  --auth-space-md: clamp(1rem, 2.5vh, 1.5rem);
  --auth-space-lg: clamp(1.25rem, 3.5vh, 2rem);
  --auth-space-xl: clamp(1.25rem, 5vh, 3rem);

  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Keep focus rings visible */
  padding: var(--auth-space-xl) 0.35rem var(--auth-space-md);
}

@supports (justify-content: safe center) {
  .auth-form-content {
    /* Prefer optical middle; fall back to start when content would overflow. */
    justify-content: safe center;
  }
}

.auth-form-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--auth-space-xl);
  width: 100%;
}

.auth-form-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.auth-form-symbol {
  display: block;
}

.auth-form-illustration {
  position: relative;
  display: block;
  width: 6.25rem;
  height: 6.25rem;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-form-illustration img {
  position: absolute;
  width: 181.02%;
  height: 179.82%;
  max-width: none;
  left: -39.84%;
  top: -44.22%;
}

.auth-form-intro:has(.auth-form-illustration),
.auth-form-intro:has(.app-form-success-icon) {
  gap: 1.5rem;
}

.auth-form-intro .app-form-success-icon {
  margin-bottom: 0;
}

.auth-form-title {
  font-size: clamp(1.875rem, 3.5vw, 2.25rem);
  line-height: 1.2;
  font-weight: 500;
  margin: 0 0 var(--auth-space-xs);
}

.auth-form-subtitle {
  font-size: 1rem;
  line-height: 1.5;
}

.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-md);
  width: 100%;
}

.auth-form-body > .btn-link {
  align-self: center;
  text-decoration: none;
  padding-block: 0.25rem;
}

.auth-form-body > * + .btn-link {
  margin-top: calc(var(--auth-space-xs) - var(--auth-space-md));
}

.auth-form-stack--login {
  gap: var(--auth-space-lg);
}

.auth-form-stack--login .auth-form-body {
  max-width: 28rem;
  margin-inline: auto;
  gap: var(--auth-space-md);
}

.auth-form-intro--minimal {
  gap: 1.25rem;
}

.auth-form-intro--minimal .auth-form-symbol {
  width: 2.5rem;
  height: 2.5rem;
}

.auth-form-intro--minimal .auth-form-title {
  font-size: clamp(1.625rem, 2.5vw, 1.875rem);
  margin-bottom: 0.375rem;
}

.auth-form-intro--minimal .auth-form-subtitle {
  font-size: 1rem;
}

.auth-form-stack--login .auth-login-form {
  gap: var(--auth-space-sm);
}

.auth-form-stack--login .auth-login-form .form-label {
  margin-bottom: 0.375rem;
}

.auth-form-stack--login .auth-divider {
  gap: 1rem;
}

.auth-form-stack--login .auth-submit {
  min-height: 2.75rem;
  padding-block: 0.625rem;
}

.auth-invite-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 16.3rem);
  margin-inline: auto;
  gap: 0.125rem;
}

.auth-invite-step-number {
  width: 1.9375rem;
  height: 1.9375rem;
  border-radius: 1.3125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  flex-shrink: 0;
}

.auth-invite-step-number.is-active {
  background: var(--bs-primary);
  color: var(--bs-light);
}

.auth-invite-step-line {
  flex: 1 1 auto;
  min-width: 1.25rem;
  border-top: 1px dashed var(--bs-border-color);
  height: 0;
}

.auth-select-membership .card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 4.75rem;
}

.auth-select-membership .form-check-input {
  margin-top: 0.2rem;
}

.auth-select-membership-label {
  cursor: pointer;
}

.auth-social-list {
  container-type: inline-size;
}

.auth-social-label--short {
  display: none;
}

@container (max-width: 26rem) {
  .auth-social-label--full {
    display: none;
  }

  .auth-social-label--short {
    display: inline;
  }
}

@container (max-width: 18rem) {
  .auth-social-label--short {
    display: none;
  }
}

.auth-form-alert {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.auth-login-form {
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-sm);
}

.auth-login-form .form-label {
  margin-bottom: 0.375rem;
}

.auth-consent-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.auth-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 1.5rem;
  margin-bottom: 0;
  padding-left: 0;
}

.auth-consent-check .form-check-input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  margin-left: 0;
  float: none;
  flex-shrink: 0;
}

.auth-consent-check .form-check-label a {
  color: var(--bs-link-color);
  text-decoration: none;
}

.auth-consent-check .form-check-label a:hover,
.auth-consent-check .form-check-label a:focus-visible {
  text-decoration: underline;
}

.auth-forgot-link {
  font-size: inherit;
  line-height: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.auth-forgot-link:hover,
.auth-forgot-link:focus-visible {
  text-decoration: underline;
}

.btn-auth-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.625rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background-color: var(--bs-body-bg);
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.btn-auth-social:hover,
.btn-auth-social:focus-visible {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  border-color: var(--bs-border-color);
}

.auth-social-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.auth-divider-line {
  flex: 1 0 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--bs-border-color-translucent, #dee2e6);
  opacity: 1;
}

.auth-divider-label {
  flex-shrink: 0;
  white-space: nowrap;
}

.auth-footer {
  flex-shrink: 0;
  padding-block: 1rem;
  margin-top: auto;
  background: #fff;
}

/* Shell layout */

.app-shell {
  display: grid;
  grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  background: var(--app-sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: var(--app-z-sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: visible;
  padding: 0;
}

.sidebar-brand-wrap {
  min-height: var(--app-shell-header-height);
  background: var(--app-shell-brand-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.5rem;
  flex-shrink: 0;
}

.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 100%;
  min-width: 0;
}

.sidebar-brand-logo {
  max-width: 100%;
  height: auto;
}

.sidebar-brand-logo-full {
  width: 170px;
}

.sidebar-brand-logo-symbol {
  display: none;
  width: 2rem;
}

.sidebar-mobile-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-mobile-toggle i {
  font-size: 1.35rem;
}

.sidebar-mobile-actions {
  display: none;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1rem 0 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.sidebar-nav-menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-nav-menu::-webkit-scrollbar {
  width: 0.5rem;
}

.sidebar-nav-menu::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
}

.sidebar-nav-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.42);
}

.sidebar-primary-nav,
.sidebar-subnav {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-primary-nav .nav-item,
.sidebar-subnav li {
  flex-shrink: 0;
  width: 100%;
  margin: 0;
}

.sidebar-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  min-width: 1.25rem;
  height: 1.25rem;
  font-size: 1.15rem;
  line-height: 1;
  text-align: center;
}

.sidebar-nav-label,
.sidebar-group-label,
.sidebar-collapse-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav .nav-link,
.sidebar-group-toggle,
.sidebar-subnav-link,
.sidebar-collapse-toggle {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 100%;
  height: var(--app-sidebar-item-height);
  min-height: var(--app-sidebar-item-height);
  padding: 0 var(--app-sidebar-item-padding-x);
  display: flex;
  align-items: center;
  gap: var(--app-sidebar-item-gap);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.sidebar-nav .nav-link::after {
  content: "";
  position: absolute;
  right: calc(
    var(--app-sidebar-item-padding-x) +
      (
        var(--app-sidebar-trailing-slot-width) -
          var(--app-sidebar-active-dot-size)
      ) /
      2
  );
  top: 50%;
  width: var(--app-sidebar-active-dot-size);
  height: var(--app-sidebar-active-dot-size);
  border-radius: 999px;
  background: transparent;
  transform: translateY(-50%) scale(0);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.sidebar-nav .nav-link.active,
.sidebar-subnav-link.active,
.sidebar-subnav-popup-link.active {
  background: var(--app-sidebar-active);
  color: #fff;
}

.sidebar-nav .nav-link:hover,
.sidebar-group-toggle:hover,
.sidebar-subnav-link:hover,
.sidebar-collapse-toggle:hover {
  background: var(--app-sidebar-hover);
  color: #fff;
}

body.sidebar-is-collapsed .sidebar-group-toggle-collapsed.is-active {
  background: var(--app-sidebar-active);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  font-weight: 400;
}

.sidebar-nav .nav-link.active::after {
  background: var(--app-sidebar-accent);
  transform: translateY(-50%) scale(1);
}

.sidebar-section-label {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem var(--app-sidebar-item-padding-x) 0.25rem;
  width: 100%;
  color: #fcfcfd;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.25;
  text-transform: uppercase;
}

.sidebar-group {
  flex-shrink: 0;
  width: 100%;
  margin: 0;
}

.sidebar-group-toggle {
  justify-content: space-between;
  padding-right: calc(
    var(--app-sidebar-item-padding-x) + var(--app-sidebar-trailing-slot-width)
  );
}

.sidebar-group-toggle-expanded {
  display: flex;
}

.sidebar-group-toggle-collapsed {
  display: none;
  justify-content: center;
  padding-right: 0;
}

.sidebar-group-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--app-sidebar-item-gap);
  min-width: 0;
}

.sidebar-group-chevron {
  position: absolute;
  right: calc(
    var(--app-sidebar-item-padding-x) +
      (var(--app-sidebar-trailing-slot-width) - 1rem) / 2
  );
  top: 50%;
  font-size: 1rem;
  width: var(--app-sidebar-trailing-slot-width);
  min-width: var(--app-sidebar-trailing-slot-width);
  text-align: center;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.sidebar-group-toggle[aria-expanded="true"] .sidebar-group-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.sidebar-subnav-link {
  height: 3rem;
  min-height: 3rem;
  padding-left: calc(var(--app-sidebar-item-padding-x) + 2rem);
  font-weight: 400;
}

.sidebar-subnav-link::after {
  content: "";
  position: absolute;
  right: calc(
    var(--app-sidebar-item-padding-x) +
      (
        var(--app-sidebar-trailing-slot-width) -
          var(--app-sidebar-active-dot-size)
      ) /
      2
  );
  top: 50%;
  width: var(--app-sidebar-active-dot-size);
  height: var(--app-sidebar-active-dot-size);
  border-radius: 999px;
  background: transparent;
  transform: translateY(-50%) scale(0);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease;
}

.sidebar-subnav-link.active::after {
  background: var(--app-sidebar-accent);
  transform: translateY(-50%) scale(1);
}

.sidebar-subnav-popup {
  min-width: 14rem;
  margin-left: 0.5rem;
  z-index: var(--app-z-sidebar-popup);
}

.sidebar-group.dropend {
  position: relative;
}

.sidebar-subnav-popup-link {
  font-size: 0.92rem;
}

.sidebar-subnav-link:is(:hover, :focus-visible) {
  color: #fff;
}

.app-grid-card {
  border: 1px solid rgba(15, 23, 42, 0.24);
  border-radius: 0.375rem;
  background-color: var(--bs-card-bg, #fff);
  box-shadow: var(--bs-box-shadow-sm);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

/* Open kebab menus use position:fixed but stay trapped in this card’s
   stacking context; lift the host above list tabs while a menu is shown. */
.app-grid-card:has(.dropdown-menu.show) {
  position: relative;
  z-index: var(--app-z-dropdown-host);
  overflow: visible;
}

.app-list-tabs-bar {
  --app-list-tab-border: rgba(15, 23, 42, 0.24);
  border-bottom: 1px solid var(--app-list-tab-border);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.app-list-tabs.nav-tabs {
  --app-list-tab-border: rgba(15, 23, 42, 0.24);
  border-bottom: 0;
  gap: 0;
  margin-bottom: -1px;
  padding: 0;
  /* Keep the last tab’s right border/radius inside the scrollport. */
  padding-inline-end: 0.25rem;
  position: relative;
  z-index: var(--app-z-list-tab);
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scroll-padding-inline: 0.25rem;
}

.app-list-tabs.nav-tabs .nav-item {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.app-list-tabs.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-top-left-radius: var(--bs-border-radius, 0.375rem);
  border-top-right-radius: var(--bs-border-radius, 0.375rem);
  color: var(--bs-link-color, #3c71f7);
  padding: 0.5rem 1rem;
  background: transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.app-list-tabs.nav-tabs .nav-link.active,
.app-list-tabs.nav-tabs .nav-item.show .nav-link {
  background-color: var(--bs-card-bg, #fff);
  border-color: var(--app-list-tab-border) var(--app-list-tab-border) var(--bs-card-bg, #fff);
  color: var(--bs-emphasis-color, #000);
  position: relative;
  z-index: var(--app-z-list-tab-active);
}

/* Tabs sit above the card; square the card’s top corners. */
.app-grid-card-with-tabs {
  --app-list-tab-border: rgba(15, 23, 42, 0.24);
  border-color: var(--app-list-tab-border);
  border-top: 0;
  border-radius: 0 0 var(--bs-border-radius, 0.375rem) var(--bs-border-radius, 0.375rem);
  width: 100%;
}

.app-grid-card-empty {
  border: 1px solid rgba(15, 23, 42, 0.24);
}

/* Keep tab/card seam open when empty state sits under list tabs. */
.app-grid-card-with-tabs.app-grid-card-empty {
  border-top: 0;
}

.app-grid-card-empty .app-empty-list-state {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-grid-card > .app-empty-list-state {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.app-list-panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  background-color: var(--bs-card-bg, #fff);
}

.app-list-panel-title {
  font-weight: 700;
  color: var(--bs-emphasis-color, #000);
  line-height: 1.5;
}

.app-list-panel-subtitle {
  color: var(--bs-body-color, #212529);
  line-height: 1.5;
}

.app-empty-list-state-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 25.1875rem;
}

.app-empty-list-state-title,
.app-empty-list-state-message {
  margin: 0;
  font-size: var(--bs-body-font-size, 1rem);
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-empty-list-state-title {
  font-weight: 700;
}

.app-empty-list-state-message {
  font-weight: 400;
}

/* Class info card: banner only. Icon rows use .app-meta-* below. */
.app-class-info-card-banner {
  height: 3.75rem;
  overflow: hidden;
  background-color: var(--bs-secondary-bg, #e9ecef);
}

.app-class-info-card-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/*
  Shared icon + caption + value (class cards, incident sidebars, review).

  Do not duplicate under .incident-* or .app-class-info-stat-*. Feature CSS
  may wrap these rows (card chrome, banners) but must not restyle the row.

  - .app-meta-row: 2.5rem tile, 1.5rem Phosphor glyph, 1rem gutter
  - Icon top-aligned so a wrapping list does not vertically center the glyph
  - Caption 0.875rem secondary; value/list 1rem body; line-height 1.5
  - No extra margin between caption and value
  - .app-meta-block: caption + content without an icon (detail/review lists)
*/
.app-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-meta-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.app-meta-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
  background-color: var(--bs-primary-bg-subtle, #d8e3fd);
  color: var(--bs-primary, #3c71f7);
}

.app-meta-icon .ph {
  font-size: inherit;
  line-height: inherit;
}

.app-meta-body {
  min-width: 0;
  flex: 1 1 auto;
}

.app-meta-label {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-meta-value {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-body-color, #212529);
}

.app-meta-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-body-color, #212529);
  list-style-type: disc;
}

.app-meta-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-assign-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1fr);
  align-items: stretch;
  min-width: 0;
  /* Must stay visible so transfer controls can position:sticky against page scroll. */
  overflow: visible;
  background-color: var(--bs-card-bg, #fff);
  border-top: 0 !important;
}

.app-assign-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-assign-panel[data-assign-panel="available"] {
  border-top: 6px solid var(--bs-secondary-border-subtle, #c4c8cb);
}

.app-assign-panel[data-assign-panel="assigned"] {
  border-top: 6px solid var(--bs-primary, #3c71f7);
  border-left: 1px solid rgba(15, 23, 42, 0.12);
}

.app-assign-panel-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 0.75rem;
}

.app-assign-search .input-group-text {
  background: var(--bs-body-bg, #fff);
}

.app-assign-student-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem 1.25rem;
}

.app-assign-student {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  text-align: left;
  color: inherit;
}

.app-assign-student:hover {
  background: rgba(60, 113, 247, 0.06);
}

.app-assign-student.is-selected {
  background: rgba(60, 113, 247, 0.12);
}

.app-assign-student-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-assign-student-name {
  font-weight: 500;
  line-height: 1.3;
}

.app-assign-student-details {
  font-size: 0.875rem;
  line-height: 1.3;
}

.app-assign-transfer-controls {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  width: 0;
  /* Rest below the panel headers / search; stick lower in the viewport. */
  padding: 13rem 0 1rem;
  align-self: start;
  position: sticky;
  top: 15rem;
  z-index: 2;
}

.app-assign-transfer-btn {
  --app-assign-transfer-border: 2px;
  --bs-btn-bg: #fff;
  --bs-btn-hover-bg: #fff;
  --bs-btn-active-bg: #fff;
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-opacity: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff !important;
  background-color: #fff !important;
  border-width: var(--app-assign-transfer-border) !important;
  border-style: solid !important;
  margin-inline: -1.25rem;
  box-shadow: none;
  opacity: 1 !important;
}

.app-assign-transfer-btn i {
  font-size: 1.25rem;
  line-height: 1;
  -webkit-text-stroke: 0.4px currentColor;
}

.app-assign-transfer-btn.btn-outline-primary {
  --bs-btn-color: var(--bs-primary, #3c71f7);
  --bs-btn-border-color: var(--bs-primary, #3c71f7);
  --bs-btn-hover-color: var(--bs-primary, #3c71f7);
  --bs-btn-hover-border-color: var(--bs-primary, #3c71f7);
  --bs-btn-active-color: var(--bs-primary, #3c71f7);
  --bs-btn-active-border-color: var(--bs-primary, #3c71f7);
  --bs-btn-disabled-color: var(--bs-primary, #3c71f7);
  --bs-btn-disabled-border-color: var(--bs-primary, #3c71f7);
  border-color: var(--bs-primary, #3c71f7) !important;
  color: var(--bs-primary, #3c71f7) !important;
}

.app-assign-transfer-btn.btn-outline-secondary {
  --bs-btn-color: var(--bs-secondary, #6c757d);
  --bs-btn-border-color: var(--bs-secondary, #6c757d);
  --bs-btn-hover-color: var(--bs-secondary, #6c757d);
  --bs-btn-hover-border-color: var(--bs-secondary, #6c757d);
  --bs-btn-active-color: var(--bs-secondary, #6c757d);
  --bs-btn-active-border-color: var(--bs-secondary, #6c757d);
  --bs-btn-disabled-color: #adb5bd;
  --bs-btn-disabled-border-color: #ced4da;
  border-color: var(--bs-secondary, #6c757d) !important;
  color: var(--bs-secondary, #6c757d) !important;
}

.app-assign-transfer-btn:disabled,
.app-assign-transfer-btn.disabled {
  background: #fff !important;
  background-color: #fff !important;
  opacity: 1 !important;
  color: #adb5bd !important;
  border-color: #ced4da !important;
}

.app-assign-transfer-btn:hover,
.app-assign-transfer-btn:focus-visible,
.app-assign-transfer-btn:active,
.app-assign-transfer-btn:hover:not(:disabled),
.app-assign-transfer-btn:focus-visible:not(:disabled) {
  background: #fff !important;
  background-color: #fff !important;
  opacity: 1 !important;
}

.app-shell-action-bar {
  --app-shell-scrollbar-compensation: 15px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--app-z-action-bar);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  box-sizing: border-box;
  height: var(--app-shell-footer-height);
  max-height: var(--app-shell-footer-height);
  padding: 0;
  padding-left: var(--app-shell-inline-padding);
  /* Match card edge: content padding + reserved scrollbar gutter on .app-content. */
  padding-right: calc(
    var(--app-shell-inline-padding) + var(--app-shell-scrollbar-compensation)
  );
  background: var(--bs-body-bg, #fff);
  border-top: var(--bs-border-width, 1px) solid var(--bs-secondary-border-subtle, #c4c8cb);
}

.app-shell-action-bar-spread {
  justify-content: space-between;
}

.app-shell-action-bar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.app-shell-action-bar form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.app-assign-save-confirm-alert ul {
  padding-left: 1.25rem;
}

.app-assign-save-confirm-alert li::marker {
  color: var(--bs-primary-text-emphasis, #052c65);
}

/* Invalidate confirm: title + bullets only — no inner rule. */
.app-incident-invalidate-alert hr,
.alert:has(#incident-invalidate-warning-title) hr {
  display: none !important;
  margin: 0 !important;
  border: 0 !important;
  height: 0 !important;
  overflow: hidden;
}

.app-incident-invalidate-alert > .d-flex,
.app-incident-invalidate-alert ul {
  border: 0 !important;
  box-shadow: none;
}

/* Keep the confirm bar pinned; page content scrolls behind it.
   overflow: clip (not hidden) so a #section hash cannot scroll .app-main
   and lift the absolutely positioned bar. */
html:has(.app-shell-action-bar),
body:has(.app-shell-action-bar) {
  overflow: clip;
}

.app-main:has(.app-shell-action-bar) {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: clip;
}

.app-main:has(.app-shell-action-bar) .app-content {
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-bottom: calc(var(--app-shell-footer-height) + 1.5rem);
}

.app-student-avatar {
  --app-student-avatar-bg: #fecba1;
  --app-student-avatar-color: #ca6510;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: var(--app-student-avatar-bg);
  color: var(--app-student-avatar-color);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1;
}

.app-student-avatar-check {
  display: none;
  font-size: 1.125rem;
  color: #fff;
}

.app-assign-student.is-selected .app-student-avatar {
  background: var(--bs-primary, #3c71f7);
  color: #fff;
}

.app-assign-student.is-selected .app-student-avatar-letter {
  display: none;
}

.app-assign-student.is-selected .app-student-avatar-check {
  display: inline-flex;
}

.app-student-avatar--orange {
  --app-student-avatar-bg: #fecba1;
  --app-student-avatar-color: #ca6510;
}

.app-student-avatar--blue {
  --app-student-avatar-bg: #c3ddfd;
  --app-student-avatar-color: #1a56db;
}

.app-student-avatar--green {
  --app-student-avatar-bg: #bcf0da;
  --app-student-avatar-color: #057a55;
}

.app-student-avatar--red {
  --app-student-avatar-bg: #fbd5d5;
  --app-student-avatar-color: #c81e1e;
}

.app-student-avatar--yellow {
  --app-student-avatar-bg: #fdf6b2;
  --app-student-avatar-color: #9f580a;
}

.app-student-avatar--purple {
  --app-student-avatar-bg: #e5d4ff;
  --app-student-avatar-color: #6b21a8;
}

.app-student-avatar--teal {
  --app-student-avatar-bg: #c8f0ef;
  --app-student-avatar-color: #0f766e;
}

.app-student-avatar--pink {
  --app-student-avatar-bg: #fce7f3;
  --app-student-avatar-color: #9d174d;
}

.app-student-profile-card .app-student-avatar--profile {
  display: flex;
  width: 4rem;
  height: 4rem;
  margin: -2rem auto 0.75rem;
  font-size: 1.25rem;
  position: relative;
  z-index: 1;
}

/* Info, then main, then contacts in source order so narrow screens stack
   that way. Wide screens keep the sidebar cards under each other. */
.app-student-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "info"
    "main"
    "contacts";
  gap: 1.5rem;
  align-items: start;
}

.app-student-detail-info {
  grid-area: info;
  min-width: 0;
}

.app-student-detail-main {
  grid-area: main;
  min-width: 0;
}

.app-student-detail-contacts {
  grid-area: contacts;
  min-width: 0;
}

@media (min-width: 768px) {
  .app-student-detail-layout {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "info main"
      "contacts main";
  }
}

@media (min-width: 1200px) {
  .app-student-detail-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  }
}

.app-student-kind-cards {
  padding: 1rem 1.5rem 0;
}

.app-student-kind-card-row {
  margin-bottom: 1rem;
}

.app-student-kind-card--warning .app-list-stat-card-header {
  background-color: color-mix(
    in srgb,
    var(--bs-warning) 50%,
    var(--bs-body-bg, #fff)
  );
}

.app-student-kind-card--success .app-list-stat-card-header {
  /* Same green as incident list kind cards, not Bootstrap success. */
  background-color: color-mix(in srgb, #4ca97e 50%, var(--bs-body-bg, #fff));
}

.app-student-kind-card--danger .app-list-stat-card-header {
  background-color: color-mix(
    in srgb,
    var(--bs-danger) 50%,
    var(--bs-body-bg, #fff)
  );
}

.app-student-kind-card--primary .app-list-stat-card-header {
  background-color: color-mix(
    in srgb,
    var(--bs-primary-border-subtle, #9ec5fe) 50%,
    var(--bs-body-bg, #fff)
  );
}

.app-student-kind-card-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.app-student-kind-card--warning .app-student-kind-card-icon {
  color: var(--bs-warning);
}

.app-student-kind-card--success .app-student-kind-card-icon {
  color: #4ca97e;
}

.app-student-kind-card--danger .app-student-kind-card-icon {
  color: var(--bs-danger);
}

.app-student-kind-card--primary .app-student-kind-card-icon {
  color: var(--bs-primary);
}

.app-student-kind-card .app-tooltip-icon {
  margin-left: auto;
}

.app-student-kind-card-footer {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  padding: 0.5rem 1rem;
}

.app-student-kind-card-add {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-link-color, var(--bs-primary));
  text-decoration: none;
}

.app-student-kind-card-add i {
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.app-student-kind-card-add:is(:hover, :focus-visible) {
  color: var(--bs-link-hover-color, #305ac6);
  text-decoration: none;
}

.app-risk-score-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1rem 1.5rem 1.5rem;
}

.app-monitoring-charts {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-monitoring-chart-canvas-wrap {
  position: relative;
  height: 17.5rem;
}

.app-monitoring-chart-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.app-toxic-duos-chart {
  width: 100%;
  height: 20rem;
}

.app-risk-score-card .app-list-stat-card-header {
  background-color: color-mix(
    in srgb,
    var(--bs-primary-bg-subtle) 50%,
    var(--bs-body-bg, #fff)
  );
}

.app-risk-score-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.app-risk-score-details-intro {
  margin: 0 0 0.375rem;
}

.app-risk-score-details-list {
  margin: 0;
  padding-left: 1.3125rem;
}

.app-risk-score-details-list li:not(:last-child) {
  margin-bottom: 0.375rem;
}

.app-risk-score-details-toggle {
  display: block;
  margin: 0.25rem 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--bs-link-color, #3c71f7);
  font: inherit;
  text-align: start;
  text-decoration: underline;
}

.app-risk-score-details-toggle:hover,
.app-risk-score-details-toggle:focus-visible {
  color: var(--bs-link-hover-color, #305ac6);
}

.app-risk-score-details-toggle[aria-expanded="true"] .app-risk-score-details-more,
.app-risk-score-details-toggle:not([aria-expanded="true"]) .app-risk-score-details-less {
  display: none;
}

.app-risk-gauge {
  position: relative;
  height: 1.5rem;
  margin: 0 0 1rem;
}

.app-risk-gauge-track {
  display: flex;
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: 0.25rem;
  transform: translateY(-50%);
}

.app-risk-gauge-seg--low {
  flex: 3 1 0;
  /* Left = score 1–3 (worst), red. */
  background-color: var(--bs-danger);
}

.app-risk-gauge-seg--mid {
  flex: 4 1 0;
  background-color: var(--bs-warning);
}

.app-risk-gauge-seg--high {
  flex: 3 1 0;
  /* Right = score 8–10 (best), green. */
  background-color: #4ca97e;
}

.app-risk-gauge-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  /* Stored score is higher = better: 1 on the red left, 10 on the green right. */
  left: calc(var(--risk-score) * 10%);
  width: 4px;
  background-color: var(--bs-body-color);
  transform: translateX(-50%);
}

@media (max-width: 991.98px) {
  .app-assign-panels {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .app-assign-transfer-controls {
    flex-direction: row;
    justify-content: center;
    width: auto;
    padding: 0.75rem;
    align-self: stretch;
    position: static;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
  }

  .app-assign-transfer-btn {
    margin-inline: 0;
  }

  /* Stacked columns: move-in goes down into assigned, move-out goes up. */
  .app-assign-transfer-btn i {
    transform: rotate(90deg);
  }

  .app-assign-panel[data-assign-panel="assigned"] {
    border-left: 0;
    border-top: 6px solid var(--bs-primary, #3c71f7);
  }
}

.app-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.24);
  background-color: var(--bs-card-bg, #fff);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.app-list-toolbar-filters {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.app-list-search {
  position: relative;
  flex: 1 1 12rem;
  width: auto;
  min-width: 0;
  max-width: 19rem;
}

.app-list-search .form-control {
  width: 100%;
  min-width: 0;
  padding-left: 2.2rem;
}

.app-list-search .app-list-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  color: var(--bs-secondary-color);
  pointer-events: none;
}

.app-list-toolbar-filters > .app-list-filter {
  min-width: 0;
  max-width: 100%;
}

.app-list-toolbar-filters > .app-list-filter:not(.app-list-filter-searchable) {
  /* Don’t size to longest <option> or grow into leftover toolbar space. */
  flex: 0 1 14rem;
  width: 14rem;
  max-width: 16rem;
}

.app-list-toolbar-filters > .app-list-filter:not(.app-list-filter-searchable) > .form-select.app-list-filter-select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.app-list-filter-searchable {
  position: relative;
  flex: 0 1 19rem;
  width: 19rem;
}

.app-list-filter-searchable .ss-main {
  width: 100%;
}

@media (max-width: 575.98px) {
  .app-list-toolbar {
    padding: 1rem;
    gap: 0.75rem;
  }

  .app-list-search,
  .app-list-toolbar-filters > .app-list-filter {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
}

.app-grid-card-with-tabs .gridjs-head.app-grid-head-external-search,
.app-grid-card-with-tabs .app-grid-head-external-search,
.app-grid-card:has(.app-list-toolbar) > [data-list-grid] .gridjs-head {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.app-grid-capacity-sep,
.app-grid-capacity-max {
  color: rgba(33, 37, 41, 0.5);
}

.app-grid-capacity-over .app-grid-capacity-enrolled {
  color: var(--bs-danger);
}

.app-grid-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.app-grid-status-dot {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background-color: var(--bs-secondary-color);
}

.app-grid-status-success .app-grid-status-dot {
  background-color: var(--bs-success);
}

.app-grid-status-danger .app-grid-status-dot {
  background-color: var(--bs-danger);
}

.app-grid-status-warning .app-grid-status-dot {
  background-color: var(--bs-warning);
}

.app-grid-status-secondary .app-grid-status-dot {
  background-color: #6c757d;
}

.app-grid-status-info .app-grid-status-dot {
  background-color: var(--bs-info);
}

.app-grid-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.app-grid-mark .ph {
  font-size: 1rem;
  line-height: 1;
}

.app-grid-mark-scheduled {
  color: var(--bs-body-color);
}

.app-grid-mark-scheduled .ph {
  color: var(--bs-success);
}

.app-grid-mark-empty {
  color: var(--bs-secondary-color);
}

.app-list-stat-cards {
  /* Restack from available content width (sidebar-aware), not viewport. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  min-width: 0;
  max-width: 100%;
}

.app-list-stat-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  background-color: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
  border-radius: var(--bs-border-radius, 0.375rem);
  overflow: hidden;
  color: inherit;
}

.app-list-stat-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
  /* Figma card-header: body-color at 3% over white */
  background-color: var(--bs-card-cap-bg, rgba(var(--bs-body-color-rgb), 0.03));
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-body-color);
}

.app-list-stat-card-header > span {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.app-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  padding: 0;
  border: 0;
  background: transparent;
  /* Inherit header size so --app-tooltip-icon-size: 1.25em resolves
     against the title, not this button (avoids a font-size cycle). */
  font-size: inherit;
  color: var(--app-tooltip-icon-color, currentColor);
  line-height: 1;
  cursor: help;
}

.app-tooltip-icon .ph {
  display: block;
  font-size: var(--app-tooltip-icon-size, 1.25em);
  line-height: 1;
}

.app-tooltip-icon:focus-visible {
  outline: 2px solid rgba(var(--bs-primary-rgb), 0.45);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.app-list-stat-card-body {
  padding: 1rem;
}

.app-list-stat-card-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-emphasis-color, #000);
}

.app-grid-card [data-list-grid] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.app-grid-card .gridjs-search {
  position: relative;
  width: min(100%, 19rem);
}

.app-grid-card .app-grid-head,
.app-grid-card .gridjs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.24);
  background-color: var(--bs-body-bg, #fff);
}

.app-grid-card .app-grid-head::after {
  display: none;
}

.app-grid-card .app-grid-head .gridjs-search {
  float: none;
  margin: 0;
  flex: 0 0 auto;
}

.app-grid-card .app-grid-head-action {
  flex: 0 0 auto;
  margin-left: auto;
}

.app-empty-list-state {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: none;
}

.app-empty-list-state-body {
  min-height: 20rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  padding-block: 3rem;
}

.app-empty-list-state-illustration {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  overflow: hidden;
}

.app-empty-list-state-illustration img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-grid-card .gridjs-search-input {
  width: 100%;
  padding-left: 2.2rem;
  border-color: var(--app-form-border-color);
}

.app-grid-card .gridjs-search-input:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.app-grid-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
  line-height: 1;
}

.app-grid-search-icon i {
  font-size: 1rem;
}

.app-grid-card .gridjs-tbody td.gridjs-message,
.app-grid-card td.gridjs-td.gridjs-message,
.app-grid-card .gridjs-message {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--bs-secondary-color);
  font-size: 1rem;
  background-color: var(--bs-card-bg, #fff);
  border-bottom: 0;
  white-space: normal;
}

.app-grid-card .gridjs-wrapper:has(.gridjs-message) {
  min-height: 8rem;
}


.app-grid-card .gridjs-table {
  border: 0;
  box-shadow: none;
  table-layout: auto;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
}

.app-grid-card .gridjs-th,
.app-grid-card .gridjs-td {
  border-left: 0;
  border-right: 0;
  border-top-color: rgba(15, 23, 42, 0.26);
  border-bottom-color: rgba(15, 23, 42, 0.26);
  text-align: left;
}

.app-grid-card .gridjs-th .gridjs-th-content {
  overflow: hidden;
  text-overflow: clip;
  float: none;
  width: auto;
  max-width: 100%;
  white-space: normal;
}

.app-grid-card .gridjs-td {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  vertical-align: middle;
}

.app-grid-card .gridjs-th[data-grid-nowrap],
.app-grid-card .gridjs-td[data-grid-nowrap] {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.app-grid-card .gridjs-th[data-grid-nowrap] .gridjs-th-content {
  white-space: nowrap;
}

.app-grid-card .gridjs-td .badge,
.app-grid-card .gridjs-td .app-grid-status,
.app-grid-card .gridjs-td .app-grid-capacity {
  white-space: nowrap;
}

.app-grid-card .gridjs-container,
.app-grid-card .gridjs-head,
.app-grid-card .gridjs-footer {
  box-shadow: none;
}

.app-grid-card .gridjs-container {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  /* Grid.js defaults to inline-block + overflow:hidden, which expands/clips. */
  overflow: visible;
}

.app-grid-card .gridjs-footer {
  border: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.24);
  border-radius: 0;
  box-shadow: none;
  padding: 0.75rem 1.5rem;
  /* Grid.js defaults this to z-index: 5, which covers row action menus. */
  z-index: 0;
}

.app-grid-card .gridjs-wrapper {
  position: relative;
  z-index: 1;
  /* Default Grid.js shadow sits above the footer once z-index is corrected. */
  box-shadow: none;
  border: 0;
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* Last resort on very narrow viewports when fixed columns still overflow. */
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.app-grid-card .gridjs-th {
  background-color: color-mix(in srgb, var(--bs-primary-bg-subtle) 50%, white);
  color: var(--bs-body-color);
  font-weight: 600;
}

.app-grid-card .app-grid-link {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: break-word;
  white-space: normal;
  color: var(--bs-link-color);
  font-weight: 400;
  text-decoration: none;
}

.app-grid-card .app-grid-link:is(:hover, :focus-visible) {
  color: var(--bs-link-hover-color);
  text-decoration: underline;
}

.app-breadcrumb {
  --bs-breadcrumb-margin-bottom: 0;
  --bs-breadcrumb-divider: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.875rem;
}

.app-breadcrumb .breadcrumb-item {
  display: flex;
  align-items: center;
  padding-left: 0;
  float: none;
}

.app-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  display: none;
  content: none;
  padding: 0;
}

.app-breadcrumb-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 0.5rem;
  color: var(--bs-secondary-color);
  line-height: 1;
}

.app-breadcrumb-separator i {
  display: block;
  font-size: 0.75rem;
  line-height: 1;
}

.app-breadcrumb .breadcrumb-item a {
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.app-breadcrumb .breadcrumb-item a:is(:hover, :focus-visible) {
  color: var(--bs-body-color);
  text-decoration: underline;
}

.app-breadcrumb .breadcrumb-item.active {
  color: var(--bs-body-color);
}

.app-grid-card th.gridjs-th-sort:is(:hover, :focus, :focus-visible) {
  background-color: color-mix(in srgb, var(--bs-primary-bg-subtle) 75%, white);
}

.app-grid-card th.gridjs-th-sort .gridjs-th-content {
  float: none;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

.app-grid-card th.gridjs-th-sort button.gridjs-sort {
  float: none;
  display: inline-block;
  vertical-align: middle;
  margin: 0 0 0 0.35rem;
  position: static;
}

.app-grid-actions-toggle {
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0 0.1rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.35rem;
  background-color: transparent;
  color: var(--bs-body-color);
  transition:
    color 0.2s ease,
    transform 0.2s ease;
}

.app-grid-actions-toggle::after {
  content: "";
  position: absolute;
  inset: -0.12rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(15, 23, 42, 0);
  opacity: 0;
  transform: scale(0.86);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.app-grid-actions-toggle i {
  color: var(--bs-emphasis-color);
  font-size: 1.3rem;
  line-height: 1;
  opacity: 1;
  transition: transform 0.2s ease;
}

.app-grid-actions-toggle:is(:hover, :focus, :focus-visible) {
  border: 0;
  padding: 0.2rem 0.5rem;
  background-color: transparent;
  color: var(--bs-emphasis-color);
  box-shadow: none;
  transform: translateY(-1px);
}

.app-grid-actions-toggle:is(:hover, :focus, :focus-visible)::after {
  opacity: 1;
  transform: scale(1);
  border-color: rgba(15, 23, 42, 0.3);
}

.app-grid-actions-toggle:is(:hover, :focus, :focus-visible) i {
  animation: app-grid-actions-icon-nudge 0.24s ease-out 1;
}

@keyframes app-grid-actions-icon-nudge {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.13);
  }
  100% {
    transform: scale(1);
  }
}

.app-grid-card th.gridjs-th[data-grid-actions],
.app-grid-card td.gridjs-td[data-grid-actions] {
  width: 3.4rem;
  padding-left: 0.25rem;
  padding-right: 1rem;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.app-grid-card td.gridjs-td[data-grid-actions] .dropdown {
  display: flex;
  justify-content: center;
}

.app-grid-actions-menu {
  min-width: 11rem;
}

.app-grid-actions-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-grid-actions-menu .dropdown-item .ph {
  width: 1rem;
  min-width: 1rem;
  font-size: 1rem;
  line-height: 1;
}

.app-grid-actions-menu .dropdown-divider {
  border-top-color: var(--bs-border-color);
}

.sidebar-nav-footer {
  margin-top: auto;
  height: var(--app-shell-footer-height);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
}

.sidebar-collapse-toggle {
  min-height: 100%;
  color: rgba(255, 255, 255, 0.88);
}

.sidebar-collapse-toggle .sidebar-nav-icon {
  transition: transform 0.2s ease;
}

@media (min-width: 992px) {
  .sidebar-nav-menu {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
  }

  body.sidebar-is-collapsed .app-shell {
    grid-template-columns: var(--app-sidebar-collapsed-width) minmax(0, 1fr);
  }

  body.sidebar-is-collapsed .sidebar-brand-wrap {
    justify-content: center;
    padding-inline: 0.75rem;
  }

  body.sidebar-is-collapsed .sidebar-brand-link {
    justify-content: center;
    width: 100%;
  }

  body.sidebar-is-collapsed .sidebar-brand-logo-full {
    display: none;
  }

  body.sidebar-is-collapsed .sidebar-brand-logo-symbol {
    display: block;
  }

  body.sidebar-is-collapsed .sidebar-nav .nav-link,
  body.sidebar-is-collapsed .sidebar-group-toggle-collapsed,
  body.sidebar-is-collapsed .sidebar-collapse-toggle {
    justify-content: center;
    padding-inline: 0;
  }

  body.sidebar-is-collapsed .sidebar-nav .nav-link::after {
    width: var(--app-sidebar-collapsed-active-dot-size);
    height: var(--app-sidebar-collapsed-active-dot-size);
    right: auto;
    left: 50%;
    top: auto;
    bottom: 0.38rem;
    transform: translateX(-50%) scale(0);
  }

  body.sidebar-is-collapsed .sidebar-nav .nav-link.active::after {
    transform: translateX(-50%) scale(1);
  }

  body.sidebar-is-collapsed .sidebar-group-toggle-expanded {
    display: none;
  }

  body.sidebar-is-collapsed .sidebar-group-toggle-collapsed {
    display: flex;
  }

  body.sidebar-is-collapsed .sidebar-nav-menu {
    overflow: visible;
  }

  body.sidebar-is-collapsed .sidebar-nav-label,
  body.sidebar-is-collapsed .sidebar-group-label,
  body.sidebar-is-collapsed .sidebar-collapse-label,
  body.sidebar-is-collapsed .sidebar-group-chevron,
  body.sidebar-is-collapsed .sidebar-section-label {
    display: none;
  }

  body.sidebar-is-collapsed .sidebar-group-label-wrap {
    justify-content: center;
    width: 100%;
  }

  body.sidebar-is-collapsed .sidebar-subnav {
    display: none !important;
  }
}

.app-main {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--app-z-header);
  min-height: var(--app-shell-header-height);
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0 var(--app-shell-inline-padding);
}

.app-shell-section {
  padding-inline: var(--app-shell-inline-padding);
}

.app-content {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  background-color: var(--bs-secondary-bg, #e9ecef);
  min-width: 0;
  max-width: 100%;
}

.page-header {
  min-width: 0;
  max-width: 100%;
}

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.page-header-title {
  min-width: 0;
  flex: 1 1 16rem;
  max-width: 36rem;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  margin-inline-start: auto;
  min-width: 0;
  max-width: 100%;
}

/* Shell actions and dropdowns */

.user-badge {
  width: 2.875rem;
  height: 2.875rem;
  border-radius: 50%;
  background: var(--app-header-avatar-bg);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--app-header-avatar-color);
}

.app-header-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.75rem;
  min-width: 0;
  min-height: var(--app-shell-header-height);
}

.app-header-context-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  gap: 0.875rem;
  min-width: 0;
  margin-right: 0;
}

.app-header-actions,
.app-header-comms-group {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.app-header-divider {
  color: rgba(33, 37, 41, 0.32);
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.75rem;
  flex-shrink: 0;
}

.app-header-context-copy {
  max-width: min(32rem, 45vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 400;
  color: #212529;
}

.app-header-context-copy-primary,
.app-header-context-copy-secondary {
  display: inline;
}

.app-header-context-copy-primary {
  font-weight: 400;
}

.app-header-context-copy-secondary {
  font-weight: 500;
}

.app-header-context-copy-separator {
  color: currentColor;
  font-size: 0.82em;
  line-height: 1;
  margin-inline: 0.4rem;
  vertical-align: baseline;
}

.app-header-icon-button,
.app-header-avatar-button {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  border-radius: 999px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  box-shadow: none;
  flex-shrink: 0;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.app-header-icon-button {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--app-header-icon-bg);
  color: var(--app-header-icon-color);
}

.app-header-avatar-button {
  width: 2.875rem;
  height: 2.875rem;
  background: var(--app-header-avatar-bg);
  color: var(--app-header-avatar-color);
}

.app-header-icon-button:hover,
.app-header-icon-button:focus-visible,
.app-header-context-switch-button:hover,
.app-header-context-switch-button:focus-visible {
  background: var(--app-header-icon-hover-bg);
  color: var(--app-header-icon-hover-color);
}

.app-header-icon-button i {
  font-size: 1.15rem;
  line-height: 1;
}

.app-header-avatar-button:hover,
.app-header-avatar-button:focus-visible {
  background: var(--app-header-avatar-hover-bg);
  color: var(--app-header-avatar-hover-color);
}

.app-header-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.app-header-avatar-button:has(.app-header-avatar-image) {
  overflow: hidden;
  background: transparent;
}

.app-header-avatar-button:has(.app-header-avatar-image):hover,
.app-header-avatar-button:has(.app-header-avatar-image):focus-visible {
  background: transparent;
}

.app-header-counter {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  min-width: 1.2rem;
  height: 1.2rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--app-sidebar-accent);
  border: 1px solid var(--app-header-counter-border-color);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

.app-header-dropdown {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.app-dropdown-menu {
  min-width: 18rem;
  margin-top: 0.9rem;
  border: 1px solid var(--app-dropdown-border-color);
  border-radius: var(--app-dropdown-radius);
  box-shadow: none;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.app-dropdown-menu .dropdown-divider {
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-top: 1px solid var(--app-dropdown-divider-color);
  background: none;
  opacity: 1;
}

.app-dropdown-menu .dropdown-item,
.app-dropdown-item {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #212529;
  text-align: left;
}

.app-dropdown-menu .dropdown-item:hover,
.app-dropdown-menu .dropdown-item:focus-visible,
.app-dropdown-item:hover,
.app-dropdown-item:focus-visible {
  background: var(--app-dropdown-hover-bg);
  color: #212529;
}

.app-dropdown-link {
  color: var(--bs-link-color);
  font-size: 0.875rem;
  font-weight: 400;
  text-decoration: none;
}

.app-dropdown-link:hover,
.app-dropdown-link:focus-visible {
  color: var(--bs-link-hover-color);
}

.app-dropdown-header {
  padding: 1rem;
  background: #fff;
  border-bottom: 1px solid var(--app-dropdown-divider-color);
}

.app-context-menu {
  width: min(28rem, calc(100vw - 2rem));
}

.app-context-search {
  margin-top: 0.75rem;
}

.app-context-search-wrap {
  position: relative;
}

.app-context-search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #6c757d;
  pointer-events: none;
}

.app-context-search-input {
  min-height: 2.75rem;
  padding-left: 2.6rem;
  font-size: 0.95rem;
}

.app-context-list,
.app-notification-list {
  max-height: 21rem;
  overflow-y: auto;
  padding: 0;
}

.app-context-item + .app-context-item {
  margin-top: 0;
  border-top: 1px solid var(--app-dropdown-divider-color);
}

.app-context-action {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 0.8rem 1rem;
  box-shadow: none;
  white-space: normal;
}

.app-context-action:hover,
.app-context-action:focus-visible {
  background: var(--app-dropdown-hover-bg);
}

.app-context-item.is-current .app-context-action {
  background: #f8f9fa;
}

.app-context-action-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.app-context-action-title,
.app-profile-name {
  font-weight: 700;
  color: #212529;
}

.app-notification-title {
  font-weight: 400;
  color: #212529;
}

.app-notification-item.is-unread .app-notification-title {
  font-weight: 500;
}

.app-context-action-meta,
.app-notification-meta,
.app-profile-email {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.app-context-current-indicator {
  width: var(--app-sidebar-active-dot-size);
  height: var(--app-sidebar-active-dot-size);
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--app-sidebar-active);
}

.app-context-empty {
  padding: 0.75rem 1rem 1rem;
}

.app-notification-menu {
  width: min(24rem, calc(100vw - 2rem));
}

.app-notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 0;
}

.app-notification-item.is-unread {
  background: #fff;
}

.app-notification-item + .app-notification-item {
  border-top: 1px solid var(--app-dropdown-divider-color);
}

.app-notification-item:is(:hover, :focus-within) {
  background: var(--app-dropdown-hover-bg);
}

.app-dropdown-footer {
  border-top: 1px solid var(--app-dropdown-divider-color);
  padding: 0.75rem 1rem;
  background: #fff;
}

.app-dropdown-footer .app-dropdown-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-notification-menu .app-dropdown-header {
  align-items: center;
}

.app-notification-menu [data-mark-notifications-read-wrap] {
  margin: 0;
}

.app-notification-menu [data-mark-notifications-read],
.app-notification-menu .app-dropdown-footer .app-dropdown-link {
  color: var(--bs-primary);
  font-size: 0.875rem;
  font-weight: 400;
}

.app-notification-menu [data-mark-notifications-read]:hover,
.app-notification-menu [data-mark-notifications-read]:focus-visible,
.app-notification-menu .app-dropdown-footer .app-dropdown-link:hover,
.app-notification-menu .app-dropdown-footer .app-dropdown-link:focus-visible {
  color: var(--bs-link-hover-color);
}

.app-notification-menu .app-dropdown-footer {
  display: flex;
  justify-content: center;
}

.app-notification-status {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  margin-top: 0.5rem;
  flex-shrink: 0;
  background: transparent;
}

.app-notification-item.is-unread .app-notification-status {
  background: var(--app-sidebar-accent);
}

.app-notification-title,
.app-notification-meta,
.app-profile-name,
.app-profile-email {
  display: block;
}

.app-notification-item-form {
  display: contents;
}

button.app-notification-item {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.app-notification-empty {
  padding: 1.25rem 1rem;
}

.app-notification-history-list {
  max-height: none;
}

.app-notification-pagination {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.app-profile-menu {
  width: min(16rem, calc(100vw - 2rem));
}

.app-profile-summary {
  padding: 1rem;
}

.app-profile-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start;
}

.app-profile-menu-icon {
  width: 1rem;
  min-width: 1rem;
  font-size: 1rem;
  line-height: 1;
  color: currentColor;
}

.app-profile-menu .dropdown-item:hover,
.app-profile-menu .dropdown-item:focus-visible {
  background: var(--app-dropdown-hover-bg);
}

.app-grid-actions-menu .dropdown-item.text-danger:hover,
.app-grid-actions-menu .dropdown-item.text-danger:focus-visible {
  color: var(--bs-danger) !important;
}

.app-profile-menu .dropdown-item.text-danger:hover,
.app-profile-menu .dropdown-item.text-danger:focus-visible {
  color: var(--bs-danger) !important;
}

/* Legal pages (privacy / terms) */

.legal-shell {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 45% at 50% -8%, rgba(60, 113, 247, 0.12), transparent 55%),
    linear-gradient(180deg, #f3f5f8 0%, #e8ecf1 100%);
}

.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--app-shell-brand-bg, #000);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-topbar-inner {
  width: min(100% - 2rem, 48rem);
  margin-inline: auto;
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.legal-brand-logo {
  height: 2.5rem;
  width: auto;
  max-width: min(170px, 52vw);
  display: block;
  object-fit: contain;
}

.legal-topbar-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  white-space: nowrap;
}

.legal-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
}

.legal-topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.legal-topbar-back i {
  font-size: 1.125rem;
  line-height: 1;
}

.legal-topbar-link:hover,
.legal-topbar-link:focus-visible {
  color: #fff;
}

.legal-main {
  flex: 1 0 auto;
  width: min(100% - 2rem, 48rem);
  margin: 2rem auto 3rem;
}

.legal-document {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 1rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.legal-document-header {
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.legal-eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bs-primary);
}

.legal-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--bs-body-color);
}

.legal-updated {
  font-size: 0.9375rem;
  color: var(--bs-secondary-color);
}

.legal-body {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--bs-body-color);
}

.legal-body > *:first-child {
  margin-top: 0;
}

.legal-body h2 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
  color: var(--bs-body-color);
}

.legal-body p,
.legal-body ul {
  margin-bottom: 1rem;
}

.legal-body ul {
  padding-left: 1.25rem;
}

.legal-body li {
  margin-bottom: 0.4rem;
}

.legal-body li::marker {
  color: rgba(var(--bs-primary-rgb), 0.55);
}

.legal-body a {
  color: var(--bs-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.legal-body a:hover {
  color: var(--bs-link-hover-color);
}

.legal-org {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.15rem;
  background: #f8f9fb;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.75rem;
}

.legal-org-heading {
  margin: 0 0 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
}

.legal-org-list {
  display: grid;
  gap: 0.65rem 1.25rem;
  margin: 0;
}

.legal-org-list > div {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
  gap: 0.35rem 1rem;
  align-items: baseline;
}

.legal-org-list dt {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bs-secondary-color);
}

.legal-org-list dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--bs-body-color);
  word-break: break-word;
}

.legal-footer {
  flex-shrink: 0;
  width: min(100% - 2rem, 48rem);
  margin: 0 auto;
  padding-block: 1rem 1.5rem;
  background: transparent;
  border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
}

@media (max-width: 575.98px) {
  .legal-topbar-inner {
    min-height: 3.75rem;
  }

  .legal-brand-logo {
    height: 2rem;
  }

  .legal-main {
    margin-top: 1.25rem;
    margin-bottom: 2rem;
  }

  .legal-document {
    border-radius: 0.75rem;
    padding: 1.25rem;
  }

  .legal-body {
    font-size: 1rem;
  }

  .legal-org-list > div {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

/* Error pages (403 / 404 / 500 / 501). Standalone shell — no app chrome. */

.error-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #d7e4f4;
}

.error-header {
  flex: 0 0 auto;
  background: var(--bs-dark);
  border-bottom: 1px solid var(--bs-gray-600, #6c757d);
  padding: 1rem 1.5rem;
}

.error-brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.error-brand-logo {
  display: block;
  height: 38px;
  width: auto;
  max-width: min(180px, 52vw);
  object-fit: contain;
}

.error-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: 0;
  background-color: #d7e4f4;
  background-image: var(--error-illustration);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: right center;
  padding: 3rem 3rem 1.5rem;
}

.error-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  width: min(100%, 41.6875rem);
}

.error-heading {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.error-title {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-emphasis-color);
}

.error-phonetic {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-body-color);
}

.error-divider {
  width: 100%;
  margin: 0;
  border: 0;
  border-bottom: 1px dashed var(--bs-border-color, #899299);
}

.error-body {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--bs-body-color);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 991.98px) {
  .error-main {
    align-items: flex-start;
    padding: 2rem 1.5rem 1.5rem;
    background-position: 72% center;
  }

  .error-title {
    font-size: 2rem;
  }

  .error-phonetic {
    font-size: 1.25rem;
  }

  .error-body {
    font-size: 1.125rem;
  }
}

@media (max-width: 575.98px) {
  .error-header {
    padding: 0.75rem 1rem;
  }

  .error-main {
    padding: 1.5rem 1rem 1.25rem;
    background-position: 82% center;
  }

  .error-title {
    font-size: 1.75rem;
  }

  .error-phonetic {
    font-size: 1.0625rem;
  }
}

/* Responsive shell */

@media (max-width: 991.98px) {
  .auth-layout {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .auth-brand-panel {
    display: none;
  }

  .auth-form-panel {
    min-height: 100dvh;
    padding: 1rem 1rem 0;
  }

  .auth-form-content {
    --auth-space-xl: clamp(1rem, 4vh, 2rem);
    --auth-space-lg: clamp(1.125rem, 3vh, 1.75rem);
    --auth-space-md: clamp(0.875rem, 2.25vh, 1.25rem);
  }

  .auth-form-title {
    font-size: 1.875rem;
  }

  .auth-footer {
    flex-shrink: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: relative;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  /* On stacked mobile layout, pin the bar to the viewport instead. */
  html:has(.app-shell-action-bar),
  body:has(.app-shell-action-bar) {
    overflow: visible;
  }

  .app-main:has(.app-shell-action-bar) {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .app-main:has(.app-shell-action-bar) .app-content {
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

  .app-shell-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .sidebar-brand-wrap {
    justify-content: flex-start;
    padding-inline: 1rem;
  }

  .sidebar-mobile-actions {
    --app-header-icon-bg: rgba(255, 255, 255, 0.1);
    --app-header-icon-color: rgba(255, 255, 255, 0.9);
    --app-header-icon-hover-bg: rgba(255, 255, 255, 0.16);
    --app-header-icon-hover-color: #fff;
    --app-header-avatar-bg: rgba(254, 203, 161, 0.24);
    --app-header-avatar-color: #ffd9b3;
    --app-header-avatar-hover-bg: rgba(254, 203, 161, 0.32);
    --app-header-avatar-hover-color: #fff2df;
    --app-header-counter-border-color: var(--app-shell-brand-bg);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
  }

  .sidebar-mobile-actions .app-header-comms-group {
    gap: 0.4rem;
  }

  .sidebar-mobile-actions .app-header-divider {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.9rem;
    min-width: 0.45rem;
  }

  .sidebar-mobile-actions .app-header-icon-button {
    width: 2.05rem;
    height: 2.05rem;
  }

  .sidebar-mobile-actions .app-header-avatar-button {
    width: 2.35rem;
    height: 2.35rem;
  }

  .sidebar-brand-logo-full {
    display: none;
  }

  .sidebar-brand-logo-symbol {
    display: block;
  }

  .sidebar-nav {
    padding: 0;
  }

  .sidebar-nav-menu {
    background: var(--app-sidebar-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.75rem;
    overflow: visible;
  }

  .sidebar-group-toggle-collapsed,
  .sidebar-subnav-popup {
    display: none !important;
  }

  .sidebar-nav-footer {
    display: none !important;
  }

  .app-header {
    display: none;
  }

  .app-header:has(.sos-panel) {
    display: flex;
  }

  .app-header:has(.sos-panel) .app-header-toolbar {
    display: none;
  }

  .app-shell-section {
    padding-inline: 1.25rem;
  }
}

@media (max-width: 575.98px) {
  .sidebar-brand-wrap {
    padding-inline: 0.875rem;
  }

  .app-grid-card .gridjs-search-input {
    width: 100%;
  }

  .sidebar-mobile-actions {
    gap: 0.3rem;
  }

  .sidebar-mobile-actions .app-header-comms-group {
    gap: 0.3rem;
  }

  .sidebar-mobile-actions .app-header-icon-button {
    width: 1.95rem;
    height: 1.95rem;
  }

  .sidebar-mobile-actions .app-header-avatar-button,
  .sidebar-mobile-actions .user-badge {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.9rem;
  }

  .app-dropdown-menu,
  .app-context-menu,
  .app-notification-menu,
  .app-profile-menu {
    width: min(22rem, calc(100vw - 1rem));
  }
}

/* Django messages → Bootstrap toasts (bottom-right).
   Position lives only here so server-rendered and JS toasts share one corner.
   Close is Phosphor `ph-x` at the same 1rem size as the status icon.
   Do not use Bootstrap `.btn-close` here — its 1em SVG + padding fills
   the toast height and looks oversized next to the body copy. */
.app-toast-container {
  position: fixed;
  inset-inline-end: 0;
  bottom: 0;
  padding: 1rem;
  z-index: var(--app-z-toast);
  pointer-events: none;
}

.app-toast {
  min-width: min(22rem, calc(100vw - 1.5rem));
  box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.app-toast .toast-body {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.app-toast .toast-body .ph {
  font-size: 1rem;
  line-height: 1;
}

.app-toast-close {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0 0.75rem 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.75;
  line-height: 1;
}

.app-toast-close .ph {
  font-size: 1rem;
  line-height: 1;
}

.app-toast-close:hover,
.app-toast-close:focus-visible {
  opacity: 1;
}

.app-toast.text-bg-dark {
  background-color: var(--bs-black) !important;
}

/*
  Incidents: layout and chrome unique to this feature.

  Icon + caption + value rows use shared .app-meta-* (above). Do not add
  incident-sidebar-row / incident-review-field copies here.
*/
.incident-submit-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
}

.incident-method-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.incident-section-title {
  font-weight: 500;
  color: var(--bs-body-color);
}

.incident-method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .incident-method-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.incident-method-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0.95rem 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  cursor: pointer;
}

.incident-method-card:has(input:checked) {
  background-color: var(--bs-primary-bg-subtle);
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
}

.incident-method-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.incident-method-card .form-check-input {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.1875rem 0 0;
}

.incident-method-card-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
  color: inherit;
}

.incident-method-card-text {
  margin-left: calc(1.125rem + 0.75rem);
  font-size: 1rem;
  line-height: 1.5;
}

.incident-method-badge {
  align-self: flex-start;
  margin-left: calc(1.125rem + 0.75rem);
  line-height: 1;
  background-color: var(--bs-secondary);
  color: var(--bs-white);
}

.incident-method-card:has(input:checked) .incident-method-badge {
  background-color: var(--bs-primary);
}

.incident-template-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.incident-template-section[hidden] {
  display: none !important;
}

.incident-method-panels {
  min-width: 0;
}

.incident-picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

@media (min-width: 768px) {
  .incident-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .incident-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .incident-template-board-cols-2.incident-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.incident-template-board {
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.5rem;
  background-color: var(--bs-secondary-border-subtle, #c4c8cb);
  gap: 1px;
}

.incident-template-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bs-body-bg);
}

.incident-template-column-header {
  display: flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.25rem 0.65rem;
  color: var(--bs-white);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.125rem;
  text-transform: uppercase;
}

.incident-template-column-physical .incident-template-column-header {
  background-color: var(--bs-primary);
}

.incident-template-column-verbal .incident-template-column-header {
  background-color: var(--bs-danger);
}

.incident-template-column-electronic .incident-template-column-header {
  background-color: var(--bs-dark);
}

.incident-template-column-other .incident-template-column-header {
  background-color: var(--bs-info);
}

.incident-template-column-accident .incident-template-column-header {
  background-color: var(--bs-primary);
}

.incident-template-column-illness .incident-template-column-header {
  background-color: var(--bs-dark);
}

.incident-template-column-academic .incident-template-column-header {
  background-color: var(--bs-primary);
}

.incident-template-column-social .incident-template-column-header {
  background-color: var(--bs-info);
}

.incident-template-column-self-regulation .incident-template-column-header {
  background-color: var(--bs-dark);
}

.incident-template-column-leadership .incident-template-column-header {
  background-color: var(--bs-success);
}

.incident-template-column-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
}

.incident-template-card {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.5rem;
}

.incident-template-card-banner {
  position: relative;
  height: 3.75rem;
  overflow: hidden;
  background-color: var(--bs-secondary-bg);
}

.incident-template-card-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.incident-template-card-banner-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(24, 39, 69, 0.5) 100%);
  pointer-events: none;
}

.incident-template-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.5rem 1rem 1rem;
}

.incident-template-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--bs-body-color);
}

.incident-template-card-text {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.125rem;
  color: var(--bs-body-color);
}

.incident-template-card-link {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--bs-link-color, var(--bs-primary));
  text-decoration: none;
}

.incident-kind-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.incident-kind-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 11.5rem;
  padding: 1rem;
  border: 1px solid var(--bs-border-color-translucent, rgba(0, 0, 0, 0.175));
  border-radius: var(--bs-border-radius, 0.375rem);
  color: var(--bs-body-color);
  text-decoration: none;
}

.incident-kind-card:hover {
  color: var(--bs-body-color);
}

.incident-kind-card-negative {
  background-color: #ffcd39;
}

.incident-kind-card-first-aid {
  background-color: #f2685a;
}

.incident-kind-card-positive {
  background-color: #4ca97e;
}

.incident-kind-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
}

.incident-kind-card-text {
  margin: 0 0 auto;
  font-size: 1rem;
  line-height: 1.5;
}

.incident-kind-card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  pointer-events: none;
}

tr:has(.app-grid-row-invalid) td {
  color: var(--bs-secondary-color);
  text-decoration: line-through;
}

tr:has(.app-grid-row-invalid) td:not(:last-child) a {
  color: var(--bs-secondary-color);
  text-decoration: line-through;
}

tr:has(.app-grid-row-invalid) td:last-child,
tr:has(.app-grid-row-invalid) td:last-child * {
  text-decoration: none;
}

.incident-template-layout {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  width: 100%;
}

.incident-template-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

/* Main column fills leftover width beside the fixed sidebar (wizard + detail). */
.incident-template-wizard,
.incident-detail-column {
  min-width: 0;
  flex: 1 1 auto;
}

.incident-detail-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 992px) {
  .incident-template-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .incident-template-sidebar {
    width: 17.0625rem;
    flex: 0 0 17.0625rem;
  }
}

/* Sidebar card chrome only. Rows inside use .app-meta-*. */
.incident-sidebar-card {
  background-color: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.375rem;
  padding: 1rem 1rem 1.5rem;
}

.incident-sidebar-identity {
  padding: 0 0 1.5rem;
  overflow: hidden;
}

.incident-sidebar-identity-banner {
  position: relative;
  height: 4.625rem;
  overflow: hidden;
  background-color: var(--bs-primary);
}

.incident-sidebar-identity-banner img {
  display: block;
  width: 100%;
  height: 196%;
  max-width: none;
  object-fit: cover;
  object-position: center 18%;
  position: relative;
  top: -40%;
}

.incident-sidebar-identity-banner::before,
.incident-sidebar-identity-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.incident-sidebar-identity-banner::before {
  background: linear-gradient(
    2deg,
    rgba(0, 0, 0, 0.4) 5%,
    rgb(102, 102, 102) 78%
  );
  mix-blend-mode: overlay;
}

.incident-sidebar-identity-banner::after {
  background: linear-gradient(
    0.3deg,
    rgba(0, 0, 0, 0.6) 1%,
    rgba(102, 102, 102, 0) 79%
  );
  mix-blend-mode: multiply;
}

.incident-sidebar-identity-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1rem 0;
}

.incident-sidebar-identity-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--bs-emphasis-color, #000);
}

.incident-sidebar-identity-text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-body-color);
}

.incident-sidebar-card-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.app-choice-list .form-check,
.incident-choice-list .form-check {
  margin-bottom: 0;
}

.incident-emergency-switch {
  min-height: 1.5rem;
  padding-left: 2.5rem;
}

.incident-parent-notes-section {
  box-shadow: inset 0.25rem 0 0 var(--bs-warning);
}

.incident-parent-notes-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  margin-bottom: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  background-color: #fff3cd;
  color: #664d03;
  line-height: 1;
}

.incident-ai-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.incident-ai-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.incident-template-form-actions {
  justify-content: space-between;
}

.incident-template-form-actions-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.incident-template-cancel {
  padding-left: 0;
  text-decoration: none;
}

.incident-behaviour-accordion .accordion-item {
  overflow: hidden;
}

.incident-behaviour-accordion .accordion-button {
  font-size: 1rem;
  font-weight: 400;
}

.incident-behaviour-accordion .accordion-button:not(.collapsed) {
  color: var(--bs-primary-text-emphasis, #052c65);
  background-color: var(--bs-primary-bg-subtle, #cfe2ff);
  box-shadow: none;
}

.incident-behaviour-accordion-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin-right: 0.5rem;
}

.incident-behaviour-count {
  min-width: 1.5rem;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.incident-behaviour-accordion .accordion-body {
  padding-top: 1rem;
}

.incident-datetime-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.incident-datetime-control {
  min-width: 0;
}

.incident-detail-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}

.incident-detail-main-title {
  font-weight: 500;
  color: var(--bs-emphasis-color, #000);
}

.incident-detail-rule {
  width: 100%;
  margin: 0;
  border: 0;
  border-top: 1px dashed var(--bs-secondary-border-subtle, #c4c8cb);
  opacity: 1;
}

/* Preserve line breaks in parent-visible notes (used with .app-meta-value). */
.incident-detail-notes {
  white-space: pre-wrap;
}

@media (min-width: 576px) {
  .incident-datetime-row {
    grid-template-columns: 1fr 1fr;
  }
}

.app-form-section[id^="incident-section-"] {
  scroll-margin-top: 1rem;
}

.incident-stepper {
  width: 100%;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
}

.incident-stepper-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-stepper-step {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: center;
  min-width: 0;
  padding-block: 1.5rem;
}

.incident-stepper-index {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.9375rem;
  height: 1.9375rem;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.incident-stepper-done .incident-stepper-index {
  background-color: var(--bs-success, #198754);
  color: var(--bs-white, #fff);
}

.incident-stepper-current .incident-stepper-index {
  background-color: var(--bs-primary, #3c71f7);
  color: var(--bs-white, #fff);
}

.incident-stepper-upcoming .incident-stepper-index {
  background-color: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.incident-stepper-label {
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.3;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  white-space: nowrap;
}

.incident-stepper-current .incident-stepper-label {
  font-weight: 500;
}

.incident-stepper-line {
  flex: 1 1 0;
  align-self: center;
  min-width: 0.5rem;
  height: 0;
  border-top: 1px dotted var(--bs-border-color, #899299);
}

.incident-stepper-line-before {
  margin-right: 0.5rem;
}

.incident-stepper-line-after {
  margin-left: 0.5rem;
}

.incident-stepper-done .incident-stepper-line-before,
.incident-stepper-done .incident-stepper-line-after,
.incident-stepper-current .incident-stepper-line-before {
  border-top-color: var(--bs-primary, #3c71f7);
}

.incident-review-row {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr) auto;
  grid-template-areas: "title body edit";
  align-items: start;
  column-gap: 0;
  row-gap: 0.75rem;
  padding: 1.5rem 1rem 1.5rem 1.5rem;
  border-bottom: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
}

.incident-review-row:last-of-type {
  border-bottom: 0;
}

.incident-review-title-wrap {
  grid-area: title;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  padding-right: 0.5rem;
}

.incident-review-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.incident-review-body {
  grid-area: body;
  min-width: 0;
}

.incident-review-edit {
  grid-area: edit;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  color: var(--bs-primary, #3c71f7);
  text-decoration: none;
}

.incident-review-edit .ph {
  font-size: 1.25rem;
  line-height: 1;
}

.incident-review-edit:hover,
.incident-review-edit:focus-visible {
  color: var(--bs-primary, #3c71f7);
}

@media (max-width: 575.98px) {
  .incident-stepper {
    padding: 0 0.75rem;
  }

  .incident-stepper-step {
    padding-block: 1rem;
  }

  .incident-stepper-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .incident-review-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title edit"
      "body body";
    padding: 1rem;
  }

  .incident-review-title-wrap {
    padding-right: 0;
  }

  .app-form-success-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .app-form-success-actions .btn {
    width: 100%;
  }
}

.incident-additional-card {
  background-color: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.375rem;
  overflow: hidden;
}

.incident-additional-header {
  padding: 1rem;
  border-bottom: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
}

.incident-additional-title {
  font-weight: 700;
  color: var(--bs-emphasis-color, #000);
}

.incident-additional-timeline {
  list-style: none;
  margin: 0;
  padding: 0 1.5rem 1.5rem;
}

.incident-additional-head,
.incident-additional-body {
  display: grid;
  grid-template-columns: 2.6875rem minmax(0, 1fr);
}

.incident-additional-head {
  align-items: center;
  padding-top: 1.5rem;
}

.incident-additional-marker {
  display: block;
  width: 1.9375rem;
  height: 1.9375rem;
  border-radius: 50%;
  background-color: var(--bs-secondary-bg, #e9ecef);
}

.incident-additional-connector {
  justify-self: center;
  align-self: stretch;
  width: 1px;
  background-color: rgba(0, 0, 0, 0.1);
}

.incident-additional-meta,
.incident-additional-text {
  grid-column: 2;
  min-width: 0;
}

.incident-additional-date {
  display: block;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.incident-additional-author {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-link-color, #0a58ca);
}

.incident-additional-text {
  padding: 1rem 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--bs-body-color, #212529);
}

.incident-additional-item:last-child .incident-additional-text {
  padding-bottom: 0;
}

.app-student-history {
  padding: 0 1.5rem 1.5rem;
}

.app-student-history-group + .app-student-history-group {
  margin-top: 0.5rem;
}

.app-student-history-year {
  margin: 0;
  padding: 1.25rem 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-student-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-student-history-item {
  display: grid;
  grid-template-columns: 2.6875rem minmax(0, 1fr);
}

.app-student-history-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-student-history-marker {
  display: block;
  width: 1rem;
  height: 1rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--bs-secondary-color);
}

.app-student-history-marker-success {
  background-color: var(--bs-success);
}

.app-student-history-marker-danger {
  background-color: var(--bs-danger);
}

.app-student-history-marker-warning {
  background-color: var(--bs-warning);
}

.app-student-history-marker-secondary {
  background-color: #6c757d;
}

.app-student-history-marker-info {
  background-color: var(--bs-info);
}

.app-student-history-connector {
  flex: 1 1 auto;
  width: 1px;
  min-height: 1.25rem;
  background-color: rgba(0, 0, 0, 0.1);
}

.app-student-history-item:not(:has(~ .app-student-history-item:not([hidden])))
  .app-student-history-connector {
  display: none;
}

.app-student-history-body {
  min-width: 0;
  padding: 0 0 1.25rem;
}

.app-student-history-item:last-child .app-student-history-body {
  padding-bottom: 0;
}

.app-student-history-date {
  display: block;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-student-history-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.app-student-history-title {
  display: inline;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
}

.app-student-history-title:hover {
  text-decoration: underline;
}

.app-student-history-caption {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.app-student-history-role {
  margin-top: 0.35rem;
}

.app-student-history-item-muted .app-student-history-date,
.app-student-history-item-muted .app-student-history-title,
.app-student-history-item-muted .app-student-history-caption {
  text-decoration: line-through;
  opacity: 0.65;
}

.app-student-history-item-muted .app-student-history-role {
  opacity: 0.65;
}

[data-append-incident-modal] textarea.form-control {
  min-height: 13rem;
}

.app-inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: inherit;
}

.app-inbox-item + .app-inbox-item {
  border-top: 1px solid var(--app-form-border-color, var(--bs-border-color));
}

.app-notification-menu .app-inbox-item + .app-inbox-item {
  border-top-color: var(--app-dropdown-divider-color);
}

.app-inbox-item:is(:hover, :focus-within) {
  background: var(--bs-tertiary-bg, #f8f9fa);
}

.app-inbox-item.is-unread .app-inbox-item-title {
  font-weight: 600;
}

.app-inbox-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.app-inbox-item-title,
.app-inbox-item-meta {
  display: block;
}

.app-inbox-item-title {
  color: var(--bs-body-color);
}

.app-inbox-item-meta {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.app-inbox-item-time {
  margin-inline-start: 0.35rem;
  font-weight: 500;
}

.app-inbox-item-clip {
  color: var(--bs-secondary-color);
  margin-top: 0.15rem;
}

.app-inbox-detail {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-inbox-recipients-body {
  padding: 1.25rem 1.5rem;
}

.app-inbox-read-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.app-inbox-read-meter {
  height: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bs-tertiary-bg, #e9ecef);
}

.app-inbox-read-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--bs-primary),
    color-mix(in srgb, var(--bs-primary) 70%, #7dd3fc)
  );
}

.app-inbox-read-meter-label {
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.app-inbox-participants {
  --inbox-chip-gap: 0.4rem;
  --inbox-chip-height: 1.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--inbox-chip-gap);
  list-style: none;
  padding: 0;
  margin: 0;
}

.app-inbox-participants.is-collapsed {
  max-height: calc((var(--inbox-chip-height) * 2) + var(--inbox-chip-gap));
  overflow: hidden;
}

.app-inbox-participant {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--inbox-chip-height);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--bs-tertiary-bg, #f8f9fa);
  font-size: 0.8125rem;
  line-height: 1.25;
}

.app-inbox-participant.is-unread {
  color: var(--bs-secondary-color);
}

.app-inbox-participant .ph {
  font-size: 0.95rem;
}

.app-inbox-recipients-toggle {
  padding-inline: 0;
  margin-top: 0.65rem;
}

.app-inbox-thread-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
}

.app-inbox-message {
  padding: 1rem 1.1rem;
  border: 1px solid var(--app-form-border-color, var(--bs-border-color));
  border-radius: 0.75rem;
  background: var(--bs-body-bg);
}

.app-inbox-message-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.app-inbox-message-author {
  font-weight: 600;
}

.app-inbox-message-time {
  color: var(--bs-secondary-color);
  font-size: 0.8125rem;
}

.app-inbox-message-body {
  line-height: 1.6;
}

.app-inbox-message-body > :last-child {
  margin-bottom: 0;
}

.app-inbox-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0.85rem 0 0;
  margin: 0;
}

.app-inbox-attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--app-form-border-color, var(--bs-border-color));
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  font-size: 0.8125rem;
}

.app-inbox-attachment:hover,
.app-inbox-attachment:focus-visible {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.app-inbox-attachment-size {
  color: var(--bs-secondary-color);
}

.app-inbox-compose,
.app-inbox-reply {
  padding: 1.25rem 1.5rem;
}

.app-form-field:has(.app-inbox-audience[hidden]) {
  display: none;
}

.app-inbox-audience {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.app-inbox-audience-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-inbox-audience-chip {
  margin: 0;
  cursor: pointer;
}

.app-inbox-audience-chip-face {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--app-form-border-color, var(--bs-border-color));
  border-radius: 999px;
  font-size: 0.875rem;
  line-height: 1.25;
  color: inherit;
  background: var(--bs-body-bg);
}

.app-inbox-audience-chip-count {
  color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums;
}

.app-inbox-audience-chip:hover .app-inbox-audience-chip-face,
.app-inbox-audience-chip:focus-within .app-inbox-audience-chip-face {
  border-color: var(--bs-primary);
}

.app-inbox-audience-chip:has(input:checked) .app-inbox-audience-chip-face {
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--bs-primary);
}

.app-inbox-audience-chip:has(input:checked) .app-inbox-audience-chip-count {
  color: inherit;
}

.app-inbox-recipient-total {
  margin: 0 0 0.75rem;
}

.app-inbox-file-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.app-inbox-file-names {
  color: var(--bs-secondary-color);
  font-size: 0.875rem;
}

.app-inbox-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.app-inbox-compose-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

trix-toolbar {
  margin-bottom: 0.5rem;
}

trix-editor.app-trix-editor {
  min-height: 12rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--app-form-border-color, var(--bs-border-color));
  border-radius: 0.5rem;
  background: var(--bs-body-bg);
}

trix-editor.app-trix-editor:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
  outline: none;
}

.app-meeting-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 1.5rem;
}

.app-grid-card .app-meeting-list {
  padding: 1rem 1.5rem 1.5rem;
  margin-bottom: 0;
}

.app-meeting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
  padding: 1rem 1.25rem;
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.375rem;
  background: var(--bs-body-bg);
}

.app-meeting-card-cancelled {
  opacity: 0.65;
}

.app-meeting-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  column-gap: 2.75rem;
  row-gap: 0.75rem;
  min-width: 0;
}

.app-meeting-type {
  min-width: 9rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.app-meeting-schedule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 2.75rem;
  row-gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

.app-meeting-student {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--bs-primary);
  text-decoration: none;
}

.app-meeting-student:hover {
  text-decoration: underline;
}

.app-meeting-when {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-meeting-when .app-meta-icon {
  width: 2.5rem;
  height: 2.5rem;
}

.app-meeting-actions {
  flex-shrink: 0;
}

@media (max-width: 991.98px) {
  .app-meeting-card-body,
  .app-meeting-schedule {
    column-gap: 1.5rem;
  }
}

@media (max-width: 767.98px) {
  .app-meeting-card {
    align-items: flex-start;
    padding: 0.85rem 1rem;
  }

  .app-meeting-card-body {
    flex-direction: column;
    align-items: stretch;
    row-gap: 0.65rem;
  }

  .app-meeting-type {
    min-width: 0;
  }

  .app-meeting-schedule {
    column-gap: 1.25rem;
    row-gap: 0.65rem;
  }
}

.app-home-alert {
  margin-bottom: 1.5rem;
  color: var(--bs-primary-text-emphasis, #052c65);
}

.app-home-alert:hover {
  color: var(--bs-primary-text-emphasis, #052c65);
}

.app-home-alert-icon,
.app-home-alert-arrow {
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.app-home-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  row-gap: 0.35rem;
  min-width: 0;
  margin: 0 0 1.5rem;
  border-left: 4px solid var(--bs-dark, #212529);
  padding-left: 1rem;
}

.app-home-events-wrap + .app-home-section-heading,
.app-meeting-list + .app-home-section-heading,
.app-grid-card-empty + .app-home-section-heading {
  margin-top: 2rem;
}

.app-home-section-heading + .app-list-tabs-bar {
  margin-top: 0;
}

.app-list-tabs-bar + .app-home-events-wrap {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
}

.app-list-tabs-bar + .app-grid-card-empty {
  margin-bottom: 1.5rem;
}

.app-home-section-heading + .app-grid-card-empty {
  margin-bottom: 1.5rem;
}

.app-home-section-title {
  flex: 0 0 auto;
}

.app-incident-trends .app-home-section-title {
  flex: 1 1 auto;
  min-width: 0;
}

.app-home-section-rule {
  flex: 1 1 auto;
  min-width: 1rem;
  border-top: 1px dotted var(--bs-border-color, #dee2e6);
}

.app-home-section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  color: var(--bs-link-color, var(--bs-primary));
  text-decoration: none;
}

.app-home-section-link:hover {
  color: var(--bs-link-hover-color, #305ac6);
  text-decoration: underline;
}

.app-home-events-wrap {
  margin-bottom: 1.5rem;
  max-width: 100%;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  border-radius: 0.375rem;
  /* Keep Bootstrap .table-responsive scrolling. overflow: hidden clipped columns. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-home-events-table {
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(15, 23, 42, 0.26);
}

.app-home-events-table thead th {
  background: color-mix(in srgb, var(--bs-primary-bg-subtle) 50%, white);
  font-weight: 500;
  white-space: nowrap;
}

.app-home-events-table td,
.app-home-events-table th {
  vertical-align: middle;
  padding: 0.65rem 1rem;
  border-left: 0;
  border-right: 0;
  border-top-color: rgba(15, 23, 42, 0.26);
  border-bottom-color: rgba(15, 23, 42, 0.26);
}

.app-home-events-table td a {
  text-decoration: none;
}

.app-home-events-table td a:not(.btn):is(:hover, :focus-visible) {
  text-decoration: underline;
}

.app-home-events-table .app-grid-status {
  gap: 0.5rem;
}

.app-home-events-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

/*
  Below md, six columns do not fit. Reflow each row into a card.
  Student and victim keep a real label (hidden from md up with .d-md-none)
  because the header row is not shown.
*/
@media (max-width: 767.98px) {
  .app-home-events-table-stack thead {
    display: none;
  }

  .app-home-events-table-stack,
  .app-home-events-table-stack tbody {
    display: block;
    width: 100%;
  }

  .app-home-events-table-stack tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title actions"
      "status status"
      "student student"
      "victim victim";
    column-gap: 0.75rem;
    row-gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.26);
  }

  .app-home-events-table-stack tr:last-child {
    border-bottom: 0;
  }

  .app-home-events-table-stack tr:not(:has(.app-home-events-actions .dropdown)) {
    grid-template-areas:
      "title title"
      "status status"
      "student student"
      "victim victim";
  }

  .app-home-events-table.app-home-events-table-stack td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .app-home-events-table.app-home-events-table-stack td.app-home-events-index {
    display: none;
  }

  .app-home-events-title {
    grid-area: title;
  }

  .app-home-events-actions {
    grid-area: actions;
    justify-self: end;
    align-self: start;
  }

  .app-home-events-status {
    grid-area: status;
  }

  .app-home-events-student {
    grid-area: student;
  }

  .app-home-events-victim {
    grid-area: victim;
  }

  .app-home-events-title .app-grid-status {
    align-items: flex-start;
  }

  .app-home-events-title .app-grid-status a {
    min-width: 0;
  }

  .app-home-events-table.app-home-events-table-stack td.app-home-events-actions:not(:has(.dropdown)) {
    display: none;
  }

  .app-home-events-field {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.75rem;
    row-gap: 0.15rem;
  }

  .app-home-events-label {
    flex: 0 0 auto;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8125rem;
    line-height: 1.3;
  }

  .app-home-events-value {
    flex: 1 1 8rem;
  }
}

.app-training-video-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-training-video-icon {
  flex-shrink: 0;
  font-size: 1.5em;
  line-height: 1;
  color: var(--bs-body-color);
}

.app-training-player-card {
  padding: 0;
}

.app-training-player-card:not(:has(.app-training-player)) {
  padding: 1.25rem;
}

.app-training-player video {
  object-fit: contain;
  background: #000;
}

.app-incident-trends {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.app-incident-trends-widgets {
  margin-bottom: 1.5rem;
}

.app-incident-trends-widget-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-incident-trends-widget-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.app-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
}

.app-trend-badge .ph {
  font-size: 0.95rem;
  line-height: 1;
}

.app-trend-badge--success {
  background: color-mix(in srgb, var(--bs-success) 16%, var(--bs-body-bg, #fff));
  color: var(--bs-success);
}

.app-trend-badge--danger {
  background: color-mix(in srgb, var(--bs-danger) 16%, var(--bs-body-bg, #fff));
  color: var(--bs-danger);
}

.app-trend-badge--warning {
  background: color-mix(in srgb, #c48a00 16%, var(--bs-body-bg, #fff));
  color: #c48a00;
}

.app-trend-badge--secondary {
  background: color-mix(in srgb, var(--bs-secondary) 12%, var(--bs-body-bg, #fff));
  color: var(--bs-secondary-color, #6c757d);
}

.app-incident-trends-chart-card,
.app-incident-trends-table-card {
  margin-bottom: 1.5rem;
}

.app-incident-trends-chart-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.app-incident-trends-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.app-incident-trends-chart--series {
  height: 20rem;
}

.app-incident-trends-chart--bars {
  height: 16rem;
}

.app-incident-trends-chart--scatter {
  height: 22rem;
}

.app-incident-trends-scatter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
}

.app-incident-trends-scatter-row .app-incident-trends-chart-card {
  margin-bottom: 0;
}

.app-incident-trends-scatter-row + .app-home-section-heading {
  margin-top: 2rem;
}

.app-incident-trends-toxic-pairs-chart {
  width: 100%;
  min-height: 20rem;
}

.app-incident-trends-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
  .app-class-climate-table {
    /* Sticky cells are unreliable while the table border-collapses. */
    border-collapse: separate;
    border-spacing: 0;
  }

  .app-class-climate-table :is(th, td) {
    padding: 0.5rem 0.65rem;
  }

  .app-class-climate-table td {
    white-space: nowrap;
  }

  .app-class-climate-table thead th:first-child,
  .app-class-climate-table tbody th {
    position: sticky;
    left: 0;
  }

  .app-class-climate-table thead th:first-child {
    z-index: 2;
    background: color-mix(in srgb, var(--bs-primary-bg-subtle) 50%, white);
  }

  .app-class-climate-table tbody th {
    z-index: 1;
    background: var(--bs-body-bg, #fff);
  }
}

.app-incident-trends-table-card .app-home-events-table {
  margin-bottom: 0;
}

.app-incident-trends-table-card .app-empty-list-state {
  border: 0;
  box-shadow: none;
}

@media (min-width: 992px) {
  .app-incident-trends-scatter-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.sos-banner-host:not(:has(.sos-banner)),
.app-header:has(.sos-panel) + .sos-banner-host {
  display: none;
}

.sos-banner-host {
  position: sticky;
  top: var(--app-shell-header-height);
  z-index: calc(var(--app-z-header) - 1);
}

.sos-banner-status,
.sos-banner-detail {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: 1rem var(--app-shell-inline-padding);
  color: #fff;
}

.sos-banner-status {
  justify-content: space-between;
  background: var(--bs-danger, #ee402e);
}

.sos-banner-status-copy {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sos-banner-pulse {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
}

.sos-banner-pulse::before,
.sos-banner-pulse::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
}

.sos-banner-pulse::before {
  background: #fff;
}

.sos-banner-pulse::after {
  border: 1.5px solid #fff;
  animation: sos-banner-pulse 1.6s ease-out infinite;
}

@keyframes sos-banner-pulse {
  0% {
    transform: scale(1);
    opacity: 0.75;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.sos-banner-status-text,
.sos-banner-detail-text {
  margin: 0;
}

.sos-banner-detail-text + .sos-banner-detail-text {
  margin-top: 1rem;
}

.sos-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  flex-shrink: 0;
}

.sos-banner-update,
.sos-banner-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.8125rem;
  border-radius: var(--bs-border-radius, 6px);
  flex-shrink: 0;
  white-space: nowrap;
}

.sos-banner-update {
  border: 1px solid var(--bs-light, #f8f9fa);
  background: transparent;
  color: var(--bs-light, #f8f9fa);
}

.sos-banner-update:hover,
.sos-banner-update:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sos-banner-clear {
  border: 1px solid var(--bs-secondary, #6c757d);
  background: var(--bs-dark, #212529);
  color: #fff;
}

.sos-banner-clear:hover,
.sos-banner-clear:focus-visible,
.sos-banner-clear.is-open {
  background: #000;
  color: #fff;
}

.sos-banner-detail {
  display: block;
  background: #97190c;
}

.sos-button-host {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: auto;
}

.sos-button-host-mobile {
  display: none;
}

.sos-button-host-mobile .sos-header-button-label-full {
  display: none;
}

.sos-button-host-mobile .sos-header-button-label-short {
  display: inline;
}

@media (max-width: 991.98px) {
  .sos-banner-host {
    top: 0;
    z-index: var(--app-z-header);
  }

  .sos-banner-status,
  .sos-banner-detail {
    padding-inline: 1.25rem;
  }

  .sos-banner-status {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .sos-banner-actions,
  .sos-banner-update,
  .sos-banner-clear {
    width: 100%;
  }

  .sos-button-host-desktop {
    display: none;
  }

  .sos-button-host-mobile {
    display: inline-flex;
  }

  .sos-button-host-mobile .sos-header-button {
    min-height: 2.05rem;
    padding: 0.25rem 0.7rem;
  }
}

.sos-header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.375rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--bs-danger, #ee402e);
  border-radius: 999px;
  background: var(--bs-danger, #ee402e);
  color: #fff;
  font-weight: 400;
  line-height: 1.5;
  white-space: nowrap;
}

.sos-header-button:hover,
.sos-header-button:focus-visible,
.sos-header-button.is-open,
.sos-header-button.is-active:hover,
.sos-header-button.is-active:focus-visible {
  background: #d63626;
  border-color: #d63626;
  color: #fff;
}

.sos-header-button-label-short {
  display: none;
}

.sos-panel-host:empty {
  display: none;
}

.sos-panel {
  background: var(--bs-dark, #212529);
  color: var(--bs-white, #fff);
  border-top: 1px solid var(--bs-secondary-border-subtle, #c4c8cb);
  margin-inline: calc(-1 * var(--app-shell-inline-padding));
  padding: 1.5rem var(--app-shell-inline-padding);
}

.sos-panel-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.sos-panel-preview,
.sos-panel-hint {
  margin: 0 0 1rem;
}

.sos-panel-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.sos-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sos-panel-actions form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
}

.sos-panel-choice,
.sos-panel-confirm,
.sos-panel-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius, 6px);
  font-weight: 500;
  text-decoration: none;
}

.sos-panel-choice {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 8.25rem;
  padding: 1rem 0.8125rem;
  border: 1px solid var(--bs-gray-600, #6c757d);
  background: var(--bs-gray-800, #343a40);
  color: #fff;
  font-weight: 700;
}

.sos-panel-choice-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.sos-panel-choice i {
  font-size: 2rem;
  width: 2rem;
  height: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.sos-panel-choice-hint {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
}

.sos-panel-confirm,
.sos-panel-cancel {
  width: 100%;
}

.sos-panel-confirm {
  border: 1px solid var(--bs-danger, #ee402e);
  background: var(--bs-danger, #ee402e);
  color: #fff;
}

.sos-panel-choice:hover,
.sos-panel-choice:focus-visible {
  background: #3d444b;
  color: #fff;
}

.sos-panel-confirm:hover,
.sos-panel-confirm:focus-visible {
  background: #d63626;
  color: #fff;
}

.sos-panel-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sos-panel-confirm-clear,
.sos-panel-confirm-clear:disabled {
  background: var(--bs-success, #198754);
  border-color: var(--bs-success, #198754);
  color: #fff;
}

.sos-panel-confirm-clear:hover,
.sos-panel-confirm-clear:focus-visible {
  background: var(--bs-success, #198754);
  border-color: var(--bs-success, #198754);
  color: #fff;
  filter: brightness(0.92);
}

.sos-panel-confirm-update,
.sos-panel-confirm-update:disabled {
  background: var(--bs-primary, #3c71f7);
  border-color: var(--bs-primary, #3c71f7);
  color: #fff;
}

.sos-panel-confirm-update:hover,
.sos-panel-confirm-update:focus-visible {
  background: var(--bs-primary, #3c71f7);
  border-color: var(--bs-primary, #3c71f7);
  color: #fff;
  filter: brightness(0.92);
}

.sos-panel-cancel {
  border: 0;
  background: var(--bs-gray-800, #343a40);
  color: var(--bs-light, #f8f9fa);
  font-weight: 400;
}

.sos-pickup-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 0 0 1rem;
}

.sos-pickup-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0;
  padding: 0.9375rem 1.5rem;
  border: 1px solid var(--bs-border-color, #899299);
  border-radius: 8px;
  cursor: pointer;
}

.sos-pickup-option:has(input:checked) {
  border-color: var(--bs-primary, #3c71f7);
}

.sos-pickup-option input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.sos-pickup-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.sos-pickup-copy strong {
  font-weight: 700;
}

.sos-update-label {
  display: block;
  margin: 0 0 0.3125rem;
  font-weight: 600;
}

.sos-update-input {
  display: block;
  width: 100%;
  min-height: 8rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--bs-secondary, #6c757d);
  border-radius: 6px;
  background: var(--bs-gray-800, #343a40);
  color: var(--bs-light, #f8f9fa);
  resize: vertical;
}

.sos-update-input::placeholder {
  color: var(--bs-light, #f8f9fa);
  opacity: 0.7;
}

.sos-slider {
  margin: 0 0 1.5rem;
}

.sos-slider-track {
  position: relative;
  height: 1.5rem;
  border-radius: 100px;
  background: var(--bs-secondary-bg, #e9ecef);
}

.sos-slider-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2rem;
  height: 2rem;
  margin-top: -1rem;
  border: 0;
  border-radius: 50%;
  background: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 2px #fff;
  touch-action: none;
  cursor: grab;
}

.sos-slider.is-ready .sos-slider-handle {
  background: var(--bs-danger, #ee402e);
  cursor: default;
}

.sos-panel-clear .sos-slider.is-ready .sos-slider-handle {
  background: var(--bs-success, #198754);
}

.sos-panel-update .sos-slider.is-ready .sos-slider-handle {
  background: var(--bs-primary, #3c71f7);
}

@media (max-width: 767.98px) {
  .sos-panel-choices,
  .sos-pickup-options {
    grid-template-columns: 1fr;
  }

  .sos-panel-choice,
  .sos-panel-confirm,
  .sos-panel-cancel {
    width: 100%;
  }
}



