:root {
    --bg-main: #080c16;
    --bg-card: rgba(18, 26, 44, 0.75);
    --bg-card-hover: rgba(25, 36, 60, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(47, 105, 254, 0.4);
    --accent-blue: #2f69fe;
    --accent-blue-hover: #4379ff;
    --accent-blue-glow: rgba(47, 105, 254, 0.25);
    --accent-green: #10b981;
    --accent-green-bg: rgba(16, 185, 129, 0.15);
    --accent-red: #ef4444;
    --accent-red-bg: rgba(239, 68, 68, 0.15);
    --accent-yellow: #f59e0b;
    --accent-yellow-bg: rgba(245, 158, 11, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

.portal-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.portal-header {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-wrap {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(47, 105, 254, 0.12);
    border: 1px solid rgba(47, 105, 254, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-title {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--accent-blue);
    text-transform: uppercase;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    background: rgba(47, 105, 254, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(47, 105, 254, 0.3);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

.user-badge.traffer {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
}

.user-id {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refresh:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-active);
}

/* Navigation Tabs */
.portal-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.portal-nav::-webkit-scrollbar {
    display: none;
}

.nav-tab-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.nav-tab-btn:hover {
    color: #ffffff;
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.nav-tab-btn.active {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 16px var(--accent-blue-glow);
}

.tab-badge {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
}

/* Views */
.portal-view {
    display: none;
    flex-direction: column;
    gap: 16px;
}
.portal-view.active {
    display: flex;
}

.view-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.view-title {
    font-size: 18px;
    font-weight: 700;
}

.view-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
}

.metric-lbl {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-val {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.metric-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Traffer Finance Banner */
.traffer-finance-banner {
    background: linear-gradient(135deg, rgba(47, 105, 254, 0.15) 0%, rgba(18, 26, 44, 0.8) 100%);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.tf-balance-col {
    display: flex;
    flex-direction: column;
}

.tf-lbl {
    font-size: 12px;
    font-weight: 600;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tf-val {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
}

/* Cards & Capsules */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-weight: 600;
    font-size: 14px;
}

.card-hint {
    font-size: 12px;
    color: var(--accent-blue);
    font-weight: 600;
}

.card-body {
    padding: 16px;
}

.card-body.p-0 {
    padding: 0;
}

/* Bot Capsule */
.bot-capsule {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    transition: all 0.2s;
    gap: 12px;
    flex-wrap: wrap;
}

.bot-capsule:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.bot-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(47, 105, 254, 0.15);
    border: 1px solid rgba(47, 105, 254, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #60a5fa;
}

.bot-meta {
    display: flex;
    flex-direction: column;
}

.bot-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bot-title-text {
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
}

.bot-username-link {
    font-size: 12px;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}
.bot-username-link:hover {
    text-decoration: underline;
}

.bot-owner-text {
    font-size: 11px;
    color: var(--text-muted);
}

.bot-stats-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.bot-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bot-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Master Kill-Switch Toggle */
.btn-killswitch {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-killswitch.active {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.btn-killswitch.active:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-killswitch.inactive {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-killswitch.inactive:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-edit-bot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-edit-bot:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.portal-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.portal-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.portal-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.user-cell-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(47, 105, 254, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: #60a5fa;
    flex-shrink: 0;
}

.user-name-line {
    font-weight: 600;
    color: #ffffff;
    text-align: left;
}

/* Tier Badges */
.badge-tier {
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}
.badge-tier.platinum {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
    border: 1px solid rgba(236, 72, 153, 0.4);
    color: #f472b6;
}
.badge-tier.plus {
    background: rgba(47, 105, 254, 0.2);
    border: 1px solid rgba(47, 105, 254, 0.4);
    color: #60a5fa;
}
.badge-tier.base {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.badge-tier.guest {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

/* Status Badges */
.status-pill {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.status-pill.pending {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-pill.approved {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-pill.rejected {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Action Buttons */
.btn-action-primary {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 9px 18px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px var(--accent-blue-glow);
}
.btn-action-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 9px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.btn-secondary-link {
    background: rgba(47, 105, 254, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(47, 105, 254, 0.3);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-secondary-link:hover {
    background: rgba(47, 105, 254, 0.2);
    color: #ffffff;
}

.btn-sm-action {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.btn-sm-action.approve {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.btn-sm-action.approve:hover {
    background: rgba(16, 185, 129, 0.3);
}
.btn-sm-action.reject {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-sm-action.reject:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.search-input-wrap {
    flex: 1;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-input-wrap input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px 9px 36px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
}
.search-input-wrap input:focus {
    border-color: var(--accent-blue);
}

.filter-select-wrap select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
}
.filter-select-wrap select option {
    background: #0f172a;
    color: #ffffff;
}

.btn-filter-apply {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
}

.btn-page {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 12px;
    color: var(--text-muted);
}

/* Settings View */
.settings-card-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-group-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-title {
    font-size: 15px;
    font-weight: 700;
}

.group-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.input-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.input-field-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-field-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
}
.input-field-group input:focus {
    border-color: var(--accent-blue);
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.settings-save-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}

.btn-save-primary {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 12px 28px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--accent-blue-glow);
    transition: all 0.2s;
}
.btn-save-primary:hover {
    background: var(--accent-blue-hover);
}

.save-status {
    font-size: 13px;
    font-weight: 500;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.modal-dialog {
    background: #0d1322;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 700;
    font-size: 15px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}
.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-notice {
    background: rgba(47, 105, 254, 0.1);
    border: 1px solid rgba(47, 105, 254, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 12px;
    color: #bfdbfe;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Utilities */
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.empty-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .portal-wrapper { padding: 10px; }
    .portal-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .header-user { width: 100%; justify-content: space-between; }
    .bot-capsule { flex-direction: column; align-items: flex-start; }
    .bot-right { width: 100%; justify-content: space-between; margin-top: 8px; }
}
