/* ═══════════════════════════════════════════════════════════════
   AGENT PANEL — emerald theme on top of common.css + admin.css
   Loaded only by /agent pages, so admin/merchant panels are untouched.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary:             #10b981;
    --primary-dark:        #059669;
    --primary-light:       #ecfdf5;
    --primary-glow:        rgba(16,185,129,0.18);
    --sidebar-active-bg:   rgba(16,185,129,0.10);
    --sidebar-active-text: #047857;
    --shadow-colored:      0 8px 24px rgba(16,185,129,0.28);
    --agent-grad:          linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%);
}

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.form-input:focus, .form-select:focus, .form-textarea:focus,
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,185,129,0.12); }
.page-item:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.page-item.active { background: var(--primary); border-color: var(--primary); box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.text-green { color: var(--primary); }
.required { color: var(--error); }

/* admin.css hides table columns 4 & 5 on phones — agent tables need every
   column, so let them scroll horizontally instead */
@media (max-width: 768px) {
    .data-table th:nth-child(4), .data-table td:nth-child(4),
    .data-table th:nth-child(5), .data-table td:nth-child(5) { display: table-cell; }
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ag-balance {
    margin: 14px; padding: 16px; border-radius: 14px; color: #fff;
    background: var(--agent-grad);
    box-shadow: 0 6px 20px rgba(16,185,129,0.32);
    position: relative; overflow: hidden;
}
.ag-balance::after {
    content: ''; position: absolute; right: -30px; top: -30px;
    width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,0.10);
}
.ag-balance-label { font-size: 10.5px; font-weight: 600; letter-spacing: .6px; opacity: .85; }
.ag-balance-value { font-size: 22px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.ag-balance-sub { font-size: 11px; opacity: .8; }
.ag-balance-btn {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
    padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.18); color: #fff; position: relative; z-index: 1;
    transition: background .18s;
}
.ag-balance-btn:hover { background: rgba(255,255,255,0.28); color: #fff; }
.nav-item .nav-count {
    margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
    background: var(--primary-light); color: var(--primary-dark);
}
.nav-item.logout { color: #ef4444; margin-top: 6px; }
.nav-item.logout:hover { background: #fef2f2; color: #dc2626; }

.ag-id-chip {
    font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
    background: var(--primary-light); color: var(--primary-dark); letter-spacing: .3px;
}
.ag-id-chip.inactive { background: #fef3c7; color: #b45309; }
.user-avatar.ag { background: var(--agent-grad); }

/* ── Page heading ────────────────────────────────────────────── */
.ag-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.ag-page-head h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -.4px; }
.ag-page-head p { font-size: 13.5px; color: var(--gray-500); margin-top: 2px; }

/* ── Hero (dashboard) ────────────────────────────────────────── */
.ag-hero {
    background: var(--agent-grad); color: #fff; border-radius: 18px;
    padding: 26px 28px; margin-bottom: 22px; position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: center;
    box-shadow: 0 10px 30px rgba(5,150,105,0.25);
}
.ag-hero::before, .ag-hero::after {
    content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08);
}
.ag-hero::before { width: 260px; height: 260px; right: -70px; top: -110px; }
.ag-hero::after  { width: 180px; height: 180px; right: 160px; bottom: -120px; }
.ag-hero > * { position: relative; z-index: 1; }
.ag-hero-greet { font-size: 13px; opacity: .85; font-weight: 500; }
.ag-hero-name { font-size: 22px; font-weight: 800; margin: 2px 0 14px; letter-spacing: -.3px; }
.ag-hero-label { font-size: 11px; font-weight: 600; letter-spacing: .7px; opacity: .8; }
.ag-hero-value { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.ag-hero-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.ag-hero-btn {
    display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 700; transition: transform .15s, background .15s;
}
.ag-hero-btn.solid { background: #fff; color: #047857; }
.ag-hero-btn.solid:hover { color: #047857; transform: translateY(-1px); }
.ag-hero-btn.ghost { background: rgba(255,255,255,0.16); color: #fff; }
.ag-hero-btn.ghost:hover { background: rgba(255,255,255,0.26); color: #fff; }
.ag-hero-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ag-hero-tile { background: rgba(255,255,255,0.13); border-radius: 12px; padding: 12px 14px; backdrop-filter: blur(4px); }
.ag-hero-tile .k { font-size: 10.5px; font-weight: 600; letter-spacing: .5px; opacity: .8; text-transform: uppercase; }
.ag-hero-tile .v { font-size: 17px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Stat cards ──────────────────────────────────────────────── */
.ag-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.ag-stats .stat-card { align-items: center; }
.ag-stats .stat-value,
.stat-card .stat-value {
    font-size: clamp(17px, 1.5vw, 22px); white-space: nowrap; overflow: visible; text-overflow: clip;
    font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.stat-sub strong { color: var(--gray-700); font-weight: 600; }
.stat-icon.emerald { background: #d1fae5; color: #059669; }
.stat-icon.gray    { background: var(--gray-100); color: var(--gray-500); }

/* status summary cards (payin / payout pages) */
.ag-status-card { border-left: 4px solid var(--gray-200); }
.ag-status-card.pending    { border-left-color: #f59e0b; }
.ag-status-card.processing { border-left-color: #06b6d4; }
.ag-status-card.completed  { border-left-color: #10b981; }
.ag-status-card.failed     { border-left-color: #ef4444; }
a.ag-status-card { color: inherit; }
a.ag-status-card:hover { color: inherit; }
.ag-status-card.is-active { box-shadow: 0 0 0 2px var(--primary); }

/* ── Cards / grids ───────────────────────────────────────────── */
.ag-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.card-title-group { display: flex; align-items: center; gap: 10px; color: var(--gray-700); }
.card-title-group h3 { margin: 0; }
.card-title-group svg { color: var(--primary); flex-shrink: 0; }
.card-header .card-link { font-size: 12.5px; font-weight: 600; color: var(--primary-dark); }
.card-body.flush { padding: 0; }
.card-body.flush .search-filter { padding: 16px 20px 0; }
.card-body.flush .pagination { padding: 16px; }

/* filter bar */
.ag-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--gray-100); background: var(--gray-50); }
.ag-filter .search-box { flex: 1 1 240px; }
.ag-filter .form-select { width: auto; min-width: 150px; padding: 8px 12px; font-size: 13px; }

/* table cell helpers */
.cell-main { font-size: 12.5px; font-weight: 600; color: var(--gray-900); }
.cell-sub  { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.cell-amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-pos { color: #059669; font-weight: 700; white-space: nowrap; }
.cell-neg { color: #ef4444; font-weight: 700; white-space: nowrap; }
.cell-muted { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.dir-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .3px; }
.dir-pill.in  { background: #d1fae5; color: #047857; }
.dir-pill.out { background: #fef3c7; color: #b45309; }
.method-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.method-pill img { width: 18px; height: 18px; object-fit: contain; }
.rate-stack { font-size: 12px; line-height: 1.6; white-space: nowrap; }
.rate-stack.green { color: #059669; font-weight: 600; }

/* empty state */
.ag-empty { text-align: center; padding: 44px 20px; color: var(--gray-500); }
.ag-empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.ag-empty-title { font-size: 14.5px; font-weight: 700; color: var(--gray-800); }
.ag-empty-text { font-size: 13px; margin-top: 4px; }

/* ── Mini list (earnings) ────────────────────────────────────── */
.ag-list { list-style: none; margin: 0; padding: 0; }
.ag-list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--gray-100); }
.ag-list li:last-child { border-bottom: none; }
.ag-list-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ag-list-icon.in  { background: #d1fae5; color: #059669; }
.ag-list-icon.out { background: #fef3c7; color: #d97706; }
.ag-list-body { flex: 1; min-width: 0; }
.ag-list-title { font-size: 13px; font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-list-sub { font-size: 11.5px; color: var(--gray-500); margin-top: 1px; }
.ag-list-amt { font-size: 13.5px; font-weight: 800; color: #059669; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Logs ────────────────────────────────────────────────────── */
.ag-log { border: 1px solid var(--gray-200); border-radius: 12px; overflow: hidden; background: var(--white); }
.ag-log + .ag-log { margin-top: 10px; }
.ag-log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--gray-50); cursor: pointer; }
.ag-log-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; min-width: 0; }
.ag-log-time { font-weight: 700; color: var(--gray-800); white-space: nowrap; }
.ag-log-endpoint { font-size: 11px; background: rgba(16,185,129,0.1); color: #065f46; padding: 2px 8px; border-radius: 6px; }
.ag-log-ip { font-size: 11px; color: var(--gray-500); }
.ag-log-toggle { background: none; border: none; color: var(--gray-500); padding: 4px; cursor: pointer; flex-shrink: 0; transition: transform .2s; }
.ag-log.open .ag-log-toggle { transform: rotate(180deg); }
.ag-log-body { display: none; }
.ag-log.open .ag-log-body { display: block; }
.ag-log-body pre { background: #0f172a; color: #a7f3d0; padding: 16px; font-size: 12px; overflow: auto; max-height: 420px; margin: 0; }

/* ── Profile ─────────────────────────────────────────────────── */
.ag-profile-hero { text-align: center; padding: 26px 20px 20px; border-bottom: 1px solid var(--gray-100); }
.ag-avatar-lg { width: 78px; height: 78px; border-radius: 22px; background: var(--agent-grad); color: #fff; font-size: 26px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px rgba(16,185,129,0.3); margin-bottom: 12px; }
.ag-profile-name { font-size: 18px; font-weight: 800; color: var(--gray-900); }
.ag-kv { list-style: none; margin: 0; padding: 6px 20px 14px; }
.ag-kv li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.ag-kv li:last-child { border-bottom: none; }
.ag-kv .k { color: var(--gray-500); }
.ag-kv .v { font-weight: 600; color: var(--gray-900); text-align: right; word-break: break-word; }
.ag-kv .v.green { color: #059669; }
.ag-meta-foot { padding: 12px 20px 18px; font-size: 12px; color: var(--gray-500); display: grid; gap: 4px; background: var(--gray-50); border-top: 1px solid var(--gray-100); }

/* ── Withdraw ────────────────────────────────────────────────── */
.balance-summary-bar {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: 14px;
    margin-bottom: 22px; overflow: hidden;
}
.balance-item { display: flex; flex-direction: column; gap: 4px; padding: 16px 22px; border-right: 1px solid var(--gray-100); }
.balance-item:last-child { border-right: none; }
.balance-divider { display: none; }
.bal-label { font-size: 11.5px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.bal-value { font-size: clamp(17px, 1.6vw, 22px); font-weight: 800; color: var(--gray-900); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bal-value.green { color: #059669; }
.bal-value.red { color: #ef4444; }
.withdraw-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.method-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.method-option {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border: 2px solid var(--gray-200); border-radius: 12px; cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s; font-weight: 600; font-size: 13.5px; color: var(--gray-700);
}
.method-option input { display: none; }
.method-option:hover { border-color: #6ee7b7; transform: translateY(-1px); }
.method-option.selected, .method-option:has(input:checked) { border-color: var(--primary); background: #ecfdf5; color: #065f46; box-shadow: 0 0 0 3px rgba(16,185,129,0.10); }
.method-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.method-icon img { width: 22px; height: 22px; object-fit: contain; }
.method-icon.bkash  { background: #fce4ec; }
.method-icon.nagad  { background: #fff3e0; }
.method-icon.rocket { background: #f3e5f5; }
.input-with-suffix { position: relative; }
.input-with-suffix input { padding-right: 56px; }
.input-suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12.5px; color: var(--gray-400); font-weight: 600; }
.btn-block { width: 100%; margin-top: 6px; justify-content: center; }
.info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.info-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--gray-600); }
.info-list li svg { color: var(--primary); flex-shrink: 0; }
@keyframes ag-spin { to { transform: rotate(360deg); } }
.ag-spin { animation: ag-spin 1s linear infinite; }

/* ── Login ───────────────────────────────────────────────────── */
.ag-login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(16,185,129,0.25), transparent 60%),
                radial-gradient(900px 500px at 110% 110%, rgba(5,150,105,0.25), transparent 60%),
                #0b1220;
}
.ag-login-card { background: #fff; border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 420px; box-shadow: 0 30px 80px rgba(0,0,0,0.35); }
.ag-login-logo { text-align: center; margin-bottom: 18px; }
.ag-login-logo img { height: 46px; }
.ag-login-title { text-align: center; font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -.3px; }
.ag-login-sub { text-align: center; font-size: 13px; color: var(--gray-500); margin: 6px 0 24px; }
.ag-login-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 20px; font-size: 11.5px; font-weight: 700; margin-bottom: 10px; }
.ag-login-btn { width: 100%; padding: 12px; margin-top: 6px; justify-content: center; background: var(--agent-grad); border: none; font-weight: 700; }
.ag-login-foot { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 20px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .withdraw-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .ag-hero { grid-template-columns: 1fr; padding: 22px; }
    .ag-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .ag-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .ag-stats .stat-card { padding: 14px; gap: 12px; }
    .ag-stats .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
    .ag-filter { padding: 12px 14px; }
    .ag-filter .form-select, .ag-filter .btn { flex: 1 1 auto; }
    .balance-summary-bar { grid-template-columns: 1fr; }
    .balance-item { border-right: none; border-bottom: 1px solid var(--gray-100); padding: 14px 18px; }
    .balance-item:last-child { border-bottom: none; }
    .ag-list li { padding: 12px 14px; }
}
@media (max-width: 520px) {
    .ag-stats { grid-template-columns: 1fr; }
    .ag-hero-tiles { grid-template-columns: 1fr 1fr; }
    .method-selector { grid-template-columns: 1fr; }
    .ag-page-head h1 { font-size: 19px; }
    .ag-login-card { padding: 28px 22px; }
}
