/* ============================================================================
   finance-bento.css — "Bento Glass" modern skin for the Finance Dashboard.
   Scoped to .fin-modern so the rest of the portal is untouched. Restyles the
   existing .glass-card tiles into frosted bento panels and adds a hero KPI
   bento grid with inline sparklines. All existing element IDs are preserved.
   ========================================================================== */

.fin-modern { position: relative; --bento-radius: 26px; }

/* Soft aurora glow behind the whole dashboard */
.fin-modern::before {
    content: "";
    position: absolute;
    top: -80px; left: -60px; right: -60px; height: 420px;
    background:
        radial-gradient(420px 300px at 12% 0%, rgba(99, 102, 241, 0.14), transparent 60%),
        radial-gradient(460px 320px at 90% 8%, rgba(16, 185, 129, 0.12), transparent 60%),
        radial-gradient(380px 300px at 60% 0%, rgba(236, 72, 153, 0.08), transparent 60%);
    filter: blur(8px);
    pointer-events: none;
    z-index: 0;
}
.fin-modern > * { position: relative; z-index: 1; }

/* ---- Every card on the dashboard becomes a DARK frosted glass tile -------- */
.fin-modern .glass-card {
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.96)) !important;
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--bento-radius) !important;
    color: #e2e8f0;
    box-shadow: 0 14px 36px -18px rgba(2, 6, 23, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}
.fin-modern .card-header,
.fin-modern .glass-card .border-bottom,
.fin-modern .glass-card .bg-white,
.fin-modern .bg-white { background: transparent !important; }

