/* Bounded work areas keep stage headings and dialog controls in reach. */
.knyaz-v5 .v4-shell .kanban {
  height: clamp(300px, calc(100dvh - 235px), 760px);
  min-height: 0;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 16px;
}
.knyaz-v5 .v4-shell .kanban > .stage {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
  scroll-padding-top: 76px;
}
.knyaz-v5 .v4-shell .kanban > .stage > header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #e6ecde;
  border-bottom: 1px solid #bdcbae;
  margin-bottom: 12px;
}
.knyaz-v5 #modal[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  max-height: calc(var(--knyaz-viewport-height, 100dvh) - var(--knyaz-safe-top, 0px) - var(--knyaz-safe-bottom, 0px) - 24px);
  overflow: hidden;
}
.knyaz-v5 #modal .modal-header { flex: 0 0 auto; position: relative; top: auto; }
.knyaz-v5 #modal .modal-header h2 { min-width: 0; overflow-wrap: anywhere; }
.knyaz-v5 #modal .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  max-height: none !important;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}
.knyaz-v5 :is(.kanban, .stage, #modal .modal-body) {
  scrollbar-width: auto;
  scrollbar-color: #496d48 #dce6d2;
}
.knyaz-v5 :is(.kanban, .stage, #modal .modal-body)::-webkit-scrollbar { width: 14px; height: 14px; }
.knyaz-v5 :is(.kanban, .stage, #modal .modal-body)::-webkit-scrollbar-track { background: #dce6d2; }
.knyaz-v5 :is(.kanban, .stage, #modal .modal-body)::-webkit-scrollbar-thumb {
  background: #496d48;
  border: 3px solid #dce6d2;
  border-radius: 0;
  min-height: 40px;
}
.knyaz-v5 :is(.kanban, .stage, #modal .modal-body)::-webkit-scrollbar-thumb:hover { background: #234d39; }
@media (max-width: 767px) {
  .knyaz-v5 .v4-shell .kanban { height: clamp(280px, 62dvh, 640px); }
}
