/* App Finance 1.0 — styles */

:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #EEF2F8;
  --hover: #F7F9FB;
  --line: #E2E6ED;
  --hair: #EDF0F4;
  --ink: #122543;
  --ink-2: #5A6478;
  --ink-3: #8A93A5;
  --track: #E6EAF0;
  --seg-bg: #E7EBF1;
  --seg-ink: #4A5468;
  --seg-on: #FFFFFF;
  --hero: #122543;
  --hero-ink: #FFFFFF;
  --hero-ink-2: #B7C1D3;
  --hero-track: #2A4068;
  --hero-btn: #1F3558;
  --hero-pos: #6FD9AE;
  --hero-warn: #FFB27A;
  --pos: #0B7A55;
  --pos-bg: #E3F3EC;
  --pos-ink: #FFFFFF;
  --warn: #A8500C;
  --warn-bg: #FBEADB;
  --warn-bar: #C9661A;
  --danger: #B42318;
  --danger-ink: #FFFFFF;
  --primary: #122543;
  --primary-ink: #FFFFFF;
  --in-bar: #7D90B5;
  --goal-bar: #0B7A55;
  --focus: #2F5BB7;
  --chip-line: #DCE1E8;
  --backdrop: rgba(11, 24, 48, .55);
  --toast: #122543;
  --toast-ink: #FFFFFF;
  --shadow: rgba(18, 37, 67, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1426; --surface: #121E35; --surface-2: #1A2843; --hover: #16243F; --line: #22314F; --hair: #1C2A45;
    --ink: #E8EDF5; --ink-2: #A3AEC2; --ink-3: #7584A0; --track: #22314F; --seg-bg: #1A2843; --seg-ink: #A3AEC2; --seg-on: #2C3E63;
    --hero: #182B4F; --hero-track: #2C4472; --hero-btn: #24395F;
    --pos: #5FD3A2; --pos-bg: #133A31; --pos-ink: #0B1426; --warn: #F2A06A; --warn-bg: #3D2615; --warn-bar: #E07B2A;
    --danger: #FF8A80; --danger-ink: #2A0906; --primary: #DCE6F7; --primary-ink: #0B1426; --in-bar: #6F86B3; --goal-bar: #5FD3A2;
    --focus: #8FB2FF; --chip-line: #2C3E63; --backdrop: rgba(0, 0, 0, .6); --toast: #E8EDF5; --toast-ink: #0B1426; --shadow: rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1426; --surface: #121E35; --surface-2: #1A2843; --hover: #16243F; --line: #22314F; --hair: #1C2A45;
  --ink: #E8EDF5; --ink-2: #A3AEC2; --ink-3: #7584A0; --track: #22314F; --seg-bg: #1A2843; --seg-ink: #A3AEC2; --seg-on: #2C3E63;
  --hero: #182B4F; --hero-track: #2C4472; --hero-btn: #24395F;
  --pos: #5FD3A2; --pos-bg: #133A31; --pos-ink: #0B1426; --warn: #F2A06A; --warn-bg: #3D2615; --warn-bar: #E07B2A;
  --danger: #FF8A80; --danger-ink: #2A0906; --primary: #DCE6F7; --primary-ink: #0B1426; --in-bar: #6F86B3; --goal-bar: #5FD3A2;
  --focus: #8FB2FF; --chip-line: #2C3E63; --backdrop: rgba(0, 0, 0, .6); --toast: #E8EDF5; --toast-ink: #0B1426; --shadow: rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.4; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1:focus, h2:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pos { color: var(--pos); }
.warn { color: var(--warn); }
.strong { font-weight: 500; }

.shell { max-width: 560px; margin: 0 auto; padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
.shell.bare { padding-bottom: 0; }
.stack-6 { display: flex; flex-direction: column; gap: 6px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-20 { display: flex; flex-direction: column; gap: 20px; }

/* ---------- header ---------- */
.top { padding: calc(env(safe-area-inset-top) + 24px) 20px 0; display: flex; flex-direction: column; gap: 4px; }
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 2px; height: 44px; margin: -8px 0 0 -6px; padding-right: 8px;
  font-size: 16px; font-weight: 500; text-decoration: none; color: var(--ink);
}
.date { margin: 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-2); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.title { margin: 0; font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; }
.purpose { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-2); }
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none;
}
.content { padding: 20px 20px 32px; display: flex; flex-direction: column; gap: 28px; }
.content.gap-20 { gap: 20px; }
.content.gap-24 { gap: 24px; }

