/* Shared app styles: inner pages, forms, cart, checkout, account, admin, courier. */

html.modal-open,
html.modal-open body {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-grid > h3,
.form-grid > .form-error,
.form-grid > .form-actions {
    grid-column: 1 / -1;
}

.admin-panel {
    padding-top: 18px;
}

.footer .contact-line a {
    display: inline;
    color: inherit;
    text-decoration: none;
}

.footer .contact-line a:hover {
    color: var(--red-ink);
}

.summary .btn + .btn {
    margin-top: 10px;
}

.panel .form-grid,
.panel .form-stack {
    margin-top: 14px;
}

.carbar {
    padding: 2px;
}

.carbar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

/* ---------- page shell ---------- */
.app-main {
    width: 100%;
    max-width: 1100px;
    min-height: calc(100vh - 384px);
    margin: 0 auto;
    padding: 26px 20px 56px;
    box-sizing: border-box;
    text-align: right;
}

.page-head {
    margin: 4px 0 20px;
}

.page-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.9;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 12.5px;
    color: var(--muted);
}

.crumbs a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--ease);
}

.crumbs a:hover {
    color: var(--red-ink);
}

.muted {
    color: var(--muted);
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 20px;
}

.panel + .panel,
.panel + .section-block,
.section-block + .section-block {
    margin-top: 18px;
}

.panel > h2,
.section-block > h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.section-block {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    scroll-margin-top: 96px;
}

.section-block .section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.section-block .section-head h2 {
    margin: 0;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease), color var(--ease), transform var(--ease);
}

.btn:hover {
    transform: scale(1.03);
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--red-glow);
}

