/*
  Layout and components. Colors come from theme.css; never hard-code them here.
  Layout dimensions: change these to resize the shell everywhere.
*/
:root {
  --app-sidebar-width: 15.5rem;
  --app-sidebar-collapsed-width: 4.5rem;
  --app-navbar-height: 3.75rem;
  --app-content-padding: 1.5rem;
  --app-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Room for the scrollbar is always kept, so the page doesn't get narrower (and its cards
   don't reflow) when content below grows past the screen, e.g. switching camp tabs. */
html {
  scrollbar-gutter: stable;
}

body {
  background-color: var(--app-bg);
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1100;
}

/* ---- Logo ---- */
.app-logo {
  display: block;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

/* ---- Shell ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.app-content {
  flex: 1;
  padding: var(--app-content-padding);
}

/* ---- Navbar (top bar of the content column) ---- */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--app-navbar-height);
  padding: 0 var(--app-content-padding);
  background-color: var(--app-bg);
  border-bottom: 1px solid var(--app-border);
}

.app-navbar-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  font-family: var(--app-font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
}

.app-navbar-section .bi {
  color: var(--app-brand);
}

.app-navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: var(--app-muted);
  background: transparent;
  border: 0;
  border-radius: var(--bs-border-radius);
  transition: background-color 150ms var(--app-ease), color 150ms var(--app-ease);
}

.btn-icon:hover {
  color: var(--app-ink);
  background-color: var(--app-hover);
}

.btn-icon .bi {
  font-size: 1.25rem;
  line-height: 1;
}

/* Theme toggle shows the icon of the theme you would switch to */
.theme-toggle .bi-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }

/* User menu */
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  color: var(--app-ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  transition: background-color 150ms var(--app-ease);
}

.user-menu-toggle:hover,
.user-menu-toggle[aria-expanded="true"] {
  background-color: var(--app-hover);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-accent);
  background-color: var(--app-accent-subtle);
  border-radius: 50%;
}

.user-menu .dropdown-menu {
  min-width: 15rem;
  padding: 0.375rem;
}

.user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--bs-border-radius-sm);
}

.user-menu-header {
  padding: 0.5rem 0.625rem 0.625rem;
  line-height: 1.3;
}

/* ---- Sidebar ---- */
.app-sidebar {
  --bs-offcanvas-width: 17rem;
  --bs-offcanvas-bg: var(--app-sidebar-bg);
}

.app-sidebar .offcanvas-body {
  padding: 0;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  background-color: var(--app-sidebar-bg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: calc(var(--app-navbar-height) - 0.75rem);
  margin-bottom: 0.75rem;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.25rem 0.375rem;
  font-family: var(--app-font-heading);
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--app-ink);
  text-decoration: none;
  border-radius: var(--bs-border-radius);
}

/* "Beta Testing" under the app's name, fading in and out */
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.beta-label {
  display: inline-flex;
  gap: 0.3125rem;
  align-items: center;
  margin-top: 0.125rem;
  font-family: var(--app-font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--app-beta);
  animation: beta-fade 2.4s ease-in-out infinite;
}

@keyframes beta-fade {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .beta-label {
    animation: none;
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--app-muted);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: var(--bs-border-radius);
  transition: background-color 150ms var(--app-ease), color 150ms var(--app-ease);
}

.sidebar-link .bi {
  flex-shrink: 0;
  width: 1.25rem;
  font-size: 1.125rem;
  line-height: 1;
  text-align: center;
}

/* Item with a submenu: the whole row folds it; the arrow at its right end shows which way */
.sidebar-link .sidebar-caret {
  width: auto;
  margin-left: auto;
  font-size: 0.75rem;
  transition: transform 200ms var(--app-ease);
}

.sidebar-link.collapsed .sidebar-caret {
  transform: rotate(-90deg);
}

/* Submenu: slightly indented under its parent, with a thin guide line */
.sidebar-submenu {
  margin: 0.125rem 0 0.25rem 1.375rem;
  padding-left: 0.375rem;
  border-left: 1px solid var(--app-border);
}

.sidebar-sublink {
  min-height: 2.125rem;
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
  font-size: 0.875rem;
}

.sidebar-sublink .bi {
  font-size: 1rem;
}

/* Parent of the current submenu page */
.sidebar-link.open {
  color: var(--app-accent);
}

.sidebar-link:hover {
  color: var(--app-ink);
  background-color: var(--app-hover);
}

.sidebar-link.active {
  font-weight: 600;
  color: var(--app-accent);
  background-color: var(--app-accent-subtle);
}

/* Profesori in the submenu: blue when selected, like its label on the page.
   After .sidebar-link.active, which it overrides. */
.sidebar-link-teacher.active {
  color: var(--app-teacher);
  background-color: var(--app-teacher-subtle);
}

.sidebar-separator {
  margin: 0.5rem 0.75rem;
  border-top: 1px solid var(--app-border);
}

.sidebar-end {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  margin-top: auto;
}

.sidebar-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--app-border);
}

.sidebar-toggle .bi {
  transition: transform 200ms var(--app-ease);
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    width: var(--app-sidebar-width);
    height: 100vh;
    border-right: 1px solid var(--app-border);
    transition: width 200ms var(--app-ease);
  }

  .app-sidebar .offcanvas-body {
    height: 100%;
    overflow: hidden;
  }

  .sidebar-inner {
    overflow-y: auto;
  }

  /* Collapsed: icon rail. Labels stay in the DOM for screen readers. */
  .sidebar-collapsed .app-sidebar {
    width: var(--app-sidebar-collapsed-width);
  }

  .sidebar-collapsed .sidebar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .sidebar-collapsed .sidebar-link,
  .sidebar-collapsed .sidebar-brand-link {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  /* Icon rail: submenu icons line up under their parent, without the arrow */
  .sidebar-collapsed .sidebar-caret {
    display: none;
  }

  .sidebar-collapsed .sidebar-submenu {
    padding-left: 0;
    margin-left: 0;
    border-left: 0;
  }

  .sidebar-collapsed .sidebar-toggle .bi {
    transform: rotate(180deg);
  }
}

