:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273548;
  --border: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #10b981;
  --primary-dim: #065f46;
  --danger: #ef4444;
  --danger-dim: #7f1d1d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  color: var(--primary);
  font-size: 1.5rem;
  text-align: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  margin-top: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #04150e;
  width: 100%;
  margin-top: 16px;
}

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger-dim);
  color: #fecaca;
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 8px;
}

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

.month-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.month-nav h2 {
  margin: 0;
  font-size: 1.1rem;
}

table.summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.summary th,
table.summary td {
  padding: 6px 4px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

table.summary th:first-child,
table.summary td:first-child {
  text-align: left;
}

table.summary .over {
  color: var(--danger);
}

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.tx-row:last-child {
  border-bottom: none;
}

.tx-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tx-amount {
  font-weight: 600;
}

.tx-amount.refund {
  color: var(--primary);
}

.fab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.fab-row button {
  flex: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  flex: 1;
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 24px 0;
}

.tx-list-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  margin-bottom: 8px;
}

.tx-count {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.filter-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

.filter-chevron {
  color: var(--text-dim);
}

.filter-body {
  margin-top: 4px;
}

.filter-row-2 {
  display: flex;
  gap: 12px;
}

.filter-row-2 > div {
  flex: 1;
}

.metrics-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-card {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.metric-value {
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 4px;
}

.metric-value.positive {
  color: var(--primary);
}

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