/* ==========================================================================
   DOMPETKU - Catatan Keuangan Pribadi Modern CSS
   Clean Architecture, Mobile-First, Accessible, Touch-Ergonomic
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette */
  --primary-dark: #0f172a;
  --primary-navy: #1e293b;
  --primary-accent: #2563eb;
  --primary-accent-hover: #1d4ed8;
  --primary-accent-subtle: #eff6ff;

  /* Semantic Status Colors */
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-text: #047857;

  --crimson-500: #ef4444;
  --crimson-600: #dc2626;
  --crimson-50: #fef2f2;
  --crimson-100: #fee2e2;
  --crimson-text: #b91c1c;

  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-50: #fffbeb;
  --amber-text: #b45309;

  /* Neutral Shades */
  --bg-page: #f8fafc;
  --surface-card: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-hover: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;

  /* Typography */
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 14px 20px -3px rgba(15, 23, 42, 0.12), 0 6px 8px -4px rgba(15, 23, 42, 0.06);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;

  /* Touch ergonomics */
  --min-touch-target: 44px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
  position: relative;
}

input,
button,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

.is-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   3. Header & Navigation (Mobile-First)
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.header-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-navy));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary-dark);
}

.brand-title span {
  color: var(--emerald-600);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Hamburger Toggle Button */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--min-touch-target);
  height: var(--min-touch-target);
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  transition: background var(--transition-fast);
}

.nav-toggle:hover {
  background-color: var(--surface-hover);
}

