/* ================================================================
   AI Chillies Dashboard — Custom Styles
   ================================================================ */

:root {
    --sidebar-w: 250px;
    --primary:   #3b82f6;
    --primary-d: #2563eb;
    --success:   #10b981;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --info:      #06b6d4;
    --gray-50:   #f9fafb;
    --gray-100:  #f3f4f6;
    --gray-200:  #e5e7eb;
    --gray-300:  #d1d5db;
    --gray-400:  #9ca3af;
    --gray-500:  #6b7280;
    --gray-600:  #4b5563;
    --gray-700:  #374151;
    --gray-800:  #1f2937;
    --gray-900:  #111827;
    --sidebar-bg:#111827;
    --sidebar-fg:#9ca3af;
    --sidebar-active: rgba(59,130,246,.15);
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    overflow-x: hidden;
}

/* ================================================================
   LAYOUT
   ================================================================ */

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

/* ================================================================
   SIDEBAR
   ================================================================ */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.brand-icon i { color: #fff; font-size: 15px; }
.brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.brand-logo { max-height: 36px; max-width: 160px; object-fit: contain; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.user-avatar-sm {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; color: #fff;
    flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name {
    font-size: 13px; font-weight: 600; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email-small {
    font-size: 10px; color: rgba(255,255,255,.5);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 140px;
}
.user-role-badge {
    display: inline-block;
    font-size: 10px; font-weight: 600;
    padding: 1px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 2px;
}
.role-admin    { background: rgba(59,130,246,.3); color: #93c5fd; }
.role-reseller { background: rgba(16,185,129,.3); color: #6ee7b7; }
.impersonating { font-size: 9px; opacity: .7; }

.sidebar-impersonate-bar {
    background: rgba(245,158,11,.15);
    color: #fcd34d;
    font-size: 11px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.exit-link {
    color: #fcd34d; font-weight: 600; text-decoration: none;
    font-size: 11px;
}
.exit-link:hover { text-decoration: underline; }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}
.nav-section-label {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.3);
    margin-top: 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--sidebar-fg);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}
.nav-item i { width: 16px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item:hover {
    background: rgba(255,255,255,.05);
    color: #e5e7eb;
}
.nav-item.active {
    background: var(--sidebar-active);
    color: #93c5fd;
    border-left-color: var(--primary);
}
.nav-item.text-danger { color: #fca5a5 !important; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    color: var(--sidebar-fg);
    text-decoration: none;
    font-size: 13px;
    border-radius: 5px;
    transition: all 0.15s;
}
.footer-link:hover { background: rgba(255,255,255,.06); color: #e5e7eb; }
.footer-link.text-danger:hover { color: #fca5a5; }
.footer-link i { width: 14px; text-align: center; }

/* ================================================================
   MAIN CONTENT
   ================================================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOPBAR */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.sidebar-toggle {
    display: none;
    background: none; border: none;
    color: var(--gray-500);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
}
.topbar-title { flex: 1; }
.topbar-title h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.2;
}
.topbar-title span {
    font-size: 12px;
    color: var(--gray-400);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.expiry-badge {
    background: var(--gray-100);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 5px;
}
.expiry-warn {
    background: #fef3c7;
    color: #92400e;
}

/* PAGE CONTENT */
.page-content {
    flex: 1;
    padding: 24px;
}

/* ================================================================
   FLASH ALERTS
   ================================================================ */

.flash-alert {
    margin: 0 24px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}
.flash-alert button {
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    opacity: .6; line-height: 1;
}
.flash-alert button:hover { opacity: 1; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error   { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info    { background: #dbeafe; color: #1e40af; }

/* ================================================================
   PANELS (Cards)
   ================================================================ */

.panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}
.panel-action {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}
.panel-action:hover { text-decoration: underline; }
.panel-toolbar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.panel-body {
    padding: 20px;
}

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

.stats-grid {
    display: grid;
    gap: 16px;
}
.stats-grid.four-col  { grid-template-columns: repeat(4, 1fr); }
.stats-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.stats-grid.two-col   { grid-template-columns: repeat(2, 1fr); }

.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.icon-blue   { background: #dbeafe; color: #2563eb; }
.icon-green  { background: #d1fae5; color: #059669; }
.icon-yellow { background: #fef3c7; color: #d97706; }
.icon-red    { background: #fee2e2; color: #dc2626; }
.icon-purple { background: #ede9fe; color: #7c3aed; }
.icon-cyan   { background: #cffafe; color: #0891b2; }
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-teal   { background: #ccfbf1; color: #0f766e; }

.stat-body { min-width: 0; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 11.5px; font-weight: 500; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* ================================================================
   ROW COLS (2-col layout)
   ================================================================ */

.row-cols-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.data-table th {
    padding: 10px 16px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    text-align: left;
}
.data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    color: var(--gray-700);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }
.empty-row {
    text-align: center !important;
    padding: 36px 16px !important;
    color: var(--gray-400) !important;
    font-style: italic;
}
.actions-cell { white-space: nowrap; }
.text-nowrap { white-space: nowrap; }

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

.btn { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; border-radius: 6px; transition: all .15s; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 5px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-secondary { background: var(--gray-100); border-color: var(--gray-300); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; color: #fff; }
.btn-outline-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline-secondary:hover { background: var(--gray-100); }
.btn-outline-warning { background: transparent; border: 1px solid var(--warning); color: var(--warning); }
.btn-outline-warning:hover { background: var(--warning); color: #fff; }
.btn-outline-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-success { background: transparent; border: 1px solid var(--success); color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-center { justify-content: center; }

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 5px;
}
.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 13.5px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-900);
    transition: border-color .15s, box-shadow .15s;
    appearance: auto;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.search-input {
    padding: 7px 12px 7px 34px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%239ca3af' viewBox='0 0 20 20'%3E%3Cpath fill-rule='evenodd' d='M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat 10px center / 16px;
    min-width: 220px;
    transition: border-color .15s;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

/* ================================================================
   PLAN CARDS (selection grid)
   ================================================================ */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.plan-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all .15s;
    position: relative;
    background: #fff;
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.plan-card.selected { border-color: var(--primary); background: #eff6ff; }
.plan-name { font-size: 14px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.plan-validity { font-size: 12px; color: var(--gray-500); }
.plan-check {
    position: absolute; top: 8px; right: 8px;
    color: var(--primary);
    font-size: 16px;
    opacity: 0;
    transition: opacity .15s;
}
.plan-card.selected .plan-check { opacity: 1; }
.plan-card-disabled { opacity: 0.5; cursor: not-allowed; border-color: #dc3545 !important; }
.plan-card-disabled:hover { border-color: #dc3545 !important; box-shadow: none; }
.plan-expiry { font-size: 12px; }

/* ================================================================
   CONFIRM DETAILS
   ================================================================ */

.confirm-details {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
}
.confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
}
.confirm-row:last-child { border-bottom: none; }
.confirm-row span { color: var(--gray-500); }

/* ================================================================
   INFO ROWS (account info)
   ================================================================ */

/* Account info grid (reseller dashboard) */
.acct-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}
.acct-info-block { }
.acct-info-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); font-weight: 600; margin-bottom: 4px; }
.acct-info-value { font-size: 15px; color: var(--gray-900); font-weight: 500; }

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--gray-500); font-weight: 500; }
.info-value { color: var(--gray-800); font-weight: 500; text-align: right; }

/* ================================================================
   QUICK ACTIONS
   ================================================================ */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.qa-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-decoration: none;
    color: var(--gray-700);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    transition: all .15s;
    box-shadow: var(--shadow);
}
.qa-card:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.qa-card i { font-size: 24px; }
.qa-card span { font-size: 13px; font-weight: 500; }

/* ================================================================
   EXPIRED RESELLER BANNER
   ================================================================ */

.expired-banner {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 32px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}
.expired-icon {
    width: 80px; height: 80px;
    background: #fee2e2;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 24px;
    font-size: 32px;
    color: var(--danger);
}
.expired-banner h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.expired-banner p { color: var(--gray-500); margin-bottom: 16px; }
.renewal-amount { font-size: 28px; font-weight: 700; color: var(--primary); display: block; margin: 8px 0; }
.qr-wrap { margin: 24px auto; }
.qr-img { max-width: 180px; border-radius: 8px; border: 1px solid var(--gray-200); margin-bottom: 8px; }
.upi-id { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.expired-instructions {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #1e40af;
    margin-top: 20px;
    text-align: left;
}

/* ================================================================
   EXPIRY ITEMS (legacy + new card grid)
   ================================================================ */

.expiry-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 12px;
}
.expiry-item:last-child { border-bottom: none; }

/* New expiry cards grid (dashboard) */
.expiry-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.expiry-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow .15s;
}
.expiry-card:hover { box-shadow: var(--shadow-md); }
.expiry-card-urgent { border-color: #fca5a5; background: #fff5f5; }
.expiry-card-warn   { border-color: #fcd34d; background: #fffbeb; }
.expiry-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.expiry-card-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
    flex-shrink: 0;
}
.expiry-card-info { flex: 1; min-width: 0; }
.expiry-card-name  { font-weight: 600; font-size: 14px; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expiry-card-email { font-size: 11px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expiry-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--gray-600);
}
.expiry-card-date    { flex: 1; }
.expiry-card-renewal { color: var(--gray-500); }

/* Table description truncation */
.text-truncate-cell {
    display: block;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state-sm {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.empty-state-sm i { font-size: 24px; }

/* ================================================================
   MODAL
   ================================================================ */

.modal-content { border: none; border-radius: 10px; box-shadow: 0 20px 40px rgba(0,0,0,.12); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-title { font-size: 15px; font-weight: 600; color: var(--gray-900); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); }

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

.badge { display: inline-block; padding: 3px 8px; font-size: 11px; font-weight: 600; border-radius: 20px; line-height: 1.4; }
.bg-primary { background: #dbeafe !important; color: #1d4ed8 !important; }
.bg-success { background: #d1fae5 !important; color: #065f46 !important; }
.bg-warning { background: #fef3c7 !important; }
.text-dark  { color: #374151 !important; }
.bg-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.bg-secondary { background: var(--gray-100) !important; color: var(--gray-600) !important; }
.bg-info    { background: #cffafe !important; }

/* ================================================================
   PREVIEW IMAGE
   ================================================================ */

.preview-img-wrap { padding: 8px; border: 1px solid var(--gray-200); border-radius: 6px; display: inline-block; background: var(--gray-50); }

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

.login-body {
    background: linear-gradient(135deg, #1e2a3a 0%, #1a1f2e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-wrapper { width: 100%; max-width: 400px; }
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-icon-wrap {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    font-size: 26px; color: #fff;
    box-shadow: 0 8px 20px rgba(59,130,246,.3);
}
.login-brand h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.login-brand p { font-size: 13px; color: var(--gray-500); }
.login-logo { max-width: 160px; max-height: 60px; object-fit: contain; margin-bottom: 12px; }
.login-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap > i:first-child {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400); font-size: 14px;
    pointer-events: none;
}
.input-icon-wrap input {
    width: 100%;
    padding: 10px 40px 10px 36px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 7px;
    background: #fff; color: var(--gray-900);
    transition: border-color .15s, box-shadow .15s;
}
.input-icon-wrap input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.toggle-pw {
    position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--gray-400); cursor: pointer;
    padding: 4px;
}
.toggle-pw:hover { color: var(--gray-600); }
.btn-login {
    width: 100%;
    padding: 11px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 4px;
}
.btn-login:hover { background: var(--primary-d); }
.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--gray-400); }

/* ================================================================
   WALLET BADGE (topbar)
   ================================================================ */

.wallet-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
.wallet-ok    { background: #d1fae5; color: #065f46; }
.wallet-low   { background: #fef3c7; color: #92400e; }
.wallet-empty { background: #fee2e2; color: #991b1b; }
.wallet-warn-text { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* ================================================================
   ACTIVATION FLOW (step-based)
   ================================================================ */

.activate-step { display: none; }
.activate-step.active { display: block; }

/* Plan selection cards for activation */
.plan-select-card {
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    background: #fff;
    height: 100%;
}
.plan-select-card:hover { border-color: var(--primary); background: #eff6ff; box-shadow: var(--shadow-md); }
.plan-select-card.selected { border-color: var(--primary); background: #eff6ff; }
.plan-select-card.plan-card-no-funds { opacity: 0.55; cursor: not-allowed; }
.plan-select-card.plan-card-no-funds:hover { border-color: var(--danger); background: #fff5f5; box-shadow: none; }
.plan-select-card .plan-check {
    position: absolute; top: 10px; right: 10px;
    color: var(--primary); font-size: 18px;
    opacity: 0; transition: opacity .15s;
}
.plan-select-card.selected .plan-check { opacity: 1; }
.plan-price-tag { font-size: 22px; font-weight: 700; color: #1d4ed8; }

/* Client lookup result */
.client-info-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 4px;
}
.client-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ================================================================
   WALLET TRANSACTIONS
   ================================================================ */

.txn-credit { color: #059669; font-weight: 600; }
.txn-debit  { color: #dc2626; font-weight: 600; }

/* Stat icons — extra colours */
.icon-orange { background: #ffedd5; color: #c2410c; }
.icon-purple { background: #ede9fe; color: #7c3aed; }

/* ================================================================
   PENDING PAYMENTS / RESELLER DETAIL
   ================================================================ */

.pending-payment-card {
    border: 1px solid #fde68a;
    background: #fffbeb;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}
.pending-payment-card.cleared { border-color: #a7f3d0; background: #ecfdf5; }
.pending-payment-card.partial { border-color: #bfdbfe; background: #eff6ff; }

.progress-bar-custom {
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-bar-custom .fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width .3s;
}

/* ================================================================
   WALLET BALANCE CARD (large display)
   ================================================================ */

.wallet-balance-card {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border-radius: 16px;
    padding: 28px 28px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.wallet-balance-card::before {
    content: '';
    position: absolute;
    right: -30px; top: -30px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.wallet-balance-card .bal-label { font-size: 13px; opacity: .8; font-weight: 500; margin-bottom: 4px; }
.wallet-balance-card .bal-amount { font-size: 36px; font-weight: 700; line-height: 1.1; }
.wallet-balance-card .bal-sub { font-size: 12px; opacity: .7; margin-top: 6px; }
.wallet-balance-card.danger { background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%); }
.wallet-balance-card.warning { background: linear-gradient(135deg, #92400e 0%, #f59e0b 100%); }

/* ================================================================
   FILTER BAR
   ================================================================ */

.filter-bar {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.filter-bar .form-label { font-size: 11px; font-weight: 600; color: var(--gray-500); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.filter-bar .form-control, .filter-bar .form-select {
    font-size: 13px;
    padding: 6px 10px;
    border-color: var(--gray-200);
}
.filter-bar .form-control:focus, .filter-bar .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }

/* ================================================================
   UTILITIES
   ================================================================ */

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.text-muted { color: var(--gray-500) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-end { text-align: right; }
.fw-semibold { font-weight: 600; }
.small { font-size: 12px; }
.alert.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 10px 14px; border-radius: 6px; font-size: 13px; }

/* ================================================================
   CUSTOM AIC POPUP SYSTEM (replaces Bootstrap modals for alerts)
   ================================================================ */

.aic-popup-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
    padding: 20px;
    pointer-events: none;
}
.aic-popup-overlay.visible { opacity: 1; visibility: visible; pointer-events: all; }

.aic-popup {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0,0,0,.22);
    max-width: 420px;
    width: 100%;
    position: relative;
    transform: scale(.92) translateY(10px);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
    overflow: hidden;
}
.aic-popup-overlay.visible .aic-popup { transform: scale(1) translateY(0); }

.aic-popup-close {
    position: absolute; top: 12px; right: 14px;
    background: rgba(0,0,0,.07); border: none;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 14px; color: #6b7280;
    transition: background .15s;
    z-index: 1;
}
.aic-popup-close:hover { background: rgba(0,0,0,.14); }

.aic-alert-popup { padding: 32px 28px; text-align: center; }
.aic-alert-icon { font-size: 42px; margin-bottom: 12px; line-height: 1; }
.aic-alert-title { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 8px; }
.aic-alert-message { font-size: 14px; color: #4b5563; line-height: 1.6; margin-bottom: 20px; }

.btn-aic-primary {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff; border: none; border-radius: 10px;
    padding: 10px 24px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .15s;
}
.btn-aic-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.btn-aic-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f3f4f6; color: #374151; border: none; border-radius: 10px;
    padding: 10px 24px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .15s;
}
.btn-aic-secondary:hover { background: #e5e7eb; }

/* Announcement popup */
.announcement-popup { max-width: 500px; }
.announcement-popup-header {
    padding: 24px 24px 20px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.announcement-popup-header h4 { margin: 0; font-size: 18px; font-weight: 700; }
.announcement-popup-img { width: 100%; max-height: 220px; object-fit: cover; }
.announcement-popup-body { padding: 20px 24px; font-size: 14px; color: #374151; line-height: 1.7; }
.announcement-popup-footer { padding: 0 24px 20px; text-align: center; }

/* ================================================================
   ANNOUNCEMENT TICKER
   ================================================================ */

.announcement-ticker {
    display: flex; align-items: center;
    background: #2563eb; color: #fff;
    padding: 8px 0; overflow: hidden;
    font-size: 13px; font-weight: 500;
    position: relative;
}
.ticker-label {
    flex-shrink: 0;
    padding: 0 16px;
    font-weight: 700;
    border-right: 1px solid rgba(255,255,255,.3);
    margin-right: 16px;
    white-space: nowrap;
}
.ticker-wrap { flex: 1; overflow: hidden; }
.ticker-text {
    display: inline-block;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-left: 100%;
}
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* ================================================================
   WELCOME BANNER
   ================================================================ */

.welcome-banner {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 60%, #7c3aed 100%);
    border-radius: 16px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    color: #fff;
}
.welcome-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,.15);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.welcome-greeting { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.welcome-sub { font-size: 13px; opacity: .85; }

/* ================================================================
   LOW WALLET WARNING BANNER
   ================================================================ */

.low-wallet-banner {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.low-wallet-warn {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================================================================
   ATTRACTIVE CUSTOM MODAL (for activate/renew/reset confirm)
   ================================================================ */

.aic-modal {
    max-width: 480px;
}
.aic-modal-header {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    padding: 20px 24px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.aic-modal-header h5 { margin: 0; font-size: 17px; font-weight: 700; }
.aic-modal-header .aic-popup-close { color: rgba(255,255,255,.8); background: rgba(255,255,255,.15); }
.aic-modal-header .aic-popup-close:hover { background: rgba(255,255,255,.25); color: #fff; }
.aic-modal-body { padding: 24px; }
.aic-modal-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

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

@media (max-width: 1200px) {
    .stats-grid.four-col { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .row-cols-2 { grid-template-columns: 1fr; }
    .stats-grid.three-col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid.four-col, .stats-grid.three-col { grid-template-columns: 1fr 1fr; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .welcome-banner { padding: 16px 18px; }
    .welcome-greeting { font-size: 17px; }
    .panel-head { flex-wrap: wrap; gap: 8px; }
    .confirm-details { font-size: 13px; }
    .plan-select-card { padding: 14px 12px; }
    .plan-price-tag { font-size: 18px; }
    .aic-popup { margin: 0 12px; }
    .announcement-ticker { font-size: 12px; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control, .filter-bar .form-select { width: 100%; }
    .topbar-right { gap: 8px; }
    .wallet-badge { padding: 5px 10px; font-size: 12px; }
    .data-table th, .data-table td { font-size: 12px; padding: 8px 10px; }
}

@media (max-width: 480px) {
    .stats-grid.four-col, .stats-grid.three-col, .stats-grid.two-col { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
    .login-card { padding: 28px 20px; }
    .welcome-icon { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr !important; }
    .aic-alert-popup { padding: 24px 18px; }
    .btn-aic-primary, .btn-aic-secondary { padding: 9px 18px; font-size: 13px; }
}
