:root {
  color-scheme: light;
  --bg: #fff7ed;
  --panel: #fffaf2;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #8a735c;
  --line: #efe1d0;
  --primary: #d97706;
  --primary-dark: #9a4a07;
  --dark: #2d2a26;
  --warn-bg: #fff0d8;
  --warn-line: #f4c983;
  --shadow: 0 18px 45px rgba(80, 55, 20, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.12), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.screen {
  min-height: 100vh;
  padding: 18px 16px 108px;
}

.entry-screen {
  display: grid;
  align-content: center;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--card);
}

.hero-card {
  border: 0;
  border-radius: 24px;
  padding: 18px;
  background: var(--dark);
  color: #fff;
}

.hero-row,
.topbar,
.list-row,
.balance-title,
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-amount {
  margin: 8px 0 12px;
  font-size: 38px;
  font-weight: 850;
  line-height: 1.05;
}

.pill-row,
.quick-grid,
.form-grid,
.report-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.icon-btn,
.tab-btn {
  border: 0;
}

.primary-btn {
  width: 100%;
  border-radius: 999px;
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 850;
}

.secondary-btn {
  border-radius: 999px;
  padding: 10px 13px;
  background: #efe2cf;
  color: var(--ink);
  font-weight: 750;
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
}

.textarea {
  min-height: 74px;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: #efe2cf;
}

.segmented button {
  border: 0;
  border-radius: 999px;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented button.active {
  background: #fff;
  color: var(--primary-dark);
}

.list-row {
  padding: 10px 0;
  border-bottom: 1px solid #f1e5d6;
}

.list-row:last-child {
  border-bottom: 0;
}

.amount {
  font-weight: 850;
}

.row-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.compact-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.mini-note {
  font-size: 12px;
}

.section-head,
.fixed-cost-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h3 {
  margin-bottom: 0;
}

.section-head span,
.fixed-cost-top span {
  color: var(--muted);
  font-size: 12px;
}

.fixed-cost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.fixed-cost-item {
  min-width: 0;
  border: 1px solid #f1e5d6;
  border-radius: 14px;
  padding: 10px;
  background: #fffdf8;
}

.fixed-cost-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fixed-cost-amount {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.05;
}

.edit-panel {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fffdf8;
}

.warn {
  border: 1px solid var(--warn-line);
  border-radius: 16px;
  padding: 11px;
  background: var(--warn-bg);
  color: #8a4b00;
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  width: min(100%, 460px);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
  backdrop-filter: blur(12px);
}

.nav {
  min-height: 76px;
  padding: 10px 12px 14px;
}

.tab-btn {
  min-width: 0;
  flex: 1;
  min-height: 52px;
  border-radius: 16px;
  padding: 12px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 850;
}

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

.month-toggle {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 6px 0;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 850;
  text-align: left;
}

.month-toggle span {
  font-size: 18px;
}

.month-toggle strong {
  font-size: 20px;
}

.report-card {
  flex: 1 1 128px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.bar-list {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe2cf;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 700px) {
  body {
    padding: 24px;
  }

  .app,
  .bottom-nav {
    border-radius: 30px;
    overflow: hidden;
  }

  .bottom-nav {
    right: 24px;
    bottom: 24px;
    left: 24px;
  }
}
