/* ================================================================
   FAMILY CASH BOOK — style.css
   Theme    : Monochrome Dark (Black · White · Gray)
   Strategy : Mobile-First · CSS Variables · Component-based
   Fonts    : Syne (display) · Epilogue (body) · JetBrains Mono (numbers)
================================================================ */

/* ── 1. CSS Custom Properties (Light / Dark Auto) ──────────────── */
:root {
  /* Default: LIGHT MODE */
  --bg:            #f7f9fa;
  --surface:       #ffffff;
  --card:          #ffffff;
  --card-hover:    #f3f4f6;
  --card-active:   #e5e7eb;
  
  --border:        #e5e7eb;
  --border-md:     #d1d5db;
  --border-hover:  #9ca3af;
  
  --text:          #111827;
  --text-2:        #4b5563;
  --text-3:        #6b7280;
  --text-4:        #9ca3af;
  
  /* Semantic Colors for Light */
  --income:        #059669;
  --income-dim:    rgba(5, 150, 105, 0.1);
  --expense:       #4b5563;
  --expense-dim:   rgba(75, 85, 99, 0.1);
  --danger:        #dc2626;
  --danger-dim:    rgba(220, 38, 38, 0.1);
  
  --sidebar-bg:    #ffffff;
  --sidebar-w:     258px;
  
  /* Layout & Shadows */
  --header-h:      54px;
  --mobile-nav-h:  62px;
  --radius:        10px;
  --radius-sm:     6px;
  --radius-full:   9999px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,0.1);
  
  /* Fixed Fonts */
  --font-display:  'Segoe UI', Arial, sans-serif;
  --font-body:     'Segoe UI', Arial, sans-serif;
  --font-mono:     Consolas, 'Courier New', monospace;
  
  --ease:          cubic-bezier(0.22, 1, 0.36, 1);
  --dur:           0.18s;
}

/* Override: DARK MODE */
[data-theme="dark"] {
  --bg:            #0a0a0a;
  --surface:       #121212;
  --card:          #191919;
  --card-hover:    #212121;
  --card-active:   #262626;
  --border:        #252525;
  --border-md:     #333333;
  --border-hover:  #444444;
  --text:          #f0f0f0;
  --text-2:        #8a8a8a;
  --text-3:        #505050;
  --text-4:        #333333;
  --income:        #e2e2e2;
  --income-dim:    rgba(226,226,226,0.08);
  --expense:       #7a7a7a;
  --expense-dim:   rgba(120,120,120,0.10);
  --danger:        #cc4444;
  --danger-dim:    rgba(204,68,68,0.12);
  --sidebar-bg:    #0d0d0d;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);
}

/* ── 2. Reset & Base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a          { color: inherit; text-decoration: none; }
button     { cursor: pointer; font-family: inherit; background: none; border: none; }
input,
select,
textarea   { font-family: inherit; }
img, svg   { display: block; }
ul, ol     { list-style: none; }


/* ── 3. Utility helpers ────────────────────────────────────────── */
.hidden        { display: none !important; }
.sr-only       { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-right    { text-align: right; }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full        { width: 100%; }
.stat-mono     { font-family: var(--font-mono); }


/* ── 4. Login Screen ───────────────────────────────────────────── */
#login-screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Radial glow behind the card */
#login-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 600px; height: 400px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(255,255,255,0.035) 0%,
    transparent 70%);
  pointer-events: none;
}

/* Subtle grid texture */
#login-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
  pointer-events: none;
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  animation: fadeUp 0.45s var(--ease) both;
}

.login-brand {
  text-align: center;
  margin-bottom: 2.25rem;
}

.login-hex {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 auto 1.1rem;
  color: var(--text-2);
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.login-brand p {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: 0.35rem;
  font-style: italic;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.875rem;
}

.login-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.login-hint {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-3);
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}


/* ── 5. App Layout ──────────────────────────────────────────────── */
#app-screen {
  display: flex;
  min-height: 100svh;
}

#sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100svh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.375rem 0 1.25rem;
  z-index: 100;
  transition: transform var(--dur) var(--ease);
}

#app-body {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}


/* ── 6. Sidebar ─────────────────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1.375rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.875rem;
}

.brand-hex {
  color: var(--text-3);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0.625rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.675rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  position: relative;
  transition: background var(--dur), color var(--dur);
  user-select: none;
}

.nav-item:hover {
  background: var(--card);
  color: var(--text);
}

.nav-item.active {
  background: var(--card);
  color: var(--text);
}

/* Left accent bar on active item */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 2px;
  background: var(--text);
  border-radius: 2px;
}

