:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --ink: #171815;
  --muted: #696d63;
  --line: #dedfd8;
  --accent: #19715a;
  --accent-2: #285f9f;
  --danger: #a83e33;
  --shadow: 0 12px 30px rgba(28, 31, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.topbar,
.panel-head,
.row-main,
.row-actions,
.tabs,
.metrics {
  display: flex;
  align-items: center;
}

.topbar,
.panel-head {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.7rem;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1rem;
}

.icon-button,
button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

button.secondary {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

button.danger {
  background: transparent;
  color: var(--danger);
  min-height: 32px;
  padding: 0 8px;
}

.budget-panel,
.tab-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.budget-panel {
  padding: 16px;
}

.meter {
  height: 10px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e7df;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms ease;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metrics div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.metrics strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 0;
  background: var(--bg);
  overflow-x: auto;
}

.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.tab-panel {
  display: none;
  padding: 14px;
}

.tab-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.stack,
.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.table-card,
.list-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-card {
  overflow: hidden;
}

.table-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfbf8;
}

.expense-row,
.list-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.expense-row:first-of-type {
  border-top: 0;
}

.row-main {
  justify-content: space-between;
  gap: 12px;
}

.amount {
  font-weight: 750;
}

.meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.row-actions {
  justify-content: flex-end;
  gap: 8px;
}

.empty {
  padding: 14px;
  color: var(--muted);
}

.status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 720px) {
  .app {
    padding-top: 28px;
  }

  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .form-grid button {
    grid-column: span 1;
  }
}