.btn--primary {
    background: linear-gradient(135deg, var(--red-bright) 0%, #a10f24 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px var(--red-glow);
}

.btn--primary:hover {
    box-shadow: 0 0 0 1px var(--red-soft), 0 10px 26px var(--red-glow);
}

.btn--ghost {
    background: var(--surface-strong);
    border-color: var(--line);
    color: var(--text);
}

.btn--ghost:hover {
    border-color: var(--red);
    color: var(--red-ink);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
}

.btn--danger {
    background: transparent;
    border-color: var(--red-soft);
    color: var(--red-ink);
}

.btn--danger:hover {
    background: var(--red);
    color: #ffffff;
    box-shadow: 0 0 16px var(--red-glow);
}

.btn--sm {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 10px;
}

.btn--full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn[hidden] {
    display: none;
}

.link-btn {
    padding: 0;
    border: none;
    background: none;
    color: var(--red-ink);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.link-btn:hover {
    text-decoration: underline;
}

/* ---------- forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: right;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 13px;
    color: var(--muted);
}

.field .hint {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.7;
}

.input,
.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    box-sizing: border-box;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    text-align: right;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.input[dir="ltr"],
.field input[dir="ltr"] {
    text-align: left;
}

.input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 14px var(--red-glow);
    background: var(--surface);
}

.field textarea {
    min-height: 92px;
    resize: vertical;
}

.field select {
    cursor: pointer;
}

.field input[type="file"] {
    padding: 8px 10px;
    cursor: pointer;
}

.field input[type="file"]::file-selector-button {
    min-height: 28px;
    margin-inline-end: 10px;
    padding: 4px 12px;
    border: 1px solid var(--red-soft);
    border-radius: 8px;
    background: var(--red);
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.image-preview {
    width: auto;
    max-width: 100%;
    max-height: 200px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
    object-fit: contain;
}

.admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.admin-gallery:empty {
    display: none;
}

.gallery-item {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
}

.gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.gallery-item figcaption {
    padding: 6px 8px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.gallery-actions {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0 6px 8px;
}

.gallery-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-height: 0;
    accent-color: var(--red);
}

.check-field {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.form-error {
    margin: 10px 0 0;
    color: var(--red-ink);
    font-size: 12.5px;
    line-height: 1.8;
}

.form-error[hidden] {
    display: none;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.form-actions .btn {
    flex-shrink: 0;
}

/* ---------- auth modal ---------- */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: grid;
    place-items: center;
    padding: 16px;
}

.auth-modal[hidden] {
    display: none;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
}

.auth-dialog {
    position: relative;
    width: min(430px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 26px 22px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(225, 29, 46, 0.2);
    text-align: right;
    animation: authIn 220ms ease;
}

@keyframes authIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.auth-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.auth-close:hover {
    border-color: var(--red);
    box-shadow: 0 0 12px var(--red-glow);
    transform: scale(1.08);
}

.auth-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-head strong {
    color: var(--red-ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.auth-head small {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.22em;
}

.auth-dialog h2 {
    margin: 12px 0 6px;
    font-size: 22px;
}

.auth-sub {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.auth-tabs button {
    padding: 9px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}

.auth-tabs button.is-active {
    background: var(--red);
    color: #ffffff;
    box-shadow: 0 6px 16px var(--red-glow);
}

.auth-form .field + .field {
    margin-top: 12px;
}

.auth-form .btn {
    margin-top: 14px;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.auth-link {
    padding: 4px;
    border: none;
    background: none;
    color: var(--red-ink);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.auth-link[hidden] {
    display: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-dev {
    margin: 14px 0 0;
    padding: 10px 12px;
    border: 1px dashed var(--red-soft);
    border-radius: 12px;
    background: rgba(225, 29, 46, 0.08);
    color: var(--red-ink);
    font-size: 12.5px;
    line-height: 1.9;
    direction: ltr;
    text-align: left;
}

.auth-dev[hidden] {
    display: none;
}

.auth-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    text-align: center;
}

/* ---------- toast ---------- */
.toast-root {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 130;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    max-width: min(90vw, 440px);
    padding: 11px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-in {
    opacity: 1;
    transform: none;
}

.toast--success {
    border-color: rgba(34, 197, 94, 0.55);
}

.toast--error {
    border-color: var(--red);
    color: var(--red-ink);
}

/* ---------- status pills ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill[data-status="pending"] {
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.35);
    background: rgba(245, 158, 11, 0.12);
}

.status-pill[data-status="processing"] {
    color: #1d4ed8;
    border-color: rgba(29, 78, 216, 0.3);
    background: rgba(59, 130, 246, 0.12);
}

.status-pill[data-status="shipped"] {
    color: var(--red-ink);
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.1);
}

.status-pill[data-status="delivered"] {
    color: #15803d;
    border-color: rgba(21, 128, 61, 0.35);
    background: rgba(34, 197, 94, 0.12);
}

.status-pill[data-status="canceled"] {
    color: var(--muted);
    border-color: var(--line);
    background: var(--surface-strong);
}

body:not(.theme-light) .status-pill[data-status="pending"] {
    color: #fbbf24;
}

body:not(.theme-light) .status-pill[data-status="processing"] {
    color: #93c5fd;
}

body:not(.theme-light) .status-pill[data-status="delivered"] {
    color: #4ade80;
}

.pay-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    color: var(--muted);
}

.pay-chip {
    display: inline-flex;
    align-items: center;
    margin-inline-start: 6px;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.pay-chip[data-state="review"] {
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.12);
}

.pay-chip[data-state="rejected"] {
    color: var(--red-ink);
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.1);
}

.pay-chip[data-state="unpaid"] {
    color: var(--muted);
    background: var(--surface-strong);
}

.pay-chip[data-state="paid"] {
    color: #15803d;
    border-color: rgba(21, 128, 61, 0.35);
    background: rgba(34, 197, 94, 0.12);
}

body:not(.theme-light) .pay-chip[data-state="review"] {
    color: #fbbf24;
}

body:not(.theme-light) .pay-chip[data-state="paid"] {
    color: #4ade80;
}

/* ---------- empty / gate states ---------- */
.empty-state {
    padding: 44px 20px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
}

.empty-state h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 18px;
}

.empty-state p {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.9;
}

.gate-wrap {
    display: grid;
    place-items: center;
    padding: 20px 0;
}

.gate-card {
    width: min(460px, 100%);
    padding: 26px 22px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--card);
    box-shadow: var(--shadow);
    text-align: right;
}

.gate-card h1,
.gate-card h2 {
    font-size: 22px;
    margin: 0 0 8px;
}

.gate-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
    margin: 0 0 16px;
}

.gate-mark {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}

.gate-mark strong {
    color: var(--red-ink);
    letter-spacing: 0.18em;
    font-size: 17px;
}

.gate-mark small {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.22em;
}

/* ---------- product detail ---------- */
.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.product-media-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.product-visual {
    position: relative;
    aspect-ratio: 1 / 1;
    max-height: 520px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 18%, var(--red-glow), transparent 64%),
        var(--surface);
    color: var(--red);
}

.product-visual img {
    position: absolute;
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
    object-fit: contain;
}

.product-visual img[hidden] {
    display: none;
}

.product-visual svg {
    width: 120px;
    height: 120px;
}

.product-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-thumbs[hidden] {
    display: none;
}

.product-thumb {
    width: 64px;
    height: 64px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.product-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-thumb:hover {
    border-color: var(--red-soft);
    transform: translateY(-1px);
}

.product-thumb.is-active {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 14px var(--red-glow);
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
    transition: color var(--ease), border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.category-pill::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

.category-pill:hover {
    color: var(--red-ink);
    border-color: var(--red);
    background: var(--surface);
    box-shadow: 0 0 14px var(--red-glow);
}

.product-info h1 {
    margin: 6px 0 10px;
    font-size: clamp(24px, 3.4vw, 32px);
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
    direction: rtl;
}

.product-specs[hidden],
.spec-pill[hidden] {
    display: none;
}

.spec-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 12px;
}

.spec-pill strong {
    color: var(--text);
    font-weight: 600;
}

.product-desc {
    margin: 14px 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 2;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    direction: rtl;
}

.product-price-row .price {
    font-size: 28px;
}

.product-price-row small {
    color: var(--muted);
    font-size: 12px;
}

.product-old-price {
    color: var(--muted);
    font-size: 14px;
}

.product-old-price[hidden] {
    display: none;
}

.product-off-badge {
    align-self: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--red-bright), #a10f24);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.product-off-badge[hidden] {
    display: none;
}

.stock-line {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.stock-line.is-low {
    color: var(--red-ink);
}

.stock-line.is-out {
    color: var(--red-ink);
    font-weight: 700;
}

.buy-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.qty {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-strong);
}

.qty button {
    width: 38px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
}

.qty button:hover {
    background: var(--red);
    color: #ffffff;
}

.qty input {
    width: 48px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: center;
    -moz-appearance: textfield;
}

.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.in-cart-note {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid var(--red-soft);
    border-radius: 14px;
    background: rgba(225, 29, 46, 0.07);
    font-size: 13px;
    line-height: 1.9;
}

.in-cart-note strong {
    color: var(--red-ink);
}

.in-cart-note .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

/* ---------- cart ---------- */
.cart-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    align-items: start;
}

.cart-list {
    display: grid;
    gap: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 76px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.cart-thumb {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: radial-gradient(circle at 50% 30%, var(--red-glow), transparent 68%), var(--surface-strong);
    color: var(--red);
}

.cart-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-thumb svg {
    width: 42px;
    height: 42px;
}

.cart-name {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 600;
}

.cart-name a {
    color: inherit;
    text-decoration: none;
}

.cart-name a:hover {
    color: var(--red-ink);
}

.cart-meta {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.cart-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cart-line-total {
    font-size: 14px;
    font-weight: 700;
    color: var(--red-ink);
}

.cart-remove {
    padding: 0;
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.cart-remove:hover {
    color: var(--red-ink);
    text-decoration: underline;
}

.summary {
    position: sticky;
    top: 96px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
}

.summary h2 {
    margin: 0 0 14px;
    font-size: 17px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    font-size: 13.5px;
    color: var(--muted);
}

.summary-row strong {
    color: var(--text);
    font-weight: 600;
}

.summary-total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 16px;
    color: var(--text);
    font-weight: 700;
}

.summary .btn {
    margin-top: 14px;
}

.summary .hint {
    margin: 10px 0 0;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.8;
}

/* ---------- checkout / payment ---------- */
.checkout-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    align-items: start;
}

.addr-list {
    display: grid;
    gap: 10px;
}

.addr-card {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease);
}

.addr-card:hover {
    border-color: var(--red-soft);
}

.addr-card input {
    margin-top: 3px;
    accent-color: var(--red);
}

.addr-card .addr-body {
    min-width: 0;
}

.addr-card strong {
    display: block;
    font-size: 13.5px;
}

.addr-card p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
}

.addr-card:has(input:checked) {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
}

.pay-methods {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.pay-option {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.pay-option input {
    margin-top: 3px;
    accent-color: var(--red);
}

.pay-option strong {
    display: block;
    font-size: 13.5px;
}

.pay-option small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.8;
}

.pay-option:has(input:checked) {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
}

.pay-option.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card-pay {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--red-soft);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(225, 29, 46, 0.06), transparent 60%),
        var(--surface-strong);
}

.card-pay-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.card-pay-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--red-ink);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.card-pay-tag::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.card-number {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px dashed var(--red-soft);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: 700 19px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 0.12em;
    text-align: center;
    user-select: all;
}