/* ---------- navy answer block ---------- */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.hero .label { margin: 0; font-size: 15px; line-height: 20px; color: var(--hero-ink-2); }
.hero .sub { margin: 0; font-size: 15px; line-height: 22px; color: var(--hero-ink-2); }
.hero .note { margin: 0; font-size: 13px; line-height: 18px; color: var(--hero-ink-2); }
.hero .pos { color: var(--hero-pos); }
.hero .warn { color: var(--hero-warn); }
.big { margin: 0; display: flex; align-items: flex-start; font-weight: 600; letter-spacing: -0.03em; font-stretch: 88%; }
.big .num { font-size: 60px; line-height: 60px; }
.big .cents { font-size: 28px; line-height: 28px; margin: 7px 0 0 2px; }
.big.small .num { font-size: 48px; line-height: 50px; }
.big.small .cents { font-size: 24px; line-height: 24px; margin-top: 6px; }
.meter-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 18px; color: var(--hero-ink-2); }
.meter { position: relative; height: 12px; }
.meter .track { position: absolute; inset: 0; border-radius: 6px; background: var(--hero-track); }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--hero-ink); }
.meter .fill.over { background: var(--hero-warn); }
.meter .tick { position: absolute; top: -5px; width: 2px; height: 22px; margin-left: -1px; border-radius: 1px; background: var(--hero-pos); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .k { font-size: 13px; line-height: 18px; color: var(--hero-ink-2); }
.stat .v { font-size: 17px; line-height: 22px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats.lg .v { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.02em; }
.hero-btn {
  align-self: flex-start; display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--hero-ink); color: #122543; font-size: 15px; font-weight: 600; text-decoration: none;
}
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-month { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.hero-nav { display: flex; gap: 8px; }
.round-btn {
  width: 44px; height: 44px; border-radius: 22px; background: var(--hero-btn); color: var(--hero-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.round-btn:disabled { opacity: .35; cursor: default; }

/* ---------- attention rows and cards ---------- */
.alert, .card-link {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; text-decoration: none; color: var(--ink); text-align: left;
}
.card-link { padding: 16px; }
.tipcard {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 8px 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px;
}
.tipcard .link { flex: none; margin-top: -6px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.t1.wrap, .t2.wrap { white-space: normal; }
.worth { font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- sections and lists ---------- */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; font-size: 19px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.aside { font-size: 13px; line-height: 18px; color: var(--ink-2); text-align: right; }
.aside-link { display: inline-block; padding: 12px 0; margin: -12px 0; font-size: 15px; line-height: 20px; font-weight: 600; text-decoration: none; color: var(--ink); }
.section-note { margin: -4px 0 0; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.group > * + * { position: relative; }
.group > * + *::before { content: ''; position: absolute; top: 0; left: 70px; right: 0; height: 1px; background: var(--hair); }
.group > .limit + *::before, .group > * + .limit::before { left: 16px; }
.row {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px;
  background: none; border: 0; text-align: left; color: var(--ink); text-decoration: none;
}
.row.sub { min-height: 56px; padding: 10px 16px 10px 70px; }
.row.setting { cursor: default; }
.tile {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; line-height: 20px; font-weight: 600;
}
.tile.round { border-radius: 20px; }
.tile.pos { background: var(--pos-bg); color: var(--pos); }
.tile.warn { background: var(--warn-bg); color: var(--warn); }
.tile.neutral { color: var(--ink-2); }
.tile.add { background: transparent; border: 1.5px dashed var(--chip-line); color: var(--ink-2); }
.date-tile { flex-direction: column; }
.date-tile .m { font-size: 11px; line-height: 13px; font-weight: 600; color: var(--ink-2); }
.date-tile .d { font-size: 16px; line-height: 18px; font-weight: 600; }
.date-tile.muted .d { color: var(--ink-2); }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.t1 { font-size: 15px; line-height: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t1.strong { font-weight: 600; }
.t1.light { font-weight: 400; }
.t2 { font-size: 13px; line-height: 18px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2.ink { color: var(--ink); }
.t2.pos { color: var(--pos); }
.t2.warn { color: var(--warn); }
.end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; max-width: 46%; }
.amt { flex: none; font-size: 15px; line-height: 20px; font-weight: 500; white-space: nowrap; }
.amt.pos { color: var(--pos); font-weight: 600; }
.amt.muted { color: var(--ink-2); }
.amt.light { font-weight: 400; }
.chev { flex: none; display: inline-flex; color: var(--ink-3); }
.row-add .t1 { font-weight: 600; }
.row.danger .t1 { color: var(--danger); }
.row.danger .tile { background: transparent; border: 1px solid var(--line); color: var(--danger); }
.detail { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px 70px; }
.detail .lbar { height: 6px; }
.empty { padding: 18px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.empty p { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-2); }
.result-note { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.day { display: flex; flex-direction: column; gap: 8px; }
.dayhead { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink-2); }

/* limits and goals */
.limit {
  position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px 16px;
  background: none; border: 0; text-align: left; color: var(--ink);
}
.limit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.limit .name { min-width: 0; font-size: 15px; line-height: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.limit .status { flex: none; font-size: 15px; line-height: 20px; font-weight: 500; }
.limit .status.warn { color: var(--warn); font-weight: 600; }
.lbar { position: relative; display: block; height: 8px; }
.lbar .track { position: absolute; inset: 0; border-radius: 4px; background: var(--track); }
.lbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--ink); }
.lbar .fill.over { background: var(--warn-bar); }
.lbar.goal .fill { background: var(--goal-bar); }
.lbar .tick { position: absolute; top: -3px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--ink); }

/* segmented control */
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 44px; padding: 4px;
  border-radius: 14px; background: var(--seg-bg);
}
.seg button { height: 36px; padding: 0 4px; border-radius: 10px; color: var(--seg-ink); font-size: 14px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.seg.small { flex: 1 1 auto; min-width: 0; max-width: 236px; margin-left: auto; height: 40px; padding: 3px; border-radius: 12px; }
.seg.small button { height: 34px; padding: 0 6px; border-radius: 9px; font-size: 13px; }
.main.fit { flex: none; }

/* search */
.search {
  display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 6px 0 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
}
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search-ico { display: inline-flex; color: var(--ink-3); }
.search input { flex: 1 1 auto; min-width: 0; height: 48px; border: 0; background: transparent; font-size: 16px; outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; font-size: 16px; font-weight: 500; color: var(--ink); }
.link.danger { color: var(--danger); }

/* ---------- reports ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; flex-direction: column; gap: 2px; }
.card-head h2 { margin: 0; font-size: 19px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.card-head p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.card .empty { padding: 0; }
.chart { display: flex; flex-direction: column; gap: 8px; }
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; height: 150px; border-bottom: 1px solid var(--chip-line); }
.col { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.bar-in, .bar-out { display: block; width: 14px; border-radius: 4px 4px 0 0; }
.bar-in { background: var(--in-bar); }
.bar-out { background: var(--ink); }
.axis, .nets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); text-align: center; }
.axis span { font-size: 13px; line-height: 18px; color: var(--ink-2); }
.axis .cur { color: var(--ink); font-weight: 600; }
.nets span { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.in { background: var(--in-bar); }
.sw.out { background: var(--ink); }
.catrows { display: flex; flex-direction: column; gap: 14px; }
.catrow { display: flex; flex-direction: column; gap: 6px; }
.catrow-head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; line-height: 20px; font-weight: 500; }
.catrow-head span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catrow-bar { display: flex; align-items: center; gap: 12px; }
.cbar { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.cbar span { display: block; height: 6px; border-radius: 3px; background: var(--ink); }
.change { flex: none; width: 104px; text-align: right; font-size: 13px; line-height: 18px; white-space: nowrap; }
.change.muted { color: var(--ink-2); }
.total-row { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--hair); font-size: 15px; line-height: 20px; font-weight: 600; }
.empty-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-2); }
.worth-block { display: flex; flex-direction: column; gap: 2px; }
.worth-block .worth { font-size: 28px; line-height: 34px; }
.spark { display: block; overflow: visible; }
.spark .area { fill: var(--surface-2); }
.spark .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark .dot { fill: var(--ink); }
.spark-labels { display: flex; justify-content: space-between; font-size: 13px; line-height: 18px; color: var(--ink-2); }

/* ---------- settings ---------- */
.row.setting select {
  flex: none; max-width: 58%; height: 40px; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A93A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  font-size: 16px; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.fine { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--ink-2); text-align: center; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start;
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 10px); background: var(--surface); border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-height: 52px; padding-top: 6px;
  color: var(--ink-2); font-size: 11px; line-height: 14px; font-weight: 500; text-decoration: none;
}
.tab[aria-current="page"], .tab.here { color: var(--ink); font-weight: 600; }
.tab-add { padding-top: 0; gap: 2px; color: var(--ink); font-weight: 600; }
.tab-add .plus {
  width: 44px; height: 32px; border-radius: 10px; background: var(--primary); color: var(--primary-ink);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- bottom sheets ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: var(--backdrop); }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100vh - 24px); max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 20px;
  padding: 8px 20px 0; background: var(--bg); border-radius: 28px 28px 0 0;
}
.sheet > * { flex-shrink: 0; }
.backdrop.enter { animation: af-fade .2s ease-out; }
.sheet.enter { animation: af-rise .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes af-fade { from { opacity: 0; } }
@keyframes af-rise { from { transform: translateY(28px); opacity: 0; } }
.grab { align-self: center; flex: none; width: 36px; height: 5px; border-radius: 3px; background: var(--chip-line); }
.sheet-head { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: -8px; }
.sheet-head .link { justify-self: start; padding: 0; }
.sheet-head h2 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; text-align: center; }
.amount-field { display: flex; flex-direction: column; gap: 4px; }
.amount-field label, .flabel { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.amount-row { display: flex; align-items: baseline; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--chip-line); }
.amount-row:focus-within { border-bottom-color: var(--ink); }
.amount-row .cur { font-size: 30px; line-height: 40px; font-weight: 500; color: var(--ink-2); }
.amount-row input {
  flex: 1 1 auto; min-width: 0; height: 60px; border: 0; padding: 0; background: transparent; outline: none;
  font-size: 48px; line-height: 60px; font-weight: 600; letter-spacing: -0.03em; font-stretch: 88%;
}
.amount-row input::placeholder { color: var(--ink-3); }
.field { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--chip-line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.chip.inc[aria-pressed="true"] { background: var(--pos); border-color: var(--pos); color: var(--pos-ink); }
.fgroup { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.frow { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 16px; }
.frow + .frow::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.frow:focus-within { box-shadow: inset 0 0 0 2px var(--focus); }
.frow label { flex: none; font-size: 15px; line-height: 20px; color: var(--ink); }
.frow input, .frow select {
  flex: 1 1 auto; min-width: 0; height: 54px; border: 0; padding: 0; background: transparent; outline: none;
  font-size: 16px; color: var(--ink-2); text-align: right;
}
.frow input::placeholder { color: var(--ink-3); }
.frow select {
  -webkit-appearance: none; appearance: none; padding-right: 22px; text-align-last: right; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A93A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E") no-repeat right 0 center / 16px;
}
.frow select option { color: initial; }
.frow input[type="date"] { -webkit-appearance: none; appearance: none; display: flex; justify-content: flex-end; }
.frow input[type="date"]::-webkit-date-and-time-value { text-align: right; }
.hint { margin: -8px 0 0; font-size: 13px; line-height: 19px; color: var(--ink-2); }
.hint.lead { margin: 0; font-size: 15px; line-height: 22px; }
.callout { margin: 0; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 22px; }
.form-error { margin: -8px 0 0; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--danger); }
.sheet-foot {
  position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 6px;
  margin: 0 -20px; padding: 12px 20px calc(env(safe-area-inset-bottom) + 16px); background: var(--bg);
}
.sheet-foot:empty { padding: 0 0 calc(env(safe-area-inset-bottom) + 16px); }
.btn-primary {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; border-radius: 16px; border: 0;
  background: var(--primary); color: var(--primary-ink); font-size: 17px; font-weight: 600; text-decoration: none;
}
.btn-primary.danger { background: var(--danger); color: var(--danger-ink); }
.btn-secondary {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600;
}
.pay-info { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.goal-summary { display: flex; flex-direction: column; gap: 6px; }
.goal-summary .lbar { margin-top: 6px; }
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.fact { position: relative; display: flex; justify-content: space-between; gap: 16px; padding: 15px 16px; font-size: 15px; line-height: 20px; }
.fact + .fact::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.fact .k { flex: none; color: var(--ink-2); }
.fact .v { min-width: 0; font-weight: 500; text-align: right; }
.confirm-text { margin: 0; font-size: 16px; line-height: 24px; }

/* ---------- toast ---------- */
#toast-root {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 100px);
  display: flex; justify-content: center; padding: 0 20px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; padding: 12px 12px 12px 16px; border-radius: 14px;
  background: var(--toast); color: var(--toast-ink); font-size: 15px; line-height: 20px; box-shadow: 0 8px 24px rgba(11, 24, 48, .2);
  animation: af-rise .22s ease-out;
}
.toast button { flex: none; min-height: 36px; padding: 0 10px; border-radius: 10px; font-weight: 600; color: var(--toast-ink); text-decoration: underline; }

/* ---------- welcome ---------- */
.welcome {
  min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 28px);
}
.welcome-hero { background: var(--hero); color: var(--hero-ink); border-radius: 28px; padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.welcome-hero .title { font-size: 36px; line-height: 42px; }
.welcome-hero p { margin: 0; font-size: 17px; line-height: 25px; color: var(--hero-ink-2); }
.mark { display: inline-flex; color: var(--hero-ink); }
.features { list-style: none; margin: 0; padding: 0 4px; display: flex; flex-direction: column; gap: 18px; }
.features li { display: flex; align-items: flex-start; gap: 14px; }
.features .t1, .features .t2 { white-space: normal; }
.welcome-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- pointer and motion ---------- */
@media (hover: hover) {
  .row:is(button, a):hover, .limit:hover, .alert:hover, .card-link:hover { background: var(--hover); }
  .btn:hover, .icon-btn:hover, .btn-secondary:hover { background: var(--surface-2); }
  .chip:hover { border-color: var(--ink-3); }
}
.row:is(button, a):active, .limit:active, .alert:active, .card-link:active { background: var(--surface-2); }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 28px; max-height: 88vh; }
  .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 20px 20px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .backdrop.enter, .sheet.enter, .toast { animation: none; }
}
