:root {
  --nav-bar-h: 48px;
  --nav-total-h: calc(var(--nav-bar-h) + env(safe-area-inset-top));
  --pad: 20px;
  --gap: 12px;
  --bg: #F3F3F5;
  --surface: #FFFFFF;
  --ink: #0D0E12;
  --ink-2: #555966;
  --ink-3: #9B9EA8;
  --line: rgba(13, 14, 18, 0.08);
  --fill: #F1F1F4;
  --brand: #E11D2E;
  --brand-deep: #A50F1C;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(13, 14, 18, 0.04), 0 10px 30px rgba(13, 14, 18, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body.is-weather, html.is-weather { background: #1F3A78; }
button, input { font-family: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
strong { color: var(--ink); font-weight: 650; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.center { text-align: center; }
.ta-r { text-align: right; }
.mt { margin-top: 18px; }

/* ── Navigation ── */
.nav {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 2000;
  padding-top: env(safe-area-inset-top);
  background: rgba(243, 243, 245, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.nav.show { display: block; }
.nav.show.light { background: rgba(14, 23, 52, 0.45); border-bottom-color: rgba(255, 255, 255, 0.08); }
.nav-inner { position: relative; height: var(--nav-bar-h); display: flex; align-items: center; justify-content: center; }
.nav-back {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 0 14px 0 10px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.06);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  z-index: 2001;
}
.nav-back-chevron { font-size: 24px; line-height: 1; margin-top: -3px; }
.nav.light .nav-back { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
.nav-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  padding: 0 100px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav.light .nav-title { color: #fff; }
.nav-spacer { height: var(--nav-total-h); }

/* ── Layout ── */
.page { padding: calc(16px + env(safe-area-inset-top)) var(--pad) 28px; }
body.sub-page .page { padding-top: 14px; }
.view { display: none; }
.view.active { display: block; animation: viewIn 0.28s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tap-card { cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease; }
.tap-card:active { transform: scale(0.985); opacity: 0.9; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: var(--gap); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-head h2 { font-size: 21px; font-weight: 750; letter-spacing: -0.025em; }
.section-head span { font-size: 13px; color: var(--ink-3); font-weight: 500; }

.tint-blue { background: #EBF1FF !important; color: #2F6BFF; }
.tint-amber { background: #FFF4E0 !important; color: #D97706; }
.tint-violet { background: #F1ECFF !important; color: #7C3AED; }
.tint-red { background: #FFECEE !important; color: var(--brand); }
.tint-gray { background: var(--fill) !important; color: var(--ink-2); }

/* ── Home ── */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 6px 2px 22px; }
.home-date { font-size: 12px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }
.home-title { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin-top: 6px; }
.brand-badge {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(145deg, #F2303F, var(--brand-deep));
  box-shadow: 0 8px 20px rgba(225, 29, 46, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-mark { width: 30px; height: 30px; }

.hero-weather {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 22px 22px 18px;
  margin-bottom: 30px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(86, 124, 255, 0.55) 0%, rgba(86, 124, 255, 0) 55%),
    linear-gradient(160deg, #0E1734 0%, #1B2B5E 55%, #26437F 100%);
  box-shadow: 0 20px 40px rgba(14, 23, 52, 0.28);
}
.hero-weather::after {
  content: '';
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-city { font-size: 15px; font-weight: 650; opacity: 0.92; }
.hero-icon { font-size: 46px; line-height: 1; }
.hero-temp { font-size: 80px; font-weight: 200; letter-spacing: -0.06em; line-height: 1; margin: 4px 0 8px -4px; }
.hero-desc { font-size: 16px; font-weight: 500; opacity: 0.85; }
.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13px;
  opacity: 0.9;
}
.hero-foot b { font-weight: 650; }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: 30px; }
.tile {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.tile-icon { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--fill); }
.tile-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.tile-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.tile-wide {
  grid-column: 1 / -1;
  min-height: 0;
  color: #fff;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(225, 29, 46, 0.5) 0%, rgba(225, 29, 46, 0) 55%),
    linear-gradient(150deg, #14161D 0%, #262932 100%);
  box-shadow: 0 18px 36px rgba(13, 14, 18, 0.22);
}
.tile-wide .tile-icon { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tile-wide .tile-sub { color: rgba(255, 255, 255, 0.6); }
.tile-wide-main { display: flex; align-items: center; gap: 14px; }
.tile-wide-foot { display: flex; align-items: flex-end; justify-content: space-between; }
.tile-wide-foot b { font-size: 30px; font-weight: 750; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.tile-wide-foot span { font-size: 13px; color: rgba(255, 255, 255, 0.6); margin-left: 6px; }
.tile-arrow { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--ink) !important; display: flex; align-items: center; justify-content: center; font-size: 18px !important; margin: 0 !important; }

.list-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; position: relative; }
.row + .row::before { content: ''; position: absolute; top: 0; left: 18px; right: 0; height: 0.5px; background: var(--line); }
.row-icon { width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: -0.015em; }
.row-desc { font-size: 13px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.row-arrow { width: 18px; height: 18px; color: #C4C6CE; }
.pill { font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--fill); color: var(--ink-2); letter-spacing: 0; }
.home-foot { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 10px; }

/* ── Weather ── */
.weather-page {
  margin: calc(-16px - env(safe-area-inset-top)) calc(-1 * var(--pad)) calc(-56px - env(safe-area-inset-bottom));
  padding: calc(var(--nav-total-h) + 14px) var(--pad) calc(40px + env(safe-area-inset-bottom));
  min-height: 100vh;
  color: #fff;
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(86, 124, 255, 0.4), rgba(86, 124, 255, 0) 60%),
    linear-gradient(180deg, #0E1734 0%, #182A5C 45%, #1F3A78 100%);
}
.wx-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.wx-city { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 650; }
.wx-actions { display: flex; gap: 8px; }
.wx-icon-btn { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 14px; font-weight: 650; }
.wx-main { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 20px; }
.wx-temp { font-size: 96px; font-weight: 200; letter-spacing: -0.06em; line-height: 1; margin-left: -6px; }
.wx-sub { font-size: 18px; font-weight: 600; margin-top: 6px; }
.wx-hilo { font-size: 14px; opacity: 0.7; margin-top: 4px; white-space: pre; }
.wx-big-icon { font-size: 80px; line-height: 1; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.25)); }

.wx-glass { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.wx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.wx-cell { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 14px 10px; font-size: 12px; }
.wx-cell span { display: block; font-size: 18px; margin-bottom: 8px; }
.wx-cell b { display: block; opacity: 0.65; font-weight: 500; margin-bottom: 4px; }
.wx-cell i { font-style: normal; font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }

.wx-sunbar { display: flex; align-items: center; justify-content: space-between; }
.wx-sunbar small { display: block; font-size: 12px; opacity: 0.65; margin-bottom: 2px; }
.wx-sunbar b { font-size: 16px; font-weight: 650; }
.wx-sunline { flex: 1; height: 3px; background: linear-gradient(90deg, #FFB648, rgba(255, 255, 255, 0.2)); margin: 0 16px; border-radius: 2px; position: relative; }
.wx-sunline i { position: absolute; left: 40%; top: -5px; width: 13px; height: 13px; background: #FFD27A; border-radius: 50%; box-shadow: 0 0 14px #FFB648; }

.wx-sec-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.65; margin: 22px 2px 10px; }
.wx-sec-title.inner { margin: 0 0 8px; }
.wx-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin: 0 calc(-1 * var(--pad)); padding-left: var(--pad); padding-right: var(--pad); scrollbar-width: none; }
.wx-scroll::-webkit-scrollbar { display: none; }
.wx-day { flex: 0 0 78px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 12px 6px; text-align: center; font-size: 12px; }
.wx-day.now { background: rgba(255, 255, 255, 0.2); }
.wx-day .d { opacity: 0.75; font-weight: 600; }
.wx-day .i { font-size: 26px; margin: 8px 0 6px; }
.wx-day .t { font-size: 11px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx-day .h { font-size: 14px; font-weight: 650; margin-top: 4px; }
.wx-day .h em { font-style: normal; opacity: 0.55; font-weight: 500; margin-left: 4px; }
.wx-day .r { font-size: 11px; color: #9CC4FF; margin-top: 4px; }
.wx-hour .wx-day { flex: 0 0 62px; }

.wx-life { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.wx-life-item { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 18px; padding: 14px; font-size: 12px; }
.wx-life-item .ic { font-size: 22px; margin-bottom: 8px; }
.wx-life-item .nm { font-size: 12px; opacity: 0.65; font-weight: 500; }
.wx-life-item .lv { font-size: 16px; font-weight: 650; color: #FFD27A; margin: 2px 0 4px; }
.wx-life-item .tx { opacity: 0.7; line-height: 1.45; }

.wx-air-top { display: flex; justify-content: space-between; align-items: center; font-weight: 650; }
.wx-air-top small { background: rgba(255, 210, 122, 0.2); color: #FFD27A; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.wx-air-num { font-size: 56px; font-weight: 200; letter-spacing: -0.05em; margin: 4px 0 12px; }
.wx-air-row { display: flex; justify-content: space-between; text-align: center; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 12px; }
.wx-air-row b { display: block; font-size: 17px; font-weight: 650; }
.wx-air-row i { font-style: normal; font-size: 11px; opacity: 0.6; }
.wx-tip p { font-size: 15px; line-height: 1.6; opacity: 0.92; }

.city-sheet { display: none; position: fixed; inset: 0; z-index: 2500; }
.city-sheet.on { display: block; }
.city-sheet-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); animation: fade 0.2s ease; }
.city-sheet-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 62vh;
  overflow-y: auto;
  animation: sheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-handle { width: 38px; height: 5px; border-radius: 3px; background: #DADBE0; margin: 0 auto 14px; }
.city-sheet-title { font-size: 18px; font-weight: 750; margin: 0 4px 10px; letter-spacing: -0.02em; }
.city-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 14px; border-radius: 14px; font-size: 16px; font-weight: 600; }
.city-item small { font-size: 14px; color: var(--ink-3); font-weight: 500; }
.city-item.on { background: var(--fill); }
.city-item.on::after { content: '✓'; color: var(--brand); font-weight: 700; margin-left: 10px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }

/* ── Forms & buttons ── */
.field {
  background: var(--fill);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.field:focus-within { border-color: var(--ink); background: #fff; }
.field span, .field em { font-style: normal; font-size: 16px; color: var(--ink-3); font-weight: 600; }
.field input { flex: 1; min-width: 0; border: none; background: none; outline: none; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.field-head label { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; }
.field-head em { font-style: normal; font-size: 13px; color: var(--ink-3); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips button { border: none; background: var(--fill); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.chips button.on { background: var(--ink); color: #fff; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  margin-top: 14px;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.985); opacity: 0.92; }
.btn .ico { width: 20px; height: 20px; }
.btn-gray { background: var(--fill); color: var(--ink); }
.btn-danger { background: #FFECEE; color: var(--brand); }
.btn-sm { height: 50px; padding: 0 20px; border: none; border-radius: 14px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 650; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.btn-pair .btn { margin-top: 0; font-size: 15px; }

.input { width: 100%; height: 50px; border: 1.5px solid transparent; border-radius: 14px; padding: 0 16px; font-size: 16px; background: var(--fill); outline: none; transition: border-color 0.15s, background 0.15s; }
.input:focus { border-color: var(--ink); background: #fff; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input.flex { flex: 1; }

.tool-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; margin-bottom: var(--gap); }
.lead { font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.note { font-size: 13px; color: var(--ink-3); line-height: 1.55; text-align: center; margin-top: 16px; }
.note.left { text-align: left; }
.fine-print { font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.5; margin: 14px 12px 0; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  opacity: 0;
  max-width: 86vw;
  background: rgba(13, 14, 18, 0.92);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 3000;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── Mortgage ── */
.loan-hero {
  border-radius: 28px;
  padding: 24px 22px 20px;
  margin-bottom: 16px;
  color: #fff;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(225, 29, 46, 0.55), rgba(225, 29, 46, 0) 55%),
    linear-gradient(155deg, #14161D 0%, #262932 100%);
  box-shadow: 0 20px 40px rgba(13, 14, 18, 0.24);
}
.loan-hero > small { font-size: 13px; opacity: 0.65; font-weight: 500; }
.loan-month { font-size: 48px; font-weight: 750; letter-spacing: -0.045em; margin: 4px 0 18px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.loan-month span { font-size: 17px; font-weight: 500; opacity: 0.55; margin-left: 4px; letter-spacing: 0; }
.loan-sum-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.loan-sum-row small { display: block; font-size: 11px; opacity: 0.55; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; font-weight: 600; }
.loan-sum-row b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.loan-card { padding: 20px 18px; }
.loan-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.loan-split div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.loan-split small { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; font-weight: 500; }
.loan-split b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 14px; text-align: left; font-size: 15px; font-weight: 650; transition: border-color 0.15s, box-shadow 0.15s; }
.seg button small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-top: 4px; line-height: 1.35; }
.seg button.on { border-color: var(--ink); box-shadow: inset 0 0 0 0.5px var(--ink); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #E6E6EB; padding: 4px; border-radius: 14px; margin: 4px 0 var(--gap); }
.tabs button { border: none; background: none; padding: 9px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--ink-2); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.chart-card { padding: 18px; }
.chart-card canvas { display: block; width: 100%; }
.chart-title { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.legend { display: flex; justify-content: center; gap: 22px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .c1 { background: var(--ink); }
.legend .c2 { background: var(--brand); }
.legend b { color: var(--ink); font-weight: 700; margin-left: 6px; }
.plan-head { display: flex; justify-content: space-between; align-items: center; padding: 18px; font-size: 15px; font-weight: 650; cursor: pointer; }
.plan-head i { font-style: normal; color: var(--ink-3); transition: transform 0.2s; }
.plan-head.open i { transform: rotate(180deg); }
.table-wrap { padding: 0 10px 10px; }
.loan-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.loan-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 650; padding: 8px 6px; text-align: right; }
.loan-table td { padding: 11px 6px; text-align: right; border-top: 0.5px solid var(--line); }
.loan-table th:first-child, .loan-table td:first-child { text-align: left; color: var(--ink-3); }

/* ── Base converter ── */
.slider { width: 100%; height: 32px; margin-top: 14px; accent-color: var(--ink); }
.slider-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.slider-scale span:nth-child(2) { color: var(--ink); font-weight: 650; }
.base-table { border: 1px solid var(--line); border-radius: 18px; margin-top: 18px; overflow: hidden; }
.base-table div { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 14px 16px; }
.base-table div + div { border-top: 0.5px solid var(--line); }
.base-table span { font-size: 15px; font-weight: 600; }
.base-table small { grid-row: 2; font-size: 11px; color: var(--ink-3); font-weight: 650; letter-spacing: 0.08em; }
.base-table b { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 18px; font-weight: 600; word-break: break-all; text-align: right; max-width: 220px; }

/* ── Sound meter ── */
.db-ring {
  --p: 0;
  --c: var(--ink);
  width: 230px;
  height: 230px;
  margin: 26px auto 6px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #EEEEF2 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.db-inner { width: 196px; height: 196px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--line); }
.decibel-num { font-size: 64px; font-weight: 750; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.decibel-unit { font-size: 12px; color: var(--ink-3); margin: 6px 0 8px; font-weight: 500; }
.decibel-lv { font-size: 15px; font-weight: 650; max-width: 150px; text-align: center; }
.scale-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.scale-grid div { background: var(--surface); border-radius: 16px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.scale-grid i { display: block; width: 8px; height: 8px; border-radius: 50%; margin: 0 auto 8px; }
.scale-grid b { display: block; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.scale-grid span { font-size: 11px; color: var(--ink-3); font-weight: 500; }

/* ── Receipt vault ── */
.receipt-grid { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.receipt-card { width: 100%; border: none; background: var(--surface); border-radius: 18px; overflow: hidden; text-align: left; box-shadow: var(--shadow); padding: 0; }
.receipt-card-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--fill); }
.receipt-card-body { padding: 10px 12px 12px; }
.receipt-card-title { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-card-date { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.empty { text-align: center; padding: 34px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty.small { box-shadow: none; padding: 26px 10px 10px; }
.empty-ico { font-size: 34px; margin-bottom: 10px; }
.empty p { font-size: 16px; font-weight: 650; }
.empty span { font-size: 13px; color: var(--ink-3); }
.receipt-modal { position: fixed; inset: 0; z-index: 2600; display: flex; align-items: center; justify-content: center; padding: 18px; }
.receipt-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.2s ease; }
.receipt-modal-body { position: relative; background: var(--surface); border-radius: 24px; padding: 18px; width: 100%; max-width: 380px; max-height: 90vh; overflow-y: auto; z-index: 1; animation: viewIn 0.25s ease; }
.receipt-modal-body img { width: 100%; border-radius: 14px; margin-bottom: 14px; display: block; }
.receipt-modal-title { font-size: 17px; font-weight: 700; }
.receipt-modal-close { position: absolute; top: 26px; right: 26px; border: none; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 20px; width: 34px; height: 34px; border-radius: 50%; line-height: 34px; }
.hidden-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ── To-do ── */
.todo-list { list-style: none; margin-top: 8px; }
.todo-list li { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 0.5px solid var(--line); font-size: 16px; }
.todo-list li:last-child { border-bottom: none; }
.todo-list input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); flex-shrink: 0; }
.todo-list li span { flex: 1; min-width: 0; word-break: break-word; }
.todo-list li.done span { color: var(--ink-3); text-decoration: line-through; }
.todo-del { border: none; background: var(--fill); color: var(--ink-3); width: 30px; height: 30px; border-radius: 50%; font-size: 16px; flex-shrink: 0; }

/* ── About & legal ── */
.about-top { text-align: center; padding: 18px 0 26px; }
.app-icon { width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 22px; background: linear-gradient(145deg, #F2303F, var(--brand-deep)); box-shadow: 0 14px 30px rgba(225, 29, 46, 0.3); display: flex; align-items: center; justify-content: center; }
.app-icon svg { width: 58px; height: 58px; }
.app-name { font-size: 26px; font-weight: 800; letter-spacing: -0.035em; }
.app-ver { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.block { padding: 20px; }
.block-title { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; margin-bottom: 10px; }
.block-text { font-size: 15px; color: var(--ink-2); line-height: 1.65; }
.block-text + .block-text { margin-top: 10px; }
.feature-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.feature-tag { padding: 6px 12px; border-radius: 999px; background: var(--fill); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.legal .block-title { font-size: 24px; letter-spacing: -0.03em; }
.legal-meta { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.legal-h { font-size: 16px; font-weight: 700; color: var(--ink); margin: 22px 0 8px; letter-spacing: -0.015em; }
.legal-ul { margin: 0 0 8px 20px; font-size: 15px; color: var(--ink-2); line-height: 1.65; }
.legal-ul li { margin-bottom: 6px; }
.copyright { text-align: center; padding: 18px 0 6px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* ── Standalone legal pages ── */
.legal-page { max-width: 720px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); }
.legal-head { text-align: center; padding: 20px 0 24px; }
.legal-head .app-icon { width: 64px; height: 64px; border-radius: 17px; margin-bottom: 14px; }
.legal-head .app-icon svg { width: 42px; height: 42px; }
.legal-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.035em; }
.legal-head p { font-size: 14px; color: var(--ink-3); margin-top: 6px; }