.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.user-avatar {
  width: 30px; height: 30px;
  background: var(--card-active);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

#sidebar-username {
  font-size: 0.82rem;
  color: var(--text-2);
  max-width: 130px;
}


/* ── 7. Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.855rem;
  font-weight: 700;
  border: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity var(--dur), transform 0.1s;
}

.btn:hover   { opacity: 0.82; }
.btn:active  { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-md);
}

.btn-secondary:hover { background: var(--card-hover); opacity: 1; }

.btn-danger {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-dim);
  opacity: 1;
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition: color var(--dur), background var(--dur);
}

.btn-icon:hover {
  background: var(--card);
  color: var(--text);
}


/* ── 8. Forms ───────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.1rem;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* 1. Paksa rata kanan untuk header tabel Amount & Actions */
.data-table th.text-right {
  text-align: right !important;
}

/* 2. Paksa tinggi dan padding yang sama rata untuk semua kotak input */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="search"],
select {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 1rem !important;
  box-sizing: border-box !important;
  line-height: 42px !important;
  border-radius: var(--radius-sm) !important; /* <-- Tambahkan baris ini */
}

select {
  -webkit-appearance: none !important; /* <-- Menghapus panah bawaan Chrome/Safari */
  appearance: none !important;         /* <-- Menghapus panah bawaan browser modern */
  padding-right: 2.5rem !important;    /* <-- Memberi ruang lebih di kanan agar teks tidak menabrak ikon panah kustom */
}

/* 3. Kecualikan Textarea (Description) agar tetap bisa tinggi/fleksibel */
textarea {
  height: auto !important;
  padding: 0.6rem 1rem !important;
  line-height: 1.5 !important;
  border-radius: var(--radius-sm) !important; /* <-- Tambahkan baris ini juga */
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-hover);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-4);
}

/* Custom select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Color scheme for date picker */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

/* Income / Expense toggle buttons */
.type-toggle {
  display: flex;
  gap: 0.5rem;
}

.type-btn {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.855rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--dur);
  text-align: center;
}

.type-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.type-btn.active-income {
  border-color: var(--income);
  color: var(--income);
  background: var(--income-dim);
}

.type-btn.active-expense {
  border-color: var(--expense);
  color: var(--expense);
  background: var(--expense-dim);
}


/* ── 9. Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.855rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.alert-error {
  background: var(--danger-dim);
  border: 1px solid rgba(204,68,68,0.3);
  color: #e07070;
}

.alert-success {
  background: var(--income-dim);
  border: 1px solid var(--border-md);
  color: var(--text);
}


/* ── 10. Mobile Header ──────────────────────────────────────────── */
#mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 1rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  flex-shrink: 0;
}

.mobile-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}


/* ── 11. Views container ────────────────────────────────────────── */
#views-container {
  flex: 1;
  padding: 2rem 2.25rem;
  overflow-y: auto;
}

.view {
  animation: fadeUp 0.22s var(--ease) both;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.875rem;
}

.view-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.view-subtitle {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: 0.3rem;
}


/* ── 12. Period Filter Pills ────────────────────────────────────── */
.period-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.625rem;
  flex-wrap: wrap;
}

.period-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--dur);
}

.period-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.period-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}


/* ── 13. Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--dur);
}

.stat-card:hover { border-color: var(--border-md); }

.stat-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.stat-income .stat-value { color: var(--income); }
.stat-expense .stat-value { color: var(--expense); }
.stat-final .stat-value, .stat-final-value { font-size: 1.45rem; }


/* ── 14. Net Banner ─────────────────────────────────────────────── */
.net-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.net-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}

.period-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--text-3);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.net-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.net-positive { color: var(--income) !important; }
.net-negative { color: var(--expense) !important; }


/* ── 15. Section Blocks ─────────────────────────────────────────── */
.section-block { margin-bottom: 2rem; }

.section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.875rem;
  letter-spacing: -0.01em;
}


/* ── 16. Category Breakdown Bars ────────────────────────────────── */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.category-group-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-3);
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
}

.category-row { display: flex; flex-direction: column; gap: 0.28rem; }

.category-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.category-name {
  font-size: 0.875rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.cat-badge {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.cat-badge-income  { background: var(--income-dim);  color: var(--income); }
.cat-badge-expense { background: var(--expense-dim); color: var(--expense); }

.category-amount {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-2);
  white-space: nowrap;
}

.cat-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.65s var(--ease);
}

.cat-bar-fill.income  { background: var(--text-2); }
.cat-bar-fill.expense { background: var(--text-3); }


/* ── 17. Recent Transactions (Dashboard) ────────────────────────── */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur);
}

.recent-item:hover { border-color: var(--border-md); }

.recent-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.type-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-income  { background: var(--income); }
.dot-expense { background: var(--expense); }