/* ---- Welcome / empty state (components/welcome.html) ---- */
.welcome {
  max-width: 36rem;
  padding: 3.5rem 0 2rem;
  margin: 0 auto;
  text-align: center;
}

.welcome-icon {
  font-size: 2.75rem;
  line-height: 1;
  color: var(--app-brand);
}

.welcome h1 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.625rem;
  font-weight: 650;
}

.welcome-text {
  margin: 0 auto;
  max-width: 32rem;
  color: var(--app-muted);
}

.welcome-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--app-muted);
  border: 1px solid var(--app-border);
  border-radius: 999px;
}

.welcome-status::before {
  width: 0.5rem;
  height: 0.5rem;
  content: "";
  background-color: var(--app-brand);
  border-radius: 50%;
}

/* ---- Auth pages (layouts/auth.html) ---- */
.auth {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background-color: var(--app-surface);
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem 1.5rem;
  overflow: hidden;
  color: #fff;
  background-color: var(--app-brand-bg);
}

/* Contour lines: the terrain of "Terra" */
.auth-brand::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: url("../img/contours.svg") right -6rem bottom -8rem / 46rem auto no-repeat;
  opacity: 0.22;
}

.auth-brand > * {
  position: relative;
  z-index: 1;
}

.auth-brand-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--app-font-heading);
  font-size: 1.25rem;
  font-weight: 650;
}

.auth-brand .app-logo {
  width: 3rem;
  height: 3rem;
}

.auth-tagline {
  display: none;
  max-width: 22ch;
  margin: 0;
  font-family: var(--app-font-heading);
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.auth-form {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1.5rem 3rem;
}

.auth-form-inner {
  width: 100%;
  max-width: 22rem;
}

.auth-form h1 {
  margin-bottom: 0.375rem;
  font-size: 1.625rem;
  font-weight: 650;
}

.auth-form .form-control {
  min-height: 2.75rem;
}

.auth-form .btn-primary {
  min-height: 2.75rem;
  font-weight: 600;
}

.field-invalid .form-control {
  border-color: var(--bs-form-invalid-border-color);
}

/* Password reveal button shows the icon of the action it performs */
.password-toggle .bi-eye-slash { display: none; }
.password-toggle[aria-pressed="true"] .bi-eye { display: none; }
.password-toggle[aria-pressed="true"] .bi-eye-slash { display: inline; }

@media (min-width: 992px) {
  .auth {
    grid-template-rows: none;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  .auth-brand {
    padding: 2.5rem 3rem;
  }

  .auth-brand .app-logo {
    width: 4.5rem;
    height: 4.5rem;
  }

  .auth-form {
    align-items: center;
  }

  .auth-tagline {
    display: block;
  }
}

/* ---- Notifications (components/notifications.html, app.js) ---- */
.notifications {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 1rem);
  right: calc(env(safe-area-inset-right, 0px) + 1rem);
  z-index: 2000; /* above the navbar, the menu on phones and dialogs */
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  width: min(23rem, calc(100vw - 2rem));
  pointer-events: none; /* the empty corner never blocks clicks */
}

.notification {
  --notification-bg: var(--app-notify-info-bg);
  --notification-ink: var(--app-notify-info-ink);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 0.75rem 1.0625rem 1rem;
  overflow: hidden;
  color: var(--notification-ink);
  background-color: var(--notification-bg);
  border-radius: 0.75rem;
  box-shadow: var(--app-notify-shadow);
  pointer-events: auto;
  animation: notification-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.notification-success {
  --notification-bg: var(--app-notify-success-bg);
  --notification-ink: var(--app-notify-success-ink);
}

.notification-danger {
  --notification-bg: var(--app-notify-danger-bg);
  --notification-ink: var(--app-notify-danger-ink);
}

.notification-warning {
  --notification-bg: var(--app-notify-warning-bg);
  --notification-ink: var(--app-notify-warning-ink);
}

.notification.is-leaving {
  animation: notification-out 0.22s ease-in forwards;
}

.notification-icon {
  flex: none;
  font-size: 1.25rem;
  line-height: 1.25;
}

.notification-text {
  flex: 1;
  min-width: 0;
  padding-top: 0.0625rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.notification-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: -0.125rem -0.125rem -0.125rem 0;
  padding: 0;
  font-size: 0.875rem;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.8;
}

.notification-close:hover {
  background-color: rgba(255, 255, 255, 0.18);
  opacity: 1;
}

/* Light fills (yellow; info in the dark theme) darken instead */
.notification-warning .notification-close:hover,
[data-bs-theme="dark"] .notification:not(.notification-success, .notification-danger) .notification-close:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.notification-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

/* Countdown line: empties from right to left in the notification's time (data-timeout).
   Stops while the pointer or the keyboard focus is on the notification, or the tab is hidden. */
.notification::after,
.notification-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0.1875rem;
  background-color: currentColor;
}

.notification::after {
  content: "";
  opacity: 0.18; /* the track */
}

.notification-progress {
  z-index: 1;
  opacity: 0.75;
  transform-origin: left center;
  animation: notification-countdown linear forwards;
  /* !important: it is information, not decoration, so it keeps its real duration even
     when the reduced-motion rule (theme.css) shortens every other animation */
  animation-duration: var(--notification-timeout, 5000ms) !important;
}

.notification:hover .notification-progress,
.notification:focus-within .notification-progress,
.notifications.is-paused .notification-progress {
  animation-play-state: paused;
}

@keyframes notification-in {
  from {
    opacity: 0;
    transform: translateX(calc(100% + 1.5rem));
  }
}

@keyframes notification-out {
  to {
    opacity: 0;
    transform: translateX(calc(100% + 1.5rem));
  }
}

@keyframes notification-countdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* ---- Page header (layouts/page.html) ---- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 650;
}

