/* ── LiveFramework app-shell footer ──────────────── */
/* Compact bar pinned to the bottom of the fixed frame (no margin-top so it
   hugs the viewport bottom; only <main> above it scrolls). */
.live-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.3rem 0;
  background-color: #5a6268;
  color: #f8f9fa;
  border-top: 1px solid #4b5157;
  font-size: 0.85rem;
}

/* Two-zone layout: help (left, grows) · tools / HTTP / copyright (right, compact). */
.live-footer-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.65rem;
  min-height: 1.45rem;
}

/* LEFT — help + field status take all remaining width. The chevrons and the viewport
   sit in front of the field status: the text scrolls, the status does not. */
.footer-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  /* The bar's own height. The help text inside is empty until the mouse is over something
     managed, so without this the whole left zone collapses to nothing — invisible either way,
     but it also leaves nothing for a guided tour to point at when it explains where the
     contextual help appears (see Documentation/Walkthrough.md §3). */
  min-height: 1.45rem;
}

/* The words just heard. Hidden until voice is recognising; then the help line steps aside. */
.footer-transcript {
  display: none;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.8rem;
}
.live-footer.is-hearing .footer-transcript { display: block; }
.live-footer.is-hearing .footer-help { display: none; }

.footer-scroll-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.35rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  color: inherit;
  line-height: 1;
  font-size: 0.65rem;
  cursor: pointer;
}
.footer-scroll-btn[hidden] { display: none !important; }
.footer-scroll-btn:hover,
.footer-scroll-btn:focus-visible {
  border-color: #6c757d;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
.footer-scroll-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.footer-scroll-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.footer-scroll-track {
  display: flex;
  align-items: center;
  width: max-content;
  white-space: nowrap;
  transform: translateX(var(--lf-footer-x, 0px));
}

.footer-field-status { flex: 0 0 auto; }

/* Contextual help for the current descriptor-linked element. It may be wider than the
   bar: the viewport clips it and the chevrons scroll it. */
.footer-help {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #ced4da;
  font-style: italic;
  font-size: 0.8rem;
}
.footer-help.has-help {
  color: #f8f9fa;
  font-style: normal;
}

/* RIGHT — HTTP communication dot. No permanent text label (kept only for screen readers via
   .visually-hidden) — the dot alone, plus title/aria-label on hover/focus and a click-through
   dialog for detail, is enough signal without permanently eating footer width. */
.footer-http {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: inherit;
  line-height: 1;
  cursor: pointer;
}
.footer-http:hover,
.footer-http:focus-visible {
  border-color: #6c757d;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
.footer-http-light {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background-color: #adb5bd;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25) inset;
  flex: 0 0 auto;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.footer-http[data-state="idle"] .footer-http-light {
  background-color: #adb5bd;
}
.footer-http[data-state="online"] .footer-http-light {
  background-color: #28a745;
  box-shadow: 0 0 6px 1px rgba(40, 167, 69, 0.7);
}
.footer-http[data-state="unstable"] .footer-http-light {
  background-color: #ffc107;
  box-shadow: 0 0 6px 1px rgba(255, 193, 7, 0.7);
}
.footer-http[data-state="offline"] .footer-http-light {
  background-color: #dc3545;
  box-shadow: 0 0 6px 1px rgba(220, 53, 69, 0.8);
}
/* Blinking is orthogonal to color (data-active, set by footer.ts) — online blinks while a
   stable request is in flight, unstable blinks only for the "slow" case (never for "flaky
   history" with nothing currently in flight), offline never blinks. */
.footer-http[data-active="1"] .footer-http-light {
  animation: footer-http-blink 1s ease-in-out infinite;
}
@keyframes footer-http-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* HTTP status dialog table. */
.footer-http-explain {
  margin-bottom: 0.75rem;
}
.footer-http-table {
  font-size: 0.85rem;
}
.footer-http-table .http-url {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.footer-http-table tr.http-err td {
  color: #dc3545;
}

/* RIGHT cluster: separator · tools menu · HTTP · copyright. */
.footer-right {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
}

.footer-sep {
  display: inline-block;
  width: 1px;
  height: 1rem;
  margin-right: 0.15rem;
  background: rgba(248, 249, 250, 0.35);
  flex: 0 0 auto;
}

/* Tools trigger — opens an upward checkable popup (popupMenu.ts). */
.footer-tools {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  color: inherit;
  line-height: 1;
  font-size: 0.72rem;
  cursor: pointer;
}
.footer-tools:hover,
.footer-tools:focus-visible,
.footer-tools[aria-expanded="true"] {
  border-color: #6c757d;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.footer-language {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  height: 1.35rem;
  padding: 0 0.3rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  color: inherit;
  line-height: 1;
  font-size: 0.72rem;
  cursor: pointer;
}

/* A paused guided tour (issue #211): the language switcher's shape, in the accent colour so it
   reads as "something is waiting for you" and not as one more setting. */
.footer-tour-paused {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.35rem;
  padding: 0 0.45rem;
  background: var(--lf-theme-accent, #0d6efd);
  border: 1px solid transparent;
  border-radius: 0.3rem;
  color: #fff;
  line-height: 1;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}
.footer-tour-paused:hover,
.footer-tour-paused:focus-visible,
.footer-tour-paused[aria-expanded="true"] {
  border-color: #fff;
  outline: none;
}

.footer-language-code {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.footer-language:hover,
.footer-language:focus-visible,
.footer-language[aria-expanded="true"] {
  border-color: #6c757d;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.lf-popup-menu-wrap {
  position: relative;
  display: inline-flex;
}

.lf-popup-menu {
  display: none;
  position: absolute;
  z-index: 1200;
  min-width: 14rem;
  padding: 0.25rem;
  background: #fff;
  color: #212529;
  border: 1px solid #dee2e6;
  border-radius: 0.4rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.lf-popup-menu.open {
  display: block;
}

.lf-popup-menu-up {
  bottom: calc(100% + 0.35rem);
  right: 0;
}

.lf-popup-menu-down {
  top: calc(100% + 0.35rem);
  right: 0;
}

.lf-popup-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 0.3rem;
  background: transparent;
  color: inherit;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.lf-popup-menu-item:hover,
.lf-popup-menu-item:focus-visible {
  background: #eef2f6;
  outline: none;
}

.lf-popup-menu-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.lf-popup-menu-item:disabled:hover {
  background: transparent;
}

.lf-popup-menu-check {
  width: 0.9rem;
  flex: 0 0 auto;
  text-align: center;
  color: #0d6efd;
  font-size: 0.75rem;
}

.lf-popup-menu-icon {
  width: 0.95rem;
  flex: 0 0 auto;
  text-align: center;
  color: #6c757d;
  font-size: 0.8rem;
}

.lf-popup-menu-label {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── Debug: outline every layout container (toggle via footer tools → layout borders) ─
   Uses outline (not border) so nothing shifts size/position — purely a visual overlay to see
   at a glance which container is contributing margin/padding around a page. */
html.lf-debug-layout main,
html.lf-debug-layout .composite-page,
html.lf-debug-layout .composite-page > *,
html.lf-debug-layout .composite-section,
html.lf-debug-layout .composite-explorer-side,
html.lf-debug-layout .composite-explorer-main,
html.lf-debug-layout .composite-master,
html.lf-debug-layout .composite-detail,
html.lf-debug-layout .lf-section-host,
html.lf-debug-layout .tree-page-container,
html.lf-debug-layout .section-page-container,
html.lf-debug-layout .section-page-card,
html.lf-debug-layout .section-page-body {
  outline: 1px solid red;
  outline-offset: -1px;
}

/* RIGHT — "© YYYY" chip. Styled with a subtle 3D/pressable look (inset highlight + drop
   shadow, moves down 1px on :active) so it reads as clickable even though the only "action"
   is revealing the popover — a real link would misleadingly suggest navigation. */
.footer-copyright {
  position: relative;
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.3rem;
  padding: 0.05rem 0.35rem;
  color: #f8f9fa;
  font-size: 0.72rem;
  line-height: 1.15;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 1px 2px rgba(0, 0, 0, 0.35);
}
.footer-copyright:hover,
.footer-copyright:focus-visible,
.footer-copyright.is-open {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.45);
  outline: none;
}
.footer-copyright:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35) inset;
}

/* Popover: hidden by default, revealed on hover/focus (desktop) or via the .is-open class
   that footer.ts toggles on click/tap (touch + keyboard-activation). Opens upward since the
   chip sits at the very bottom of the viewport. */
.footer-copyright-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  background: var(--lf-theme-popup-bg, #212529);
  color: var(--lf-theme-popup-fg, #f8f9fa);
  border: 1px solid var(--lf-theme-popup-border, rgba(255, 255, 255, 0.15));
  border-radius: 0.35rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: normal;
  white-space: nowrap;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--lf-theme-body-fg, #000) 28%, transparent);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1200;
}
.footer-copyright:hover .footer-copyright-popover,
.footer-copyright:focus-visible .footer-copyright-popover,
.footer-copyright.is-open .footer-copyright-popover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Navbar: the parts that are ours by name ───────────── */
/* Vertical rule between the menu strip (and its scroll arrow) and the
   notifications / chat / account cluster — same shape as .footer-sep. */
.lf-navbar-sep {
  display: inline-block;
  width: 1px;
  height: 1.25rem;
  margin: 0 0.35rem;
  background: rgba(248, 249, 250, 0.35);
  flex: 0 0 auto;
  align-self: center;
}

.lf-navbar-end {
  flex: 0 0 auto;
  margin-left: auto;
}

/* Account button: an icon and nothing else, so it costs the app bar a fixed square instead of a
   slice that grows with the length of somebody's name. What it used to show inline is in the
   dialog it opens (core/accountMenu.ts). */
.lf-account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
}

/* The dialog's body: one label/value pair per line, the label fixed-width so the values line up
   however long the labels get once translated. */
.lf-account-panel {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lf-account-row {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.lf-account-row-label {
  flex: 0 0 8rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.7;
}

.lf-account-row-value {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  /* A handle is a long opaque string; it must wrap rather than widen the dialog. */
  overflow-wrap: anywhere;
}

/* Sitemap: icon + count inline inside the same button */
.lf-menu-sitemap {
  flex: 0 0 auto;
  display: inline-flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 2.4rem;
  min-width: 3.5rem;
  padding: 0.35rem 0.65rem !important;
  box-sizing: border-box;
}
.lf-menu-sitemap-icon,
.lf-menu-sitemap .svg-inline--fa {
  font-size: 1.05rem;
  line-height: 1;
  flex: 0 0 auto;
  margin: 0 !important;
}
.lf-menu-sitemap-count {
  flex: 0 0 auto;
  display: inline-block;
  min-width: 1.5rem;
  max-width: 3.5rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background-color: #ffc107;
  color: #212529;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  vertical-align: middle;
}

/* Header menu search */
.lf-menu-search-wrap {
  position: relative;
  flex: 0 0 auto;
  width: var(--lf-menu-search-width, 14rem);
  min-width: 7rem;
  max-width: none;
  box-sizing: border-box;
}

/* Drag handle between search box and menu strip */
.lf-menu-splitter {
  flex: 0 0 auto;
  width: 7px;
  height: 2.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  cursor: col-resize;
  position: relative;
  align-self: center;
  touch-action: none;
  user-select: none;
}
.lf-menu-splitter::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  bottom: 0.35rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.35);
  transition: background-color 0.12s ease, width 0.12s ease;
}
.lf-menu-splitter:hover::before,
.lf-menu-splitter:focus-visible::before,
.lf-menu-splitter.is-dragging::before {
  width: 3px;
  background: rgba(255, 255, 255, 0.85);
}
.lf-menu-splitter:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 1px;
}
body.lf-menu-splitter-active {
  cursor: col-resize !important;
  user-select: none !important;
}
body.lf-menu-splitter-active * {
  cursor: col-resize !important;
  user-select: none !important;
}
.lf-menu-search {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.lf-menu-search::placeholder {
  color: rgba(255, 255, 255, 0.65);
}
.lf-menu-search:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: #fff;
  color: #fff;
  box-shadow: none;
}
.lf-menu-search-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  /* Width comes from Menu settings (menuNav.ts). Height follows the same
     settings through --lf-menu-search-max-rows, kept here rather than inline
     so the bottom-docked bar can cap it (shell.css, issue #328). */
  max-height: calc(var(--lf-menu-search-max-rows, 8) * 3.4rem);
  min-width: 14rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1080;
  background: #fff;
  color: #212529;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}
.lf-menu-search-item {
  display: block;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f3f5;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.lf-menu-search-item:hover,
.lf-menu-search-item:focus,
.lf-menu-search-item.is-active {
  background: #e7f1ff;
  color: inherit;
  border-left-color: #0d6efd;
  outline: none;
}
.lf-menu-search-item.is-active {
  background: #d0e4ff;
}
.lf-menu-search-label {
  display: block;
  font-weight: 600;
}
.lf-menu-search-path {
  display: block;
  font-size: 0.75rem;
  color: #6c757d;
}
.lf-menu-search-help {
  display: block;
  font-size: 0.75rem;
  color: #495057;
  font-style: italic;
}

/* Horizontally scrollable menu strip + arrows.
   IMPORTANT: do NOT use overflow-x/y on the strip — it clips or swallows Bootstrap
   dropdowns. Horizontal scrolling is done by translating .lf-menu-list instead. */
.lf-menu-scroll-btn {
  flex: 0 0 auto;
  width: 32px;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  justify-content: center;
}
.lf-menu-scroll-btn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}
.lf-menu-strip {
  flex: 1 1 auto;
  min-width: 0;
  height: 2.5rem;
  overflow: visible;
  align-self: center;
  /* Clip only the buttons row visually, not the floating dropdowns (they are
     position:absolute relative to .dropdown which lives here — so we clip via
     an inner mask that does not contain the menus). */
  position: relative;
}
.lf-menu-strip-viewport {
  height: 2.5rem;
  overflow: hidden; /* clips the button row only */
  width: 100%;
}
.lf-menu-list {
  width: max-content;
  height: 2.5rem;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  padding: 0;
  transform: translateX(var(--lf-menu-x, 0px));
  transition: transform 0.15s ease;
  will-change: transform;
}
.lf-menu-list > .nav-item {
  flex: 0 0 auto;
  height: 2.5rem;
  display: flex;
  align-items: center;
}
.lf-menu-list > .nav-item.dropdown {
  position: relative;
}
/* Dropdowns are moved to document.body on open (see menuNav.ts) so they are not
   clipped by .lf-menu-strip-viewport overflow:hidden. */
.lf-navbar .dropdown-menu {
  z-index: 2000;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
}
/* Not scoped, and it does not need to be: the compound requires OUR class, so it can never
   reach a menu the host page built. Issue #73 §1.6 classifies this shape as low risk. */
.dropdown-menu.lf-menu-dropdown-portal {
  position: fixed !important;
  inset: auto auto auto auto;
  float: none;
}

/* User-owned header bar (pins + groups) */
.lf-menu-bar-slot {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.lf-menu-bar-pin-wrap {
  position: relative;
  display: inline-flex;
}
.lf-menu-bar-close {
  display: none;
  position: absolute;
  top: 0.05rem;
  right: 0.05rem;
  width: 0.85rem;
  height: 0.85rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.5rem;
  cursor: pointer;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  color: #212529;
}
.lf-menu-bar-close:hover {
  background: #dc3545;
  color: #fff;
}
.lf-surface-open > .lf-menu-bar-close,
.lf-surface-open .lf-menu-bar-close {
  display: inline-flex;
}
.lf-surface-open .lf-menu-bar-pin {
  padding-right: 1.05rem;
}
.lf-menu-bar-member.lf-surface-open > a.dropdown-item {
  padding-right: 1.4rem;
}
.lf-menu-bar-close svg,
.lf-menu-bar-close i {
  width: 0.45rem;
  height: 0.45rem;
}
.lf-menu-bar-grip {
  flex: 0 0 auto;
  width: 0.75rem;
  align-self: stretch;
  cursor: grab;
  opacity: 0.4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lf-menu-bar-grip::before {
  content: "";
  width: 3px;
  height: 0.95rem;
  border-left: 1px dotted rgba(255, 255, 255, 0.75);
  border-right: 1px dotted rgba(255, 255, 255, 0.75);
}
.lf-menu-bar-slot:hover .lf-menu-bar-grip { opacity: 0.85; }
.lf-menu-bar-split {
  display: inline-flex;
}
.lf-menu-bar-group-main {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lf-menu-bar-group-count {
  display: inline-block;
  margin-left: 0.35rem;
  min-width: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.lf-menu-bar-group-caret {
  min-width: 1.35rem;
  padding-left: 0.25rem;
  padding-right: 0.35rem;
}
.lf-menu-bar-hint {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8rem;
  font-style: italic;
  white-space: nowrap;
  padding: 0 0.5rem;
  align-self: center;
  user-select: none;
}
.lf-menu-bar-drop-target .btn,
.lf-menu-bar-drop-target.lf-menu-bar-slot {
  outline: 2px solid #ffc107;
  outline-offset: 1px;
}
.lf-menu-bar-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 4000;
  padding: 0.25rem 0.6rem;
  border-radius: 0.25rem;
  background: #212529;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 0 0.35rem 0.75rem rgba(0, 0, 0, 0.35);
}
.lf-menu-bar-insert {
  position: fixed;
  pointer-events: none;
  z-index: 4000;
  background: #ffc107;
  border-radius: 1px;
}
body.lf-menu-bar-dragging,
body.lf-menu-bar-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
}
.lf-menu-bar-dropdown {
  min-width: 12rem;
}
.lf-menu-bar-member {
  display: flex;
  align-items: stretch;
  gap: 0.1rem;
  position: relative;
}
.lf-menu-bar-member > a.dropdown-item {
  flex: 1 1 auto;
}
.lf-menu-bar-dropdown .lf-menu-bar-grip::before {
  border-left-color: rgba(33, 37, 41, 0.45);
  border-right-color: rgba(33, 37, 41, 0.45);
}
.lf-menu-bar-check-spacer {
  display: inline-block;
  width: 1rem;
}
.app-menu-pin-split .app-menu-pin-caret {
  min-width: 1.2rem;
  padding-left: 0.2rem;
  padding-right: 0.3rem;
}

/* AppMenu browser page */
.app-menu-tree {
  max-height: calc(100vh - 14rem);
  overflow: auto;
}
.app-menu-row:hover {
  background: rgba(0, 0, 0, 0.02);
}
.app-menu-row[data-url] {
  cursor: pointer;
}
.app-menu-row[data-url]:focus-visible {
  outline: 2px solid var(--bs-primary, #0d6efd);
  outline-offset: -2px;
}
.app-menu-help {
  margin-top: 0.15rem;
}

/* ── What `:where(html.lf-shell, .lf-mount, .lf-scope)` is, once ───────────────────
   Everything below this point that redefines a name we did not invent — a Bootstrap class, a
   bare element — is scoped to it. Three roots, because a framework surface can be in three
   places (issue #73 §1.6/§3.7, issue #118):

     html.lf-shell     a document the framework owns end to end (_LiveLayout, _AccountLayout
                       set the class). There is no host page to collide with, so the rules
                       apply as they always did, chrome included — which is what keeps the
                       classic look and feel byte-identical, the verification this change is
                       measured by.
     .lf-mount   one mounted container inside a page that is NOT ours: Embedded, or two
                       surfaces side by side. Emitted by the server for the shells that know
                       where their mount is and adopted by mount() (Core/Section/MountMarker.cs,
                       Scripts/core/mount.ts), so the rules match at first paint rather than
                       after the bundle runs — issue #117, which had to land first.
     .lf-scope         a panel we parked on document.body because any other parent would clip
                       it: a dialog, a portalled dropdown, a cell editor. Outside every mount
                       by construction, so it says so itself (Scripts/core/portal.ts).

   Rules whose selector is already ours by name (.section-*, .tree-*, .composite-*, .lf-*) are
   NOT scoped: they cannot match a host's markup, and §1.6 classifies them as low risk.

   `:where()` and not `:is()`, and that is load-bearing rather than a style preference: :where()
   adds NOTHING to specificity, so every rule below keeps the exact weight it had as a bare
   `.card` / `.btn-primary` / `table` and the cascade comes out where it did. With :is() each
   would have gained a class — enough for site.css's `.card` to start outranking theme.css's
   `.section-page-card` on the one element that carries both (sectionPage.ts renders
   "section-page-card card"), and every themed section card would have gone back to grey. */

/* ── Cards & sections ───────────────────────────── */
:where(html.lf-shell, .lf-mount, .lf-scope) .card {
  border: 1px solid var(--lf-theme-panel-border, #ced4da);
  border-radius: 0.5rem;
  background-color: var(--lf-theme-panel-bg, #f8f9fa);
  color: var(--lf-theme-panel-fg, #212529);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--lf-theme-body-fg, #000) 8%, transparent);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--lf-theme-panel-fg, #495057);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--lf-theme-panel-border, #adb5bd);
}

/* ── Buttons ─────────────────────────────────────── */
:where(html.lf-shell, .lf-mount, .lf-scope) .btn-primary {
  background-color: var(--lf-theme-column-header-bg, #6c757d);
  border-color: var(--lf-theme-column-header-bg, #6c757d);
  color: var(--lf-theme-column-header-fg, #fff);
}
:where(html.lf-shell, .lf-mount, .lf-scope) .btn-primary:hover {
  background-color: color-mix(in srgb, var(--lf-theme-column-header-bg, #6c757d) 86%, var(--lf-theme-column-header-fg, #fff));
  border-color: color-mix(in srgb, var(--lf-theme-column-header-bg, #6c757d) 86%, var(--lf-theme-column-header-fg, #fff));
  color: var(--lf-theme-column-header-fg, #fff);
}

:where(html.lf-shell, .lf-mount, .lf-scope) .btn-secondary {
  background-color: #adb5bd;
  border-color: #adb5bd;
  color: #212529;
}
:where(html.lf-shell, .lf-mount, .lf-scope) .btn-secondary:hover {
  background-color: #9aa2a9;
  border-color: #9aa2a9;
  color: #212529;
}

/* ── Tables ──────────────────────────────────────── */
.table-container {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.table-container thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-container thead th {
  background-color: var(--lf-theme-column-header-bg, #6c757d);
  color: var(--lf-theme-column-header-fg, #fff);
  vertical-align: middle;
  white-space: nowrap;
}

.table-container tbody td {
  vertical-align: middle;
}

/* Table container for server-side paginated views — no scroll, auto height */
.table-container-page {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.table-container-page thead {
  position: sticky;
  top: var(--lf-header-height); /* clears the header, which is row one of the shell grid */
  z-index: 2;
}

.table-container-page thead th {
  background-color: #6c757d;
  color: #fff;
  vertical-align: middle;
  white-space: nowrap;
}

.table-container-page tbody td {
  vertical-align: middle;
}



/* ── Form controls ──────────────────────────────── */
:where(html.lf-shell, .lf-mount, .lf-scope) .form-control:focus,
:where(html.lf-shell, .lf-mount, .lf-scope) .form-select:focus {
  border-color: var(--lf-theme-editor-border, #6c757d);
  box-shadow: 0 0 0 0.2rem rgba(var(--lf-theme-accent-rgb, 108, 117, 125), 0.25);
}

/* ── Table page layout (fills main without overflow) ─ */
.section-page-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.section-page-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.section-page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ── Pagination ──────────────────────────────────── */
:where(html.lf-shell, .lf-mount, .lf-scope) .pagination .page-link {
  color: var(--lf-theme-panel-fg, #6c757d);
}
:where(html.lf-shell, .lf-mount, .lf-scope) .pagination .page-item.active .page-link {
  background-color: var(--lf-theme-column-header-bg, #6c757d);
  border-color: var(--lf-theme-column-header-bg, #6c757d);
  color: var(--lf-theme-column-header-fg, #fff);
}

/* Responsive tweaks */
@media (max-width: 768px) {
  :where(html.lf-shell, .lf-mount, .lf-scope) table {
    font-size: 0.8rem;
  }
}

/* ── Compact shell (issue #234, M4 / M3) ───────────────────────────────────────
   Driven by html.lf-compact from core/compact.ts (same md breakpoint the sheets use).
   The invariant: nothing in the app bar may widen the document. */

.lf-navbar-more { display: none !important; }

html.lf-compact .lf-navbar-inner {
  flex-wrap: wrap;
  row-gap: 0.35rem;
  max-width: 100%;
}


html.lf-compact .lf-menu-search-wrap {
  /* Always collapsed here: the menu sheet (the ☰ button) carries the search. The wrap stays in
     the DOM for the results portal. */
  position: absolute;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  pointer-events: none;
}

html.lf-compact .lf-menu-splitter,
html.lf-compact .lf-menu-scroll-btn {
  display: none !important;
}

html.lf-compact .lf-menu-strip {
  flex: 1 1 100%;
  order: 20;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 2.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}

html.lf-compact .lf-menu-strip-viewport {
  overflow: visible;
  width: max-content;
  min-width: 100%;
}

html.lf-compact .lf-menu-list {
  transform: none !important; /* native scroll replaces the translateX path */
  scroll-snap-type: x proximity;
}

html.lf-compact .lf-menu-list > .nav-item {
  scroll-snap-align: start;
}

html.lf-compact .lf-navbar-sep { display: none; }

html.lf-compact .lf-navbar-more {
  display: inline-flex !important;
  position: relative;
  flex: 0 0 auto;
  min-width: 2.4rem;
  min-height: 2.4rem;
  justify-content: center;
}

html.lf-compact .lf-navbar-more-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  min-width: 1.1rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: #ffc107;
  color: #212529;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
}

html.lf-compact .lf-navbar-end {
  position: relative;
}

html.lf-compact .lf-navbar-end-tools {
  /* Dropdown under the More button (issue #234): icon + desktop tooltip text as the row label.
     Kept in the DOM when closed so badge sums stay readable. */
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  left: auto;
  bottom: auto;
  z-index: 1085;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  min-width: 14rem;
  max-width: min(22rem, calc(100vw - 1rem));
  max-height: min(70vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.18);
}

html.lf-compact .lf-navbar-end-tools.is-open {
  display: flex;
}

html.lf-compact .lf-navbar-end-tools .btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
  color: var(--bs-body-color, #212529) !important;
  border-color: var(--bs-border-color, #dee2e6) !important;
  background: transparent !important;
}

/* Desktop tooltips become the visible row label under md. */
html.lf-compact .lf-navbar-end-tools .btn::after {
  content: attr(aria-label);
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0.55rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
}

html.lf-compact .lf-navbar-end-tools .btn > i {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  text-align: center;
}

/* Square toggles are 38px on the bar; in the menu they are full-width rows. */
html.lf-compact .lf-navbar-end-tools .lf-notif-toggle,
html.lf-compact .lf-navbar-end-tools .lf-chat-toggle,
html.lf-compact .lf-navbar-end-tools .lf-panel-toggle,
html.lf-compact .lf-navbar-end-tools .lf-apps-toggle,
html.lf-compact .lf-navbar-end-tools .lf-voice-toggle {
  width: 100%;
}

/* Keep unread chips next to the icon, not at the far end of the row. */
html.lf-compact .lf-navbar-end-tools .lf-notif-badge,
html.lf-compact .lf-navbar-end-tools .lf-chat-badge {
  top: 0.35rem;
  right: auto;
  left: 1.55rem;
}

/* Microphone + menu stay one control (issue #330): the label is on the mic, and the menu
   is the transparent strip along the bottom of that row, not a column beside it. */
html.lf-compact .lf-navbar-end-tools .lf-voice-split {
  display: flex;
  width: 100%;
  align-items: stretch;
}

html.lf-compact .lf-navbar-end-tools .lf-voice-main {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

html.lf-compact .lf-navbar-end-tools .lf-voice-toggle {
  width: 100%;
  min-width: 0;
}

html.lf-compact .lf-navbar-end-tools .lf-voice-caret {
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: var(--lf-voice-menu-strip, 20%);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  border: 0;
}

html.lf-compact .lf-navbar-end-tools .lf-voice-caret::after {
  content: none;
  display: none;
}

html.lf-compact .lf-dock-grip,
html.lf-compact [data-lf-dock-grip-slot] .lf-dock-grip {
  display: none !important;
}

/* ── One-row app bar and menu sheet (issue #258, phase 1) ───────────────────────
   [☰]  Page title                         [🔍] [⋯]
   The strip, arrows, splitter, sitemap link and brand are replaced by one button that opens the
   menu sheet. Desktop is untouched: everything is under html.lf-compact. */

.lf-menu-open { display: none !important; }
.lf-appbar-title { display: none; }

html.lf-compact {
  --lf-header-height: 44px;
}

html.lf-compact .lf-navbar-inner {
  flex-wrap: nowrap;
  row-gap: 0;
  align-items: center;
  /* Fixed, not var(--lf-header-height): shellDock publishes the measured height into it. */
  min-height: 2.75rem;
}

html.lf-compact .lf-navbar { padding-top: 0; padding-bottom: 0; }

html.lf-compact .lf-menu-sitemap,
html.lf-compact .lf-menu-strip {
  display: none !important;
}

html.lf-compact .lf-menu-open {
  display: inline-flex !important;
  position: relative;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

html.lf-compact .lf-menu-open[hidden],
html.lf-compact .lf-appbar-title[hidden] { display: none !important; }

html.lf-compact .lf-menu-open-badge {
  position: absolute;
  top: 0;
  right: -0.15rem;
  min-width: 1.1rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: #ffc107;
  color: #212529;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
}

html.lf-compact .lf-appbar-title {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0.25rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 40px buttons inside a 44px bar; the 44px touch target is kept by an expanded hit area. */
html.lf-compact.lf-touch .lf-navbar .btn-outline-light,
html.lf-compact.lf-touch .lf-navbar .lf-account-button,
html.lf-compact .lf-navbar .btn-outline-light,
html.lf-compact .lf-navbar .lf-account-button {
  position: relative;
  min-width: 2.5rem;
  min-height: 2.5rem;
  height: 2.5rem;
  padding-top: 0;
  padding-bottom: 0;
}

html.lf-compact .lf-navbar .btn-outline-light::before,
html.lf-compact .lf-navbar .lf-account-button::before {
  content: "";
  position: absolute;
  inset: -0.25rem;
}

html.lf-compact .lf-navbar-end-tools .btn::before { content: none; }

/* After the square-button rules above (issue #330): those set every navbar button to
   2.5rem and clear ::before, which would swallow the voice menu strip and its arrow. */
html.lf-compact .lf-navbar .lf-voice-caret,
html.lf-compact .lf-navbar-end-tools .lf-voice-caret {
  position: absolute;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: var(--lf-voice-menu-strip, 20%);
  padding: 0;
  border: 0;
  align-items: flex-end;
  justify-content: center;
}

html.lf-compact .lf-navbar .lf-voice-caret::before,
html.lf-compact .lf-navbar-end-tools .lf-voice-caret::before {
  content: "";
  position: static;
  inset: auto;
  width: 0.55rem;
  height: 0.28rem;
  margin-bottom: 0.1rem;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

html.lf-menu-sheet-open body { overflow: hidden; }

.lf-menu-sheet {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  padding-left: var(--lf-safe-left, 0px);
  padding-right: var(--lf-safe-right, 0px);
  background: var(--bs-body-bg, #fff);
  color: var(--bs-body-color, #212529);
}

.lf-menu-sheet-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  height: var(--lf-header-height, 44px);
  margin-top: var(--lf-safe-top, 0px);
  padding: 0 0.5rem;
  background: var(--lf-theme-header-bg, #5a6268);
}

.lf-menu-sheet-close { color: #fff; min-width: 2.5rem; min-height: 2.5rem; }
.lf-menu-sheet-search { flex: 1 1 auto; min-width: 0; font-size: 16px; /* no iOS zoom */ }

.lf-menu-sheet-list {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 0 var(--lf-safe-bottom, 0px);
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lf-menu-sheet-heading {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color, #6c757d);
}

.lf-menu-sheet-link,
.lf-menu-sheet-group,
.lf-menu-sheet-empty {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.35rem 1rem 0.35rem calc(1rem + var(--lf-sheet-depth, 0) * 1rem);
}

.lf-menu-sheet-link { color: inherit; text-decoration: none; }
.lf-menu-sheet-link:active { background: var(--bs-secondary-bg, #e9ecef); }
.lf-menu-sheet-link > i,
.lf-menu-sheet-group > i { flex: 0 0 1.25rem; text-align: center; }
.lf-menu-sheet-group { font-weight: 600; color: var(--bs-secondary-color, #6c757d); }

/* Primary touch targets (M10). */
html.lf-touch .lf-navbar .btn-outline-light,
html.lf-touch .lf-account-button,
html.lf-touch .lf-tb-btn,
html.lf-touch .section-tb-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
}

html.lf-touch .form-control,
html.lf-touch .form-select,
html.lf-touch input:not([type="checkbox"]):not([type="radio"]),
html.lf-touch textarea,
html.lf-touch select {
  font-size: 16px !important;
}

/* Form / card: the body scrolls; record navigation is horizontal (M7).
   The view class is on the table, inside the wrapper (issue #329). */
html.lf-compact .section-table-wrapper:has(> .section-grid-table.section-view-form),
html.lf-compact .section-view-card .section-table-wrapper {
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

html.lf-compact .section-form-view-value {
  white-space: normal;
  text-overflow: unset;
  overflow: visible;
}

html.lf-compact .section-form-view-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 576px) and (max-width: 767.98px) {
  html.lf-compact .section-form-view-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Bottom action bar placeholder host (M5) — filled by fullEditToolbar when compact. */
.lf-compact-action-bar {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 1040;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem calc(0.4rem + var(--lf-safe-bottom, 0px));
  background: var(--bs-body-bg, #fff);
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

html.lf-compact .lf-compact-action-bar.is-active {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--lf-footer-height, 0px));
  align-items: center;
  justify-content: space-around;
}

html.lf-compact .lf-compact-action-bar .btn {
  flex: 1 1 0;
  min-height: 2.75rem;
}

/* Room for the fixed action bar above the status bar (M5). */
html.lf-compact.lf-full-edit body.lf-shell-grid {
  padding-bottom: 0;
}
html.lf-compact.lf-full-edit .lf-shell-body,
html.lf-compact.lf-full-edit main {
  padding-bottom: 3.25rem;
}

/* Top FullEdit strip is replaced by the action bar under md (M5 / M11). */
html.lf-compact.lf-full-edit #lfFullEditToolbar:not(.lf-fe-strip-for-overflow) {
  position: fixed !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  pointer-events: none;
  opacity: 0;
}
html.lf-compact.lf-full-edit #lfFullEditToolbar.lf-fe-strip-for-overflow {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: calc(var(--lf-footer-height, 0px) + 3.25rem) !important;
  top: auto !important;
  width: auto !important;
  height: auto !important;
  max-height: 50vh;
  overflow: visible !important;
  opacity: 1;
  pointer-events: auto;
  z-index: 1086;
  background: var(--bs-body-bg, #fff);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}
html.lf-compact.lf-full-edit #lfFullEditToolbar.lf-fe-strip-for-overflow .lf-tb-overflow-panel {
  position: static;
  max-height: 40vh;
  box-shadow: none;
  border: 0;
}

/* Status bar: gone under compact (issue #258, D3). Connection, language and options move into
   the More menu (core/compactStatus.ts); the contextual help has no hover to follow; field
   errors and the voice transcript float above the action bar as a toast. */
html.lf-compact .live-footer {
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
}
html.lf-compact .live-footer .footer-right,
html.lf-compact .live-footer .footer-scroll-btn,
html.lf-compact .live-footer .footer-scroll-viewport,
html.lf-compact .live-footer .footer-help {
  display: none !important;
}
html.lf-compact .live-footer-inner,
html.lf-compact .live-footer .footer-left {
  min-height: 0;
  padding: 0;
}
html.lf-compact .live-footer .footer-field-status:not([hidden]),
html.lf-compact .live-footer .footer-transcript:not([hidden]) {
  position: fixed;
  left: calc(var(--lf-safe-left, 0px) + 0.5rem);
  right: calc(var(--lf-safe-right, 0px) + 0.5rem);
  bottom: calc(var(--lf-compact-bars-height, 0px) + var(--lf-safe-bottom, 0px) + 0.5rem);
  z-index: 1060;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #343a40;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  white-space: normal;
}

/* The status items, relocated into the More menu. */
.lf-navbar-status { display: none; }
html.lf-compact .lf-navbar-end-tools .lf-navbar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  color: var(--bs-body-color, #212529);
}
html.lf-compact .lf-navbar-status .footer-http,
html.lf-compact .lf-navbar-status .footer-tools,
html.lf-compact .lf-navbar-status .lf-popup-menu-wrap > button {
  color: var(--bs-body-color, #212529);
}

/* Bars that retire while reading (issue #258, D4). */
html.lf-compact body.lf-shell-grid > header,
html.lf-compact .lf-compact-action-bar {
  transition: transform 0.18s ease-out, margin-bottom 0.18s ease-out;
}
/* <main> rises into the space the bar leaves (--lf-header-offset, set by compactBarsAutoHide.ts)
   instead of leaving a hole. */
html.lf-compact.lf-bars-hidden body.lf-shell-grid > header {
  transform: translateY(-100%);
  margin-bottom: calc(-1 * var(--lf-header-offset, 0px));
}
html.lf-compact.lf-bars-hidden .lf-compact-action-bar.is-active {
  transform: translateY(100%);
}
@media (prefers-reduced-motion: reduce) {
  html.lf-compact body.lf-shell-grid > header,
  html.lf-compact .lf-compact-action-bar { transition: none; }
}

/* Panels are full pages under compact (issue #258): geometry lives in core/shell.css. */

/* Density (issue #258, phase 4 / 3.5.1): more data per screen. Side padding 12px at most,
   grid cells 0.35rem tall. Touch targets of commands are untouched. */
html.lf-compact main .container-fluid,
html.lf-compact main .section-page-card {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
html.lf-compact main .section-grid-table > tbody > tr > td,
html.lf-compact main .section-grid-table > thead > tr > th {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.875rem;
}

/* Explorer: stack the side column (M9 / §5.3). */
html.lf-compact .composite-page[data-layout="Explorer"] {
  flex-direction: column !important;
}
html.lf-compact .composite-explorer-side {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  width: 100% !important;
  max-height: 40vh;
}
html.lf-compact .composite-page[data-layout="Explorer"] > .lf-page-splitter {
  display: none !important;
}

/* Segmented-looking view control on compact section toolbars (M5). */
html.lf-compact .section-view-menu-wrap > .btn,
html.lf-compact #lfFeView {
  min-width: 2.75rem;
}

/* Detail modal header on a phone (#234): title + window controls on row 1,
   command toolbar full-width on row 2. The three-column desktop layout leaves
   a few dozen pixels in the middle and the buttons wrap into an unusable grid
   beside the enlarge control. */
html.lf-compact .section-detail-modal .modal-header.section-modal-header {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  row-gap: 0.35rem;
}

html.lf-compact .section-detail-modal .section-modal-titlebar {
  grid-column: 1;
  grid-row: 1;
  max-width: 100%;
}

html.lf-compact .section-detail-modal .section-modal-window {
  grid-column: 2;
  grid-row: 1;
}

html.lf-compact .section-detail-modal .section-modal-toolbar,
html.lf-compact .section-detail-modal .section-detail-fulledit-toolbar {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: stretch;
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: none;
  width: 100%;
  padding-bottom: 0.1rem;
}

html.lf-compact .section-detail-modal .section-modal-toolbar .btn-group,
html.lf-compact .section-detail-modal .section-detail-fulledit-toolbar .btn-group {
  flex: 0 0 auto;
}

/* RIGHT — unsaved drafts (#336 F5). Shown only when the user has some; amber while they are held
   in memory, normal when the store keeps them across a restart, red when the store failed. */
.footer-drafts {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.35rem;
  padding: 0 0.45rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  color: #ffc107;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
}
.footer-drafts[hidden] { display: none; }
.footer-drafts[data-state="durable"] { color: #8bd0a0; }
.footer-drafts[data-state="failing"] { color: #ff6b6b; }
.footer-drafts:hover,
.footer-drafts:focus-visible {
  border-color: #6c757d;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
.lf-drafts-badge { font-size: 0.68rem; }
/* A record whose draft was started on a version that has since changed (#336 F6): a dashed
   outline in the modified colour, drawn inside the row so a table keeps its geometry. */
.section-row.section-row-stale,
.section-kanban-card.section-row-stale,
.section-card.section-row-stale {
  outline: 2px dashed var(--lf-theme-recordstate-modified, #dc3545);
  outline-offset: -2px;
}
.lf-drafts-table th { white-space: nowrap; font-weight: 600; }
.lf-drafts-dialog { min-width: min(46rem, 90vw); }
