﻿/* ============================================================
   Finance App - Main Stylesheet
   Desain: Dark Luxury Fintech (Slate + Emerald + Gold)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* === CSS VARIABLES === */
:root {
  --bg-900:  #0A0F1E;
  --bg-800:  #0E1629;
  --bg-700:  #131E38;
  --bg-600:  #1A2847;
  --bg-card: rgba(19,30,56,0.85);

  --accent:       #10F0A0;
  --accent-soft:  rgba(16,240,160,0.12);
  --accent-glow:  0 0 24px rgba(16,240,160,0.25);

  --gold:      #F0B130;
  --gold-soft: rgba(240,177,48,0.12);

  --red:      #FF4757;
  --red-soft: rgba(255,71,87,0.12);

  --text-100: #F0F4FF;
  --text-300: #8892B0;
  --text-500: #4A5568;

  --border:   rgba(255,255,255,0.06);
  --border-focus: rgba(16,240,160,0.35);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 40px rgba(16,240,160,0.08);

  --sidebar-w: 260px;
  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* Light mode */
[data-theme="light"] {
  --bg-900:  #F0F4F8;
  --bg-800:  #E8EDF5;
  --bg-700:  #DDE4F0;
  --bg-600:  #C8D3E8;
  --bg-card: rgba(255,255,255,0.92);
  --text-100: #1A2847;
  --text-300: #4A5568;
  --text-500: #8892B0;
  --border:   rgba(0,0,0,0.08);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.10);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-900);
  color: var(--text-100);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-500); }

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-900);
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.auth-bg-orb.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(16,240,160,0.12), transparent 70%);
  top: -100px; left: -150px;
}
.auth-bg-orb.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(240,177,48,0.08), transparent 70%);
  bottom: -80px; right: -100px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease forwards;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.auth-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #06D6A0);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.auth-logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-300); font-size: 14px; margin-bottom: 28px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-500);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

/* === FORM ELEMENTS === */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-300);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-100);
  font-family: inherit;
  font-size: 15px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16,240,160,0.08);
}
.form-control::placeholder { color: var(--text-500); }

select.form-control { cursor: pointer; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.input-group-append {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-300);
  transition: color var(--transition);
}
.input-group-append:hover { color: var(--accent); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #06D6A0 100%);
  color: #0A0F1E;
  width: 100%;
  padding: 14px;
  font-size: 15px;
  box-shadow: 0 4px 20px rgba(16,240,160,0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(16,240,160,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-600);
  color: var(--text-100);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-700); border-color: var(--border-focus); }

.btn-google {
  width: 100%;
  background: var(--bg-700);
  color: var(--text-100);
  border: 1px solid var(--border);
  padding: 13px;
}
.btn-google:hover:not(:disabled) {
  border-color: var(--border-focus);
  background: var(--bg-600);
}
.google-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #4285F4;
  font-weight: 700;
  font-family: Arial, sans-serif;
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(255,71,87,0.2);
}
.btn-danger:hover { background: rgba(255,71,87,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--text-300);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-100); background: var(--bg-600); }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 6px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  border-radius: 8px;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-800);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #06D6A0);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #0A0F1E;
}
.sidebar-logo-name {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-500);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-300);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--bg-600); color: var(--text-100); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-600);
  cursor: pointer;
  transition: background var(--transition);
}
.user-card:hover { background: var(--bg-700); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #0A0F1E;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11px; color: var(--text-300); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  min-width: 0;
}

.topbar {
  height: 64px;
  background: var(--bg-800);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-600);
  color: var(--text-300);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-size: 15px;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--border-focus); }

.hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-600);
  color: var(--text-100);
  cursor: pointer;
  align-items: center; justify-content: center;
}

.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

/* === PAGES === */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}
.stat-card.income::before  { background: var(--accent); }
.stat-card.expense::before { background: var(--red); }
.stat-card.balance::before { background: var(--gold); }
.stat-card.count::before   { background: #818CF8; }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-300); letter-spacing: 0.04em; text-transform: uppercase; }
.stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.stat-icon.income-icon  { background: var(--accent-soft); color: var(--accent); }
.stat-icon.expense-icon { background: var(--red-soft);    color: var(--red); }
.stat-icon.balance-icon { background: var(--gold-soft);   color: var(--gold); }
.stat-icon.count-icon   { background: rgba(129,140,248,0.12); color: #818CF8; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: 'DM Mono', monospace;
  margin-bottom: 4px;
}
.stat-sub { font-size: 12px; color: var(--text-500); }

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(10px);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-title { font-size: 15px; font-weight: 600; }
.chart-subtitle { font-size: 12px; color: var(--text-300); }

.year-select {
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-100);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.donut-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-700);
  padding: 3px;
  border-radius: 8px;
  width: fit-content;
}
.donut-tab {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-300);
  border: none;
  background: transparent;
}
.donut-tab.active { background: var(--bg-card); color: var(--text-100); }

canvas { max-width: 100%; }

/* Recent Transactions */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 700; }

.transactions-list { display: flex; flex-direction: column; gap: 8px; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}
.tx-item:hover { border-color: var(--border-focus); transform: translateX(2px); }

.tx-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 12px; color: var(--text-300); margin-top: 2px; }

.tx-amount {
  font-size: 15px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}
.tx-amount.income  { color: var(--accent); }
.tx-amount.expense { color: var(--red); }

