:root {
  --bg: #111827;
  --panel: #1f2937;
  --border: #374151;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #4ade80;
  --danger: #f87171;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: 72px;
}

header {
  padding: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  border-bottom: 1px solid var(--border);
}

h1 { font-size: 1.1rem; margin: 0 0 12px; color: var(--muted); font-weight: 500; }

.period-toggle {
  display: flex;
  gap: 6px;
}
.period-toggle button {
  flex: 1;
  padding: 8px 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.85rem;
}
.period-toggle button.active {
  background: var(--accent);
  color: #052e16;
  border-color: var(--accent);
  font-weight: 600;
}

main { padding: 16px; }

.view { display: none; }
.view.active { display: block; }

.total-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.total-card .amount { font-size: 2.1rem; font-weight: 700; }
.total-card .label { color: var(--muted); font-size: 0.85rem; }

.card {
  background: var(--panel);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { font-size: 0.9rem; color: var(--muted); margin: 0 0 12px; font-weight: 600; }

.list-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.list-row:last-child { border-bottom: none; }
.list-row .name { color: var(--text); }
.list-row .value { color: var(--muted); }

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-main { display: flex; flex-direction: column; }
.tx-merchant { font-weight: 600; font-size: 0.95rem; }
.tx-meta { color: var(--muted); font-size: 0.78rem; }
.tx-amount { font-weight: 700; }

input, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters input, .filters select { margin-bottom: 0; }

button.primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #052e16;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
}

.ai-answer {
  background: var(--panel);
  border-radius: 14px;
  padding: 16px;
  margin-top: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
}

nav.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
nav.tabbar button {
  flex: 1;
  padding: 12px 4px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
}
nav.tabbar button.active { color: var(--accent); }

.empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 0.9rem; }
.muted { color: var(--muted); font-size: 0.8rem; }

@media print {
  header, nav.tabbar, .no-print { display: none !important; }
  body { padding-bottom: 0; background: #fff; color: #000; }
  .card, .total-card { background: #fff; border: 1px solid #ccc; }
}
