.shop-container {
    padding-bottom: 64px;
}

.token-header {
    align-items: center;
}

.shop-header-actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.token-balance-card {
    min-width: 170px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.token-balance-button {
    appearance: none;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.token-balance-button:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
}

.token-balance-button:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 68%, white);
    outline-offset: 2px;
}

.owned-purchases-trigger.is-loading .token-balance-value,
.owned-purchases-trigger.is-empty .token-balance-value {
    color: var(--text-main);
}

.owned-purchases-trigger.is-error .token-balance-value {
    color: #f87171;
}

.owned-purchases-trigger:not(.is-empty):not(.is-error) {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}

.token-balance-label {
    font-size: 0.72rem;
    color: var(--text-sub);
    font-weight: 700;
}

.token-balance-value {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 800;
}

.owned-purchases-box {
    margin-bottom: 18px;
}

.owned-purchases-head {
    align-items: flex-start;
    gap: 14px;
}

.owned-purchases-summary {
    font-size: 0.8rem;
    color: var(--text-sub);
    text-align: right;
    white-space: nowrap;
}

.owned-purchases-status {
    margin: 2px 0 12px;
    min-height: 1.1rem;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.owned-purchases-status.is-success {
    color: #34d399;
}

.owned-purchases-status.is-error {
    color: #f87171;
}

.owned-purchases-table .shop-empty {
    text-align: center;
}

.shop-purchase-expiry {
    margin-top: 4px;
    color: var(--text-sub);
    font-size: 0.75rem;
    font-weight: 700;
}

.shop-status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.shop-status-chip.status-purchased {
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.12);
}

.shop-status-chip.status-requested {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.12);
}

.shop-status-chip.status-approved {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.12);
}

.shop-status-chip.status-rejected {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.12);
}

.shop-status-chip.status-refund-requested {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.15);
}

.shop-status-chip.status-refund-approved {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.15);
}

.shop-status-chip.status-refund-rejected {
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.42);
    background: rgba(244, 63, 94, 0.14);
}

.owned-purchase-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.filter-tabs {
    margin-bottom: 16px;
}

.weekly-supply-notice {
    margin: -4px 0 18px;
    border: 1px solid rgba(251, 191, 36, 0.32);
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(34, 197, 94, 0.08));
}

.weekly-supply-notice[hidden] {
    display: none;
}

.weekly-supply-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.weekly-supply-head strong {
    display: block;
    margin-top: 2px;
    font-size: 1rem;
}

.weekly-supply-head p {
    margin: 4px 0 0;
    color: var(--text-sub);
    font-size: 0.84rem;
    line-height: 1.45;
}

.weekly-supply-head em {
    align-self: flex-start;
    white-space: nowrap;
    color: #fbbf24;
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 800;
}

.weekly-supply-kicker {
    display: inline-flex;
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
}

.weekly-supply-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.weekly-supply-stats span {
    display: grid;
    gap: 3px;
    min-height: 58px;
    padding: 10px;
    border: 1px solid rgba(251, 191, 36, 0.22);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.weekly-supply-stats small {
    color: var(--text-sub);
    font-size: 0.72rem;
    font-weight: 800;
}

.weekly-supply-stats strong {
    color: #fbbf24;
    font-size: 0.95rem;
}

.weekly-supply-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.weekly-supply-list article {
    display: grid;
    gap: 5px;
    padding: 11px;
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.08);
}

.weekly-supply-list strong {
    font-size: 0.9rem;
}

.weekly-supply-list span,
.weekly-supply-list p {
    margin: 0;
    color: var(--text-sub);
    font-size: 0.78rem;
    line-height: 1.4;
}

.price-lesson-notice {
    margin: -4px 0 18px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(16, 185, 129, 0.08));
}

.price-lesson-notice[hidden] {
    display: none;
}

.price-lesson-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.price-lesson-head strong {
    display: block;
    margin-top: 2px;
    font-size: 1rem;
}

.price-lesson-head p {
    margin: 4px 0 0;
    color: var(--text-sub);
    font-size: 0.84rem;
    line-height: 1.45;
}

