/* ===== GYMOS — MAIN CSS ===== */

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

:root {
  --bg-base: #080d1a;
  --bg-surface: #0e1525;
  --bg-card: #131c30;
  --bg-card-hover: #1a2540;
  --bg-elevated: #1e2d47;
  --accent: #00e5a0;
  --accent-dim: rgba(0,229,160,0.12);
  --accent-glow: rgba(0,229,160,0.25);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);
  --orange: #f97316;
  --orange-dim: rgba(249,115,22,0.12);
  --purple: #a855f7;
  --purple-dim: rgba(168,85,247,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --yellow: #eab308;
  --text-primary: #e8edf5;
  --text-secondary: #8899b0;
  --text-muted: #4a5a72;
  --border: rgba(255,255,255,0.07);
  --border-accent: rgba(0,229,160,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Rajdhani', system-ui, sans-serif;
  --transition: 0.2s ease;
}

html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg-base); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; }
img { max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-icon svg { width: 36px; height: 36px; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-primary { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.logo-accent { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--accent); margin-left: 2px; display: inline; }
.logo-text small { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.08em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding: 12px 8px 4px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--accent); border-radius: 0 3px 3px 0;
}

.badge { font-size: 0.6rem; padding: 2px 7px; border-radius: 99px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin-left: auto; }
.badge-green { background: var(--accent-dim); color: var(--accent); }
.badge-yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge-gray { background: var(--bg-elevated); color: var(--text-muted); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; flex-shrink: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; display: block; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

/* ===== TOPBAR (mobile) ===== */
.topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  align-items: center; padding: 0 16px; gap: 12px; z-index: 190;
}
.menu-toggle { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; padding: 4px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: var(--transition); }
.topbar-title { flex: 1; font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }
.notif-bell { position: relative; cursor: pointer; padding: 6px; }
.notif-bell svg { width: 20px; height: 20px; color: var(--text-secondary); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ===== OVERLAY ===== */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 150; }
.overlay.visible { display: block; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 28px 28px;
  min-height: 100vh;
}

/* ===== MODULES ===== */
.module { display: none; }
.module.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1; }
.page-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; border: none; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #080d1a; }
.btn-primary:hover { background: #00ffb5; box-shadow: 0 0 18px var(--accent-glow); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all var(--transition); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ===== CARDS ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-link { font-size: 0.78rem; color: var(--accent); }
.card-link:hover { text-decoration: underline; }
.mt-4 { margin-top: 20px; }
.mt-2 { margin-top: 10px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; align-items: center; gap: 14px; transition: border-color var(--transition); }
.kpi-card:hover { border-color: var(--border-accent); }
.kpi-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 22px; height: 22px; }
.kpi-green { background: var(--accent-dim); color: var(--accent); }
.kpi-blue { background: var(--blue-dim); color: var(--blue); }
.kpi-orange { background: var(--orange-dim); color: var(--orange); }
.kpi-purple { background: var(--purple-dim); color: var(--purple); }
.kpi-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.kpi-trend { font-size: 0.7rem; margin-top: 4px; color: var(--text-muted); }
.kpi-trend.up { color: var(--accent); }
.kpi-trend.down { color: var(--red); }

/* ===== DASHBOARD GRID ===== */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); padding: 7px 14px; border-radius: 99px; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.filter-btn:hover, .filter-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); }
.filter-search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; min-width: 200px; }
.filter-search svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.filter-search input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 0.85rem; width: 100%; }
.filter-search input::placeholder { color: var(--text-muted); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 0.78rem; font-weight: 500; color: var(--text-secondary); }
.form-input { background: var(--bg-base); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 0.875rem; transition: border-color var(--transition); width: 100%; outline: none; }
.form-input:focus { border-color: var(--border-accent); }
.form-input option { background: var(--bg-surface); }
textarea.form-input { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; font-size: 0.8rem; }
.checkbox-item input { accent-color: var(--accent); }

/* ===== SELECT SM ===== */
.select-sm { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 0.8rem; outline: none; cursor: pointer; }
.select-sm option { background: var(--bg-surface); }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table .td-name { color: var(--text-primary); font-weight: 500; }

