:root,
[data-theme="light"] {
  --bg: #e6ebf2;
  --surface: #e6ebf2;
  --surface-alt: #dde3ec;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-soft: rgba(16, 185, 129, 0.14);
  --rose: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --indigo: #6366f1;
  --indigo-soft: rgba(99, 102, 241, 0.14);

  --neu-shadow-out: 7px 7px 14px #c5cdd8, -7px -7px 14px #ffffff;
  --neu-shadow-sm: 4px 4px 9px #c5cdd8, -4px -4px 9px #ffffff;
  --neu-shadow-in: inset 4px 4px 8px #c5cdd8, inset -4px -4px 8px #ffffff;
  --neu-border: 1px solid rgba(255, 255, 255, 0.55);
  --divider-color: rgba(148, 163, 184, 0.25);
  --radius: 18px;
}

[data-theme="dark"] {
  --bg: #1e232a;
  --surface: #1e232a;
  --surface-alt: #252b34;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #34d399;
  --primary-dark: #10b981;
  --primary-soft: rgba(52, 211, 153, 0.16);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.16);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.16);
  --indigo: #818cf8;
  --indigo-soft: rgba(129, 140, 248, 0.16);

  --neu-shadow-out: 7px 7px 14px #14181d, -7px -7px 14px #282e37;
  --neu-shadow-sm: 4px 4px 9px #14181d, -4px -4px 9px #282e37;
  --neu-shadow-in: inset 4px 4px 8px #14181d, inset -4px -4px 8px #282e37;
  --neu-border: 1px solid rgba(255, 255, 255, 0.05);
  --divider-color: rgba(148, 163, 184, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html,
body {
  overflow-x: hidden;
  max-width: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.text-emerald { color: var(--primary); }
.text-rose { color: var(--rose); }
.text-right { text-align: right; }

/* Neumorphic Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  border: var(--neu-border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neu-shadow-sm);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.2s ease;
  text-decoration: none;
}

.btn:active:not(:disabled) {
  box-shadow: var(--neu-shadow-in);
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  border: none;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
}

.btn-ghost {
  background: var(--surface);
  color: var(--muted);
}
.btn-ghost:hover {
  color: var(--text);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--rose);
}

.btn-block {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 2px;
}
.btn-link:hover {
  text-decoration: underline;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: var(--neu-border);
  background: var(--surface);
  box-shadow: var(--neu-shadow-sm);
  display: inline-grid;
  place-items: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.icon-btn:active {
  box-shadow: var(--neu-shadow-in);
  transform: scale(0.96);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: var(--neu-border);
  background: var(--surface);
  box-shadow: var(--neu-shadow-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.theme-toggle:active {
  box-shadow: var(--neu-shadow-in);
  transform: scale(0.96);
}

/* Inset Neumorphic Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.field label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  padding-left: 2px;
}

.field input,
.field select,
.field textarea,
.month-picker,
.toolbar-filters input,
.toolbar-filters select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  font: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: box-shadow 0.18s ease;
}

.field textarea {
  min-height: 76px;
  resize: vertical;
}

input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block;
  box-sizing: border-box;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  box-shadow: var(--neu-shadow-in), 0 0 0 2px var(--primary-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: var(--neu-border);
  box-shadow: var(--neu-shadow-out);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}
.toast.success { border-left: 4px solid var(--primary); }
.toast.error { border-left: 4px solid var(--rose); }

/* Auth View (Mobile-first) */
.auth-wrapper {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  position: relative;
}

.auth-topbar {
  width: 100%;
  max-width: 460px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: var(--neu-border);
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: var(--neu-shadow-out);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-badge svg {
  width: 46px;
  height: 46px;
  display: block;
  border-radius: 14px;
  box-shadow: var(--neu-shadow-sm);
}
.brand-badge.sm svg {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.auth-brand h1 {
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-brand p {
  font-size: 0.82rem;
  color: var(--muted);
}

.mode-banner {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
  background: var(--amber-soft);
  color: var(--amber);
  box-shadow: var(--neu-shadow-in);
}
.mode-banner.online {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
[data-theme="dark"] .mode-banner.online {
  color: var(--primary);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 18px;
  gap: 6px;
}

.auth-tab {
  min-height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s ease;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--neu-shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  padding-top: 14px;
  border-top: 1px solid var(--divider-color);
}

/* App Shell — Mobile-First Layout */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  left: -290px;
  top: 0;
  bottom: 0;
  width: 268px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-out);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  z-index: 1100;
  transition: left 0.22s ease;
}
.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 0 4px;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-inline strong {
  display: block;
  font-size: 1.05rem;
}

.sidebar-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: 0.16s ease;
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item:hover {
  color: var(--text);
  box-shadow: var(--neu-shadow-sm);
}
.nav-item.active {
  color: var(--primary);
  box-shadow: var(--neu-shadow-in);
}

.sidebar-footer {
  border-top: 1px solid var(--divider-color);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sync-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  text-align: center;
  box-shadow: var(--neu-shadow-in);
}
.sync-badge.online {
  background: var(--primary-soft);
  color: var(--primary);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--neu-shadow-sm);
}

.user-meta {
  overflow: hidden;
}
.user-meta strong,
.user-meta span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta strong { font-size: 0.88rem; }
.user-meta span { font-size: 0.76rem; color: var(--muted); }

/* Main Content (with bottom padding on mobile for bottom nav) */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 16px 14px calc(92px + env(safe-area-inset-bottom));
  width: 100%;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar h2 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.topbar-actions .btn,
.topbar-actions .icon-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.month-picker {
  flex: 1;
  min-width: 0;
}

/* KPI Grid (Mobile-first 2x2 or 1-col compact) */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: var(--neu-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--neu-shadow-out);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-card.highlight {
  position: relative;
  padding-right: 64px;
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  color: #ffffff;
  border: none;
}

.balance-eye-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.balance-eye-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}
.balance-eye-btn:active {
  transform: translateY(-50%) scale(0.95);
}
.kpi-card:last-child {
  grid-column: 1 / -1;
}
.kpi-card.highlight .kpi-label,
.kpi-card.highlight .kpi-sub {
  color: rgba(255, 255, 255, 0.85);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.15rem;
  font-weight: 800;
  word-break: break-word;
}
.kpi-card.highlight .kpi-value {
  font-size: 1.5rem;
}

.kpi-sub {
  font-size: 0.74rem;
  color: var(--muted);
}

/* Panels & Charts */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--surface);
  border: var(--neu-border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--neu-shadow-out);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-header h3 {
  font-size: 0.98rem;
  font-weight: 800;
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.dot.emerald { background: var(--primary); }
.dot.rose { background: var(--rose); }

.chart-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: end;
  height: 180px;
  padding: 12px 8px 8px;
  border-radius: 14px;
  box-shadow: var(--neu-shadow-in);
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 132px;
  width: 100%;
  justify-content: center;
}

.bar {
  width: 12px;
  border-radius: 6px 6px 3px 3px;
  min-height: 4px;
  transition: height 0.3s ease;
}
.bar.income { background: var(--primary); }
.bar.expense { background: var(--rose); }

.chart-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 700;
}