.price-lesson-head em {
    align-self: flex-start;
    white-space: nowrap;
    color: #7dd3fc;
    font-size: 0.78rem;
    font-style: normal;
    font-weight: 800;
}

.price-lesson-kicker {
    display: inline-flex;
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 800;
}

.price-lesson-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.price-lesson-list article {
    position: relative;
    min-height: 112px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.38);
}

.price-lesson-list article[data-direction="up"] {
    border-color: rgba(251, 146, 60, 0.34);
}

.price-lesson-list article[data-direction="down"] {
    border-color: rgba(52, 211, 153, 0.34);
}

.price-lesson-list strong,
.price-lesson-list span {
    display: block;
}

.price-lesson-list strong {
    padding-right: 42px;
    font-size: 0.92rem;
    line-height: 1.35;
}

.price-lesson-list span {
    margin-top: 7px;
    color: var(--accent);
    font-weight: 800;
}

.price-lesson-list p {
    margin: 7px 0 0;
    color: var(--text-sub);
    font-size: 0.78rem;
    line-height: 1.45;
}

.price-lesson-list em {
    position: absolute;
    top: 10px;
    right: 10px;
    border-radius: 999px;
    padding: 3px 7px;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.18);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
}

.price-lesson-list article[data-direction="up"] em {
    color: #fed7aa;
    background: rgba(251, 146, 60, 0.18);
}

.price-lesson-list article[data-direction="down"] em {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.18);
}

.avatar-filter-bar {
    margin: -6px 0 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.avatar-filter-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.avatar-filter-item .shop-select {
    min-width: 130px;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.item-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

.item-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}

.item-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.item-tag {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 700;
}

.item-tag-meta {
    margin-top: -2px;
    font-size: 0.68rem;
    color: var(--text-sub);
    font-weight: 600;
}

.item-name {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
}

.item-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    color: var(--accent);
    font-weight: 800;
}

.item-price span {
    margin-left: auto;
    font-size: 0.74rem;
    color: var(--text-sub);
    font-weight: 600;
}

.item-validity {
    color: var(--text-sub);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.35;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.76);
    backdrop-filter: blur(6px);
    z-index: 2000;
    padding: 16px;
}

.modal-box {
    width: min(520px, 100%);
    max-height: min(720px, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    padding: 18px;
}

.owned-purchases-modal-box {
    width: min(960px, 100%);
}

.owned-purchases-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.owned-purchases-modal-title {
    margin: 0;
    font-size: 1.2rem;
}

.owned-purchases-modal-copy {
    margin: 8px 0 0;
    color: var(--text-sub);
    line-height: 1.5;
}

.modal-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 12px;
}

.modal-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
}

.modal-meta-validity {
    max-width: 180px;
    text-align: right;
}

.modal-meta-label {
    font-size: 0.72rem;
    color: var(--text-sub);
    font-weight: 700;
}

.modal-meta-value {
    font-size: 1rem;
    font-weight: 800;
}

.modal-purchase-status {
    min-height: 22px;
    margin: -4px 0 8px;
    color: var(--text-sub);
    font-size: 0.9rem;
    line-height: 1.45;
}

.modal-purchase-status.is-error {
    color: #fca5a5;
}

.modal-purchase-status.is-info {
    color: #93c5fd;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    padding-top: 12px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0), var(--card-bg) 32%);
}

.modal-actions .btn {
    flex: 1;
}

@media (max-width: 900px) {
    .owned-purchases-head {
        flex-direction: column;
    }

    .owned-purchases-summary {
        text-align: left;
        white-space: normal;
    }

    .shop-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .token-balance-card {
        width: 100%;
    }

    .weekly-supply-head,
    .price-lesson-head {
        flex-direction: column;
    }

    .weekly-supply-head em,
    .price-lesson-head em {
        align-self: flex-start;
    }

    .weekly-supply-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 820px) {
    .modal-box {
        max-height: calc(100vh - 16px);
        padding-bottom: 16px;
    }

    .modal-img {
        aspect-ratio: 16 / 10;
    }
}
