:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #66726d;
  --line: #dce4df;
  --page: #f4f7f3;
  --surface: #ffffff;
  --surface-soft: #f9fbf8;
  --green: #207a55;
  --teal: #0f6a73;
  --blue: #245f9d;
  --gold: #9b6b09;
  --red: #b43d32;
  --shadow: 0 18px 48px rgba(31, 47, 42, 0.11);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.3rem, 6vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.04rem;
}

.lede {
  width: min(680px, 100%);
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.5;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  border: 0;
  border-radius: 7px;
  padding: 11px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  min-height: 42px;
}

.button:hover {
  background: #263531;
}

.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--surface-soft);
}

.button.full {
  width: 100%;
  margin-top: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  white-space: nowrap;
}

.pill.good {
  border-color: rgba(32, 122, 85, 0.25);
  color: var(--green);
  background: #eef8f1;
}

.pill.warn {
  border-color: rgba(180, 61, 50, 0.25);
  color: var(--red);
  background: #fff0eb;
}

.metrics,
.grid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 118px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span,
.forecast-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric strong {
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 1;
}

.metric.reserve {
  background: #f0f7f4;
}

.metric.spend {
  border-color: rgba(15, 106, 115, 0.25);
  background: #eef8f8;
}

.metric.risk {
  border-color: rgba(155, 107, 9, 0.2);
  background: #fff8e8;
}

.primary-grid {
  grid-template-columns: 310px minmax(0, 1fr);
}

.secondary-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

.section-title {
  margin-bottom: 16px;
}

.section-title.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}

label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: var(--surface-soft);
  color: var(--ink);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.forecast-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.forecast-card strong {
  display: block;
  margin: 6px 0;
  font-size: 1.3rem;
}

.forecast-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.bill-list,
.stack {
  display: grid;
  gap: 10px;
}

.bill-card,
.list-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 13px;
}

.bill-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) repeat(4, minmax(110px, 0.65fr)) auto;
  gap: 12px;
  align-items: center;
}

.bill-main strong,
.list-top strong {
  display: block;
}

.subtext {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.amount {
  color: var(--blue);
  font-weight: 850;
}

.negative {
  color: var(--red);
}

.small-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

.reserve-input {
  max-width: 118px;
  padding: 8px 9px;
}

.icon-button {
  min-width: 42px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-weight: 900;
}

.icon-button.active {
  border-color: rgba(32, 122, 85, 0.35);
  background: #e9f7ee;
  color: var(--green);
}

.list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar {
  height: 9px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: #e7ede9;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
}

.compact .list-card {
  padding: 11px 12px;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-header,
  .section-title.row {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .primary-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }

  .bill-card {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 620px);
    padding-top: 18px;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .header-actions .button,
  .header-actions .pill {
    flex: 1 1 100%;
  }

  .bill-card {
    grid-template-columns: 1fr;
  }
}

