/* Inventar V17: einheitliche Raster und Nebenfenster. */
.inventory-v16-app {
    --inventory-window-width: clamp(315px, 22.8vw, 430px);
    --inventory-slot-gap: 4px;
}

.inventory-v16-window {
    flex: 0 0 var(--inventory-window-width);
    width: var(--inventory-window-width);
}

.inventory-v16-raster {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: var(--inventory-slot-gap);
}

.inventory-v16-raster > .inventory-v16-item,
.inventory-v16-raster > .inventory-v16-empty {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.inventory-v16-storage.storage-mobile .inventory-v16-raster {
    min-height: 0;
}

.inventory-v16-clothing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    align-content: start;
}

.inventory-v16-clothing-grid button {
    min-height: 0;
    aspect-ratio: 1 / 1;
}

.inventory-v16-clothing-grid span {
    min-height: 0;
}

.inventory-v16-equipment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    align-content: start;
}

.inventory-v16-equipment-grid button {
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1 / 1;
}

.inventory-v16-equipment-grid button.wide {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 0;
    aspect-ratio: 2 / 1;
}

.inventory-v16-equipment-grid button > span {
    min-height: 0;
}

.inventory-v16-equipment-grid button.wide > span {
    position: absolute;
    inset: 8px 26% 28px;
}

.inventory-v16-equipment-grid button.wide small {
    position: absolute;
    left: 8px;
    bottom: 8px;
}

.inventory-v16-equipment-grid button.wide strong {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 88px;
}

.inventory-v16-documents > section {
    overflow: hidden;
}

.inventory-v16-document-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 30px;
    padding: 6px 8px;
    border: 0;
    background: rgba(20, 18, 14, .82);
    color: #a98f68;
    font: 700 8px Georgia, serif;
    letter-spacing: .09em;
    text-align: left;
}

.inventory-v16-document-toggle:hover {
    background: rgba(61, 34, 22, .72);
    color: #d2b37f;
}

.inventory-v16-document-toggle span {
    display: flex;
    align-items: center;
}

.inventory-v16-document-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 57px;
    padding: 6px 8px;
    border: 0;
    border-top: 1px solid rgba(68, 58, 46, .42);
    background: rgba(9, 10, 8, .58);
    color: #cabaa5;
    text-align: left;
}

.inventory-v16-document-row:hover {
    background: linear-gradient(90deg, rgba(86, 28, 20, .62), rgba(22, 13, 10, .48));
}

.inventory-v16-document-row img {
    width: 41px;
    height: 41px;
    object-fit: contain;
}

