:root {
    color-scheme: dark;
    --bg: #080817;
    --sidebar: #0e0e23;
    --panel: rgba(18, 18, 42, 0.88);
    --panel-strong: #151532;
    --line: rgba(255, 255, 255, 0.085);
    --text: #f8fafc;
    --muted: #929bb1;
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --accent: #38bdf8;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 84% 8%, rgba(124, 58, 237, 0.14), transparent 28%),
        radial-gradient(circle at 45% 85%, rgba(56, 189, 248, 0.08), transparent 30%),
        var(--bg);
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 26px 18px;
    border-right: 1px solid var(--line);
    background: rgba(11, 11, 29, 0.92);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 8px 32px;
    color: #fff;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}

.brand strong { color: #a5b4fc; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(135deg, #6366f1, #9333ea);
    font-weight: 950;
    box-shadow: 0 12px 28px rgba(99, 102, 241, .3);
}

.sidebar-nav { display: grid; gap: 7px; }
.nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    font-weight: 750;
    cursor: pointer;
    text-align: left;
}

.nav-button:hover,
.nav-button.active {
    border-color: rgba(167, 139, 250, .17);
    background: rgba(124, 58, 237, .12);
    color: #fff;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .055);
    color: #a5b4fc;
    font-size: 10px;
    font-weight: 900;
}

.nav-count {
    min-width: 24px;
    margin-left: auto;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(251, 191, 36, .15);
    color: #fde68a;
    font-size: 11px;
    text-align: center;
}

.sidebar-help {
    display: grid;
    gap: 7px;
    margin-top: auto;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .035);
}

.sidebar-help strong { font-size: 12px; }
.sidebar-help span { color: var(--muted); font-size: 11px; line-height: 1.6; }

