:root {
    --mpbos-sidebar-width: 240px;
    --mpbos-context-help-size: 1.5rem;
}

@media (pointer: coarse) {
    :root {
        --mpbos-context-help-size: 2rem;
    }
}

.sort-heading-with-help,
.sort-heading-link {
    display: inline-grid;
    grid-template-columns: auto var(--mpbos-context-help-size) 0.625em;
    column-gap: 0.125rem;
    align-items: center;
}

.sort-heading-link {
    grid-area: 1 / 1 / 2 / -1;
    pointer-events: none;
}

.sort-heading-link > span {
    pointer-events: auto;
}

.sort-heading-link:focus-visible {
    outline: none;
}

.sort-heading-link:focus-visible > span {
    outline: 2px solid var(--bs-primary);
    outline-offset: 0;
}

.sort-heading-indicator {
    grid-column: 3;
    text-align: center;
}

.sort-heading-with-help > .context-help-button {
    grid-area: 1 / 2;
    z-index: 1;
}

.context-help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mpbos-context-help-size);
    height: var(--mpbos-context-help-size);
    padding: 0;
    border: 0;
    border-radius: var(--bs-border-radius);
    background: transparent;
    color: var(--bs-secondary-color);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    vertical-align: middle;
}

.context-help-button:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.context-help-button:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.context-help-icon {
    display: block;
    flex: none;
    width: 1rem;
    height: 1rem;
}

.context-help-content {
    display: none;
    position: fixed;
    inset: auto;
    margin: 0;
    z-index: 1080;
    width: max-content;
    max-width: min(20rem, calc(100vw - 1rem));
    max-height: calc(100dvh - 1rem);
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow-sm);
    color: var(--bs-body-color);
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.5;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
}

.context-help-content:popover-open {
    display: block;
}

.context-help-fallback:not([hidden]) {
    display: block;
}

html,
body {
    min-height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bs-tertiary-bg);
}

.app-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
}

.app-header {
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.app-layout {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
}

.app-sidebar {
    --bs-offcanvas-width: var(--mpbos-sidebar-width);
    width: var(--mpbos-sidebar-width);
    flex: 0 0 var(--mpbos-sidebar-width);
    background-color: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
}

.app-content {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}

.object-heading {
    min-width: 0;
    max-width: 100%;
}

.object-heading-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.breadcrumb-item {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.app-footer {
    background-color: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.workspace-form-card {
    width: 100%;
    max-width: 640px;
}

.workspace-create-guidance {
    width: 100%;
    max-width: 880px;
}

.skip-link {
    position: fixed;
    top: 0;
    left: 1rem;
    z-index: 1100;
    padding: 0.75rem 1rem;
    color: var(--bs-white);
    background-color: var(--bs-dark);
    border-radius: 0 0 0.375rem 0.375rem;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.user-card {
    width: 100%;
    max-width: 520px;
}

.workspace-switcher {
    min-width: 0;
    max-width: min(240px, 35vw);
}

.workspace-switcher-toggle {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barcode-form-list {
    container-type: inline-size;
    padding-block: 0.25rem;
}

.barcode-row {
    --barcode-control-height: 2.375rem;
    position: relative;
    background: var(--bs-body-bg);
}

.barcode-row-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "controls value remove" ". primary ." "order order order";
    align-items: center;
    gap: 0 0.5rem;
}

.barcode-row-controls { grid-area: controls; display: flex; align-items: center; align-self: start; gap: 0.5rem; }
.barcode-row-value { grid-area: value; min-width: 0; width: calc(14ch + 3rem + 2px); max-width: 100%; }
.barcode-row-value > .form-control { height: var(--barcode-control-height); }
.barcode-row-primary { grid-area: primary; display: flex; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.barcode-row-remove { grid-area: remove; align-self: start; }
.barcode-row-order { grid-area: order; margin-top: 0.5rem; }
.barcode-row-number { min-width: 2ch; font-variant-numeric: tabular-nums; }
.barcode-row-controls .btn, .barcode-row-remove > .btn {
    min-width: 2rem;
    height: var(--barcode-control-height);
    padding-inline: 0.5rem;
}
[data-barcode-primary-help] { display: inline-flex; align-items: center; }
.barcode-row [data-barcode-action="drag"] { cursor: grab; }
.barcode-row [data-barcode-action="drag"]:active { cursor: grabbing; }
.barcode-row-deleted { background: var(--bs-tertiary-bg); }
.barcode-row-deleted .barcode-row-value { opacity: 0.55; }
.barcode-row-primary:not(:has([data-barcode-primary-badge]:not([hidden]))) { display: none; }
.barcode-row [hidden] { display: none !important; }

.barcode-drop-before::before, .barcode-drop-after::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bs-primary);
    border-radius: 2px;
    pointer-events: none;
}
.barcode-drop-before::before { top: -0.4rem; }
.barcode-drop-after::after { bottom: -0.4rem; }

@container (max-width: 22rem) {
    .barcode-row-grid { column-gap: 0.375rem; }
    .barcode-row-controls { gap: 0.25rem; }
    .barcode-row-number { min-width: 1.5ch; }
    .barcode-row-controls .btn, .barcode-row-remove > .btn { min-width: 1.75rem; }
}

.barcode-row-grid:has([data-barcode-delete-fallback]:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "value primary" "order order" "remove remove";
    row-gap: 0.5rem;
}
.barcode-row-grid:has([data-barcode-delete-fallback]:not([hidden])) .barcode-row-primary,
.barcode-row-grid:has([data-barcode-delete-fallback]:not([hidden])) .barcode-row-order {
    margin-top: 0;
}

.form-actions {
    margin-top: 1.5rem;
}

.form-actions__bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.form-actions--sticky {
    position: sticky;
    bottom: 0;
    z-index: 1010;
    padding-bottom: 0.5rem;
}

.form-actions--sticky .form-actions__bar {
    box-shadow: var(--bs-box-shadow);
}

.form-actions__status {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .form-actions__bar {
        flex-wrap: wrap;
    }

    .form-actions__status {
        flex-basis: 100%;
    }
}