.hamburger-bar {
  width: 20px;
  height: 2px;
  background-color: var(--text-main);
  border-radius: 2px;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.nav-toggle.is-open .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.is-open .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Nav Menu Overlay on Mobile (< 992px) */
.app-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 1rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

.app-nav.is-open {
  display: flex;
  animation: slideDownNav 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownNav {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-tabs-wrapper {
  width: 100%;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  padding: 0;
  margin: 0;
  list-style: none;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
  background-color: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-tab-btn:hover {
  background-color: var(--surface-subtle);
  color: var(--text-main);
}

.nav-tab-btn.active {
  background-color: #0f172a;
  color: #ffffff;
}

.nav-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  width: 100%;
}

/* Database Status Indicator */
.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  border: 1px solid var(--border-light);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--text-subtle);
}

.db-status-badge.status-connected {
  background-color: var(--emerald-50);
  border-color: var(--emerald-500);
  color: var(--emerald-text);
}
.db-status-badge.status-connected .db-dot {
  background-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.db-status-badge.status-syncing {
  background-color: var(--amber-50);
  border-color: var(--amber-500);
  color: var(--amber-text);
}
.db-status-badge.status-syncing .db-dot {
  background-color: var(--amber-500);
  animation: pulseDot 0.8s infinite alternate;
}

.db-status-badge.status-offline {
  background-color: var(--surface-subtle);
  border-color: var(--border-light);
  color: var(--text-muted);
}
.db-status-badge.status-offline .db-dot {
  background-color: var(--text-subtle);
}

@keyframes pulseDot {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

/* --------------------------------------------------------------------------
   4. Main Layout & Container
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  padding: 1rem 0.75rem 3rem 0.75rem;
  max-width: 100vw;
  box-sizing: border-box;
}

.main-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
}

/* Alert Banner (Budget Exceeded) */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: var(--crimson-50);
  border: 1px solid var(--crimson-500);
  border-left: 5px solid var(--crimson-600);
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-icon {
  color: var(--crimson-600);
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--crimson-text);
  margin-bottom: 0.25rem;
}

.alert-desc {
  font-size: var(--font-size-xs);
  color: var(--crimson-text);
  line-height: 1.4;
}

.alert-close {
  color: var(--crimson-600);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 0.25rem;
  opacity: 0.7;
}

.alert-close:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   5. Summary Cards Grid
   -------------------------------------------------------------------------- */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.summary-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

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

.income-badge {
  background-color: var(--emerald-50);
  color: var(--emerald-600);
}

.expense-badge {
  background-color: var(--crimson-50);
  color: var(--crimson-600);
}

.balance-badge {
  background-color: var(--primary-accent-subtle);
  color: var(--primary-accent);
}

.card-amount {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: block;
  word-break: break-word;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.card-income .card-amount {
  color: var(--emerald-600);
}

.card-expense .card-amount {
  color: var(--crimson-600);
}

.card-footer-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge-emerald {
  background-color: var(--emerald-100);
  color: var(--emerald-text);
}

.badge-crimson {
  background-color: var(--crimson-100);
  color: var(--crimson-text);
}

.badge-amber {
  background-color: var(--amber-50);
  color: var(--amber-text);
  border: 1px solid var(--amber-500);
}

.badge-gray {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
}

/* Budget Card Specifics */
.btn-icon-mini {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-mini:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}

.budget-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.budget-meta-row {
  display: flex;
  justify-content: space-between;
}

.budget-meta-row strong {
  color: var(--text-main);
}

.budget-progress-track {
  width: 100%;
  height: 6px;
  background-color: var(--surface-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.2rem 0;
}

.budget-progress-bar {
  height: 100%;
  background-color: var(--emerald-500);
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background-color 0.3s ease;
}

.budget-progress-bar.is-warning {
  background-color: var(--amber-500);
}

.budget-progress-bar.is-danger {
  background-color: var(--crimson-500);
}

.budget-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.budget-indicator-badge {
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--emerald-100);
  color: var(--emerald-text);
}

.budget-indicator-badge.is-warning {
  background-color: var(--amber-50);
  color: var(--amber-text);
}

.budget-indicator-badge.is-danger {
  background-color: var(--crimson-100);
  color: var(--crimson-text);
  animation: pulseBudget 1.5s infinite;
}

@keyframes pulseBudget {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------------
   6. Content Layout (Form + Table)
   -------------------------------------------------------------------------- */
.content-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-panel {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.panel-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}

.panel-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.mode-badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
}

.mode-badge.is-editing {
  background-color: var(--amber-50);
  color: var(--amber-text);
  border: 1px solid var(--amber-500);
}

/* --------------------------------------------------------------------------
   7. Form Components (Touch-Optimized)
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.required {
  color: var(--crimson-500);
}

.form-control {
  width: 100%;
  min-height: var(--min-touch-target);
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control-sm {
  min-height: 38px;
  padding: 0.4rem 0.75rem;
  font-size: var(--font-size-xs);
}

.input-with-affix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 0.85rem;
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-affix .form-control {
  padding-left: 2.5rem;
  font-weight: 700;
  font-size: var(--font-size-base);
  letter-spacing: 0.02em;
}

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

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

/* Segmented Control (Expense / Income) */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.segmented-option {
  position: relative;
  cursor: pointer;
}

.segmented-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.segmented-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  user-select: none;
}

.expense-opt input[type="radio"]:checked + .segmented-btn {
  background-color: #ffffff;
  color: var(--crimson-600);
  box-shadow: var(--shadow-sm);
}

.income-opt input[type="radio"]:checked + .segmented-btn {
  background-color: #ffffff;
  color: var(--emerald-600);
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--min-touch-target);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 700;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-sm {
  min-height: 38px;
  padding: 0.4rem 0.85rem;
  font-size: var(--font-size-xs);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-dark);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-navy);
  box-shadow: var(--shadow-md);
}

.btn-outline-primary {
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  background-color: #ffffff;
}

.btn-outline-primary:hover {
  background-color: var(--surface-subtle);
  border-color: var(--text-subtle);
}

.btn-secondary {
  background-color: var(--surface-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--surface-hover);
}

.btn-secondary-subtle {
  background-color: transparent;
  color: var(--text-muted);
}

.btn-secondary-subtle:hover {
  background-color: var(--surface-subtle);
  color: var(--text-main);
}

.btn-danger {
  background-color: var(--crimson-600);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--crimson-500);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   8. Transaction Table & Toolbar
   -------------------------------------------------------------------------- */
.table-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.toolbar-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-badge {
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
}

.toolbar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input-wrapper .form-control {
  padding-left: 2.2rem;
}

/* Table Responsive Container */
.table-responsive-wrapper {
  width: 100%;
  border-radius: var(--radius-md);
  background-color: transparent;
}

.max-h-400 {
  max-height: 420px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--font-size-sm);
}

/* ==========================================================================
   MOBILE-FIRST CARD VIEW FOR TRANSACTIONS (Mencegah Layar Geser-Geser)
   ========================================================================== */
