/* ==============================================
   KontraktorPro — Design Tokens & Styles
   ============================================== */

:root {
  /* Colors */
  --c-bg:          oklch(1.000 0.000 0);
  --c-surface:     oklch(0.968 0.004 25);
  --c-surface-2:   oklch(0.940 0.006 25);
  --c-ink:         oklch(0.150 0.012 25);
  --c-muted:       oklch(0.520 0.010 25);
  --c-placeholder: oklch(0.640 0.008 25);

  --c-primary:       oklch(0.480 0.215 25.7);
  --c-primary-hover: oklch(0.420 0.200 25.7);
  --c-primary-light: oklch(0.960 0.020 25.7);
  --c-primary-text:  oklch(1.000 0.000 0);

  --c-accent:      oklch(0.300 0.080 240);
  --c-accent-text: oklch(1.000 0.000 0);

  --c-danger:     oklch(0.480 0.215 25.7);
  --c-danger-bg:  oklch(0.960 0.020 25.7);
  --c-warning:    oklch(0.530 0.180 55);
  --c-warning-bg: oklch(0.970 0.025 55);
  --c-success:    oklch(0.420 0.130 145);
  --c-success-bg: oklch(0.960 0.020 145);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* Radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:    0 1px 2px oklch(0.150 0.012 25 / 0.06);
  --shadow-md:    0 2px 8px oklch(0.150 0.012 25 / 0.08), 0 1px 2px oklch(0.150 0.012 25 / 0.04);
  --shadow-lg:    0 8px 24px oklch(0.150 0.012 25 / 0.12), 0 2px 6px oklch(0.150 0.012 25 / 0.06);
  --shadow-modal: 0 24px 64px oklch(0.150 0.012 25 / 0.22);

  /* Z-index */
  --z-sticky:   200;
  --z-modal-bd: 300;
  --z-modal:    400;
  --z-toast:    500;

  /* Layout */
  --sidebar-w:    240px;
  --bottom-nav-h: 64px;

  /* Motion */
  --dur-fast:   120ms;
  --dur-normal: 220ms;
  --dur-slow:   350ms;
  --ease-out:   cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-ink);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: var(--text-base); }
a { color: var(--c-primary); text-decoration: none; }
img, svg { display: block; }

/* ── Utilities ── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── App shell ── */
#app {
  display: flex;
  min-height: 100dvh;
}

/* ── Sidebar (desktop) ── */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-surface-2);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  padding: var(--sp-6) 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-6) var(--sp-6);
  border-bottom: 1px solid var(--c-surface-2);
  margin-bottom: var(--sp-4);
}
.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: var(--c-primary);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-mark span {
  color: var(--c-primary-text);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar-logo-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: 0 var(--sp-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--c-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--dur-fast); }
.nav-item:hover { background: var(--c-surface-2); color: var(--c-ink); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--sp-4) var(--sp-3) 0;
  border-top: 1px solid var(--c-surface-2);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ── Main content ── */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

.page-header {
  position: sticky; top: 0;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-surface-2);
  padding: var(--sp-5) var(--sp-8);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.page-body {
  padding: var(--sp-8);
  flex: 1;
  max-width: 1280px;
  width: 100%;
}

/* ── Summary cards ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.summary-card {
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.summary-card-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.summary-card-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.summary-card-value.safe    { color: var(--c-success); }
.summary-card-value.warn    { color: var(--c-warning); }
.summary-card-value.danger  { color: var(--c-danger); }
.summary-card-sub {
  font-size: var(--text-xs);
  color: var(--c-muted);
  font-family: var(--font-mono);
}

/* ── Dashboard layout ── */
.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-6);
  align-items: start;
}

.budget-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.section-heading {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
}

/* ── Budget table ── */
.budget-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
}
.budget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.budget-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  color: var(--c-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--c-surface-2);
  white-space: nowrap;
}
.budget-table th.num, .budget-table td.num {
  text-align: right;
}
.budget-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-surface-2);
  vertical-align: middle;
}
.budget-table tr:last-child td { border-bottom: none; }
.budget-table tr:hover td { background: var(--c-surface); }

