/* UI14 system-wide accessibility and interaction polish. */

.tm-skip-link {
  position: fixed;
  z-index: 10000;
  top: calc(var(--tm-accent-height, 4px) + 8px);
  left: 12px;
  max-width: calc(100vw - 24px);
  padding: 9px 13px;
  color: var(--tm-brand-ink);
  font-size: .875rem;
  font-weight: 750;
  text-decoration: none;
  border: 1px solid #caa80e;
  border-radius: var(--tm-radius-md);
  background: var(--tm-brand);
  box-shadow: var(--tm-shadow-md);
  transform: translateY(-180%);
  transition: transform .12s ease;
}

.tm-skip-link:focus {
  color: var(--tm-brand-ink);
  transform: translateY(0);
  outline: none;
  box-shadow: var(--tm-focus-ring), var(--tm-shadow-md);
}

.tm-live-region {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Keep keyboard focus visually strong on the few Bootstrap controls whose
   default focus ring can otherwise be lost against muted operating surfaces. */
.btn-close:focus-visible,
.app-mobile-header__toggle:focus-visible,
.app-user__logout:focus-visible,
.app-sidebar__link:focus-visible,
.app-workspace-option:focus-visible {
  outline: none;
  box-shadow: var(--tm-focus-ring);
}

/* Make horizontal data regions usable without moving the whole page. */
.table-responsive,
.tm-table-scroll {
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.table-responsive:focus-visible,
.tm-table-scroll:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(254, 204, 19, .72);
}

/* Anchored/deep-linked content should not land flush against the viewport. */
[id] {
  scroll-margin-top: calc(var(--navbar-h, 0px) + 18px);
}

/* Native invalid controls remain obvious even on pages with specialized CSS. */
.form-control:invalid:focus,
.form-select:invalid:focus,
textarea:invalid:focus {
  border-color: var(--tm-danger);
  box-shadow: 0 0 0 .2rem rgba(180, 35, 24, .14);
}

/* Minimum target size for icon-only controls used throughout operational
   tables and modal headers. */
.btn-close,
[data-app-sidebar-toggle],
.app-user__logout {
  min-width: 32px;
  min-height: 32px;
}

@media (max-width: 767.98px) {
  .table-responsive,
  .tm-table-scroll {
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .app-sidebar__link.is-active,
  .app-workspace-option.is-current,
  .btn-primary {
    border: 2px solid CanvasText;
  }

  .app-sidebar__context-dot,
  .app-workspace-option__indicator {
    forced-color-adjust: none;
    background: CanvasText;
  }
}
