.npqa-modal, .npqa-toast {
    --npqa-surface: #ffffff; --npqa-ink: #242424; --npqa-muted: #656565;
    --npqa-border: #dedbd7; --npqa-accent: #f36e21;
    font-family: "KalamehFaNum-Regular", Tahoma, sans-serif;
    font-size: 15px; line-height: 1.7; color: var(--npqa-ink); direction: rtl;
    box-sizing: border-box;
}
.npqa-modal *, .npqa-toast * { box-sizing: border-box; }
body.npqa-modal-open { overflow: hidden; }
.npqa-modal[hidden], .npqa-toast[hidden], .npqa-modal [hidden] { display: none !important; }
dialog.npqa-modal, div.npqa-modal {
    position: fixed; inset: 0; z-index: 2147483000; width: 100%; max-width: none;
    height: 100%; height: 100dvh; max-height: none; margin: 0; border: 0;
    padding: 24px; background: transparent; overflow: hidden;
}
.npqa-modal[open] { display: grid; place-items: center; }
.npqa-modal::backdrop { background: rgba(10, 6, 6, .72); }
div.npqa-modal { background: rgba(10, 6, 6, .72); }
.npqa-panel {
    width: min(600px, 100%); max-height: 100%; min-height: 0;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--npqa-surface); border: 1px solid var(--npqa-border);
    border-radius: 24px; box-shadow: 0 30px 100px #0008;
    animation: npqa-enter .16s ease-out;
}
.npqa-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--npqa-border); }
.npqa-header small { display: block; color: #984110; font-size: 12px; }
.npqa-modal .npqa-header h2 { margin: 2px 0 0; font: inherit; font-size: 20px; font-weight: 700; color: var(--npqa-ink); }
.npqa-modal button.npqa-close { display: grid; place-items: center; flex: 0 0 44px; height: 44px; width: 44px; margin: 0; padding: 0; color: var(--npqa-ink); background: #f8f7f5; border: 1px solid var(--npqa-border); border-radius: 50%; cursor: pointer; }
.npqa-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.npqa-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px; scrollbar-width: thin; scrollbar-color: #aaa29b transparent; }
.npqa-summary { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: center; margin-bottom: 24px; }
.npqa-modal img.npqa-image { width: 96px; height: 112px; object-fit: contain; background: #fff; border-radius: 14px; }
.npqa-modal .npqa-name { margin: 0 0 8px; color: var(--npqa-ink); font: inherit; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.npqa-price, .npqa-price .price { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 4px 9px; direction: ltr; text-align: right; font-size: 17px; font-weight: 700; color: var(--npqa-ink); }
.npqa-price .price { width: 100%; }
.npqa-price ins { background: transparent; text-decoration: none; }
.npqa-price del { color: var(--npqa-muted); font-size: 14px; font-weight: 400; }
.npqa-price .amount { white-space: nowrap; }
.npqa-price .screen-reader-text { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; }
.npqa-stock { margin: 7px 0 0; font-size: 13px; color: #297140; }
.npqa-stock.is-out { color: #a52323; }
.npqa-field { min-width: 0; padding: 0; border: 0; margin: 0 0 22px; }
.npqa-field:last-child { margin-bottom: 0; }
.npqa-field legend { display: block; float: none; padding: 0; margin: 0 0 10px; color: var(--npqa-ink); font: inherit; font-size: 16px; font-weight: 700; }
.npqa-options { display: flex; flex-wrap: wrap; gap: 8px; }
.npqa-field .npqa-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
.npqa-modal button.npqa-option { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 15px; margin: 0; color: var(--npqa-ink); background: #fff; border: 1px solid #c8c3bd; border-radius: 11px; font: inherit; font-size: 14px; line-height: 1.55; text-align: center; cursor: pointer; transition: background .12s, border-color .12s; }
.npqa-modal button.npqa-option:hover:not(:disabled) { background: #fff6f0; border-color: #c25312; }
.npqa-modal button.npqa-option[aria-pressed="true"] { color: var(--npqa-ink); background: #fff0e5; border-color: #b74c0b; box-shadow: inset 0 0 0 1px #b74c0b; }
.npqa-modal button.npqa-option:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.npqa-modal button.npqa-option[aria-pressed="true"]:disabled { text-decoration: none; }
.npqa-hint, .npqa-help { color: var(--npqa-muted); font-size: 13px; margin: 0 0 12px; }
.npqa-footer { flex-shrink: 0; padding: 14px 22px 20px; border-top: 1px solid var(--npqa-border); background: var(--npqa-surface); }
.npqa-error { color: #a52323; font-size: 14px; margin: 0 0 12px; }
.npqa-error:empty { display: none; }
.npqa-quantity-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.npqa-quantity-row label { color: var(--npqa-ink); font: inherit; font-weight: 700; }
.npqa-quantity-controls { display: inline-flex; align-items: center; gap: 6px; }
.npqa-modal .npqa-quantity-controls button { width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0; border: 1px solid #c8c3bd; border-radius: 10px; background: #fff8f2; color: var(--npqa-ink); font: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.npqa-modal input.npqa-quantity { width: 66px; height: 44px; min-width: 0; margin: 0; padding: 4px; border: 1px solid #c8c3bd; border-radius: 10px; background: #fff; color: var(--npqa-ink); font: inherit; font-size: 18px; text-align: center; direction: ltr; appearance: textfield; }
.npqa-quantity::-webkit-inner-spin-button, .npqa-quantity::-webkit-outer-spin-button { appearance: none; margin: 0; }
.npqa-modal .npqa-quantity-controls button:disabled, .npqa-modal input.npqa-quantity:disabled { opacity: .5; cursor: not-allowed; }
.npqa-modal input.npqa-quantity:focus-visible { outline: 3px solid #8a3500; outline-offset: 2px; }
.npqa-modal input.npqa-quantity[aria-invalid="true"] { border-color: #a52323; }
.npqa-unit-note { margin: 0 0 8px; color: var(--npqa-muted); font-size: 12px; }
.npqa-quantity-error { margin: 0 0 8px; color: #a52323; font-size: 13px; }
.npqa-quantity-error:empty { display: none; }
.npqa-modal button.npqa-add { width: 100%; min-height: 50px; padding: 12px 18px; margin: 0; background: var(--npqa-accent); color: #202020; border: 1px solid #c75a18; border-radius: 13px; font: inherit; font-weight: 700; cursor: pointer; }
.npqa-modal button.npqa-add:hover:not(:disabled) { background: #df601a; }
.npqa-modal button.npqa-add:disabled { background: #dedbd7; border-color: #dedbd7; color: #67635f; cursor: not-allowed; }
.npqa-modal button:focus-visible, .npqa-toast a:focus-visible, .npqa-toast button:focus-visible { outline: 3px solid #8a3500; outline-offset: 3px; }
.npqa-loading { min-height: 220px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--npqa-muted); }
.npqa-spinner { display: inline-block; width: 22px; height: 22px; flex: 0 0 22px; border: 2px solid var(--npqa-border); border-top-color: #c5540e; border-radius: 50%; animation: npqa-spin .8s linear infinite; }
.npqa-busy { opacity: .55; cursor: wait; }
.npqa-toast { position: fixed; z-index: 2147483001; right: 20px; bottom: 24px; width: min(400px, calc(100vw - 32px)); padding: 17px; background: #24372c; border: 1px solid #849789; border-radius: 16px; box-shadow: 0 12px 50px #0005; }
.npqa-toast.is-error { background: #492529; border-color: #b6757c; }
.npqa-toast p { margin: 0 0 12px; color: #fff; }
.npqa-toast > div { display: flex; flex-wrap: wrap; gap: 10px; }
.npqa-toast a, .npqa-toast button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 7px 14px; color: #fff; background: #ffffff08; border: 1px solid #b5c3b9; border-radius: 9px; text-decoration: none; font: inherit; font-size: 13px; cursor: pointer; }
@keyframes npqa-spin { to { transform: rotate(360deg); } }
@keyframes npqa-enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 767px) {
    dialog.npqa-modal, div.npqa-modal { padding: 0; }
    .npqa-modal[open] { place-items: end stretch; }
    .npqa-panel { width: 100%; max-height: 92%; max-height: 92dvh; border-radius: 22px 22px 0 0; border-bottom: 0; }
    .npqa-header { position: relative; padding: 20px 16px 12px; }
    .npqa-header::before { content: ''; position: absolute; width: 42px; height: 4px; background: #bfb7b0; border-radius: 99px; top: 7px; left: calc(50% - 21px); }
    .npqa-modal .npqa-header h2 { font-size: 18px; }
    .npqa-content { padding: 18px 16px; }
    .npqa-modal .npqa-field button.npqa-option { padding-inline: 8px; }
    .npqa-summary { grid-template-columns: 78px minmax(0, 1fr); gap: 13px; margin-bottom: 20px; }
    .npqa-modal img.npqa-image { width: 78px; height: 92px; }
    .npqa-modal .npqa-name { font-size: 16px; }
    .npqa-price, .npqa-price .price { font-size: 15px; }
    .npqa-footer { padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
    .npqa-toast { right: 16px; bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .npqa-panel, .npqa-spinner { animation: none; } .npqa-modal button.npqa-option { transition: none; } }
.npqa-actions { display: flex; gap: 10px; align-items: stretch; }
.npqa-modal .npqa-actions .npqa-add { flex: 1 1 auto; min-width: 0; }
.npqa-modal button.npqa-guide { flex: 0 0 auto; margin: 0; min-height: 50px; padding: 10px 14px; color: #873907; background: #fff8f2; border: 1px solid #c9b3a3; border-radius: 13px; font: inherit; font-size: 13px; cursor: pointer; }
.npqa-modal button.npqa-guide:disabled { opacity: .55; cursor: wait; }
.npqa-modal .npqa-options { display: flex; flex-wrap: wrap; }
.npqa-modal button.npqa-option { gap: 8px; min-width: 54px; }
.npqa-modal .npqa-swatch { display: block; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid #b6b1ac; box-shadow: inset 0 0 0 2px #fff; object-fit: cover; }
.npqa-modal button.npqa-option:disabled .npqa-swatch { filter: grayscale(1); }
