/* ============================================
   Financial Planning Group of Samiti
   Admin Panel — Premium Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #10102a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-sidebar: #0d0d20;
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-input-focus: rgba(255, 255, 255, 0.1);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.05);

    --text-primary: #f0f0f5;
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.35);

    --accent-primary: #6c5ce7;
    --accent-secondary: #00cec9;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #00cec9);
    --accent-gradient-2: linear-gradient(135deg, #a855f7, #6366f1);
    --accent-gradient-3: linear-gradient(135deg, #6366f1, #06b6d4);

    --success: #00b894;
    --success-bg: rgba(0, 184, 148, 0.12);
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.12);
    --warning: #fdcb6e;
    --warning-bg: rgba(253, 203, 110, 0.12);
    --info: #74b9ff;
    --info-bg: rgba(116, 185, 255, 0.12);

    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--accent-secondary); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--accent-primary); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ================================================
   LAYOUT — Sidebar + Content
   ================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

.sidebar-brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand img {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    object-fit: cover;
    box-shadow: var(--shadow-glow);
    margin-bottom: 10px;
}

.sidebar-brand h6 {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 2px;
    line-height: 1.3;
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: visible;
    max-height: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.sidebar-nav .nav-link.active i {
    color: #fff;
}

.nav-spacer { display: none; }

.sidebar-nav .nav-link.nav-logout {
    margin-top: auto;
    color: var(--danger);
}
.sidebar-nav .nav-link.nav-logout:hover {
    background: var(--danger-bg);
}

/* ---- Mobile sidebar overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 28px 32px;
    transition: margin-left var(--transition-normal);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    font-size: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

/* ---- Mobile menu toggle ---- */
.mobile-menu-btn {
    display: none;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.mobile-menu-btn:hover { background: var(--bg-card-hover); }

/* ================================================
   CARDS
   ================================================ */

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
    transition: var(--transition-normal);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    backdrop-filter: blur(20px);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(108, 92, 231, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.icon-purple { background: rgba(108, 92, 231, 0.15); color: var(--accent-primary); }
.icon-teal { background: rgba(0, 206, 201, 0.15); color: var(--accent-secondary); }
.icon-green { background: var(--success-bg); color: var(--success); }
.icon-red { background: var(--danger-bg); color: var(--danger); }
.icon-blue { background: var(--info-bg); color: var(--info); }
.icon-yellow { background: var(--warning-bg); color: var(--warning); }

/* ================================================
   TABLES
   ================================================ */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.table-container .table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.table-container .table-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: rgba(255,255,255,0.02);
}

.data-table tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

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

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 14px 20px;
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table .user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-table .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.data-table .user-info .name {
    font-weight: 600;
    font-size: 13.5px;
}

.data-table .user-info .sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ================================================
   BADGES
   ================================================ */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }
.badge-credit { background: var(--success-bg); color: var(--success); }
.badge-debit { background: var(--danger-bg); color: var(--danger); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-verified { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ================================================
   BUTTONS
   ================================================ */

.btn-primary-gradient {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-normal);
    font-family: 'Inter', sans-serif;
}

.btn-primary-gradient:hover {
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
}

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-action-text {
    height: 34px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    color: var(--text-secondary);
}

.btn-action-text:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-success-soft {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, 0.2);
}
.btn-success-soft:hover {
    background: rgba(0, 184, 148, 0.2);
}

.btn-danger-soft {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(255, 107, 107, 0.2);
}
.btn-danger-soft:hover {
    background: rgba(255, 107, 107, 0.2);
}

.btn-warning-soft {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(253, 203, 110, 0.2);
}
.btn-warning-soft:hover {
    background: rgba(253, 203, 110, 0.2);
}

.btn-info-soft {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(116, 185, 255, 0.2);
}

/* ================================================
   FORMS
   ================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-fast);
    outline: none;
}

.form-input:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* ================================================
   MODALS
   ================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-box-lg {
    max-width: 720px;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 28px;
    border-top: 1px solid var(--border-color);
}

/* Modal tabs / steps */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
}

.modal-tab {
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.modal-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

/* ================================================
   DETAIL / PROFILE PAGE
   ================================================ */

.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}

.profile-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-info .profile-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.profile-stat {
    text-align: center;
}

.profile-stat .value {
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-stat .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Detail info grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    backdrop-filter: blur(20px);
}