.item-name {
  font-weight: 500;
  color: var(--c-ink);
  max-width: 280px;
}
.item-qty {
  color: var(--c-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.money {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.money.safe   { color: var(--c-success); font-weight: 600; }
.money.warn   { color: var(--c-warning); font-weight: 600; }
.money.danger { color: var(--c-danger);  font-weight: 600; }
.money.neutral { color: var(--c-ink); }
.money.muted  { color: var(--c-muted); }

/* ── Progress bar ── */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}
.progress-track {
  height: 5px;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--c-success);
  transition: width var(--dur-slow) var(--ease-out);
}
.progress-fill.warn   { background: var(--c-warning); }
.progress-fill.danger { background: var(--c-danger); }
.progress-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--c-muted);
  text-align: right;
}

/* ── Chart panel ── */
.chart-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: sticky;
  top: calc(57px + var(--sp-8));
}
.chart-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: var(--sp-4);
}
.chart-container {
  position: relative;
  height: 220px;
}
.chart-legend {
  margin-top: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 180px;
  overflow-y: auto;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--c-muted);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-ink);
}
.legend-pct {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-muted);
}

/* ── Keuangan summary ── */
.finance-summary {
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-surface-2);
  gap: var(--sp-4);
}
.finance-row:last-child { border-bottom: none; }
.finance-row.total {
  background: var(--c-primary-light);
  padding: var(--sp-4) var(--sp-5);
}
.finance-label {
  font-size: var(--text-sm);
  color: var(--c-muted);
}
.finance-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
  white-space: nowrap;
}
.finance-value.profit { color: var(--c-success); }
.finance-value.highlight { color: var(--c-primary); font-size: var(--text-base); }

/* ── Form page ── */
.form-layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: var(--sp-8);
  align-items: start;
}

.form-card {
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.form-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: var(--sp-6);
  letter-spacing: -0.02em;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-ink);
}
.form-label .required {
  color: var(--c-danger);
  margin-left: 2px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-ink);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  outline: none;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--c-placeholder);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px oklch(0.480 0.215 25.7 / 0.12);
}
.form-input.mono { font-family: var(--font-mono); }
.form-input.error { border-color: var(--c-danger); }
.form-error-msg {
  font-size: var(--text-xs);
  color: var(--c-danger);
  display: none;
}
.form-error-msg.show { display: block; }

.form-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

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

.btn-secondary {
  background: var(--c-surface-2);
  color: var(--c-ink);
  border: 1px solid var(--c-surface-2);
}
.btn-secondary:hover { background: var(--c-surface); border-color: var(--c-surface-2); }

.btn-ghost {
  background: none;
  color: var(--c-muted);
  border: 1px solid var(--c-surface-2);
}
.btn-ghost:hover { background: var(--c-surface); color: var(--c-ink); }

.btn-danger {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border: 1px solid oklch(0.480 0.215 25.7 / 0.2);
}
.btn-danger:hover { background: var(--c-danger); color: var(--c-primary-text); }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--text-base); }
.btn-full { width: 100%; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
}

/* ── Recent transactions ── */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.recent-item {
  background: var(--c-bg);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  transition: background var(--dur-fast);
}
.recent-item:hover { background: var(--c-surface); }
.recent-item-info {
  flex: 1;
  min-width: 0;
}
.recent-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-item-detail {
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-top: 2px;
}
.recent-item-amount {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-danger);
  white-space: nowrap;
}

/* ── Log / Riwayat toolbar ── */
.log-toolbar { display: none; } /* lama, disembunyikan */

.riwayat-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.riwayat-filter-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.riwayat-filter-sel {
  flex: 1;
  min-width: 130px;
  max-width: 200px;
}
.riwayat-toolbar-right {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}
.riwayat-toolbar-right .riwayat-filter-sel {
  min-width: 160px;
  max-width: 200px;
}
.riwayat-count {
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-left: auto;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .riwayat-filter-sel { max-width: 100%; }
  .riwayat-count { margin-left: 0; }
}

.log-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
}
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.log-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--c-surface-2);
  white-space: nowrap;
}
.log-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-surface-2);
  vertical-align: middle;
}
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: var(--c-surface); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
  color: var(--c-muted);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--sp-4);
  opacity: 0.4;
}
.empty-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: var(--sp-2);
}
.empty-text {
  font-size: var(--text-sm);
  color: var(--c-muted);
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-surface-2) 50%, var(--c-surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - var(--sp-8));
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: white;
  pointer-events: auto;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  animation: toast-in var(--dur-normal) var(--ease-out) forwards;
}
.toast.out {
  animation: toast-out var(--dur-normal) var(--ease-out) forwards;
}
.toast.success { background: var(--c-success); }
.toast.error   { background: var(--c-danger); }
.toast.info    { background: var(--c-accent); }
@keyframes toast-in {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(4px); }
}

