:root {
    --item-bg: #0f172a;
    --item-card: rgba(17, 24, 39, .94);
    --item-gold: #d4af37;
    --item-gold-2: #f59e0b;
    --item-text: #f8fafc;
    --item-muted: #94a3b8;
    --item-border: rgba(255,255,255,.12);
}

body.item-body {
    min-height: 100vh;
    color: var(--item-text);
    background: radial-gradient(circle at top right, rgba(212,175,55,.13), transparent 30%), linear-gradient(180deg, #0b1120 0%, #111827 100%);
}

.item-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(15,23,42,.94);
    border-bottom: 1px solid var(--item-border);
    backdrop-filter: blur(14px);
}

.item-navbar-inner { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.item-brand { min-width:0; display:inline-flex; align-items:center; gap:.8rem; color:inherit; text-decoration:none; }
.item-brand:hover { color:inherit; }
.item-logo { width:58px; height:42px; object-fit:contain; }
.item-logo-fallback { width:42px; height:42px; display:grid; place-items:center; border-radius:50%; color:var(--item-gold); border:1px solid rgba(212,175,55,.65); background:rgba(212,175,55,.1); font-weight:800; }
.item-brand-copy { min-width:0; line-height:1.15; }
.item-brand-copy strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.item-brand-copy small { color:var(--item-gold); letter-spacing:.12em; }

.item-card {
    background: var(--item-card);
    border: 1px solid var(--item-border);
    border-radius: 22px;
    box-shadow: 0 18px 42px rgba(0,0,0,.26);
}
.item-hero { background:radial-gradient(circle at top right, rgba(245,158,11,.25), transparent 28%), var(--item-card); }
.item-muted { color:var(--item-muted); }
.item-section-title { font-weight:800; font-size:1.12rem; }
.item-badge { display:inline-flex; align-items:center; gap:.4rem; min-height:28px; padding:.3rem .72rem; border-radius:999px; background:rgba(212,175,55,.12); color:#f8dc78; font-weight:700; font-size:.82rem; }

.item-product-card { height:100%; overflow:hidden; transition:transform .18s ease, border-color .18s ease; }
.item-product-card:hover { transform:translateY(-3px); border-color:rgba(212,175,55,.55); }
.item-product-image-wrap { aspect-ratio:1/1; background:#0b1120; overflow:hidden; position:relative; }
.item-product-image { width:100%; height:100%; object-fit:contain; display:block; background:#0b1120; }
.item-product-placeholder { width:100%; height:100%; display:grid; place-items:center; color:#475569; font-size:3.5rem; background:linear-gradient(145deg,#111827,#0b1120); }
.item-product-content { padding:1rem; display:flex; flex-direction:column; min-height:210px; }
.item-product-title { font-size:1.08rem; font-weight:800; margin:0 0 .35rem; }
.item-product-price { color:var(--item-gold); font-size:1.15rem; font-weight:800; }
.item-stock { font-size:.78rem; color:#86efac; }
.item-stock.out { color:#fca5a5; }

.item-cart-sticky { position:sticky; top:92px; }
.item-cart-list { display:grid; gap:.72rem; }
.item-cart-row { display:grid; grid-template-columns:62px minmax(0,1fr) auto; gap:.72rem; padding:.72rem; border:1px solid var(--item-border); border-radius:15px; background:rgba(255,255,255,.025); }
.item-cart-thumb { width:62px; height:62px; border-radius:12px; object-fit:cover; background:#0b1120; }
.item-cart-name { font-weight:750; line-height:1.25; }
.item-cart-meta { color:var(--item-muted); font-size:.78rem; }
.item-qty-controls { display:inline-flex; align-items:center; gap:.35rem; margin-top:.45rem; }
.item-qty-btn { width:30px; height:30px; display:grid; place-items:center; padding:0; border-radius:9px; }
.item-remove-btn { border:0; background:transparent; color:#fca5a5; padding:.2rem; }
.item-total-row { display:flex; justify-content:space-between; align-items:center; border-top:1px dashed var(--item-border); margin-top:1rem; padding-top:1rem; }

.item-style-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:.75rem; }
.item-style-choice { border:1px solid var(--item-border); border-radius:15px; background:rgba(255,255,255,.025); color:#fff; padding:.55rem; text-align:left; cursor:pointer; transition:.15s ease; }
.item-style-choice:hover,.item-style-choice.active { border-color:var(--item-gold); background:rgba(212,175,55,.1); }
.item-style-choice img { width:100%; aspect-ratio:1/1; object-fit:contain; border-radius:11px; background:#0b1120; margin-bottom:.5rem; }
.item-style-choice .placeholder { width:100%; aspect-ratio:1/1; display:grid; place-items:center; border-radius:11px; background:#0b1120; color:#475569; margin-bottom:.5rem; }
.item-size-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(78px,1fr)); gap:.65rem; }
.item-size-choice { min-width:0; min-height:48px; display:flex; align-items:center; justify-content:center; gap:.35rem; border:1px solid var(--item-border); border-radius:12px; background:rgba(255,255,255,.025); color:#fff; padding:.65rem .8rem; cursor:pointer; font-weight:700; line-height:1.1; }
.item-size-choice.active { border-color:#22c55e; background:rgba(34,197,94,.12); box-shadow:0 0 0 1px rgba(34,197,94,.2) inset; }
.item-size-choice:disabled { opacity:.45; cursor:not-allowed; }
.item-size-status { color:#fca5a5; font-size:.68rem; font-weight:700; }
.item-modal-image { width:100%; height:100%; aspect-ratio:1/1; object-fit:contain; display:block; border-radius:18px; background:#0b1120; }

.modal-content.item-modal { color:#fff; background:#111827; border:1px solid var(--item-border); border-radius:22px; }
.item-modal .btn-close { filter:invert(1); }
.form-control,.form-select { background:#0b1120; border-color:rgba(255,255,255,.16); color:#fff; }
.form-control:focus,.form-select:focus { color:#fff; background:#0b1120; border-color:var(--item-gold); box-shadow:0 0 0 .2rem rgba(212,175,55,.12); }
.form-control::placeholder { color:#64748b; }
.form-select option { color:#111827; }
.btn-warning { background:var(--item-gold); border-color:var(--item-gold); color:#111827; }
.btn-warning:hover { background:#e7c657; border-color:#e7c657; color:#111827; }

.item-order-line { display:grid; grid-template-columns:64px minmax(0,1fr) auto; gap:.85rem; align-items:center; padding:.85rem 0; border-bottom:1px solid var(--item-border); }
.item-order-line:last-child { border-bottom:0; }

@media (max-width: 1199.98px) { .item-cart-sticky { position:static; } }
@media (max-width: 575.98px) {
    .item-brand-copy small { font-size:.67rem; }
    .item-card { border-radius:17px; }
    .item-product-content { min-height:190px; }
    .item-cart-row { grid-template-columns:54px minmax(0,1fr) auto; }
    .item-cart-thumb { width:54px; height:54px; }
    .item-order-line { grid-template-columns:54px minmax(0,1fr); }
    .item-order-line > :last-child { grid-column:2; }
}


/* Product modal: structured, responsive and image-safe */
.item-product-modal {
    overflow: hidden;
}
.item-product-modal-header {
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
    border-bottom: 1px solid var(--item-border);
}
.item-modal-title-wrap {
    min-width: 0;
}
.item-modal-product-name {
    margin: .7rem 0 .25rem;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 850;
    line-height: 1.25;
}
.item-modal-short-description {
    max-width: 780px;
    line-height: 1.55;
}
.item-product-modal-body {
    padding: 1.35rem;
    overflow-y: auto;
    scrollbar-width: none;
}
.item-product-modal-body::-webkit-scrollbar {
    display: none;
}
.item-product-modal-layout {
    display: grid;
    grid-template-columns: minmax(320px, .88fr) minmax(380px, 1.12fr);
    gap: 1.35rem;
    align-items: start;
}
.item-modal-media-column,
.item-modal-options-column {
    min-width: 0;
    display: grid;
    gap: 1rem;
}
.item-modal-image-shell {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid var(--item-border);
    border-radius: 20px;
    background: #0b1120;
    box-shadow: 0 16px 36px rgba(0,0,0,.24);
}
.item-modal-image-shell .item-product-placeholder {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 0;
}
.item-modal-description-card,
.item-modal-option-section,
.item-modal-summary-card {
    border: 1px solid var(--item-border);
    border-radius: 18px;
    background: rgba(255,255,255,.025);
}
.item-modal-description-card,
.item-modal-option-section {
    padding: 1rem;
}
.item-modal-section-heading {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .9rem;
}
.item-modal-section-heading > div {
    min-width: 0;
}
.item-modal-section-heading strong {
    display: block;
    font-size: .98rem;
    line-height: 1.25;
}
.item-modal-section-heading small {
    display: block;
    margin-top: .18rem;
    color: var(--item-muted);
    font-size: .76rem;
    line-height: 1.35;
}
.item-modal-step,
.item-modal-section-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #f8dc78;
    background: rgba(212,175,55,.13);
    border: 1px solid rgba(212,175,55,.28);
    font-weight: 850;
}
.item-modal-product-details {
    color: #dbe4ef;
    white-space: pre-line;
    overflow-wrap: anywhere;
    line-height: 1.7;
    font-size: .92rem;
}
.item-product-modal .item-style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.item-product-modal .item-style-choice {
    min-width: 0;
    padding: .65rem;
}
.item-product-modal .item-style-choice strong {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.item-product-modal .item-size-grid {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
}
.item-modal-summary-card {
    padding: .25rem 1rem;
}
.item-modal-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 1rem;
    align-items: center;
    padding: .78rem 0;
    border-bottom: 1px dashed var(--item-border);
}
.item-modal-summary-row:last-child {
    border-bottom: 0;
}
.item-modal-summary-row > span {
    color: var(--item-muted);
}
.item-modal-summary-row > strong {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}
.item-modal-summary-price strong {
    color: var(--item-gold);
    font-size: 1.14rem;
}
.item-modal-purchase-bar {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: .85rem;
    align-items: end;
    padding-top: .1rem;
}
.item-modal-quantity-field {
    min-width: 0;
}
.item-modal-quantity-field .form-label {
    margin-bottom: .4rem;
    font-weight: 700;
}
.item-modal-quantity-field .form-control {
    width: 100%;
    min-height: 48px;
    text-align: center;
    font-weight: 800;
}
.item-modal-add-button {
    min-height: 48px;
}

@media (min-width: 1200px) {
    .item-product-modal {
        max-height: calc(100vh - 3.5rem);
    }
}

@media (max-width: 991.98px) {
    #productModal .modal-dialog {
        max-width: 760px;
        margin-left: auto;
        margin-right: auto;
    }
    .item-product-modal-layout {
        grid-template-columns: 1fr;
    }
    .item-modal-image-shell {
        width: min(100%, 560px);
        margin-inline: auto;
    }
}

@media (max-width: 575.98px) {
    #productModal .modal-dialog {
        margin: .55rem;
    }
    .item-product-modal-header {
        padding: 1rem;
    }
    .item-product-modal-body {
        padding: .85rem;
    }
    .item-product-modal-layout,
    .item-modal-media-column,
    .item-modal-options-column {
        gap: .8rem;
    }
    .item-modal-description-card,
    .item-modal-option-section {
        padding: .85rem;
        border-radius: 15px;
    }
    .item-modal-image-shell {
        border-radius: 16px;
    }
    .item-product-modal .item-style-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .6rem;
    }
    .item-product-modal .item-style-choice {
        padding: .5rem;
        font-size: .82rem;
    }
    .item-product-modal .item-size-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .55rem;
    }
    .item-size-choice {
        min-height: 46px;
        padding: .55rem .4rem;
        font-size: .86rem;
    }
    .item-modal-summary-card {
        padding: .15rem .85rem;
        border-radius: 15px;
    }
    .item-modal-summary-row {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
        gap: .65rem;
        padding: .7rem 0;
        font-size: .88rem;
    }
    .item-modal-purchase-bar {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: .65rem;
    }
    .item-modal-add-button {
        padding-left: .7rem;
        padding-right: .7rem;
        font-size: .96rem;
    }
}

@media (max-width: 359.98px) {
    .item-product-modal .item-size-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .item-modal-purchase-bar {
        grid-template-columns: 1fr;
    }
}

/* Item payment + robust slip QR flow */
.item-payment-section {
    padding: 1rem;
    border: 1px solid var(--item-border);
    border-radius: 17px;
    background: rgba(255,255,255,.025);
}
.item-payment-heading {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .9rem;
}
.item-payment-heading > div { min-width: 0; }
.item-payment-heading strong { display: block; line-height: 1.25; }
.item-payment-heading small { display: block; margin-top: .18rem; color: var(--item-muted); font-size: .74rem; line-height: 1.4; }
.item-payment-step {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(212,175,55,.13);
    border: 1px solid rgba(212,175,55,.3);
    color: #f8dc78;
    font-weight: 850;
}
.item-payment-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}
.item-payment-qr-area {
    min-width: 0;
    display: grid;
    gap: .75rem;
}
.item-payment-qr-title {
    color: #fff;
    font-size: .9rem;
    font-weight: 750;
    line-height: 1.3;
}
.item-payment-qr-shell {
    width: 100%;
    min-height: 86px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: .8rem;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--item-border);
    border-radius: 15px;
    background: rgba(15,23,42,.65);
}
.item-payment-qr-shell.has-qr { min-height: 0; }
.item-payment-qr {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    padding: .65rem;
    border-radius: 13px;
    background: #fff;
}
.item-payment-qr[hidden] { display: none !important; }
.item-payment-qr-download {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: 12px;
    font-weight: 750;
}
.item-payment-qr-download[hidden] { display: none !important; }
.item-payment-qr-hint {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .25rem;
    color: var(--item-muted);
    font-size: .78rem;
    line-height: 1.45;
    text-align: center;
}
.item-payment-qr-shell.is-loading .item-payment-qr-hint { color: #fde68a; }
.item-payment-qr-shell.is-error .item-payment-qr-hint { color: #fca5a5; }
.item-payment-qr-hint .spinner-border { width: 1rem; height: 1rem; flex: 0 0 auto; }

.item-payment-account {
    min-width: 0;
    padding: .85rem;
    border: 1px solid var(--item-border);
    border-radius: 15px;
    background: rgba(15,23,42,.65);
}
.item-payment-total { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .45rem; padding-bottom: .7rem; margin-bottom: .65rem; border-bottom: 1px dashed var(--item-border); }
.item-payment-total span { color: var(--item-muted); font-size: .78rem; }
.item-payment-total strong { color: var(--item-gold); }
.item-payment-account dl { margin: 0; display: grid; gap: .55rem; }
.item-payment-account dl > div { min-width: 0; }
.item-payment-account dt { color: var(--item-muted); font-size: .68rem; font-weight: 600; }
.item-payment-account dd { margin: .1rem 0 0; color: #fff; font-size: .82rem; font-weight: 700; overflow-wrap: anywhere; }
.item-payment-unavailable {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem;
    border: 1px solid rgba(245,158,11,.3);
    border-radius: 13px;
    background: rgba(245,158,11,.08);
    color: #fde68a;
    font-size: .82rem;
    line-height: 1.5;
}
.item-slip-upload {
    position: relative;
    min-height: 170px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px dashed rgba(212,175,55,.42);
    border-radius: 15px;
    background: rgba(15,23,42,.72);
    cursor: pointer;
    transition: .16s ease;
}
.item-slip-upload:hover,
.item-slip-upload.is-dragging { border-color: var(--item-gold); background: rgba(212,175,55,.06); }
.item-slip-upload.is-disabled { opacity: .45; cursor: not-allowed; }
.item-slip-preview { display: none; width: 100%; height: 100%; max-height: 280px; object-fit: contain; background: #0b1120; }
.item-slip-preview.is-visible { display: block; }
.item-slip-upload-message { padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: .28rem; text-align: center; }
.item-slip-upload-message i { color: var(--item-gold); font-size: 2rem; }
.item-slip-upload-message strong { color: #fff; }
.item-slip-upload-message span { color: var(--item-muted); font-size: .72rem; }
.item-slip-clear {
    position: absolute;
    top: .55rem;
    right: .55rem;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(248,113,113,.8);
    border-radius: 50%;
    background: rgba(15,23,42,.92);
    color: #fca5a5;
}
.item-slip-status { margin-top: .55rem; color: var(--item-muted); font-size: .75rem; line-height: 1.4; }
.item-slip-status.is-reading { color: #fde68a; }
.item-slip-status.is-success { color: #86efac; }
.item-slip-status.is-error { color: #fca5a5; }

@media (max-width: 575.98px) {
    .item-payment-section { padding: .85rem; border-radius: 15px; }
    .item-payment-grid { gap: .75rem; }
    .item-payment-account { padding: .7rem; }
    .item-payment-total { display: grid; }
    .item-slip-upload { min-height: 150px; }
}

/* Product catalog: one full-width card per row, whole card opens modal */
.item-product-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}
.item-product-card {
    min-width: 0;
    display: grid;
    grid-template-columns: clamp(150px, 25%, 220px) minmax(0, 1fr);
    align-items: stretch;
    cursor: pointer;
    outline: none;
}
.item-product-card:focus-visible {
    border-color: var(--item-gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,.2), 0 18px 42px rgba(0,0,0,.26);
}
.item-product-card.is-out-of-stock {
    opacity: .78;
}
.item-product-card .item-product-image-wrap {
    width: 100%;
    min-height: 0;
    aspect-ratio: 1 / 1;
    align-self: center;
    border-right: 1px solid var(--item-border);
}
.item-product-card .item-product-content {
    min-width: 0;
    min-height: 0;
    padding: 1.15rem 1.25rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "copy meta"
        "hint hint";
    gap: 1rem 1.35rem;
    align-items: center;
}
.item-product-copy {
    grid-area: copy;
    min-width: 0;
}
.item-product-card .item-product-title {
    margin-bottom: .45rem;
    font-size: clamp(1.08rem, 2vw, 1.28rem);
}
.item-product-description {
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.item-product-meta {
    grid-area: meta;
    min-width: 150px;
    text-align: right;
}
.item-product-card .item-stock {
    margin-top: .25rem;
}
.item-product-card-hint {
    grid-area: hint;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    padding-top: .75rem;
    border-top: 1px dashed var(--item-border);
    color: #f8dc78;
    font-size: .82rem;
    font-weight: 700;
}
.item-product-card-hint i {
    transition: transform .18s ease;
}
.item-product-card:hover .item-product-card-hint i,
.item-product-card:focus-visible .item-product-card-hint i {
    transform: translateX(3px);
}

/* Product modal styles: fill available width instead of fixed column count */
.item-product-modal .item-style-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    align-items: stretch;
}
.item-product-modal .item-style-choice {
    width: 100%;
    height: 100%;
}

@media (max-width: 767.98px) {
    .item-product-card {
        grid-template-columns: 118px minmax(0, 1fr);
    }
    .item-product-card .item-product-content {
        padding: .9rem;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "copy"
            "meta"
            "hint";
        gap: .6rem;
        align-content: center;
    }
    .item-product-meta {
        min-width: 0;
        text-align: left;
    }
    .item-product-card-hint {
        justify-content: space-between;
        padding-top: .55rem;
    }
}

@media (max-width: 479.98px) {
    .item-product-card {
        grid-template-columns: 104px minmax(0, 1fr);
        border-radius: 16px;
    }
    .item-product-card .item-product-image-wrap {
        border-right: 1px solid var(--item-border);
    }
    .item-product-card .item-product-content {
        padding: .78rem;
    }
    .item-product-card .item-product-title {
        font-size: .98rem;
        line-height: 1.3;
    }
    .item-product-description {
        font-size: .78rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .item-product-card .item-product-price {
        font-size: 1rem;
    }
    .item-product-card-hint {
        font-size: .74rem;
    }
    .item-product-modal .item-style-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(112px, 100%), 1fr));
    }
}

/* Order proof and printable E-ticket parity */
.item-order-slip-image {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    background: #080b12;
    border: 1px solid rgba(255,255,255,.1);
}
@media print {
    body { background: #fff !important; }
    .actions, .ticket-shell > .actions { display: none !important; }
    .ticket-shell { width: 100%; margin: 0; }
    .ticket-card { box-shadow: none; break-inside: avoid; }
}
