:root {
  color-scheme: light;
  --bg: #eef3f0;
  --phone: #f9fbf8;
  --text: #17211d;
  --muted: #73817a;
  --line: #e0e8e2;
  --green: #16a06c;
  --green-dark: #0f6b4a;
  --mint: #daf6e8;
  --blue: #3767d6;
  --amber: #f0a929;
  --red: #df5b68;
  --card: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #dff4e8, var(--bg) 42rem); color: var(--text); }
button { border: 0; font: inherit; color: inherit; cursor: pointer; }

.phone {
  position: relative;
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--phone);
  box-shadow: 0 30px 90px rgba(24, 48, 38, 0.16);
  overflow: hidden;
}

.app-header, .home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.home-top {
  padding: 2px 2px 12px;
}

.app-header p, .home-top p, .page-title p, .hero-card p, .action-preview p, .timeline-card p, .app-card p { color: var(--muted); }
.app-header p, .home-top p { margin: 0 0 4px; font-size: 13px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; letter-spacing: -0.05em; }
h2 { margin-bottom: 8px; font-size: 26px; letter-spacing: -0.04em; line-height: 1.1; }
h3 { margin-bottom: 0; font-size: 18px; }
h4 { margin: 6px 0 6px; font-size: 18px; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  font-weight: 800;
}