/* ── Dialog / Modal ── */
dialog {
  padding: 0;
  border: none;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  max-width: min(460px, calc(100vw - var(--sp-8)));
  width: 100%;
  background: var(--c-bg);
  outline: none;
}
dialog::backdrop {
  background: oklch(0.100 0.010 25 / 0.45);
  backdrop-filter: blur(2px);
}
.dialog-header {
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--c-surface-2);
}
.dialog-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.02em;
}
.dialog-body {
  padding: var(--sp-5) var(--sp-6);
}
.dialog-body p {
  font-size: var(--text-sm);
  color: var(--c-muted);
  line-height: 1.6;
}
.dialog-footer {
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* ── Hapus Semua Riwayat modal ── */
.hapus-semua-warning {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: oklch(0.970 0.015 25);
  border: 1px solid oklch(0.880 0.040 25);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.hapus-semua-warning svg {
  flex-shrink: 0;
  color: var(--c-danger);
  margin-top: 1px;
}
.hapus-semua-warning p {
  font-size: var(--text-sm);
  color: var(--c-text);
  line-height: 1.6;
  margin: 0;
}
.hapus-semua-confirm-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.hapus-semua-label {
  font-size: var(--text-sm);
  color: var(--c-muted);
}
.hapus-semua-keyword {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--c-danger);
  background: oklch(0.960 0.020 25);
  padding: 1px 6px;
  border-radius: 4px;
}
.hapus-semua-input {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ── Export dialog ── */
.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
}
.export-option {
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.export-option:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.export-option svg { color: var(--c-primary); }
.export-option-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
}
.export-option-desc {
  font-size: var(--text-xs);
  color: var(--c-muted);
}

/* ── Setup overlay ── */
#setup-overlay {
  position: fixed; inset: 0;
  background: var(--c-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}
.setup-card {
  max-width: 480px;
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
}
.setup-logo {
  width: 48px; height: 48px;
  background: var(--c-primary);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-5);
}
.setup-logo span {
  color: white;
  font-size: var(--text-lg);
  font-weight: 700;
}
.setup-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
}
.setup-desc {
  font-size: var(--text-sm);
  color: var(--c-muted);
  margin-bottom: var(--sp-6);
  line-height: 1.7;
}
.setup-steps {
  background: var(--c-bg);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-6);
  font-size: var(--text-sm);
  line-height: 2;
  color: var(--c-muted);
}
.setup-steps code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--c-surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--c-ink);
}