/* A contact kind: Profesor in blue, Părinte in orange (components/kind_badge.html) */
.kind-badge {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--app-accent);
  white-space: nowrap;
  vertical-align: middle;
  background-color: var(--app-accent-subtle);
  border-radius: 50rem;
}

.kind-badge-teacher {
  color: var(--app-teacher);
  background-color: var(--app-teacher-subtle);
}

/* The same label, bigger, next to a page heading (Leaduri [Profesori]) */
.title-tag {
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  margin-left: 0.375rem;
  font-size: 1rem;
}

.page-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0.375rem 0 0;
  color: var(--app-muted);
}

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

.page-header-actions:empty {
  display: none;
}

/* ---- Cards ---- */
.card {
  --bs-card-border-color: var(--app-border);
  --bs-card-bg: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
}

.card-title-sm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.count-pill {
  padding: 0 0.5rem;
  font-family: var(--app-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-accent);
  background-color: var(--app-accent-subtle);
  border-radius: 999px;
}

.form-card {
  max-width: 44rem;
}

/* A form in two columns on large screens (Useri) */
.form-card-wide {
  max-width: 64rem;
}

/* A fieldset's title, the size of every other label (Bootstrap makes legends large) */
legend.form-label {
  font-size: inherit;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.text-prewrap {
  white-space: pre-line;
}

/* Definition list: label above value */
.detail-list {
  margin: 0;
}

.detail-list dt {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--app-muted);
}

.detail-list dd {
  margin-bottom: 0.875rem;
}

.detail-list dd:last-child {
  margin-bottom: 0;
}

/* ---- Toolbar: search + filters above a list ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.toolbar-search {
  position: relative;
  flex: 1 1 16rem;
  max-width: 28rem;
}

.toolbar-search .bi {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  color: var(--app-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.toolbar-search .form-control {
  padding-left: 2.25rem;
}

/* Results of a search-as-you-type form, dimmed while the new ones load */
.search-results[aria-busy="true"] {
  opacity: 0.6;
  transition: opacity 150ms var(--app-ease);
}

/* ---- Autocomplete (AutocompleteSelect): matches under the search box ---- */
.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  z-index: 1000;
  max-height: 18rem;
  padding: 0.25rem;
  margin: 0.25rem 0 0;
  overflow-y: auto;
  list-style: none;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--app-shadow);
}

.autocomplete-list [role="option"] {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  border-radius: var(--bs-border-radius-sm);
}

.autocomplete-list [role="option"]:hover,
.autocomplete-list [aria-selected="true"] {
  background-color: var(--app-hover);
}

.autocomplete-label {
  font-weight: 600;
}

.autocomplete-detail,
.autocomplete-list .autocomplete-empty {
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.autocomplete-list .autocomplete-empty {
  cursor: default;
}

/* ---- Bulk actions bar: on top of a list with checkboxes ---- */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.bulk-count {
  margin-right: auto;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.bulk-count.is-active {
  font-weight: 600;
  color: var(--app-accent);
}

.bulk-bar .form-select {
  width: auto;
  max-width: 100%;
}

/* ---- Assignee picker (components/assignee_picker.html) ---- */
.assignee-menu {
  min-width: 16rem;
  padding: 0.75rem;
}

.assignee-menu fieldset {
  max-height: 18rem;
  overflow-y: auto;
}

.assignee-menu-title {
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--app-muted);
}

.assignee-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: var(--bs-border-radius-sm);
  cursor: pointer;
}

.assignee-option:hover {
  background-color: var(--app-hover);
}

.assignee-option .form-check-input {
  flex-shrink: 0;
  margin-top: 0;
}

.assignee-role {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.assignee-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.table .col-check {
  width: 1%;
  padding-right: 0;
}

.table .col-check .form-check-input {
  margin-top: 0;
}

/* Each secondary column takes a share of the table's width (--col-share) but never less
   than --col-min (padding included), and the name column takes what is left, at least
   its own --col-min. So a list keeps its layout whatever the page or filter shows, and
   when the minimums don't fit the table scrolls instead of squeezing columns by their
   content. The header's empty ::before is what keeps a column from shrinking. */
.table .col-name {
  --col-min: 10rem;
}

.table .col-kind {
  --col-share: 12%;
  --col-min: 8.5rem;
}

.table .col-phone {
  --col-share: 15%;
  --col-min: 9.5rem;
}

.table .col-person {
  --col-share: 17%;
  --col-min: 10rem;
}

.table .col-email {
  --col-share: 22%;
  --col-min: 12rem;
}

.table .col-status {
  --col-share: 13%;
  --col-min: 8rem;
}

.table .col-date {
  --col-share: 12%;
  --col-min: 8rem;
}

.table .col-count {
  --col-share: 9%;
  --col-min: 5.5rem;
}

.table .col-actions {
  --col-share: 12%;
  --col-min: 10rem;
}

.table :is(.col-kind, .col-phone, .col-person, .col-email, .col-status, .col-date, .col-count, .col-actions) {
  width: var(--col-share);
}

.table > thead :is(.col-name, .col-kind, .col-phone, .col-person, .col-email, .col-status, .col-date, .col-count, .col-actions)::before {
  display: block;
  width: calc(var(--col-min) - 2rem);
  content: "";
}

/* ---- Tables ---- */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--app-hover);
}

.table > thead th {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--app-muted);
  white-space: nowrap;
}

.table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
}