@media (max-width: 767px) {
  .table-responsive-wrapper {
    overflow-x: hidden !important;
    border: none !important;
    padding: 0 !important;
  }

  .data-table thead {
    display: none !important;
  }

  .data-table,
  .data-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .data-table tr.tx-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.6rem !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.95rem 1rem !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
    box-sizing: border-box !important;
    width: 100% !important;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }

  .data-table tr.tx-row:hover {
    box-shadow: var(--shadow-md) !important;
  }

  .data-table td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
  }

  /* Susunan rapi baris per baris di kartu mobile */
  .col-category {
    order: 1;
  }

  .cat-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
  }

  .cat-pill strong {
    font-size: 0.95rem;
    color: var(--text-main);
  }

  .col-amount {
    order: 2;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0 !important;
    border-top: 1px dashed #f1f5f9 !important;
    border-bottom: 1px dashed #f1f5f9 !important;
  }

  .col-amount::before {
    content: "Nominal";
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .amount-val {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  .col-date {
    order: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .col-date::before {
    content: "Tanggal Transaksi:";
    font-weight: 500;
  }

  .date-sub {
    display: none;
  }

  .col-actions {
    order: 4;
    padding-top: 0.4rem !important;
  }

  .actions-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .btn-action {
    width: 100% !important;
    height: 38px !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
    border-radius: var(--radius-sm) !important;
  }

  .badge-mobile-only {
    display: inline-flex !important;
  }

  .cell-desktop-only {
    display: none !important;
  }
}

/* ==========================================================================
   DESKTOP VIEW FOR TRANSACTIONS TABLE (>= 768px)
   ========================================================================== */
@media (min-width: 768px) {
  .table-responsive-wrapper {
    overflow-x: hidden;
    border: 1px solid var(--border-light);
    background-color: #ffffff;
  }

  .data-table {
    display: table;
    table-layout: fixed;
    width: 100%;
  }

  .data-table thead {
    display: table-header-group;
  }

  .data-table tbody {
    display: table-row-group;
  }

  .data-table tr.tx-row {
    display: table-row;
  }

  .data-table th,
  .data-table td {
    display: table-cell;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
  }

  .data-table th {
    background-color: var(--surface-subtle);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 2;
  }

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

  .data-table tbody tr:hover {
    background-color: rgba(248, 250, 252, 0.8);
  }

  /* Kolom Proporsional Rapi Tanpa Geser-Geser */
  .th-date, .col-date { width: 18%; }
  .th-category, .col-category { width: 36%; }
  .th-type, .col-type { width: 14%; }
  .th-amount, .col-amount { width: 18%; text-align: right; }
  .th-actions, .col-actions { width: 14%; text-align: center; }

  .badge-mobile-only {
    display: none !important;
  }

  .cell-desktop-only {
    display: table-cell !important;
  }

  .actions-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
  }

  .btn-action {
    height: 32px;
    padding: 0 0.65rem;
  }
}

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

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

.date-main {
  font-weight: 700;
  display: block;
}

.date-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
}

.td-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
  word-break: break-word;
}

.notes-empty {
  font-style: italic;
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.td-amount-income {
  color: var(--emerald-600);
  font-weight: 700;
}

.td-amount-expense {
  color: var(--crimson-600);
  font-weight: 700;
}

/* ==========================================================================
   TOMBOL AKSI TRANSAKSI RAPIH & TOUCH-FRIENDLY
   ========================================================================== */
.actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.btn-action.edit {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-action.edit:hover,
.btn-action.edit:active {
  background-color: #e0e7ff;
  color: #3730a3;
  border-color: #a5b4fc;
}

.btn-action.delete {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-action.delete:hover,
.btn-action.delete:active {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #f87171;
}

.btn-action svg {
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-icon {
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

.empty-title {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.empty-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  max-width: 320px;
}

/* --------------------------------------------------------------------------
   9. Tab 2: Monthly Report
   -------------------------------------------------------------------------- */
.report-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.report-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.title-with-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-dark);
}

.filter-bar-selectors {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-label-inline {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-main);
  min-width: 50px;
}

.report-summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.report-stat-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.report-stat-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.report-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.report-stat-card.income-stat .report-stat-val {
  color: var(--emerald-600);
}

.report-stat-card.expense-stat .report-stat-val {
  color: var(--crimson-600);
}

.report-stat-card.net-stat .report-stat-val {
  color: var(--primary-accent);
}

.report-stat-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Category Breakdown Progress Bars */
.category-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cat-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--font-size-sm);
}

.cat-name {
  font-weight: 600;
  color: var(--text-main);
}

.cat-amount-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cat-amount {
  font-weight: 700;
  color: var(--text-main);
}

.cat-percent-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-subtle);
  color: var(--text-muted);
}