.main { min-width: 0; padding: 30px clamp(20px, 4vw, 52px) 70px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.eyebrow,
.panel-kicker {
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.topbar h1 { margin: 5px 0 0; font-size: clamp(28px, 4vw, 43px); letter-spacing: -.05em; }
.admin-identity { display: flex; align-items: center; gap: 16px; text-align: right; }
.admin-identity div { display: grid; }
.admin-identity span { color: var(--muted); font-size: 11px; }
.admin-identity a,
.access-panel a {
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.global-message {
    min-height: 0;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 13px;
}
.global-message.success,
.global-message.error {
    min-height: auto;
    padding: 12px 14px;
    border-radius: 12px;
}
.global-message.success { background: rgba(52, 211, 153, .1); color: #a7f3d0; }
.global-message.error { background: rgba(251, 113, 133, .1); color: #fecdd3; }

.access-panel {
    max-width: 620px;
    margin: 12vh auto;
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    text-align: center;
}
.access-code { color: #fda4af; font-size: 12px; font-weight: 900; letter-spacing: .15em; }
.access-panel h2 { margin: 8px 0; font-size: 28px; }
.access-panel p { margin: 0 0 24px; color: var(--muted); line-height: 1.7; }

.view { display: none; }
.view.active { display: block; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 22px 55px rgba(0, 0, 0, .19);
    backdrop-filter: blur(18px);
}

.metric-card {
    min-height: 160px;
    padding: 21px;
    border-radius: 20px;
}
.metric-card-primary {
    background:
        radial-gradient(circle at 90% 5%, rgba(56, 189, 248, .22), transparent 44%),
        linear-gradient(145deg, rgba(99, 102, 241, .22), rgba(18, 18, 42, .92));
}
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.metric-card strong { display: block; margin: 18px 0 5px; font-size: 38px; letter-spacing: -.05em; }
.metric-card small { color: var(--muted); font-size: 11px; }

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 18px;
    margin-bottom: 18px;
}

.panel { padding: 22px; border-radius: 21px; margin-bottom: 18px; }
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 19px;
}
.panel-heading h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.025em; }
.panel-heading-wrap { flex-wrap: wrap; }
.text-button {
    border: 0;
    background: none;
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.revenue-grid { display: grid; gap: 10px; }
.revenue-grid div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 13px;
    background: rgba(255, 255, 255, .03);
}
.revenue-grid span { color: var(--muted); font-size: 12px; }
.revenue-grid strong { font-size: 20px; }

.workflow-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.workflow-list li { display: flex; align-items: center; gap: 12px; color: #d7dbea; font-size: 13px; line-height: 1.55; }
.workflow-list span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: rgba(124, 58, 237, .16);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 900;
}

.compact-list,
.payment-grid { display: grid; gap: 11px; }
.empty-state {
    padding: 36px 18px;
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 15px;
    color: var(--muted);
    text-align: center;
}
.compact-payment {
    display: grid;
    grid-template-columns: 1.4fr .8fr .8fr auto;
    align-items: center;
    gap: 14px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 13px;
    background: rgba(255, 255, 255, .025);
}
.compact-payment span { color: var(--muted); font-size: 11px; }
.compact-payment strong { display: block; margin-top: 2px; font-size: 13px; }

.search-form { display: flex; gap: 8px; }
.search-form input,
.credit-form input,
.credit-form textarea {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: none;
    background: rgba(7, 7, 22, .55);
    color: #fff;
}
.search-form input { width: min(310px, 55vw); }
.search-form input:focus,
.credit-form input:focus,
.credit-form textarea:focus { border-color: rgba(56, 189, 248, .42); }
.search-form button,
.pagination button,
.filter-tabs button,
.primary-button,
.secondary-button,
.danger-button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .055);
    font-weight: 800;
    cursor: pointer;
}
.search-form button,
.primary-button { border: 0; background: linear-gradient(135deg, #6366f1, #7c3aed); }
.danger-button { border-color: rgba(251, 113, 133, .25); color: #fda4af; background: rgba(251, 113, 133, .08); }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
}
.admin-table td { padding: 14px 12px; border-bottom: 1px solid rgba(255, 255, 255, .055); font-size: 12px; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: rgba(255, 255, 255, .02); }
.referral-table td {
    vertical-align: top;
}
.muted-cell {
    max-width: 260px;
    color: var(--muted);
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.user-cell strong,
.user-cell span { display: block; }
.user-cell span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.number-cell { font-size: 15px !important; font-weight: 900; }
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 220px;
}
.row-action {
    border: 0;
    background: none;
    color: #a5b4fc;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}
.row-action-bonus {
    color: #86efac;
}
.row-action-credit {
    color: #c4b5fd;
}
.row-action-take {
    color: #fda4af;
}
.row-action-email {
    color: #7dd3fc;
}
.row-action:disabled {
    color: rgba(160, 174, 192, .42);
    cursor: not-allowed;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.badge.active,
.badge.approved,
.badge.verified { background: rgba(52, 211, 153, .12); color: #6ee7b7; }
.badge.pending,
.badge.unverified { background: rgba(251, 191, 36, .12); color: #fde68a; }
.badge.disabled,
.badge.rejected,
.badge.failed,
.badge.blocked { background: rgba(251, 113, 133, .12); color: #fda4af; }
.badge.processing { background: rgba(56, 189, 248, .12); color: #7dd3fc; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 17px; }
.pagination span { color: var(--muted); font-size: 11px; }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-tabs button { min-height: 37px; color: var(--muted); font-size: 11px; }
.filter-tabs button.active { border-color: rgba(56, 189, 248, .28); background: rgba(56, 189, 248, .09); color: #fff; }

.referral-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.referral-summary-grid div {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .065);
    border-radius: 14px;
    background: rgba(255, 255, 255, .032);
}
.referral-summary-grid span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
}
.referral-summary-grid strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
    letter-spacing: -.04em;
}

.payment-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    padding: 17px;
    border: 1px solid rgba(255, 255, 255, .065);
    border-radius: 16px;
    background: rgba(255, 255, 255, .026);
}
.payment-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.payment-card-head span { color: #7dd3fc; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.payment-card-head h3 { margin: 4px 0 0; font-size: 17px; }
.payment-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.data-item { min-width: 0; padding: 10px; border-radius: 11px; background: rgba(0, 0, 0, .14); }
.data-item span { display: block; color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.data-item strong { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 11px; }
.payment-review { display: flex; flex-direction: column; gap: 9px; }
.payment-review textarea { min-height: 76px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0, 0, 0, .18); color: #fff; }
.payment-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.proof-link { color: #7dd3fc; font-size: 11px; font-weight: 800; text-decoration: none; }
.review-note { color: var(--muted); font-size: 11px; line-height: 1.6; }

.user-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
}
.user-modal-backdrop { position: absolute; inset: 0; background: rgba(4, 4, 15, .78); backdrop-filter: blur(12px); }
.user-modal-dialog {
    position: relative;
    width: min(720px, 100%);
    height: 100%;
    overflow-y: auto;
    padding: 28px;
    border-left: 1px solid var(--line);
    background: #101027;
    box-shadow: -30px 0 80px rgba(0, 0, 0, .45);
}
.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
    cursor: pointer;
}
.user-detail-head { padding-right: 45px; margin-bottom: 18px; }
.user-detail-head h2 { margin: 5px 0 2px; font-size: 27px; letter-spacing: -.035em; }
.user-detail-head p { margin: 0; color: var(--muted); }
.user-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.balance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.balance-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .035); }
.balance-card span { display: block; color: var(--muted); font-size: 10px; }
.balance-card strong { display: block; margin-top: 5px; font-size: 22px; }
.care-bonus-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(52, 211, 153, .22);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(52, 211, 153, .14), transparent 34%),
        rgba(16, 185, 129, .055);
}
.care-bonus-panel strong { display: block; font-size: 15px; }
.care-bonus-panel span,
.care-bonus-panel small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.care-bonus-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.care-bonus-actions button:disabled { opacity: .5; cursor: not-allowed; }
.restriction-panel {
    display: grid;
    gap: 10px;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid rgba(251, 191, 36, .2);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(251, 191, 36, .12), transparent 34%),
        rgba(251, 191, 36, .045);
}
.restriction-panel.restricted {
    border-color: rgba(251, 113, 133, .26);
    background:
        radial-gradient(circle at 100% 0%, rgba(251, 113, 133, .14), transparent 34%),
        rgba(251, 113, 133, .055);
}
.restriction-panel strong { font-size: 15px; }
.restriction-panel span,
.restriction-panel small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.restriction-panel blockquote {
    margin: 0;
    padding: 12px;
    border-left: 3px solid #fda4af;
    border-radius: 10px;
    background: rgba(0, 0, 0, .16);
    color: #f8fafc;
    font-size: 12px;
    line-height: 1.6;
}
.credit-form {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(124, 58, 237, .2);
    border-radius: 15px;
    background: rgba(124, 58, 237, .07);
}
.credit-form textarea { min-height: 42px; resize: vertical; }
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 10px; font-size: 15px; }
.history-list { display: grid; gap: 8px; }
.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
}
.history-item strong { font-size: 12px; }
.history-item span,
.history-item small { color: var(--muted); font-size: 10px; }
.history-item .badge { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

@media (max-width: 1050px) {
    .metric-grid,
    .referral-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .overview-grid { grid-template-columns: 1fr; }
    .payment-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; padding: 14px; }
    .brand { margin-bottom: 14px; }
    .sidebar-nav { grid-template-columns: repeat(3, 1fr); }
    .nav-button { justify-content: center; padding: 0 8px; }
    .nav-icon, .sidebar-help { display: none; }
    .nav-count { margin-left: 0; }
    .main { padding: 22px 12px 50px; }
    .topbar, .admin-identity { align-items: flex-start; flex-direction: column; text-align: left; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .compact-payment { grid-template-columns: 1fr 1fr; }
    .payment-details { grid-template-columns: repeat(2, 1fr); }
    .credit-form { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .sidebar-nav { grid-template-columns: 1fr; }
    .nav-button { justify-content: flex-start; }
    .metric-grid,
    .balance-grid,
    .referral-summary-grid { grid-template-columns: 1fr; }
    .panel { padding: 16px; }
    .search-form { width: 100%; }
    .search-form input { width: 100%; min-width: 0; }
    .payment-details { grid-template-columns: 1fr; }
    .user-modal-dialog { padding: 22px 15px; }
}