/* Long text cut with "…" instead of widening its column: width 0 keeps it out of the
   column's sizing, min-width fills the cell. Put the full text in title. */
.cell-truncate {
  width: 0;
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-link {
  color: var(--app-ink);
  text-decoration: none;
}

.row-link:hover {
  color: var(--app-accent);
  text-decoration: underline;
}

/* ---- Status tabs (opportunity list) ---- */
.status-tabs {
  display: flex;
  gap: 0.375rem;
  padding-bottom: 0.25rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.status-tab {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--app-muted);
  text-decoration: none;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  transition: background-color 150ms var(--app-ease), color 150ms var(--app-ease);
}

.status-tab:hover {
  color: var(--app-ink);
  background-color: var(--app-hover);
}

.status-tab.active {
  font-weight: 600;
  color: var(--app-accent);
  background-color: var(--app-accent-subtle);
  border-color: transparent;
}

/* Contact kind tabs: the kind's icon and colour, as in the list */
.status-tab-icon {
  color: var(--app-accent);
}

.status-tab-teacher .status-tab-icon,
.status-tab-teacher.active {
  color: var(--app-teacher);
}

.status-tab-teacher.active {
  background-color: var(--app-teacher-subtle);
}

/* Between the status tabs and the seller tabs */
.status-tabs-divider {
  flex-shrink: 0;
  align-self: stretch;
  width: 1px;
  margin: 0.25rem 0.375rem;
  background-color: var(--app-border);
}

/* Phones: the tabs wrap instead of scrolling sideways, and the divider becomes a line
   that puts the second group (sellers, people) under the first. */
@media (max-width: 767.98px) {
  .status-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .status-tabs-divider {
    flex-basis: 100%;
    width: auto;
    height: 1px;
    margin: 0.125rem 0;
  }
}

.status-tab-count {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.status-badge {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---- Item lists (opportunities of a contact) ---- */
.item-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.item-list > li {
  padding: 0.75rem 0;
  border-top: 1px solid var(--app-border);
}

.item-list > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

/* ---- Timeline (notes) ---- */
.note-form {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--app-border);
}

/* Vertical history: a marker per entry on a rail (initials for a note, the new status's
   icon and color for a status change); notes sit in a bubble, days are labels on the rail. */
.timeline {
  --timeline-marker: 2rem;
  --timeline-gap: 0.875rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.timeline-compact {
  --timeline-marker: 1.75rem;
  --timeline-gap: 0.75rem;
}

.timeline-item,
.timeline-day {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item {
  display: flex;
  gap: var(--timeline-gap);
}

.timeline-compact .timeline-item {
  padding-bottom: 1rem;
}

/* The rail, from under each marker down to the next entry */
.timeline-item::before,
.timeline-day::before {
  position: absolute;
  top: var(--timeline-marker);
  bottom: 0;
  left: calc(var(--timeline-marker) / 2 - 1px);
  width: 2px;
  content: "";
  background-color: var(--app-border);
}

.timeline-day::before {
  top: 0;
}

.timeline-day:first-child::before {
  top: 50%;
}

.timeline > :last-child {
  padding-bottom: 0;
}

.timeline > :last-child::before {
  display: none;
}

.timeline-marker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: var(--timeline-marker);
  height: var(--timeline-marker);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-accent);
  background-color: var(--app-accent-subtle);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--app-surface);
}

.timeline-day span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-muted);
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 50rem;
}

.timeline-body {
  flex: 1;
  min-width: 0;
  /* First line centered on the marker */
  padding-top: calc((var(--timeline-marker) - 1.3125rem) / 2);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.timeline-meta strong {
  color: var(--app-ink);
}

.timeline-note {
  padding: 0.625rem 0.875rem;
  margin-top: 0.375rem;
  background-color: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 0 var(--bs-border-radius) var(--bs-border-radius);
}

.status-change {
  font-weight: 600;
}

/* ---- Camp participants: children under their contact, the "+" that adds one ---- */
.participants .col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.participant-children {
  margin-right: 0.5rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.participant-goes {
  margin-top: 0.375rem;
  font-size: 0.875rem;
}

.participant-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
}

/* Open, the "+" turns into "×" */
.participant-add[aria-expanded="true"] .bi {
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: no-preference) {
  .participant-add .bi {
    transition: transform 150ms var(--app-ease);
  }
}

.participants .child-row > td,
.participants .child-form-row > td {
  background-color: var(--app-bg);
}

.participants .child-row > td {
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
}

.child-name {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1rem;
}

.child-name .bi,
.child-form-arrow {
  color: var(--app-muted);
}

.child-remove {
  width: 2rem;
  height: 2rem;
}

.child-remove .bi {
  font-size: 0.875rem;
}

/* Participanți / Doar copiii switch; Doar copiii's medical notes sit under the name */
button.status-tab {
  background-color: transparent;
}

.participants-switch {
  margin-bottom: 0.75rem;
}

.children-table .child-medical {
  margin-left: 0;
}

.child-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.25rem 0 0.25rem 1rem;
}

.child-form-arrow {
  align-self: center;
  margin-top: 1.5rem;
}

.child-form-field {
  flex: 1 1 12rem;
}

.child-form-field .form-label {
  margin-bottom: 0.25rem;
}

.child-form-age {
  flex: 0 0 5.5rem;
}

.child-form-city {
  flex: 0 1 11rem;
}

/* Medical notes take a whole line, under name, age and town */
.child-form-medical {
  flex-basis: 100%;
}