.cat-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cat-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--crimson-500), #f87171);
  transition: width 0.5s ease-out;
}

/* --------------------------------------------------------------------------
   10. Modal Dialogs (HTML5 <dialog>)
   -------------------------------------------------------------------------- */
.modal-dialog {
  border: none;
  background: transparent;
  padding: 1rem;
  margin: auto;
  max-width: 480px;
  width: 100%;
}

.modal-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  background-color: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}

.modal-desc {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-close-btn {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: var(--surface-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
}

/* Modal Footer Standar (Budget Modal dsb) */
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background-color: #f8fafc;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
}

.modal-footer .btn {
  width: 100%;
  min-height: 44px;
}

#cancelBudgetBtn {
  background-color: #ffffff;
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
}

#cancelBudgetBtn:hover {
  background-color: var(--surface-subtle);
}

/* ==========================================================================
   DESAIN BARU: MODAL KONFIRMASI HAPUS (RAPIH, SIMETRIS & MODERN)
   ========================================================================== */
.modal-delete-card {
  max-width: 420px;
  margin: 0 auto;
  border-radius: 20px;
  padding: 1.6rem;
  background-color: #ffffff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-light);
  text-align: center;
}

.delete-modal-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.2rem;
}

.delete-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background-color: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  box-shadow: 0 0 0 8px #fef2f2;
}

.delete-modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.delete-modal-subtitle {
  font-size: 0.825rem;
  color: #64748b;
  line-height: 1.4;
}

.delete-preview-card {
  background-color: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 1rem 1.15rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.4rem;
}

.delete-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.delete-preview-cat {
  font-weight: 800;
  color: #0f172a;
  font-size: 0.95rem;
}

.delete-preview-nominal {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.delete-preview-date {
  font-size: 0.775rem;
  color: #64748b;
  border-top: 1px dashed #e2e8f0;
  padding-top: 0.4rem;
}

.delete-modal-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
}