.card-pay-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.card-pay-meta div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-pay-meta span {
    color: var(--muted);
    font-size: 11px;
}

.card-pay-meta b {
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}

.card-hint {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.85;
}

.card-warn {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-size: 12px;
    line-height: 1.8;
}

body:not(.theme-light) .card-warn {
    color: #fbbf24;
}

.receipt-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.receipt-preview img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.pay-state[data-state="paid"] {
    color: #15803d;
}

.pay-state[data-state="review"] {
    color: #b45309;
}

.pay-state[data-state="rejected"] {
    color: var(--red-ink);
}

body:not(.theme-light) .pay-state[data-state="paid"] {
    color: #4ade80;
}

body:not(.theme-light) .pay-state[data-state="review"] {
    color: #fbbf24;
}

.receipt-thumb {
    display: block;
    max-width: 240px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
}

.receipt-thumb img {
    display: block;
    width: 100%;
    height: auto;
}

.receipt-thumb--sm {
    max-width: 170px;
    margin-top: 0;
    flex: 0 0 auto;
}

.form-section {
    grid-column: 1 / -1;
    margin: 10px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--text);
}

.payment-review {
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.payment-review[data-state="review"] {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.07);
}

.payment-review[data-state="rejected"] {
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.06);
}

.payment-review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}

.payment-review-head .pay-chip {
    margin: 0;
}

.payment-review-body {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
}

.payment-review-side {
    flex: 1 1 260px;
    min-width: 0;
}

.review-note {
    margin: 0 0 8px;
    padding: 7px 10px;
    border-right: 3px solid var(--red);
    border-radius: 8px;
    background: var(--surface-strong);
    font-size: 12.5px;
    line-height: 1.8;
}

.receipt-empty {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.review-note-input {
    flex: 1 1 200px;
    min-width: 0;
}

.discount-box {
    margin: 6px 0 2px;
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.discount-box label {
    display: block;
    margin-bottom: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.discount-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.discount-row .input {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.discount-row .btn {
    flex: none;
    margin: 0;
    white-space: nowrap;
}

.discount-note {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.discount-note.is-ok,
.discount-note.is-error {
    color: var(--red-ink);
}

.discount-note[hidden] {
    display: none;
}

#discountRow strong {
    color: var(--red-ink);
}

#discountRow small {
    font-size: 11px;
    color: var(--muted);
}

.pay-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.8;
    color: var(--muted);
}

.pay-status {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.8;
}

.pay-status.is-error {
    border-color: var(--red);
    color: var(--red-ink);
}

.pay-status[hidden] {
    display: none;
}

.checkout-form {
    margin-top: 16px;
}

/* ---------- account ---------- */
.account-grid {
    display: grid;
    gap: 18px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.address-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.address-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.address-card h3 {
    margin: 0;
    font-size: 14px;
}

.address-card p {
    margin: 3px 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
}

.addr-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.orders-list {
    display: grid;
    gap: 10px;
}

.order-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.order-row:hover {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
    transform: translateY(-1px);
}

.order-row .order-id {
    color: var(--red-ink);
    font-size: 13px;
    font-weight: 800;
}

.order-meta {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.8;
}

.order-total {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.account-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.account-hello {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.account-hello strong {
    color: var(--text);
}

/* ---------- order detail ---------- */
.order-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.order-head h1 {
    margin: 0;
    font-size: 24px;
}

.order-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 12.5px;
    color: var(--muted);
}

.delivery-code {
    padding: 16px;
    border: 1px dashed var(--red-soft);
    border-radius: 16px;
    background: rgba(225, 29, 46, 0.07);
    text-align: center;
}

.delivery-code span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--muted);
}

.delivery-code strong {
    display: inline-block;
    color: var(--red-ink);
    font-size: clamp(26px, 5vw, 34px);
    letter-spacing: 0.35em;
    direction: ltr;
}

.order-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    align-items: start;
    margin-top: 18px;
}

.items-list {
    display: grid;
    gap: 0;
}

.item-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}

.item-row:last-child {
    border-bottom: none;
}

.item-row .item-price {
    color: var(--muted);
    white-space: nowrap;
}

.item-row .item-total {
    font-weight: 700;
    color: var(--red-ink);
    white-space: nowrap;
}

.info-line {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.9;
}

.info-line span {
    color: var(--muted);
    min-width: 82px;
    flex-shrink: 0;
}

/* ---------- admin ---------- */
.admin-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-top {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 0 6px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    backdrop-filter: blur(14px);
}

.admin-top-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-top-brand .gate-mark {
    line-height: 1.15;
}

.admin-top-brand .account-hello {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.admin-top .row-actions {
    margin-inline-start: auto;
    display: flex;
    gap: 8px;
}

.admin-burger {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}

.admin-burger span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: background var(--ease);
}

.admin-burger:hover,
.admin-burger:focus-visible {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-soft);
    outline: none;
    transform: translateY(-1px);
}

.admin-burger:hover span {
    background: var(--red);
}

.admin-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(12, 10, 10, 0.42);
    backdrop-filter: blur(2px);
}

.admin-nav {
    position: fixed;
    z-index: 70;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(300px, 84vw);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 14px 26px;
    border-left: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(18px);
    box-shadow: -18px 0 44px rgba(20, 12, 12, 0.2);
    transform: translateX(102%);
    transition: transform 0.24s var(--ease);
    overflow-y: auto;
}