/* ===== PULSE DOT ===== */
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* ===== TOGGLE ===== */
.toggle { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--bg-elevated); border-radius: 99px; cursor: pointer; transition: var(--transition); }
.slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--text-muted); transition: var(--transition); }
.toggle input:checked + .slider { background: var(--accent-dim); border: 1px solid var(--border-accent); }
.toggle input:checked + .slider::before { background: var(--accent); transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.toggle-row:last-child { border-bottom: none; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.85rem; display: flex; align-items: center; gap: 10px; min-width: 260px; animation: slideIn 0.25s ease; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ===== SETTINGS ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 16px; color: var(--accent); }
.sdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sdk-item:last-child { border-bottom: none; }
.sdk-item > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sdk-item > div:nth-child(2) strong { font-size: 0.875rem; }
.sdk-item > div:nth-child(2) small { font-size: 0.7rem; color: var(--text-muted); }
.sdk-logo { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; flex-shrink: 0; }
.sdk-logo.zk { background: rgba(59,130,246,0.15); color: var(--blue); }
.sdk-logo.hik { background: rgba(239,68,68,0.12); color: var(--red); }
.sdk-logo.st { background: var(--accent-dim); color: var(--accent); }
.sdk-logo.wg { background: var(--purple-dim); color: var(--purple); }

/* ===== IMPORT DROP ===== */
.import-drop { border: 2px dashed var(--border-accent); border-radius: var(--radius); padding: 40px; text-align: center; }
.import-drop svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 12px; }
.import-drop p { font-size: 0.875rem; color: var(--text-secondary); }
.import-drop small { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 6px; }
.file-link { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ===== CHART CONTAINER ===== */
.chart-container { position: relative; height: 200px; }

/* ===== PLANS TABLE ===== */
.plans-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.plan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.2s;
}
.plan-card:hover { border-color: var(--border-accent); }
.plan-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-card-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.plan-card-price { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1; }
.plan-card-currency { font-size: 0.75rem; color: var(--text-muted); }
.plan-card-meta { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-card-actions { display: flex; gap: 6px; margin-top: 4px; }
.plan-card-actions .btn { flex: 1; justify-content: center; }
.plan-active-badge { font-size: 0.62rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.plan-active-badge.active { background: var(--accent-dim); color: var(--accent); }
.plan-active-badge.inactive { background: var(--bg-card); color: var(--text-muted); }
.plan-blue .plan-card-price { color: var(--blue); }
.plan-accent .plan-card-price { color: var(--accent); }
.plan-orange .plan-card-price { color: var(--orange); }
.plan-purple .plan-card-price { color: var(--purple); }
.plan-yellow .plan-card-price { color: var(--yellow); }
.plan-green .plan-card-price { color: var(--accent); }

/* ===== FINANCE FILTERS ===== */
.fin-filter-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.fin-filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fin-filter-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-right: 4px; white-space: nowrap; }
.fin-date-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fin-date-group { display: flex; align-items: center; gap: 8px; }
.fin-date-group label { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.fin-date-group .form-input { width: auto; padding: 6px 10px; font-size: 0.82rem; }
.tx-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.tx-chip { font-size: 0.78rem; font-weight: 600; padding: 4px 12px; border-radius: 99px; }
.tx-chip.paid { background: var(--accent-dim); color: var(--accent); }
.tx-chip.pending { background: var(--orange-dim); color: var(--orange); }
.tx-chip.total { background: var(--bg-elevated); color: var(--text-secondary); }
.td-inv { font-family: 'Rajdhani'; font-size: 0.82rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.tx-item-label { display: inline-block; background: var(--bg-elevated); border-radius: 4px; padding: 2px 7px; font-size: 0.72rem; color: var(--text-secondary); margin: 1px 1px; }
.tx-actions { display: flex; gap: 4px; }
.tx-row-pending td:first-child { border-left: 2px solid var(--orange); }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 16px 0 4px; flex-wrap: wrap; }
.page-btn { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.82rem; cursor: pointer; transition: all 0.15s; }
.page-btn:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-primary); }
.page-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--border-accent); font-weight: 700; }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); padding: 0 4px; font-size: 0.82rem; }