.progress-track {
  height: 10px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  border-radius: 999px;
  overflow: hidden;
  padding: 2px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 999px;
}
.progress-fill.warn { background: var(--amber); }
.progress-fill.danger { background: var(--rose); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table th {
  text-align: left;
  padding: 10px 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--divider-color);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.badge.income { background: var(--primary-soft); color: var(--primary); }
.badge.expense { background: var(--rose-soft); color: var(--rose); }
.badge.transfer { background: var(--indigo-soft); color: var(--indigo); }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.neutral { background: var(--surface-alt); color: var(--muted); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.toolbar-filters input[type="search"] {
  grid-column: 1 / -1;
}
@media (max-width: 639px) {
  .toolbar-filters > :nth-child(2):last-child,
  .toolbar-filters > :nth-child(4):last-child {
    grid-column: 1 / -1;
  }
}

.toolbar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.toolbar-actions .btn {
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 0.86rem;
}
#btn-add-tx {
  display: none;
}
@media (min-width: 900px) {
  .toolbar-actions {
    display: flex;
    width: auto;
  }
  #btn-add-tx {
    display: inline-flex;
  }
}

/* Cards & Documents */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.entity-card {
  background: var(--surface);
  border: var(--neu-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--neu-shadow-out);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entity-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.doc-card {
  position: relative;
  background: var(--surface);
  border: var(--neu-border);
  border-radius: var(--radius);
  box-shadow: var(--neu-shadow-out);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.doc-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: var(--neu-border);
  background: var(--surface);
  box-shadow: var(--neu-shadow-sm);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.doc-edit-btn:active {
  box-shadow: var(--neu-shadow-in);
}

.doc-thumb {
  position: relative;
  height: 128px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.doc-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.doc-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.doc-body strong {
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-details {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 0.86rem;
}

.doc-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--divider-color);
  margin-top: auto;
}

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

/* Modals (Bottom-sheet style on mobile, centered on desktop) */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-x: hidden;
  z-index: 1200;
}

.modal-card {
  background: var(--surface);
  border: var(--neu-border);
  border-radius: 24px;
  width: 100%;
  max-width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 18px;
  box-shadow: var(--neu-shadow-out);
}
.modal-card.sm { max-width: 100%; }
@media (min-width: 640px) {
  .modal-card { max-width: 560px; }
  .modal-card.sm { max-width: 460px; }
}

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

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

.receipt-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  border-radius: 12px;
  font-size: 0.84rem;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.receipt-preview span,
.receipt-preview a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: 220px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  border-radius: 14px;
  padding: 12px;
}
.preview-body img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 10px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border: var(--neu-border);
  box-shadow: var(--neu-shadow-out);
  border-radius: 22px;
  padding: 8px 6px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  z-index: 1050;
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

