:root {
  color-scheme: dark;
  --bg: #0b0d0c;
  --surface: #151917;
  --surface-2: #1d231f;
  --line: #303831;
  --text: #f1efe4;
  --muted: #aaa895;
  --green: #1f6f54;
  --green-soft: #2c8a67;
  --brass: #b99755;
  --red: #9f3f32;
  --paper: #ddd0ac;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(185, 151, 85, 0.14), transparent 29rem),
    linear-gradient(135deg, #050605, #151713 62%, #0a0d0b);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 450px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 108px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    var(--bg);
  background-size: 22px 22px;
  box-shadow: var(--shadow);
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(100%, 390px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(31, 111, 84, 0.18), rgba(21, 25, 23, 0.98) 50%);
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-card h1 {
  margin: 8px 0 22px;
  font-size: 32px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-message {
  min-height: 20px;
  color: var(--brass);
  font-size: 14px;
}

[hidden] {
  display: none !important;
}

.topbar,
.hero-row,
.section-heading,
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow,
.muted,
label span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

h3 {
  font-size: 14px;
  line-height: 1.2;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #101311;
  color: var(--paper);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hero-panel,
.entry-panel,
.reflection-panel,
.movements {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(31, 111, 84, 0.2), rgba(21, 25, 23, 0.98) 48%);
  padding: 18px;
}

.hero-panel {
  margin-top: 24px;
}

.hero-panel h2 {
  margin: 8px 0 6px;
  font-size: clamp(36px, 10vw, 48px);
  line-height: 0.95;
  color: var(--paper);
}

.seal {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid var(--red);
  border-radius: 8px;
  color: #f1c8bb;
  font-family: Georgia, serif;
  font-weight: 700;
  transform: rotate(-4deg);
}

.meter {
  height: 9px;
  margin: 18px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #2a2e29;
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-soft), var(--brass));
  transition: width 220ms ease;
}

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

.hero-stats strong {
  color: var(--text);
  font-weight: 700;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d100e;
}

.segment {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 8px 11px;
  font-size: 13px;
}

.segment.active {
  background: var(--paper);
  color: #111513;
}

.entry-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 8px;
}

.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1210;
  color: var(--text);
  padding: 13px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brass);
}

textarea {
  resize: vertical;
}

.primary-button {
  grid-column: 1 / -1;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #2e8063);
  color: #fff9e9;
  font-weight: 800;
}

.categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.categories article {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 25, 23, 0.88);
  padding: 12px;
}

.cat-icon {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #20271f;
  color: var(--brass);
  font-size: 12px;
  font-weight: 800;
}

.categories p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.reflection-panel {
  background: linear-gradient(145deg, rgba(185, 151, 85, 0.15), rgba(21, 25, 23, 0.98) 52%);
}

.reflection-panel .section-heading {
  align-items: flex-start;
  margin-bottom: 14px;
}

#savingGoal {
  max-width: 130px;
  color: var(--brass);
  font-size: 12px;
  text-align: right;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--brass);
  font-weight: 700;
}

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

.movement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 10px;
}

.movement:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.movement small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.amount {
  color: var(--paper);
  font-weight: 800;
  white-space: nowrap;
}

.amount.income {
  color: #88d0ad;
}

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

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 450px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(11, 13, 12, 0.92);
  backdrop-filter: blur(14px);
  padding: 10px 12px 12px;
}

.bottom-nav button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.bottom-nav .active {
  background: var(--surface-2);
  color: var(--paper);
}

@media (min-width: 760px) {
  body {
    padding: 28px 0;
  }

  .app-shell {
    min-height: calc(100vh - 56px);
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
  }

  .bottom-nav {
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
}
