* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #4ade80;
  --red: #f87171;
  --orange: #fb923c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  padding-top: env(safe-area-inset-top, 16px);
  padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 80px);
}

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

header h1 {
  font-size: 22px;
  font-weight: 700;
}

.header-btns {
  display: flex;
  gap: 8px;
}

/* Hero card - today's remaining budget */
.hero-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  border: 2px solid var(--green);
}

.hero-card.over {
  border-color: var(--red);
  background: #1e1215;
}

.hero-label {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.hero-value {
  font-size: 48px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 13px;
  color: var(--muted);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.card.wide { width: 100%; }

.card-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
}

.card-value.red { color: var(--red); }
.card-value.green { color: var(--green); }

/* Month progress */
.month-header, .month-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-footer {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 8px;
  position: relative;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-fill.over {
  background: var(--red);
}

.progress-marker {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  background: var(--text);
  opacity: 0.5;
  transform: translateX(-1px);
}

/* Chart */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  padding: 12px 0 20px 0;
  position: relative;
}

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

.chart-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}

.chart-bar.over {
  background: var(--red);
}

.chart-date {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

.chart-budget-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--muted);
  opacity: 0.4;
}

.chart-budget-line span {
  font-size: 9px;
  color: var(--muted);
  position: absolute;
  right: 0;
  top: -14px;
}

/* Section titles */
.section-title {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 20px;
}

.empty-msg {
  font-size: 14px;
  color: var(--muted);
  padding: 12px 0;
}

/* Transaction list */
.txn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.txn:active {
  opacity: 0.7;
}

.txn-info { flex: 1; min-width: 0; }

.txn-name {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-meta {
  font-size: 12px;
  color: var(--muted);
}

.txn-amount {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 12px;
  white-space: nowrap;
}

.txn-amount.debit { color: var(--text); }
.txn-amount.credit { color: var(--green); }

.fixed-badge {
  font-size: 10px;
  background: var(--border);
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
}

/* Buttons */
.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}

.btn:active { opacity: 0.8; }

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

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
  border-radius: 8px;
  margin-bottom: 0;
}

/* Settings */
.settings-row {
  display: flex;
  align-items: center;
  margin-top: 12px;
}

.dollar-prefix {
  font-size: 28px;
  font-weight: 700;
  margin-right: 4px;
}

.settings-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  width: 100%;
  outline: none;
}

.settings-input:focus {
  border-color: var(--accent);
}

.settings-hint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.4;
}

/* States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 15px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.error-msg {
  color: var(--red);
  margin-bottom: 16px;
  font-size: 14px;
}

.pull-indicator {
  position: fixed;
  top: -40px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 10px;
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  z-index: 100;
  pointer-events: none;
}