/* ── Loading spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--c-surface-2);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Bottom nav (mobile only) ── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--c-bg);
  border-top: 1px solid var(--c-surface-2);
  z-index: var(--z-sticky);
  padding: 0;
}
.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 100%;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--c-muted);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--dur-fast);
  border: none;
  background: none;
  cursor: pointer;
}
.bottom-nav-item svg { transition: transform var(--dur-fast) var(--ease-out); }
.bottom-nav-item.active {
  color: var(--c-primary);
}
.bottom-nav-item.active svg { transform: scale(1.1); }

/* ── Mobile header ── */
.mobile-header {
  display: none;
  position: sticky; top: 0;
  height: 56px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-surface-2);
  z-index: var(--z-sticky);
  padding: 0 var(--sp-5);
  align-items: center;
  justify-content: space-between;
}
.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.mobile-header-logo-mark {
  width: 28px; height: 28px;
  background: var(--c-primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.mobile-header-logo-mark span {
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
}
.mobile-header-title {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mobile-header-actions {
  display: flex;
  gap: var(--sp-2);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .dashboard-body {
    grid-template-columns: 1fr;
  }
  .chart-panel {
    position: static;
  }
  .form-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #sidebar { display: none; }
  #main { margin-left: 0; padding-bottom: var(--bottom-nav-h); }
  #bottom-nav { display: block; }
  .mobile-header { display: flex; }
  .page-header { display: none; }
  .page-body { padding: var(--sp-4); }

  /* Summary cards: 2x2 grid */
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
  }
  .summary-card { padding: var(--sp-4); }
  .summary-card-value { font-size: var(--text-xl); }

  /* Dashboard: tabel dulu, grafik ke bawah */
  .dashboard-body {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
  }
  /* Kolom kanan (grafik) pindah ke bawah — order CSS */
  .dashboard-body > .budget-section { order: 1; }
  .dashboard-body > div:last-child   { order: 2; }

  /* Tabel: horizontal scroll */
  .budget-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .budget-table {
    min-width: 560px;
  }

  .budget-table th, .budget-table td { padding: var(--sp-2) var(--sp-3); }
  .log-table th, .log-table td { padding: var(--sp-2) var(--sp-3); }
  .form-card { padding: var(--sp-4); }
}

@media (max-width: 480px) {
  /* Summary cards: 1 kolom di layar sangat kecil */
  .summary-grid { grid-template-columns: 1fr; }
  .export-options { grid-template-columns: 1fr; }
}

/* ── Sidebar Drawer (mobile hamburger) ── */
.sidebar-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
}
.sidebar-drawer.hidden {
  pointer-events: none;
}
.sidebar-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: oklch(0.100 0.010 25 / 0.45);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity var(--dur-normal) var(--ease-out);
}
.sidebar-drawer.hidden .sidebar-drawer-backdrop {
  opacity: 0;
}
.sidebar-drawer-panel {
  position: relative;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform var(--dur-normal) var(--ease-out);
  box-shadow: 4px 0 24px oklch(0 0 0 / 0.12);
  overflow-y: auto;
}
.sidebar-drawer.hidden .sidebar-drawer-panel {
  transform: translateX(-100%);
}
.sidebar-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--c-surface-2);
}
.sidebar-drawer-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-3);
}
.sidebar-drawer-footer {
  padding: var(--sp-3) var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--c-surface-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

/* ── Auth Screen ── */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: var(--c-surface-1);
}
.auth-card {
  background: var(--c-bg);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px oklch(0 0 0 / 0.06);
}
.auth-logo {
  text-align: center;
  margin-bottom: var(--sp-6);
}
.auth-logo-mark {
  width: 52px; height: 52px;
  background: var(--c-primary);
  border-radius: var(--r-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-3);
}
.auth-logo-mark span {
  color: white;
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.auth-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-1);
}
.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--c-muted);
}
.auth-tabs {
  display: flex;
  background: var(--c-surface-1);
  border-radius: var(--r-md);
  padding: 3px;
  margin-bottom: var(--sp-5);
  gap: 2px;
}
.auth-tab {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: transparent;
  border-radius: calc(var(--r-md) - 2px);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--c-muted);
  transition: all var(--dur-fast) var(--ease-out);
}
.auth-tab.active {
  background: var(--c-bg);
  color: var(--c-text);
  box-shadow: 0 1px 4px oklch(0 0 0 / 0.08);
}
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-toggle-pw {
  position: absolute;
  right: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  padding: 0;
}
.auth-forgot {
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-top: calc(var(--sp-1) * -1);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
  color: var(--c-muted);
  font-size: var(--text-xs);
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-surface-2);
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  color: var(--c-text);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn-google:hover {
  background: var(--c-surface-1);
  border-color: var(--c-border);
}

/* ── Sidebar user info ── */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  background: var(--c-surface-1);
  border-radius: var(--r-md);
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  background: var(--c-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-detail { overflow: hidden; }
.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: var(--text-xs);
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════
   v2 ADDITIONS — multi-project & new tabs
   ══════════════════════════════════════════ */

/* ── App shell v2 ── */
#app {
  flex-direction: column;
}
#screen-projects {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
#screen-project {
  display: flex;
  min-height: 100dvh;
}