.admin-nav.is-open {
    transform: translateX(0);
}

.admin-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 4px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.admin-nav-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.admin-nav-close:hover {
    border-color: var(--red);
    color: var(--red);
}

.admin-nav > button {
    position: relative;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    cursor: pointer;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.admin-nav > button:hover {
    background: var(--surface);
    border-color: var(--line);
}

.admin-nav > button.is-active {
    background: var(--red);
    border-color: var(--red);
    color: #ffffff;
    box-shadow: 0 8px 20px var(--red-soft);
}

body.admin-nav-open {
    overflow: hidden;
}

.admin-panel[hidden] {
    display: none;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

.data-table th {
    padding: 10px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.data-table td {
    padding: 10px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--surface);
}

.data-table .num {
    direction: ltr;
    text-align: right;
    white-space: nowrap;
}

.page-path {
    display: inline-block;
    max-width: 100%;
    direction: ltr;
    padding: 3px 9px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.address-list {
    display: grid;
    gap: 10px;
}

.address-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.address-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.address-info strong {
    font-size: 13.5px;
}

.address-note {
    color: var(--muted);
    font-size: 11.5px;
}

@media (max-width: 600px) {
    .address-item {
        flex-direction: column;
        align-items: stretch;
    }

    .address-item .row-actions {
        justify-content: flex-end;
    }
}

.poster-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.poster-admin-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.poster-admin-card.is-off {
    opacity: 0.62;
}

.poster-admin-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 887 / 213;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-strong);
}

.poster-admin-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.poster-admin-body strong {
    font-size: 13.5px;
}

.poster-admin-card .row-actions {
    justify-content: flex-end;
    margin-top: auto;
}

.cell-title {
    display: block;
}

.cell-sub {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.cell-old {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    text-decoration: line-through;
}

.cell-discount {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
}

.discount-table {
    min-width: 0;
    font-size: 12px;
}

.discount-table th,
.discount-table td {
    padding: 8px 6px;
}

.discount-table .row-actions {
    gap: 4px;
    flex-wrap: nowrap;
}

.discount-table .btn {
    padding: 5px 8px;
    font-size: 11.5px;
}

.discount-table td {
    white-space: nowrap;
}

.discount-table .cell-sub {
    white-space: normal;
}

.row-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.inline-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--red-soft);
    border-radius: 16px;
    background: var(--surface);
}

.inline-form[hidden] {
    display: none;
}

.inline-form .form-actions {
    grid-column: 1 / -1;
    margin-top: 0;
}

.inline-form h3 {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 15px;
}

.form-help {
    grid-column: 1 / -1;
    direction: rtl;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border: 1px dashed var(--red-soft);
    border-radius: 12px;
    background: var(--surface-strong);
    font-size: 12.5px;
    line-height: 1.9;
}

.form-help strong {
    font-size: 12.5px;
    color: var(--red-ink);
}

.form-help ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
}

.form-help li {
    position: relative;
    padding-inline-start: 16px;
}

.form-help li::before {
    content: '';
    position: absolute;
    inset-inline-start: 2px;
    top: 0.72em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--red-soft);
}

.form-help code {
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--red-ink);
    font-family: inherit;
    font-weight: 700;
    font-size: 12px;
    unicode-bidi: isolate;
}

.admin-order {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.admin-order + .admin-order {
    margin-top: 10px;
}

.admin-order-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-order-head strong {
    color: var(--red-ink);
    font-size: 14px;
}

.admin-order-body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.9;
}

.admin-order-body b {
    color: var(--text);
    font-weight: 600;
}

.admin-order-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.admin-order-actions select {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
}

.code-chip {
    display: inline-block;
    padding: 2px 9px;
    border: 1px dashed var(--red-soft);
    border-radius: 8px;
    color: var(--red-ink);
    font-weight: 700;
    direction: ltr;
}

.code-chip--rtl {
    direction: rtl;
    font-weight: 600;
}

/* ---------- courier ---------- */
.courier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.courier-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
}

.courier-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.courier-card h2 {
    margin: 0;
    font-size: 16px;
}

.courier-line {
    display: flex;
    gap: 8px;
    padding: 2px 0;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text);
}

.courier-line span {
    min-width: 74px;
    flex-shrink: 0;
    color: var(--muted);
}

.courier-items {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px dashed var(--line);
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.9;
}

.deliver-zone {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.deliver-form {
    display: flex;
    gap: 8px;
}

.deliver-form .input {
    flex: 1;
    min-width: 0;
}

.deliver-msg {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--red-ink);
    line-height: 1.8;
}

.deliver-msg[hidden] {
    display: none;
}

.courier-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.courier-topbar h1 {
    margin: 0;
    font-size: 24px;
}

/* ---------- home product-card link ---------- */
.product-card .card-link {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
}

.product-card .card-link:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 3px var(--red-glow);
}

.product-card .product-tag {
    z-index: 3;
}

.product-card .add-btn {
    position: relative;
    z-index: 3;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .product-layout,
    .cart-layout,
    .checkout-grid,
    .order-grid {
        grid-template-columns: 1fr;
    }

    .summary {
        position: static;
    }

    .admin-order-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .app-main {
        padding: 18px 14px 42px;
    }

    .admin-top {
        flex-wrap: wrap;
        padding: 10px 12px;
    }

    .admin-top-brand .account-hello {
        display: none;
    }

    .admin-top .row-actions {
        width: 100%;
        margin-inline-start: 0;
    }

    .admin-top .row-actions .btn {
        flex: 1;
    }

    .payment-review-body {
        flex-direction: column;
    }

    .payment-review-side {
        flex: 0 0 auto;
        width: 100%;
    }

    .receipt-thumb--sm {
        max-width: 100%;
    }

    .form-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 64px 1fr;
    }

    .cart-thumb {
        width: 64px;
        height: 64px;
    }

    .cart-controls {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .product-visual {
        aspect-ratio: 1 / 1;
        max-height: 380px;
    }

    .order-row {
        grid-template-columns: 1fr auto;
    }

    .order-row .order-meta {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .toast-root {
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }

    .panel,
    .section-block {
        padding: 16px;
    }

    .auth-dialog {
        padding: 22px 16px 18px;
    }

    .deliver-form {
        flex-wrap: wrap;
    }

    .card-number {
        font-size: 16px;
        letter-spacing: 0.08em;
        padding: 10px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .order-row,
    .toast {
        transition: none;
    }

    .btn:hover,
    .order-row:hover {
        transform: none;
    }

    .auth-dialog {
        animation: none;
    }
}

/* ---------- customer support drawer ---------- */
body.support-locked {
    overflow: hidden;
}

.chat-btn {
    position: relative;
}

.chat-btn.has-support-unread::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--red-bright);
    box-shadow: 0 0 0 2px #161616, 0 0 12px var(--red-glow);
    animation: supportPulse 1.9s ease-in-out infinite;
}

