:root {
  --bg: #0b0f0d;
  --surface: #121713;
  --surface-raised: #171e19;
  --border: #223029;
  --text: #eef3ef;
  --text-dim: #93a39a;
  --accent: #35d08a;
  --accent-dim: #1f6b4c;
  --danger: #ef6b5b;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 8px;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: #05120c;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1rem;
  font-weight: 600;
}

.brand-text span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

main {
  padding: 12px 20px 0;
}

.balance-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(165deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-top: 8px;
}

.balance-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.balance-value {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

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

.entries-section {
  margin-top: 28px;
}

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

.section-head h2 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 600;
}

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #05120c;
}

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

.entries-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.entry-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-zweck {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.entry-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.entry-amount.is-income { color: var(--accent); }
.entry-amount.is-expense { color: var(--danger); }

.empty-state {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  padding: 32px 0;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 4, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.sheet-overlay[hidden] {
  display: none;
}

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 28px;
  max-height: 88vh;
  overflow-y: auto;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 6px auto 14px;
}

.sheet h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
}

.segmented-option {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 9px 0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.segmented-option.is-active {
  background: var(--accent);
  color: #05120c;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.field input,
.field select {
  font-size: 1rem;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.sheet-actions .btn {
  flex: 1;
}
