/* =============================================================
   Shared utilities — scroll regions, truncation, visibility.

   The scrollbar skin here is the one the application already used
   on its scroll panels (8px, gray-400 pill thumb, transparent
   track), lifted out of the three pages that each declared their
   own copy. It is applied to scroll regions, not to every element,
   so native page and sidebar scrolling is untouched.
   ============================================================= */

/* ---------- Scroll regions ---------- */
.fg-scroll,
.fg-modal-scroll,
.fg-table-scroll,
.modal-body,
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.fg-scroll::-webkit-scrollbar,
.fg-modal-scroll::-webkit-scrollbar,
.fg-table-scroll::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

.fg-scroll::-webkit-scrollbar-track,
.fg-modal-scroll::-webkit-scrollbar-track,
.fg-table-scroll::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.fg-scroll::-webkit-scrollbar-thumb,
.fg-modal-scroll::-webkit-scrollbar-thumb,
.fg-table-scroll::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-pill);
}

.fg-scroll::-webkit-scrollbar-thumb:hover,
.fg-modal-scroll::-webkit-scrollbar-thumb:hover,
.fg-table-scroll::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Reserve the gutter so content does not reflow when a scrollbar
   appears — the layout shift this prevents was patched per page. */
.fg-scroll,
.fg-modal-scroll {
    scrollbar-gutter: stable;
}

/* ---------- Overflow guards ----------
   Horizontal scrolling belongs to the component that needs it, not
   to the page. */
.fg-no-x-overflow {
    overflow-x: hidden;
}

.fg-min-w-0 {
    min-width: 0;
}

/* ---------- Text ---------- */
.fg-truncate-1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fg-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fg-text-muted {
    color: var(--text-muted);
}

/* ---------- Accessibility ---------- */
.fg-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Skip link ----------
   Keyboard and screen-reader users land on the shell's sidebar, which is
   dozens of links before the page content. This gives them one Tab to jump
   past it. Off-screen until focused, so it costs nothing visually. */
.app-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: var(--space-3) var(--space-4);
    background: var(--surface, #fff);
    color: var(--theme-primary-text, var(--color-primary));
    font-weight: var(--fw-semibold);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) 0;
    text-decoration: none;
}

.app-skip-link:focus,
.app-skip-link:focus-visible {
    left: 0;
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
