:root {
  color-scheme: light;
  --bg: #f7f7f6;
  --paper: #ffffff;
  --text: #171717;
  --muted: #8a8a8a;
  --line: #ececec;
  --accent: #ff655d;
  --accent-strong: #ef4444;
  --soft-shadow: 0 22px 55px rgba(30, 30, 30, 0.08);
  --bar-a: #ffdca8;
  --bar-b: #b7e9fb;
  --bar-c: #fac8da;
  --bar-d: #f8eda8;
  --bar-e: #d7f5c8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 50% -10%, #ffffff 0, var(--bg) 42%, #f1f1f0 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.phone-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(104px + env(safe-area-inset-bottom));
  position: relative;
}

.hero-summary {
  padding-top: 2px;
}

.total-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3.4rem, 16vw, 5.25rem);
  line-height: 0.9;
  font-weight: 900;
}

h2 {
  font-size: 1.05rem;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.chip-filter,
.count-chip,
.day-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  color: #303030;
  background: #eeeeed;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.chip-filter {
  position: relative;
}

.chip-filter input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chip-filter::after {
  content: "⌄";
  color: #555;
  font-size: 0.8rem;
}

.chip-filter.static::after {
  content: "";
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.report-month {
  min-height: 18px;
  margin: 14px 0 0;
}

.chart {
  min-height: 330px;
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 8px 0 28px;
  padding-top: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.bar-row {
  border: 0;
  padding: 0;
  background: transparent;
  flex: 0 0 82px;
  width: 82px;
  height: 300px;
  display: flex;
  align-items: end;
  scroll-snap-align: start;
  cursor: pointer;
}

.bar-row.active .bar-card {
  outline: 3px solid rgba(23, 23, 23, 0.18);
  outline-offset: 4px;
  transform: translateY(-6px);
}

.bar-card {
  width: 100%;
  min-height: 112px;
  border-radius: 18px;
  position: relative;
  display: grid;
  align-content: end;
  justify-items: center;
  padding: 18px 8px 20px;
  overflow: visible;
}

.bar-row:nth-child(4n + 1) .bar-card {
  background: var(--bar-a);
}

.bar-row:nth-child(4n + 2) .bar-card {
  background: var(--bar-b);
}

.bar-row:nth-child(4n + 3) .bar-card {
  background: var(--bar-c);
}

.bar-row:nth-child(4n + 4) .bar-card {
  background: var(--bar-d);
}

.bar-emoji {
  font-size: 1.28rem;
  line-height: 1;
  margin-bottom: 8px;
}

.bar-value {
  color: #2d2d2d;
  font-size: 0.98rem;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.bar-percent {
  margin-top: 3px;
  color: #6d6d6d;
  font-size: 0.76rem;
  font-weight: 800;
}

.bar-label {
  max-width: 100%;
  margin-top: 8px;
  color: #6d6d6d;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-feed {
  margin-top: 4px;
}

.feed-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.count-chip {
  min-width: 40px;
  justify-content: center;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.filter-clear {
  min-height: 30px;
  max-width: 210px;
  border: 0;
  border-radius: 8px;
  background: #171717;
  color: #fff;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.expense-list {
  display: grid;
  gap: 12px;
}

.expense-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
}

.expense-emoji {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bar-a);
  font-size: 1.35rem;
}

.expense-main strong {
  display: block;
  margin-bottom: 2px;
  color: #222;
  font-size: 1rem;
}

.expense-main span,
.expense-date {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.expense-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.expense-tag {
  border-radius: 7px;
  background: #f0f0f0;
  padding: 4px 8px;
  color: #7a7a7a;
  font-size: 0.72rem;
  font-weight: 800;
}

.expense-amount {
  border-radius: 12px;
  background: #f3f3f3;
  padding: 10px 12px;
  color: #202020;
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.expense-actions {
  grid-column: 2 / 4;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.expense-action {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: #333;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 20, 20, 0.08);
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.expense-action.delete {
  background: #fff;
}

.empty {
  padding: 26px 18px;
  border-radius: 18px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  box-shadow: var(--soft-shadow);
}

.capture-sheet {
  margin-top: 22px;
  border-radius: 22px 22px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--soft-shadow);
  padding: 12px 16px 18px;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: #dedede;
  margin: 0 auto 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #6f6f6f;
  font-size: 0.82rem;
  font-weight: 800;
}

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

textarea {
  min-height: 98px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 101, 93, 0.14);
}

.expense-form,
.confirm-form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.voice-fab {
  border: 0;
  cursor: pointer;
  min-height: 46px;
  font-weight: 900;
}

.primary-btn {
  border-radius: 14px;
  color: #fff;
  background: var(--accent);
  padding: 0 16px;
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.secondary-btn {
  border-radius: 14px;
  color: #333;
  background: #eeeeed;
  padding: 0 16px;
}

.voice-fab {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 18px 32px rgba(239, 68, 68, 0.28);
  font-size: 1.45rem;
}

.voice-icon {
  grid-area: 1 / 1;
}

.cancel-icon {
  display: none;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.voice-fab.recording {
  background: #dc2626;
  box-shadow: 0 18px 38px rgba(220, 38, 38, 0.36);
  animation: recordingPulse 1.25s ease-in-out infinite;
}

.voice-fab.recording .mic-icon {
  display: none;
}

.voice-fab.recording .cancel-icon {
  display: block;
}

@keyframes recordingPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.voice-fab.inline {
  width: 46px;
  height: 46px;
  min-height: 46px;
  font-size: 1.12rem;
}

.voice-fab.floating {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 20px));
  z-index: 30;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.status.error {
  color: #b91c1c;
}

.status.warn {
  color: #b45309;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 900px) {
  .phone-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 430px minmax(360px, 1fr);
    gap: 32px;
    align-items: start;
  }

  .hero-summary,
  .expense-feed {
    grid-column: 1;
  }

  .capture-sheet {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 74px;
    border-radius: 22px;
  }

  .voice-fab.floating {
    display: none;
  }
}

@media (max-width: 899px) {
  .voice-fab.inline {
    display: none;
  }
}

@media (max-width: 390px) {
  .phone-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chart {
    gap: 9px;
  }

  .bar-value {
    font-size: 0.86rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .expense-item {
    grid-template-columns: 50px 1fr;
  }

  .expense-amount {
    grid-column: 2;
    justify-self: start;
  }

  .expense-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