.child-facts {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

.child-medical {
  display: flex;
  gap: 0.375rem;
  max-width: 32rem;
  margin: 0.25rem 0 0 2.25rem;
  font-size: 0.875rem;
  color: var(--bs-danger-text-emphasis);
  white-space: pre-line;
}

.child-medical .bi {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.child-form-actions {
  display: flex;
  gap: 0.25rem;
}

/* ---- Room organigram (templates/tabere/_organigram.html) ---- */
.room-batch {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  padding: 0.875rem;
  margin-bottom: 1.25rem;
  background-color: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius);
}

.room-batch-field {
  width: 7rem;
}

.room-batch-field .form-label {
  margin-bottom: 0.25rem;
}

.room-batch-x {
  padding-bottom: 0.375rem;
  color: var(--app-muted);
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.875rem;
}

.room {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-top: 3px solid var(--app-brand);
  border-radius: var(--bs-border-radius);
  transition: border-color 150ms var(--app-ease), box-shadow 150ms var(--app-ease);
}

.room.is-full {
  border-top-color: var(--bs-success);
}

/* Something is dragged over it, or someone is chosen and waits for "Pune aici" */
.room.is-over,
.is-placing .room:not(.is-full) {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 3px rgba(var(--app-accent-rgb), 0.15);
}

.room-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.room-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.room-count {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--app-muted);
}

.room.is-full .room-count {
  color: var(--bs-success-text-emphasis);
}

.room-delete {
  width: 1.75rem;
  height: 1.75rem;
}

.room-delete .bi {
  font-size: 0.875rem;
}

.room-occupants {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.room-occupant,
.room-slot {
  min-height: 2.5rem;
  border-radius: var(--bs-border-radius-sm);
}

.room-occupant {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.25rem 0.3125rem 0.5rem;
  font-size: 0.875rem;
  cursor: grab;
  background-color: var(--app-accent-subtle);
  border: 1px solid transparent;
}

.room-occupant.is-adult {
  background-color: var(--bs-info-bg-subtle);
}

.room-occupant > .bi {
  flex-shrink: 0;
  color: var(--app-accent);
}

.room-occupant.is-adult > .bi {
  color: var(--bs-info-text-emphasis);
}

.room-occupant-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.room-occupant-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-occupant-meta {
  overflow: hidden;
  font-size: 0.75rem;
  color: var(--app-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-occupant-remove {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 0.75rem;
  color: var(--app-muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.room-occupant-remove:hover {
  color: var(--app-ink);
  background-color: var(--app-hover);
}

.room-slot {
  border: 1px dashed var(--app-border);
}

.room-free {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--app-muted);
}

.room-place {
  margin-top: 0.5rem;
}

/* Participants: stay in view while the rooms scroll (large screens) */
@media (min-width: 992px) {
  .roster-card {
    position: sticky;
    top: calc(var(--app-navbar-height) + 1rem);
    max-height: calc(100vh - var(--app-navbar-height) - 2rem);
    overflow-y: auto;
  }
}

.roster {
  padding: 0.25rem;
  margin: 0 -0.25rem;
  list-style: none;
  border: 1px dashed transparent;
  border-radius: var(--bs-border-radius);
}

/* Dropping here takes someone out of their room */
.roster.is-over {
  border-color: var(--app-accent);
  background-color: var(--app-hover);
}

.roster-family + .roster-family {
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--app-border);
}

.roster-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.375rem;
}

.roster-people {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0 0 0.75rem;
  margin: 0;
  list-style: none;
  border-left: 2px solid var(--app-border);
}

.roster-person {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: var(--app-ink);
  text-align: left;
  cursor: grab;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius-sm);
}

.roster-person:hover {
  background-color: var(--app-hover);
}

.roster-person:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}

.roster-grip {
  color: var(--app-muted);
}

.roster-person-name {
  flex: 1;
  min-width: 0;
}

.roster-room {
  flex-shrink: 0;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bs-warning-text-emphasis);
  background-color: var(--bs-warning-bg-subtle);
  border-radius: 50rem;
}

.roster-person.is-placed .roster-room {
  color: var(--bs-success-text-emphasis);
  background-color: var(--bs-success-bg-subtle);
}

.roster-person.is-selected,
.room-occupant.is-selected {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 2px rgba(var(--app-accent-rgb), 0.35);
}

.room-occupant.is-dragging,
.roster-person.is-dragging {
  opacity: 0.5;
}

/* Under the status form of a won or lost opportunity */
.closed-note {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--app-border);
}

/* Camp field under the status select (shown for "Câștigat") */
.status-camp {
  padding: 0.875rem 0.875rem 0.125rem;
  margin-bottom: 1rem;
  background-color: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius);
}

/* ---- Tasks ---- */
.task-list {
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
}

.task {
  display: flex;
  gap: 0.625rem;
  padding: 0.625rem 0;
  border-top: 1px solid var(--app-border);
}

.task:first-child {
  padding-top: 0;
  border-top: 0;
}

.task-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.25rem;
  color: var(--app-muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  transition: color 150ms var(--app-ease);
}

.task-check:hover {
  color: var(--app-accent);
}

.task-done .task-check {
  color: var(--bs-success);
}

.task-body {
  flex: 1;
  min-width: 0;
  padding-top: 0.125rem;
}

.task-done .task-title {
  color: var(--app-muted);
  text-decoration: line-through;
}

/* Tasks of one camp or opportunity, under a link to it (Wall) */
.task-group + .task-group {
  margin-top: 1.25rem;
}

.task-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.task-group-title .bi {
  flex-shrink: 0;
  color: var(--app-brand);
}

.task-group-title a {
  min-width: 0;
  overflow: hidden;
  color: var(--app-ink);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-group-title a:hover {
  color: var(--app-accent);
  text-decoration: underline;
}

.task-group-count {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--app-muted);
}

.task-group .task-list {
  padding-left: 0.75rem;
  margin: 0 0 0 0.4375rem;
  border-left: 2px solid var(--app-border);
}

.task-add summary {
  list-style: none;
}

.task-add summary::-webkit-details-marker {
  display: none;
}