body.theme-light .chat-btn.has-support-unread::after {
    box-shadow: 0 0 0 2px #ffffff, 0 0 12px var(--red-glow);
}

.support-layer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    pointer-events: none;
}

.support-layer[hidden] {
    display: none;
}

.support-layer.is-open {
    pointer-events: auto;
}

.support-scrim {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 300ms ease;
}

.support-layer.is-open .support-scrim {
    opacity: 1;
}

.support-drawer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(432px, 100vw);
    height: 100dvh;
    direction: rtl;
    background: linear-gradient(180deg, #181818 0%, #0c0c0c 100%);
    border-right: 1px solid var(--line);
    box-shadow: 30px 0 80px rgba(0, 0, 0, 0.65);
    transform: translateX(-104%);
    transition: transform 340ms cubic-bezier(0.22, 0.9, 0.26, 1);
    outline: none;
    overflow: hidden;
}

.support-layer.is-open .support-drawer {
    transform: translateX(0);
}

.support-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
}

.support-head-id {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.support-mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--red-bright) 0%, #8c0b1d 100%);
    box-shadow: 0 8px 20px var(--red-glow);
}

.support-mark svg {
    width: 20px;
    height: 20px;
}

.support-head-text {
    min-width: 0;
}

.support-head-text h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.support-head-text p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11.5px;
}

.support-x {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease), transform var(--ease);
}

.support-x:hover,
.support-x:focus-visible {
    outline: none;
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 16px var(--red-glow);
    transform: scale(1.06);
}

.support-x svg {
    width: 17px;
    height: 17px;
}

.support-views {
    flex: 1;
    min-height: 0;
    display: flex;
}

.support-view {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.support-view[hidden] {
    display: none;
}

.support-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 26px;
    scrollbar-width: thin;
    scrollbar-color: var(--red-soft) transparent;
}

.support-scroll::-webkit-scrollbar,
.support-thread::-webkit-scrollbar {
    width: 6px;
}

.support-scroll::-webkit-scrollbar-thumb,
.support-thread::-webkit-scrollbar-thumb {
    background: var(--red-soft);
    border-radius: 999px;
}

.support-eyebrow {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--red-soft);
    background: rgba(225, 29, 46, 0.08);
    color: var(--red-ink);
    font-size: 10.5px;
    font-weight: 600;
}

.support-intro h3 {
    margin: 12px 0 6px;
    font-size: 18px;
    font-weight: 800;
}

.support-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.95;
}

.support-agent-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.support-agent {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: right;
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease), transform var(--ease);
}

.support-agent:hover,
.support-agent:focus-visible {
    outline: none;
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 22px var(--red-glow);
    transform: translateY(-2px);
}

.support-avatar {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: radial-gradient(circle at 30% 20%, rgba(225, 29, 46, 0.24), transparent 70%), var(--surface-strong);
    color: var(--red-ink);
    font-size: 18px;
    font-weight: 800;
}

.support-avatar--sm {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    font-size: 15px;
}

.support-avatar--xs {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    font-size: 12px;
    align-self: flex-end;
}

.support-agent-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.support-agent-body strong {
    font-size: 13.5px;
    font-weight: 700;
}

.support-agent-body small {
    color: var(--muted);
    font-size: 11px;
}

.support-agent-preview {
    max-width: 100%;
    overflow: hidden;
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-agent-preview.is-empty {
    color: var(--red-ink);
    opacity: 0.85;
}

.support-agent-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.support-unread {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--red);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    box-shadow: 0 0 12px var(--red-glow);
}

.support-tag {
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 9.5px;
}

.support-agent-go {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    transition: border-color var(--ease), background var(--ease), color var(--ease);
}

.support-agent:hover .support-agent-go {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.support-agent-go svg {
    width: 15px;
    height: 15px;
}

.support-footnote {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.8;
    text-align: center;
}

.support-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.support-back {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.support-back:hover,
.support-back:focus-visible {
    outline: none;
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 14px var(--red-glow);
}

.support-back svg {
    width: 17px;
    height: 17px;
}

.support-chat-who {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: right;
}

.support-chat-who strong {
    font-size: 13.5px;
    font-weight: 700;
}

.support-chat-who span {
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 9.5px;
    white-space: nowrap;
}

.support-pill i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red-bright);
    box-shadow: 0 0 8px var(--red-glow);
    animation: supportPulse 2s ease-in-out infinite;
}

.support-pill.is-closed i {
    background: var(--muted);
    box-shadow: none;
    animation: none;
}

.support-pill.is-closed {
    color: var(--muted);
}

.support-thread {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--red-soft) transparent;
}

.support-thread-empty {
    margin: auto;
    max-width: 250px;
    padding: 26px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.support-empty-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: radial-gradient(circle at 30% 20%, var(--red-glow), transparent 70%), var(--surface);
    color: var(--red-ink);
}

.support-empty-mark svg {
    width: 26px;
    height: 26px;
}

.support-thread-empty strong {
    font-size: 14px;
}

.support-thread-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.9;
}

.support-day {
    align-self: center;
    margin: 4px 0;
}

.support-day span {
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 10px;
}

.support-msg {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    max-width: 86%;
}

.support-msg--agent {
    align-self: flex-start;
}

.support-msg--user {
    align-self: flex-end;
}

.support-msg-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.support-msg--user .support-msg-body {
    align-items: flex-end;
}