.detail-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-card h4 i {
    color: var(--accent-primary);
    font-size: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child { border-bottom: none; }

.detail-row .label {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-row .value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* ================================================
   SEARCH & FILTERS
   ================================================ */

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
}

.search-box input {
    padding-left: 40px;
    width: 260px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    backdrop-filter: blur(20px);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-info { border-left: 3px solid var(--info); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

.toast-message {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}

/* ================================================
   LOADING / SKELETON
   ================================================ */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

.loading-row td {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

.empty-state h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ================================================
   FORM ROW GRID
   ================================================ */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ================================================
   GRID LAYOUTS
   ================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ================================================
   ANIMATIONS
   ================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.4s ease forwards;
}

.animate-delay-1 { animation-delay: 0.05s; opacity: 0; }
.animate-delay-2 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-3 { animation-delay: 0.15s; opacity: 0; }
.animate-delay-4 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-5 { animation-delay: 0.25s; opacity: 0; }
.animate-delay-6 { animation-delay: 0.3s; opacity: 0; }

/* ================================================
   UTILITY
   ================================================ */

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-accent { color: var(--accent-primary) !important; }

.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-24 { margin-top: 24px; }
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-primary);
}

/* Amount display */
.amount-positive { color: var(--success); font-weight: 700; }
.amount-negative { color: var(--danger); font-weight: 700; }

/* ================================================
   LOGIN PAGE
   ================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 206, 201, 0.1), transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

.login-card .logo-wrapper {
    text-align: center;
    margin-bottom: 28px;
}

.login-card .logo-wrapper img {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: var(--shadow-glow);
}

.login-card h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13.5px;
    margin-bottom: 32px;
}

.login-card .btn-login {
    width: 100%;
    padding: 13px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: 'Inter', sans-serif;
}

.login-card .btn-login:hover {
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
}

/* ================================================
   CHART CONTAINER
   ================================================ */

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(20px);
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container h3 i {
    color: var(--accent-primary);
}

/* ================================================
   MOBILE CARD VIEW (replaces table on small screens)
   ================================================ */

.mobile-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: var(--transition-fast);
}

.mobile-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255,255,255,0.12);
}

.mobile-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mobile-card-top .user-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.mobile-card-top .user-info {
    flex: 1;
    min-width: 0;
}

.mobile-card-top .user-info .name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-card-top .user-info .sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.mobile-card-top .card-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.mobile-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}

.mobile-card-field {
    display: flex;
    flex-direction: column;
}

.mobile-card-field .mcf-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.mobile-card-field .mcf-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.mobile-card-actions .btn-icon {
    flex: 1;
    width: auto;
    height: 36px;
    font-size: 13px;
    gap: 6px;
}

.mobile-card-actions .btn-icon span {
    font-size: 12px;
    font-weight: 500;
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .profile-actions {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .page-actions {
        width: 100%;
    }

    /* Table: horizontal scroll on the container */
    .table-container {
        overflow: hidden;
    }

    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table thead th {
        padding: 12px 14px;
        font-size: 11px;
    }

    .data-table tbody td {
        padding: 12px 14px;
        font-size: 12.5px;
    }

    /* Show mobile cards, hide desktop table for user/agent lists */
    .desktop-table-only {
        display: none;
    }

    .mobile-cards {
        display: flex;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-box {
        margin: 10px;
        max-height: 90vh;
    }

    .login-card {
        padding: 32px 24px;
        margin: 16px;
    }

    .profile-top {
        flex-direction: column;
        text-align: center;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .profile-avatar {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }

    .modal-tabs {
        overflow-x: auto;
        padding: 0 16px;
    }

    .modal-tab {
        padding: 12px 14px;
        font-size: 12px;
        white-space: nowrap;
    }

    .mobile-card-body {
        grid-template-columns: 1fr 1fr;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .btn-primary-gradient {
        width: 100%;
        justify-content: center;
    }
}

/* ================================================
   NEW ADDITIONS — Mobile Topbar, Sidebar User,
   Global Toast, Share Section, Toggle
   ================================================ */

/* Mobile Topbar */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    margin: -28px -32px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-topbar .mobile-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.mobile-topbar .mobile-logout {
    color: var(--danger);
    font-size: 1.2rem;
    text-decoration: none;
}

@media (max-width: 768px) {
    .mobile-topbar { display: flex; }
    .mobile-menu-btn { display: flex; }
}

/* Sidebar User Footer */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-info-sm .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

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

/* Sidebar open on mobile */
.sidebar.open {
    transform: translateX(0) !important;
}

.sidebar-overlay.show {
    display: block;
}

/* Global Toast */
.global-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 9999;
    pointer-events: none;
}

.global-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.global-toast.error { background: var(--danger); }
.global-toast.warning { background: var(--warning); color: #333; }

/* btn-secondary */
.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    font-family: 'Inter', sans-serif;
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 100px;
    transition: 0.3s;
    border: 1px solid var(--border-color);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
    border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Share card */
.share-preview-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.6;
    margin-top: 12px;
}

.share-preview-box .highlight {
    color: var(--accent-secondary);
    font-weight: 600;
}

/* Copy button inline */
.input-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-copy-row .form-input {
    flex: 1;
}

.dark { background: #111; }

/* Utility */
.mb-24 { margin-bottom: 24px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.fw-700 { font-weight: 700; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted-sm { color: var(--text-muted); font-size: 12px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