/* ---- Empty state (components/empty_state.html) ---- */
.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--app-muted);
}

.empty-state .bi {
  font-size: 2rem;
  color: var(--app-brand);
}

.empty-state p {
  max-width: 28rem;
  margin: 0.75rem auto 1rem;
}

/* ---- Accounts: name with the account's icon and colour (|user_tag) ---- */
.user-tag {
  display: inline-flex;
  gap: 0.3125rem;
  align-items: baseline;
  font-weight: 600;
}

.user-tag .bi {
  align-self: center;
  font-size: 0.9375em;
}

.user-tone-red {
  color: var(--app-user-red);
}

.user-tone-orange {
  color: var(--app-user-orange);
}

.user-tone-yellow {
  color: var(--app-user-yellow);
}

.user-tone-green {
  color: var(--app-user-green);
}

.user-tone-teal {
  color: var(--app-user-teal);
}

.user-tone-blue {
  color: var(--app-user-blue);
}

.user-tone-indigo {
  color: var(--app-user-indigo);
}

.user-tone-purple {
  color: var(--app-user-purple);
}

.user-tone-pink {
  color: var(--app-user-pink);
}

.user-tone-slate {
  color: var(--app-user-slate);
}

/* Pickers on the account form: colour swatches and icons as toggle buttons */
.tone-picker,
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tone-swatch,
.icon-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  border: 2px solid var(--app-border);
  border-radius: 50%;
  transition: border-color 150ms var(--app-ease), box-shadow 150ms var(--app-ease);
}

.tone-swatch::before {
  width: 1.5rem;
  height: 1.5rem;
  content: "";
  background-color: currentcolor;
  border-radius: 50%;
}

/* "No colour": a crossed-out circle in the text colour */
.tone-swatch-none::before {
  background: linear-gradient(135deg, transparent 45%, var(--app-muted) 45% 55%, transparent 55%);
  border: 1px solid var(--app-muted);
}

.icon-choice {
  font-size: 1.125rem;
  color: var(--app-muted);
  border-radius: var(--bs-border-radius);
}

.tone-swatch:hover,
.icon-choice:hover {
  border-color: var(--app-muted);
}

/* Selected: accent ring; a swatch keeps its own colour, an icon turns accent */
.btn-check:checked + .tone-swatch,
.btn-check:checked + .icon-choice {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 2px var(--app-accent-subtle);
}

.btn-check:checked + .icon-choice {
  color: var(--app-accent);
}

.btn-check:focus-visible + .tone-swatch,
.btn-check:focus-visible + .icon-choice {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}

/* The icons preview the chosen colour */
.account-look:has(.btn-check[value="red"]:checked) .icon-choice {
  color: var(--app-user-red);
}

.account-look:has(.btn-check[value="orange"]:checked) .icon-choice {
  color: var(--app-user-orange);
}

.account-look:has(.btn-check[value="yellow"]:checked) .icon-choice {
  color: var(--app-user-yellow);
}

.account-look:has(.btn-check[value="green"]:checked) .icon-choice {
  color: var(--app-user-green);
}

.account-look:has(.btn-check[value="teal"]:checked) .icon-choice {
  color: var(--app-user-teal);
}

.account-look:has(.btn-check[value="blue"]:checked) .icon-choice {
  color: var(--app-user-blue);
}

.account-look:has(.btn-check[value="indigo"]:checked) .icon-choice {
  color: var(--app-user-indigo);
}

.account-look:has(.btn-check[value="purple"]:checked) .icon-choice {
  color: var(--app-user-purple);
}

.account-look:has(.btn-check[value="pink"]:checked) .icon-choice {
  color: var(--app-user-pink);
}

.account-look:has(.btn-check[value="slate"]:checked) .icon-choice {
  color: var(--app-user-slate);
}

/* ---- Tabere: one big card per camp kind ---- */
.camp-kind-card {
  color: var(--app-ink);
  text-decoration: none;
  transition: border-color 150ms var(--app-ease), box-shadow 150ms var(--app-ease),
    transform 150ms var(--app-ease);
}

.camp-kind-card:hover {
  color: var(--app-ink);
  border-color: var(--app-muted);
  box-shadow: var(--app-shadow);
  transform: translateY(-2px);
}

.camp-kind-card:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}

.camp-kind-card .card-body {
  padding: 1.75rem 1.5rem;
}

.camp-kind-icon {
  display: block;
  margin-bottom: 1rem;
  font-size: 2.75rem;
  line-height: 1;
}

.camp-kind-title {
  margin-bottom: 0.25rem;
  font-family: var(--app-font-heading);
  font-size: 1.75rem;
  font-weight: 650;
}

.camp-kind-count {
  margin-bottom: 1rem;
  font-size: 1.0625rem;
  color: var(--app-muted);
}

.camp-kind-next {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: var(--app-muted);
}

@media (prefers-reduced-motion: reduce) {
  .camp-kind-card:hover {
    transform: none;
  }
}

/* Tabere list: one foldable block per season, Sep–Aug (the others' camps load when opened) */
.camp-year + .camp-year {
  margin-top: 0.75rem;
}

.camp-year-heading {
  margin: 0;
}

.camp-year-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.25rem;
  font-family: var(--app-font-heading);
  font-size: 1.25rem;
  font-weight: 650;
  color: var(--app-ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--bs-border-radius);
}

.camp-year-toggle:hover {
  background-color: var(--app-hover);
}

.camp-year-toggle:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
}

.camp-year-caret {
  font-size: 0.875rem;
  color: var(--app-muted);
  transition: transform 200ms var(--app-ease);
}

.camp-year-toggle.collapsed .camp-year-caret {
  transform: rotate(-90deg);
}

.camp-year .collapse > .card,
.camp-year .collapsing > .card {
  margin: 0.25rem 0 0.75rem;
}