.support-bubble {
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.95;
    text-align: right;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.support-msg--agent .support-bubble {
    border-top-right-radius: 5px;
}

.support-msg--user .support-bubble {
    border-color: transparent;
    border-top-left-radius: 5px;
    background: linear-gradient(135deg, var(--red-bright) 0%, #a10f24 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px var(--red-glow);
}

.support-time {
    padding: 0 4px;
    color: var(--muted);
    font-size: 9.5px;
}

.support-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 10px;
}

.support-suggest:empty {
    display: none;
}

.support-chip {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: border-color var(--ease), box-shadow var(--ease), color var(--ease);
}

.support-chip:hover,
.support-chip:focus-visible {
    outline: none;
    border-color: var(--red);
    color: var(--red-ink);
    box-shadow: 0 0 14px var(--red-glow);
}

.support-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.support-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    max-height: 128px;
    padding: 10px 13px;
    box-sizing: border-box;
    resize: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    line-height: 1.9;
    text-align: right;
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.support-composer textarea::placeholder {
    color: var(--muted);
}

.support-composer textarea:focus {
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
}

.support-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red-bright) 0%, #8c0b1d 100%);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--red-glow);
    transition: transform var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.support-send:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 0 0 1px var(--red-soft), 0 10px 24px var(--red-glow);
}

.support-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.support-send svg {
    width: 19px;
    height: 19px;
    transform: scaleX(-1);
}

.support-composer-hint {
    margin: 0;
    padding: 0 16px 10px;
    color: var(--muted);
    font-size: 9.5px;
    text-align: center;
}

.support-view--gate {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.support-gate {
    max-width: 300px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.support-gate-badge {
    position: relative;
    display: inline-flex;
    margin-top: 16px;
}

.support-gate-avatar {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    font-size: 24px;
}

.support-gate-icon {
    position: absolute;
    bottom: -7px;
    left: -7px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red-bright), #8c0b1d);
    color: #ffffff;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.support-gate-icon svg {
    width: 14px;
    height: 14px;
}

.support-gate h3 {
    margin: 6px 0 0;
    font-size: 16px;
}

.support-gate p {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
}

.support-linkbtn {
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11.5px;
    cursor: pointer;
}

.support-linkbtn:hover {
    color: var(--red-ink);
}

.support-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 12px;
}

.support-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: supportSpin 800ms linear infinite;
}

.support-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 16px;
}

.support-error p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
}

.support-empty-note {
    padding: 24px 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
    text-align: center;
}

body.theme-light .support-drawer {
    background: linear-gradient(180deg, #ffffff 0%, #f4f4f4 100%);
    box-shadow: 30px 0 70px rgba(0, 0, 0, 0.18);
}

body.theme-light .support-scrim {
    background: rgba(10, 10, 10, 0.4);
}

body.theme-light .support-head,
body.theme-light .support-chat-head,
body.theme-light .support-composer {
    background: rgba(0, 0, 0, 0.02);
}

body.theme-light .support-avatar {
    background: radial-gradient(circle at 30% 20%, rgba(200, 16, 46, 0.16), transparent 70%), #ffffff;
}

body.theme-light .support-agent {
    background: #ffffff;
}

body.theme-light .support-agent:hover {
    background: #fafafa;
}

@keyframes supportPulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.78);
    }
}

@keyframes supportSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {
    .support-drawer {
        width: 100vw;
        border-right: 0;
    }

    .support-head {
        padding: 14px 14px calc(14px + env(safe-area-inset-top, 0px));
    }

    .support-scroll {
        padding: 16px 14px 22px;
    }

    .support-thread {
        padding: 14px 12px 8px;
    }

    .support-msg {
        max-width: 92%;
    }

    .support-composer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .support-composer-hint {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-drawer,
    .support-scrim,
    .chat-btn.has-support-unread::after,
    .support-pill i {
        transition: none;
        animation: none;
    }
}

/* ---------- support desk (agents) ---------- */
body.helpdesk-body {
    padding-top: 0;
    min-height: 100dvh;
}

.helpdesk-main {
    max-width: 1340px;
    min-height: 100dvh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.helpdesk-main > .gate-wrap {
    flex: 1;
}

.support-demo {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.support-demo strong {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11.5px;
}

.support-demo p {
    margin: 3px 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.8;
}

.support-demo code {
    display: inline-block;
    direction: ltr;
    color: var(--red-ink);
    font-family: inherit;
    font-weight: 700;
}

.helpdesk-shell {
    flex: 1;
    min-height: 540px;
    height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.helpdesk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.helpdesk-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.helpdesk-brand .gate-mark {
    margin: 0;
}

.helpdesk-agent {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.helpdesk-agent strong {
    font-size: 14.5px;
}

.helpdesk-agent span {
    color: var(--muted);
    font-size: 11px;
}

.helpdesk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.helpdesk-unread {
    padding: 5px 10px;
    border: 1px solid var(--red-soft);
    border-radius: 999px;
    background: rgba(225, 29, 46, 0.1);
    color: var(--red-ink);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.helpdesk-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
}

.helpdesk-inbox {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.015);
}

.helpdesk-inbox-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--line);
}

.helpdesk-inbox-head h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.helpdesk-inbox-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.helpdesk-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.helpdesk-search:focus-within {
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 14px var(--red-glow);
}

.helpdesk-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--muted);
}

.helpdesk-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    line-height: 38px;
    text-align: right;
}

.helpdesk-search input::placeholder {
    color: var(--muted);
}

.helpdesk-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--red-soft) transparent;
}

.helpdesk-list::-webkit-scrollbar,
.helpdesk-thread::-webkit-scrollbar {
    width: 6px;
}

.helpdesk-list::-webkit-scrollbar-thumb,
.helpdesk-thread::-webkit-scrollbar-thumb {
    background: var(--red-soft);
    border-radius: 999px;
}

.helpdesk-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: right;
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), box-shadow var(--ease);
}

.helpdesk-item:hover,
.helpdesk-item:focus-visible {
    outline: none;
    border-color: var(--line);
    background: var(--surface-strong);
}

.helpdesk-item.is-active {
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.08);
    box-shadow: inset -3px 0 0 var(--red);
}

