/* ===============================
   THEME VARIABLES
=============================== */

:root {
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #111111;
    --subtle: #666;
    --border: #e0e0e0;
    --positive: #3ecf8e;
    --negative: #ff5c75;
    --accent: #4f7cff;
}

body.dark-mode {
    --bg: #121417;
    --card-bg: #1c1f24;
    --text: #d8dbe0;
    --subtle: #aaaaaa;
    --border: #2a2e35;
    --accent: #4f7cff;
}

/* ===============================
   GLOBAL
=============================== */

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

h1 { margin-bottom: 30px;padding-left: 52px;   /* ← add this */ }


/* ── HOME BUTTON ── */
.home-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border: 1px solid var(--gold-dim);
    color: var(--gold-dim);
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.home-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
    background: rgba(201,168,76,0.1);
}
.home-btn svg {
    width: 18px;
    height: 18px;
}

hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 15px 0;
}

/* ===============================
   THEME TOGGLE
=============================== */

.theme-toggle {
    float: right;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
}

/* ===============================
   DASHBOARD GRID
=============================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 650px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.full-width  { grid-column: 1 / -1; }
.half-width  { grid-column: span 2; }
.third-width { grid-column: span 1; }

/* ===============================
   CARD
=============================== */

.card {
    background: linear-gradient(145deg, var(--card-bg) 0%, rgba(0,0,0,0.03) 100%);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.02),
        0 8px 25px rgba(0,0,0,0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35), 0 0 0 1px rgba(79,124,255,0.25);
}

.card h2,
.card-title {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
    color: var(--subtle);
    font-weight: 600;
}

.card h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    margin-right: 8px;
    border-radius: 3px;
    background: var(--accent);
}

/* ===============================
   KPI CARDS
=============================== */

.kpi-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
    overflow: hidden;
}

.kpi-title {
    font-size: 0.8rem;
    color: var(--subtle);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 600;
    margin: 8px 0;
    letter-spacing: 0.5px;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--subtle);
}

.big-number {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.positive { color: var(--positive); }
.negative { color: var(--negative); }

.mini-chart {
    margin-top: 8px;
    opacity: 0.8;
}

canvas { max-height: 100% !important; }

/* ===============================
   TABLES
=============================== */

table {
    border-collapse: collapse;
    font-size: 14px;
    width: 100%;
}

th {
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    color: var(--subtle);
    font-weight: 500;
    letter-spacing: 0.3px;
}

td {
    padding: 6px 0;
    color: var(--text);
}

.table-total td {
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* ===============================
   CLICKABLE CARDS
=============================== */

.card.clickable { cursor: pointer; }

/* ===============================
   FORM ELEMENTS
=============================== */

input, select {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
}

button {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: 0.2s ease;
}

button:hover { opacity: 0.85; }

/* ===============================
   CREDIT CARD
=============================== */

.cc-overview {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.cc-overview h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    opacity: 0.8;
}

.cc-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin: 4px 0;
}

.cc-stat small { font-size: 11px; opacity: 0.7; }

/* ===============================
   CHART CONTAINER — single definition
=============================== */

.chart-container {
    position: relative;
    height: 380px;
    width: 100%;
    background: linear-gradient(145deg, #1a1f2d, #131722);
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.45);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.mini-chart-container {
    position: relative;
    height: 55px;
    width: 100%;
}

/* ===============================
   PIE CONTAINER
=============================== */

.pie-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* ===============================
   PERFORMANCE / BUDGET CARDS
=============================== */

.performance-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.budget-card {
    padding: 18px;
    border-radius: 14px;
    background: linear-gradient(145deg, #1a1f2d, #131722);
    box-shadow: 0 6px 16px rgba(0,0,0,0.45);
    transition: all 0.25s ease;
}

.budget-card h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #ffffff;
}

.budget-card p { margin: 4px 0; color: #cfd8dc; }

.budget-card.good    { border-left: 5px solid #2ecc71; }
.budget-card.warning { border-left: 5px solid #f1c40f; }
.budget-card.danger  { border-left: 5px solid #e74c3c; }

.budget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.55);
}

.progress {
    background: #2a2f3d;
    height: 6px;
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill { height: 100%; width: 0; transition: width 0.3s ease; }
.budget-card.good    .progress-fill { background: #2ecc71; }
.budget-card.warning .progress-fill { background: #f1c40f; }
.budget-card.danger  .progress-fill { background: #e74c3c; box-shadow: 0 0 8px rgba(231,76,60,0.7); }

/* ===============================
   TAB BUTTONS
=============================== */

.chart-tabs {
    display: inline-flex;
    gap: 6px;
    margin-left: 12px;
    vertical-align: middle;
}

.tab-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: #8f9bb3;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover { background: rgba(255,255,255,0.13); color: #cfd6e3; }
.tab-btn.active { background: #4aa3ff; border-color: #4aa3ff; color: #fff; }

/* ===============================
   DRILL-DOWN TOGGLE
=============================== */

.drill-toggle {
    margin: 12px 0 0 0;
    background: none;
    border: 1px solid rgba(255,255,255,0.12);
    color: #8f9bb3;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: block;
}

.drill-toggle:hover { background: rgba(255,255,255,0.07); color: #cfd6e3; }

/* ===============================
   DRILL-DOWN TABLE
=============================== */

.drilldown-table {
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.drilldown-table table { border-collapse: collapse; font-size: 0.82rem; }
.drilldown-table th { color: #8f9bb3; font-weight: 600; padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.drilldown-table td { color: #cfd6e3; padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.drilldown-table tr:hover td { background: rgba(255,255,255,0.03); }

/* ===============================
   INTELLIGENCE ROW
=============================== */

.intelligence-row {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
}

