/* ---------------------------------------------------------------------------
   Member purchase + request history.
   Additive only — no existing public-site selector is redefined.
   Theme-aware: colours come from the public CSS variables where available.
   --------------------------------------------------------------------------- */

.hidden { display: none !important; }

/* ---------------- purchase page ---------------- */

.mp-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 56px;
}

.mp-breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 18px;
    opacity: 0.8;
}

.mp-breadcrumb a { text-decoration: none; }
.mp-breadcrumb a:hover { text-decoration: underline; }

.mp-loading,
.mp-blocked {
    padding: 22px;
    border-radius: 14px;
    background: var(--surface-2, rgba(0, 0, 0, 0.04));
    text-align: center;
}

.mp-blocked {
    border: 1px solid var(--cl-accent, #d97706);
}

.mp-blocked-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
}

.mp-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.mp-card {
    background: var(--surface-1, #fff);
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.1));
    border-radius: 16px;
    padding: 22px;
}

.mp-card h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.mp-plan {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-2, rgba(0, 0, 0, 0.04));
    margin-bottom: 16px;
}

.mp-plan-name { font-weight: 700; }
.mp-plan-price { font-size: 1.25rem; font-weight: 800; color: var(--cl-accent, #d97706); }
.mp-plan-duration { opacity: 0.7; font-size: 0.85rem; }

.mp-qr {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.mp-qr img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
}

.mp-instructions {
    white-space: pre-wrap;
    margin: 0 0 16px;
    font-size: 0.92rem;
    line-height: 1.55;
}

.mp-details { margin: 0; }

.mp-detail {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border-subtle, rgba(0, 0, 0, 0.12));
}

.mp-detail dt {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.65;
    margin: 0;
}

.mp-detail dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
    word-break: break-all;
}

/* ---------------- form ---------------- */

.mp-hint { opacity: 0.75; font-size: 0.88rem; margin: 0 0 16px; }

.mp-field { margin-bottom: 16px; }

.mp-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.mp-field input[type="text"],
.mp-field input[type="file"],
.mp-field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.18));
    background: var(--surface-1, #fff);
    color: inherit;
    font: inherit;
}

.mp-field input:focus-visible,
.mp-field textarea:focus-visible,
.mp-submit:focus-visible,
.mr-action:focus-visible {
    outline: 2px solid var(--cl-accent, #d97706);
    outline-offset: 2px;
}

.mp-req { color: #dc2626; }
.mp-optional { opacity: 0.6; font-weight: 400; font-size: 0.78rem; }

.mp-error {
    display: block;
    margin-top: 5px;
    color: #dc2626;
    font-size: 0.82rem;
    min-height: 1em;
}

.mp-thumb { margin-top: 10px; }

.mp-thumb img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 10px;
    display: block;
}

.mp-submit {
    display: inline-block;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--cl-accent, #d97706);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.mp-submit[disabled] { opacity: 0.6; cursor: not-allowed; }

.mp-submit--ghost {
    width: auto;
    background: transparent;
    color: inherit;
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.2));
}

/* ---------------- request history ---------------- */

.mr-section {
    max-width: 1080px;
    margin: 32px auto 0;
    padding: 0 20px 48px;
}

.mr-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mr-head h2 { margin: 0; font-size: 1.15rem; }

.mr-banner {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.mr-banner.is-pending {
    background: rgba(217, 119, 6, 0.12);
    border-color: rgba(217, 119, 6, 0.4);
}

.mr-empty { opacity: 0.7; padding: 18px 0; }

.mr-card {
    background: var(--surface-1, #fff);
    border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.1));
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
}

.mr-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.mr-plan { margin: 0; font-size: 1.02rem; }
.mr-sub { margin: 2px 0 0; opacity: 0.7; font-size: 0.86rem; }

.mr-pill {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}

