.warehouse-page-head {
    align-items: center;
}

.warehouse-app {
    display: grid;
    gap: 12px;
    min-width: 0;
    color: #1d2939;
}

.warehouse-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 8px;
}

.warehouse-selector button {
    min-width: 0;
    min-height: 48px;
    display: grid;
    gap: 2px;
    align-content: center;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 7px 10px;
    background: #fff;
    color: #526174;
    text-align: left;
    cursor: pointer;
}

.warehouse-selector button strong {
    overflow: hidden;
    color: #223047;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-selector button span {
    font-size: 11px;
}

.warehouse-selector button.is-active {
    border-color: #2b755d;
    box-shadow: inset 4px 0 #2b755d;
    background: #eff8f4;
}

.warehouse-selector button:disabled {
    border-style: dashed;
    background: #f5f7f9;
    color: #8390a0;
    cursor: default;
}

.warehouse-search-band {
    position: relative;
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(280px, 0.8fr) minmax(340px, 1.2fr);
    gap: 12px;
    align-items: stretch;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

.warehouse-search-field {
    position: relative;
    display: grid;
    gap: 5px;
    align-content: start;
}

.warehouse-search-field > span,
.warehouse-dialog label > span {
    color: #526174;
    font-size: 12px;
    font-weight: 750;
}

.warehouse-search-field input,
.warehouse-dialog input,
.warehouse-dialog select,
.warehouse-dialog textarea {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    border: 1px solid #bcc8d6;
    border-radius: 5px;
    padding: 7px 10px;
    background: #fff;
    color: #172235;
    font: inherit;
}

.warehouse-search-field input:focus,
.warehouse-dialog input:focus,
.warehouse-dialog select:focus,
.warehouse-dialog textarea:focus {
    border-color: #2d765e;
    outline: 3px solid rgba(45, 118, 94, 0.14);
}

.warehouse-search-results {
    position: absolute;
    top: calc(100% + 3px);
    right: 0;
    left: 0;
    max-height: 330px;
    overflow: auto;
    scrollbar-width: thin;
    border: 1px solid #aebbc9;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(24, 38, 56, 0.18);
}

.warehouse-search-result {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid #edf0f4;
    padding: 7px 10px;
    background: #fff;
    color: #1f2d42;
    text-align: left;
    cursor: pointer;
}

.warehouse-search-result:hover,
.warehouse-search-result:focus-visible {
    background: #edf7f3;
    outline: 0;
}

.warehouse-search-result small {
    flex: 0 1 58%;
    color: #758296;
    font-size: 10px;
    line-height: 1.35;
    text-align: right;
}

.warehouse-search-empty {
    margin: 0;
    padding: 12px;
    color: #687588;
    font-size: 12px;
}

.warehouse-selection {
    min-width: 0;
    display: grid;
    gap: 7px;
    align-content: center;
    border-left: 1px solid #e0e5eb;
    padding-left: 12px;
}

.warehouse-selection > strong {
    color: #1c2b40;
    font-size: 15px;
}

.warehouse-selection-head {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.warehouse-selection-head strong {
    overflow: hidden;
    color: #1c2b40;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-selection-head .warehouse-rename-button {
    flex: 0 0 auto;
}

.warehouse-location-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.warehouse-location-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    border: 1px solid #9dc9b8;
    border-radius: 999px;
    padding: 4px 9px;
    background: #ecf8f2;
    color: #185742;
    font-size: 12px;
    font-weight: 700;
}

.warehouse-location-chip.is-mixed {
    border-color: #dfbb69;
    background: #fff7df;
    color: #76540d;
}

.warehouse-location-chip.is-unassigned {
    border-color: #e1a4a8;
    background: #fff0f1;
    color: #812f37;
}

.warehouse-statistics {
    display: grid;
    grid-template-columns: repeat(7, minmax(96px, 1fr));
    gap: 7px;
}

.warehouse-statistics article {
    min-width: 0;
    min-height: 62px;
    display: grid;
    gap: 3px;
    align-content: center;
    border: 1px solid #d7dee7;
    border-radius: 5px;
    padding: 8px 10px;
    background: #fff;
    text-align: center;
}

.warehouse-statistics span {
    color: #667386;
    font-size: 11px;
}

.warehouse-statistics strong {
    overflow: hidden;
    color: #1f2f46;
    font-size: 18px;
    line-height: 1.1;
    text-overflow: ellipsis;
}

.warehouse-workspace {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(620px, 1fr) minmax(280px, 360px);
    gap: 12px;
    align-items: start;
}

.warehouse-map-panel,
.warehouse-detail {
    min-width: 0;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    background: #fff;
}

.warehouse-map-panel {
    overflow-x: auto;
    scrollbar-width: thin;
}

.warehouse-map-panel > header,
.warehouse-detail > header {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #dfe5ec;
    padding: 8px 12px;
    background: #f7f9fb;
}

.warehouse-map-panel h2,
.warehouse-detail h2,
.warehouse-dialog h2 {
    margin: 0;
    color: #223047;
    font-size: 15px;
}

.warehouse-map-panel > header span {
    color: #6d7a8b;
    font-size: 11px;
}

.warehouse-map {
    position: relative;
    width: 100%;
    min-width: 860px;
    aspect-ratio: 14 / 10;
    overflow: hidden;
    background:
        linear-gradient(#eef2f6 1px, transparent 1px),
        linear-gradient(90deg, #eef2f6 1px, transparent 1px),
        #fbfcfd;
    background-size: 24px 24px;
}

.warehouse-zone {
    position: absolute;
    display: grid;
    place-items: center;
    border: 2px solid #8d9aaa;
    background: rgba(224, 230, 236, 0.9);
    color: #526174;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

/* Coordinate della planimetria principale. Sono nel CSS per rispettare la CSP
   del sito, che rifiuta correttamente gli attributi style generati dal client. */
.warehouse-zone[data-warehouse-zone="ufficio"] { left: 69%; top: 43%; width: 30%; height: 55%; }
.warehouse-zone[data-warehouse-zone="bagno"] { left: 61%; top: 72%; width: 12%; height: 26%; }
.warehouse-zone[data-warehouse-zone="ingresso"] { left: 91%; top: 96%; width: 7%; height: 3%; }

.warehouse-zone.is-bathroom {
    display: block;
    background: repeating-linear-gradient(135deg, #eef1f4, #eef1f4 8px, #dfe5eb 8px, #dfe5eb 10px);
}

.warehouse-zone.is-bathroom .warehouse-zone-label {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 33.333%;
    display: grid;
    place-items: center;
    border-top: 2px solid #8d9aaa;
    background: rgba(238, 242, 246, 0.96);
}

.warehouse-zone.is-entrance {
    border-style: dashed;
    background: #eaf5f1;
    color: #2b6e58;
}

.warehouse-row {
    position: absolute;
    z-index: 2;
    display: flex;
    gap: 2px;
    border: 1px solid #78889b;
    padding: 2px;
    background: #dde4eb;
    box-shadow: 0 2px 6px rgba(37, 51, 71, 0.12);
}

.warehouse-row.is-right-to-left {
    flex-direction: row-reverse;
}

.warehouse-row.is-vertical {
    flex-direction: column;
}

.warehouse-row[data-warehouse-row="A"] { left: 70%; top: 36%; width: 28%; height: 7%; }
.warehouse-row[data-warehouse-row="B"] { left: 96%; top: 11%; width: 3%; height: 25%; }
.warehouse-row[data-warehouse-row="C"] { left: 5%; top: 3%; width: 90%; height: 7%; }
.warehouse-row[data-warehouse-row="D"] { left: 16%; top: 14%; width: 75%; height: 4.5%; }
.warehouse-row[data-warehouse-row="E"] { left: 16%; top: 18.5%; width: 75%; height: 4.5%; }
.warehouse-row[data-warehouse-row="F"] { left: 16%; top: 28%; width: 52%; height: 4.5%; }
.warehouse-row[data-warehouse-row="G"] { left: 16%; top: 32.5%; width: 52%; height: 4.5%; }
.warehouse-row[data-warehouse-row="H"] { left: 16%; top: 43%; width: 48%; height: 4.5%; }
.warehouse-row[data-warehouse-row="I"] { left: 16%; top: 47.5%; width: 48%; height: 4.5%; }
.warehouse-row[data-warehouse-row="L"] { left: 16%; top: 57.5%; width: 48%; height: 4.5%; }
.warehouse-row[data-warehouse-row="M"] { left: 16%; top: 62%; width: 48%; height: 4.5%; }
.warehouse-row[data-warehouse-row="N"] { left: 5%; top: 72.5%; width: 50%; height: 4.5%; }
.warehouse-row[data-warehouse-row="O"] { left: 5%; top: 77%; width: 50%; height: 4.5%; }
.warehouse-row[data-warehouse-row="P"] { left: 5%; top: 90%; width: 47%; height: 7%; }
.warehouse-row[data-warehouse-row="Q"] { left: 57%; top: 90%; width: 3.5%; height: 8%; }
.warehouse-row[data-warehouse-row="R"] { left: 57%; top: 81.5%; width: 3.5%; height: 7.5%; }
.warehouse-row[data-warehouse-row="S"] { left: 57%; top: 72.5%; width: 3.5%; height: 8%; }
.warehouse-row[data-warehouse-row="T"] { left: 65%; top: 57%; width: 3.5%; height: 10%; }
.warehouse-row[data-warehouse-row="U"] { left: 65%; top: 44%; width: 3.5%; height: 11%; }
.warehouse-row[data-warehouse-row="V"] { left: 5%; top: 13%; width: 3.5%; height: 56%; }

/* Due quadretti della griglia verso sinistra, come nella pianta reale. */
.warehouse-row[data-warehouse-row="D"],
.warehouse-row[data-warehouse-row="E"],
.warehouse-row[data-warehouse-row="F"],
.warehouse-row[data-warehouse-row="G"],
.warehouse-row[data-warehouse-row="H"],
.warehouse-row[data-warehouse-row="I"],
.warehouse-row[data-warehouse-row="L"],
.warehouse-row[data-warehouse-row="M"] {
    transform: translateX(-48px);
}

.warehouse-row.is-double {
    border-color: #526a83;
    background: #d6e0e9;
}

.warehouse-row.is-uncensused {
    border-style: dashed;
    border-color: #9b7a42;
    background: #f5ead6;
}

.warehouse-shelf {
    min-width: 0;
    min-height: 0;
    flex: 1 1 0;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    overflow: hidden;
    border: 1px solid #aeb9c5;
    border-radius: 2px;
    padding: 0;
    background: #f8fafc;
    color: #27384e;
    font-size: clamp(8px, 0.8vw, 11px);
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.warehouse-shelf-code {
    line-height: 1;
}

.warehouse-shelf-floor {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(7px, 0.62vw, 9px);
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-shelf.has-note .warehouse-shelf-code {
    color: #c98a00;
    text-shadow: 0 0 1px rgba(255, 214, 90, 0.25);
}

.warehouse-row.is-vertical .warehouse-shelf {
    width: 100%;
}

.warehouse-shelf:hover,
.warehouse-shelf:focus-visible,
.warehouse-shelf.is-active {
    border-color: #2e6fa4;
    background: #ddecf8;
    outline: 2px solid rgba(46, 111, 164, 0.24);
    outline-offset: -1px;
}

.warehouse-shelf.is-match {
    z-index: 3;
    border-color: #a86e00;
    background: #f5cf54;
    color: #493407;
    box-shadow: 0 0 0 3px rgba(245, 207, 84, 0.34);
}

.warehouse-shelf.is-possible {
    z-index: 3;
    border-color: #b7780b;
    background: #f2c35e;
    color: #4c350a;
    box-shadow: 0 0 0 3px rgba(242, 195, 94, 0.3);
}

.warehouse-row-placeholder {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #6e5528;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.warehouse-detail {
    position: sticky;
    top: 54px;
    max-height: min(72vh, 760px);
    overflow: hidden;
}

.warehouse-detail [data-warehouse-detail-body] {
    max-height: calc(min(72vh, 760px) - 43px);
    overflow: auto;
    scrollbar-width: thin;
    padding: 10px;
}

.warehouse-detail-empty {
    margin: 0;
    color: #6c7889;
    font-size: 13px;
    line-height: 1.5;
}

.warehouse-shelf-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.warehouse-shelf-summary div {
    min-width: 0;
    border: 1px solid #dce2e9;
    padding: 7px;
    background: #f8fafb;
    text-align: center;
}

.warehouse-shelf-summary span,
.warehouse-shelf-summary strong {
    display: block;
}

.warehouse-shelf-summary span {
    color: #748093;
    font-size: 10px;
}

.warehouse-shelf-summary strong {
    margin-top: 2px;
    color: #24344b;
    font-size: 14px;
}

.warehouse-shelf-floor-controls {
    display: flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

.warehouse-shelf-floor-controls strong {
    display: inline-block;
    min-width: 18px;
    margin-top: 0;
}

.warehouse-shelf-floor-controls .warehouse-floor-icon {
    width: 22px;
    height: 22px;
}

.warehouse-shelf-note {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
    border: 1px solid #d8dee7;
    border-radius: 5px;
    padding: 9px;
    background: #f8fafc;
}

.warehouse-shelf-note textarea {
    width: 100%;
    min-height: 68px;
    resize: vertical;
    border: 1px solid #b9c5d2;
    border-radius: 4px;
    padding: 7px 8px;
    background: #fff;
    color: #1c293b;
    font: inherit;
    font-weight: 400;
}

.warehouse-floor {
    border-top: 1px solid #dfe5eb;
    padding: 10px 0;
}

.warehouse-floor:first-of-type {
    border-top: 0;
}

.warehouse-floor > header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    color: #34465e;
    font-size: 13px;
}

.warehouse-floor > header strong {
    color: #21334b;
    font-size: 15px;
    font-weight: 800;
}

.warehouse-floor-heading,
.warehouse-floor-tools {
    display: flex;
    align-items: center;
    gap: 5px;
}

.warehouse-floor-tools > span {
    min-width: 22px;
    color: #6f7c8e;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.warehouse-floor-icon {
    position: relative;
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid #cbd4df;
    border-radius: 4px;
    padding: 0;
    background: #fff;
    color: #40566f;
    cursor: pointer;
}

.warehouse-floor-icon svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2.2;
}

.warehouse-floor-icon.is-add:hover,
.warehouse-floor-icon.is-add:focus-visible {
    border-color: #2f7a5e;
    background: #ecf8f3;
    color: #176547;
}

.warehouse-floor-icon.is-remove:hover,
.warehouse-floor-icon.is-remove:focus-visible {
    border-color: #af4a54;
    background: #fff0f1;
    color: #92333c;
}

.warehouse-floor-icon:disabled {
    border-color: #dde3ea;
    background: #f4f6f8;
    color: #a5afba;
    cursor: not-allowed;
}

.warehouse-floor-warning {
    min-height: 18px;
    margin: 0;
    color: #526174;
    font-size: 12px;
    line-height: 1.4;
}

.warehouse-floor-warning.is-error {
    color: #a13942;
    font-weight: 700;
}

.warehouse-add-publisher {
    min-height: 24px;
    border: 0;
    padding: 2px 4px;
    background: transparent;
    color: #24644f;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
}

.warehouse-add-publisher:hover,
.warehouse-add-publisher:focus-visible {
    color: #123f31;
    text-decoration: underline;
}

.warehouse-empty-floor {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: flex-start;
}

.warehouse-empty-floor .warehouse-action-button {
    width: 34px;
}

.warehouse-no-floors {
    display: grid;
    justify-items: start;
    gap: 9px;
    border-top: 1px solid #dfe5eb;
    padding: 12px 0 4px;
}

.warehouse-no-floors p {
    margin: 0;
    color: #6c7889;
    font-size: 13px;
}

.warehouse-publisher-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, 32px);
    gap: 5px;
    align-items: center;
    margin-top: 4px;
}

.warehouse-publisher-name,
.warehouse-rename-button,
.warehouse-move-button {
    min-height: 30px;
    border: 1px solid #d5dde6;
    border-radius: 4px;
    background: #fff;
    color: #26364c;
    cursor: pointer;
}

.warehouse-rename-button {
    padding: 0 5px;
    color: #53657b;
    font-size: 10px;
    font-weight: 700;
}

.warehouse-rename-button:hover {
    border-color: #8b6c16;
    background: #fff8df;
    color: #6e5208;
}

.warehouse-publisher-name {
    overflow: hidden;
    padding: 5px 8px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.warehouse-publisher-name:hover {
    border-color: #2d765e;
    background: #edf8f3;
}

.warehouse-move-button {
    display: grid;
    place-items: center;
    padding: 0;
    color: #53657b;
    font-size: 16px;
}

.warehouse-move-button:hover {
    border-color: #2e6fa4;
    background: #edf5fb;
    color: #235a86;
}

.warehouse-action-button {
    position: relative;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid #d5dde6;
    border-radius: 4px;
    background: #fff;
    color: #53657b;
    cursor: pointer;
}

.warehouse-action-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.warehouse-action-button:hover,
.warehouse-action-button:focus-visible {
    border-color: #52718f;
    background: #edf5fb;
    color: #214f78;
}

.warehouse-action-button.is-delete:hover,
.warehouse-action-button.is-delete:focus-visible {
    border-color: #b5545b;
    background: #fff0f1;
    color: #9b3039;
}

.warehouse-action-button::after {
    position: absolute;
    z-index: 30;
    right: 0;
    bottom: calc(100% + 7px);
    visibility: hidden;
    border: 1px solid #35465a;
    border-radius: 4px;
    padding: 5px 7px;
    background: #1f2c3d;
    box-shadow: 0 4px 12px rgba(20, 31, 46, 0.2);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.warehouse-action-button:hover::after,
.warehouse-action-button:focus-visible::after {
    animation: warehouse-action-tooltip 120ms ease 2s forwards;
}

.warehouse-floor-icon::after {
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: calc(100% + 7px);
    visibility: hidden;
    transform: translateX(-50%);
    border: 1px solid #35465a;
    border-radius: 4px;
    padding: 5px 7px;
    background: #1f2c3d;
    box-shadow: 0 4px 12px rgba(20, 31, 46, 0.2);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.warehouse-floor-icon:not(:disabled):hover::after,
.warehouse-floor-icon:not(:disabled):focus-visible::after {
    animation: warehouse-action-tooltip 120ms ease 2s forwards;
}

@keyframes warehouse-action-tooltip {
    to {
        visibility: visible;
        opacity: 1;
    }
}

.warehouse-status {
    min-height: 20px;
    color: #526174;
    font-size: 12px;
}

.warehouse-status.is-error {
    color: #a13942;
}

.warehouse-status.is-success {
    color: #18714d;
}

.warehouse-dialog {
    width: min(620px, calc(100vw - 32px));
    max-width: 620px;
    border: 1px solid #aeb9c6;
    border-radius: 7px;
    padding: 0;
    background: #fff;
    color: #1d2939;
    box-shadow: 0 24px 64px rgba(23, 35, 52, 0.28);
}

.warehouse-dialog::backdrop {
    background: rgba(20, 31, 46, 0.56);
}

.warehouse-dialog form {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.warehouse-dialog header {
    display: grid;
    gap: 4px;
    border-bottom: 1px solid #e1e6ec;
    padding-bottom: 10px;
}

.warehouse-dialog header p {
    margin: 0;
    color: #657286;
    font-size: 12px;
}

.warehouse-dialog label {
    display: grid;
    gap: 5px;
}

.warehouse-dialog textarea {
    min-height: 76px;
    resize: vertical;
}

.warehouse-location-fields {
    display: grid;
    grid-template-columns: 0.7fr 1fr 1fr;
    gap: 8px;
}

.warehouse-dialog .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #e1e6ec;
    padding-top: 12px;
}

@media (max-width: 1180px) {
    .warehouse-statistics {
        grid-template-columns: repeat(4, minmax(100px, 1fr));
    }

    .warehouse-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .warehouse-detail {
        position: static;
        max-height: none;
    }

    .warehouse-detail [data-warehouse-detail-body] {
        max-height: 420px;
    }
}

@media (max-width: 760px) {
    .warehouse-selector {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .warehouse-search-band {
        grid-template-columns: minmax(0, 1fr);
    }

    .warehouse-selection {
        border-top: 1px solid #e0e5eb;
        border-left: 0;
        padding-top: 10px;
        padding-left: 0;
    }

    .warehouse-statistics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .warehouse-location-fields {
        grid-template-columns: 1fr;
    }
}