.screen {
  display: none;
  height: 100vh;
  padding: 20px 18px 94px;
  overflow-y: auto;
}
.screen.active { display: block; animation: enter .18s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.chat-screen { position: relative; padding: 22px 18px 206px; overflow: hidden; }

.hero-card {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 16px;
  margin-top: 4px;
  padding: 20px;
  border-radius: 28px;
  background: linear-gradient(145deg, #173d2c, #0f6b4a);
  color: white;
  box-shadow: 0 20px 45px rgba(15, 107, 74, .24);
}
.hero-card p { color: rgba(255,255,255,.76); line-height: 1.55; margin-bottom: 0; }
.pill { display: inline-flex; margin-bottom: 14px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.15); font-size: 12px; font-weight: 800; }
.score { display: grid; place-content: center; text-align: center; width: 86px; height: 86px; border-radius: 50%; background: rgba(255,255,255,.14); align-self: center; }
.score strong { font-size: 32px; line-height: 1; }
.score span { margin-top: 4px; font-size: 11px; color: rgba(255,255,255,.7); }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 20px; }
.quick-grid button { min-height: 116px; padding: 14px 12px; border-radius: 20px; background: var(--card); box-shadow: 0 8px 24px rgba(22, 35, 29, .06); text-align: left; }
.quick-grid span { display: block; font-size: 15px; font-weight: 900; color: var(--green); }
.quick-grid p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.section-block { margin-top: 16px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.section-title button { background: transparent; color: var(--green); font-weight: 800; }
.action-preview, .timeline-card, .app-card, .receipt-item {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(22, 35, 29, .05);
}
.action-preview { display: grid; grid-template-columns: 1fr 76px; gap: 14px; padding: 18px; align-items: center; }
.action-preview span, .timeline-card span, .app-card span, .receipt-item span { color: var(--green); font-size: 12px; font-weight: 900; }
.action-preview p { margin-bottom: 0; line-height: 1.5; font-size: 14px; }
.primary { padding: 12px 14px; border-radius: 16px; background: var(--green); color: white; font-weight: 900; }

.invoice-summary, .source-list, .settings-list, .recommended-actions { display: grid; gap: 10px; }
.invoice-summary { grid-template-columns: 1fr; }
.invoice-summary.compact { grid-template-columns: repeat(3, 1fr); }
.invoice-summary article, .source-list div, .setting-card, .recommended-actions article {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}
.invoice-summary article { justify-content: space-between; align-items: flex-start; }
.invoice-summary.compact article { display: block; padding: 13px; }
.invoice-summary span { color: var(--green); font-size: 12px; font-weight: 900; }
.invoice-summary strong { display: block; margin: 4px 0; font-size: 22px; }
.invoice-summary p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.recommended-actions article { display: block; align-items: stretch; }
.recommended-actions span { color: var(--green); font-size: 12px; font-weight: 900; }
.recommended-actions h4 { margin-bottom: 6px; }
.recommended-actions p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.recommended-primary { background: linear-gradient(145deg, #ffffff, #eaf8f1) !important; border-color: #c7ead8 !important; }
.source-list strong { display: block; }
.source-list div { justify-content: space-between; }
.source-list span { color: var(--muted); font-size: 13px; text-align: right; }

.page-title { margin: 4px 0 16px; }
.page-title p { margin-bottom: 0; line-height: 1.45; }
.timeline { display: grid; gap: 12px; }
.timeline-card { display: grid; grid-template-columns: 58px 1fr; gap: 14px; padding: 16px; }
.timeline-card time { display: grid; place-content: center; height: 52px; border-radius: 16px; background: var(--mint); color: var(--green-dark); font-weight: 900; }
.timeline-card p { margin-bottom: 0; font-size: 14px; line-height: 1.5; }
.timeline-card.active { border-color: var(--green); box-shadow: 0 0 0 4px rgba(22,160,108,.08); }
.confidence-line { margin-top: 10px; color: var(--green-dark); font-size: 13px; font-weight: 900; }

.expense-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.expense-summary div { padding: 18px; border-radius: 22px; background: var(--text); color: white; }
.expense-summary span { display: block; color: rgba(255,255,255,.62); font-size: 12px; }
.expense-summary strong { display: block; margin-top: 6px; font-size: 24px; }
.receipt-list { display: grid; gap: 10px; }
.receipt-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 15px; }
.receipt-item p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.receipt-item strong:last-child { color: var(--green); }

.card-stack { display: grid; gap: 12px; }
.app-card { padding: 18px; }
.app-card p { line-height: 1.55; margin-bottom: 16px; }
.app-card .card-actions { display: flex; gap: 8px; }
.app-card button { flex: 1; padding: 12px; border-radius: 15px; background: #eef4f0; font-weight: 800; }
.app-card button.accept { background: var(--green); color: white; }

.chat-box {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: calc(100vh - 312px);
  overflow-y: auto;
  padding-bottom: 14px;
}
.bubble { max-width: 88%; padding: 13px 15px; border-radius: 20px; line-height: 1.55; font-size: 15px; }
.bubble.ai { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 8px; }
.bubble.user { justify-self: end; background: var(--green); color: white; border-bottom-right-radius: 8px; }
.chat-composer {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 84px;
}
.chat-input {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(22,35,29,.08);
}
.chat-input input {
  min-width: 0;
  border: 0;
  border-radius: 18px;
  padding: 12px 4px 12px 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}
.chat-input button { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--green); color: white; font-weight: 900; font-size: 20px; }
.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 0; margin: 0; scrollbar-width: none; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { flex: 0 0 auto; padding: 10px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; }

.setting-card { justify-content: space-between; }
.setting-card span { display: block; color: var(--green); font-size: 12px; font-weight: 900; margin-bottom: 4px; }
.setting-card strong { display: block; font-size: 15px; }
.setting-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.setting-card button { flex: 0 0 auto; padding: 10px 13px; border-radius: 14px; background: #eef4f0; color: var(--green-dark); font-weight: 900; }
.primary-setting { align-items: flex-start; background: linear-gradient(145deg, #ffffff, #eaf8f1); border-color: #c7ead8; }
.primary-setting button { background: var(--green); color: white; }

.bottom-nav {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 15px 40px rgba(22,35,29,.14);
  backdrop-filter: blur(16px);
}
.bottom-nav button { padding: 10px 4px; border-radius: 16px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.bottom-nav button.active { background: var(--text); color: white; }

.toast {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 92px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--text);
  color: white;
  box-shadow: 0 16px 40px rgba(22,35,29,.2);
  animation: toast .24s ease;
}
@keyframes toast { from { opacity: 0; transform: translateY(12px); } }

@media (min-width: 760px) {
  body { padding: 28px 0; }
  .phone { min-height: calc(100vh - 56px); border-radius: 38px; }
  .screen { height: calc(100vh - 56px); }
}
