:root {
  --bg: #f4f3ef;
  --surface: #fffefa;
  --surface-2: #f7f7f2;
  --ink: #142820;
  --ink-2: #2b3d34;
  --muted: #7a827c;
  --line: #e9e9e3;
  --green: #266b47;
  --green-dark: #18392b;
  --green-light: #eaf4eb;
  --red: #d53d3c;
  --red-soft: #fff0ed;
  --amber: #cb782c;
  --amber-soft: #fff5e8;
  --shadow: 0 10px 34px rgba(28, 40, 31, .035), 0 1px 3px rgba(34, 44, 32, .035);
  --radius: 23px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Arial", sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(38,107,71,.24); outline-offset: 2px; }
a { color: var(--green); }
.app-shell { margin: 0 auto; max-width: 510px; min-height: 100dvh; background: var(--bg); position: relative; }
.page { padding: max(24px, env(safe-area-inset-top)) 16px calc(174px + env(safe-area-inset-bottom)); }
.header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.eyebrow { color: var(--muted); text-transform: uppercase; font-size: 10px; font-weight: 750; letter-spacing: .11em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.055em; }
h2 { font-size: 17px; letter-spacing: -.025em; }
.header-subtitle { color: var(--muted); margin-top: 4px; font-size: 12px; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--green-dark); font-size: 21px; display: grid; place-items: center; }
.icon-btn img { width: 20px; height: 20px; }
.card { border: 1px solid rgba(232,234,227,.68); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.currency-and-forecast { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-bottom: 14px; }
.rates-card { padding: 16px 10px 11px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.currency-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.currency-cell { border-right: 1px solid var(--line); min-width: 0; padding: 2px 2px; }
.currency-cell:last-child { border: 0; }
.currency-symbol { color: #628774; font-size: 22px; line-height: 1; font-weight: 500; }
.currency-number { display: block; color: var(--ink); margin-top: 9px; font-size: clamp(11px, 3.3vw, 14px); font-weight: 550; white-space: nowrap; }
.micro { color: #9aa49d; font-size: 10px; line-height: 1.4; }
.rates-note { text-align: center; margin-top: 10px; }
.forecast-card { min-width: 0; padding: 13px 13px 8px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; text-align: left; width: 100%; }
.forecast-card .micro { font-size: 10px; }
.forecast-label { color: var(--muted); font-size: 11px; }
.forecast-status { color: var(--green); font-size: 13px; font-weight: 680; margin-top: 3px; }
.forecast-status.risk { color: var(--red); }
.chart { width: 100%; height: 60px; display: block; margin: 3px 0 -4px; overflow: visible; }
.chart-large { height: 160px; margin: 15px 0; }
.primary-card { padding: 22px 18px 20px; margin-bottom: 12px; }
.big-label { font-size: 11px; font-weight: 680; letter-spacing: .045em; text-transform: uppercase; color: var(--muted); }
.primary-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.07fr); gap: 13px; align-items: center; margin: 11px 0 18px; }
.today-number { font-size: clamp(49px, 14vw, 70px); line-height: 1; font-weight: 730; letter-spacing: -.07em; white-space: nowrap; }
.today-number span { font-size: .66em; letter-spacing: -.08em; }
.today-number.risk { color: var(--red); }
.payment-peek { border-left: 1px solid #e1e7e0; padding-left: 12px; min-width: 0; }
.payment-peek-head { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left; border: none; background: transparent; padding: 0; margin-bottom: 8px; color: var(--ink-2); font-size: 12px; font-weight: 650; }
.payment-peek-head .arrow { color: var(--muted); font-size: 17px; }
.payment-peek-line { display: flex; min-width: 0; align-items: center; gap: 5px; font-size: 10px; margin: 7px 0; white-space: nowrap; }
.payment-peek-line .dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; background: #9da9a2; }
.payment-peek-line .name { overflow: hidden; text-overflow: ellipsis; }
.payment-peek-line.urgent { color: var(--red); font-weight: 650; }
.payment-peek-line.urgent .dot { background: var(--red); box-shadow: 0 0 0 3px #fce6e3; }
.payment-peek-line.soon { color: var(--amber); }
.payment-peek-line.soon .dot { background: var(--amber); }
.pale-caption { color: var(--muted); }
.progress-track { background: #e8ece7; height: 9px; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #84ac90, #4e8e66); border-radius: inherit; transition: width 250ms ease; }
.day-subtitle { color: var(--muted); margin-top: 12px; font-size: 14px; }
.day-subtitle strong { color: var(--ink); }
.summary-stack { display: grid; gap: 10px; margin: 12px 0; }
.summary-card { width: 100%; padding: 16px 18px; display: flex; align-items: center; gap: 13px; text-align: left; }
.summary-icon, .assistant-icon { flex: 0 0 auto; width: 49px; height: 49px; border-radius: 17px; background: #f0f4ee; color: #476b54; display: grid; place-items: center; font-size: 25px; }
.summary-label { color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.summary-value { font-size: 27px; font-weight: 690; letter-spacing: -.045em; line-height: 1.1; }
.chevron { margin-left: auto; color: #909a90; font-size: 23px; }
.assistant-card { padding: 15px 14px 13px; margin-top: 12px; }
.assistant-heading { display: flex; align-items: center; gap: 11px; }
.assistant-icon { width: 42px; height: 42px; border-radius: 14px; font-size: 23px; color: #177742; }
.assistant-title { font-size: 16px; font-weight: 710; letter-spacing: -.025em; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #60a778; margin-left: 6px; }
.assistant-subtitle { color: var(--muted); font-size: 11px; margin-top: 4px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.chip { min-width: 0; min-height: 36px; background: #f9faf7; border: 1px solid #e7ece6; border-radius: 999px; color: #53685d; padding: 6px 8px; text-align: center; font-size: 10px; }
.chip:active { background: var(--green-light); }
.assistant-input-row { display: flex; align-items: center; gap: 7px; background: #f3f6f0; border-radius: 999px; padding: 6px 7px 6px 15px; margin-top: 12px; }
.assistant-input-row input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; color: var(--ink); font-size: 13px; }
.assistant-input-row input::placeholder { color: #a3afa6; }
.send-btn { border: 0; flex-shrink: 0; border-radius: 999px; width: 32px; height: 32px; background: #467d5b; color: #fff; font-size: 18px; }
.assistant-response { border-radius: 15px; background: var(--green-light); font-size: 12px; line-height: 1.5; color: #355242; padding: 11px 12px; margin-top: 10px; white-space: pre-line; }
.assistant-response.error { background: #fff1ef; color: #8c3b37; }
.assistant-actions { display: flex; gap: 7px; margin-top: 9px; }
.assistant-actions button { flex: 1; padding: 10px; font-weight: 650; border-radius: 11px; border: 1px solid #e4e8e1; }
.assistant-actions .confirm { background: var(--green-dark); color: white; border-color: var(--green-dark); }
.assistant-actions .cancel { background: white; color: var(--ink-2); }
.dock { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 510px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 20; background: linear-gradient(180deg, transparent, rgba(244,243,239,.98) 17%, var(--bg)); }
.action-bar { background: var(--green-dark); display: flex; height: 53px; width: 100%; border-radius: 18px; overflow: hidden; box-shadow: 0 6px 20px rgba(24,57,43,.1); }
.action-bar button { border: 0; flex: 1; font-size: 15px; font-weight: 590; color: #fff; background: transparent; }
.action-bar button:first-child { border-right: 1px solid rgba(255,255,255,.22); }
.action-bar button span { font-size: 22px; vertical-align: -1px; margin-right: 10px; }
.nav { height: 45px; display: flex; justify-content: space-around; align-items: center; gap: 6px; margin-top: 5px; }
.nav button { border: 0; background: transparent; min-width: 0; display: flex; align-items: center; flex-direction: column; gap: 1px; padding: 4px 6px; color: #93a096; flex: 1; }
.nav button.active { color: var(--green); }
.nav .nav-icon { font-size: 19px; }
.nav .nav-text { font-size: 10px; }
.notice { padding: 10px 13px; border-radius: 14px; font-size: 12px; background: #eaf2e8; color: #496951; margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notice button { background: transparent; border: 0; color: var(--green-dark); text-decoration: underline; font-size: 11px; flex-shrink: 0; }
.page-title { margin-top: 9px; margin-bottom: 16px; }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 5px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 17px 1px 11px; }
.soft-btn { border: 1px solid #e2e7df; background: var(--surface); color: #3f624d; border-radius: 13px; padding: 9px 12px; font-size: 12px; font-weight: 650; }
.entry { display: flex; align-items: center; gap: 11px; padding: 13px 12px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: #f1f3ef; color: var(--green); font-size: 17px; flex-shrink: 0; }
.entry-icon.out { background: #f9f1ef; color: #b46d5f; }
.entry-main { min-width: 0; flex: 1; }
.entry-title { font-size: 13px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.entry-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.entry-amount { font-size: 14px; font-weight: 700; white-space: nowrap; }
.entry-amount.in { color: var(--green); }
.entry-amount.out { color: #a74f48; }
.entry-button { border: 0; background: none; padding: 7px; color: #83918a; font-size: 18px; }
.empty { padding: 32px 17px; text-align: center; color: var(--muted); font-size: 13px; }
.alert-tag { display: inline-flex; background: var(--red-soft); color: var(--red); border-radius: 7px; padding: 3px 6px; font-weight: 650; font-size: 10px; }
.alert-tag.soon { background: var(--amber-soft); color: var(--amber); }
.alert-tag.safe { background: var(--green-light); color: var(--green); }
.payment-list .entry { align-items: start; }
.payment-list .entry-actions { display: flex; flex-direction: column; gap: 6px; align-items: end; }
.payment-list .entry-actions button { font-size: 11px; }
.payment-paid .entry-title { text-decoration: line-through; opacity: .65; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-card { padding: 14px 15px; }
.stat-card .stat-label { color: var(--muted); font-size: 11px; }
.stat-card .stat-number { font-size: 20px; margin-top: 7px; font-weight: 720; letter-spacing: -.045em; }
.chart-box { padding: 16px; margin: 14px 0; }
.big-explanation { line-height: 1.55; color: #627369; font-size: 12px; }
.setting-card { padding: 16px; margin: 12px 0; }
.setting-card h2 { margin-bottom: 15px; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field label { font-size: 12px; font-weight: 600; color: #546359; }
.field input, .field select, .field textarea { border: 1px solid #dde4db; border-radius: 13px; background: #fdfdfa; padding: 12px; width: 100%; font-size: 16px; color: var(--ink); }
.field textarea { resize: vertical; min-height: 64px; }
.field-hint { font-size: 11px; line-height: 1.5; color: var(--muted); }
.primary-btn { background: var(--green-dark); color: #fff; border: 1px solid var(--green-dark); padding: 12px 16px; border-radius: 14px; font-weight: 660; }
.ghost-btn { background: #fff; color: var(--green-dark); border: 1px solid #dfe6dd; padding: 11px 15px; border-radius: 14px; font-weight: 650; }
.danger-btn { background: #fff6f3; color: #b53f3a; border: 1px solid #f6dcd8; padding: 11px 15px; border-radius: 14px; font-weight: 660; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.btn-row button { flex: 1 1 auto; }
#modal-root:empty { display: none; }
.modal-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(13,31,22,.45); display: flex; align-items: end; justify-content: center; padding: 10px 10px max(10px,env(safe-area-inset-bottom)); }
.modal { background: #fffefa; border-radius: 25px; max-width: 490px; width: 100%; padding: 21px; max-height: 88dvh; overflow: auto; box-shadow: 0 19px 60px rgba(7,21,12,.16); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-close { border: none; background: #f1f2ee; border-radius: 50%; width: 34px; height: 34px; color: #607465; font-size: 22px; }
.modal .subline { font-size: 12px; color: var(--muted); margin-top: 7px; }
.modal .btn-row { margin-top: 18px; }
.modal .btn-row button { min-height: 44px; }
#toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(156px + env(safe-area-inset-bottom)); z-index: 60; width: min(470px,90vw); pointer-events: none; }
.toast { background: #213f2d; color: white; padding: 13px 16px; font-size: 12px; border-radius: 14px; box-shadow: 0 12px 30px rgba(10,30,18,.2); margin-top: 8px; }
.toast.error { background: #a54840; }
.pill { border-radius: 999px; padding: 5px 9px; font-size: 11px; background: #eff4ec; color: #467254; display: inline-flex; }
.small-divider { height: 1px; background: var(--line); margin: 14px 0; }
@media(max-width: 360px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .currency-and-forecast { gap: 7px; }
  .currency-symbol { font-size: 18px; }
  .currency-number { font-size: 10px; }
  .rates-card { padding: 12px 5px 9px; }
  .forecast-card { padding: 12px 8px 7px; }
  .primary-card { padding: 20px 12px 18px; }
  .primary-columns { gap: 7px; }
  .today-number { font-size: 46px; }
  .payment-peek { padding-left: 8px; }
  .payment-peek-line { font-size: 9px; }
  .chip { font-size: 9px; }
}
@media(min-width: 511px) {
  .page { padding-left: 22px; padding-right: 22px; }
  .today-number { font-size: 71px; }
  .payment-peek-line { font-size: 12px; }
}
@media(prefers-reduced-motion:reduce) { .progress-fill { transition: none; } }
