:root {
    --canvas: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #111827;
    --ink-soft: #4b5563;
    --muted: #7a8594;
    --line: #e3e7ee;
    --line-strong: #cfd6df;
    --blue: #2457d6;
    --blue-hover: #1f49b4;
    --blue-soft: #eef4ff;
    --green: #0f8f61;
    --green-soft: #edfdf5;
    --amber: #a26207;
    --amber-soft: #fff7e8;
    --red: #c93737;
    --red-soft: #fff0f0;
    --shadow: 0 18px 44px rgba(17, 24, 39, .08);
    --radius: 8px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.shell {
    width: min(100% - 32px, 520px);
    margin: 0 auto;
    padding: 34px 0 48px;
}

.admin-page .shell {
    width: min(100% - 32px, 1120px);
}

.auth-page {
    background:
        radial-gradient(circle at top, rgba(36, 87, 214, .08), transparent 34rem),
        var(--canvas);
}

body.auth-page .shell {
    display: grid;
    align-content: center;
    width: min(100% - 48px, 600px);
    min-height: 100vh;
    padding: 28px 0;
}

.app-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    margin: 0;
    color: var(--ink);
    font-size: clamp(28px, 8vw, 38px);
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
}

.brand span { color: var(--blue); }

.net-state {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #cbd9ff;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 13px;
    font-weight: 600;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 26px;
}

.hidden { display: none !important; }

.section-label {
    display: inline-flex;
    margin-bottom: 10px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.panel-head {
    margin-bottom: 22px;
}

.panel-head h2,
.admin-bar h2,
.status-panel h2 {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    line-height: 1.22;
    letter-spacing: 0;
}

.panel-head p {
    margin: 9px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.65;
}

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

label {
    display: grid;
    gap: 8px;
}

label > span {
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
}

input {
    width: 100%;
    min-height: 54px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    padding: 0 14px;
    outline: 0;
    font-size: 16px;
    font-weight: 500;
}

input::placeholder { color: #a3adba; }

input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(36, 87, 214, .12);
}

.primary-button,
.gold-button,
.ghost-button,
.file-button,
.approve-button,
.reject-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.primary-button {
    width: 100%;
    min-height: 54px;
    background: var(--blue);
    color: #fff;
}

.primary-button:hover { background: var(--blue-hover); }

.primary-button:disabled {
    opacity: .6;
    cursor: wait;
}

.status-panel {
    padding: 28px;
}

.status-panel h2 {
    max-width: 560px;
    margin: 0 0 14px;
}

.status-chip,
.status-pill,
.timer,
.notify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
}

.status-chip {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
}

.status-chip i,
.notify i.hot { color: var(--blue); }

.status-chip[data-mode="approved"] i { color: var(--green); }
.status-chip[data-mode="rejected"] i { color: var(--red); }

.access-link {
    margin: 20px 0 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    text-align: left;
}

.access-link > span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.access-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
}

.access-link-row a {
    display: block;
    min-height: 42px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--blue);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.access-link-row a:hover {
    text-decoration: underline;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
}

.copy-button:hover,
.copy-button.is-copied {
    border-color: #cbd9ff;
    background: var(--blue-soft);
    color: var(--blue);
}

.bank-copy {
    margin: 20px 0 22px;
    max-width: 560px;
    color: var(--ink-soft);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.8;
}

.timer {
    min-height: 40px;
    margin: 0 0 18px;
    padding: 0 14px;
    border-color: #f2d39b;
    border-radius: 999px;
    background: var(--amber-soft);
    color: var(--amber);
}

