/* Compact desktop workspace: keep storage locations visible in one viewport. */
@media (min-width: 521px) {
    html.inventory-document:has(.locations-page),
    body.role-warehouse_worker:has(.locations-page) {
        overflow: hidden;
    }

    body.role-warehouse_worker:has(.locations-page) .site-shell {
        min-height: 100vh;
    }

    .locations-page {
        box-sizing: border-box;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 12px;
        width: min(calc(100% - 32px), 1180px);
        height: calc(100vh - 68px);
        max-width: none;
        padding: 14px 0 18px;
    }

    .locations-header {
        min-height: 0;
        align-items: center;
        flex-direction: row;
        padding: 14px 20px;
        gap: 18px;
        border-radius: 16px;
    }

    .locations-header > div {
        min-width: 0;
    }

    .locations-header .eyebrow {
        margin: 0;
        font-size: .7rem;
        line-height: 1.1;
    }

    .locations-header h1 {
        margin-top: 3px;
        font-size: clamp(1.7rem, 3vw, 2.35rem);
        line-height: 1.06;
    }

    .locations-header p:not(.eyebrow) {
        margin-top: 5px;
        font-size: .9rem;
        line-height: 1.3;
    }

    .locations-header .button-secondary {
        width: auto;
        min-height: 40px;
        height: 40px;
        padding: 8px 15px;
        font-size: .78rem;
        white-space: nowrap;
    }

    .locations-layout {
        min-height: 0;
        height: auto;
        grid-template-columns: minmax(280px, .72fr) minmax(0, 1.4fr);
        align-items: stretch;
        gap: 12px;
    }

    .location-form-card,
    .locations-list-card {
        min-height: 0;
        box-sizing: border-box;
    }

    .location-form-card {
        display: flex;
        flex-direction: column;
        padding: 16px;
    }

    .location-form-card h2,
    .locations-list-card h2 {
        font-size: 1.1rem;
    }

    .location-form-card h2 {
        margin-bottom: 10px;
    }

    .location-form-card .entity-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        gap: 8px 10px;
    }

    .location-form-card .form-row {
        min-width: 0;
        gap: 4px;
    }

    .location-form-card .form-row label {
        font-size: .72rem;
        line-height: 1.2;
    }

    .location-form-card .form-row input:not([type='checkbox']) {
        min-height: 38px;
        padding: 8px 10px;
        font-size: .82rem;
    }

    .location-form-card .form-row:has(input[type='checkbox']) {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .location-form-card .form-row:has(input[type='checkbox']) label {
        order: 2;
    }

    .location-form-card .form-row:has(input[type='checkbox']) input {
        order: 1;
    }

    .location-form-actions {
        grid-column: 1 / -1;
        margin-top: 2px;
    }

    .location-form-actions button,
    .location-form-actions .button-link {
        min-height: 38px;
        padding: 8px 13px;
        font-size: .78rem;
    }

    .locations-list-card {
        display: flex;
        flex-direction: column;
    }

    .locations-list-card > header {
        padding: 16px 18px;
    }

    .locations-list-card header p {
        margin-top: 3px;
        font-size: .78rem;
    }

    .locations-list {
        min-height: 0;
        overflow: auto;
    }

    .location-row {
        gap: 10px;
        padding: 12px 16px;
    }

    .location-code {
        width: 38px;
        height: 38px;
        border-radius: 11px;
    }

    .location-info {
        gap: 2px;
    }

    .location-info span {
        font-size: .8rem;
    }

    .location-info small {
        font-size: .7rem;
    }

    .location-stock {
        display: grid;
        gap: 5px;
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid #e3e8ef;
    }

    .location-stock__heading {
        display: grid;
        gap: 1px;
    }

    .location-stock__heading strong {
        color: #40526e;
        font-size: .7rem;
    }

    .location-stock__heading span,
    .location-stock__empty,
    .location-stock__more {
        color: #718097;
        font-size: .65rem;
        line-height: 1.25;
    }

    .location-stock__list {
        display: grid;
        gap: 3px;
    }

    .location-stock__item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 4px 6px;
        border-radius: 8px;
        background: #f5f7fa;
    }

    .location-stock__product,
    .location-stock__quantity {
        display: grid;
        min-width: 0;
    }

    .location-stock__product strong {
        overflow: hidden;
        color: #263852;
        font-size: .68rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .location-stock__product:hover strong {
        color: #465a78;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .location-stock__product small {
        overflow: hidden;
        color: #718097;
        font-size: .58rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .location-stock__quantity {
        flex: 0 0 auto;
        justify-items: end;
    }

    .location-stock__quantity small {
        color: #718097;
        font-size: .56rem;
    }

    .location-stock__quantity strong {
        color: #36705a;
        font-size: .72rem;
        font-variant-numeric: tabular-nums;
    }

    .location-stock-empty-inline {
        display: block;
        margin-top: 4px;
        color: #718097;
        font-size: .65rem;
        line-height: 1.25;
    }

    .location-actions {
        gap: 6px;
    }

    .location-actions > a,
    .location-toggle {
        min-height: 30px;
        padding: 5px 8px;
        font-size: .7rem;
    }

    .location-status {
        padding: 4px 7px;
        font-size: .66rem;
    }
}

@media (min-width: 521px) and (max-width: 760px) {
    .locations-page {
        height: calc(100vh - 144px);
        gap: 10px;
        padding-block: 10px 12px;
    }

    .locations-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .locations-header h1 {
        font-size: 1.45rem;
        line-height: 1;
    }

    .locations-header p:not(.eyebrow) {
        max-width: 260px;
        font-size: .78rem;
        line-height: 1.2;
    }

    .locations-header .button-secondary {
        min-height: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: .7rem;
    }

    .location-form-card {
        padding: 12px;
    }

    .location-form-card h2,
    .locations-list-card h2 {
        font-size: 1rem;
    }

    .location-form-card h2 {
        margin-bottom: 7px;
    }

    .location-form-card .entity-form {
        gap: 6px 8px;
    }

    .location-form-card .form-row input:not([type='checkbox']) {
        min-height: 34px;
        padding: 6px 8px;
    }

    .location-form-actions button,
    .location-form-actions .button-link {
        width: 100%;
        min-height: 36px;
        padding: 7px 10px;
    }

    .locations-list-card > header {
        padding: 12px 14px;
    }

    .location-row {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 10px 12px;
    }

    .location-actions {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px;
    }

    .location-actions > a,
    .location-actions > form,
    .location-actions > form button {
        width: 100%;
        min-width: 0;
    }

    .location-actions > a,
    .location-actions > form button {
        padding-inline: 3px;
        font-size: .6rem;
        text-align: center;
        white-space: nowrap;
    }

    .location-stock {
        max-height: 132px;
        overflow: auto;
    }

    .location-stock__heading span {
        display: none;
    }

    .location-stock {
        margin-top: 3px;
        padding-top: 3px;
    }
}