.camp-year-loading,
.lazy-load-error {
  padding: 0.75rem 0.25rem;
  margin: 0;
  color: var(--app-muted);
}

.lazy-load-error {
  color: var(--bs-danger-text-emphasis);
}

/* ---- Camp page: summary card and the tabs under it ---- */
.camp-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.25rem 1.5rem;
  margin: 0;
}

.camp-facts dt,
.camp-notes-title {
  margin-bottom: 0.25rem;
  font-family: var(--app-font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--app-muted);
}

.camp-facts dd {
  margin: 0;
  font-weight: 600;
}

.camp-facts dd .small {
  font-weight: 400;
}

.camp-kind {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
}

.camp-seats {
  max-width: 10rem;
  height: 0.375rem;
  margin-top: 0.375rem;
}

.camp-notes {
  padding-top: 1.25rem;
  margin-top: 1.25rem;
  border-top: 1px solid var(--app-border);
}

/* Segmented tabs; the highlight slides under the active one (its index from :has) */
.camp-tabs {
  --active: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tab-count), minmax(0, 1fr));
  padding: 0.25rem;
  margin-bottom: 1rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius-lg);
}

.camp-tabs:has(> .camp-tab:nth-of-type(2).active) {
  --active: 1;
}

.camp-tabs:has(> .camp-tab:nth-of-type(3).active) {
  --active: 2;
}

.camp-tabs:has(> .camp-tab:nth-of-type(4).active) {
  --active: 3;
}

.camp-tabs-indicator {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  left: 0.25rem;
  width: calc((100% - 0.5rem) / var(--tab-count));
  background-color: var(--app-accent-subtle);
  border-radius: var(--bs-border-radius);
  transform: translateX(calc(100% * var(--active)));
  transition: transform 250ms var(--app-ease);
}

.camp-tab {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  color: var(--app-muted);
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: var(--bs-border-radius);
  transition: color 150ms var(--app-ease);
}

.camp-tab:hover {
  color: var(--app-ink);
}

.camp-tab.active {
  color: var(--app-accent);
}

.camp-tab:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: -2px;
}

/* Phones: icon above a smaller label, so four tabs fit */
@media (max-width: 575.98px) {
  .camp-tab {
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.375rem 0.25rem;
    font-size: 0.75rem;
  }

  .camp-tab .bi {
    font-size: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .camp-tabs-indicator {
    transition: none;
  }
}

/* ---- Camp checklist: the ring, the steps, the edit mode (static/js/checklist.js) ---- */
.checklist-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.checklist-edit-button {
  margin-left: auto;
}

.checklist-title {
  margin: 0 0 0.125rem;
  font-family: var(--app-font-heading);
  font-size: 1.25rem;
  font-weight: 650;
}

.checklist-ring {
  position: relative;
  flex-shrink: 0;
  width: 7.5rem;
  height: 7.5rem;
}

.checklist-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.checklist-ring circle {
  fill: none;
  stroke-width: 10;
}

.checklist-ring-track {
  stroke: var(--app-border);
}

/* pathLength="100": the offset is what's left to do, in percent */
.checklist-ring-value {
  stroke: var(--app-primary);
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 900ms cubic-bezier(0.22, 1, 0.36, 1), stroke 300ms var(--app-ease);
}

.checklist-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--app-font-heading);
  font-size: 1.875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.checklist-ring-label small {
  margin-left: 0.0625rem;
  font-size: 0.9375rem;
  color: var(--app-muted);
}

/* All done: the ring turns green and a tick pops in */
.checklist-ring-done {
  position: absolute;
  right: 0.125rem;
  bottom: 0.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.125rem;
  color: var(--app-notify-success-ink);
  background-color: var(--app-notify-success-bg);
  border: 3px solid var(--app-surface);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 350ms cubic-bezier(0.34, 1.56, 0.64, 1) 500ms;
}

.checklist-ring.is-complete .checklist-ring-value {
  stroke: var(--app-notify-success-bg);
}

.checklist-ring.is-complete .checklist-ring-done {
  transform: scale(1);
}

.checklist-steps {
  display: grid;
  gap: 0.375rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.checklist-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.625rem 0.875rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius);
  transition: background-color 200ms var(--app-ease);
}

.checklist-step.is-done {
  background-color: var(--app-bg);
}

.checklist-check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.0625rem 0 0;
  cursor: pointer;
}

.checklist-mark {
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1.3;
  color: var(--app-muted);
}

.checklist-step.is-done .checklist-mark {
  color: var(--app-notify-success-bg);
}

.checklist-step-body {
  flex: 1;
  min-width: 0;
}

.checklist-step-title {
  display: block;
  font-weight: 500;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.checklist-step.is-done .checklist-step-title {
  color: var(--app-muted);
  text-decoration: line-through;
}

.checklist-step-meta {
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.checklist-step-meta:empty {
  display: none;
}

/* Just ticked: the box pops */
@keyframes checklist-pop {
  50% {
    transform: scale(1.25);
  }
}

.checklist-step.just-done .checklist-check {
  animation: checklist-pop 300ms var(--app-ease);
}

.checklist-load,
.checklist-save-as {
  padding: 0.875rem;
  background-color: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--bs-border-radius);
}

.checklist-load {
  margin-bottom: 1rem;
}

.checklist-save-as {
  margin-top: 1.25rem;
}

.checklist-load-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checklist-load-controls .form-select,
.checklist-load-controls .form-control {
  flex: 1 1 14rem;
  width: auto;
}

/* Edit mode: numbered steps, each with move up / down and remove */
.checklist-rows {
  display: grid;
  gap: 0.375rem;
  padding: 0;
  margin: 0 0 0.75rem;
  list-style: none;
  counter-reset: checklist-row;
}

.checklist-row {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  counter-increment: checklist-row;
}

.checklist-row::before {
  flex-shrink: 0;
  width: 1.75rem;
  padding-right: 0.375rem;
  font-variant-numeric: tabular-nums;
  color: var(--app-muted);
  text-align: right;
  content: counter(checklist-row) ".";
}

.checklist-row .form-control {
  flex: 1;
  min-width: 0;
}

.checklist-row-done {
  flex-shrink: 0;
  margin: 0 0.25rem;
  color: var(--app-notify-success-bg);
}

.checklist-row-button {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
}

.checklist-row:first-child [data-row-up],
.checklist-row:last-child [data-row-down] {
  visibility: hidden;
}

.checklist-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .checklist-ring-value,
  .checklist-ring-done {
    transition: none;
  }

  .checklist-step.just-done .checklist-check {
    animation: none;
  }
}

