/* EEM Management Platform — design tokens and components on top of Bootstrap 5.3.
   Emerald + gold follow the EEM brand reference; surfaces stay light and
   high-contrast for long working sessions. All text colours meet WCAG AA. */
:root {
  --eem-emerald-900: #0a3b2e;
  --eem-emerald-800: #0d4a3a;
  --eem-emerald-700: #11604b;
  --eem-emerald-100: #e3efe9;
  --eem-gold-600: #8a6a22;   /* text-safe gold on white (AA) */
  --eem-gold-400: #c9a24a;
  --eem-gold-100: #f6efdc;
  --eem-ink: #1c2421;
  --eem-surface: #f5f6f4;
  --eem-border: #dde2de;
  --eem-sidebar-width: 15.5rem;
  --eem-radius: .6rem;

  --bs-body-color: var(--eem-ink);
  --bs-body-bg: var(--eem-surface);
  --bs-link-color: var(--eem-emerald-700);
  --bs-link-color-rgb: 17, 96, 75;
  --bs-link-hover-color: var(--eem-emerald-900);
  --bs-link-hover-color-rgb: 10, 59, 46;
  --bs-border-color: var(--eem-border);
  --bs-focus-ring-color: rgba(201, 162, 74, .55);
}

.btn-primary {
  --bs-btn-bg: var(--eem-emerald-700);
  --bs-btn-border-color: var(--eem-emerald-700);
  --bs-btn-hover-bg: var(--eem-emerald-800);
  --bs-btn-hover-border-color: var(--eem-emerald-800);
  --bs-btn-active-bg: var(--eem-emerald-900);
  --bs-btn-active-border-color: var(--eem-emerald-900);
  --bs-btn-disabled-bg: var(--eem-emerald-700);
  --bs-btn-disabled-border-color: var(--eem-emerald-700);
}
.btn-outline-primary {
  --bs-btn-color: var(--eem-emerald-700);
  --bs-btn-border-color: var(--eem-emerald-700);
  --bs-btn-hover-bg: var(--eem-emerald-700);
  --bs-btn-hover-border-color: var(--eem-emerald-700);
  --bs-btn-active-bg: var(--eem-emerald-800);
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--eem-emerald-700); }
.pagination { --bs-pagination-active-bg: var(--eem-emerald-700); --bs-pagination-active-border-color: var(--eem-emerald-700); --bs-pagination-color: var(--eem-emerald-700); }
.list-group { --bs-list-group-active-bg: var(--eem-emerald-700); --bs-list-group-active-border-color: var(--eem-emerald-700); }

/* Visible focus for keyboard users everywhere */
:focus-visible { outline: 3px solid var(--eem-gold-400); outline-offset: 2px; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--eem-gold-400); box-shadow: 0 0 0 .2rem rgba(201,162,74,.35); }

.eem-skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: var(--eem-radius); }