.btn-modal-cancel {
  background-color: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-weight: 700;
  border-radius: 12px;
  min-height: 46px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-modal-cancel:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-modal-danger {
  background-color: #dc2626;
  border: none;
  color: #ffffff;
  font-weight: 700;
  border-radius: 12px;
  min-height: 46px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transition: all var(--transition-fast);
}

.btn-modal-danger:hover {
  background-color: #b91c1c;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

/* Presets for Budget Modal */
.quick-preset-container {
  margin-top: 1rem;
}

.preset-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.4rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-preset {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  background-color: var(--surface-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

.btn-preset:hover {
  background-color: var(--primary-accent-subtle);
  color: var(--primary-accent);
  border-color: var(--primary-accent);
}

/* --------------------------------------------------------------------------
   11. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background-color: var(--primary-dark);
  color: #ffffff;
  font-size: var(--font-size-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
}

.toast.toast-success {
  background-color: var(--emerald-600);
}

.toast.toast-danger {
  background-color: var(--crimson-600);
}

.toast.toast-warning {
  background-color: var(--amber-600);
}

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

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

/* --------------------------------------------------------------------------
   12. Media Queries & Responsive Adaptations (Tablet, Laptop, Desktop)
   -------------------------------------------------------------------------- */

/* Tablet & Up (>= 768px) */
@media (min-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-controls {
    flex-direction: row;
    align-items: center;
  }
}

/* Desktop & Laptop (>= 992px): Navigasi Elegan Segmented Pill Bebas Menumpuk */
@media (min-width: 992px) {
  .header-container {
    padding: 0.75rem 2rem;
  }

  .nav-toggle {
    display: none; /* Sembunyikan hamburger pada layar desktop */
  }

  .app-nav {
    display: flex;
    position: static;
    width: auto;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }

  .nav-tabs-wrapper {
    width: auto;
  }

  .nav-tabs {
    flex-direction: row;
    background-color: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius-full);
    border: 1px solid #e2e8f0;
    gap: 0.25rem;
  }

  .nav-tab-btn {
    width: auto;
    padding: 0.45rem 1.05rem;
    border-radius: var(--radius-full);
    font-size: 0.825rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
  }

  .nav-tab-btn:hover {
    color: #0f172a;
    background: transparent;
  }

  .nav-tab-btn.active {
    background-color: #ffffff;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .nav-actions {
    flex-direction: row;
    align-items: center;
    padding-top: 0;
    border-top: none;
    gap: 0.75rem;
    width: auto;
  }
}

  .toolbar-controls {
    flex-direction: row;
    align-items: center;
  }

  .search-input-wrapper {
    flex: 1;
  }

  .filter-bar-selectors {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .report-summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Laptop & Desktop (>= 1024px) */
@media (min-width: 1024px) {
  .app-main {
    padding: 2rem 1.5rem 4rem 1.5rem;
  }

  .summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .content-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    align-items: start;
    gap: 1.75rem;
  }

  .form-panel {
    position: sticky;
    top: 5rem;
  }

  .report-filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .filter-bar-header {
    flex: 1;
  }
}

/* Extra Large Screens (>= 1280px) */
@media (min-width: 1280px) {
  .content-layout {
    grid-template-columns: 410px 1fr;
    gap: 2rem;
  }
}

/* ==========================================================================
   MODUL LOGIN & REGISTRASI (AUTHENTICATION SYSTEM)
   ========================================================================== */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(85vh - 70px);
  width: 100%;
  padding: 1.5rem 0.5rem;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  animation: fadeInAuth 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInAuth {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-icon-badge {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--emerald-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.auth-title span {
  color: var(--emerald-500);
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

/* Input With Icon */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-subtle);
  pointer-events: none;
  z-index: 1;
}

.input-with-icon .form-control {
  padding-left: 2.5rem;
  padding-right: 2.6rem;
  width: 100%;
  box-sizing: border-box;
}

.toggle-password-btn {
  position: absolute;
  right: 0.65rem;
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  z-index: 2;
}

.toggle-password-btn:hover {
  color: var(--primary-dark);
}

.btn-auth-action {
  margin-top: 1.25rem;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

/* ==========================================================================
   NAVBAR: TOMBOL BUDGET & CHIP PROFIL ELEGAN TERPADU (ANTI-NUMPUK)
   ========================================================================== */
.btn-budget-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  border: 1.5px solid #e2e8f0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-budget-pill:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.user-profile-section {
  display: inline-flex;
  align-items: center;
}

.user-pill-unified {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.35rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all var(--transition-fast);
}

.user-pill-unified:hover {
  border-color: #cbd5e1;
}

.user-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #10b981;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.25rem;
}

.user-name-text {
  font-size: 0.825rem;
  font-weight: 700;
  color: #0f172a;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: #0f172a;
  color: #10b981;
  letter-spacing: 0.03em;
}

.btn-logout-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  flex-shrink: 0;
}

.btn-logout-icon:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

/* Mode Logged-Out: Sembunyikan elemen dashboard saat user belum login */
body.user-logged-out .app-nav .nav-tabs,
body.user-logged-out #openBudgetModalBtn,
body.user-logged-out #navToggle {
  display: none !important;
}

/* Responsif Mobile untuk Auth */
@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem 1.15rem;
    box-shadow: none;
    border: 1px solid var(--border-light);
  }

  .user-name-text {
    max-width: 80px;
  }
}

/* ==========================================================================
   STYLING DASHBOARD ADMINISTRATOR (PANEL ADMIN)
   ========================================================================== */
.admin-badge-pill {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--emerald-500);
  color: #ffffff;
  letter-spacing: 0.04em;
  margin-left: 0.25rem;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: #0f172a;
  color: var(--emerald-500);
}

.admin-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.admin-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.admin-header-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.admin-shield-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: var(--emerald-500);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  flex-shrink: 0;
}

.admin-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 0;
}

.admin-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0 0;
}

/* Grid Kartu Metrik Admin */
.admin-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .admin-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.admin-stat-card {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.admin-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-stat-val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 0.35rem 0 0.2rem 0;
  letter-spacing: -0.01em;
}