.recent-info { min-width: 0; }

.recent-category {
  font-size: 0.855rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 1px;
}

.recent-amount {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.amount-income  { color: var(--income); }
.amount-expense { color: var(--expense); }


/* ── 18. Cash Book Filters ──────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 180px;
}

.select-input {
  min-width: 155px;
  width: auto;
}


/* ── 19. Data Table ─────────────────────────────────────────────── */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--dur);
}

.data-table tbody tr:hover { background: var(--card); }

.tx-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
}

.tx-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

.tx-desc {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 0.84rem;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.type-income  { background: var(--income-dim);  color: var(--income); }
.type-expense { background: var(--expense-dim); color: var(--expense); }

.action-btns {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
}

.empty-state {
  padding: 2.75rem 1.5rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.88rem;
}

td.empty-state { display: table-cell; }


/* ── 20. Initial Balance Card ───────────────────────────────────── */
.balance-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 520px;
}

.balance-display {
  text-align: center;
  padding-bottom: 2rem;
}

.balance-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

.balance-amount {
  display: block;
  font-size: 2.75rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.balance-updated {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--text-3);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 1.75rem;
}

.balance-form-wrap h3 { margin-bottom: 1.25rem; }


/* ── 21. Savings Portfolio Grid ─────────────────────────────────── */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.portfolio-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--dur), box-shadow var(--dur);
}

.portfolio-card:hover {
  border-color: var(--border-md);
  box-shadow: var(--shadow-sm);
}

.portfolio-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

.portfolio-balance {
  font-family: var(--font-mono);
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.portfolio-notes {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.55;
}

.portfolio-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

.portfolio-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}


/* ── 22. Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 1.875rem;
  width: 100%;
  max-width: 476px;
  max-height: 92svh;
  overflow-y: auto;
  animation: fadeUp 0.2s var(--ease) both;
  box-shadow: var(--shadow-lg);
}

/* Custom scrollbar inside modal */
.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  margin-top: 1.375rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}


/* ── 23. Toast Notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 310px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.855rem;
  color: var(--text);
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.25s var(--ease) both;
  pointer-events: auto;
  line-height: 1.45;
}

.toast-success { border-left: 3px solid var(--text-2); }
.toast-error   { border-left: 3px solid var(--danger); }


/* ── 24. Mobile Bottom Nav ──────────────────────────────────────── */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0;
  transition: color var(--dur);
  position: relative;
}

.mobile-nav-item::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: transparent;
  border-radius: 0 0 2px 2px;
  transition: background var(--dur);
}

.mobile-nav-item.active {
  color: var(--text);
}

.mobile-nav-item.active::before {
  background: var(--text);
}


/* ── 25. Drawer overlay (mobile sidebar) ────────────────────────── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}


/* ── 26. Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(18px); }
}


/* ── 27. Responsive: Mobile  (< 768px) ─────────────────────────── */
@media (max-width: 767px) {
  /* Sidebar — off-canvas, slides in on demand */
  #sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.55);
  }

  /* Body uses full width and leaves room for bottom nav */
  #app-body {
    margin-left: 0;
    padding-bottom: var(--mobile-nav-h);
  }

  #mobile-header { display: flex; }
  #mobile-nav    { display: flex; }

  #views-container {
    padding: 1.25rem 1rem 1.5rem;
  }

  .view-title { font-size: 1.4rem; }

  /* Stats: 2 columns on mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
  }

  .stat-value     { font-size: 1.05rem; }
  .stat-final .stat-value,
  .stat-final-value { font-size: 1.2rem; }

  .balance-amount { font-size: 2rem; }

  /* Hide description column in table on mobile */
  .hidden-mobile  { display: none !important; }

  /* Stack form rows on mobile */
  .form-row { grid-template-columns: 1fr; }

  /* Filters stack vertically */
  .filter-bar { flex-direction: column; }
  .search-input  { min-width: unset; }
  .select-input  { width: 100%; }

  /* Portfolio full width */
  .portfolio-grid { grid-template-columns: 1fr; }

  /* Modal full-width on narrow screens */
  .modal-card { padding: 1.5rem 1.25rem; }
}


/* ── 28. Responsive: Tablet  (768px – 1023px) ───────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --sidebar-w: 220px; }
  #views-container { padding: 1.75rem 1.5rem; }
}


/* ── 29. Responsive: Wide  (≥ 1280px) ──────────────────────────── */
@media (min-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ── 30. Scrollbar (Webkit) ─────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Merapikan lebar kolom tabel Cash Book */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 15%; } /* Date */
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 15%; } /* Type */
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 20%; } /* Category */
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 30%; } /* Description */
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 15%; } /* Amount */
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 5%; }  /* Actions */