/* ============================================================
   TRANSACTIONS PAGE
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(10px);
}
.filter-bar .form-control { padding: 9px 13px; font-size: 13px; }

.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .form-control { padding-left: 38px; }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-500);
  pointer-events: none;
}

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-300);
  background: var(--bg-700);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-700); }

tbody td { padding: 13px 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge.income  { background: var(--accent-soft); color: var(--accent); }
.badge.expense { background: var(--red-soft);    color: var(--red); }

.table-actions { display: flex; gap: 6px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-700);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-300);
}
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-300);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--border-focus); color: var(--text-100); }
.page-btn.active { background: var(--accent); color: #0A0F1E; border-color: var(--accent); font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  transform: scale(0.94) translateY(16px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-600);
  color: var(--text-300);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  font-size: 18px;
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }

/* Type selector */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.type-option {
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-size: 14px;
  font-weight: 500;
}
.type-option:hover { border-color: var(--text-500); }
.type-option.active.income  { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.type-option.active.expense { border-color: var(--red);    background: var(--red-soft);    color: var(--red); }

/* ============================================================
   REPORTS PAGE
   ============================================================ */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

.report-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.report-export-btn {
  width: auto;
  white-space: nowrap;
}

.btn-icon-inline,
.btn-icon-inline svg {
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.report-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-300);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; color: var(--text-100); }
.empty-desc { font-size: 14px; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  min-width: 280px;
  max-width: 360px;
  animation: slideInRight 0.3s ease;
  backdrop-filter: blur(20px);
}
.toast.success { border-color: rgba(16,240,160,0.3); }
.toast.error   { border-color: rgba(255,71,87,0.3); }
.toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--accent); }
.toast.error   .toast-icon { color: var(--red); }
.toast-msg { font-size: 13px; font-weight: 500; flex: 1; }
.toast-close {
  width: 20px; height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-500);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.toast-close:hover { color: var(--text-100); }

/* ============================================================
   LOADING
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,15,30,0.8);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.loading-overlay.show { opacity: 1; pointer-events: all; }

.spinner {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid var(--bg-600);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn    { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp   { from { opacity:0; transform:translateY(24px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideInRight { from { opacity:0; transform:translateX(32px) } to { opacity:1; transform:translateX(0) } }
@keyframes spin      { to { transform: rotate(360deg) } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }

  .main-content { margin-left: 0; overflow-x: hidden; }

  .hamburger { display: flex; }

  .page-content { padding: 16px; }

  /* Topbar fix: tidak overflow ke kanan di mobile */
  .topbar { padding: 0 16px; }
  #topbar-user { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 20px; }

  .filter-bar { flex-direction: column; }

  table { font-size: 12px; }
  thead th, tbody td { padding: 10px 12px; }

  .modal { padding: 24px 20px; }

  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* Rupiah input */
.rupiah-hint { font-size: 11px; color: var(--text-500); margin-top: 4px; }

/* Chart legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-300);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Mono numbers */
.mono { font-family: 'DM Mono', monospace; }
/* ============================================================
   AI CHATBOT
   ============================================================ */
.chatbot-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.chatbot-main,
.chatbot-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.chatbot-main {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  overflow: hidden;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.chatbot-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.chatbot-header p {
  font-size: 13px;
  color: var(--text-300);
  margin-top: 2px;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-empty {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: var(--text-300);
}

.chatbot-empty-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
}

.chatbot-empty h3 {
  color: var(--text-100);
  font-size: 18px;
  margin-bottom: 6px;
}

.chatbot-message {
  display: flex;
}

.chatbot-message.user {
  justify-content: flex-end;
}

.chatbot-message.bot {
  justify-content: flex-start;
}

.chatbot-bubble {
  max-width: min(760px, 82%);
  padding: 13px 15px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

.chatbot-message.user .chatbot-bubble {
  background: var(--accent);
  color: #0A0F1E;
  border-color: transparent;
}

.chatbot-message.bot .chatbot-bubble {
  background: var(--bg-700);
  color: var(--text-100);
}

.chatbot-message.loading .chatbot-bubble {
  color: var(--text-300);
}

.chatbot-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  padding: 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-800);
}

.chatbot-form textarea {
  resize: none;
  min-height: 54px;
  max-height: 140px;
}

.chatbot-send {
  width: 100%;
  align-self: stretch;
}

.chatbot-side {
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 84px;
}

.chatbot-side-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-100);
  margin-bottom: 12px;
}

.chatbot-side button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-700);
  color: var(--text-300);
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 8px;
  transition: all var(--transition);
}

.chatbot-side button:hover {
  color: var(--text-100);
  border-color: var(--border-focus);
}

@media (max-width: 900px) {
  .chatbot-shell {
    grid-template-columns: 1fr;
  }

  .chatbot-side {
    position: static;
    order: -1;
  }

  .chatbot-main {
    min-height: 560px;
  }
}

@media (max-width: 560px) {
  .chatbot-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chatbot-form {
    grid-template-columns: 1fr;
  }

  .chatbot-bubble {
    max-width: 94%;
  }
}

/* Icon SVG normalization */
.auth-logo-icon svg,
.sidebar-logo-icon svg,
.theme-toggle svg,
.hamburger svg,
.stat-icon svg,
.tx-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.auth-logo-icon svg { width: 21px; height: 21px; }
.sidebar-logo-icon svg { width: 19px; height: 19px; }
.theme-toggle svg,
.hamburger svg { width: 18px; height: 18px; }
.stat-icon svg { width: 19px; height: 19px; }
.tx-icon svg { width: 17px; height: 17px; }

/* Remaining inline icon sizing */
.input-group-append svg,
.search-icon svg,
.modal-close svg,
.type-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.type-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Action icons sizing */
.btn-icon svg,
.toast-icon svg,
.toast-close svg,
.empty-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.toast-icon,
.toast-close,
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-icon svg {
  width: 42px;
  height: 42px;
  opacity: 0.75;
}
