:root {
    --bg: #05070b;
    --panel: rgba(17, 21, 29, .9);
    --panel-strong: rgba(23, 28, 39, .96);
    --panel-soft: rgba(255, 255, 255, .06);
    --line: rgba(255, 255, 255, .11);
    --text: #f3f6fb;
    --muted: #aab2c1;
    --gold: #ffd37a;
    --teal: #28d7c7;
    --red: #f05b5b;
    --blue: #5aa8ff;
    --violet: #a78bfa;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 28% 10%, rgba(255, 211, 122, .16), transparent 24%),
        radial-gradient(circle at 76% 4%, rgba(40, 215, 199, .13), transparent 22%),
        linear-gradient(120deg, rgba(5, 7, 11, .86), rgba(5, 7, 11, .98)),
        url('/assets/mu-banner.png') center top / cover fixed,
        var(--bg);
    overflow-x: hidden;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(115deg, rgba(255,255,255,.028) 0 9%, transparent 9% 20%),
        linear-gradient(rgba(255,255,255,.026) 1px, transparent 1px);
    background-size: 190px 190px, 100% 58px;
    mask-image: linear-gradient(to bottom, #000, transparent 86%);
}
body::after {
    content: "";
    position: fixed;
    inset: auto 0 0 0;
    height: 48vh;
    pointer-events: none;
    background: radial-gradient(circle at 50% 100%, rgba(240, 91, 91, .16), transparent 56%);
    mix-blend-mode: screen;
}
a { color: inherit; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px clamp(14px, 3vw, 34px);
    background: linear-gradient(180deg, rgba(24, 28, 35, .96), rgba(14, 17, 23, .92));
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 52px rgba(0,0,0,.42);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 900;
}
.crest {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 34px;
    border-radius: 8px;
    color: #1b1202;
    background: linear-gradient(135deg, #fff0bd, #f5b73d 48%, #922c25);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.38), 0 0 20px rgba(255,211,122,.2);
    animation: crestGlow 4.8s ease-in-out infinite;
}
nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.nav-link, .chip {
    text-decoration: none;
    border: 1px solid transparent;
    color: #dfe5ef;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 800;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.nav-link:hover, .nav-link.active, .chip:hover {
    color: #fff;
    border-color: var(--line);
    background: linear-gradient(135deg, rgba(255,255,255,.13), rgba(255,255,255,.055));
    transform: translateY(-1px);
}

.app-shell {
    width: min(1880px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 64px;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 300px;
    gap: 22px;
    position: relative;
}
body > main:not(.app-shell) {
    width: min(1500px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 64px;
    position: relative;
}
.side-menu, .right-panel {
    position: sticky;
    top: 84px;
    align-self: start;
}
.side-menu {
    min-height: calc(100vh - 112px);
    padding: 22px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.05), transparent 34%),
        rgba(13, 17, 23, .78);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 22px 60px rgba(0,0,0,.32);
}
.side-title {
    margin: 14px 0 8px;
    color: #f5f5f5;
    font-weight: 900;
    font-size: 13px;
}
.side-menu a {
    display: block;
    text-decoration: none;
    padding: 12px 13px;
    margin: 4px 0;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}
.side-menu a:hover, .side-menu a.active {
    background: linear-gradient(90deg, rgba(255,211,122,.16), rgba(255,255,255,.055));
    color: var(--text);
    transform: translateX(4px);
}
.content { min-width: 0; }

.hero {
    min-height: 320px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 18px;
}
.hero-copy, .status-panel, .panel, .metric, .module-card, .server-card, .support-card, .gift-card, .shop-card {
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 26px 80px rgba(0,0,0,.34);
    position: relative;
    overflow: hidden;
}
.hero-copy::before, .panel::before, .module-card::before, .gift-card::before, .shop-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255,255,255,.095), transparent 32%, rgba(255,211,122,.06)),
        radial-gradient(circle at 78% 12%, rgba(90,168,255,.1), transparent 26%);
    opacity: .74;
}
.hero-copy {
    padding: clamp(28px, 5vw, 58px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.hero-copy::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--red), var(--teal));
}
.hero-copy h1 {
    font-size: clamp(40px, 6vw, 76px);
    line-height: .98;
    margin: 0 0 16px;
    text-shadow: 0 0 34px rgba(255,211,122,.25), 0 8px 28px rgba(0,0,0,.72);
}
.hero-copy p {
    max-width: 680px;
    color: #d1d7e2;
    font-size: 18px;
}
.eyebrow {
    color: var(--gold);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 12px;
}
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}
.button {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 16px;
    min-height: 42px;
    background: rgba(255,255,255,.08);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.button.primary {
    background: linear-gradient(135deg, #3d8bff, #8b5cf6 48%, #ef476f);
    border-color: rgba(255,255,255,.2);
    box-shadow: 0 12px 30px rgba(139,92,246,.25);
}
.button:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 14px 32px rgba(0,0,0,.32);
}
.button.full { width: 100%; }
.status-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}
.status-panel div, .metric {
    padding: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(255,255,255,.026));
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.status-panel strong, .metric strong {
    display: block;
    font-size: 30px;
}
.status-panel span, .metric span, .muted {
    color: var(--muted);
}
.module-grid, .gift-grid, .shop-grid, .cards {
    display: grid;
    gap: 14px;
}
.module-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.module-card {
    padding: 20px;
    text-decoration: none;
    min-height: 118px;
    display: grid;
    align-content: space-between;
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 18px 56px rgba(0,0,0,.26);
}
.module-card:hover, .gift-card:hover, .shop-card:hover {
    transform: translateY(-5px);
    border-color: rgba(240,198,106,.42);
    background: var(--panel-strong);
}
.module-card span, .pack-tag {
    color: var(--gold);
    font-weight: 900;
}
.module-card:nth-child(1) { border-top: 3px solid #5aa8ff; }
.module-card:nth-child(2) { border-top: 3px solid #ef476f; }
.module-card:nth-child(3) { border-top: 3px solid #f1c66a; }
.module-card:nth-child(4) { border-top: 3px solid #28d7c7; }
.module-card strong { font-size: 18px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 22px; margin-bottom: 16px; }
.panel h1, .panel h2 { margin-top: 0; }
.promo strong { color: #b784ff; font-size: 34px; }
.promo:nth-child(1) strong { color: #c084fc; }
.promo:nth-child(2) strong { color: #fb923c; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0; }
.account-head, .section-title, .page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}
.account-head h1, .page-head h1 { margin: 0; font-size: 42px; }
.page-head { justify-content: flex-start; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-icon {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(40,215,199,.36), rgba(90,168,255,.28), rgba(167,139,250,.18));
    border: 1px solid rgba(40,215,199,.42);
    color: #d7fffa;
    font-weight: 900;
    box-shadow: 0 0 28px rgba(40,215,199,.18);
}
.auth, .download {
    min-height: 520px;
    display: grid;
    place-items: center;
}
.form { width: min(520px, 100%); }
label {
    display: grid;
    gap: 7px;
    margin: 14px 0;
    color: #d1d7e2;
    font-weight: 800;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    background: rgba(5, 8, 12, .82);
    color: var(--text);
    font-size: 15px;
}
textarea {
    min-height: 120px;
    resize: vertical;
    font-family: Consolas, monospace;
}
.inline-form {
    display: grid;
    grid-template-columns: repeat(5, max-content);
    gap: 8px;
    min-width: 460px;
    align-items: center;
}
.inline-form input { padding: 9px 10px; }
.inline-form input[name="admin_note"] { min-width: 180px; }
.segmented {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}
.segmented button {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255,255,255,.08);
    color: var(--text);
    font-weight: 900;
}
.segmented .active { background: linear-gradient(135deg, #f7f7f7, #9aa0aa); color: #0b0f15; }
.payment-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    gap: 18px;
}
.payment-note {
    padding: 16px;
    border-radius: 8px;
    background: rgba(255,255,255,.055);
    border: 1px solid var(--line);
    color: var(--muted);
    line-height: 1.55;
    margin: 16px 0;
}
.payment-note p { margin: 6px 0; }
.payment-note strong { color: #ff5a66; }
.qr-card {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 350px;
    align-content: center;
    gap: 10px;
}
.qr-mark {
    display: grid;
    place-items: center;
    width: 130px;
    height: 130px;
    border-radius: 18px;
    background: linear-gradient(135deg, #66e3ff, #3156d4);
    font-size: 44px;
    font-weight: 900;
    transform: rotate(-3deg);
    box-shadow: 0 18px 42px rgba(49,86,212,.32);
}
.vietqr-image {
    width: min(230px, 72vw);
    max-height: 34vh;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 18px 42px rgba(0,0,0,.36);
}
.bank-info {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 14px;
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0,0,0,.58);
    backdrop-filter: blur(6px);
    width: 100vw;
    height: 100vh;
    overflow: auto;
}
.payment-modal {
    width: min(430px, 100%);
    max-height: calc(100vh - 24px);
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.16);
    background:
        radial-gradient(circle at 15% -8%, rgba(255,211,122,.2), transparent 31%),
        radial-gradient(circle at 88% 0, rgba(40,215,199,.13), transparent 28%),
        linear-gradient(160deg, rgba(36,42,52,.98), rgba(13,16,23,.99));
    box-shadow: 0 34px 110px rgba(0,0,0,.66), inset 0 1px 0 rgba(255,255,255,.09);
    margin: auto;
}
.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 8px;
}
.modal-head h2 {
    margin: 0;
    font-size: 24px;
}
.modal-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    text-decoration: none;
    background: rgba(255,255,255,.08);
    font-size: 28px;
    line-height: 1;
}
.transaction-body {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 0 18px 14px;
}
.valid-label {
    color: #58f09b;
    font-weight: 900;
    margin: 0;
    font-size: 14px;
}
.countdown {
    font-size: clamp(38px, 10vw, 52px);
    line-height: .95;
    font-weight: 900;
    letter-spacing: -1px;
}
.countdown.expired { color: #ff6b6b; }
.pay-warning {
    margin: 2px 0 6px;
    color: #ff6b6b;
    font-weight: 900;
    text-align: center;
    line-height: 1.35;
}
.transaction-card {
    width: 100%;
    display: grid;
    gap: 9px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,.055);
    border: 1px solid var(--line);
}
.transaction-card div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.transaction-card span,
.transaction-lines span {
    color: var(--muted);
    font-weight: 800;
}
.transaction-card strong {
    color: #fff;
}
.transaction-lines {
    width: 100%;
    display: grid;
    gap: 10px;
}
.transaction-lines div {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
}
.transaction-lines span {
    grid-column: 1 / -1;
}
.transaction-lines strong {
    overflow-wrap: anywhere;
}
.copy-btn {
    border: 0;
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}
.copy-btn:hover { background: rgba(255,255,255,.15); }
/* Legacy summary styles retained for older rendered sessions. */
.payment-summary p {
    margin: 0;
    color: var(--muted);
}
.payment-summary strong {
    font-size: 24px;
    color: var(--gold);
}
.payment-summary code {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: rgba(0,0,0,.34);
    color: #fff;
    font-size: 20px;
    overflow-wrap: anywhere;
}
.modal-actions {
    padding: 0 18px 18px;
    display: flex;
    justify-content: flex-end;
}
.code-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 18px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    margin-bottom: 16px;
}
.gift-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gift-card {
    min-height: 210px;
    padding: 24px;
    display: grid;
    align-content: space-between;
    background:
        linear-gradient(140deg, rgba(255,211,122,.16), transparent 42%),
        var(--panel);
}
.gift-card h2 { color: var(--gold); }
.shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shop-card {
    padding: 22px;
    display: grid;
    gap: 12px;
    background:
        linear-gradient(160deg, rgba(90,168,255,.16), transparent 44%),
        var(--panel);
}
.shop-card strong { font-size: 24px; }
.shop-card ul { padding-left: 18px; color: var(--muted); }
.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert.error { color: #fecaca; background: rgba(127, 29, 29, .55); border-color: rgba(248, 113, 113, .35); }
.alert.ok { color: #bbf7d0; background: rgba(20, 83, 45, .55); border-color: rgba(74, 222, 128, .35); }
.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
th, td {
    text-align: left;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
th {
    color: #fef3c7;
    background: rgba(255,255,255,.05);
}
tr:last-child td { border-bottom: 0; }
.support-card {
    padding: 22px;
    display: grid;
    gap: 10px;
    background:
        radial-gradient(circle at 18% 0, rgba(255,211,122,.22), transparent 34%),
        linear-gradient(145deg, rgba(31, 38, 53, .96), rgba(11, 14, 20, .94));
}
.support-card h2 { margin: 0; font-size: 28px; }
.support-card p { margin: 0 0 6px; color: var(--muted); line-height: 1.55; }
.support-badge {
    width: max-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,211,122,.14);
    color: var(--gold);
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.support-card a {
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    transition: transform .18s ease, background .18s ease;
    font-weight: 900;
}
.support-card .support-main {
    background: linear-gradient(135deg, #30d5c8, #3d8bff);
    color: #031015;
}
.support-card a:hover {
    transform: translateX(3px);
    background: rgba(255,255,255,.12);
}

@keyframes crestGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.25); }
}

@media (max-width: 1280px) {
    .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
    .right-panel { display: none; }
}
@media (max-width: 900px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    nav { justify-content: flex-start; }
    .app-shell { grid-template-columns: 1fr; }
    .side-menu { position: static; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .side-title { grid-column: 1 / -1; }
    .hero, .grid.two, .cards, .module-grid, .payment-layout, .gift-grid, .shop-grid { grid-template-columns: 1fr; }
    .payment-modal { max-height: calc(100vh - 12px); overflow: auto; }
    .modal-backdrop { padding: 9px; }
    .modal-head, .transaction-body, .modal-actions { padding-left: 14px; padding-right: 14px; }
    .vietqr-image { width: min(230px, 74vw); max-height: 34vh; justify-self: center; }
    .code-box { grid-template-columns: 1fr; }
    .hero { min-height: 0; }
}
