:root {
  --green: #1FA37A;
  --green-2: #2A9D8F;
  --green-soft: #DDF4EC;
  --ink: #264653;
  --muted: #6E7D7A;
  --cream: #F7F4EE;
  --card: #FFFFFF;
  --line: rgba(38, 70, 83, .10);
  --yellow: #F4B942;
  --red: #E76F51;
  --shadow: 0 14px 38px rgba(38, 70, 83, .10);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; min-height: 100%; background: var(--cream); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
.app-shell { max-width: 520px; height: 100dvh; min-height: 100vh; margin: 0 auto; background: linear-gradient(180deg, #FBF8F1 0%, var(--cream) 58%, #EFECE5 100%); position: relative; padding-bottom: calc(74px + env(safe-area-inset-bottom)); overflow: hidden; }
main { height: 100%; overflow: hidden; }
.view { display: none; height: calc(100dvh - 74px - env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(26px + env(safe-area-inset-top)) 14px 12px; animation: show .16s ease; }
.view.active { display: block; }
@keyframes show { from { opacity: .55; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.chat-view { height: calc(100dvh - 74px - env(safe-area-inset-bottom)); min-height: 0; overflow: hidden; padding-bottom: 82px; display: none; flex-direction: column; }
.chat-view.active { display: flex; }
.chat-header, .page-header { display: flex; align-items: center; gap: 12px; padding: 10px 2px 12px; }
.page-header { display: block; padding-top: 18px; }
.avatar { width: 44px; height: 44px; border-radius: 16px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 20px; box-shadow: 0 8px 18px rgba(31,163,122,.25); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 23px; line-height: 1; }
h2 { font-size: 25px; line-height: 1.05; margin-bottom: 5px; }
p { color: var(--muted); line-height: 1.35; }
.chat-header p, .page-header p { font-size: 13px; }
.small-pill { margin-left: auto; border: 0; background: var(--card); color: var(--green); padding: 8px 12px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow); }
.daily-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow); margin-bottom: 10px; }
.daily-card b { display: block; font-size: 15px; margin-bottom: 3px; }
.daily-card span { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.traffic-dot { width: 16px; height: 16px; border-radius: 999px; margin-top: 2px; flex: 0 0 auto; box-shadow: 0 0 0 5px rgba(31,163,122,.12); }
.traffic-dot.green { background: var(--green); }
.traffic-dot.yellow { background: var(--yellow); box-shadow: 0 0 0 5px rgba(244,185,66,.17); }
.traffic-dot.red { background: var(--red); box-shadow: 0 0 0 5px rgba(231,111,81,.16); }
.quick-actions { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions button { flex: 0 0 auto; border: 1px solid var(--line); background: rgba(255,255,255,.82); color: var(--ink); border-radius: 999px; padding: 9px 12px; font-weight: 800; font-size: 12px; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px 0 10px; min-height: 280px; }
.msg { display: flex; margin: 10px 0; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 86%; border-radius: 22px; padding: 12px 13px; font-size: 15px; line-height: 1.35; box-shadow: 0 8px 22px rgba(38,70,83,.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.marc .bubble { background: var(--card); color: var(--ink); border-top-left-radius: 8px; border: 1px solid var(--line); }
.msg.user .bubble { background: var(--green-soft); color: #183E34; border-top-right-radius: 8px; }
.card-bubble { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; box-shadow: var(--shadow); max-width: 92%; }
.movement-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.status-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 900; background: var(--green-soft); color: #11634D; }
.status-tag.pending { background: #FFF2CC; color: #856215; }
.status-tag.reversed { background: #ECEAE5; color: #7A7468; }
.movement-title { display: block; font-size: 16px; font-weight: 900; margin-bottom: 3px; }
.movement-meta, .movement-note { color: var(--muted); font-size: 12px; line-height: 1.3; }
.amount { font-size: 20px; font-weight: 950; white-space: nowrap; }
.amount.expense { color: #C7533F; }
.amount.income { color: var(--green); }
.card-actions { display: flex; gap: 8px; margin-top: 12px; }
.card-actions button, .primary-btn, .secondary-btn { border: 0; border-radius: 15px; padding: 12px 14px; font-weight: 900; font-size: 14px; }
.card-actions button { flex: 1; }
.primary-btn { width: 100%; background: var(--green); color: #fff; margin-top: 12px; }
.secondary-btn { width: 100%; background: #EAE7DE; color: var(--ink); margin-top: 10px; }
.edit-area { width: 100%; margin-top: 12px; border: 1px solid var(--line); background: #FAF8F1; color: var(--ink); border-radius: 16px; padding: 12px; font-size: 15px; resize: vertical; }
.recording-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(132px + env(safe-area-inset-bottom)); width: min(492px, calc(100% - 28px)); background: var(--card); border: 1px solid rgba(231,111,81,.2); border-radius: 24px; padding: 8px; display: flex; align-items: center; gap: 10px; box-shadow: 0 18px 44px rgba(38,70,83,.18); z-index: 25; transition: transform .15s ease, opacity .15s ease; }
.recording-bar.cancel-ready { border-color: rgba(231,111,81,.55); background: #FFF0EB; }
.recording-bar.locked { border-color: rgba(31,163,122,.35); background: #F2FCF8; }
.recording-bar b { display: block; font-size: 14px; }
.recording-copy { flex: 1; min-width: 0; }
.recording-bar span { display: block; color: var(--muted); font-size: 12px; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(231,111,81,.55); animation: pulse 1.1s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(231,111,81,0); } 100% { box-shadow: 0 0 0 0 rgba(231,111,81,0); } }
.cancel-audio-btn, .send-recording-btn { border: 0; min-width: 82px; height: 42px; border-radius: 16px; display: grid; place-items: center; font-size: 14px; font-weight: 900; flex: 0 0 auto; padding: 0 13px; }
.cancel-audio-btn { background: #FCE8E2; color: var(--red); }
.send-recording-btn { background: var(--green); color: #fff; font-weight: 900; min-width: 52px; }
.composer-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(74px + env(safe-area-inset-bottom)); width: min(492px, calc(100% - 28px)); display: flex; align-items: flex-end; gap: 8px; background: rgba(247,244,238,.96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 7px; border-radius: 24px; border: 1px solid rgba(255,255,255,.75); box-shadow: 0 16px 42px rgba(38,70,83,.16); z-index: 20; }
.composer-wrap.is-recording #chatInput { color: var(--red); font-weight: 800; }
.attach-btn, .send-btn, .mic-btn { border: 0; width: 42px; height: 42px; border-radius: 16px; display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.mic-btn { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.attach-btn { background: #EAE7DE; color: var(--ink); }
.send-btn, .mic-btn { background: var(--green); color: #fff; font-weight: 900; }
.mic-btn.recording { background: var(--red); transform: scale(1.04); box-shadow: 0 0 0 8px rgba(231,111,81,.12); }
#chatInput { flex: 1; min-height: 42px; max-height: 112px; border: 0; outline: 0; background: var(--card); border-radius: 17px; padding: 12px 13px; font-size: 15px; color: var(--ink); resize: none; box-shadow: inset 0 0 0 1px var(--line); -webkit-appearance: none; }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(520px, 100%); display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border-top: 1px solid var(--line); z-index: 30; }
.nav-btn { border: 0; background: transparent; color: #7C8784; border-radius: 16px; padding: 7px 2px 6px; font-size: 10.5px; font-weight: 850; }
.nav-btn span { display: block; font-size: 18px; margin-bottom: 2px; }
.nav-btn.active { background: var(--green-soft); color: #13654E; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.filter { border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 9px 12px; border-radius: 999px; font-weight: 850; }
.filter.active { background: var(--green); color: #fff; border-color: var(--green); }
.bank-list { display: grid; gap: 10px; }
.empty-state, .soft-note, .advice-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px; color: var(--muted); box-shadow: var(--shadow); }
.bank-item { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; box-shadow: var(--shadow); }
.bank-item.reversed { opacity: .62; background: #F1EFE9; }
.bank-item b { display: block; margin-bottom: 3px; }
.bank-item small { display: block; color: var(--muted); line-height: 1.35; }
.money-hero { background: linear-gradient(145deg, var(--green), var(--green-2)); color: #fff; border-radius: 28px; padding: 22px; box-shadow: 0 18px 40px rgba(31,163,122,.23); margin: 12px 0; }
.money-hero span { font-weight: 800; opacity: .92; }
.money-hero strong { display: block; font-size: 42px; line-height: 1.05; margin: 8px 0; }
.money-hero p { color: rgba(255,255,255,.88); }
.simple-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.simple-card, .profile-card, .payment-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 15px; box-shadow: var(--shadow); }
.simple-card span { color: var(--muted); font-size: 12px; font-weight: 800; }
.simple-card b { display: block; font-size: 21px; margin: 6px 0 4px; }
.simple-card small { color: var(--muted); font-size: 11px; line-height: 1.25; }
.advice-card { margin-top: 12px; color: var(--ink); }
.payment-card { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin: 10px 0; }
.payment-card span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.payment-card strong { white-space: nowrap; color: var(--green); }
.payment-card.important { border-color: rgba(244,185,66,.35); background: #FFF9EA; }
.profile-card { margin: 12px 0; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 850; margin: 12px 0 6px; }
select, input { width: 100%; border: 1px solid var(--line); background: #FAF8F1; color: var(--ink); border-radius: 16px; padding: 13px; font-size: 15px; }
.dev-card summary { cursor: pointer; font-weight: 900; }
.dev-card small { color: var(--muted); display: block; margin-top: 10px; line-height: 1.35; }
@media (max-width: 380px) { .simple-grid { grid-template-columns: 1fr; } .composer-wrap { width: calc(100% - 16px); } .recording-bar { width: calc(100% - 16px); } .nav-btn { font-size: 9.5px; } }

.lock-target { position: absolute; right: 6px; bottom: 61px; display: grid; place-items: center; gap: 4px; pointer-events: none; animation: lockPop .14s ease; }
.lock-icon { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; background: var(--card); border: 1px solid rgba(38,70,83,.12); box-shadow: 0 14px 30px rgba(38,70,83,.18); font-size: 20px; }
.lock-target span { font-size: 10px; font-weight: 900; color: var(--muted); background: rgba(255,255,255,.86); padding: 3px 7px; border-radius: 999px; }
.lock-target.ready .lock-icon { background: var(--green); color: white; transform: scale(1.08); }
@keyframes lockPop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
button, textarea, input, select { font-family: inherit; }
button { touch-action: manipulation; }
@supports (-webkit-touch-callout: none) { .app-shell { min-height: -webkit-fill-available; } }

@media (max-width: 380px) { .cancel-audio-btn { min-width: 74px; padding: 0 10px; } .recording-copy span { font-size: 11px; } }

.auto-save-note {
  margin-top: 14px;
  background: var(--green-soft);
  color: #13654E;
  border-radius: 16px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 850;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(148px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(38,70,83,.94);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(38,70,83,.18);
  pointer-events: none;
}

.version-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.mic-btn:active { transform: scale(.98); }

.inline-actions { display:flex; gap:10px; align-items:center; }
.inline-actions .secondary-btn { flex:1; }
.ghost-btn { border:none; background:transparent; color:var(--muted); font-weight:800; padding:12px 10px; border-radius:16px; }
.ghost-btn:active { background:rgba(38,70,83,.08); }


.status-tag.test {
  background: #EAF3FF;
  color: #27628F;
}
.amount.neutral {
  color: var(--ink);
}
.exchange-amounts {
  display: grid;
  gap: 2px;
  text-align: right;
  white-space: nowrap;
}
.exchange-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.bank-item.test-movement {
  background: rgba(255,255,255,.72);
}


.setup-card h3 { margin: 0 0 6px; color: var(--ink); font-size: 20px; }
.setup-card p { margin: 0 0 14px; color: var(--muted); }
.setup-summary { background: #f7f4ee; border: 1px solid rgba(38,70,83,.08); border-radius: 16px; padding: 12px 14px; color: var(--ink); margin-bottom: 12px; line-height: 1.45; }
.setup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setup-actions .primary-btn, .setup-actions .ghost-btn { grid-column: 1 / -1; }
@media (max-width: 420px) { .setup-actions { grid-template-columns: 1fr; } }


.setup-feedback {
  margin: 0 0 12px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 800;
}
.setup-feedback.info { background: #EEF7F4; color: #176A53; }
.setup-feedback.success { background: #E4F6EE; color: #14634C; }
.setup-feedback.warning { background: #FFF4D8; color: #7A5912; }
.setup-feedback.error { background: #FCE8E4; color: #9B3E2E; }
.setup-actions button:disabled { opacity: .62; }
