/* --- DESIGN TOKENS & SYSTEM VARIABLES (LIGHT THEME) --- */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette - Premium Light Theme */
  --bg-main: #f8fafc;        /* Slate 50 */
  --bg-sidebar: #ffffff;     /* Pure White */
  --bg-card: #ffffff;        /* Pure White Cards */
  --bg-card-hover: #f1f5f9;  /* Slate 100 */
  
  --border-color: #e2e8f0;   /* Slate 200 */
  --border-hover: #cbd5e1;   /* Slate 300 */
  
  --primary-color: #2563eb;  /* Blue 600 */
  --primary-hover: #1d4ed8;  /* Blue 700 */
  --primary-glow: rgba(37, 99, 235, 0.08);
  
  --success-color: #10b981;  /* Emerald 500 */
  --success-bg: rgba(16, 185, 129, 0.08);
  --success-glow: rgba(16, 185, 129, 0.15);
  
  --danger-color: #ef4444;   /* Red 500 */
  --danger-bg: rgba(239, 68, 68, 0.08);
  --danger-glow: rgba(239, 68, 68, 0.15);
  
  --warning-color: #d97706;  /* Amber 600 */
  --info-color: #0891b2;     /* Cyan 600 */
  
  --text-main: #0f172a;      /* Slate 900 */
  --text-muted: #64748b;     /* Slate 500 */
  --text-dark: #334155;      /* Slate 700 */
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  
  --transition-fast: 0.18s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- BASE STYLES & RESET --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.01em;
  transition: opacity 0.15s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* --- APP LAYOUT --- */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 0 8px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.logo-icon i {
  width: 20px;
  height: 20px;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.92rem;
  transition: var(--transition-fast);
}

.menu-item i {
  width: 18px;
  height: 18px;
}

.menu-item:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

.menu-item.active {
  background-color: #eff6ff;
  border-left: 3px solid var(--primary-color);
  color: var(--primary-color);
  padding-left: 13px; /* Offset border width */
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 18px;
}

/* User profile with logout wrapper */
.user-profile-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.user-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.btn-logout:hover {
  background-color: #fee2e2;
  color: var(--danger-color);
}