.mr-pill.is-pending   { background: rgba(217, 119, 6, 0.14);  color: #b45309; border-color: rgba(217, 119, 6, 0.4); }
.mr-pill.is-approved  { background: rgba(22, 163, 74, 0.14);  color: #15803d; border-color: rgba(22, 163, 74, 0.4); }
.mr-pill.is-rejected  { background: rgba(220, 38, 38, 0.14);  color: #b91c1c; border-color: rgba(220, 38, 38, 0.4); }
.mr-pill.is-info      { background: rgba(56, 130, 246, 0.14); color: #1d4ed8; border-color: rgba(56, 130, 246, 0.4); }
.mr-pill.is-cancelled { background: rgba(120, 120, 130, 0.16); color: #4b5563; border-color: rgba(120, 120, 130, 0.4); }

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

.mr-facts dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
}

.mr-facts dd { margin: 2px 0 0; font-weight: 600; }

.mr-note {
    border-left: 3px solid var(--border-subtle, rgba(0, 0, 0, 0.2));
    padding: 10px 14px;
    border-radius: 0 10px 10px 0;
    background: var(--surface-2, rgba(0, 0, 0, 0.035));
    margin-bottom: 12px;
}

.mr-note.is-info { border-left-color: #2563eb; }

.mr-note-k {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.65;
    margin-bottom: 3px;
}

.mr-note p { margin: 0; white-space: pre-wrap; }

/* ---------------- timeline ---------------- */

.mr-timeline {
    list-style: none;
    margin: 4px 0 12px;
    padding: 0 0 0 6px;
}

.mr-tl-item {
    position: relative;
    padding: 0 0 16px 22px;
    border-left: 2px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
}

.mr-tl-item:last-child { padding-bottom: 0; border-left-color: transparent; }

.mr-tl-dot {
    position: absolute;
    left: -7px;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface-1, #fff);
    border: 2px solid #9ca3af;
}

.mr-tl-item.is-member .mr-tl-dot { border-color: var(--cl-accent, #d97706); }
.mr-tl-item.is-admin .mr-tl-dot  { border-color: #2563eb; }

.mr-tl-label { font-weight: 600; font-size: 0.9rem; }

.mr-tl-time {
    display: block;
    font-size: 0.76rem;
    opacity: 0.65;
    margin-top: 1px;
}

.mr-tl-note {
    margin: 5px 0 0;
    font-size: 0.86rem;
    white-space: pre-wrap;
    opacity: 0.9;
}

.mr-action {
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--cl-accent, #d97706);
    background: transparent;
    color: var(--cl-accent, #d97706);
    font-weight: 700;
    cursor: pointer;
}

/* ---------------- resubmit dialog ---------------- */

.mr-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 1000;
}

.mr-dialog[hidden] { display: none; }

.mr-dialog-inner {
    background: var(--surface-1, #fff);
    border-radius: 16px;
    padding: 22px;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}

.mr-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.mr-dialog-head h3 { margin: 0; font-size: 1.05rem; }

.mr-dialog-close {
    background: none;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.mr-dialog-prompt {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(56, 130, 246, 0.1);
    font-size: 0.88rem;
    white-space: pre-wrap;
}

.mr-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.mr-dialog-actions .mp-submit { width: auto; }

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
    .mp-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
    .mp-detail,
    .mr-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .mp-detail dd { text-align: left; }
    .mr-dialog-actions { flex-direction: column-reverse; }
    .mr-dialog-actions .mp-submit { width: 100%; }
}

@media (prefers-color-scheme: dark) {
    .mp-card,
    .mr-card,
    .mr-dialog-inner {
        background: var(--surface-1, #12161f);
        border-color: rgba(255, 255, 255, 0.09);
    }

    .mp-field input[type="text"],
    .mp-field input[type="file"],
    .mp-field textarea {
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.14);
    }

    .mr-pill.is-pending   { color: #f0a13a; }
    .mr-pill.is-approved  { color: #4ade80; }
    .mr-pill.is-rejected  { color: #f87171; }
    .mr-pill.is-info      { color: #7cb0ff; }
    .mr-pill.is-cancelled { color: #b6b9c2; }
}