.qr-wrap {
    width: min(100%, 320px);
    aspect-ratio: 1;
    margin: 0 auto 20px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

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

.message,
.alert,
.empty-state {
    margin: 16px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
}

.message[data-type="error"],
.alert.is-error { color: var(--red); }

.alert.is-ok { color: var(--green); }

.auth-panel {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 34px;
    box-shadow: 0 22px 64px rgba(17, 24, 39, .1);
}

.auth-page .app-top {
    width: 100%;
    margin-bottom: 24px;
}

.auth-page .brand {
    font-size: 36px;
}

.auth-page .net-state {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

.auth-panel .panel-head {
    margin-bottom: 26px;
}

.auth-panel .panel-head h2 {
    font-size: 26px;
}

.auth-panel .panel-head p {
    max-width: none;
}

.auth-panel .form-stack {
    gap: 18px;
}

.auth-panel input {
    min-height: 54px;
    background: var(--surface-soft);
}

.auth-panel .primary-button {
    margin-top: 4px;
    box-shadow: 0 10px 24px rgba(36, 87, 214, .18);
}

.admin-panel {
    padding: 22px;
}

.admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.admin-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.notify {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
}

.notify i {
    color: #cbd2dc;
    font-size: 9px;
}

.ghost-button {
    min-height: 38px;
    padding: 0 12px;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.ghost-button:hover {
    background: var(--surface-soft);
}

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

.request-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 286px;
    gap: 18px;
    align-items: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.request-main {
    min-width: 0;
}

.request-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.request-title > strong {
    min-width: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.request-grid {
    display: grid;
    grid-template-columns: .7fr 1fr .8fr;
    gap: 14px;
    min-width: 0;
}

.request-grid div { min-width: 0; }

.request-grid span,
.member-url span,
.qr-preview > span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.request-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
    overflow-wrap: anywhere;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.member-url {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.member-url a {
    display: block;
    margin-top: 5px;
    color: var(--blue);
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-decoration: none;
}

.member-url a:hover {
    text-decoration: underline;
}

.qr-preview {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.qr-thumb {
    display: inline-grid;
    grid-template-columns: 54px auto;
    align-items: center;
    gap: 10px;
    max-width: 220px;
    min-height: 66px;
    margin-top: 7px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    font-weight: 650;
}

.qr-thumb img {
    width: 54px;
    height: 54px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    object-fit: cover;
}

.qr-thumb span {
    font-size: 13px;
}

.status-pill {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
}

.status-pill.is-new,
.status-pill.is-processing {
    border-color: #f2d39b;
    background: var(--amber-soft);
    color: var(--amber);
}

.status-pill.is-approved {
    border-color: #b7ebd0;
    background: var(--green-soft);
    color: var(--green);
}

.status-pill.is-rejected {
    border-color: #f2bcbc;
    background: var(--red-soft);
    color: var(--red);
}

.admin-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.admin-card-actions form { margin: 0; }

.gold-button,
.file-button,
.approve-button,
.reject-button {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
}

.gold-button {
    border-color: #f2d39b;
    background: var(--amber-soft);
    color: var(--amber);
}

.file-button {
    position: relative;
    border-color: #cbd9ff;
    background: var(--blue-soft);
    color: var(--blue);
}

.file-button input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-progress {
    display: none;
    grid-column: 1 / -1;
    position: relative;
    height: 32px;
    overflow: hidden;
    border: 1px solid #cbd9ff;
    border-radius: var(--radius);
    background: var(--surface);
}

.upload-progress.is-active {
    display: block;
}

.upload-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(36, 87, 214, .2), rgba(36, 87, 214, .45));
    transition: width .18s ease;
}

.upload-progress strong {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    overflow: hidden;
    padding: 0 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.upload-progress.is-error {
    border-color: #f2bcbc;
    background: var(--red-soft);
}

.upload-progress.is-error .upload-progress-bar {
    width: 100%;
    background: rgba(201, 55, 55, .18);
}

.upload-progress.is-error strong {
    color: var(--red);
}

.upload-note {
    grid-column: 1 / -1;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.upload-note[data-type="ok"] {
    color: var(--green);
}

.upload-note[data-type="warn"] {
    color: var(--amber);
}

.upload-note[data-type="error"] {
    color: var(--red);
}

.approve-button {
    border-color: #b7ebd0;
    background: var(--green-soft);
    color: var(--green);
}

.reject-button {
    border-color: #f2bcbc;
    background: var(--red-soft);
    color: var(--red);
}

.qr-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.qr-modal.is-open {
    display: flex;
}

.qr-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .52);
}

.qr-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 520px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
    padding: 18px;
}

.qr-modal-dialog header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.qr-modal-dialog h2 {
    margin: 0;
    font-size: 18px;
}

.qr-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--ink);
    cursor: pointer;
}

.qr-modal-dialog img {
    display: block;
    width: 100%;
    max-height: 68vh;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    object-fit: contain;
}

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

    .admin-card-actions {
        width: min(100%, 360px);
    }
}

@media (max-width: 560px) {
    .shell,
    .admin-page .shell {
        width: min(100% - 24px, 1120px);
        padding-top: 22px;
    }

    body.auth-page .shell {
        width: min(100% - 24px, 600px);
        padding: 22px 0;
    }

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

    .auth-panel {
        padding: 22px;
    }

    .app-top {
        margin-bottom: 16px;
    }

    .net-state {
        display: none;
    }

    .panel-head h2,
    .admin-bar h2,
    .status-panel h2 {
        font-size: 22px;
    }

    .admin-bar {
        align-items: flex-start;
    }

    .admin-actions {
        flex-direction: column;
        align-items: flex-end;
    }

    .request-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .request-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .admin-card-actions {
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }
}