.helpdesk-item.is-closed .helpdesk-item-preview {
    opacity: 0.6;
}

.helpdesk-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 15px;
}

.support-avatar.tone-1 {
    border-color: transparent;
    background: linear-gradient(135deg, var(--red-bright) 0%, #8c0b1d 100%);
    color: #ffffff;
}

.support-avatar.tone-2 {
    border-color: var(--red-soft);
    color: var(--red-ink);
}

.helpdesk-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.helpdesk-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.helpdesk-item-top strong {
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpdesk-item-time {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 9.5px;
}

.helpdesk-item-preview {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpdesk-item-foot {
    min-height: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.helpdesk-item-email {
    flex: 1;
    overflow: hidden;
    color: var(--muted);
    font-size: 9.5px;
    opacity: 0.8;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpdesk-empty {
    padding: 30px 18px;
    text-align: center;
}

.helpdesk-empty strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.helpdesk-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.9;
}

.helpdesk-chat {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.helpdesk-placeholder {
    max-width: 320px;
    margin: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.helpdesk-placeholder-mark {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: radial-gradient(circle at 30% 20%, var(--red-glow), transparent 70%), var(--surface);
    color: var(--red-ink);
}

.helpdesk-placeholder-mark svg {
    width: 28px;
    height: 28px;
}

.helpdesk-placeholder h2 {
    margin: 0;
    font-size: 17px;
}

.helpdesk-placeholder p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.9;
}

.helpdesk-thread-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.helpdesk-thread-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.helpdesk-back {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: none;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.helpdesk-back:hover,
.helpdesk-back:focus-visible {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 14px var(--red-glow);
}

.helpdesk-back svg {
    width: 17px;
    height: 17px;
}

.helpdesk-thread-who {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    text-align: right;
}

.helpdesk-thread-who strong {
    font-size: 13.5px;
}

.helpdesk-thread-who span {
    overflow: hidden;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.7;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpdesk-thread {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--red-soft) transparent;
}

.helpdesk-thread-empty {
    margin: auto;
    padding: 30px;
    text-align: center;
}

.helpdesk-thread-empty strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
}

.helpdesk-thread-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.9;
}

.helpdesk-msg {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    max-width: 80%;
}

.helpdesk-msg--in {
    align-self: flex-start;
}

.helpdesk-msg--out {
    align-self: flex-end;
}

.helpdesk-msg-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.helpdesk-msg--out .helpdesk-msg-body {
    align-items: flex-end;
}

.helpdesk-bubble {
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.95;
    text-align: right;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.helpdesk-msg--in .helpdesk-bubble {
    border-top-right-radius: 5px;
}

.helpdesk-msg--out .helpdesk-bubble {
    border-color: transparent;
    border-top-left-radius: 5px;
    background: linear-gradient(135deg, var(--red-bright) 0%, #a10f24 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px var(--red-glow);
}

.helpdesk-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.helpdesk-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    max-height: 140px;
    padding: 10px 13px;
    box-sizing: border-box;
    resize: none;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    line-height: 1.9;
    text-align: right;
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.helpdesk-composer textarea::placeholder {
    color: var(--muted);
}

.helpdesk-composer textarea:focus {
    border-color: var(--red);
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px var(--red-soft), 0 0 16px var(--red-glow);
}

.helpdesk-send {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--red-bright) 0%, #8c0b1d 100%);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--red-glow);
    transition: transform var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.helpdesk-send:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 0 0 1px var(--red-soft), 0 10px 24px var(--red-glow);
}

.helpdesk-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.helpdesk-send svg {
    width: 19px;
    height: 19px;
    transform: scaleX(-1);
}

@media (max-width: 900px) {
    .helpdesk-main {
        padding: 12px;
    }

    .helpdesk-shell {
        height: calc(100dvh - 24px);
        min-height: 0;
        border-radius: 18px;
    }

    .helpdesk-layout {
        grid-template-columns: 1fr;
    }

    .helpdesk-inbox {
        border-left: 0;
    }

    .helpdesk-chat {
        display: none;
    }

    .helpdesk-layout.is-thread-open .helpdesk-inbox {
        display: none;
    }

    .helpdesk-layout.is-thread-open .helpdesk-chat {
        display: flex;
    }

    .helpdesk-back {
        display: grid;
    }

    .helpdesk-thread-head {
        padding: 10px 12px;
    }

    .helpdesk-thread-head .btn {
        padding: 6px 9px;
        min-height: 34px;
        font-size: 11px;
    }

    .helpdesk-thread {
        padding: 14px 12px 10px;
    }

    .helpdesk-msg {
        max-width: 92%;
    }

    .helpdesk-composer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 600px) {
    .helpdesk-brand .gate-mark {
        display: none;
    }

    .helpdesk-actions .btn {
        padding: 6px 9px;
        min-height: 34px;
        font-size: 11px;
    }

    .helpdesk-unread {
        order: -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .helpdesk-item,
    .helpdesk-send {
        transition: none;
    }

    .helpdesk-send:hover:not(:disabled) {
        transform: none;
    }
}

/* ---------- lottery page ---------- */
.lottery-main {
    padding-bottom: 44px;
}

.lottery-head {
    max-width: 660px;
    margin: 8px auto 26px;
    text-align: center;
}

.lottery-head h1 {
    margin: 6px 0 10px;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.35;
}

.lottery-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 2.1;
}

.lottery-board {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: clamp(20px, 4vw, 44px);
    align-items: center;
    padding: clamp(18px, 3vw, 34px);
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--panel);
    backdrop-filter: blur(18px);
}

.lottery-stage {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, 420px);
    aspect-ratio: 1;
    margin: 0 auto;
}

.lottery-stage::before {
    content: "";
    position: absolute;
    inset: -5%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(225, 29, 46, 0.18), transparent 66%);
    pointer-events: none;
}

.wheel-pointer {
    position: absolute;
    top: -8px;
    left: 50%;
    z-index: 3;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid var(--red);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.wheel-disc {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid rgba(0, 0, 0, 0.28);
    box-shadow:
        0 0 0 8px rgba(255, 255, 255, 0.06),
        0 26px 54px rgba(0, 0, 0, 0.38),
        inset 0 0 60px rgba(0, 0, 0, 0.4);
    transform: rotate(0deg);
    will-change: transform;
}

body.theme-light .wheel-disc {
    border-color: #121212;
    box-shadow:
        0 0 0 8px rgba(0, 0, 0, 0.06),
        0 26px 54px rgba(0, 0, 0, 0.22),
        inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.wheel-labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.wheel-label {
    position: absolute;
    inset: 0;
}

.wheel-label > span {
    position: absolute;
    top: 8.5%;
    left: 50%;
    width: 38%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: clamp(9px, 1.15vw, 12.5px);
    font-weight: 600;
    line-height: 1.55;
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.wheel-hub {
    position: absolute;
    inset: 37.5%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 26%, #ffffff, #eaeaea 46%, #a4a4a4 100%);
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.45),
        inset 0 0 0 4px rgba(0, 0, 0, 0.08);
    color: #a8102a;
    font-size: clamp(10px, 1.3vw, 15px);
    font-weight: 800;
    letter-spacing: 0.06em;
    z-index: 2;
}

.lottery-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.lottery-spin {
    width: 100%;
    padding: 15px 24px;
    font-size: 15px;
}

.lottery-cooldown {
    margin: 0;
    padding: 11px 16px;
    border: 1px solid rgba(225, 29, 46, 0.3);
    border-radius: 14px;
    background: rgba(225, 29, 46, 0.08);
    color: var(--red-ink);
    font-size: 13px;
    line-height: 1.9;
}

.lottery-note {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 2.05;
}

.lottery-win {
    position: relative;
    margin-top: 26px;
    padding: clamp(22px, 3vw, 34px);
    border: 1px solid rgba(225, 29, 46, 0.35);
    border-radius: 24px;
    background:
        radial-gradient(90% 120% at 50% 0%, rgba(225, 29, 46, 0.16), transparent 62%),
        var(--panel);
    text-align: center;
    animation: lotteryWinIn 0.55s ease both;
}

.lottery-win[hidden] {
    display: none;
}

@keyframes lotteryWinIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

.win-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--red-bright), #a10f24);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.lottery-win h2 {
    margin: 13px 0 8px;
    font-size: clamp(22px, 3vw, 31px);
    line-height: 1.4;
}

.lottery-win p {
    max-width: 560px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 2.05;
}

.lottery-win p[hidden] {
    display: none;
}

.win-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
    margin-top: 15px;
    color: var(--muted);
    font-size: 12px;
}

.win-next {
    margin-top: 10px !important;
    color: var(--red-ink) !important;
    font-size: 12.5px !important;
}

@media (max-width: 900px) {
    .lottery-board {
        grid-template-columns: 1fr;
    }

    .lottery-stage {
        max-width: 372px;
    }
}

@media (max-width: 560px) {
    .lottery-stage {
        max-width: 296px;
    }

    .wheel-label > span {
        width: 42%;
        font-size: 9.5px;
    }

    .wheel-hub {
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lottery-win {
        animation: none;
    }
}

/* ---------- receipt facts and AI pre-check ---------- */
.receipt-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    margin: 14px 0 6px;
}

.receipt-facts .field {
    margin: 0;
}

.receipt-ai-hint {
    margin: 8px 0 14px;
    padding: 8px 12px;
    border-inline-start: 3px solid var(--red);
    border-radius: 8px;
    background: var(--surface);
}

.receipt-ai-hint[data-state="pass"] {
    border-inline-start-color: var(--text);
}

.payment-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin: 0 0 10px;
}