/* Top bar */
.eem-topbar { background: var(--eem-emerald-900); color: #fff; min-height: 3.5rem; }
.eem-brand { color: #fff; display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.eem-brand:hover, .eem-brand:focus { color: var(--eem-gold-100); }
.eem-brand-mark { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: .08em;
  background: var(--eem-gold-400); color: var(--eem-emerald-900); border-radius: .35rem; padding: .15rem .45rem; font-size: .85rem; }
.eem-brand-mark-lg { font-size: 1.1rem; padding: .35rem .6rem; }
.eem-topbar-btn { color: #fff; border-color: rgba(255,255,255,.25); }
.eem-topbar-btn:hover, .eem-topbar-btn:focus { color: #fff; background: rgba(255,255,255,.12); }
.eem-topsearch { min-width: 18rem; max-width: 26rem; flex: 1 1 auto; }
.eem-topsearch .form-control { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.eem-topsearch .form-control::placeholder { color: rgba(255,255,255,.7); }
.eem-lang-select { width: auto; background-color: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.eem-lang-select option { color: var(--eem-ink); }

/* Shell */
.eem-shell { display: flex; min-height: calc(100vh - 3.5rem); }
.eem-sidebar { background: #fff; border-right: 1px solid var(--eem-border); }
@media (min-width: 992px) {
  .eem-sidebar { width: var(--eem-sidebar-width); flex: 0 0 var(--eem-sidebar-width); position: sticky; top: 3.5rem; height: calc(100vh - 3.5rem); overflow-y: auto; }
}
.eem-sidebar .offcanvas-body { padding: .75rem .5rem; flex-direction: column; }
.eem-nav .nav-link { display: flex; align-items: center; gap: .6rem; color: var(--eem-ink); border-radius: .45rem; padding: .45rem .7rem; font-size: .95rem; }
.eem-nav .nav-link:hover { background: var(--eem-emerald-100); }
.eem-nav .nav-link.active { background: var(--eem-emerald-700); color: #fff; }
.eem-nav .nav-link.active .badge { background: rgba(255,255,255,.2) !important; color: #fff !important; }
.eem-nav-planned { color: #5c6661 !important; }
.eem-subnav { margin: .1rem 0 .3rem 2.1rem; }
.eem-subnav .nav-link { font-size: .85rem; padding: .2rem .6rem; color: #4a5450; }
.eem-badge-planned { background: #e9ecea; color: #4a5450; font-weight: 500; }
.eem-badge-partial { background: var(--eem-gold-100); color: var(--eem-gold-600); font-weight: 500; }

.eem-main { flex: 1 1 auto; min-width: 0; padding: 1.25rem 1rem 0; }
@media (min-width: 768px) { .eem-main { padding: 1.5rem 2rem 0; } }
.eem-main:focus { outline: none; }
.eem-footer { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; font-size: .8rem; color: #5c6661; border-top: 1px solid var(--eem-border); margin-top: 3rem; padding: 1rem 0 1.5rem; }

/* Page structure */
.eem-page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.eem-section-title { font-weight: 600; margin-bottom: .75rem; color: var(--eem-emerald-900); }
.eem-breadcrumb { font-size: .875rem; margin-bottom: .75rem; }
.eem-card { border-color: var(--eem-border); border-radius: var(--eem-radius); }
.eem-card > .card-header { background: #fff; font-weight: 600; border-bottom-color: var(--eem-border); }
.eem-fieldset-legend { float: none; width: 100%; font-size: 1rem; margin-bottom: 0; }
.eem-form-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 2rem; }
.eem-required { color: #b02a37; font-weight: 700; }
.eem-optional { color: #5c6661; font-weight: 400; font-size: .85em; }
.eem-error-summary a { color: inherit; text-decoration: underline; }
.eem-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .25rem 1rem; }

/* Stats */
.eem-stat { display: flex; flex-direction: column; padding: 1rem 1.1rem; text-decoration: none; color: var(--eem-ink); height: 100%; }
a.eem-stat:hover { border-color: var(--eem-emerald-700); }
.eem-stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; color: var(--eem-emerald-800); }
.eem-stat-label { font-size: .85rem; color: #4a5450; }
.eem-stat-inline { font-weight: 700; font-size: 1.15rem; color: var(--eem-emerald-800); margin-right: .25rem; }
.eem-pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; }
.eem-pipeline-stage { display: flex; flex-direction: column; padding: .9rem 1rem; text-decoration: none; color: var(--eem-ink); }
.eem-pipeline-stage:hover { border-color: var(--eem-emerald-700); }

/* Module cards */
.eem-module-card { text-decoration: none; color: var(--eem-ink); transition: border-color .15s; }
.eem-module-card:hover, .eem-module-card:focus { border-color: var(--eem-emerald-700); color: var(--eem-ink); }
.eem-module-planned { background: #fafbfa; border-style: dashed; }

/* Identifiers */
.eem-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; color: var(--eem-gold-600); }
.eem-museum-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 1rem; letter-spacing: .04em;
  background: var(--eem-gold-100); color: var(--eem-gold-600); border: 1px solid #e8d9b0; border-radius: .35rem; padding: .1rem .5rem; }

/* Tables and definition lists */
.eem-table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #4a5450; background: #fafbfa; white-space: nowrap; }
.eem-sort-link { color: inherit; text-decoration: none; }
.eem-sort-link:hover { text-decoration: underline; }
.eem-row-archived td { color: #6b746f; }
.eem-changes { font-size: .8rem; max-width: 32rem; word-break: break-word; }
.eem-dl { margin: 0; }
.eem-dl-row { display: grid; grid-template-columns: minmax(9rem, 38%) 1fr; gap: .75rem; padding: .55rem 1rem; border-bottom: 1px solid var(--eem-border); }
.eem-dl-row:last-child { border-bottom: 0; }
.eem-dl-row dt { font-weight: 500; color: #4a5450; font-size: .9rem; }
.eem-dl-row dd { margin: 0; word-break: break-word; }
.eem-dl-compact .eem-dl-row { grid-template-columns: 8rem 1fr; padding: .4rem 1rem; font-size: .9rem; }
.eem-tabs { margin-bottom: 1rem; }
.eem-tabs .nav-link { color: #4a5450; }
.eem-tabs .nav-link.active { color: var(--eem-emerald-800); font-weight: 600; }
.eem-category-tree .list-group-item { font-size: .9rem; }

/* Login */
.eem-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(160deg, var(--eem-emerald-900), var(--eem-emerald-700)); }
.eem-login-card { width: 100%; max-width: 30rem; border: 0; border-radius: 1rem; }

/* Progressive enhancement: hide the Apply button only when JS is running */
.eem-js .eem-js-hide { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Sidebar status icons (language-neutral; text alternative is visually hidden) */
.eem-nav-status { font-size: .85rem; color: #6b746f; flex-shrink: 0; }
.eem-nav .nav-link.active .eem-nav-status { color: #fff; }
.eem-nav-legend { margin: 1rem .7rem 0; padding-top: .75rem; border-top: 1px solid var(--eem-border); font-size: .75rem; color: #5c6661; display: grid; gap: .25rem; }

/* Key-value statistics: label then number (works without plural forms) */
.eem-kv { margin: 0; }
.eem-kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dashed var(--eem-border); }
.eem-kv > div:last-child { border-bottom: 0; }
.eem-kv dt { font-weight: 400; color: #3d4642; }
.eem-kv dd { margin: 0; font-weight: 700; font-size: 1.1rem; color: var(--eem-emerald-800); }

/* White caret on the dark top-bar language select */
.eem-lang-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }

/* --------------------------------------------------------------------------
   Two applications, one design system.
   EEM Heritage OS keeps the emerald accent; EEM External CRM uses a navy
   accent so staff always see which application they are in. The token names
   stay the same, so every component follows automatically. All accent values
   keep white text and links at WCAG AA (navy-700 on white: 8.9:1).
   -------------------------------------------------------------------------- */
:root[data-eem-app="crm"] {
  --eem-emerald-900: #13294b;
  --eem-emerald-800: #1a365f;
  --eem-emerald-700: #23497f;
  --eem-emerald-100: #e5ebf5;
  --bs-link-color: var(--eem-emerald-700);
  --bs-link-color-rgb: 35, 73, 127;
  --bs-link-hover-color: var(--eem-emerald-900);
  --bs-link-hover-color-rgb: 19, 41, 75;
}

/* Brand block: EEM mark + application name + one-line purpose */
.eem-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.eem-app-name { font-weight: 600; }
.eem-app-tagline { font-size: .72rem; font-weight: 400; color: rgba(255,255,255,.72); }

/* Sidebar sections and footer (Roadmap) */
.eem-sidebar .offcanvas-body { gap: 0; }
.eem-nav-heading { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: #5c6661; margin: .9rem .7rem .3rem; }
.eem-nav-footer { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--eem-border); }
.eem-nav-footer .eem-nav-legend { border-top: 0; margin-top: .5rem; padding-top: 0; }

/* Dashboard quick actions and scope note */
.eem-quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.eem-scope-note { font-size: .875rem; color: #4a5450; border-left: 3px solid var(--eem-gold-400); padding: .25rem 0 .25rem .75rem; margin-bottom: 1.25rem; }
.eem-roadmap-list .list-group-item { display: flex; gap: .75rem; align-items: flex-start; }
.eem-roadmap-list .bi { font-size: 1.25rem; color: var(--eem-emerald-700); }

/* --------------------------------------------------------------------------
   Responsive top bar (audit 2026-11-19: at <= 768 px the user menu was pushed
   off-screen and every page scrolled sideways). Children may shrink; the
   product name and the username hide on small screens; search gets narrower.
   -------------------------------------------------------------------------- */
.eem-topbar .container-fluid > * { min-width: 0; }
.eem-topsearch { min-width: 10rem; }
@media (max-width: 1199.98px) { .eem-topsearch { max-width: 18rem; } }
@media (max-width: 575.98px) {
  .eem-brand-text { display: none; }
  .eem-topbar .bi-translate { display: none; }
  .eem-lang-select { max-width: 7.5rem; }
}

/* Object tabs scroll horizontally on narrow screens instead of stacking. */
.eem-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.eem-tabs .nav-link { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Digital Archive
   -------------------------------------------------------------------------- */
.eem-cover { display: flex; align-items: center; justify-content: center; background: #eef1ef;
  border-radius: var(--eem-radius); overflow: hidden; color: #5c6661; }
.eem-cover img { width: 100%; height: 100%; object-fit: contain; }
.eem-cover-sm { width: 4rem; height: 5rem; flex: 0 0 4rem; }
.eem-cover-lg { width: 7.5rem; height: 9.5rem; flex: 0 0 7.5rem; }
.eem-cover-card { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--eem-radius) var(--eem-radius) 0 0; }
.eem-cover-fallback { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .5rem;
  text-align: center; font-size: .75rem; line-height: 1.2; }
.eem-cover-fallback .bi { font-size: 1.4rem; }
@media (max-width: 575.98px) { .eem-cover-lg { width: 5rem; height: 6.5rem; flex-basis: 5rem; } }
/* Small covers: the fallback reason is clamped visually (full text stays in the
   accessibility tree and in the title tooltip) so it never spills out of the tile. */
.eem-cover-sm .eem-cover-fallback > span { display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.eem-cover-sm .eem-cover-fallback { font-size: .625rem; padding: .25rem; }
@media (max-width: 575.98px) {
  .eem-cover-lg .eem-cover-fallback > span { display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden; }
  .eem-cover-lg .eem-cover-fallback { font-size: .625rem; padding: .25rem; }
}

.eem-archive-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.eem-archive-totals > div { background: #fff; border: 1px solid var(--eem-border); border-radius: var(--eem-radius); padding: .6rem .9rem; }
.eem-archive-totals dt { font-weight: 400; font-size: .8rem; color: #4a5450; }
.eem-archive-totals dd { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--eem-emerald-800); }
.eem-category-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.eem-code-plain { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
.eem-archive-card-link { display: block; }
.eem-progress { height: .35rem; background: var(--eem-emerald-100); border-radius: 1rem; overflow: hidden; }
.eem-progress span { display: block; height: 100%; background: var(--eem-emerald-700); }

.eem-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .75rem; padding: 0; }
.eem-page-thumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; background: #eef1ef;
  border-radius: var(--eem-radius) var(--eem-radius) 0 0; overflow: hidden; color: #5c6661; }
.eem-page-thumb img { width: 100%; height: 100%; object-fit: contain; }
.eem-position-input { width: 4.5rem; }

.eem-viewer-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .6rem; border-bottom: 1px solid var(--eem-border); }
.eem-viewer-stage { max-height: 80vh; overflow: auto; text-align: center; background: #2b2f2d; padding: .75rem; }
.eem-viewer-stage img { max-width: 100%; height: auto; }
.eem-viewer-stage.is-zoomed img { max-width: none; }
.eem-page-strip { display: flex; gap: .5rem; overflow-x: auto; padding: 0 0 .5rem; }
.eem-page-strip a { display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 5rem; text-decoration: none;
  border: 2px solid transparent; border-radius: .4rem; padding: .2rem; }
.eem-page-strip a.is-current { border-color: var(--eem-emerald-700); }
.eem-page-strip img, .eem-page-strip .eem-cover-fallback { width: 4.4rem; height: 5.8rem; object-fit: contain; background: #eef1ef; }

.eem-rights-list li { display: grid; grid-template-columns: 1.2rem 1fr; column-gap: .4rem; padding: .2rem 0; }
.eem-rights-list li > .small { grid-column: 2; }
.eem-rights-list .is-allowed .bi { color: #198754; }
.eem-rights-list .is-denied .bi { color: #6b746f; }
.eem-media-preview { max-height: 28rem; object-fit: contain; background: #eef1ef; }
.eem-upload-progress { max-width: 30rem; margin-bottom: 1rem; }

/* Readable export: selection column and preview sample */
.eem-select-col { width: 2.5rem; text-align: center; }
.eem-export-sample { max-height: 12rem; overflow-y: auto; }

/* Staff & Access: readable access matrix */
.eem-access-matrix th { white-space: normal; font-size: .8rem; }
.eem-access-matrix th[scope="row"] { min-width: 12rem; }

/* Single object page */
.eem-object-sections .badge { white-space: normal; text-align: start; }
.eem-section-index { position: sticky; top: 4.5rem; }
.eem-section-index .nav { gap: .25rem; flex-wrap: nowrap; overflow-x: auto; }
@media (max-width: 991.98px) {
  .eem-section-index { top: 3.5rem; z-index: 5; background: var(--bs-body-bg); padding: .25rem 0; }
  .eem-section-index .nav-link { white-space: nowrap; padding: .25rem .5rem; }
}
@media (min-width: 992px) { .eem-section-index .nav { flex-wrap: wrap; overflow: visible; } }
.eem-save-bar { position: sticky; bottom: 0; z-index: 10; }
.eem-inline-form > summary { list-style: none; display: inline-block; }
.eem-inline-form > summary::-webkit-details-marker { display: none; }
.eem-inline-actions { margin-top: -.75rem; margin-bottom: .5rem; }
.eem-page-strip li { width: 5.5rem; }
.eem-strip-thumb { width: 5rem; height: 6.5rem; object-fit: cover; border: 1px solid var(--bs-border-color); border-radius: .25rem; background: var(--bs-tertiary-bg); }

/* --------------------------------------------------------------------------
   EEM External CRM: boards (tasks, partnership pipeline) and task calendar
   -------------------------------------------------------------------------- */
.eem-board { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .75rem;
  overflow-x: auto; padding-bottom: .5rem; }
.eem-board-column { background: #f3f5f4; border: 1px solid var(--eem-border); border-radius: var(--eem-radius);
  display: flex; flex-direction: column; min-height: 8rem; }
.eem-board-column.is-drop-target { outline: 2px dashed var(--eem-emerald-700); outline-offset: -2px; }
.eem-board-column > header { padding: .5rem .75rem; font-weight: 600; display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.eem-board-cards { list-style: none; margin: 0; padding: 0 .5rem .5rem; display: flex; flex-direction: column; gap: .5rem; }
.eem-board-card { background: #fff; border: 1px solid var(--eem-border); border-radius: var(--eem-radius); padding: .5rem .6rem; }
.eem-board-card[draggable="true"] { cursor: grab; }
.eem-board-card.is-overdue { border-left: 3px solid #dc3545; }
.eem-calendar { table-layout: fixed; }
.eem-calendar td { height: 7rem; vertical-align: top; min-width: 0; }
.eem-calendar .is-other-month { background: #f7f8f7; color: #6b746f; }
.eem-calendar .is-today { box-shadow: inset 0 0 0 2px var(--eem-emerald-700); }
.eem-calendar ul { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .8rem; }
.eem-calendar li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767.98px) {
  .eem-calendar thead { display: none; }
  .eem-calendar, .eem-calendar tbody, .eem-calendar tr, .eem-calendar td { display: block; width: 100%; height: auto; }
  .eem-calendar td.is-other-month:not(.has-items), .eem-calendar td:not(.has-items):not(.is-today) { display: none; }
  .eem-calendar li { white-space: normal; }
}
.eem-topbar-bell { position: relative; }
.eem-topbar-bell .badge { position: absolute; top: .1rem; right: .05rem; font-size: .62rem; }
.eem-preview-text { white-space: pre-wrap; max-height: 30rem; overflow: auto; }

/* CRM mail: message frame (sandboxed, sanitised HTML), texts and previews */
.eem-mail-frame {
  display: block;
  width: 100%;
  height: 22rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: #fff;
  resize: vertical;
}
.eem-mail-text { overflow-wrap: anywhere; }
.eem-mail-outgoing { border-left: 3px solid var(--bs-primary); }
.eem-mail-snippet { max-width: 40rem; }

/* --------------------------------------------------------------------------
   Responsive layout safeguards (docs/RESPONSIVE_LAYOUT_AUDIT.md, 2026-11-27)
   -------------------------------------------------------------------------- */
/* Long unbroken values (file names, URLs, e-mail addresses, codes, long words in
   Russian or Spanish) wrap instead of widening the page. "anywhere" only acts when a
   word cannot fit its line, and it lets flex and grid children shrink below such a word.
   Bootstrap resets .card and code to break-word, so they are named here as well.
   Tables keep word-sized columns; genuinely wide tables scroll in .table-responsive. */
.eem-main, .eem-main .card, .eem-main code { overflow-wrap: anywhere; }
.eem-main table, .eem-main table code { overflow-wrap: break-word; }
/* A table scroller is the containing block of everything inside it: screen-reader text
   (.visually-hidden is position:absolute) otherwise escapes it and widens the page. */
.table-responsive { position: relative; }
/* Search and filter bar of the shared list pages: the fields flow by the width the bar
   really has (a list can sit beside the category column), not by the window width. */
.eem-list-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.eem-list-filter { flex: 1 1 7.5rem; min-width: 0; }
.eem-list-filter.is-search { flex: 2 1 15rem; }
.eem-list-filter-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* A badge wraps between its words instead of sticking out of its container; a count
   or a single word is never split. */
.eem-main .badge { white-space: normal; text-align: start; overflow-wrap: break-word; }
/* Buttons keep whole words too: their labels are short, and in a row of controls the
   neighbouring field gives way instead of a word being split ("Перем|естить"). */
.eem-main .btn { overflow-wrap: break-word; }

/* Keyboard focus and in-page links never land under the sticky bars (static/js/eem.js
   measures the save bar, whose buttons wrap on narrow screens). */
html { scroll-padding-top: 4.5rem; }
html:has(.eem-section-index) { scroll-padding-top: 7.5rem; }
html:has(.eem-save-bar) { scroll-padding-bottom: var(--eem-save-bar-space, 5.5rem); }

/* Short viewports (landscape phones, browser zoom of about 200 % and more):
   - sticky bars would cover most of the screen, so they scroll with the page instead;
   - a scrollable dialog scrolls as a whole, so its title and its buttons stay reachable
     even when they alone are taller than the screen (zoom of 400 %). */
@media (max-height: 30rem) {
  .eem-topbar.sticky-top, .eem-section-index, .eem-save-bar { position: static; }
  html, html:has(.eem-section-index), html:has(.eem-save-bar) { scroll-padding-top: 0; scroll-padding-bottom: 0; }
  .modal-dialog-scrollable { height: auto; }
  .modal-dialog-scrollable .modal-content { max-height: none; overflow: visible; }
  .modal-dialog-scrollable .modal-body { overflow-y: visible; }
}
@media (max-height: 30rem) and (min-width: 992px) {
  .eem-sidebar { top: 0; height: 100vh; }
}
