/* ============================================================
   MLM Binary Pro — Public Styles  (FluentCRM-style member UI)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --mlm-primary:   #4f46e5;
  --mlm-primary-50:#eef2ff;
  --mlm-green:     #16a34a;
  --mlm-red:       #dc2626;
  --mlm-amber:     #d97706;
  --mlm-border:    #e5e7eb;
  --mlm-bg:        #f4f5f7;
  --mlm-card:      #ffffff;
  --mlm-text:      #1f2937;
  --mlm-muted:     #6b7280;
  --mlm-radius:    10px;
  --mlm-shadow:    0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.04);
}

.mlm-md, .mlm-wallet-section, .mlm-affiliate-section,
.mlm-register-wrap, .mlm-gtree-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--mlm-text);
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════
   MEMBER DASHBOARD
   ══════════════════════════════════════════════════════ */

/* Top bar */
.mlm-md-topbar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    background: #fff; border: 1px solid var(--mlm-border); border-radius: var(--mlm-radius);
    padding: 16px 20px; margin-bottom: 18px; box-shadow: var(--mlm-shadow);
}
.mlm-md-greeting { display: flex; align-items: center; gap: 14px; }
.mlm-md-avatar   { position: relative; flex-shrink: 0; }
.mlm-md-avatar-img { border-radius: 50% !important; border: 3px solid var(--mlm-primary-50) !important; width: 56px !important; height: 56px !important; }
.mlm-md-status-dot { position: absolute; bottom: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; }
.mlm-status-active   .mlm-md-status-dot,
.mlm-md-status-dot.mlm-status-active { background: #22c55e; }
.mlm-md-status-dot.mlm-status-inactive { background: #9ca3af; }
.mlm-md-status-dot.mlm-status-suspended { background: #ef4444; }

.mlm-md-hello    { font-size: 16px; font-weight: 600; color: var(--mlm-text); }
.mlm-md-sub      { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.mlm-md-rank-chip{ display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: #fff; }
.mlm-md-member-id{ font-size: 12px; color: var(--mlm-muted); }
.mlm-md-warn-chip{ background: #fef3c7; color: #92400e; border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

.mlm-md-topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mlm-md-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; text-decoration: none; border: 1px solid var(--mlm-border); background: #fff; color: var(--mlm-text);
    transition: background .12s;
}
.mlm-md-action-btn:hover { background: #f9fafb; color: var(--mlm-text); text-decoration: none; }
.mlm-md-action-btn.mlm-btn-primary { background: var(--mlm-primary); border-color: var(--mlm-primary); color: #fff; }
.mlm-md-action-btn.mlm-btn-primary:hover { background: #4338ca; color: #fff; }

/* KPI strip */
.mlm-md-kpis {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 18px;
}
@media (max-width: 900px) { .mlm-md-kpis { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .mlm-md-kpis { grid-template-columns: 1fr; } }

.mlm-md-kpi {
    background: #fff; border: 1px solid var(--mlm-border); border-radius: var(--mlm-radius);
    box-shadow: var(--mlm-shadow); padding: 16px 18px; display: flex; align-items: center; gap: 12px;
    border-top: 3px solid var(--kc, #6366f1);
}
.mlm-md-kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.mlm-md-kpi-val  { font-size: 20px; font-weight: 800; line-height: 1.1; }
.mlm-md-kpi-lbl  { font-size: 11.5px; color: var(--mlm-muted); margin-top: 2px; }
.mlm-md-kpi-sub  { font-size: 11px; color: var(--mlm-muted); margin-top: 2px; }

/* 2-col body */
.mlm-md-body { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
@media (max-width: 900px) { .mlm-md-body { grid-template-columns: 1fr; } }

/* Cards */
.mlm-md-card { background: #fff; border: 1px solid var(--mlm-border); border-radius: var(--mlm-radius); box-shadow: var(--mlm-shadow); padding: 18px; margin-bottom: 16px; }
.mlm-md-card-head { display: flex; align-items: center; justify-content: space-between; }
.mlm-md-card-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; }

/* Progress */
.mlm-md-progress-card { border-left: 4px solid var(--mlm-primary); }
.mlm-md-pct-badge { background: var(--mlm-primary-50); color: var(--mlm-primary); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.mlm-md-progress-bar { background: #f1f2f4; border-radius: 999px; height: 10px; margin: 10px 0 6px; overflow: hidden; }
.mlm-md-progress-fill { height: 100%; border-radius: 999px; transition: width .4s; }
.mlm-md-progress-info { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--mlm-muted); }

/* Tabs */
.mlm-md-tabs { display: flex; border-bottom: 2px solid var(--mlm-border); margin-bottom: 0; background: #fff; border-radius: var(--mlm-radius) var(--mlm-radius) 0 0; border: 1px solid var(--mlm-border); border-bottom: 2px solid var(--mlm-border); padding: 0 4px; }
.mlm-md-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 12px 16px; font-size: 13.5px; font-weight: 600; color: var(--mlm-muted); cursor: pointer; margin-bottom: -2px; transition: color .12s; white-space: nowrap; }
.mlm-md-tab.active { color: var(--mlm-primary); border-bottom-color: var(--mlm-primary); }
.mlm-md-tab:hover  { color: var(--mlm-text); }
.mlm-md-tab-body   { background: #fff; border: 1px solid var(--mlm-border); border-top: none; border-radius: 0 0 var(--mlm-radius) var(--mlm-radius); padding: 16px; min-height: 200px; margin-bottom: 16px; }

/* Bonus/transaction list */
.mlm-md-bonus-list { display: flex; flex-direction: column; gap: 2px; }
.mlm-md-bonus-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; transition: background .1s; cursor: default; }
.mlm-md-bonus-row:hover { background: #f8fafc; }
.mlm-md-bonus-icon { font-size: 24px; width: 36px; text-align: center; flex-shrink: 0; }
.mlm-md-bonus-info { flex: 1; }
.mlm-md-bonus-type { font-weight: 600; font-size: 13.5px; }
.mlm-md-bonus-date { font-size: 11.5px; color: var(--mlm-muted); margin-top: 2px; }
.mlm-md-bonus-desc { font-size: 11px; color: var(--mlm-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.mlm-md-bonus-right { text-align: right; }
.mlm-md-bonus-amt { font-weight: 700; font-size: 14px; }
.mlm-pos { color: var(--mlm-green); }
.mlm-neg { color: var(--mlm-red); }
.mlm-md-balance-after { font-size: 11px; color: var(--mlm-muted); margin-top: 2px; }

/* Status chips */
.mlm-md-status-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; margin-top: 3px; }
.mlm-status-approved, .mlm-status-paid, .mlm-status-active   { background: #dcfce7; color: #15803d; }
.mlm-status-pending  { background: #fef3c7; color: #92400e; }
.mlm-status-cancelled,
.mlm-status-rejected,
.mlm-status-suspended { background: #fee2e2; color: #b91c1c; }
.mlm-status-inactive  { background: #f3f4f6; color: #6b7280; }

.mlm-md-empty { text-align: center; padding: 40px; color: var(--mlm-muted); font-size: 14px; }

/* Payout */
.mlm-md-payout-saldo { background: linear-gradient(135deg,#1e40af,#3b82f6); color: #fff; border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.mlm-md-payout-saldo-lbl { font-size: 13px; opacity: .85; }
.mlm-md-payout-saldo-val { font-size: 22px; font-weight: 800; }

/* Profile grid */
.mlm-md-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .mlm-md-profile-grid { grid-template-columns: 1fr; } }
.mlm-md-profile-item { background: #f8fafc; border-radius: 8px; padding: 10px 14px; }
.mlm-md-profile-key  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mlm-muted); }
.mlm-md-profile-val  { font-size: 13.5px; font-weight: 600; margin-top: 4px; }

/* Sidebar */
.mlm-md-aff-widget .mlm-md-card-title { margin-bottom: 10px; }
.mlm-md-aff-url-box { display: flex; background: #f1f5f9; border-radius: 8px; overflow: hidden; border: 1px solid var(--mlm-border); }
.mlm-md-aff-url-box input { flex: 1; border: none; background: transparent; padding: 8px 10px; font-size: 12px; color: var(--mlm-muted); outline: none; }
.mlm-md-copy-btn { background: var(--mlm-primary); color: #fff; border: none; padding: 8px 12px; cursor: pointer; font-size: 16px; }
.mlm-md-aff-stats { display: flex; justify-content: space-around; margin: 12px 0 0; }
.mlm-md-aff-stat { text-align: center; }
.mlm-md-aff-stat-val { font-size: 20px; font-weight: 800; display: block; color: var(--mlm-text); }
.mlm-md-aff-stat-lbl { font-size: 11px; color: var(--mlm-muted); }

.mlm-md-tree-legs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mlm-md-leg { border-radius: 8px; padding: 10px; text-align: center; }
.mlm-leg-left  { background: #eff6ff; }
.mlm-leg-right { background: #fef2f2; }
.mlm-md-leg-label { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.mlm-leg-left  .mlm-md-leg-label { color: #1d4ed8; }
.mlm-leg-right .mlm-md-leg-label { color: #b91c1c; }
.mlm-md-leg-bv { font-size: 16px; font-weight: 800; }
.mlm-md-leg-carry { font-size: 11px; color: var(--mlm-muted); margin-top: 2px; }
.mlm-md-link-btn { display: block; text-align: center; background: var(--mlm-primary-50); color: var(--mlm-primary); border-radius: 8px; padding: 8px; font-size: 13px; font-weight: 600; text-decoration: none; margin-top: 12px; transition: background .1s; }
.mlm-md-link-btn:hover { background: #e0e7ff; text-decoration: none; color: var(--mlm-primary); }

.mlm-md-quick-links { display: flex; flex-direction: column; gap: 4px; }
.mlm-md-qlink { display: block; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background .1s; color: var(--mlm-text); text-decoration: none; }
.mlm-md-qlink:hover { background: var(--mlm-primary-50); color: var(--mlm-primary); text-decoration: none; }

/* ══════════════════════════════════════════════════════
   REGISTER FORM
   ══════════════════════════════════════════════════════ */
.mlm-register-wrap { max-width: 480px; margin: 0 auto; }

.mlm-sponsor-banner {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg,#eff6ff,#dbeafe); border: 1px solid #93c5fd;
    border-radius: 12px; padding: 14px 18px; margin-bottom: 20px;
    position: relative;
}
.mlm-sponsor-avatar img { border-radius: 50% !important; width: 48px !important; height: 48px !important; }
.mlm-sponsor-label { font-size: 11px; color: #1d4ed8; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.mlm-sponsor-name  { font-size: 16px; font-weight: 800; color: #1e3a8a; }
.mlm-sponsor-check { margin-left: auto; font-size: 22px; color: var(--mlm-green); }

.mlm-register-card { background: #fff; border: 1px solid var(--mlm-border); border-radius: 16px; padding: 32px; box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.mlm-register-header { text-align: center; margin-bottom: 24px; }
.mlm-register-icon   { font-size: 36px; margin-bottom: 8px; }
.mlm-register-title  { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.mlm-register-sub    { font-size: 14px; color: var(--mlm-muted); margin: 0; }

.mlm-field-group { margin-bottom: 16px; }
.mlm-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.mlm-req   { color: var(--mlm-red); }
.mlm-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--mlm-border); border-radius: 8px; font-size: 14px; transition: border .15s, box-shadow .15s; outline: none; background: #fff; color: var(--mlm-text); }
.mlm-input:focus { border-color: var(--mlm-primary); box-shadow: 0 0 0 3px #eef2ff; }
.mlm-password-wrap { position: relative; }
.mlm-pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; }

.mlm-sponsor-locked { background: #f0fdf4; border: 1.5px solid #bbf7d0; border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.mlm-sponsor-lock-icon { font-size: 16px; }
.mlm-sponsor-lock-name { font-weight: 700; color: #15803d; }
.mlm-sponsor-lock-code { color: var(--mlm-muted); font-size: 12px; }

.mlm-register-btn {
    width: 100%; padding: 13px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
    font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 8px;
    transition: opacity .15s, transform .1s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mlm-register-btn:hover { opacity: .92; transform: translateY(-1px); }
.mlm-register-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.mlm-msg-success { background: #dcfce7; color: #15803d; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-top: 12px; }
.mlm-msg-error   { background: #fee2e2; color: #b91c1c; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-top: 12px; }

/* ══════════════════════════════════════════════════════
   GENEALOGY TREE  (member-tree.php) — light theme, matches admin
   ══════════════════════════════════════════════════════ */
.mlm-gtree-wrap {
    position: relative; background: #fff;
    border: 1px solid var(--mlm-border); border-radius: 14px; overflow: hidden;
    min-height: 600px; display: flex; flex-direction: column;
    box-shadow: var(--mlm-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Toolbar */
.mlm-gtree-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--mlm-border);
    z-index: 10;
}
.mlm-gtree-toolbar-left, .mlm-gtree-toolbar-right { display: flex; align-items: center; gap: 6px; }
.mlm-gtree-toolbar-center { flex: 1; }
.mlm-gtree-tool {
    background: #fff; color: #475569; border: 1px solid var(--mlm-border);
    width: 32px; height: 32px; border-radius: 8px; font-size: 18px; font-weight: 700;
    cursor: pointer; display: grid; place-items: center; transition: all .12s;
}
.mlm-gtree-tool:hover { background: var(--mlm-primary-50); color: var(--mlm-primary); border-color: var(--mlm-primary); }
.mlm-gtree-search {
    width: 100%; max-width: 260px; background: #fff; border: 1px solid var(--mlm-border);
    color: var(--mlm-text); border-radius: 8px; padding: 7px 12px; font-size: 13px; outline: none;
}
.mlm-gtree-search:focus { border-color: var(--mlm-primary); box-shadow: 0 0 0 3px var(--mlm-primary-50); }
.mlm-gtree-select {
    background: #fff; color: var(--mlm-text); border: 1px solid var(--mlm-border);
    border-radius: 8px; padding: 6px 10px; font-size: 13px; outline: none; cursor: pointer;
}
.mlm-gtree-tool-primary {
    background: var(--mlm-primary); color: #fff; border: none;
    padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.mlm-gtree-tool-primary:hover { background: #4338ca; }

/* Canvas */
.mlm-gtree-canvas { flex: 1; position: relative; overflow: hidden; min-height: 500px; cursor: grab; background: #f9fafb; }
.mlm-gtree-canvas:active { cursor: grabbing; }
.mlm-gtree-canvas svg { display: block; }

/* Loading & empty */
.mlm-gtree-loading {
    position: absolute; inset: 0; background: #f9fafb;
    display: flex; align-items: center; justify-content: center;
    gap: 12px; color: var(--mlm-muted); font-size: 14px; z-index: 5;
}
.mlm-gtree-spinner {
    width: 24px; height: 24px; border: 3px solid #e0e7ff; border-top-color: var(--mlm-primary);
    border-radius: 50%; animation: gtree-spin .7s linear infinite;
}
@keyframes gtree-spin { to { transform: rotate(360deg); } }
.mlm-gtree-empty { padding: 80px 20px; text-align: center; color: var(--mlm-muted); font-size: 15px; }

/* ─── DETAIL SIDE PANEL (light) ─── */
.mlm-gtree-panel {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 260px; background: #fff; border-left: 1px solid var(--mlm-border);
    z-index: 20; display: flex; flex-direction: column;
    padding: 20px; overflow-y: auto; box-shadow: -4px 0 16px rgba(0,0,0,.06);
}
.mlm-gtree-panel-close {
    position: absolute; top: 12px; right: 12px;
    background: #f1f5f9; border: none; color: #64748b;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px;
    display: grid; place-items: center;
}
.mlm-gtree-panel-close:hover { background: #e2e8f0; color: var(--mlm-text); }
.mlm-gtree-panel-avatar { text-align: center; padding: 16px 0 8px; }
.mlm-gtree-panel-name { font-size: 20px; font-weight: 800; color: var(--mlm-text); text-align: center; }
.mlm-gtree-panel-rank { font-size: 14px; font-weight: 700; text-align: center; margin-top: 4px; margin-bottom: 16px; }

.mlm-gtree-panel-meta { margin-bottom: 16px; }
.mlm-gtree-panel-meta-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.mlm-gtree-panel-meta-item { background: #f8fafc; border-radius: 8px; padding: 8px; text-align: center; }
.gtp-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--mlm-muted); margin-bottom: 4px; }
.gtp-val   { font-size: 12px; font-weight: 700; color: var(--mlm-text); text-transform: capitalize; }

.mlm-gtree-panel-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; border-top: 1px solid var(--mlm-border); padding-top: 16px; }
.gtp-stat { text-align: center; background: #f8fafc; border-radius: 8px; padding: 10px; }
.gtp-stat-val { font-size: 20px; font-weight: 800; color: var(--mlm-primary); display: block; }
.gtp-stat-lbl { font-size: 11px; color: var(--mlm-muted); }

/* ══════════════════════════════════════════════════════
   WALLET / AFFILIATE (keep legacy styles)
   ══════════════════════════════════════════════════════ */
.mlm-wallet-balances { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.mlm-wallet-currency {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff; border-radius: 12px; padding: 20px 28px; min-width: 160px; text-align: center;
}
.mlm-wallet-balance { font-size: 22px; font-weight: 700; margin: 8px 0 4px; }

.mlm-section h3  { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.mlm-table       { width: 100%; border-collapse: collapse; font-size: 13px; }
.mlm-table th    { background: #f8fafc; padding: 9px 12px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid var(--mlm-border); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.mlm-table td    { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
.mlm-table tr:last-child td { border-bottom: none; }
.mlm-table tr:hover td { background: #f8fafc; }

/* Keep old register fallback */
.mlm-register-section .mlm-form { max-width: 480px; margin: 0 auto; }
.mlm-form-row { margin-bottom: 14px; }
.mlm-form-row label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.mlm-form-row input, .mlm-form-row select, .mlm-form-row textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--mlm-border); border-radius: 8px; font-size: 14px; outline: none; }
.mlm-form-row input:focus { border-color: var(--mlm-primary); }

.mlm-success { color: var(--mlm-green); background: #dcfce7; border-radius: 6px; padding: 8px 12px; }
.mlm-error   { color: var(--mlm-red);   background: #fee2e2; border-radius: 6px; padding: 8px 12px; }

/* Landing page join button [mlm_join_button] */
.mlm-join-button {
    display: inline-block; padding: 14px 36px; border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff !important;
    font-size: 16px; font-weight: 700; text-decoration: none !important;
    box-shadow: 0 6px 20px rgba(79,70,229,.35); transition: transform .12s, box-shadow .12s;
}
.mlm-join-button:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(79,70,229,.45); color: #fff !important; }

@media (max-width: 640px) {
    .mlm-md-topbar { flex-direction: column; align-items: flex-start; }
    .mlm-md-topbar-actions { width: 100%; }
    .mlm-md-action-btn { flex: 1; justify-content: center; }
    .mlm-gtree-panel { position: fixed; bottom: 0; right: 0; left: 0; top: auto; width: 100%; height: 280px; border: none; border-top: 1px solid #334155; }
    .mlm-gtree-toolbar { gap: 6px; }
    .mlm-gtree-toolbar-center { order: -1; flex-basis: 100%; }
}