/* ---- Documentation (templates/documentatie/) ---- */
.doc {
  display: grid;
  gap: 3rem;
}

.doc-main {
  min-width: 0;
  max-width: 46rem;
}

.doc-toc {
  display: none;
}

@media (min-width: 1200px) {
  .doc {
    grid-template-columns: minmax(0, 46rem) 12rem;
  }

  /* Beside the text, following it down the page */
  .doc-toc {
    position: sticky;
    top: calc(var(--app-navbar-height) + 1.5rem);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: start;
    padding-left: 1rem;
    font-size: 0.875rem;
    border-left: 1px solid var(--app-border);
  }
}

.doc-toc-title {
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-toc a {
  color: var(--app-muted);
  text-decoration: none;
}

.doc-toc a:hover {
  color: var(--app-accent);
}

.doc-lead {
  margin-bottom: 1.75rem;
  font-size: 1.125rem;
  line-height: 1.6;
}

/* The journey at the top: one card per step, an arrow between them */
.doc-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.doc-flow-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.doc-flow-step .bi {
  margin-bottom: 0.375rem;
  font-size: 1.25rem;
  color: var(--app-brand);
}

.doc-flow-step span {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--app-muted);
}

.doc-flow-step.is-current {
  background-color: var(--app-accent-subtle);
  border-color: var(--app-accent);
}

@media (min-width: 768px) {
  .doc-flow-step:not(:last-child)::after {
    position: absolute;
    top: 50%;
    right: -0.875rem;
    font-family: "bootstrap-icons";
    font-size: 0.75rem;
    color: var(--app-muted);
    content: "\f285";
    transform: translateY(-50%);
  }
}

/* The statuses of a lead, and where each one leads */
.doc-states {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 1.25rem;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.doc-state-arrow {
  color: var(--app-muted);
}

.doc-state-ends {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-state {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.doc-state-then,
.doc-state-swap {
  font-size: 0.8125rem;
  color: var(--app-muted);
}

.doc-state-swap {
  padding-left: 0.75rem;
}

/* The statuses of a camp, in the order the days bring them */
.doc-phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  margin: 0;
  list-style: none;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.doc-phases li {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.doc-phases li > span:last-child {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--app-muted);
}

.doc-section {
  margin-top: 3rem;
  scroll-margin-top: calc(var(--app-navbar-height) + 1rem);
}

.doc-section h2 {
  margin-bottom: 0.875rem;
  font-size: 1.25rem;
  font-weight: 650;
}

.doc-section p,
.doc-section li,
.doc-section dd {
  line-height: 1.65;
}

/* Numbered steps, the number in a circle */
.doc-steps {
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
  counter-reset: doc-step;
}

.doc-steps li {
  position: relative;
  padding-left: 2.5rem;
  margin-bottom: 0.75rem;
  counter-increment: doc-step;
}

.doc-steps li::before {
  position: absolute;
  top: 0.125rem;
  left: 0;
  display: grid;
  place-items: center;
  width: 1.625rem;
  height: 1.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-accent);
  content: counter(doc-step);
  background-color: var(--app-accent-subtle);
  border-radius: 50%;
}

.doc-list li {
  margin-bottom: 0.375rem;
}

.doc-terms dt {
  font-weight: 600;
}

.doc-terms dd {
  margin-bottom: 0.875rem;
  color: var(--app-muted);
}

.doc-rules {
  padding: 0.25rem 1.25rem;
  margin: 0;
  list-style: none;
  background-color: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.doc-rules li {
  position: relative;
  padding: 0.75rem 0 0.75rem 1.75rem;
}

.doc-rules li + li {
  border-top: 1px solid var(--app-border);
}

.doc-rules li::before {
  position: absolute;
  top: 0.75rem;
  left: 0;
  font-family: "bootstrap-icons";
  color: var(--app-accent);
  content: "\f272";
}

/* Screenshots: the one of the current theme shows */
.doc-shot {
  margin: 1.5rem 0 2rem;
}

.doc-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  box-shadow: var(--app-shadow);
}

.doc-shot .doc-shot-dark,
[data-bs-theme="dark"] .doc-shot .doc-shot-light {
  display: none;
}

[data-bs-theme="dark"] .doc-shot .doc-shot-dark {
  display: block;
}

.doc-shot figcaption {
  margin-top: 0.625rem;
  font-size: 0.8125rem;
  color: var(--app-muted);
  text-align: center;
}

.doc-pager {
  display: flex;
  padding-top: 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid var(--app-border);
}

.doc-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.75rem 1.125rem;
  color: var(--app-ink);
  text-decoration: none;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.doc-pager a:hover {
  border-color: var(--app-accent);
}

.doc-pager span {
  font-size: 0.75rem;
  color: var(--app-muted);
}

.doc-pager strong {
  color: var(--app-accent);
}

.doc-pager-next {
  margin-left: auto;
  text-align: right;
}