/* ---- Light text on dark — readable everywhere inside the Finance Center --- */
.fin-modern,
.fin-modern h1, .fin-modern h2, .fin-modern h3, .fin-modern h4, .fin-modern h5, .fin-modern h6,
.fin-modern .h1, .fin-modern .h2, .fin-modern .h3, .fin-modern .h4,
.fin-modern .text-dark, .fin-modern b, .fin-modern strong { color: #f1f5f9 !important; }
.fin-modern .text-muted, .fin-modern .text-xs.text-muted, .fin-modern small { color: rgba(226, 232, 240, 0.58) !important; }
.fin-modern p.text-muted, .fin-modern .text-secondary { color: rgba(226, 232, 240, 0.5) !important; }

/* Keep semantic colours bright so they pop on dark */
.fin-modern .text-success { color: #34d399 !important; }
.fin-modern .text-danger  { color: #f87171 !important; }
.fin-modern .text-primary { color: #60a5fa !important; }
.fin-modern .text-info    { color: #38bdf8 !important; }
.fin-modern .text-warning { color: #fbbf24 !important; }

/* Borders, dividers (incl. inline-styled list rows in the panels) */
.fin-modern .border-bottom, .fin-modern .border-right, .fin-modern .border, .fin-modern .border-top { border-color: rgba(255, 255, 255, 0.08) !important; }
.fin-modern [style*="border-bottom"] { border-bottom-color: rgba(255, 255, 255, 0.08) !important; }
.fin-modern [style*="border-right"]  { border-right-color: rgba(255, 255, 255, 0.08) !important; }

/* Chrome bits: badges, progress, soft pills, light/outline buttons */
.fin-modern .badge-light { background: rgba(255, 255, 255, 0.1) !important; color: #e2e8f0 !important; border-color: rgba(255, 255, 255, 0.12) !important; }
.fin-modern .progress { background: rgba(255, 255, 255, 0.08) !important; }
.fin-modern .bg-success-soft { background: rgba(16, 185, 129, 0.2) !important; }
.fin-modern .bg-danger-soft  { background: rgba(239, 68, 68, 0.2) !important; }
.fin-modern .btn-white, .fin-modern .btn-outline-secondary { color: #e2e8f0 !important; border-color: rgba(255, 255, 255, 0.18) !important; background: rgba(255, 255, 255, 0.05) !important; }
.fin-modern .btn-white:hover, .fin-modern .btn-outline-secondary:hover { background: rgba(255, 255, 255, 0.12) !important; }
/* Light row-hover for list/table rows on dark */
.fin-modern .lift-hover:hover { background: rgba(255, 255, 255, 0.04) !important; }

/* ----------------------------- Hero KPI bento ---------------------------- */
.fin-bento {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(150px, auto);
    gap: 18px;
    margin-bottom: 22px;
}
.bento {
    border-radius: var(--bento-radius);
    padding: 22px 22px 54px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.62));
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 12px 34px -18px rgba(15, 23, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.32s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.bento:hover { transform: translateY(-6px) scale(1.012); box-shadow: 0 28px 56px -22px rgba(15, 23, 42, 0.4); }

.bento .b-label { font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 800; color: #64748b; }
.bento .b-value { font-size: 2rem; font-weight: 800; line-height: 1.1; margin-top: 8px; letter-spacing: -0.02em; }
.bento .b-ico {
    position: absolute; top: 20px; right: 20px;
    width: 44px; height: 44px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.05rem;
    box-shadow: 0 10px 20px -7px rgba(0, 0, 0, 0.4);
}
.bento .b-spark { position: absolute; left: 0; right: 0; bottom: 0; height: 50px; width: 100% !important; opacity: 0.95; }
.bento .stat-delta { font-size: 0.78rem; font-weight: 700; }

/* Colour tints (radial wash in the top-right corner) */
.bento.t-green::after  { content: ""; position: absolute; inset: 0; background: radial-gradient(130% 120% at 100% 0%, rgba(16, 185, 129, 0.16), transparent 58%); pointer-events: none; }
.bento.t-red::after    { content: ""; position: absolute; inset: 0; background: radial-gradient(130% 120% at 100% 0%, rgba(239, 68, 68, 0.15), transparent 58%); pointer-events: none; }
.bento.t-blue::after   { content: ""; position: absolute; inset: 0; background: radial-gradient(130% 120% at 100% 0%, rgba(59, 130, 246, 0.16), transparent 58%); pointer-events: none; }

/* Hero (Net Profit) — wide dark gradient tile */
.bento.b-hero { grid-column: span 2; }
.bento.b-profit {
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 70%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}
.bento.b-profit::after { content: ""; position: absolute; inset: 0; background: radial-gradient(150% 140% at 100% 0%, rgba(99, 102, 241, 0.35), transparent 55%); pointer-events: none; }
.bento.b-profit .b-label { color: rgba(248, 250, 252, 0.62); }
.bento.b-profit .b-value { font-size: 2.6rem; color: #fff; }
.bento.b-profit .b-ico { background: linear-gradient(135deg, #f59e0b, #d97706); }

/* ---------------- Dark premium KPI tiles (match the Net Profit hero) ------ */
.bento.b-income, .bento.b-expenses, .bento.b-cash {
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.bento.b-income   { background: linear-gradient(135deg, #0f3026 0%, #0a1f18 72%); --glow: rgba(16, 185, 129, 0.45); }
.bento.b-expenses { background: linear-gradient(135deg, #3a1517 0%, #1f0c0e 72%); --glow: rgba(244, 63, 94, 0.42); }
.bento.b-cash     { background: linear-gradient(135deg, #102945 0%, #0b1a2e 72%); --glow: rgba(59, 130, 246, 0.45); }
.bento.b-profit   { --glow: rgba(99, 102, 241, 0.5); }

.bento.b-income .b-label, .bento.b-expenses .b-label, .bento.b-cash .b-label { color: rgba(248, 250, 252, 0.62); }
.bento.b-income .b-value, .bento.b-expenses .b-value, .bento.b-cash .b-value { color: #ffffff; }
.bento.b-cash .text-muted { color: rgba(248, 250, 252, 0.55) !important; }

.bento.b-income::after   { content: ""; position: absolute; inset: 0; background: radial-gradient(150% 140% at 100% 0%, rgba(16, 185, 129, 0.32), transparent 56%); pointer-events: none; }
.bento.b-expenses::after { content: ""; position: absolute; inset: 0; background: radial-gradient(150% 140% at 100% 0%, rgba(244, 63, 94, 0.30), transparent 56%); pointer-events: none; }
.bento.b-cash::after     { content: ""; position: absolute; inset: 0; background: radial-gradient(150% 140% at 100% 0%, rgba(59, 130, 246, 0.32), transparent 56%); pointer-events: none; }

/* All dark tiles softly pulse their coloured glow forever */
.bento.b-profit, .bento.b-income, .bento.b-expenses, .bento.b-cash { animation: bento-glow 4.6s ease-in-out infinite; }
@keyframes bento-glow {
    0%, 100% { box-shadow: 0 14px 36px -20px rgba(2, 6, 23, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
    50%      { box-shadow: 0 20px 48px -18px rgba(2, 6, 23, 0.8), 0 0 30px -4px var(--glow, rgba(99, 102, 241, 0.4)), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
}
.bento.b-profit:hover, .bento.b-income:hover, .bento.b-expenses:hover, .bento.b-cash:hover {
    box-shadow: 0 28px 60px -22px rgba(2, 6, 23, 0.85), 0 0 42px -2px var(--glow, rgba(99, 102, 241, 0.5)) !important;
}

/* Light sheen sweeps across the dark tiles while hovered */
.bento.b-profit::before, .bento.b-income::before, .bento.b-expenses::before, .bento.b-cash::before {
    content: ""; position: absolute; top: 0; left: -130%; width: 55%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.16), transparent);
    transform: skewX(-22deg); pointer-events: none; opacity: 0; z-index: 2;
}
.bento.b-profit:hover::before, .bento.b-income:hover::before, .bento.b-expenses:hover::before, .bento.b-cash:hover::before {
    animation: bento-sheen 1.1s ease-in-out infinite;
}
@keyframes bento-sheen { 0% { left: -130%; opacity: 1; } 60% { left: 150%; opacity: 1; } 100% { left: 150%; opacity: 0; } }

/* Secondary-metrics strip — dark to match the KPI tiles */
.bento.b-strip {
    grid-column: span 3; cursor: default; padding-bottom: 22px; justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 72%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}
.bento.b-strip .text-muted { color: rgba(248, 250, 252, 0.55) !important; }
.bento.b-strip .kpi-pill { background: rgba(255, 255, 255, 0.06) !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; }
.bento.b-strip .kpi-val.text-dark { color: #ffffff !important; }

/* ---------------- Premium dark chart card (Profit & Cash-Flow) ------------ */
.fin-modern .bento-chart-dark {
    background: linear-gradient(135deg, #1f2937 0%, #0f172a 72%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--bento-radius);
    padding: 22px 24px;
    position: relative; overflow: hidden;
    color: #f8fafc;
    box-shadow: 0 16px 42px -22px rgba(2, 6, 23, 0.7);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.32s ease;
}
.fin-modern .bento-chart-dark::after { content: ""; position: absolute; inset: 0; background: radial-gradient(110% 130% at 100% 0%, rgba(99, 102, 241, 0.22), transparent 56%); pointer-events: none; }
.fin-modern .bento-chart-dark:hover { transform: translateY(-4px); box-shadow: 0 30px 60px -24px rgba(2, 6, 23, 0.8), 0 0 40px -6px rgba(99, 102, 241, 0.35); }
.fin-modern .bento-chart-dark > * { position: relative; z-index: 1; }

/* Responsive collapse */
@media (max-width: 1199px) {
    .fin-bento { grid-template-columns: repeat(2, 1fr); }
    .bento.b-hero, .bento.b-strip { grid-column: span 2; }
}
@media (max-width: 575px) {
    .fin-bento { grid-template-columns: 1fr; }
    .bento.b-hero, .bento.b-strip { grid-column: span 1; }
    .bento .b-value { font-size: 1.7rem; }
}

/* ============================================================================
   LIGHT MODE — the Finance Dashboard now FOLLOWS the light theme.
   The bento skin above is hardcoded dark; these higher-specificity
   [data-theme="light"] + !important rules lighten it only when light mode is
   active. Dark mode (default) is completely untouched.
   ========================================================================== */

/* Cards -> white glass, dark text */
[data-theme="light"] .fin-modern .glass-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92)) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: #0f172a !important;
    box-shadow: 0 14px 34px -20px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}

/* Text -> dark on light */
[data-theme="light"] .fin-modern,
[data-theme="light"] .fin-modern h1, [data-theme="light"] .fin-modern h2, [data-theme="light"] .fin-modern h3,
[data-theme="light"] .fin-modern h4, [data-theme="light"] .fin-modern h5, [data-theme="light"] .fin-modern h6,
[data-theme="light"] .fin-modern .h1, [data-theme="light"] .fin-modern .h2, [data-theme="light"] .fin-modern .h3, [data-theme="light"] .fin-modern .h4,
[data-theme="light"] .fin-modern .text-dark, [data-theme="light"] .fin-modern b, [data-theme="light"] .fin-modern strong { color: #0f172a !important; }
[data-theme="light"] .fin-modern .text-muted, [data-theme="light"] .fin-modern .text-xs.text-muted, [data-theme="light"] .fin-modern small,
[data-theme="light"] .fin-modern p.text-muted, [data-theme="light"] .fin-modern .text-secondary { color: #64748b !important; }

/* Semantic colours deepened for contrast on white */
[data-theme="light"] .fin-modern .text-success { color: #059669 !important; }
[data-theme="light"] .fin-modern .text-danger  { color: #dc2626 !important; }
[data-theme="light"] .fin-modern .text-primary { color: #2563eb !important; }
[data-theme="light"] .fin-modern .text-info    { color: #0284c7 !important; }
[data-theme="light"] .fin-modern .text-warning { color: #d97706 !important; }

/* Borders / dividers */
[data-theme="light"] .fin-modern .border-bottom, [data-theme="light"] .fin-modern .border-right,
[data-theme="light"] .fin-modern .border, [data-theme="light"] .fin-modern .border-top { border-color: rgba(15, 23, 42, 0.08) !important; }
[data-theme="light"] .fin-modern [style*="border-bottom"] { border-bottom-color: rgba(15, 23, 42, 0.08) !important; }
[data-theme="light"] .fin-modern [style*="border-right"]  { border-right-color: rgba(15, 23, 42, 0.08) !important; }

/* Chrome bits */
[data-theme="light"] .fin-modern .badge-light { background: rgba(15, 23, 42, 0.06) !important; color: #334155 !important; border-color: rgba(15, 23, 42, 0.1) !important; }
[data-theme="light"] .fin-modern .progress { background: rgba(15, 23, 42, 0.08) !important; }
[data-theme="light"] .fin-modern .btn-white, [data-theme="light"] .fin-modern .btn-outline-secondary { color: #334155 !important; border-color: rgba(15, 23, 42, 0.18) !important; background: rgba(255, 255, 255, 0.7) !important; }
[data-theme="light"] .fin-modern .btn-white:hover, [data-theme="light"] .fin-modern .btn-outline-secondary:hover { background: rgba(15, 23, 42, 0.06) !important; }
[data-theme="light"] .fin-modern .lift-hover:hover { background: rgba(15, 23, 42, 0.035) !important; }

/* Hero KPI tiles -> soft tinted light versions with dark text */
[data-theme="light"] .bento.b-profit   { background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 72%) !important; border: 1px solid rgba(99, 102, 241, 0.18) !important; color: #0f172a !important; }
[data-theme="light"] .bento.b-income   { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 72%) !important; border: 1px solid rgba(16, 185, 129, 0.2) !important; color: #0f172a !important; }
[data-theme="light"] .bento.b-expenses { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 72%) !important; border: 1px solid rgba(244, 63, 94, 0.2) !important; color: #0f172a !important; }
[data-theme="light"] .bento.b-cash     { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 72%) !important; border: 1px solid rgba(59, 130, 246, 0.2) !important; color: #0f172a !important; }
[data-theme="light"] .bento.b-profit .b-label, [data-theme="light"] .bento.b-income .b-label,
[data-theme="light"] .bento.b-expenses .b-label, [data-theme="light"] .bento.b-cash .b-label { color: #64748b !important; }
[data-theme="light"] .bento.b-profit .b-value, [data-theme="light"] .bento.b-income .b-value,
[data-theme="light"] .bento.b-expenses .b-value, [data-theme="light"] .bento.b-cash .b-value { color: #0f172a !important; }
[data-theme="light"] .bento.b-cash .text-muted { color: #64748b !important; }

/* Stop the dark glow pulse; soft light shadow instead */
[data-theme="light"] .bento.b-profit, [data-theme="light"] .bento.b-income,
[data-theme="light"] .bento.b-expenses, [data-theme="light"] .bento.b-cash {
    animation: none !important;
    box-shadow: 0 12px 32px -18px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}

/* Secondary strip + premium chart card -> light */
[data-theme="light"] .bento.b-strip { background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 72%) !important; border: 1px solid rgba(15, 23, 42, 0.08) !important; color: #0f172a !important; }
[data-theme="light"] .bento.b-strip .text-muted { color: #64748b !important; }
[data-theme="light"] .bento.b-strip .kpi-pill { background: rgba(15, 23, 42, 0.04) !important; border: 1px solid rgba(15, 23, 42, 0.08) !important; }
[data-theme="light"] .bento.b-strip .kpi-val.text-dark { color: #0f172a !important; }
[data-theme="light"] .fin-modern .bento-chart-dark {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 72%) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: #0f172a !important;
    box-shadow: 0 16px 40px -24px rgba(15, 23, 42, 0.2) !important;
}