/* ── Projects header ── */
.projects-header {
  padding: var(--sp-6) var(--sp-8);
  border-bottom: 1px solid var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  background: var(--c-bg);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.projects-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ── Projects user menu ── */
.projects-user-menu {
  position: relative;
}
.projects-user-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-3);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--radius-full);
  background: var(--c-bg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--c-ink);
  font-size: var(--text-sm);
  font-weight: 500;
}
.projects-user-btn:hover {
  background: var(--c-surface-1);
  border-color: var(--c-surface-3);
}
.projects-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}
.projects-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--c-bg);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: calc(var(--z-sticky) + 10);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
}
.projects-user-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.projects-user-dropdown-info {
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}
.projects-user-dropdown-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-user-dropdown-email {
  font-size: var(--text-xs);
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-user-dropdown-divider {
  height: 1px;
  background: var(--c-surface-2);
  margin: 0 var(--sp-2);
}
.projects-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--c-ink);
  text-align: left;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: background 0.12s;
}
.projects-user-dropdown-item:hover {
  background: var(--c-surface-1);
}
.projects-user-dropdown-logout {
  color: var(--c-danger, #dc2626);
}

/* Mobile: hide user name text, keep avatar only */
@media (max-width: 480px) {
  .projects-user-name,
  .projects-user-btn > svg:last-child {
    display: none;
  }
  .projects-user-btn {
    padding: 6px;
    border-radius: 50%;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.brand-mark {
  width: 40px; height: 40px;
  background: var(--c-primary);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark span {
  color: white;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--c-ink);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.brand-tag {
  font-size: var(--text-xs);
  color: var(--c-muted);
}

.projects-body {
  flex: 1;
  padding: var(--sp-8);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ── Projects grid ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-5);
}

/* ── Project card ── */
.project-card {
  background: var(--c-surface);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: box-shadow var(--dur-normal) var(--ease-out),
              border-color var(--dur-normal) var(--ease-out);
}
.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: oklch(0.480 0.215 25.7 / 0.2);
}
.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.project-card-icon {
  width: 40px; height: 40px;
  background: var(--c-primary-light);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.project-card-icon span {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--c-primary);
  letter-spacing: -0.02em;
}
.project-card-actions {
  display: flex;
  gap: var(--sp-1);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.project-card:hover .project-card-actions { opacity: 1; }
.project-card-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.project-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}
.project-stat-label {
  font-size: var(--text-xs);
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.project-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
}
.project-card-btn {
  margin-top: auto;
  justify-content: space-between;
}

/* ── Sidebar v2 (back btn + project name) ── */
.sidebar-top {
  padding: 0 var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-surface-2);
  margin-bottom: var(--sp-4);
}
.sidebar-back-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--c-muted);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: none;
  background: none;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
  width: 100%;
  text-align: left;
  margin-bottom: var(--sp-3);
}
.sidebar-back-btn:hover {
  background: var(--c-surface-2);
  color: var(--c-ink);
}
.sidebar-project-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
  padding: 0 var(--sp-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Page subtitle ── */
.page-subtitle {
  font-size: var(--text-sm);
  color: var(--c-muted);
  margin-top: 2px;
}

/* ── Input prefix (Rp label inside input) ── */
.input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
  font-size: var(--text-sm);
  pointer-events: none;
  font-family: var(--font-mono);
}

/* ── Form hint ── */
.form-hint {
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-top: var(--sp-1);
  display: block;
}

/* ── Kategori total row ── */
.kategori-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  margin-top: var(--sp-1);
  background: var(--c-primary-light);
  border: 1px solid oklch(0.480 0.215 25.7 / 0.15);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-primary);
}

/* ── Log badge (activity log actions) ── */
.log-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.log-badge-create {
  background: var(--c-success-bg);
  color: var(--c-success);
}
.log-badge-update {
  background: var(--c-warning-bg);
  color: var(--c-warning);
}
.log-badge-delete {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}
.log-badge-system {
  background: var(--c-surface-2);
  color: var(--c-muted);
}

/* ── Danger zone card ── */
.danger-zone-card {
  border: 1px solid oklch(0.480 0.215 25.7 / 0.25);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  background: var(--c-danger-bg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
}
.danger-zone-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-danger);
  margin-bottom: var(--sp-1);
}
.danger-zone-desc {
  font-size: var(--text-sm);
  color: var(--c-muted);
  max-width: 360px;
  line-height: 1.5;
}