.admin-stat-sub {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.admin-panel-box {
  margin-bottom: 0.5rem;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-tx-filters {
  min-width: 220px;
}

/* Tabel Admin & User Cells */
.table-user-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.table-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--primary-dark);
  border: 1px solid var(--border-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.table-user-info {
  display: flex;
  flex-direction: column;
}

.table-user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
}

.table-user-uname {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-role-admin {
  background-color: #0f172a !important;
  color: var(--emerald-500) !important;
  font-weight: 800;
}

.badge-role-user {
  background-color: var(--surface-subtle) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-light);
}

.btn-admin-action {
  min-height: 32px;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-admin-danger {
  background-color: #fff1f2;
  color: var(--crimson-600);
  border: 1px solid #fecdd3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-admin-danger:hover {
  background-color: var(--crimson-600);
  color: #ffffff;
}

.btn-admin-role {
  background-color: #f0fdf4;
  color: var(--emerald-600);
  border: 1px solid #bbf7d0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-admin-role:hover {
  background-color: var(--emerald-600);
  color: #ffffff;
}

/* ==========================================================================
   MOBILE CARD VIEW UNTUK TABEL ADMIN (PENGGUNA & SEMUA TRANSAKSI)
   ========================================================================== */
@media (max-width: 767px) {
  /* Sembunyikan thead tabel pada tampilan mobile */
  .admin-table thead {
    display: none !important;
  }

  .admin-table,
  .admin-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.85rem !important;
    width: 100% !important;
  }

  /* 1. Kartu Pengguna Admin di Mobile */
  .data-table tr.admin-user-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.55rem !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.95rem 1rem !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .col-au-user {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-bottom: 0.65rem !important;
    width: 100% !important;
  }

  .au-mobile-top-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .au-id-pill {
    font-size: 0.725rem;
    font-weight: 800;
    color: #64748b;
    background-color: #f1f5f9;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
  }

  .col-au-date,
  .col-au-count,
  .col-au-spend {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 0.8rem !important;
    padding: 0.2rem 0 !important;
    width: 100% !important;
    border: none !important;
  }

  .col-au-spend {
    border-top: 1px dashed #f1f5f9 !important;
    padding-top: 0.45rem !important;
  }

  .au-row-label {
    display: inline-block !important;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
  }

  .au-row-val {
    font-size: 0.825rem;
    color: var(--text-main);
  }

  .col-au-actions {
    border-top: 1px dashed #f1f5f9 !important;
    padding-top: 0.65rem !important;
    margin-top: 0.2rem !important;
    width: 100% !important;
    border-bottom: none !important;
  }

  .au-actions-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .au-self-tag {
    font-size: 0.775rem;
    color: var(--text-subtle);
    text-align: center;
    width: 100%;
    padding: 0.25rem 0;
    font-style: italic;
  }

  .au-actions-wrapper .btn-admin-action {
    width: 100% !important;
    min-height: 38px !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
  }

  /* 2. Kartu Transaksi Pengguna di Mobile */
  .data-table tr.admin-tx-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.55rem !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.95rem 1rem !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .col-atx-user {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-bottom: 0.65rem !important;
    width: 100% !important;
    border-top: none !important;
  }

  .table-user-avatar-sm {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.75rem !important;
  }

  .col-atx-date {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 0.775rem !important;
    color: var(--text-muted) !important;
    padding: 0.15rem 0 !important;
    width: 100% !important;
    border: none !important;
  }

  .col-atx-category {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.2rem !important;
    padding: 0.25rem 0 !important;
    width: 100% !important;
    border: none !important;
  }

  .atx-cat-title {
    font-size: 0.95rem;
    color: var(--text-main);
  }

  .atx-notes-text {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .col-atx-amount {
    display: flex !important;
    align-items: baseline !important;
    justify-content: space-between !important;
    border-top: 1px dashed #f1f5f9 !important;
    border-bottom: 1px dashed #f1f5f9 !important;
    padding: 0.45rem 0 !important;
    width: 100% !important;
  }

  .atx-row-label {
    display: inline-block !important;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .col-atx-actions {
    padding-top: 0.35rem !important;
    width: 100% !important;
    border: none !important;
  }

  .atx-actions-wrapper {
    display: flex !important;
    width: 100% !important;
  }

  .atx-actions-wrapper .btn-admin-danger {
    width: 100% !important;
    min-height: 38px !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
  }
}

/* Desktop View untuk Tabel Admin (>= 768px) */
@media (min-width: 768px) {
  .au-row-label,
  .atx-row-label,
  .au-mobile-top-badges,
  .atx-mobile-top-badge {
    display: none !important;
  }

  .admin-table {
    display: table !important;
    width: 100% !important;
    table-layout: fixed;
  }

  .admin-table thead {
    display: table-header-group !important;
  }

  .admin-table tbody {
    display: table-row-group !important;
  }

  .admin-table tr {
    display: table-row !important;
  }

  .admin-table th,
  .admin-table td {
    display: table-cell !important;
    padding: 0.85rem 1rem !important;
    border-bottom: 1px solid var(--border-light) !important;
    vertical-align: middle;
  }
}



