/* STAR ENTERPRISES — Admin & Member panel styles */
:root {
    --se-navy: #0b1f4d; --se-navy-2: #10296a; --se-royal: #1e4fd8; --se-gold: #d4a017; --se-gold-2: #f5c542;
    --se-bg: #f3f6fd; --se-ink: #1b2440; --se-muted: #5b6785; --sidebar-w: 268px;
    --se-gradient-gold: linear-gradient(135deg, #f7d774 0%, #d4a017 100%);
}
body { font-family: 'Inter', system-ui, sans-serif; color: var(--se-ink); background: var(--se-bg); }
h1, h2, h3, h4, h5, h6, .btn, .side-link { font-family: 'Poppins', 'Inter', sans-serif; }
a { color: var(--se-royal); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-gold { background: var(--se-gradient-gold); color: var(--se-navy); border: none; }
.btn-gold:hover { color: var(--se-navy); filter: brightness(1.05); }
.btn-royal { background: var(--se-royal); color: #fff; border: none; }
.btn-royal:hover { background: var(--se-navy); color: #fff; }
.btn-outline-royal { border: 1px solid var(--se-royal); color: var(--se-royal); }
.btn-outline-royal:hover { background: var(--se-royal); color: #fff; }
.btn-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; background: #fff; border: 1px solid #e3e9f6; color: var(--se-navy); font-size: 1.15rem; padding: 0; }
.form-control, .form-select { border-radius: 10px; border-color: #d5ddef; }
.form-control:focus, .form-select:focus { border-color: var(--se-royal); box-shadow: 0 0 0 .2rem rgba(30, 79, 216, .15); }
.min-w-0 { min-width: 0; }

/* sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: linear-gradient(180deg, #071538 0%, #0b1f4d 55%, #10296a 100%); color: #fff; display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease; }
.sidebar-brand { padding: 18px 20px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand img { height: 46px; }
.panel-tag { display: block; margin-top: 6px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--se-gold-2); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: thin; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 2px; border-radius: 10px; color: rgba(255, 255, 255, .78); text-decoration: none; font-size: .9rem; font-weight: 500; background: none; border: none; text-align: left; }
.side-link > i:first-child { font-size: 1.05rem; width: 20px; text-align: center; }
.side-link > span { flex: 1; }
.side-link > span.phase-badge { flex: 0 0 auto; }
.side-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-link.active { background: var(--se-gradient-gold); color: var(--se-navy); font-weight: 600; box-shadow: 0 8px 20px -10px rgba(212, 160, 23, .8); }
.side-link.child { padding-left: 44px; font-size: .85rem; }
.side-link.child > i:first-child { display: none; }
.side-group .caret { transition: transform .2s ease; font-size: .75rem; }
.side-group.collapsed .caret { transform: rotate(-90deg); }
.phase-badge { font-size: .62rem; font-weight: 700; color: var(--se-gold-2); border: 1px solid rgba(245, 197, 66, .45); border-radius: 6px; padding: 0 5px; }
.side-link.active .phase-badge { color: var(--se-navy); border-color: var(--se-navy); }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-backdrop { display: none; }

/* main */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topnav { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(243, 246, 253, .92); backdrop-filter: blur(8px); border-bottom: 1px solid #e3e9f6; }
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--se-navy); margin: 0; }
.content { padding: 24px; flex: 1; }
.panel-foot { padding: 14px 24px; border-top: 1px solid #e3e9f6; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--se-gradient-gold); color: var(--se-navy); display: grid; place-items: center; font-weight: 700; font-family: 'Poppins', sans-serif; }
.avatar-lg { width: 72px; height: 72px; border-radius: 20px; font-size: 1.8rem; }
.notif-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: #dc3545; color: #fff; font-size: .65rem; display: grid; place-items: center; padding: 0 4px; }

.card-panel { background: #fff; border-radius: 16px; padding: 20px; border: 1px solid #e6ecf8; box-shadow: 0 10px 30px -24px rgba(11, 31, 77, .5); }
.card-panel h2, .card-panel h3 { color: var(--se-navy); font-weight: 700; }
.stat-card { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 16px; padding: 18px; border: 1px solid #e6ecf8; box-shadow: 0 10px 30px -24px rgba(11, 31, 77, .5); text-decoration: none; color: inherit; height: 100%; transition: transform .2s ease, box-shadow .2s ease; }
a.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -22px rgba(11, 31, 77, .55); color: inherit; }
.stat-icon { width: 50px; height: 50px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; }
.stat-label { font-size: .78rem; color: var(--se-muted); font-weight: 500; }
.stat-value { font-family: 'Poppins', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--se-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: .75rem; color: var(--se-muted); }
.tone-navy .stat-icon { background: #e6ebf7; color: var(--se-navy); }
.tone-royal .stat-icon { background: #e7eeff; color: var(--se-royal); }
.tone-gold .stat-icon { background: #fff4d6; color: #b68307; }
.tone-green .stat-icon { background: #e3f6ec; color: #198754; }
.tone-orange .stat-icon { background: #fff0e0; color: #e8700a; }
.tone-red .stat-icon { background: #fde8ea; color: #dc3545; }
.tone-gray .stat-icon { background: #eef0f4; color: #6c757d; }
.chart-box { position: relative; height: 320px; }
.recent-list li { padding: 10px 0; border-bottom: 1px dashed #e3e9f6; }
.recent-list li:last-child { border-bottom: none; }
.data-table thead th, .table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--se-muted); background: #f7f9fe; border-bottom: 1px solid #e3e9f6; }
.audit-json { max-width: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; word-break: break-all; }
.ticket { border: 1px solid #e6ecf8; border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.soon-icon { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 22px; display: grid; place-items: center; background: var(--se-gradient-gold); color: var(--se-navy); font-size: 2rem; }
.welcome-band { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 22px 24px; border-radius: 18px; color: #fff; background: linear-gradient(120deg, #071538 0%, #0b1f4d 50%, #1e4fd8 100%); position: relative; overflow: hidden; }
.welcome-band::after { content: ''; position: absolute; right: -60px; top: -80px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 197, 66, .35), transparent 65%); }
.id-pill { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); padding: 3px 12px; border-radius: 999px; font-weight: 600; letter-spacing: .04em; }

/* auth */
.auth-body { min-height: 100vh; background: radial-gradient(circle at 80% 10%, rgba(245, 197, 66, .25), transparent 40%), linear-gradient(130deg, #071538 0%, #0b1f4d 50%, #1e4fd8 100%); }
.auth-admin { background: radial-gradient(circle at 80% 10%, rgba(245, 197, 66, .18), transparent 40%), linear-gradient(130deg, #050d24 0%, #0b1f4d 70%, #10296a 100%); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 56px 16px; }
.auth-card { background: #fff; border-radius: 22px; padding: 32px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55); }
.auth-logo { max-width: 240px; width: 100%; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(5, 13, 36, .5); z-index: 1035; }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .topnav { padding: 10px 16px; }
}
@media print {
    .sidebar, .topnav, .panel-foot, .btn, form.filter-bar, .pagination { display: none !important; }
    .main { margin: 0; }
    .card-panel { box-shadow: none; border: none; }
}

/* ---------------- Phase 2–9 components ---------------- */
.text-navy { color: var(--se-navy); }
.btn-navy { background: var(--se-navy); color: #fff; border: none; }
.btn-navy:hover { background: #050f29; color: #fff; }
.plan-pick { display: flex; flex-direction: column; gap: 2px; height: 100%; border: 2px solid #dfe5f4; border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; transition: all .15s ease; }
.plan-pick strong { color: var(--se-navy); }
.plan-pick small { color: var(--se-muted); }
.btn-check:checked + .plan-pick { border-color: var(--se-royal); background: #eef3ff; box-shadow: 0 0 0 3px rgba(30, 79, 216, .12); }
.btn-check:disabled + .plan-pick { cursor: not-allowed; }
.calc-box { background: #f5f8ff; border-radius: 10px; padding: 10px 12px; }
.calc-box div { display: flex; justify-content: space-between; padding: 2px 0; }
.calc-box .total { border-top: 1px dashed #c9d4ef; margin-top: 4px; padding-top: 6px; font-weight: 600; color: var(--se-navy); }
.sticky-save { position: sticky; bottom: 0; background: rgba(243, 246, 253, .95); padding: 12px 0; margin-top: 12px; border-top: 1px solid #e3e9f6; z-index: 5; }
.recent-list li.unread { background: #fff9e6; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.qa { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid #e3e9f6; color: var(--se-navy); text-decoration: none; font-weight: 600; font-size: .88rem; box-shadow: 0 6px 18px -14px rgba(11, 31, 77, .5); }
.qa:hover { border-color: var(--se-royal); color: var(--se-royal); }
.qa i { font-size: 1.1rem; color: var(--se-royal); }
.qa-gold { background: var(--se-gradient-gold); border: none; }
.qa-gold i, .qa-gold:hover { color: var(--se-navy); }
.qa-warn { border-color: #f0c36d; background: #fff8e6; }

/* wallet cards */
.wallet-card { border-radius: 18px; padding: 22px; color: #fff; position: relative; overflow: hidden; height: 100%; }
.wallet-card::after { content: ''; position: absolute; right: -50px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.wallet-entry { background: linear-gradient(130deg, #0b1f4d, #1e4fd8); }
.wallet-commission { background: var(--se-gradient-gold); color: var(--se-navy); }
.wallet-amount { font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800; margin: 8px 0 4px; }

/* binary tree */
.tree-legend { display: flex; flex-wrap: wrap; gap: 14px; }
.tree-scroll { overflow-x: auto; padding-bottom: 8px; }
.btree { display: block; width: max-content; min-width: 100%; text-align: center; }
.btree ul { padding-top: 22px; position: relative; display: flex; justify-content: center; margin: 0; padding-left: 0; }
.btree li { list-style: none; position: relative; padding: 22px 6px 0; text-align: center; flex: 1 1 0; }
.btree li::before, .btree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 2px solid #b9c7ea; }
.btree li::after { right: auto; left: 50%; border-left: 2px solid #b9c7ea; }
.btree li:only-child::before, .btree li:only-child::after { display: none; }
.btree li:only-child { padding-top: 0; }
.btree li:first-child::before, .btree li:last-child::after { border: 0 none; }
.btree li:last-child::before { border-right: 2px solid #b9c7ea; border-radius: 0 6px 0 0; }
.btree li:first-child::after { border-radius: 6px 0 0 0; }
.btree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #b9c7ea; height: 22px; }
.btree > ul { padding-top: 0; }
.tnode { display: inline-flex; flex-direction: column; align-items: center; min-width: 128px; max-width: 160px; padding: 10px 8px; border-radius: 14px; background: #fff; border: 2px solid #dfe5f4; text-decoration: none; color: var(--se-ink); font-size: .74rem; line-height: 1.25; box-shadow: 0 8px 20px -16px rgba(11, 31, 77, .6); transition: transform .15s ease; }
.tnode:hover { transform: translateY(-2px); color: var(--se-ink); }
.tnode strong { font-size: .82rem; color: var(--se-navy); }
.tavatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; margin-bottom: 4px; background: #6c757d; }
.tnode.is-active { border-color: #9ad6b4; }
.tnode.is-active .tavatar { background: linear-gradient(135deg, #20c997, #198754); }
.tnode.is-blocked { border-color: #f1a7ae; }
.tnode.is-blocked .tavatar { background: #dc3545; }
.tname { color: var(--se-muted); }
.tmeta { font-size: .68rem; color: var(--se-royal); }
.tbv { display: flex; gap: 6px; margin-top: 4px; }
.tbv span { background: #eef3ff; border-radius: 6px; padding: 1px 6px; font-weight: 600; color: var(--se-navy); }
.tteam, .tsponsor { font-size: .66rem; color: var(--se-muted); }
.tempty { border-style: dashed; color: var(--se-muted); background: #f8faff; min-height: 90px; justify-content: center; }
.tempty i { font-size: 1.4rem; color: var(--se-royal); }
.tempty small { color: var(--se-royal); font-weight: 600; }
.tempty.disabled { opacity: .6; }
.tmore { border-style: dotted; min-height: 60px; justify-content: center; }

/* sponsor tree */
.stree { list-style: none; padding-left: 22px; margin: 0; border-left: 2px solid #e1e7f5; }
.stree li { position: relative; padding: 4px 0 4px 14px; }
.stree li::before { content: ''; position: absolute; left: 0; top: 16px; width: 12px; border-top: 2px solid #e1e7f5; }
.snode { font-size: .88rem; }
.snode.root { font-size: 1rem; margin-bottom: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #adb5bd; }
.dot-active { background: #198754; }
.dot-blocked { background: #dc3545; }

/* orders */
.order-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.ostep { flex: 1 1 100px; text-align: center; font-size: .78rem; color: var(--se-muted); position: relative; }
.ostep span { display: grid; place-items: center; width: 30px; height: 30px; margin: 0 auto 4px; border-radius: 50%; background: #e9eef8; font-weight: 700; }
.ostep.done { color: var(--se-navy); font-weight: 600; }
.ostep.done span { background: var(--se-gradient-gold); color: var(--se-navy); }
.timeline { list-style: none; padding-left: 18px; border-left: 2px solid #e1e7f5; }
.timeline li { position: relative; padding: 4px 0 10px 8px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--se-royal); border: 2px solid #fff; }
.shop-card { background: #fff; border: 1px solid #e6ecf8; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.shop-card img { width: 100%; aspect-ratio: 6 / 5; object-fit: cover; background: #f3f6fd; }
.shop-card > div { flex: 1; }

/* reports */
.report-table th a.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }

/* welcome letter */
.letter { max-width: 820px; background: #fff; border-radius: 14px; padding: 40px; border: 1px solid #e6ecf8; box-shadow: 0 16px 40px -30px rgba(11, 31, 77, .6); }
.letter-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 3px solid var(--se-gold); padding-bottom: 16px; margin-bottom: 18px; }
.letter-head img { width: 220px; }
.letter-table th { width: 38%; background: #f5f8ff; }
.signature { font-family: 'Poppins', cursive; font-style: italic; font-size: 1.3rem; color: var(--se-royal); }
@media print {
    .letter { box-shadow: none; border: none; padding: 0; }
    .report-table a { color: inherit; text-decoration: none; }
}

/* Member login with welcome letter */
.auth-wrap.auth-wide { max-width: 1020px; }
.auth-split { display: grid; grid-template-columns: 1.15fr 1fr; border-radius: 22px; overflow: hidden; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55); }
.auth-split .auth-card { border-radius: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
.auth-welcome { position: relative; background: #fffdf6; padding: 36px 34px; border-right: 1px solid #efe3bf; color: var(--se-ink); font-size: .92rem; }
.auth-welcome::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--se-gradient-gold); }
.auth-welcome h2 { font-size: 1.35rem; font-weight: 800; color: var(--se-navy); margin: 10px 0 14px; }
.wl-ribbon { display: inline-flex; gap: 8px; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--se-navy); color: var(--se-gold-2); font-weight: 600; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.lead-sm { font-weight: 600; margin-bottom: 6px; }
.wl-points { list-style: none; padding: 0; margin: 14px 0 18px; }
.wl-points li { display: flex; gap: 8px; padding: 4px 0; }
.wl-points i { color: #b68307; }
.wl-sign { font-family: 'Poppins', sans-serif; font-style: italic; font-size: 1.15rem; color: var(--se-royal); }
.wl-join { margin-top: 22px; padding: 14px 16px; border-radius: 14px; background: var(--se-navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wl-join span { font-weight: 600; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; color: var(--se-muted); font-size: .82rem; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid #e3e9f6; }
@media (max-width: 767.98px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-welcome { order: 2; border-right: none; border-top: 1px solid #efe3bf; }
}