/* ── Bottom nav v2 (5 items) ── */
.bottom-nav-inner {
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav-cta {
  color: var(--c-primary) !important;
  font-weight: 600;
}
.bottom-nav-cta svg {
  stroke: var(--c-primary);
}

/* ── More sheet (mobile slide-up) ── */
.more-sheet {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) - 1);
}
.more-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: oklch(0.100 0.010 25 / 0.4);
}
.more-sheet-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--c-bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-2) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.more-sheet-handle {
  width: 36px; height: 4px;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  margin: var(--sp-2) auto var(--sp-4);
}
.more-sheet-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--c-ink);
  border-radius: var(--r-md);
  border: none;
  background: none;
  cursor: pointer;
  transition: background var(--dur-fast);
  text-align: left;
}
.more-sheet-item svg { color: var(--c-muted); flex-shrink: 0; }
.more-sheet-item:hover { background: var(--c-surface); }
.more-sheet-divider {
  height: 1px;
  background: var(--c-surface-2);
  margin: var(--sp-2) 0;
}
.more-sheet-back {
  color: var(--c-muted);
}

/* ── Mobile back button ── */
.mobile-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--c-ink);
  margin-right: var(--sp-1);
  flex-shrink: 0;
  transition: background var(--dur-fast);
}
.mobile-back-btn:hover { background: var(--c-surface-2); }

/* ── Responsive v2 ── */
@media (max-width: 768px) {
  .projects-header { padding: var(--sp-4) var(--sp-5); }
  .projects-body { padding: var(--sp-4); }
  .projects-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
  .project-card-actions { opacity: 1; }
  .danger-zone-card { flex-direction: column; gap: var(--sp-4); }
}

@media (max-width: 480px) {
  .projects-grid { grid-template-columns: 1fr; }
}

/* ── Termin (Dana Masuk) ── */
.termin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  gap: var(--sp-3);
}

.termin-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

.termin-item {
  background: var(--c-bg);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  transition: background var(--dur-fast);
}
.termin-item:hover { background: var(--c-surface); }

.termin-item-left {
  flex: 1;
  min-width: 0;
}
.termin-item-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
}
.termin-item-meta {
  font-size: var(--text-xs);
  color: var(--c-muted);
  margin-top: 2px;
}

.termin-item-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.termin-item-amount {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-success);
  white-space: nowrap;
}

.termin-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-ink);
  border-top: 1px solid var(--c-surface-2);
  margin-top: var(--sp-1);
}

/* ── Import Massal Modal ── */
.modal-import {
  width: min(860px, 96vw);
  max-height: 92dvh;
}
.modal-import[open] {
  display: flex;
  flex-direction: column;
}
.modal-import .dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.import-hint {
  font-size: var(--text-sm);
  color: var(--c-muted);
  margin-bottom: var(--sp-3);
}
.import-format-example {
  background: var(--c-surface-1);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--c-muted);
}
.import-format-example pre {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--c-ink);
  white-space: pre-wrap;
}
.import-textarea {
  width: 100%;
  min-height: 220px;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-surface-3);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--c-ink);
  background: var(--c-bg);
  resize: vertical;
  box-sizing: border-box;
}
.import-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-subtle);
}
.import-preview-body {
  overflow-y: auto;
  max-height: 55dvh;
  padding-bottom: 0;
}
.import-summary {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}
.import-summary-chip {
  background: var(--c-surface-1);
  border: 1px solid var(--c-surface-2);
  border-radius: var(--radius-full);
  padding: 3px var(--sp-3);
  font-size: var(--text-xs);
  color: var(--c-muted);
}
.import-summary-chip strong { color: var(--c-ink); }
.import-table-wrap { overflow-x: auto; }
.import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.import-table th {
  background: var(--c-surface-1);
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--c-surface-2);
  white-space: nowrap;
}
.import-table th.num { text-align: right; }
.import-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-surface-1);
  vertical-align: middle;
}
.import-table td.num { text-align: right; font-family: var(--font-mono); }
.import-table tr:hover td { background: var(--c-surface-1); }
.import-table tr.import-row-error td { background: oklch(0.98 0.01 25); }
.import-kat-select {
  width: 100%;
  padding: 4px var(--sp-2);
  border: 1px solid var(--c-surface-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  background: var(--c-bg);
  color: var(--c-ink);
}
.import-kat-select.unmatched { border-color: var(--c-warning); background: oklch(0.99 0.02 85); }
.import-row-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-muted);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}
.import-row-remove:hover { color: var(--c-danger); }