.payment-facts > div {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.payment-facts span {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
}

.payment-facts b {
    font-size: 12.5px;
    word-break: break-word;
}

.ai-report {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-strong);
}

.ai-report[data-state="fail"] {
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.06);
}

.ai-report-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.ai-chip[data-state="pass"] {
    border-color: rgba(17, 17, 17, 0.35);
    background: rgba(17, 17, 17, 0.06);
}

.ai-chip[data-state="review"] {
    border-color: rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.12);
    color: #8a5b06;
}

.ai-chip[data-state="fail"] {
    border-color: var(--red-soft);
    background: rgba(225, 29, 46, 0.12);
    color: var(--red-ink);
}

.ai-score {
    color: var(--muted);
    font-size: 11.5px;
}

.ai-summary {
    margin: 0 0 6px;
    font-size: 12.5px;
    line-height: 1.8;
}

.ai-checks {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-checks li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
    line-height: 1.75;
}

.ai-dot {
    flex: none;
    width: 7px;
    height: 7px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--red);
}

.ai-checks li.is-ok .ai-dot {
    background: #16a34a;
}

.ai-checks li.is-bad span:last-child {
    color: var(--red-ink);
}

.review-by {
    margin: 0;
    font-size: 11.5px;
}

/* ---------- support desk payment queue ---------- */
.helpdesk-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.helpdesk-switch button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.helpdesk-switch button.is-active {
    background: var(--red);
    color: #fff;
}

.support-count {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 10.5px;
    line-height: 1.6;
}

.helpdesk-switch button:not(.is-active) .support-count {
    background: rgba(225, 29, 46, 0.14);
    color: var(--red-ink);
}

.helpdesk-payments {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px clamp(14px, 3vw, 28px) 26px;
}

.helpdesk-payments-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.helpdesk-payments-head h1 {
    margin: 0 0 2px;
    font-size: 18px;
}

.helpdesk-payments-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.support-payments {
    display: grid;
    gap: 14px;
}

.support-pay-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
}

.support-pay-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 12px;
}

.support-pay-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-inline-end: auto;
}

.support-pay-title strong {
    font-size: 14px;
}

.support-pay-body {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
}

.support-pay-side {
    flex: 1 1 320px;
    min-width: 0;
}

.support-pay-side .review-actions {
    margin-top: 10px;
}

@media (max-width: 720px) {
    .receipt-facts {
        grid-template-columns: 1fr;
    }

    .helpdesk-switch {
        order: 3;
        width: 100%;
    }

    .helpdesk-switch button {
        flex: 1;
        justify-content: center;
    }

    .support-pay-side .review-note-input {
        flex-basis: 100%;
    }

    .support-pay-side .review-actions .btn {
        flex: 1 1 0;
    }
}
