:root,
html[data-bp-theme="emerald-ocean"] {
    --bp-primary: #0D9488;
    --bp-primary-dark: #0F766E;
    --bp-secondary: #0EA5E9;
    --bp-grad: linear-gradient(135deg, #10B981 0%, #0EA5E9 100%);
    --bp-sidebar-bg: linear-gradient(165deg, #059669 0%, #0D9488 46%, #0284C7 100%);
    --bp-tint-bg: #ECFDF5;
    --bp-tint-border: #A7F3D0;
    --bp-tint-fg: #047857;
    --bp-glow: rgba(14, 165, 233, 0.42);
    --bp-ring: rgba(16, 185, 129, 0.22);
}
html[data-bp-theme="royal-indigo"] {
    --bp-primary: #4F46E5;
    --bp-primary-dark: #4338CA;
    --bp-secondary: #7C3AED;
    --bp-grad: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --bp-sidebar-bg: linear-gradient(165deg, #3730A3 0%, #4F46E5 48%, #7C3AED 100%);
    --bp-tint-bg: #EEF2FF;
    --bp-tint-border: #C7D2FE;
    --bp-tint-fg: #4338CA;
    --bp-glow: rgba(79, 70, 229, 0.44);
    --bp-ring: rgba(79, 70, 229, 0.20);
}
html[data-bp-theme="cobalt-blue"] {
    --bp-primary: #2563EB;
    --bp-primary-dark: #1D4ED8;
    --bp-secondary: #06B6D4;
    --bp-grad: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
    --bp-sidebar-bg: linear-gradient(165deg, #1E40AF 0%, #2563EB 50%, #0284C7 100%);
    --bp-tint-bg: #EFF6FF;
    --bp-tint-border: #BFDBFE;
    --bp-tint-fg: #1D4ED8;
    --bp-glow: rgba(37, 99, 235, 0.42);
    --bp-ring: rgba(37, 99, 235, 0.20);
}
html[data-bp-theme="sunset-coral"] {
    --bp-primary: #EA580C;
    --bp-primary-dark: #C2410C;
    --bp-secondary: #EC4899;
    --bp-grad: linear-gradient(135deg, #F97316 0%, #EC4899 54%, #9333EA 100%);
    --bp-sidebar-bg: linear-gradient(165deg, #EA580C 0%, #DB2777 54%, #7E22CE 100%);
    --bp-tint-bg: #FFF7ED;
    --bp-tint-border: #FED7AA;
    --bp-tint-fg: #C2410C;
    --bp-glow: rgba(236, 72, 153, 0.44);
    --bp-ring: rgba(249, 115, 22, 0.22);
}

:root {
    --ax-body: #F0F4F8;
    --ax-card: #FFFFFF;
    --ax-topbar: #FFFFFF;
    --ax-surface-alt: #F8FAFC;
    --ax-border: #E5E7EB;
    --ax-text: #0F172A;
    --ax-text-muted: #64748B;
    --ax-input-bg: #FFFFFF;
    --ax-input-border: #CBD5E1;
}

html.dark {
    --ax-body: #0B1120;
    --ax-card: #111A2E;
    --ax-topbar: #111A2E;
    --ax-surface-alt: #16223A;
    --ax-border: #24324D;
    --ax-text: #F1F5F9;
    --ax-text-muted: #94A3B8;
    --ax-input-bg: #0F172A;
    --ax-input-border: #334155;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14.5px; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--ax-body);
    color: var(--ax-text);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

.bp-shell { display: flex; min-height: 100vh; }

/* Luminous Billpay v3 Gradient Sidebar */
.bp-sidebar {
    width: 256px;
    flex-shrink: 0;
    background:
        radial-gradient(circle at 0% 8%, rgba(255, 255, 255, 0.18) 0%, transparent 38%),
        radial-gradient(circle at 100% 88%, rgba(255, 255, 255, 0.15) 0%, transparent 42%),
        var(--bp-sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 4px 0 24px -10px rgba(15, 23, 42, 0.22);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
}
.bp-sidebar-hdr {
    padding: 16px 18px;
    background: rgba(15, 23, 42, 0.13);
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    gap: 10px;
}
.bp-brand-badge {
    width: 34px; height: 34px; border-radius: 10px;
    background: #FFFFFF; color: var(--bp-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.25);
}
.bp-brand-title { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; }
.bp-brand-sub {
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 9999px;
    background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.28);
}

.bp-nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.bp-nav-group {
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75); padding: 12px 10px 4px;
}
.bp-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 11px;
    font-size: 13px; font-weight: 500;
    color: rgba(255, 255, 255, 0.94);
    transition: all 0.15s ease;
}
.bp-nav-item:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.bp-nav-item.active {
    background: #FFFFFF;
    color: var(--bp-primary-dark);
    font-weight: 700;
    box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.28);
}
.bp-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.bp-nav-item.active svg { color: var(--bp-primary); }
.bp-nav-badge {
    margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 9999px;
    background: rgba(255, 255, 255, 0.22); color: #fff;
}
.bp-nav-item.active .bp-nav-badge { background: var(--bp-tint-bg); color: var(--bp-tint-fg); }

.bp-sidebar-foot {
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.12);
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.88);
}

/* Main Content & Topbar */
.bp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bp-topbar {
    min-height: 60px;
    background: var(--ax-topbar);
    border-bottom: 1px solid var(--ax-border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.bp-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bp-top-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.bp-no-isolir-pill {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 4px 10px; border-radius: 9999px; font-size: 11px; font-weight: 700;
    background: rgba(16, 185, 129, 0.12); color: #059669; border: 1px solid rgba(16, 185, 129, 0.28);
}
html.dark .bp-no-isolir-pill { color: #34D399; }

.bp-top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bp-page { padding: 22px 24px 36px; max-width: 1520px; width: 100%; margin: 0 auto; }

/* Accountix Gradient KPI Stat Cards */
.ax-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 980px) { .ax-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ax-kpi-grid { grid-template-columns: 1fr; } }

.ax-stat-card {
    position: relative; overflow: hidden;
    border-radius: 16px; padding: 18px 20px; color: #FFFFFF;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 6px 18px -6px rgba(15, 23, 42, 0.2);
}
.ax-stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -8px rgba(15, 23, 42, 0.24); }
.ax-stat-card::before {
    content: ""; position: absolute; right: -28px; top: -28px; width: 120px; height: 120px;
    border-radius: 9999px; background: rgba(255, 255, 255, 0.13); pointer-events: none;
}
.ax-stat-card::after {
    content: ""; position: absolute; right: 26px; bottom: -36px; width: 92px; height: 92px;
    border-radius: 9999px; background: rgba(255, 255, 255, 0.08); pointer-events: none;
}
.ax-grad-indigo  { background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%); }
.ax-grad-emerald { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.ax-grad-purple  { background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%); }
.ax-grad-cyan    { background: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%); }
.ax-grad-rose    { background: linear-gradient(135deg, #F43F5E 0%, #E11D48 100%); }
.ax-grad-amber   { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); }

.ax-kpi-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255,255,255,0.84); }
.ax-kpi-val { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; }
.ax-kpi-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 9999px; font-size: 11px; font-weight: 600;
    background: rgba(255,255,255,0.2); color: #fff; margin-top: 8px;
}
.ax-kpi-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Accountix Cards & Grids */
.ax-card {
    background: var(--ax-card);
    border: 1px solid var(--ax-border);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.ax-card-hdr { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ax-card-title { font-size: 14.5px; font-weight: 700; margin: 0; }
.ax-card-sub { font-size: 12px; color: var(--ax-text-muted); margin: 2px 0 0; }

.bp-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.bp-grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.bp-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 960px) { .bp-grid-3-1, .bp-grid-2 { grid-template-columns: 1fr; } .bp-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Tables */
.ax-table-wrap { overflow-x: auto; border: 1px solid var(--ax-border); border-radius: 12px; }
table.ax-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ax-table thead th {
    background: var(--ax-surface-alt);
    color: var(--ax-text-muted);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--ax-border); white-space: nowrap;
}
table.ax-table tbody td {
    padding: 11px 12px; border-bottom: 1px solid var(--ax-border); vertical-align: middle;
}
table.ax-table tbody tr:last-child td { border-bottom: none; }
table.ax-table tbody tr:hover { background: var(--ax-surface-alt); }

/* Badges */
.ax-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 9999px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ax-badge::before { content: ""; width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.ax-badge-green { background: rgba(16, 185, 129, 0.13); color: #059669; }
.ax-badge-red   { background: rgba(239, 68, 68, 0.13); color: #DC2626; }
.ax-badge-amber { background: rgba(245, 158, 11, 0.14); color: #D97706; }
.ax-badge-blue  { background: rgba(14, 165, 233, 0.14); color: #0284C7; }
.ax-badge-indigo{ background: rgba(79, 70, 229, 0.13); color: #4F46E5; }
.ax-badge-slate { background: rgba(100, 116, 139, 0.14); color: #64748B; }
html.dark .ax-badge-green { color: #34D399; }
html.dark .ax-badge-red   { color: #F87171; }
html.dark .ax-badge-amber { color: #FBBF24; }
html.dark .ax-badge-blue  { color: #38BDF8; }
html.dark .ax-badge-indigo{ color: #818CF8; }

/* Buttons & Form Inputs */
.bp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; white-space: nowrap;
}
.bp-btn-sm { padding: 5px 10px; font-size: 11.5px; border-radius: 8px; }
.bp-btn-primary { background: var(--bp-grad); color: #fff; box-shadow: 0 4px 14px -4px var(--bp-glow); }
.bp-btn-primary:hover { filter: brightness(1.05); }
.bp-btn-ghost { background: var(--ax-card); border-color: var(--ax-border); color: var(--ax-text); }
.bp-btn-ghost:hover { background: var(--ax-surface-alt); }
.bp-btn-success { background: #10B981; color: #fff; }
.bp-btn-danger  { background: rgba(239, 68, 68, 0.12); color: #DC2626; border-color: rgba(239, 68, 68, 0.25); }

.bp-field { margin-bottom: 12px; }
.bp-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ax-text-muted); margin-bottom: 5px; }
.bp-input, .bp-select, .bp-textarea {
    width: 100%; background: var(--ax-input-bg); color: var(--ax-text);
    border: 1px solid var(--ax-input-border); border-radius: 10px;
    padding: 8px 11px; font-size: 13px; font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bp-input, .bp-select { height: 38px; }
.bp-input:focus, .bp-select:focus, .bp-textarea:focus {
    outline: none; border-color: var(--bp-primary); box-shadow: 0 0 0 3px var(--bp-ring);
}
.bp-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Flash & Alerts */
.bp-alert { padding: 11px 14px; border-radius: 12px; font-size: 13px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.bp-alert-ok  { background: rgba(16, 185, 129, 0.13); border: 1px solid rgba(16, 185, 129, 0.35); color: #047857; }
.bp-alert-err { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.32); color: #B91C1C; }
html.dark .bp-alert-ok  { color: #34D399; }
html.dark .bp-alert-err { color: #FCA5A5; }

/* Modals */
.bp-modal-bg {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px); z-index: 60;
    display: none; align-items: center; justify-content: center; padding: 18px;
}
.bp-modal-bg.open { display: flex; }
.bp-modal {
    width: 100%; max-width: 680px; max-height: 92vh;
    background: var(--ax-card); border: 1px solid var(--ax-border); border-radius: 16px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.38);
    display: flex; flex-direction: column; overflow: hidden;
}
.bp-modal-wide { max-width: 940px; }
.bp-modal-hdr {
    padding: 15px 20px; border-bottom: 1px solid var(--ax-border);
    display: flex; align-items: center; justify-content: space-between;
}
.bp-modal-title { font-size: 15px; font-weight: 700; margin: 0; }
.bp-modal-body { padding: 18px 20px; overflow-y: auto; }
.bp-modal-foot {
    padding: 12px 20px; border-top: 1px solid var(--ax-border);
    display: flex; justify-content: flex-end; gap: 8px; background: var(--ax-surface-alt);
}

/* Mobile Sidebar toggle */
.bp-mob-btn { display: none; }
@media (max-width: 960px) {
    .bp-sidebar { position: fixed; left: -270px; transition: left 0.2s ease; }
    .bp-sidebar.open { left: 0; }
    .bp-mob-btn { display: inline-flex; }
}