/* ===== INVOICE MODAL ===== */
.invoice-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 10px; }
.invoice-section { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.invoice-section-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.invoice-cart-title { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 600px) {
  .invoice-sections { grid-template-columns: 1fr; }
  .fin-filter-row { flex-direction: column; gap: 10px; }
}

/* ===== FINANCE TABS ===== */
.fin-tabs {
  display: flex; gap: 4px; margin-top: 16px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px;
}
.fin-tab {
  display: flex; align-items: center; gap: 8px; padding: 10px 18px;
  border-radius: calc(var(--radius) - 2px); font-size: 0.85rem; font-weight: 500;
  background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.fin-tab svg { width: 15px; height: 15px; }
.fin-tab:hover { color: var(--text-primary); background: var(--bg-elevated); }
.fin-tab.active { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-glow); }

.kpi-red { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ===== EXPENSE CATEGORIES GRID ===== */
.exp-cats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-top: 16px;
}
.exp-cat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
}
.exp-cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.exp-cat-icon { font-size: 1.5rem; margin-bottom: 6px; }
.exp-cat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.exp-cat-amount { font-family: 'Rajdhani', sans-serif; font-size: 1.1rem; font-weight: 700; color: #ef4444; }
.exp-cat-pct { font-size: 0.7rem; color: var(--text-muted); margin: 2px 0 6px; }
.exp-cat-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.exp-cat-bar-fill { height: 100%; background: #ef4444; border-radius: 2px; transition: width 0.5s; }

.exp-cat-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; }

/* ===== BALANCE ===== */
.balance-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px;
}
.balance-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 16px;
}
.balance-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px;
}
.balance-item {
  border-radius: var(--radius-sm); padding: 16px; text-align: center;
}
.balance-item.income { background: rgba(0,229,160,0.08); border: 1px solid rgba(0,229,160,0.2); }
.balance-item.expense { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); }
.balance-item.positive { background: rgba(0,229,160,0.12); border: 1px solid rgba(0,229,160,0.35); }
.balance-item.negative { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); }
.balance-item-icon { font-size: 1.3rem; margin-bottom: 4px; }
.balance-item-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.balance-item-value { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: 700; }
.balance-item.income .balance-item-value { color: var(--accent); }
.balance-item.expense .balance-item-value { color: #ef4444; }
.balance-item.positive .balance-item-value { color: var(--accent); }
.balance-item.negative .balance-item-value { color: #ef4444; }

.balance-bar-wrap { margin-top: 4px; }
.balance-bar-bg { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.balance-bar-fill.pos { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.6s; }
.balance-bar-fill.neg { height: 100%; background: #ef4444; border-radius: 3px; transition: width 0.6s; }
.balance-bar-label { font-size: 0.82rem; color: var(--text-muted); }

/* Breakdown */
.exp-breakdown { padding: 8px 0; display: flex; flex-direction: column; gap: 10px; }
.breakdown-row { display: grid; grid-template-columns: 150px 1fr 100px; align-items: center; gap: 10px; }
.breakdown-cat { font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.breakdown-bar-wrap { display: flex; align-items: center; gap: 6px; }
.breakdown-bar { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.breakdown-bar-fill { height: 100%; background: #ef4444; border-radius: 3px; transition: width 0.5s; }
.breakdown-pct { font-size: 0.72rem; color: var(--text-muted); width: 32px; text-align: right; }
.breakdown-amt { font-family: 'Rajdhani', sans-serif; font-size: 0.9rem; font-weight: 700; color: #ef4444; text-align: right; }

@media (max-width: 900px) {
  .balance-grid { grid-template-columns: 1fr; }
  .balance-row { grid-template-columns: 1fr; }
  .breakdown-row { grid-template-columns: 120px 1fr 80px; }
  .exp-cats-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .main-content { margin-left: 0; padding: 80px 14px 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