.bottom-nav-btn svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-btn.active {
  color: var(--primary);
  box-shadow: var(--neu-shadow-in);
}

/* Hide hamburger button on mobile (bottom nav is primary) */
#btn-open-sidebar {
  display: none !important;
}

.mobile-only { display: inline-grid; }

/* Searchable Select (Neumorphic) */
.ss-wrap {
  position: relative;
  width: 100%;
}

.ss-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.ss-trigger {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ss-trigger-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-dropdown {
  position: fixed;
  background: var(--surface);
  border: var(--neu-border);
  border-radius: 14px;
  box-shadow: var(--neu-shadow-out);
  padding: 8px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ss-search {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.ss-options {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ss-option {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.ss-option:hover,
.ss-option.selected {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

/* Donut Chart Diagram */
.donut-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.donut-svg-wrap {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  box-shadow: var(--neu-shadow-out);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.donut-center span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}
.donut-center strong {
  font-size: 0.92rem;
  font-weight: 800;
}

.donut-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
}

.donut-legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .donut-layout {
    flex-direction: row;
    align-items: center;
  }
}

/* Native Neumorphic Notification & Confirm Modals */
.notify-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 6px 4px;
}

.notify-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.notify-icon.success { color: var(--primary); }
.notify-icon.error { color: var(--rose); }
.notify-icon.warning { color: var(--amber); }
.notify-icon.info { color: var(--indigo); }

@keyframes mm-spin {
  to { transform: rotate(360deg); }
}
.loading-spinner {
  animation: mm-spin 0.85s linear infinite;
}

/* ATM-Style Wallet Cards */
.atm-card {
  position: relative;
  border-radius: 20px;
  padding: 20px;
  color: #ffffff;
  box-shadow: var(--neu-shadow-out);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 185px;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.atm-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.atm-card.bank-bri { background: linear-gradient(135deg, #00529c 0%, #003366 100%); }
.atm-card.bank-bca { background: linear-gradient(135deg, #005eb8 0%, #003875 100%); }
.atm-card.bank-jago { background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%); }
.atm-card.bank-seabank { background: linear-gradient(135deg, #f97316 0%, #c2410c 100%); }
.atm-card.bank-dana { background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%); }
.atm-card.bank-gopay { background: linear-gradient(135deg, #00aa13 0%, #007a4d 100%); }
.atm-card.bank-ovo { background: linear-gradient(135deg, #4c3494 0%, #2e1065 100%); }
.atm-card.bank-cash { background: linear-gradient(135deg, #059669 0%, #064e3b 100%); }

.atm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 1;
}
.atm-bank-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}
.atm-actions {
  display: flex;
  gap: 6px;
}
.atm-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.atm-icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.atm-chip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
  z-index: 1;
}
.atm-balance {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  z-index: 1;
}
.atm-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.8rem;
  opacity: 0.92;
  z-index: 1;
}
.atm-name {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Stacked Apple Wallet Staircase */
.atm-stack-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.atm-stack {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.atm-card.is-stacked {
  position: absolute;
  left: 0;
  right: 0;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), top 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.18), 0 12px 28px rgba(0, 0, 0, 0.22);
}

.atm-card.is-stacked.is-dragging {
  transition: none;
  cursor: grabbing;
}

.atm-peek-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atm-primary-pill {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.atm-stack-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* =========================================================
   APPLE LIQUID GLASS (GLASSMORPHISM) THEME
   ========================================================= */
[data-ui-style="liquidglass"] {
  --glass-bg: rgba(255, 255, 255, 0.56);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-inset: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 12px 36px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --glass-shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --radius: 22px;
}

[data-ui-style="liquidglass"][data-theme="dark"] {
  --glass-bg: rgba(28, 34, 48, 0.56);
  --glass-bg-strong: rgba(24, 30, 44, 0.78);
  --glass-inset: rgba(15, 23, 42, 0.45);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  --glass-shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

[data-ui-style="liquidglass"] body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.014em;
  background:
    radial-gradient(circle at 12% 10%, rgba(16, 185, 129, 0.28), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(56, 189, 248, 0.28), transparent 44%),
    radial-gradient(circle at 50% 88%, rgba(129, 140, 248, 0.24), transparent 48%),
    linear-gradient(160deg, #eef4f8 0%, #e2ebf5 55%, #edf2f7 100%);
  background-attachment: fixed;
}

[data-ui-style="liquidglass"][data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 12%, rgba(16, 185, 129, 0.22), transparent 42%),
    radial-gradient(circle at 86% 20%, rgba(59, 130, 246, 0.24), transparent 46%),
    radial-gradient(circle at 48% 90%, rgba(139, 92, 246, 0.2), transparent 50%),
    linear-gradient(160deg, #0b1120 0%, #111827 55%, #0f172a 100%);
  background-attachment: fixed;
}

[data-ui-style="liquidglass"] .auth-card,
[data-ui-style="liquidglass"] .kpi-card:not(.highlight),
[data-ui-style="liquidglass"] .panel,
[data-ui-style="liquidglass"] .entity-card,
[data-ui-style="liquidglass"] .doc-card,
[data-ui-style="liquidglass"] .modal-card,
[data-ui-style="liquidglass"] .sidebar,
[data-ui-style="liquidglass"] .ss-dropdown {
  background: var(--glass-bg);
  backdrop-filter: blur(26px) saturate(190%);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
}

[data-ui-style="liquidglass"] .modal-card,
[data-ui-style="liquidglass"] .ss-dropdown {
  background: var(--glass-bg-strong);
}

[data-ui-style="liquidglass"] .mobile-bottom-nav {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 999px;
  padding: 6px 10px;
}

[data-ui-style="liquidglass"] .bottom-nav-btn {
  border-radius: 999px;
}
[data-ui-style="liquidglass"] .bottom-nav-btn.active {
  background: var(--primary-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

[data-ui-style="liquidglass"] .btn,
[data-ui-style="liquidglass"] .icon-btn,
[data-ui-style="liquidglass"] .theme-toggle,
[data-ui-style="liquidglass"] .doc-edit-btn {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
  border-radius: 999px;
}

[data-ui-style="liquidglass"] .btn-primary {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.92) 0%, rgba(5, 150, 105, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

[data-ui-style="liquidglass"] .field input,
[data-ui-style="liquidglass"] .field select,
[data-ui-style="liquidglass"] .field textarea,
[data-ui-style="liquidglass"] .month-picker,
[data-ui-style="liquidglass"] .toolbar-filters input,
[data-ui-style="liquidglass"] .ss-trigger,
[data-ui-style="liquidglass"] .ss-search,
[data-ui-style="liquidglass"] .chart-bars,
[data-ui-style="liquidglass"] .progress-track,
[data-ui-style="liquidglass"] .preview-body,
[data-ui-style="liquidglass"] .preview-details,
[data-ui-style="liquidglass"] .receipt-preview,
[data-ui-style="liquidglass"] .auth-tabs,
[data-ui-style="liquidglass"] .mode-banner,
[data-ui-style="liquidglass"] .notify-icon {
  background: var(--glass-inset);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

[data-ui-style="liquidglass"] .nav-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
}
[data-ui-style="liquidglass"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}
[data-ui-style="liquidglass"][data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
[data-ui-style="liquidglass"] .auth-tab.active,
[data-ui-style="liquidglass"] .nav-item.active {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
  color: var(--primary);
  font-weight: 700;
}

[data-ui-style="liquidglass"] .kpi-card.highlight {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.86) 0%, rgba(13, 148, 136, 0.9) 100%);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow: 0 14px 34px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* Tablet & Desktop Breakpoints */
@media (min-width: 640px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .docs-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
  .modal {
    align-items: center;
    padding: 16px;
  }
  .modal-card {
    border-radius: 24px;
    padding: 24px;
  }
  .toolbar-filters {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
  .toolbar-filters input[type="search"] {
    grid-column: auto;
  }
}

@media (min-width: 900px) {
  .mobile-only,
  .mobile-bottom-nav {
    display: none !important;
  }
  .sidebar {
    position: sticky;
    top: 20px;
    left: 0;
    height: calc(100vh - 40px);
    margin: 20px 0 20px 20px;
    border-radius: 24px;
    border: var(--neu-border);
    box-shadow: var(--neu-shadow-out);
    flex-shrink: 0;
  }
  .main-content {
    padding: 26px 32px;
  }
  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
  }
  .topbar-row {
    flex: 1;
    min-width: 0;
  }
  .topbar h2 {
    font-size: 1.45rem;
  }
  .page-subtitle {
    display: block;
  }
  .topbar-actions {
    width: auto;
    flex-shrink: 0;
    gap: 10px;
  }
  .month-picker {
    flex: 0 0 auto;
    width: 170px;
  }
  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
  .kpi-card.highlight,
  .kpi-card:last-child {
    grid-column: auto;
  }
  .dashboard-grid {
    grid-template-columns: 1.35fr 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .toolbar-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    gap: 10px;
  }
  .toolbar-filters input[type="search"] {
    flex: 1.4;
    min-width: 190px;
    max-width: 300px;
  }
  .toolbar-filters .ss-wrap {
    flex: 1;
    min-width: 135px;
    max-width: 190px;
  }
  .toolbar-actions .btn {
    flex: none;
  }
}

/* =========================================================
   HAND-DRAWN (SKETCHBOOK) THEME
   ========================================================= */
[data-ui-style="handdrawn"] {
  --hd-paper: #fdfaf2;
  --hd-paper-alt: #f5efe0;
  --hd-ink: #1e293b;
  --hd-shadow: 4px 4px 0px #1e293b;
  --hd-shadow-sm: 2.5px 2.5px 0px #1e293b;
  --hd-radius: 18px 22px 19px 24px / 22px 17px 23px 18px;
}

[data-ui-style="handdrawn"][data-theme="dark"] {
  --hd-paper: #1d2128;
  --hd-paper-alt: #262b34;
  --hd-ink: #e2e8f0;
  --hd-shadow: 4px 4px 0px #090b0f;
  --hd-shadow-sm: 2.5px 2.5px 0px #090b0f;
}

[data-ui-style="handdrawn"] body {
  font-family: 'Patrick Hand', 'Plus Jakarta Sans', cursive, sans-serif;
  font-size: 1.04rem;
  background-color: var(--hd-paper);
  background-image: radial-gradient(rgba(100, 116, 139, 0.22) 1px, transparent 1px);
  background-size: 20px 20px;
}

[data-ui-style="handdrawn"] h1,
[data-ui-style="handdrawn"] h2,
[data-ui-style="handdrawn"] h3,
[data-ui-style="handdrawn"] h4 {
  font-family: 'Caveat', 'Patrick Hand', cursive;
  letter-spacing: 0.01em;
}

[data-ui-style="handdrawn"] .auth-card,
[data-ui-style="handdrawn"] .kpi-card:not(.highlight),
[data-ui-style="handdrawn"] .panel,
[data-ui-style="handdrawn"] .entity-card,
[data-ui-style="handdrawn"] .doc-card,
[data-ui-style="handdrawn"] .modal-card,
[data-ui-style="handdrawn"] .sidebar,
[data-ui-style="handdrawn"] .mobile-bottom-nav,
[data-ui-style="handdrawn"] .ss-dropdown {
  background: var(--hd-paper);
  border: 2.5px solid var(--hd-ink);
  border-radius: var(--hd-radius);
  box-shadow: var(--hd-shadow);
}

[data-ui-style="handdrawn"] .kpi-card.highlight {
  border: 2.5px solid var(--hd-ink);
  border-radius: var(--hd-radius);
  box-shadow: var(--hd-shadow);
}

[data-ui-style="handdrawn"] .atm-card {
  border: 2.5px solid var(--hd-ink);
  border-radius: 20px 16px 22px 17px / 17px 21px 16px 22px;
  box-shadow: var(--hd-shadow);
}

[data-ui-style="handdrawn"] .btn,
[data-ui-style="handdrawn"] .icon-btn,
[data-ui-style="handdrawn"] .theme-toggle,
[data-ui-style="handdrawn"] .doc-edit-btn {
  background: var(--hd-paper-alt);
  border: 2px solid var(--hd-ink);
  border-radius: 14px 18px 15px 17px / 17px 14px 18px 15px;
  box-shadow: var(--hd-shadow-sm);
}

[data-ui-style="handdrawn"] .btn-primary {
  background: var(--primary);
  color: #ffffff;
}

[data-ui-style="handdrawn"] .btn:active:not(:disabled),
[data-ui-style="handdrawn"] .icon-btn:active,
[data-ui-style="handdrawn"] .theme-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--hd-ink);
}

[data-ui-style="handdrawn"] .field input,
[data-ui-style="handdrawn"] .field select,
[data-ui-style="handdrawn"] .field textarea,
[data-ui-style="handdrawn"] .month-picker,
[data-ui-style="handdrawn"] .toolbar-filters input,
[data-ui-style="handdrawn"] .ss-trigger,
[data-ui-style="handdrawn"] .ss-search,
[data-ui-style="handdrawn"] .chart-bars,
[data-ui-style="handdrawn"] .progress-track,
[data-ui-style="handdrawn"] .preview-body,
[data-ui-style="handdrawn"] .preview-details,
[data-ui-style="handdrawn"] .receipt-preview,
[data-ui-style="handdrawn"] .auth-tabs,
[data-ui-style="handdrawn"] .mode-banner,
[data-ui-style="handdrawn"] .notify-icon,
[data-ui-style="handdrawn"] .donut-svg-wrap {
  background: var(--hd-paper-alt);
  border: 2px solid var(--hd-ink);
  border-radius: 12px 15px 13px 14px / 14px 12px 15px 13px;
  box-shadow: none;
}

[data-ui-style="handdrawn"] .donut-svg-wrap {
  border-radius: 50%;
  box-shadow: var(--hd-shadow-sm);
}

[data-ui-style="handdrawn"] .nav-item {
  border: 2px solid transparent;
  border-radius: 14px 17px 15px 16px;
}
[data-ui-style="handdrawn"] .nav-item:hover {
  background: var(--hd-paper-alt);
  border-color: var(--hd-ink);
}
[data-ui-style="handdrawn"] .nav-item.active,
[data-ui-style="handdrawn"] .bottom-nav-btn.active,
[data-ui-style="handdrawn"] .auth-tab.active {
  background: rgba(16, 185, 129, 0.2);
  border: 2px solid var(--hd-ink);
  box-shadow: var(--hd-shadow-sm);
  color: var(--text);
}

/* =========================================================
   TERMINAL (HACKER / PROGRAMMER) THEME
   ========================================================= */
[data-ui-style="terminal"] {
  --bg: #edf5ef;
  --surface: #f5faf6;
  --surface-alt: #e3efe6;
  --text: #062818;
  --muted: #2f6b4f;
  --primary: #059669;
  --primary-dark: #047857;
  --term-border: rgba(5, 150, 105, 0.42);
  --term-glow: 0 0 16px rgba(5, 150, 105, 0.12);
  --radius: 6px;
}

[data-ui-style="terminal"][data-theme="dark"] {
  --bg: #050a07;
  --surface: #0a120d;
  --surface-alt: #0f1b14;
  --text: #4ade80;
  --muted: #22c55e;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --primary-soft: rgba(34, 197, 94, 0.16);
  --rose: #fb7185;
  --amber: #facc15;
  --indigo: #38bdf8;
  --term-border: rgba(74, 222, 128, 0.35);
  --term-glow: 0 0 20px rgba(34, 197, 94, 0.14);
}

[data-ui-style="terminal"] body {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(
    0deg,
    rgba(34, 197, 94, 0.03) 0px,
    rgba(34, 197, 94, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
}

[data-ui-style="terminal"] .auth-card,
[data-ui-style="terminal"] .kpi-card:not(.highlight),
[data-ui-style="terminal"] .panel,
[data-ui-style="terminal"] .entity-card,
[data-ui-style="terminal"] .doc-card,
[data-ui-style="terminal"] .modal-card,
[data-ui-style="terminal"] .sidebar,
[data-ui-style="terminal"] .mobile-bottom-nav,
[data-ui-style="terminal"] .ss-dropdown {
  background: var(--surface);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow: var(--term-glow);
}

[data-ui-style="terminal"] .kpi-card.highlight {
  border: 1px solid var(--primary);
  border-radius: 6px;
  box-shadow: var(--term-glow);
}

[data-ui-style="terminal"] .atm-card {
  border: 1px solid var(--term-border);
  border-radius: 8px;
  box-shadow: var(--term-glow);
}

[data-ui-style="terminal"] .btn,
[data-ui-style="terminal"] .icon-btn,
[data-ui-style="terminal"] .theme-toggle,
[data-ui-style="terminal"] .doc-edit-btn {
  background: var(--surface-alt);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow: none;
  letter-spacing: 0.03em;
}

[data-ui-style="terminal"] .btn-primary {
  background: var(--primary);
  color: #03150b;
  border-color: var(--primary);
}

[data-ui-style="terminal"] .field input,
[data-ui-style="terminal"] .field select,
[data-ui-style="terminal"] .field textarea,
[data-ui-style="terminal"] .month-picker,
[data-ui-style="terminal"] .toolbar-filters input,
[data-ui-style="terminal"] .ss-trigger,
[data-ui-style="terminal"] .ss-search,
[data-ui-style="terminal"] .chart-bars,
[data-ui-style="terminal"] .progress-track,
[data-ui-style="terminal"] .preview-body,
[data-ui-style="terminal"] .preview-details,
[data-ui-style="terminal"] .receipt-preview,
[data-ui-style="terminal"] .auth-tabs,
[data-ui-style="terminal"] .mode-banner,
[data-ui-style="terminal"] .notify-icon {
  background: var(--bg);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow: none;
}

[data-ui-style="terminal"] .nav-item,
[data-ui-style="terminal"] .bottom-nav-btn {
  border-radius: 6px;
}

[data-ui-style="terminal"] .nav-item.active,
[data-ui-style="terminal"] .bottom-nav-btn.active,
[data-ui-style="terminal"] .auth-tab.active {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  box-shadow: var(--term-glow);
  color: var(--text);
}

/* Sub-tabs (Ringkasan & Anggaran) */
.subtabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--neu-shadow-in);
  margin-bottom: 16px;
  width: 100%;
  max-width: 420px;
}
.subtab-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
.subtab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--neu-shadow-sm);
}

[data-ui-style="liquidglass"] .subtabs {
  background: var(--glass-inset);
  border: 1px solid var(--glass-border);
  box-shadow: none;
  border-radius: 999px;
}
[data-ui-style="liquidglass"] .subtab-btn {
  border-radius: 999px;
}
[data-ui-style="liquidglass"] .subtab-btn.active {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-sm);
}

[data-ui-style="handdrawn"] .subtabs {
  background: var(--hd-paper-alt);
  border: 2px solid var(--hd-ink);
  box-shadow: none;
}
[data-ui-style="handdrawn"] .subtab-btn.active {
  background: rgba(16, 185, 129, 0.22);
  border: 2px solid var(--hd-ink);
  box-shadow: var(--hd-shadow-sm);
  color: var(--text);
}

[data-ui-style="terminal"] .subtabs {
  background: var(--bg);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow: none;
}
[data-ui-style="terminal"] .subtab-btn {
  border-radius: 4px;
}
[data-ui-style="terminal"] .subtab-btn.active {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  box-shadow: var(--term-glow);
  color: var(--text);
}

/* Goal Analysis Box */
.goal-analysis-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-alt);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Indonesian Stock Analyzer Grid */
.stocks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  .stocks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .stocks-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.stock-card {
  background: var(--surface);
  border: var(--neu-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--neu-shadow-out);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
[data-ui-style="liquidglass"] .stock-card {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
[data-ui-style="handdrawn"] .stock-card {
  background: var(--hd-paper);
  border: 2.5px solid var(--hd-ink);
  border-radius: var(--hd-radius);
  box-shadow: var(--hd-shadow);
}
[data-ui-style="terminal"] .stock-card {
  background: var(--surface);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow: var(--term-glow);
}

.stock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.stock-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 0.78rem;
}
.stock-metric-box {
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--surface-alt);
}
.stock-metric-box span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}