/* --- MAIN CONTENT --- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 40px;
  overflow-y: auto;
  max-width: calc(100% - 240px);
  min-width: 0;
}

/* --- HEADER --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  font-family: var(--font-family);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: white;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: var(--border-hover);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  transition: var(--transition-fast);
}

.btn-text:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.btn-close:hover {
  background-color: #f1f5f9;
  color: var(--text-main);
}

/* --- STATS SUMMARY --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon i {
  width: 22px;
  height: 22px;
}

.stat-details span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-details h3 {
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

/* Balance Card (Featured) */
.balance-card .stat-icon {
  background: linear-gradient(135deg, var(--primary-color), var(--info-color));
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.balance-card {
  border-color: rgba(37, 99, 235, 0.15);
  background: linear-gradient(180deg, #ffffff, #eff6ff);
}

/* Receivables Card */
.receivables-card .stat-icon {
  background: linear-gradient(135deg, var(--info-color), #06b6d4);
  color: white;
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.15);
}

.receivables-card {
  border-color: rgba(8, 145, 178, 0.15);
  background: linear-gradient(180deg, #ffffff, #ecfeff);
}

/* Payables Card */
.payables-card .stat-icon {
  background: linear-gradient(135deg, var(--warning-color), #f59e0b);
  color: white;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
}

.payables-card {
  border-color: rgba(217, 119, 6, 0.15);
  background: linear-gradient(180deg, #ffffff, #fffbeb);
}

.income-card .stat-icon {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.expense-card .stat-icon {
  background-color: var(--danger-bg);
  color: var(--danger-color);
}

.stat-comparison {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.stat-comparison.positive {
  color: var(--success-color);
}

.stat-comparison.negative {
  color: var(--danger-color);
}

/* --- CARDS & PANELS --- */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-header-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 3px;
  display: block;
}

.card-header-subtitle strong {
  color: var(--primary-color);
  font-weight: 700;
}

.header-icon {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

/* --- DASHBOARD CATEGORY BREAKDOWNS (New Request) --- */
.dashboard-donuts-card {
  margin-bottom: 32px;
}

.dashboard-donuts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.donut-chart-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  background-color: #f8fafc;
  min-width: 0;
  width: 100%;
}

.donut-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
}

.donut-chart-box h4 {
  font-size: 0.88rem;
  color: var(--text-dark);
  margin-bottom: 0;
  font-weight: 600;
}

.donut-total {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  background-color: white;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
}

/* For reports page where background is white, use gray background for total */
.card-header .donut-total {
  background-color: #f1f5f9;
  font-size: 0.82rem;
}

.dashboard-chart-wrapper {
  position: relative;
  height: 180px;
  width: 100%;
  max-width: 320px;
}

/* Toggles Pill button-group */
.toggle-buttons-group {
  display: flex;
  background-color: #f1f5f9;
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.toggle-btn.active {
  background-color: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

/* --- DASHBOARD MIDDLE SECTION --- */
.dashboard-middle-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 24px;
  margin-bottom: 32px;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

/* Accounts List Widget */
.accounts-card {
  max-height: 400px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
}

.account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.account-item:hover {
  background-color: #f1f5f9;
  border-color: var(--border-hover);
}

.account-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.account-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.account-value {
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

.account-bal-num {
  font-weight: 700;
  font-size: 0.92rem;
}

.account-bal-num.negative {
  color: var(--danger-color);
}

.account-bal-num.positive {
  color: var(--success-color);
}

.account-currency {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Chart Container */
.chart-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.chart-container {
  position: relative;
  flex-grow: 1;
  width: 100%;
  height: 280px;
}

.recent-tx-card {
  max-height: 400px;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.recent-tx-card .table-wrapper {
  overflow-y: auto;
  overflow-x: auto;
  flex-grow: 1;
}

/* --- KASALAR & BANKALAR GRID MANAGER (New Request) --- */
.accounts-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.account-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.account-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.account-card-icon {
  width: 42px;
  height: 42px;
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
}

.account-card-icon i {
  width: 18px;
  height: 18px;
}

.account-card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.account-card-badge.bank {
  background-color: rgba(37, 99, 235, 0.08);
  color: var(--primary-color);
}

.account-card-badge.cash {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.account-card-badge.credit_card {
  background-color: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}

.account-card h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
}

.account-card-bal-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.account-card-bal-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.account-card-bal-val.negative {
  color: var(--danger-color);
}

.account-card-bal-val.positive {
  color: var(--success-color);
}

.account-card-footer {
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.account-card-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: var(--transition-fast);
}

.account-card:hover .account-card-actions {
  opacity: 1;
}

/* --- TABLES --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

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

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.font-semibold {
  font-weight: 600;
}

/* Transaction Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-income {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.badge-expense {
  background-color: var(--danger-bg);
  color: var(--danger-color);
}

.badge-transfer {
  background-color: rgba(8, 145, 178, 0.08);
  color: var(--info-color);
}

.badge-warning {
  background-color: rgba(217, 119, 6, 0.08);
  color: var(--warning-color);
}

.text-red-color {
  color: var(--danger-color);
}
.text-green-color {
  color: var(--success-color);
}

/* --- FILTERS PANEL --- */
.filters-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.filter-group.date-range-group {
  min-width: 290px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-group select,
.filter-group input {
  background-color: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-family: var(--font-family);
  outline: none;
  transition: var(--transition-fast);
}

.filter-group select:focus,
.filter-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 14px;
  height: 14px;
}

.search-input-wrapper input {
  padding-left: 34px;
  width: 100%;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input {
  flex: 1;
}

.filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --- PAGINATION --- */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}

#pagination-info, #doc-pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

/* --- CARI / CONTACTS GRID --- */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  cursor: pointer;
}

.contact-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.contact-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.contact-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.contact-badge.customer {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.contact-badge.vendor {
  background-color: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}

.contact-avatar {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.95rem;
}

.contact-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.3;
}

.contact-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.contact-meta-row i {
  width: 13px;
  height: 13px;
}

.contact-card-divider {
  border-top: 1px solid var(--border-color);
  margin: 14px 0;
}

.contact-balance-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contact-balance-block span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.contact-balance-value {
  font-weight: 700;
  font-size: 1.05rem;
}

.contact-balance-value.positive {
  color: var(--success-color);
}

.contact-balance-value.negative {
  color: var(--danger-color);
}

.contact-card-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: var(--transition-fast);
}

.contact-card:hover .contact-card-actions {
  opacity: 1;
}

/* --- REPORTS --- */
.reports-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.report-chart-wrapper {
  position: relative;
  height: 240px;
  width: 100%;
}

.chart-container canvas,
.dashboard-chart-wrapper canvas,
.report-chart-wrapper canvas {
  width: 100% !important;
  max-width: 100% !important;
}

.reports-table-card {
  margin-bottom: 0;
}

/* --- MODALS & DIALOGS --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.modal-card.modal-wide {
  max-width: 760px;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.tab-buttons {
  display: flex;
  background-color: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background-color: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

/* Forms layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background-color: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-family);
  outline: none;
  transition: var(--transition-fast);
}

.form-group select {
  max-width: 100%;
  text-overflow: ellipsis;
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-addon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-addon-wrapper input {
  width: 100%;
  padding-right: 32px;
}

.input-addon-wrapper .addon {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* Cari detail stats cards */
.cari-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.cari-stat-card {
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.cari-stat-card span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cari-stat-card h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.cari-stat-card.highlight {
  border-color: rgba(37, 99, 235, 0.25);
  background-color: #eff6ff;
}

.cari-detail-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 0.82rem;
}

.info-item {
  color: var(--text-dark);
}

.info-item strong {
  color: var(--text-muted);
}

/* Helpers & Core layout toggles */
.hide {
  display: none !important;
}

/* --- VIEW MANAGER STYLES --- */
.app-view {
  display: none;
  animation: fadeIn 0.2s ease-out;
}

.app-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- LOGIN PAGE STYLING --- */
.login-body {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.login-logo h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-full {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
}

.error-box {
  background-color: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

/* --- DASHBOARD SPLIT LAYOUT --- */
.dashboard-split-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}

.dashboard-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-timeline-col {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}

/* Timeline Panel */
.dashboard-timeline-col .timeline-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
  height: 100%;
}

.dashboard-timeline-col .card-header {
  margin-bottom: 12px;
  padding: 0 4px;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Timeline Item Card styling */
.timeline-item {
  background-color: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  padding: 12px 8px 12px 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.timeline-item:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-color);
  background-color: rgba(15, 23, 42, 0.03); /* subtle slate background on hover */
}

/* Status left-border indicators */
.timeline-item.overdue {
  border-left: 4px solid var(--danger-color);
}
.timeline-item.today {
  border-left: 4px solid var(--warning-color);
}
.timeline-item.upcoming {
  border-left: 4px solid var(--primary-color);
}

.timeline-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-badge.income {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.timeline-badge.expense {
  background-color: var(--danger-bg);
  color: var(--danger-color);
}

.timeline-due-days {
  font-size: 0.72rem;
  font-weight: 600;
}

.timeline-due-days.overdue {
  color: var(--danger-color);
}

.timeline-due-days.today {
  color: var(--warning-color);
}

.timeline-due-days.upcoming {
  color: var(--text-muted);
}

.timeline-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  padding-right: 36px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

.timeline-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.timeline-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Timeline Pay Action Button */
.btn-timeline-pay {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--success-bg);
  border: none;
  color: var(--success-color);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.btn-timeline-pay:hover {
  background-color: var(--success-color);
  color: white;
  transform: translateY(-50%) scale(1.05);
}

.btn-timeline-pay i, .btn-timeline-pay svg {
  width: 14px;
  height: 14px;
}

/* Mobile menu toggler and overlay (hidden on desktop) */
.mobile-menu-btn {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.mobile-menu-btn:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.mobile-menu-btn i, .mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.sidebar-overlay {
  display: none;
}

/* --- CUSTOM SEARCHABLE SELECT --- */
.custom-select-container {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.custom-select-trigger:focus-within,
.custom-select-container.active .custom-select-trigger {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
  outline: none;
}

.custom-select-trigger .chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.custom-select-container.active .chevron {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  display: none;
  flex-direction: column;
  max-height: 280px;
  overflow: hidden;
}

.custom-select-container.active .custom-select-dropdown {
  display: flex;
}

.custom-select-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
}

.custom-select-search-wrapper .search-icon {
  position: absolute;
  left: 16px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.custom-select-search-input {
  width: 100%;
  padding: 6px 12px 6px 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  outline: none;
  box-sizing: border-box;
}

.custom-select-search-input:focus {
  border-color: var(--primary-color);
}

.custom-select-options {
  overflow-y: auto;
  max-height: 200px;
  padding: 4px 0;
}

.custom-select-option {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-fast);
}

.custom-select-option:hover {
  background-color: var(--bg-main);
}

.custom-select-option.selected {
  background-color: var(--primary-glow);
  color: var(--primary-color);
  font-weight: 500;
}

.custom-select-option-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  background-color: var(--border-color);
  color: var(--text-muted);
  font-weight: bold;
}

/* --- CALENDAR SYSTEM --- */
.calendar-layout {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 24px;
}

.calendar-main-card {
  flex: 3;
  min-width: 450px;
}

.calendar-sidebar-card {
  flex: 2;
  min-width: 300px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.calendar-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition-fast);
}

.calendar-nav-btn:hover {
  background-color: var(--bg-main);
  border-color: var(--border-hover);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding-bottom: 8px;
}

.calendar-day-cell {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 90px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: var(--transition-fast);
}

.calendar-day-cell:hover {
  border-color: var(--border-hover);
  background: var(--bg-sidebar);
}

.calendar-day-cell.other-month {
  opacity: 0.45;
}

.calendar-day-cell.today-cell {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.02);
}

.calendar-day-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dark);
  text-align: right;
  margin-bottom: 4px;
}

.calendar-day-cell.today-cell .calendar-day-number {
  color: var(--primary-color);
  font-weight: 800;
}

.calendar-events-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 64px;
}

.calendar-event-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.calendar-event-badge.reminder {
  background-color: rgba(217, 119, 6, 0.08);
  color: var(--warning-color);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

.calendar-event-badge.document-income {
  background-color: var(--success-bg);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.calendar-event-badge.document-expense {
  background-color: var(--danger-bg);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.calendar-event-badge.completed {
  text-decoration: line-through;
  opacity: 0.5;
  background-color: rgba(100, 116, 139, 0.05);
  color: var(--text-muted);
  border-color: var(--border-color);
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: flex;
  }
  
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -240px;
    width: 240px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    border-bottom: none;
  }
  
  .sidebar.mobile-active {
    left: 0;
  }

  .app-container {
    flex-direction: row;
  }

  .main-content {
    max-width: 100%;
    width: 100%;
    padding: 20px;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
  }

  .header-actions {
    display: flex;
    gap: 10px;
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .dashboard-split-layout {
    flex-direction: column;
  }

  .dashboard-timeline-col {
    width: 100%;
    position: static;
    margin-top: 16px;
  }

  .dashboard-middle-grid,
  .dashboard-bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-donuts-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-brand {
    margin-bottom: 16px;
  }

  .cari-stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-group.full-width {
    grid-column: span 1;
  }
}