.inventory-v16-document-row span {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.inventory-v16-document-row strong,
.inventory-v16-document-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-v16-document-row strong { font-size: 10px; }
.inventory-v16-document-row small { color: #7f7262; font-size: 8px; }

/* ACP V17: vollständiges Western-Raster mit rechter Detailbox. */
.acp-v17-shell {
    grid-template-columns: minmax(275px, 20.5%) minmax(0, 1fr);
}

.acp-v17-sidebar {
    padding: 18px 13px 14px;
    overflow: hidden;
}

.acp-v17-sidebar > header {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    min-height: 105px;
    padding: 8px 5px 18px;
}

.acp-v17-sidebar > header > img {
    width: 54px;
    height: 54px;
}

.acp-v17-sidebar > header > div {
    min-width: 0;
}

.acp-v17-sidebar > header strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: #d6ba8d;
    font: 700 clamp(27px, 2.15vw, 39px)/1 Georgia, serif;
    letter-spacing: .015em;
    white-space: nowrap;
}

.acp-v17-sidebar > header small {
    display: block;
    margin-top: 8px;
    color: #ab281f;
    font: 700 14px/1 Georgia, serif;
    letter-spacing: .22em;
}

.acp-v17-sidebar nav {
    min-height: 0;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: #8d3b31 #0c0d0b;
}

.acp-v17-sidebar nav button {
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 55px;
    padding: 7px 10px;
    text-transform: none;
}

.acp-v17-sidebar nav button svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acp-v17-sidebar nav button > span {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.acp-v17-sidebar nav button b {
    overflow: hidden;
    color: inherit;
    font: 700 11px Georgia, serif;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.acp-v17-sidebar nav button small {
    overflow: hidden;
    color: #715f45;
    font-size: 7px;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acp-v17-sidebar nav button.active small { color: #987c55; }

.acp-v17-workspace {
    grid-template-rows: 154px auto minmax(0, 1fr);
}

.acp-v17-title-box {
    position: relative;
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) minmax(245px, .42fr) 42px;
    align-items: center;
    gap: 15px;
    margin: 10px 11px 0;
    padding: 20px 26px !important;
    border: 0 !important;
    background-color: #caa165 !important;
    background-image: linear-gradient(rgba(211, 173, 111, .1), rgba(170, 119, 62, .08)), url('../../bank-header-parchment-v4.png') !important;
    background-size: auto, cover !important;
    overflow: hidden;
}

.acp-v17-title-frame {
    position: absolute;
    inset: -6px;
    z-index: 4;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    object-fit: fill;
    filter: sepia(1) saturate(3.8) hue-rotate(318deg) brightness(.48);
    opacity: .72;
    pointer-events: none;
}

.acp-v17-title-box > *:not(.acp-v17-title-frame) {
    position: relative;
    z-index: 5;
}

.acp-v17-title-box .large-system-title-art {
    width: 80px;
    height: 80px;
    margin: 0;
}

.acp-v17-title-copy {
    display: grid;
    min-width: 0;
}

.acp-v17-title-copy p { margin-bottom: 5px !important; }
.acp-v17-title-copy h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp-v17-title-copy small { margin-top: 8px; color: #5f3b24; font: 11px 'Segoe UI', sans-serif; }

.acp-v17-title-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px;
    gap: 6px 10px;
    padding: 10px 12px;
    border: 1px solid rgba(92, 55, 29, .52);
    background: rgba(119, 67, 34, .12);
}

.acp-v17-title-info span { display: grid; min-width: 0; gap: 2px; }
.acp-v17-title-info span:first-child { grid-column: 1; }
.acp-v17-title-info span:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; }
.acp-v17-title-info small { color: #795333; font: 7px 'Segoe UI', sans-serif; letter-spacing: .1em; }
.acp-v17-title-info strong { overflow: hidden; color: #3c2113; font: 700 11px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.acp-v17-title-info button { grid-column: 1 / -1; min-height: 29px; padding: 5px 8px; border-color: #7b251d; background: rgba(100, 28, 20, .76); color: #e0bd83; font: 700 8px Georgia, serif; text-align: center; }

.acp-v17-close {
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
}

.acp-v17-content {
    padding: 13px 15px 18px;
}

.acp-v17-overview {
    display: grid;
    gap: 13px;
    min-height: 100%;
}

.acp-v17-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
}

.acp-v17-stat-grid article,
.acp-v17-info-card,
.acp-v17-main-box,
.acp-v17-list-panel,
.acp-v17-detail-panel {
    border: 1px solid rgba(139, 101, 53, .58);
    background-image: linear-gradient(rgba(3, 4, 3, .56), rgba(3, 4, 3, .75)), url('../../bank-background-v4.png');
    background-size: auto, cover;
    box-shadow: inset 0 0 0 3px rgba(4, 4, 3, .7), inset 0 0 0 4px rgba(162, 117, 60, .14);
}

.acp-v17-stat-grid article {
    display: grid;
    gap: 7px;
    min-height: 92px;
    padding: 17px;
}

.acp-v17-stat-grid span { color: #806845; font-size: 9px; text-transform: uppercase; }
.acp-v17-stat-grid strong { color: #cda668; font: 700 26px Georgia, serif; }

.acp-v17-overview-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, .72fr);
    gap: 13px;
    min-height: 0;
}

.acp-v17-info-card {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 300px;
    padding: 27px;
}

.acp-v17-info-card > img { width: 135px; height: 135px; object-fit: contain; filter: sepia(.25) drop-shadow(0 7px 12px #000); }
.acp-v17-info-card small { color: #8c2b22; font: 700 9px Georgia, serif; letter-spacing: .14em; }
.acp-v17-info-card h2 { margin: 8px 0 10px; color: #cda668; font: 700 24px Georgia, serif; text-transform: uppercase; }
.acp-v17-info-card p { max-width: 660px; color: #887452; font-size: 12px; line-height: 1.65; }
.acp-v17-info-card.telegram { min-height: 100%; }

.acp-v17-main-box,
.acp-v17-detail-panel {
    padding: 18px;
    overflow: auto;
}

.acp-v17-main-box > header,
.acp-v17-detail-panel > header,
.acp-v17-action-form > header,
.acp-v17-item-form > header,
.acp-v17-telegram-form > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 13px;
    padding-bottom: 11px;
    border-bottom: 3px double rgba(132, 94, 48, .42);
}

.acp-v17-main-box h2,
.acp-v17-detail-panel h2,
.acp-v17-action-form h3,
.acp-v17-item-form h2,
.acp-v17-telegram-form h2 {
    margin: 0;
    color: #cda668;
    font: 700 18px Georgia, serif;
    text-transform: uppercase;
}

.acp-v17-main-box > header span,
.acp-v17-detail-panel > header > b,
.acp-v17-item-form > header > b {
    color: #9c8a70;
    font-size: 8px;
}

.acp-v17-detail-panel > header > b.online { color: #7fa35f; }

.acp-v17-main-box dl,
.acp-v17-detail-panel dl {
    display: grid;
    gap: 4px;
    margin: 0 0 16px;
}

.acp-v17-main-box dl div,
.acp-v17-detail-panel dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 2px;
    border-bottom: 1px solid rgba(116, 84, 46, .27);
}

.acp-v17-main-box dt,
.acp-v17-detail-panel dt { color: #806845; }
.acp-v17-main-box dd,
.acp-v17-detail-panel dd { margin: 0; color: #c6a874; text-align: right; }
.acp-v17-main-box > button { width: 100%; min-height: 38px; text-align: center; }

.acp-v17-split {
    display: grid;
    grid-template-columns: minmax(430px, 44%) minmax(0, 1fr);
    gap: 13px;
    min-height: 100%;
}

.acp-v17-list-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.acp-v17-list-panel > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 3px double rgba(132, 94, 48, .46);
}

.acp-v17-list-panel > header div { display: grid; gap: 3px; }
.acp-v17-list-panel h2 { margin: 0; color: #cda668; font: 700 17px Georgia, serif; text-transform: uppercase; }
.acp-v17-list-panel header small { color: #746248; font-size: 8px; }
.acp-v17-list-panel header input { max-width: 210px; min-height: 34px; }
.acp-v17-list-panel > div { min-height: 0; overflow-y: auto; }

.acp-v17-list-panel > div > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 61px;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid rgba(113, 81, 43, .25);
    background: transparent;
    color: #ae9163;
    text-align: left;
}

.acp-v17-list-panel > div > button:hover,
.acp-v17-list-panel > div > button.selected { background: rgba(92, 30, 21, .38); box-shadow: inset 3px 0 #9b3c29; }
.acp-v17-list-panel button span { display: grid; min-width: 0; gap: 4px; }
.acp-v17-list-panel button strong,
.acp-v17-list-panel button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp-v17-list-panel button strong { color: #c8aa78; font: 700 12px Georgia, serif; }
.acp-v17-list-panel button small { color: #766348; font-size: 8px; }
.acp-v17-list-panel button b { color: #806e51; font-size: 8px; white-space: nowrap; }
.acp-v17-list-panel button b.online { color: #75a453; }

.acp-v17-empty {
    display: grid;
    place-content: center;
    gap: 8px;
    min-height: 100%;
    color: #766348;
    text-align: center;
}

.acp-v17-empty strong { color: #b99a68; font: 700 17px Georgia, serif; }

.acp-v17-finance,
.acp-v17-actions,
.acp-v17-credit-actions {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid rgba(113, 81, 43, .3);
}

.acp-v17-finance h3,
.acp-v17-actions h3 { margin: 0 0 9px; color: #a98a5d; font: 700 11px Georgia, serif; text-transform: uppercase; }
.acp-v17-finance > div { display: flex; justify-content: space-between; padding: 6px 0; color: #806845; }
.acp-v17-finance b { color: #c4a675; }
.acp-v17-actions > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.acp-v17-actions button,
.acp-v17-credit-actions button { min-height: 34px; padding: 6px 8px; font-size: 8px; text-align: center; }
.acp-v17-credit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.acp-v17-action-form,
.acp-v17-item-form,
.acp-v17-telegram-form {
    display: grid;
    gap: 9px;
    margin-top: 14px;
    padding: 13px;
    border: 1px solid rgba(137, 78, 51, .55);
    background: rgba(11, 12, 10, .78);
}

.acp-v17-action-form > header button { width: 28px; min-height: 27px; padding: 0; text-align: center; }
.acp-v17-action-form label,
.acp-v17-item-form label,
.acp-v17-telegram-form label { margin: 0; }
.acp-v17-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.acp-v17-action-form footer,
.acp-v17-item-form footer { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.acp-v17-action-form footer button,
.acp-v17-item-form footer button { min-height: 34px; text-align: center; }
.acp-v17-action-form .primary,
.acp-v17-item-form .primary,
.acp-v17-telegram-form .primary { border-color: #86271f; background-color: #681b14; }
.acp-v17-item-form textarea { min-height: 90px; resize: vertical; }
.acp-v17-telegram-form .check { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px; border: 1px solid rgba(113, 91, 61, .3); }
.acp-v17-telegram-form .check input { width: 18px; height: 18px; min-height: 0; accent-color: #8d2a21; }

.acp-v17-json {
    max-height: 380px;
    margin: 14px 0 0;
    padding: 12px;
    overflow: auto;
    border: 1px solid rgba(96, 72, 44, .34);
    background: rgba(5, 6, 5, .58);
    color: #9f8968;
    font: 9px/1.5 Consolas, monospace;
    white-space: pre-wrap;
}

@media (max-width: 1250px) {
    .acp-v17-shell { grid-template-columns: 235px minmax(0, 1fr); }
    .acp-v17-title-box { grid-template-columns: 70px minmax(0, 1fr) 210px 38px; padding: 17px 19px !important; }
    .acp-v17-title-box .large-system-title-art { width: 65px; height: 65px; }
    .acp-v17-title-info { grid-template-columns: 1fr; }
    .acp-v17-title-info span:nth-child(2) { display: none; }
    .acp-v17-split { grid-template-columns: minmax(350px, 42%) minmax(0, 1fr); }
}
