/* =========================================================
   同账 · Together Ledger
   Warm paper, deep green, one shared place for money stories.
   ========================================================= */

:root {
  --paper: #f2f2f7;
  --paper-deep: #e5e5ea;
  --paper-soft: #f7f7fa;
  --card: #ffffff;
  --card-soft: #f7f7fa;
  --ink: #1d1d1f;
  --ink-soft: #3a3a3c;
  --muted: #6e6e73;
  --muted-soft: #8e8e93;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.22);
  --forest: #007aff;
  --forest-deep: #0051d5;
  --forest-mid: #0071e3;
  --sage: #a7c7ff;
  --lime: #e8f0ff;
  --amber: #ff9f0a;
  --amber-soft: #fff4e5;
  --clay: #ff6b4a;
  --clay-soft: #ffece8;
  --rose: #ff375f;
  --green: #34c759;
  --green-soft: #e9f9ee;
  --red: #ff3b30;
  --red-soft: #ffeceb;
  --white: #ffffff;

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;

  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 34px -26px rgba(0, 0, 0, 0.2);
  --shadow-float: 0 28px 80px -28px rgba(0, 0, 0, 0.32);
  --sidebar-w: 252px;
  --recent-w: 270px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 8% -8%, rgba(217, 164, 91, 0.12), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(167, 189, 160, 0.16), transparent 55%),
    var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
::selection { background: var(--lime); color: var(--forest-deep); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; }

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow.light { color: rgba(244, 237, 223, 0.55); }

/* ---------------------------------------------------------
   Buttons, fields, shared bits
   --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--forest); color: #f7f1e4; box-shadow: 0 10px 24px -14px rgba(23, 60, 48, 0.8); }
.btn-primary:hover { background: var(--forest-mid); }
.btn-wide { width: 100%; min-height: 46px; border-radius: 13px; }
.btn-outline { border-color: var(--line-strong); background: rgba(255, 253, 248, 0.48); color: var(--ink-soft); }
.btn-outline:hover { background: var(--card); border-color: rgba(27, 42, 35, 0.28); }
.btn-ghost { background: var(--card-soft); color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper-soft); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(177, 79, 63, 0.14); }
.btn-danger:hover { background: #f1d4cd; }
.btn-quiet { color: var(--muted); padding: 6px 9px; min-height: 32px; }
.btn-quiet:hover { background: rgba(27, 42, 35, 0.06); color: var(--ink); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: 0.18s ease;
}
.icon-btn:hover { background: rgba(27, 42, 35, 0.06); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--card);
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-soft); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(54, 114, 91, 0.55);
  box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.09);
}
.field textarea { min-height: 84px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error {
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
}
.form-note { color: var(--muted); font-size: 11.5px; line-height: 1.6; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  border: 2px solid var(--card);
  flex: none;
}
.avatar-me { background: var(--forest); color: #f3ead9; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { margin-left: -8px; width: 31px; height: 31px; font-size: 12px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar-more { background: var(--paper-deep); color: var(--muted); font-family: var(--font-body); font-size: 10px; font-weight: 700; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: #90682d; }
.badge-clay { background: var(--clay-soft); color: #9e4d30; }
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.platform-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #fffdf8;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  flex: none;
}
.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.platform-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------------------------------------------------------
   Boot
   --------------------------------------------------------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--paper);
}
.brand-mark-large { width: 60px; height: 60px; border-radius: 18px; }
.boot-copy { display: flex; flex-direction: column; gap: 2px; }
.boot-copy strong { font-family: var(--font-display); font-size: 26px; letter-spacing: 0.05em; }
.boot-copy span { color: var(--muted); font-size: 12px; }
.boot-progress-wrap {
  position: absolute;
  bottom: 13%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(300px, 68vw);
  transform: translateX(-50%);
}
.boot-progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
#boot-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #64d2ff);
  box-shadow: 0 0 12px rgba(0, 122, 255, 0.5);
  transition: width 0.38s cubic-bezier(0.22, 0.8, 0.3, 1);
}
#boot-progress-text {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------
   Brand mark
   --------------------------------------------------------- */

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--forest);
  color: #f5eddf;
  flex: none;
}
.brand-mark svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.brand-mark svg circle:last-child { stroke: var(--amber); }

/* ---------------------------------------------------------
   Auth
   --------------------------------------------------------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.07fr) minmax(420px, 0.93fr);
  min-height: 100vh;
  background: var(--paper);
}

.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  color: #f3ecdf;
  background:
    radial-gradient(900px 560px at 10% 0%, rgba(74, 123, 98, 0.38), transparent 58%),
    radial-gradient(600px 500px at 100% 100%, rgba(217, 164, 91, 0.16), transparent 62%),
    linear-gradient(145deg, #0f2d24 0%, #173c30 52%, #1d493a 100%);
}
.auth-art::before {
  content: "";
  position: absolute;
  width: 58vw;
  height: 58vw;
  min-width: 620px;
  min-height: 620px;
  right: -28vw;
  top: -24vw;
  border: 1px solid rgba(244, 237, 223, 0.1);
  border-radius: 50%;
  box-shadow: inset 0 0 0 80px rgba(244, 237, 223, 0.018), inset 0 0 0 160px rgba(244, 237, 223, 0.014);
}
.auth-art::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(244, 237, 223, 0.11) 40px);
  mask-image: linear-gradient(180deg, transparent 0, #000 40%, transparent 100%);
  pointer-events: none;
}
.auth-art-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 44px clamp(36px, 5.2vw, 76px) 38px;
}
.auth-brand { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; }
.auth-brand .brand-mark { background: rgba(244, 237, 223, 0.1); border: 1px solid rgba(244, 237, 223, 0.18); }
.auth-brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand-copy strong { font-family: var(--font-display); font-size: 20px; letter-spacing: 0.12em; }
.auth-brand-copy small { color: rgba(244, 237, 223, 0.45); font-size: 8px; letter-spacing: 0.19em; margin-top: 3px; }

.auth-editorial { margin-top: auto; padding-top: 58px; max-width: 570px; }
.auth-editorial h1 {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(42px, 4.6vw, 64px);
  font-weight: 500;
  line-height: 1.13;
  letter-spacing: -0.035em;
}
.auth-editorial h1 em { color: var(--amber); font-style: normal; position: relative; }
.auth-editorial h1 em::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 3px;
  height: 7px;
  background: rgba(217, 164, 91, 0.19);
  z-index: -1;
  border-radius: 2px;
}
.auth-lead {
  max-width: 460px;
  margin-top: 22px;
  color: rgba(244, 237, 223, 0.62);
  font-size: 14px;
  line-height: 1.9;
}

.auth-demo-card {
  width: min(490px, 100%);
  margin-top: 38px;
  padding: 18px 20px 17px;
  border: 1px solid rgba(244, 237, 223, 0.14);
  border-radius: 20px;
  background: rgba(250, 245, 235, 0.055);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 70px -40px rgba(0, 0, 0, 0.5);
}
.demo-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: rgba(244, 237, 223, 0.55); font-size: 10.5px; }
.demo-live { display: inline-flex; align-items: center; gap: 5px; }
.demo-live i { width: 5px; height: 5px; border-radius: 50%; background: #93c49d; box-shadow: 0 0 0 3px rgba(147, 196, 157, 0.12); }
.demo-amount { margin-top: 7px; font-family: var(--font-num); font-size: 38px; letter-spacing: -0.03em; line-height: 1.2; }
.demo-amount span { color: rgba(244, 237, 223, 0.5); font-size: 20px; margin-right: 4px; }
.demo-amount small { color: rgba(244, 237, 223, 0.5); font-size: 22px; }
.demo-merge {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  color: rgba(244, 237, 223, 0.58);
  font-size: 10.5px;
}
.demo-platform { padding: 3px 7px; border: 1px solid rgba(244, 237, 223, 0.15); border-radius: 5px; }
.demo-merge b { color: rgba(244, 237, 223, 0.28); font-weight: 400; }
.demo-merge strong { color: var(--amber); }
.demo-bars { display: flex; align-items: flex-end; gap: 4px; height: 22px; margin-top: 14px; }
.demo-bars i { display: block; height: 100%; width: var(--w); max-width: 28%; border-radius: 3px 3px 1px 1px; background: var(--c); opacity: 0.72; }
.auth-footnote { margin-top: auto; padding-top: 30px; color: rgba(244, 237, 223, 0.32); font-size: 10px; letter-spacing: 0.03em; }

.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(34px, 5vw, 80px) 30px;
  background: var(--paper);
}
.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background-image: radial-gradient(rgba(27, 42, 35, 0.1) 0.6px, transparent 0.6px);
  background-size: 7px 7px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}
.auth-form-wrap { position: relative; width: min(420px, 100%); margin: auto; padding: 10px 0; }
.auth-mobile-brand { display: none; }
.auth-heading h2 { margin-top: 6px; font-family: var(--font-display); font-size: 32px; font-weight: 500; letter-spacing: -0.025em; }
.auth-heading > p:last-child { margin-top: 7px; color: var(--muted); font-size: 13px; }

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 27px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.55);
}
.auth-tab {
  position: relative;
  z-index: 1;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  transition: color 0.2s ease;
}
.auth-tab.is-active { color: #f6efe2; }
.auth-tab-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: 36px;
  border-radius: 8px;
  background: var(--forest);
  box-shadow: 0 5px 14px -8px rgba(23, 60, 48, 0.6);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-tabs[data-mode="register"] .auth-tab-indicator { transform: translateX(100%); }

.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 23px; }
.auth-form .field > span { font-size: 11.5px; }
.auth-form .field input { min-height: 46px; background: rgba(255, 253, 248, 0.76); }
.auth-form .btn { margin-top: 3px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted-soft); font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-demo { border-style: dashed; background: transparent; color: var(--ink-soft); font-weight: 550; }
.btn-demo:hover { background: rgba(255, 253, 248, 0.7); border-style: solid; }
.auth-terms { margin-top: 16px; color: var(--muted-soft); font-size: 10px; line-height: 1.7; text-align: center; }
.auth-panel-foot { position: relative; margin-top: auto; padding-top: 26px; color: var(--muted-soft); font-size: 10px; letter-spacing: 0.04em; }

/* ---------------------------------------------------------
   App shell / sidebar
   --------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  padding: 24px 18px 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.6), rgba(242, 237, 226, 0.5)),
    var(--paper);
}
.sidebar-top { min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: 0.1em; }
.brand-copy small { margin-top: 3px; color: var(--muted-soft); font-size: 7.5px; letter-spacing: 0.18em; }

.ledger-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 23px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.62);
  text-align: left;
  transition: 0.18s ease;
}
.ledger-switch:hover { background: var(--card); border-color: var(--line-strong); }
.ledger-switch-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--amber-soft);
  color: #8d6429;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  flex: none;
}
.ledger-switch-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ledger-switch-copy small { color: var(--muted-soft); font-size: 8.5px; letter-spacing: 0.04em; }
.ledger-switch-copy strong { overflow: hidden; margin-top: 1px; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ledger-switch > .icon { width: 14px; height: 14px; color: var(--muted); }

.btn-new {
  width: 100%;
  min-height: 43px;
  margin-top: 11px;
  padding: 10px 13px;
  justify-content: flex-start;
  border-radius: 12px;
  background: var(--forest);
  color: #f7f1e5;
  box-shadow: 0 12px 26px -18px rgba(23, 60, 48, 0.95);
}
.btn-new:hover { background: var(--forest-mid); }
.btn-new span { flex: 1; text-align: left; }
.btn-new kbd {
  padding: 2px 6px;
  border: 1px solid rgba(247, 241, 229, 0.18);
  border-radius: 5px;
  background: rgba(247, 241, 229, 0.08);
  color: rgba(247, 241, 229, 0.55);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 21px; }
.nav-label {
  margin: 13px 0 5px;
  padding: 0 10px;
  color: var(--muted-soft);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 39px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 550;
  transition: 0.16s ease;
}
.nav-link .icon { width: 17px; height: 17px; color: var(--muted); }
.nav-link:hover { background: rgba(27, 42, 35, 0.05); color: var(--ink); }
.nav-link.is-active { background: var(--forest); color: #f5eddf; box-shadow: 0 10px 22px -18px rgba(23, 60, 48, 0.9); }
.nav-link.is-active .icon { color: var(--amber); }
.nav-tag {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(27, 42, 35, 0.06);
  color: var(--muted-soft);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nav-link.is-active .nav-tag { background: rgba(245, 237, 223, 0.1); color: var(--amber); }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; }
.sidebar-note {
  display: flex;
  gap: 8px;
  padding: 11px;
  border: 1px dashed rgba(27, 42, 35, 0.16);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.32);
}
.sidebar-note .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--amber); }
.sidebar-note p { display: flex; flex-direction: column; gap: 2px; }
.sidebar-note strong { color: var(--ink-soft); font-size: 10.5px; font-weight: 650; }
.sidebar-note span { font-size: 9.5px; line-height: 1.6; }

.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 14px 30px -26px rgba(0, 0, 0, 0.3);
  text-align: left;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.78); }
.user-chip .avatar { width: 46px; height: 46px; font-size: 17px; }
.user-chip-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-chip-copy strong { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip > .icon { width: 16px; height: 16px; color: var(--muted); }
.user-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 82px;
  z-index: 5;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-float);
}
.user-menu button,
.user-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 11.5px;
  text-align: left;
}
.user-menu button:hover { background: var(--paper-soft); color: var(--red); }
.user-menu a:hover { background: rgba(0, 122, 255, 0.08); color: #0066cc; }
.user-menu .icon { width: 17px; height: 17px; }
.user-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---------------------------------------------------------
   Topbar
   --------------------------------------------------------- */

.app-main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 237, 226, 0.86);
  backdrop-filter: blur(16px);
}
.topbar-left { display: flex; align-items: center; min-width: 0; }
.topbar-crumb { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 11px; }
.topbar-crumb span { color: var(--muted-soft); white-space: nowrap; }
.topbar-crumb span::after { content: "/"; margin-left: 7px; color: var(--line-strong); }
.topbar-crumb strong { overflow: hidden; max-width: 220px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.month-remaining {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 14px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 159, 10, 0.24);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.16), rgba(255, 214, 102, 0.1));
  color: #8a5a00;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.month-remaining::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff9f0a;
  box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.14);
}
.mobile-ledger { display: none; }
.month-nav { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 253, 248, 0.5); }
.month-arrow { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.month-arrow:hover { background: var(--card); color: var(--ink); }
.month-arrow .icon { width: 14px; height: 14px; }
.month-label { min-width: 116px; height: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.month-short { display: none; }
.month-label:hover { background: var(--card); }
.month-today { display: none; height: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; }
.month-today:hover { background: var(--card); color: var(--ink); }
.month-nav.is-other .month-today { display: inline-flex; align-items: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.btn-invite { min-height: 34px; padding: 6px 12px; border-radius: 9px; font-size: 11px; background: transparent; }
.btn-invite .icon { width: 14px; height: 14px; }
.btn-chat-top { min-height: 34px; padding: 6px 12px; border-radius: 9px; font-size: 11px; background: transparent; }
.btn-chat-top .icon { width: 14px; height: 14px; color: var(--green); }

/* ---------------------------------------------------------
   Page / shared page furniture
   --------------------------------------------------------- */

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 31px 40px 64px;
  outline: none;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-head h1 { margin-top: 5px; font-family: var(--font-display); font-size: 37px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.08; }
.page-head p:last-child { margin-top: 8px; color: var(--muted); font-size: 12px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.head-actions .btn { min-height: 38px; font-size: 11.5px; }
.page .eyebrow { margin-bottom: 0; }

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-top: 4px; font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.panel-head .eyebrow { font-size: 8.5px; }
.panel-sub { margin-top: 4px; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.link-btn:hover { color: var(--forest); }
.link-btn .icon { width: 12px; height: 12px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.money-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ---------------------------------------------------------
   Overview
   --------------------------------------------------------- */

.overview-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(250px, 0.62fr);
  min-height: 246px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(650px 300px at 92% 4%, rgba(217, 164, 91, 0.16), transparent 58%),
    radial-gradient(500px 300px at 4% 110%, rgba(113, 157, 132, 0.2), transparent 63%),
    linear-gradient(125deg, #112f26, #173c30 55%, #1e4a3a);
  color: #f5efe3;
  box-shadow: 0 34px 74px -46px rgba(15, 45, 36, 0.72);
}
.overview-hero::before {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  right: -104px;
  top: -180px;
  border: 1px solid rgba(245, 239, 227, 0.1);
  border-radius: 50%;
  box-shadow: inset 0 0 0 52px rgba(245, 239, 227, 0.018), inset 0 0 0 106px rgba(245, 239, 227, 0.014);
}
.overview-hero::after {
  content: "月";
  position: absolute;
  right: 19px;
  bottom: -56px;
  color: rgba(245, 239, 227, 0.032);
  font-family: var(--font-display);
  font-size: 230px;
  line-height: 1;
  pointer-events: none;
}
.hero-main { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; padding: 33px 38px; }
.hero-kicker { display: flex; align-items: center; gap: 8px; color: rgba(245, 239, 227, 0.53); font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }
.hero-kicker i { width: 17px; height: 1px; background: var(--amber); }
.hero-balance-label {
  margin-top: 16px;
  color: rgba(245, 239, 227, 0.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}
.hero-balance { margin-top: 5px; line-height: 1; }
.hero-meta-summary { gap: 36px; }
.hero-summary-item { display: inline-flex; align-items: baseline; gap: 10px; }
.hero-summary-item > span { color: rgba(245, 239, 227, 0.62); font-size: 13px; font-weight: 600; }
.hero-summary-item b {
  color: rgba(245, 239, 227, 0.96);
  font-family: var(--font-num);
  font-size: 33px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
@media (max-width: 560px) {
  .hero-meta-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 18px;
    width: 100%;
  }
  .hero-summary-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .hero-summary-item > span { font-size: 12px; }
  .hero-summary-item b { font-size: clamp(23px, 7vw, 27px); }
}
.hero-balance .currency { margin-right: 7px; color: rgba(245, 239, 227, 0.48); font-family: var(--font-num); font-size: 24px; }
.hero-balance strong { font-family: var(--font-num); font-size: clamp(44px, 4.4vw, 62px); font-weight: 400; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.hero-balance small { color: rgba(245, 239, 227, 0.48); font-family: var(--font-num); font-size: 26px; }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 18px; }
.hero-delta { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid rgba(245, 239, 227, 0.13); border-radius: 6px; color: rgba(245, 239, 227, 0.62); font-size: 10px; }
.hero-delta.is-up { color: #e5b579; background: rgba(217, 164, 91, 0.08); }
.hero-delta.is-down { color: #a8cbb1; background: rgba(168, 203, 177, 0.07); }
.hero-flows { display: flex; gap: 19px; color: rgba(245, 239, 227, 0.54); font-size: 10.5px; }
.hero-flows b { margin-left: 5px; color: rgba(245, 239, 227, 0.9); font-family: var(--font-num); font-size: 13px; font-weight: 500; }
.hero-chat-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(217, 164, 91, 0.24);
  border-radius: 6px;
  background: rgba(217, 164, 91, 0.07);
  color: rgba(245, 239, 227, 0.7);
  font-size: 9.5px;
  transition: 0.16s ease;
}
.hero-chat-link:hover { background: rgba(217, 164, 91, 0.14); color: #f5efe3; }
.hero-chat-link .icon { width: 11px; height: 11px; color: var(--amber); }
.hero-side {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 30px 26px;
  border-left: 1px solid rgba(245, 239, 227, 0.1);
  background: rgba(7, 28, 21, 0.16);
}
.hero-side-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-side-label { color: rgba(245, 239, 227, 0.4); font-size: 9.5px; letter-spacing: 0.04em; }
.hero-members { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hero-members .avatar { width: 31px; height: 31px; border-color: rgba(245, 239, 227, 0.18); font-size: 11px; }
.hero-members .avatar:nth-child(1) { background: #d9a45b; color: #3e2b12; }
.hero-members .avatar:nth-child(2) { background: #9bb28f; color: #1d3326; }
.hero-members .avatar:nth-child(3) { background: #cf825c; color: #3c2015; }
.hero-members .avatar:nth-child(4) { background: #d8cdb5; color: #3c372d; }
.hero-members span:last-child { color: rgba(245, 239, 227, 0.5); font-size: 10px; }
.hero-count { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.hero-count strong { font-family: var(--font-num); font-size: 24px; font-weight: 400; line-height: 1.1; }
.hero-count span { color: rgba(245, 239, 227, 0.38); font-size: 9px; }
.hero-spark { position: relative; height: 68px; margin: 8px 0 2px; }
.hero-spark svg { width: 100%; height: 100%; overflow: visible; }
.hero-spark-meta { display: flex; align-items: center; justify-content: space-between; color: rgba(245, 239, 227, 0.36); font-size: 8.5px; }
.hero-spark-meta strong { color: rgba(245, 239, 227, 0.65); font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 17px; }
.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 106px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.68);
  overflow: hidden;
  transition: 0.18s ease;
}
.stat-card:hover { background: var(--card); border-color: var(--line-strong); transform: translateY(-1px); }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.stat-label .icon { width: 13px; height: 13px; color: var(--muted-soft); }
.stat-value { font-family: var(--font-num); font-size: 25px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value .unit { margin-left: 3px; color: var(--muted); font-family: var(--font-body); font-size: 10px; font-weight: 500; }
.stat-foot { color: var(--muted-soft); font-size: 9.5px; }
.stat-foot em { color: var(--green); font-style: normal; font-weight: 600; }
.stat-foot em.warn { color: var(--clay); }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr); gap: 17px; margin-top: 17px; }
.category-panel, .platform-panel { padding: 24px 25px 21px; }
.category-visual { display: grid; grid-template-columns: 154px minmax(0, 1fr); align-items: center; gap: 22px; margin-top: 19px; }
.donut-wrap { position: relative; width: 150px; height: 150px; flex: none; }
.donut {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--segments));
  transform: rotate(-90deg);
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, 0.18);
}
.donut::after { content: ""; position: absolute; inset: 19px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.donut-center span { color: var(--muted); font-size: 8.5px; }
.donut-center strong { font-family: var(--font-num); font-size: 18px; font-weight: 500; letter-spacing: -0.03em; }
.donut-center small { color: var(--muted-soft); font-size: 8px; }
.category-rows { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  transition: background 0.15s ease;
}
.category-row:hover { background: var(--paper-soft); }
.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 11%, transparent);
  flex: none;
}
.cat-icon .icon { width: 17px; height: 17px; }
.cat-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cat-main strong { font-size: 11.5px; font-weight: 650; }
.cat-main small { overflow: hidden; margin-top: 1px; color: var(--muted-soft); font-size: 8.5px; text-overflow: ellipsis; white-space: nowrap; }
.cat-amount { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.cat-amount strong { font-family: var(--font-num); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-amount span { color: var(--muted-soft); font-size: 8.5px; }
.merge-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}
.merge-note .icon { width: 12px; height: 12px; color: var(--amber); flex: none; }
.merge-note strong { color: var(--ink-soft); font-weight: 650; }
.category-empty, .platform-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 180px; gap: 5px; color: var(--muted); text-align: center; }
.category-empty strong, .platform-empty strong { color: var(--ink-soft); font-size: 12px; }
.category-empty span, .platform-empty span { font-size: 10px; }

.platform-rows { display: flex; flex-direction: column; gap: 13px; margin-top: 22px; }
.platform-row { display: flex; align-items: center; gap: 10px; }
.platform-row .platform-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 10px; }
.platform-row-main { flex: 1; min-width: 0; }
.platform-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10.5px; }
.platform-row-head strong { font-weight: 600; }
.platform-row-head span { color: var(--muted); font-family: var(--font-num); font-size: 12px; }
.platform-track { height: 4px; margin-top: 5px; border-radius: 4px; background: var(--paper-deep); overflow: hidden; }
.platform-track i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--c); opacity: 0.8; }
.platform-total { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; padding-top: 13px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 9.5px; }
.platform-total strong { color: var(--ink-soft); font-family: var(--font-num); font-size: 14px; font-weight: 500; }

.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr); gap: 17px; margin-top: 17px; }
.recent-panel { padding: 23px 24px 9px; }
.recent-list { margin-top: 13px; }
.recent-row {
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: rgba(247, 242, 232, 0.55); }
.recent-main { display: flex; flex-direction: column; min-width: 0; }
.recent-main strong { overflow: hidden; font-size: 11.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.recent-main span { overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.recent-main span b { font-weight: 500; color: var(--muted-soft); }
.recent-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.recent-amount strong { font-family: var(--font-num); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.recent-amount strong.income { color: var(--green); }
.recent-amount span { color: var(--muted-soft); font-size: 8px; }
.recent-empty { padding: 30px 0 35px; text-align: center; color: var(--muted); font-size: 11px; }

.member-panel { display: flex; flex-direction: column; padding: 23px 24px 19px; }
.member-contrib { display: flex; flex-direction: column; gap: 13px; margin-top: 19px; }
.member-contrib-row { display: flex; align-items: center; gap: 9px; }
.member-contrib-row .avatar { width: 29px; height: 29px; font-size: 11px; }
.member-contrib-main { flex: 1; min-width: 0; }
.member-contrib-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; }
.member-contrib-head strong { font-weight: 600; }
.member-contrib-head span { color: var(--muted); font-family: var(--font-num); font-size: 11px; }
.member-track { height: 3px; margin-top: 5px; border-radius: 3px; background: var(--paper-deep); overflow: hidden; }
.member-track i { display: block; height: 100%; width: var(--w); background: var(--forest-mid); border-radius: inherit; opacity: 0.66; }
.invite-mini {
  margin-top: auto;
  padding-top: 17px;
}
.invite-mini-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 13px;
  border: 1px dashed rgba(27, 42, 35, 0.16);
  border-radius: 12px;
  background: var(--paper-soft);
}
.invite-mini-copy { display: flex; flex-direction: column; gap: 2px; }
.invite-mini-copy span { color: var(--muted); font-size: 8.5px; }
.invite-mini-copy strong { font-family: var(--font-num); font-size: 15px; font-weight: 500; letter-spacing: 0.14em; }
.invite-mini .btn { min-height: 28px; padding: 5px 9px; font-size: 9.5px; border-radius: 7px; }

/* Empty overview */
.empty-welcome {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  min-height: 290px;
  margin-bottom: 17px;
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, #173c30, #1e4a3a);
  color: #f5efe3;
}
.empty-welcome-copy { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; padding: 38px 40px; }
.empty-welcome h1 { max-width: 430px; margin-top: 11px; font-family: var(--font-display); font-size: 39px; font-weight: 500; line-height: 1.16; letter-spacing: -0.03em; }
.empty-welcome p { max-width: 430px; margin-top: 12px; color: rgba(245, 239, 227, 0.58); font-size: 12px; line-height: 1.8; }
.empty-welcome-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.empty-welcome .btn-primary { background: var(--amber); color: #33230f; }
.empty-welcome .btn-primary:hover { background: #e4b470; }
.empty-welcome .btn-outline { color: #f5efe3; border-color: rgba(245, 239, 227, 0.24); background: transparent; }
.empty-welcome .btn-outline:hover { background: rgba(245, 239, 227, 0.08); }
.empty-illustration { position: relative; display: flex; align-items: center; justify-content: center; padding: 26px; border-left: 1px solid rgba(245, 239, 227, 0.1); background: rgba(7, 28, 21, 0.12); }
.paper-stack { position: relative; width: 180px; height: 180px; }
.paper-stack i { position: absolute; inset: 20px 8px 8px 20px; border: 1px solid rgba(245, 239, 227, 0.15); border-radius: 10px; background: rgba(245, 239, 227, 0.035); transform: rotate(-7deg); }
.paper-stack i:nth-child(2) { inset: 10px 15px 18px 13px; transform: rotate(4deg); background: rgba(245, 239, 227, 0.055); }
.paper-stack i:nth-child(3) { inset: 22px 20px 8px 24px; transform: rotate(-1deg); background: rgba(245, 239, 227, 0.07); }
.paper-lines { position: absolute; inset: 36px 34px 32px 40px; z-index: 1; display: flex; flex-direction: column; gap: 13px; }
.paper-lines span { display: block; height: 1px; background: rgba(245, 239, 227, 0.23); }
.paper-lines span:nth-child(2) { width: 62%; }
.paper-lines span:nth-child(3) { width: 78%; }
.paper-lines span:nth-child(4) { width: 48%; }
.paper-stamp { position: absolute; z-index: 2; right: 12px; bottom: 16px; display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border: 1px solid rgba(217, 164, 91, 0.5); border-radius: 50%; color: var(--amber); font-family: var(--font-display); font-size: 17px; transform: rotate(-12deg); }

/* ---------------------------------------------------------
   Transactions
   --------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.7);
  box-shadow: 0 12px 36px -34px rgba(26, 44, 35, 0.46);
}
.search-box { position: relative; flex: 1; min-width: 140px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search-box input {
  width: 100%;
  height: 36px;
  padding: 8px 12px 8px 33px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--paper-soft);
  font-size: 11.5px;
}
.search-box input:focus { border-color: var(--line-strong); background: var(--card); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.06); }
.search-box input::placeholder { color: var(--muted-soft); }
.segmented { display: flex; padding: 3px; border-radius: 9px; background: var(--paper-soft); flex: none; }
.segmented button { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; }
.segmented button.is-active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px -4px rgba(26, 44, 35, 0.3); }
.select-wrap { position: relative; flex: none; }
.select-wrap select {
  height: 36px;
  min-width: 94px;
  padding: 0 27px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 10px;
  appearance: none;
  cursor: pointer;
}
.select-wrap .icon { position: absolute; right: 8px; top: 50%; width: 11px; height: 11px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.filter-clear { flex: none; }
.summary-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; padding: 14px 4px 10px; color: var(--muted); font-size: 10px; }
.summary-strip strong { color: var(--ink-soft); font-family: var(--font-num); font-size: 12px; font-weight: 500; }
.summary-strip .sep { width: 1px; height: 11px; background: var(--line); }

.tx-groups { margin-top: 2px; }
.tx-group { margin-top: 16px; }
.tx-date-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 5px 8px; border-bottom: 1px solid var(--line); }
.tx-date-left { display: flex; align-items: baseline; gap: 7px; }
.tx-date-left strong { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.tx-date-left span { color: var(--muted); font-size: 9.5px; }
.tx-date-sum { color: var(--muted); font-size: 9.5px; }
.tx-date-sum b { color: var(--ink-soft); font-family: var(--font-num); font-size: 12px; font-weight: 500; }
.tx-rows { background: rgba(255, 253, 248, 0.34); }
.tx-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 63px;
  padding: 10px 7px;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s ease;
}
.tx-row:last-child { border-bottom: 0; }
.tx-row:hover { background: rgba(255, 253, 248, 0.7); }
.tx-row:hover .tx-actions { opacity: 1; transform: translateX(0); }
.tx-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--cat-color) 10%, transparent); color: var(--cat-color); }
.tx-icon .icon { width: 18px; height: 18px; }
.tx-body { display: flex; flex-direction: column; min-width: 0; }
.tx-title { overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 3px; color: var(--muted); font-size: 9px; }
.tx-meta .platform-chip { font-size: 9px; }
.tx-meta .dot-sep { width: 2px; height: 2px; border-radius: 50%; background: var(--muted-soft); }
.tx-member { display: inline-flex; align-items: center; gap: 3px; color: var(--muted-soft); }
.tx-member .mini-avatar { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: var(--paper-deep); font-size: 7px; color: var(--ink-soft); }
.tx-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 92px; }
.tx-amount strong { font-family: var(--font-num); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tx-amount strong.income { color: var(--green); }
.tx-amount span { color: var(--muted-soft); font-size: 8px; }
.tx-actions { display: flex; align-items: center; gap: 1px; opacity: 0; transform: translateX(4px); transition: 0.15s ease; }
.tx-actions button { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.tx-actions button:hover { background: var(--paper-soft); color: var(--ink); }
.tx-actions button[data-action="delete-tx"]:hover { color: var(--red); background: var(--red-soft); }
.tx-actions .icon { width: 14px; height: 14px; }
.tx-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; margin-top: 17px; border: 1px dashed var(--line-strong); border-radius: 18px; text-align: center; }
.tx-empty-icon { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: 13px; border-radius: 14px; background: var(--paper-soft); color: var(--muted); }
.tx-empty-icon .icon { width: 22px; height: 22px; }
.tx-empty h3 { font-family: var(--font-display); font-size: 20px; font-weight: 500; }
.tx-empty p { max-width: 300px; margin-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.tx-empty .btn { margin-top: 15px; }

/* ---------------------------------------------------------
   Platforms
   --------------------------------------------------------- */

.merge-board { padding: 25px 26px; }
.merge-board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.merge-board-intro { max-width: 540px; }
.merge-board-intro p { margin-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.merge-groups { display: flex; flex-direction: column; margin-top: 18px; }
.merge-group { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 16px; padding: 13px 2px; border-top: 1px solid var(--line); }
.merge-group:last-child { border-bottom: 1px solid var(--line); }
.merge-cat { display: flex; align-items: center; gap: 9px; }
.merge-cat .cat-icon { width: 32px; height: 32px; }
.merge-cat-copy { display: flex; flex-direction: column; gap: 1px; }
.merge-cat-copy strong { font-size: 11.5px; }
.merge-cat-copy span { color: var(--muted-soft); font-size: 8.5px; }
.merge-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 9.5px;
  transition: 0.15s ease;
}
.rule-pill:hover { border-color: var(--line-strong); background: var(--card); transform: translateY(-1px); }
.rule-pill .dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.rule-pill .native { color: var(--muted); }
.rule-pill .icon { width: 10px; height: 10px; color: var(--muted-soft); }
.add-rule-pill { border-style: dashed; background: transparent; color: var(--muted); }
.add-rule-pill:hover { color: var(--forest); border-color: rgba(23, 60, 48, 0.36); }
.merge-empty { padding: 25px 0; color: var(--muted); font-size: 10.5px; text-align: center; }

.platform-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 27px 0 13px; }
.platform-section-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.platform-section-head p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 13px; }
.platform-card { padding: 17px 17px 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 253, 248, 0.62); transition: 0.18s ease; }
.platform-card:hover { background: var(--card); border-color: var(--line-strong); }
.platform-card-head { display: flex; align-items: center; gap: 10px; }
.platform-card-head .platform-mark { width: 35px; height: 35px; border-radius: 10px; font-size: 12px; }
.platform-card-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.platform-card-title strong { font-size: 12px; }
.platform-card-title span { color: var(--muted); font-size: 8.5px; }
.platform-card-head .link-btn { font-size: 9px; }
.native-list { display: flex; flex-direction: column; gap: 3px; margin-top: 13px; padding-top: 10px; border-top: 1px dashed var(--line); }
.native-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  transition: background 0.14s ease;
}
.native-row:hover { background: var(--paper-soft); }
.native-row .native-name { flex: 1; min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.native-row .arrow { color: var(--muted-soft); font-size: 10px; }
.cat-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--cat-color) 9%, transparent); color: var(--cat-color); font-size: 8.5px; font-weight: 600; white-space: nowrap; }
.cat-chip::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.native-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 5px 4px; color: var(--muted-soft); font-size: 9.5px; }
.native-empty button { border: 0; background: transparent; color: var(--green); font-size: 9.5px; font-weight: 600; padding: 2px; }

.platform-summary-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-soft); color: var(--muted); font-size: 9.5px; }
.platform-summary-bar strong { color: var(--ink-soft); font-weight: 650; }
.platform-summary-bar .sep { width: 1px; height: 10px; background: var(--line-strong); }

/* ---------------------------------------------------------
   Members
   --------------------------------------------------------- */

.invite-board {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  padding: 29px 32px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(217, 164, 91, 0.17), transparent 62%),
    linear-gradient(120deg, #122f26, #1c4738);
  color: #f5efe3;
  box-shadow: 0 28px 62px -46px rgba(15, 45, 36, 0.7);
}
.invite-board::before { content: ""; position: absolute; width: 280px; height: 280px; right: 22%; top: -180px; border: 1px solid rgba(245, 239, 227, 0.1); border-radius: 50%; box-shadow: inset 0 0 0 45px rgba(245, 239, 227, 0.015); }
.invite-board-copy { position: relative; z-index: 1; }
.invite-board-copy h2 { margin-top: 7px; font-family: var(--font-display); font-size: 29px; font-weight: 500; letter-spacing: -0.025em; }
.invite-board-copy p { max-width: 460px; margin-top: 7px; color: rgba(245, 239, 227, 0.54); font-size: 10.5px; line-height: 1.75; }
.invite-board-actions { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.invite-code-box { display: flex; align-items: center; gap: 11px; padding: 11px 13px 11px 17px; border: 1px solid rgba(245, 239, 227, 0.17); border-radius: 12px; background: rgba(245, 239, 227, 0.06); backdrop-filter: blur(10px); }
.invite-code-box span { color: rgba(245, 239, 227, 0.4); font-size: 8.5px; letter-spacing: 0.08em; }
.invite-code-box strong { font-family: var(--font-num); font-size: 24px; font-weight: 400; letter-spacing: 0.22em; }
.invite-code-box .icon-btn { width: 30px; height: 30px; color: rgba(245, 239, 227, 0.7); border-color: rgba(245, 239, 227, 0.16); }
.invite-code-box .icon-btn:hover { background: rgba(245, 239, 227, 0.1); color: #fff; }
.invite-board-actions .link-btn { color: rgba(245, 239, 227, 0.43); font-size: 9px; }
.invite-board-actions .link-btn:hover { color: rgba(245, 239, 227, 0.8); }

.members-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 27px 0 12px; }
.members-head h2 { font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.members-head p { color: var(--muted); font-size: 10px; }
.members-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.member-card { padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 253, 248, 0.64); }
.member-card-top { display: flex; align-items: center; gap: 11px; }
.member-card-top .avatar { width: 43px; height: 43px; font-size: 17px; }
.member-card-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.member-card-name strong { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.member-card-name span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.member-card-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.member-card-stats div { display: flex; flex-direction: column; gap: 1px; }
.member-card-stats span { color: var(--muted); font-size: 8.5px; }
.member-card-stats strong { font-family: var(--font-num); font-size: 19px; font-weight: 500; }
.member-card-stats small { color: var(--muted-soft); font-size: 8px; }
.member-card-bar { height: 3px; margin-top: 13px; border-radius: 3px; background: var(--paper-deep); overflow: hidden; }
.member-card-bar i { display: block; height: 100%; width: var(--w); background: var(--forest-mid); border-radius: inherit; opacity: 0.55; }
.member-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 17px; padding: 13px 15px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 9.5px; line-height: 1.7; }
.member-note .icon { width: 14px; height: 14px; margin-top: 1px; color: var(--amber); flex: none; }
.member-note strong { color: var(--ink-soft); }

/* ---------------------------------------------------------
   Settings
   --------------------------------------------------------- */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 17px; align-items: start; }
.settings-card { padding: 24px 25px; }
.settings-card + .settings-card { margin-top: 0; }
.settings-card h2 { font-family: var(--font-display); font-size: 21px; font-weight: 500; letter-spacing: -0.02em; }
.settings-card > p { margin-top: 5px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.settings-form { display: flex; flex-direction: column; gap: 13px; margin-top: 18px; }
.settings-form .btn { align-self: flex-start; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row-copy { display: flex; flex-direction: column; gap: 3px; }
.settings-row-copy strong { font-size: 11.5px; font-weight: 650; }
.settings-row-copy span { color: var(--muted); font-size: 9.5px; line-height: 1.6; }
.settings-row .btn { flex: none; font-size: 10px; min-height: 33px; }
.account-line { display: flex; align-items: center; gap: 11px; margin-top: 18px; padding: 14px; border-radius: 13px; background: var(--paper-soft); }
.account-line .avatar { width: 38px; height: 38px; }
.account-line div { display: flex; flex-direction: column; gap: 2px; }
.account-line strong { font-size: 12px; }
.account-line span { color: var(--muted); font-size: 9.5px; }
.about-mark { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.about-mark .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.about-mark div { display: flex; flex-direction: column; }
.about-mark strong { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.05em; }
.about-mark span { color: var(--muted); font-size: 8.5px; }
.about-copy { margin-top: 13px; color: var(--muted); font-size: 9.8px; line-height: 1.8; }
.about-copy strong { color: var(--ink-soft); }
.settings-code { margin-top: 14px; padding: 12px 13px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--card-soft); }
.settings-code span { display: block; color: var(--muted); font-size: 8.5px; }
.settings-code strong { display: block; margin-top: 3px; font-family: var(--font-num); font-size: 19px; font-weight: 500; letter-spacing: 0.18em; }
.settings-code .btn { margin-top: 9px; }

/* ---------------------------------------------------------
   Modal / sheet
   --------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 32, 25, 0.5);
  backdrop-filter: blur(7px);
  animation: fadeIn 0.18s ease;
}
.modal {
  width: min(570px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 253, 248, 0.5);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 40px 100px -30px rgba(7, 25, 18, 0.55);
  animation: modalIn 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.modal-wide { width: min(760px, 100%); }
.modal-sheet {
  width: min(560px, 100%);
  height: calc(100vh - 24px);
  max-height: none;
  margin: 12px 12px 12px auto;
  border-radius: 24px;
  animation: sheetIn 0.28s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.modal-backdrop-sheet { align-items: stretch; justify-content: flex-end; padding: 0; }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 25px 17px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 237, 226, 0.94);
  backdrop-filter: blur(12px);
}
.modal-head h2 { margin-top: 4px; font-family: var(--font-display); font-size: 25px; font-weight: 500; letter-spacing: -0.025em; }
.modal-head p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.modal-close { display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--muted); flex: none; }
.modal-close:hover { color: var(--ink); border-color: var(--line-strong); }
.modal-close .icon { width: 15px; height: 15px; }
.modal-body { padding: 22px 25px 25px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal-foot-actions { display: flex; align-items: center; gap: 8px; }
.modal-subhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 19px 0 9px; }
.modal-subhead span { color: var(--muted); font-size: 9px; }

/* Ledger dialog */
.ledger-list { display: flex; flex-direction: column; gap: 6px; }
.ledger-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); text-align: left; transition: 0.15s ease; }
.ledger-option:hover { border-color: var(--line-strong); }
.ledger-option.is-current { border-color: rgba(23, 60, 48, 0.3); background: #fbfaef; box-shadow: inset 3px 0 0 var(--forest); }
.ledger-option-icon { display: inline-flex; align-items: center; justify-content: center; width: 33px; height: 33px; border-radius: 9px; background: var(--amber-soft); color: #8d6429; font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.ledger-option-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ledger-option-copy strong { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.ledger-option-copy span { color: var(--muted); font-size: 9px; }
.ledger-option .badge { font-size: 8.5px; }
.ledger-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 17px; }
.ledger-inline-form { margin-top: 15px; padding: 14px; border-radius: 12px; background: var(--card-soft); border: 1px solid var(--line); }
.ledger-inline-form .field { gap: 6px; }
.ledger-inline-form .btn { margin-top: 10px; }
.ledger-inline-form .form-note { margin-top: 8px; }
.ledger-switch-note { margin-top: 16px; padding: 10px 12px; border-radius: 9px; background: var(--paper-soft); color: var(--muted); font-size: 9px; line-height: 1.7; }

/* Transaction sheet */
.tx-sheet-body { padding-top: 18px; }
.tx-type-toggle { display: flex; padding: 4px; border-radius: 11px; background: var(--paper-deep); }
.tx-type-toggle button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; transition: 0.18s ease; }
.tx-type-toggle button.is-active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px -4px rgba(26, 44, 35, 0.32); }
.tx-type-toggle button[data-tx-type="expense"].is-active { color: var(--clay); }
.tx-type-toggle button[data-tx-type="income"].is-active { color: var(--green); }
.amount-field { position: relative; display: flex; align-items: center; margin: 20px 0 4px; padding-bottom: 13px; border-bottom: 1px solid var(--line-strong); }
.amount-field .currency { color: var(--muted); font-family: var(--font-num); font-size: 28px; }
.amount-field input { width: 100%; min-width: 0; padding: 0 0 0 8px; border: 0; background: transparent; color: var(--ink); font-family: var(--font-num); font-size: 45px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.1; }
.amount-field input::placeholder { color: var(--muted-soft); }
.amount-field input:focus { outline: none; }
.amount-caption { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted-soft); font-size: 9px; }
.tx-sheet-section { margin-top: 21px; }
.tx-sheet-section > .section-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.tx-sheet-section .section-label strong { font-size: 11px; font-weight: 650; }
.tx-sheet-section .section-label span { color: var(--muted); font-size: 9px; }
.category-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.category-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  padding: 7px 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--card-soft);
  color: var(--muted);
  font-size: 9px;
  transition: 0.15s ease;
}
.category-choice .icon { width: 17px; height: 17px; }
.category-choice:hover { background: var(--card); border-color: var(--line); color: var(--ink-soft); }
.category-choice.is-active { border-color: color-mix(in srgb, var(--cat-color) 45%, transparent); background: color-mix(in srgb, var(--cat-color) 9%, var(--card)); color: var(--cat-color); font-weight: 650; }
.category-picker.is-locked { pointer-events: none; opacity: 0.66; }
.category-picker.is-locked .category-choice.is-active { opacity: 1; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.sheet-field { display: flex; flex-direction: column; gap: 6px; }
.sheet-field > span { color: var(--ink-soft); font-size: 10px; font-weight: 650; }
.sheet-field input, .sheet-field select, .sheet-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  font-size: 11px;
}
.field-required, .field-optional {
  margin-left: 4px;
  font-style: normal;
  font-size: 8px;
  font-weight: 500;
}
.field-required { color: var(--clay); }
.field-optional { color: var(--muted-soft); }
.sheet-field textarea { min-height: 62px; resize: vertical; }
.sheet-field input:focus, .sheet-field select:focus, .sheet-field textarea:focus { border-color: rgba(54, 114, 91, 0.5); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.07); }
.platform-category-wrap { position: relative; }
.platform-category-wrap input {
  width: 100%;
  min-height: 40px;
  padding: 8px 84px 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--card);
  font-size: 11px;
}
.platform-category-wrap input:focus { border-color: rgba(54, 114, 91, 0.5); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.07); }
.platform-category-wrap .mapped-tag { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.mapping-hint { display: flex; align-items: center; gap: 6px; min-height: 17px; margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.mapping-hint .icon { width: 11px; height: 11px; flex: none; }
.mapping-hint.is-mapped { color: var(--green); }
.mapping-hint.is-new { color: #97713b; }
.platform-select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tx-sheet-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 23px -25px -25px; padding: 15px 25px; border-top: 1px solid var(--line); background: rgba(242, 237, 226, 0.94); backdrop-filter: blur(12px); }
.tx-sheet-foot .btn-primary { min-width: 128px; }
.tx-delete-inline { color: var(--muted); font-size: 9.5px; }
.tx-delete-inline:hover { color: var(--red); }

.comment-count-inline { display: inline-flex; align-items: center; gap: 2px; color: var(--muted-soft); font-size: 8.5px; }
.comment-count-inline .icon { width: 10px; height: 10px; }

.tx-comments {
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px dashed var(--line-strong);
}
.tx-comments-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tx-comments-head > div { display: flex; align-items: baseline; gap: 7px; }
.tx-comments-head strong { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650; }
.tx-comments-head strong .icon { width: 13px; height: 13px; color: var(--green); }
.tx-comments-head span { color: var(--muted); font-size: 8.5px; }
.tx-comments-head .link-btn { font-size: 8.5px; }
.tx-comment-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 210px;
  margin-top: 11px;
  padding-right: 2px;
  overflow-y: auto;
}
.tx-comment { display: flex; align-items: flex-start; gap: 7px; }
.tx-comment .avatar { width: 26px; height: 26px; font-size: 10px; }
.tx-comment-body { flex: 1; min-width: 0; }
.tx-comment-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tx-comment-top strong { color: var(--ink-soft); font-size: 9.5px; font-weight: 650; }
.tx-comment-top span { color: var(--muted-soft); font-size: 7.5px; }
.tx-comment-body p {
  margin-top: 2px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 3px 9px 9px 9px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.65;
  word-break: break-word;
}
.tx-comment-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-soft);
  flex: none;
}
.tx-comment-delete:hover { background: var(--red-soft); color: var(--red); }
.tx-comment-delete .icon { width: 11px; height: 11px; }
.tx-comment-empty, .tx-comment-loading { padding: 13px 0 8px; color: var(--muted-soft); font-size: 9px; text-align: center; }
.tx-comment-input { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.tx-comment-input input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
  font-size: 10px;
}
.tx-comment-input input:focus { border-color: rgba(54, 114, 91, 0.5); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.07); outline: none; }
.tx-comment-input .btn { min-height: 32px; padding: 5px 10px; border-radius: 8px; font-size: 9px; }
.tx-comment-input .btn .icon { width: 12px; height: 12px; }
.sheet-note { margin-top: 12px; color: var(--muted-soft); font-size: 8.5px; line-height: 1.6; }

/* Confirm */
.confirm-layer { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 32, 25, 0.45); backdrop-filter: blur(4px); animation: fadeIn 0.15s ease; }
.confirm-card { width: min(380px, 100%); padding: 23px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow-float); animation: modalIn 0.2s ease; }
.confirm-card h3 { font-family: var(--font-display); font-size: 21px; font-weight: 500; }
.confirm-card p { margin-top: 6px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-actions .btn { min-height: 34px; padding: 6px 13px; font-size: 10.5px; }

/* Mapping / category dialog bits */
.mapping-preview { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 11px; background: var(--card-soft); border: 1px solid var(--line); }
.mapping-preview .platform-mark { width: 32px; height: 32px; }
.mapping-preview-copy { display: flex; flex-direction: column; gap: 1px; }
.mapping-preview-copy strong { font-size: 11.5px; }
.mapping-preview-copy span { color: var(--muted); font-size: 9px; }
.mapping-preview .arrow-line { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 9px; }
.mapping-arrow { display: inline-flex; align-items: center; justify-content: center; width: 20px; color: var(--muted-soft); }
.mapping-arrow .icon { width: 13px; height: 13px; }
.form-grid { display: flex; flex-direction: column; gap: 13px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 13px; color: var(--ink-soft); font-size: 10px; line-height: 1.6; cursor: pointer; }
.checkbox-line input { width: 14px; height: 14px; margin: 2px 0 0; accent-color: var(--forest); flex: none; }
.checkbox-line small { display: block; color: var(--muted); font-size: 9px; }
.color-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.color-swatch { width: 25px; height: 25px; border: 2px solid transparent; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07); }
.color-swatch.is-active { border-color: var(--card); box-shadow: 0 0 0 2px var(--forest), inset 0 0 0 1px rgba(0, 0, 0, 0.07); }
.mapping-delete { margin-top: 18px; padding-top: 13px; border-top: 1px dashed var(--line); }
.mapping-delete .btn { min-height: 30px; padding: 4px 9px; font-size: 9.5px; }

/* Toast */
.toast-root { position: fixed; z-index: 90; right: 22px; bottom: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 253, 248, 0.14);
  border-radius: 10px;
  background: #173c30;
  color: #f7f1e5;
  box-shadow: 0 16px 40px -18px rgba(7, 25, 18, 0.65);
  font-size: 10.5px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toastIn 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.toast.is-error { background: #7f3329; }
.toast .icon { width: 14px; height: 14px; color: var(--amber); flex: none; }
.toast.is-error .icon { color: #f4c5ba; }
.toast.is-leaving { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------
   Conversational bookkeeping
   --------------------------------------------------------- */

.page-chat { padding-bottom: 28px; }
.chat-head { margin-bottom: 18px; }
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 17px;
}
.chat-shell {
  display: flex;
  flex-direction: column;
  height: min(760px, calc(100vh - 195px));
  min-height: 540px;
  overflow: hidden;
}
.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 23px 20px;
  background:
    radial-gradient(420px 240px at 100% 0%, rgba(217, 164, 91, 0.06), transparent 65%),
    repeating-linear-gradient(0deg, transparent, transparent 35px, rgba(27, 42, 35, 0.038) 36px),
    var(--card);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.chat-day-sep { display: flex; justify-content: center; margin: 1px 0 15px; }
.chat-day-sep span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--muted-soft);
  font-size: 8.5px;
}
.chat-message { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; }
.chat-message.is-user { justify-content: flex-end; }
.chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  margin-top: 1px;
  border-radius: 9px;
  background: var(--forest);
  color: #f4ead9;
  font-family: var(--font-display);
  font-size: 13px;
  flex: none;
}
.chat-message-body { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 81%; min-width: 0; }
.chat-message.is-user .chat-message-body { align-items: flex-end; }
.chat-bubble {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.8;
  word-break: break-word;
}
.chat-bubble b { color: var(--ink); font-weight: 650; }
.chat-message.is-user .chat-bubble {
  border-color: transparent;
  border-radius: 14px 4px 14px 14px;
  background: var(--forest);
  color: #f6efe2;
}
.chat-message.is-success .chat-bubble { border-color: rgba(54, 114, 91, 0.16); background: var(--green-soft); color: var(--green); }
.chat-message.is-error .chat-bubble { border-color: rgba(177, 79, 63, 0.13); background: var(--red-soft); color: var(--red); }
.chat-message.is-thinking .chat-bubble { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.chat-dots { display: inline-flex; align-items: center; gap: 3px; }
.chat-dots i { display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); animation: chatDot 1.1s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.14s; }
.chat-dots i:nth-child(3) { animation-delay: 0.28s; }
@keyframes chatDot { 0%, 70%, 100% { opacity: 0.3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
.chat-meta { padding: 0 3px; color: var(--muted-soft); font-size: 7.5px; }
.chat-starters { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0 0 37px; }
.chat-starter {
  padding: 5px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
  text-align: left;
  transition: 0.15s ease;
}
.chat-starter:hover { border-style: solid; background: var(--paper-soft); color: var(--forest); }

.chat-draft {
  margin: 18px 0 1px;
  overflow: hidden;
  border: 1px solid rgba(217, 164, 91, 0.3);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 18px 40px -34px rgba(26, 44, 35, 0.4);
}
.chat-draft-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(243, 229, 206, 0.56), rgba(255, 253, 248, 0.3));
}
.chat-draft-head strong { display: block; margin-top: 2px; font-family: var(--font-display); font-size: 18px; font-weight: 500; }
.chat-draft-total { color: var(--muted); font-size: 9px; line-height: 1.6; text-align: right; }
.chat-draft-list { display: flex; flex-direction: column; gap: 7px; padding: 9px; }
.chat-draft-item { padding: 9px 10px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card-soft); }
.chat-draft-item-head { display: flex; align-items: center; gap: 7px; }
.draft-cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 10%, transparent);
  flex: none;
}
.draft-cat-icon .icon { width: 15px; height: 15px; }
.draft-note {
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}
.draft-note:hover { border-color: var(--line); }
.draft-note:focus { border-color: var(--line-strong); background: var(--card); outline: none; }
.draft-inferred, .draft-type {
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 7px;
  font-weight: 700;
  white-space: nowrap;
}
.draft-inferred { background: var(--amber-soft); color: #8d6429; }
.draft-type { background: var(--paper); color: var(--muted); }
.draft-type.income { background: var(--green-soft); color: var(--green); }
.draft-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-soft);
  flex: none;
}
.draft-remove:hover { background: var(--red-soft); color: var(--red); }
.draft-remove .icon { width: 11px; height: 11px; }
.chat-draft-fields { display: grid; grid-template-columns: 92px minmax(78px, 1fr) minmax(78px, 1fr) 117px; gap: 6px; margin-top: 7px; }
.draft-amount {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
}
.draft-amount > span { color: var(--muted); font-family: var(--font-num); font-size: 11px; }
.draft-amount input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-num);
  font-size: 13px;
}
.draft-amount input:focus { outline: none; }
.draft-amount:focus-within { border-color: rgba(54, 114, 91, 0.5); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.06); }
.draft-select {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  height: 34px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
}
.draft-select > span { color: var(--muted-soft); font-size: 7px; }
.draft-select select, .draft-select input {
  width: 100%;
  min-width: 0;
  height: 17px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 9px;
}
.draft-select select { cursor: pointer; appearance: none; }
.draft-select:focus-within { border-color: rgba(54, 114, 91, 0.5); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.06); }
.draft-select select:focus, .draft-select input:focus { outline: none; }
.draft-date input { font-size: 8.5px; }
.chat-draft-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  background: var(--card-soft);
}
.chat-draft-foot > span { color: var(--muted-soft); font-size: 8.5px; }
.chat-draft-foot > div { display: flex; align-items: center; gap: 5px; }
.chat-draft-foot .btn { min-height: 30px; padding: 4px 10px; font-size: 9.5px; border-radius: 8px; }

.chat-composer-wrap { padding: 11px 14px 9px; border-top: 1px solid var(--line); background: var(--card); }
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 5px 5px 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--card-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.chat-composer:focus-within { border-color: rgba(54, 114, 91, 0.55); box-shadow: 0 0 0 3px rgba(54, 114, 91, 0.07); background: var(--card); }
.chat-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-soft);
  color: var(--forest);
  flex: none;
  transition: 0.18s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
.chat-voice:hover { border-color: var(--line-strong); background: var(--card); }
.chat-voice.is-listening {
  border-color: transparent;
  background: var(--clay);
  color: #fff9f1;
  animation: voicePulse 1.5s ease-in-out infinite;
}
.chat-voice .icon { width: 16px; height: 16px; }
.chat-voice-status {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 2px 0;
  color: var(--clay);
  font-size: 9px;
  line-height: 1.55;
}
#chat-voice-message { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.chat-voice-status.is-error { color: var(--red); }
.voice-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 13%, transparent);
  flex: none;
  animation: voiceDot 1.1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(203, 115, 80, 0.24); }
  50% { box-shadow: 0 0 0 7px rgba(203, 115, 80, 0); }
}
@keyframes voiceDot { 50% { opacity: 0.35; transform: scale(0.8); } }
.chat-composer textarea {
  flex: 1;
  min-height: 36px;
  max-height: 100px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.65;
  resize: none;
}
.chat-composer textarea:focus { outline: none; }
.chat-composer textarea::placeholder { color: var(--muted-soft); }
.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--forest);
  color: #f5ede0;
  flex: none;
  transition: 0.18s ease;
}
.chat-send:hover { background: var(--forest-mid); transform: translateY(-1px); }
.chat-send:disabled { opacity: 0.5; cursor: wait; transform: none; }
.chat-send .icon { width: 15px; height: 15px; }
.chat-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; color: var(--muted-soft); font-size: 7.5px; }
.chat-composer-foot kbd { padding: 1px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--card); font-size: 7px; }

.chat-side { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 13px; }
.chat-guide { padding: 20px; }
.chat-guide h2 { margin-top: 4px; font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.chat-guide > p:not(.eyebrow) { margin-top: 5px; color: var(--muted); font-size: 9.8px; line-height: 1.75; }
.chat-examples { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.chat-example {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-soft);
  color: var(--ink-soft);
  font-size: 9.5px;
  line-height: 1.5;
  text-align: left;
  transition: 0.15s ease;
}
.chat-example:hover { border-color: var(--line-strong); background: var(--card); transform: translateX(2px); color: var(--forest); }
.chat-guide-small { background: rgba(255, 253, 248, 0.55); }
.chat-tips { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.chat-tips li { display: flex; flex-direction: column; gap: 2px; }
.chat-tips strong { color: var(--ink-soft); font-size: 9.8px; font-weight: 650; }
.chat-tips span { color: var(--muted); font-size: 9px; line-height: 1.65; }
.chat-local-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted-soft);
  font-size: 8.5px;
}
.chat-local-badge .icon { width: 12px; height: 12px; color: var(--green); }
.chat-ai-link { margin-top: 9px; color: var(--green); font-size: 8.5px; }

.quick-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-add-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 170px;
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: center;
  transition: 0.17s ease;
}
.quick-add-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.quick-add-card.is-chat { border-color: rgba(23, 60, 48, 0.2); background: linear-gradient(135deg, rgba(220, 231, 203, 0.45), var(--card)); }
.quick-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 9px;
  border-radius: 14px;
  background: var(--paper-soft);
  color: var(--forest);
}
.quick-add-card.is-chat .quick-add-icon { background: #007aff; color: #fff; }
.quick-add-icon .icon { width: 23px; height: 23px; }
.quick-add-card strong { font-size: 17px; font-weight: 700; }
.quick-add-card small { color: var(--muted); font-size: 11px; line-height: 1.6; }

.ai-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ai-settings-head h2 { margin-top: 0; }
.ai-settings-head > div > p { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.ai-settings-head .badge { flex: none; }
.ai-form { margin-top: 16px; }
.ai-toggle { margin-top: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-soft); }
.ai-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ai-presets > span { margin-right: 2px; color: var(--muted-soft); font-size: 8.5px; }
.ai-presets button {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
}
.ai-presets button:hover { border-color: var(--line-strong); background: var(--card); color: var(--ink-soft); }
.ai-form .form-error { margin-top: 0; }

/* ---------------------------------------------------------
   Mobile nav
   --------------------------------------------------------- */

.mobile-nav { display: none; }

/* ---------------------------------------------------------
   Animations
   --------------------------------------------------------- */

@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } }
@keyframes sheetIn { from { opacity: 0; transform: translateX(24px); } }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 1160px) {
  .page { padding: 28px 30px 58px; }
  .topbar { padding: 0 24px; }
  .hero-main { padding: 29px 30px; }
  .hero-side { padding: 25px 24px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .category-visual { grid-template-columns: 140px minmax(0, 1fr); gap: 16px; }
  .donut-wrap { width: 136px; height: 136px; }
  .donut-center strong { font-size: 16px; }
  .bottom-grid { grid-template-columns: 1fr; }
  .member-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .member-panel .panel-head { grid-column: 1 / -1; }
  .member-contrib { margin-top: 0; }
  .invite-mini { padding-top: 0; align-self: end; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 218px; }
  .sidebar { padding: 20px 14px 14px; }
  .nav-link { font-size: 12px; }
  .topbar-crumb strong { max-width: 150px; }
  .overview-grid { grid-template-columns: 1fr; }
  .platform-panel .platform-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
  .platform-panel .platform-total { grid-column: 1 / -1; }
  .settings-grid { grid-template-columns: 1fr; }
  .members-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { min-height: 100vh; padding: 26px 24px 22px; justify-content: flex-start; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 9px; align-self: flex-start; margin-bottom: 44px; }
  .auth-mobile-brand .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .auth-mobile-brand .brand-mark svg { width: 26px; height: 26px; }
  .auth-mobile-brand strong { font-family: var(--font-display); font-size: 19px; letter-spacing: 0.1em; }
  .auth-form-wrap { margin: auto; }
  .auth-panel-foot { margin-top: 30px; }

  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    grid-template-columns: 1fr auto;
    height: 60px;
    padding: 0 16px;
    gap: 8px;
  }
  .topbar-left { display: flex; min-width: 0; }
  .topbar-right { display: none; }
  .topbar-crumb { display: none; }
  .mobile-ledger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    height: 34px;
    padding: 4px 7px 4px 5px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 253, 248, 0.64);
  }
  .ledger-dot { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; background: var(--amber-soft); color: #8d6429; font-family: var(--font-display); font-size: 11px; font-weight: 700; }
  .mobile-ledger span:nth-child(2) { overflow: hidden; max-width: 140px; font-size: 11.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-ledger .icon { width: 12px; height: 12px; color: var(--muted); }
  .topbar .month-nav { justify-self: end; background: transparent; border-color: transparent; padding: 0; }
  .topbar .month-label { min-width: 100px; font-size: 12px; }
  .topbar .month-arrow { width: 26px; height: 26px; }
  .topbar .month-today { display: none !important; }
  .page { padding: 20px 16px 100px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 18px; }
  .page-head h1 { font-size: 31px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .overview-hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-main { padding: 28px 24px 22px; }
  .hero-side { border-left: 0; border-top: 1px solid rgba(245, 239, 227, 0.1); padding: 17px 24px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
  .hero-side-top { grid-column: 1 / -1; }
  .hero-spark { grid-column: 1 / -1; height: 45px; margin: 0; }
  .hero-spark-meta { grid-column: 1 / -1; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 14px; min-height: 96px; }
  .stat-value { font-size: 22px; }
  .overview-grid { gap: 13px; }
  .category-panel, .platform-panel { padding: 20px 18px 17px; }
  .platform-panel .platform-rows { grid-template-columns: 1fr; }
  .bottom-grid { gap: 13px; }
  .recent-panel { padding: 20px 18px 7px; }
  .member-panel { display: flex; padding: 20px 18px 17px; }
  .invite-mini { padding-top: 15px; }
  .filters { flex-wrap: wrap; padding: 9px; gap: 7px; }
  .search-box { flex-basis: 100%; }
  .segmented { flex: 1 1 100%; }
  .segmented button { flex: 1; }
  .select-wrap { flex: 1 1 calc(33.333% - 6px); }
  .select-wrap select { width: 100%; min-width: 0; }
  .filter-clear { flex: 1 1 100%; }
  .tx-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; min-height: 60px; padding: 9px 4px; }
  .tx-actions { display: none; }
  .tx-amount { min-width: 78px; }
  .tx-amount strong { font-size: 14px; }
  .tx-amount span { display: none; }
  .tx-row { cursor: pointer; }
  .merge-board { padding: 20px 18px; }
  .merge-group { grid-template-columns: 1fr; gap: 7px; padding: 12px 0; }
  .merge-cat { justify-content: flex-start; }
  .platform-grid { grid-template-columns: 1fr; }
  .platform-section-head { align-items: flex-start; flex-direction: column; gap: 9px; margin-top: 22px; }
  .platform-section-head .head-actions { width: 100%; }
  .invite-board { grid-template-columns: 1fr; padding: 24px 21px; gap: 17px; }
  .invite-board-copy h2 { font-size: 25px; }
  .invite-board-actions { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .invite-code-box { padding: 9px 10px 9px 13px; }
  .invite-code-box strong { font-size: 21px; }
  .members-grid { grid-template-columns: 1fr; }
  .members-head { margin-top: 23px; }
  .settings-card { padding: 20px 18px; }
  .mobile-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 5px 10px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(250, 246, 237, 0.94);
    backdrop-filter: blur(16px);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 46px; padding: 5px 0; color: var(--muted); font-size: 8.5px; }
  .mobile-nav a .icon { width: 19px; height: 19px; }
  .mobile-nav a.is-active { color: var(--forest); }
  .mobile-nav a.is-active .icon { color: var(--forest); }
  .mobile-add { display: inline-flex; align-items: center; justify-content: center; width: 43px; height: 43px; margin-top: -16px; border: 0; border-radius: 50%; background: var(--forest); color: #f7f1e5; box-shadow: 0 9px 22px -8px rgba(23, 60, 48, 0.65); }
  .mobile-add .icon { width: 21px; height: 21px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-radius: 22px 22px 0 0; animation: bottomIn 0.26s cubic-bezier(0.22, 0.8, 0.3, 1); }
  .modal-wide { width: 100%; }
  .modal-sheet { width: 100%; height: auto; max-height: 92vh; margin: 0; border-radius: 22px 22px 0 0; animation: bottomIn 0.26s cubic-bezier(0.22, 0.8, 0.3, 1); }
  .modal-backdrop-sheet { align-items: flex-end; }
  .modal-head { padding: 18px 18px 14px; border-radius: 22px 22px 0 0; }
  .modal-body { padding: 18px 18px 22px; }
  .modal-head h2 { font-size: 23px; }
  .tx-sheet-body { padding-top: 16px; }
  .tx-sheet-foot { margin: 20px -18px -22px; padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); }
  .toast-root { right: 14px; left: 14px; bottom: calc(74px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  @keyframes bottomIn { from { opacity: 0; transform: translateY(26px); } }
}

@media (max-width: 560px) {
  .auth-panel { padding: 20px 18px 18px; }
  .auth-mobile-brand { margin-bottom: 29px; }
  .auth-heading h2 { font-size: 28px; }
  .auth-form-wrap { width: 100%; }
  .auth-terms { font-size: 9.5px; }
  .field-row { grid-template-columns: 1fr; gap: 13px; }
  .hero-balance strong { font-size: 41px; }
  .hero-balance .currency { font-size: 20px; }
  .hero-balance small { font-size: 22px; }
  .hero-flows { gap: 13px; }
  .hero-meta { gap: 8px 13px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-label { font-size: 9px; }
  .stat-value { font-size: 20px; }
  .stat-foot { font-size: 8.5px; }
  .category-visual { grid-template-columns: 1fr; justify-items: center; gap: 14px; }
  .category-rows { width: 100%; }
  .donut-wrap { width: 142px; height: 142px; }
  .merge-note { align-items: flex-start; }
  .recent-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .recent-main strong { font-size: 11px; }
  .recent-main span { font-size: 8.5px; }
  .recent-amount strong { font-size: 12px; }
  .tx-date-left strong { font-size: 14px; }
  .tx-meta { font-size: 8.5px; }
  .tx-title { font-size: 11.5px; }
  .tx-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .tx-icon { width: 33px; height: 33px; }
  .tx-amount { min-width: 71px; }
  .tx-amount strong { font-size: 13.5px; }
  .summary-strip { gap: 7px 13px; padding: 11px 2px 4px; }
  .summary-strip .sep { display: none; }
  .invite-board-actions { flex-direction: column; align-items: stretch; }
  .invite-code-box { justify-content: space-between; }
  .members-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .member-card { padding: 17px; }
  .modal-head { padding: 16px 16px 12px; }
  .modal-body { padding: 16px 16px 20px; }
  .amount-field input { font-size: 40px; }
  .category-picker { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .category-choice { min-height: 55px; font-size: 8.5px; }
  .category-choice .icon { width: 16px; height: 16px; }
  .sheet-grid { grid-template-columns: 1fr; gap: 10px; }
  .platform-select-row { grid-template-columns: 1fr; }
  .tx-sheet-foot { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .tx-sheet-foot .btn-primary { min-width: 108px; }
  .toast-root { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .settings-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .settings-row .btn { align-self: stretch; }
}

@media (max-width: 360px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .month-label { min-width: 88px; padding: 0 4px; font-size: 11px; }
  .topbar .month-arrow { width: 22px; }
  .mobile-ledger span:nth-child(2) { max-width: 100px; }
  .mobile-ledger { padding-right: 4px; }
  .mobile-nav { padding-left: 6px; padding-right: 6px; }
  .mobile-nav a { width: 44px; font-size: 8px; }
  .mobile-add { width: 41px; height: 41px; }
  .page { padding-left: 13px; padding-right: 13px; }
  .category-choice { min-height: 52px; }
  .sheet-grid { gap: 8px; }
  .modal-head { padding-left: 14px; padding-right: 14px; }
  .modal-body { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 1160px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr) 272px; }
  .btn-chat-top span { display: none; }
  .btn-chat-top { padding: 6px 9px; }
}

@media (max-width: 980px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .chat-shell { height: min(760px, calc(100vh - 185px)); }
}

@media (max-width: 860px) {
  .page.page-chat { padding: 12px 16px 82px; }
  .page-chat .page-head { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 10px; }
  .page-chat .page-head .eyebrow { display: none; }
  .page-chat .page-head h1 { margin-top: 0; font-size: 27px; }
  .page-chat .page-head p:last-child { display: none; }
  .page-chat .head-actions { width: auto; gap: 6px; }
  .page-chat .head-actions .btn { flex: none; min-height: 32px; padding: 5px 8px; font-size: 9.5px; }
  .chat-shell { height: calc(100dvh - 185px); min-height: 480px; border-radius: 20px; }
  .chat-thread { padding: 14px 13px; }
  .chat-message-body { max-width: 88%; }
  .chat-bubble { padding: 9px 12px; font-size: 11px; }
  .chat-draft-head { padding: 10px 11px; }
  .chat-draft-head strong { font-size: 16px; }
  .chat-draft-total { font-size: 8px; }
  .chat-draft-list { padding: 8px; gap: 6px; }
  .chat-draft-item { padding: 8px 8px 9px; }
  .chat-draft-fields { grid-template-columns: 1fr 1fr; gap: 5px; }
  .draft-amount, .draft-select { height: 32px; }
  .chat-draft-foot { flex-direction: column; align-items: stretch; gap: 7px; padding: 8px 9px; }
  .chat-draft-foot > span { display: none; }
  .chat-draft-foot > div { justify-content: flex-end; }
  .chat-composer-wrap { padding: 8px 9px 7px; }
  .chat-composer textarea { min-height: 34px; font-size: 11px; }
  .chat-composer-foot span:last-child { display: none; }
}

@media (max-width: 560px) {
  .page.page-chat { padding: 10px 12px 76px; }
  .page-chat .page-head h1 { font-size: 25px; }
  .chat-shell { height: calc(100dvh - 174px); min-height: 460px; }
  .chat-draft-fields { grid-template-columns: 92px 1fr 1fr; }
  .draft-date { grid-column: 1 / -1; height: 31px; }
  .draft-date input { font-size: 9px; }
  .chat-message-body { max-width: 92%; }
  .chat-avatar { width: 25px; height: 25px; border-radius: 8px; font-size: 11px; }
  .chat-composer { border-radius: 12px; }
  .chat-send { width: 32px; height: 32px; }
  .chat-day-sep { margin-bottom: 10px; }
  .quick-add-grid { grid-template-columns: 1fr; gap: 12px; }
  .quick-add-card {
    min-height: 158px;
    padding: 24px 18px;
    gap: 7px;
  }
  .quick-add-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 10px;
    border-radius: 18px;
  }
  .quick-add-icon .icon { width: 27px; height: 27px; }
  .quick-add-card strong { font-size: 21px; }
  .quick-add-card small { font-size: 12px; line-height: 1.65; }
}

/* Mobile reading comfort: bigger type, stronger contrast, calmer headings. */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .page { font-size: 15px; }
  .page-head h1 {
    font-family: var(--font-body);
    font-size: 32px;
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.2;
  }
  .page-head > div > p:last-child { font-size: 13px; line-height: 1.7; }
  .eyebrow { font-size: 10.5px; letter-spacing: 0.13em; }
  .panel-head h2,
  .platform-section-head h2,
  .members-head h2,
  .settings-card h2,
  .chat-guide h2,
  .chat-draft-head strong {
    font-family: var(--font-body);
    font-weight: 650;
  }
  .panel-head h2 { font-size: 22px; }
  .panel-sub { font-size: 11.5px; line-height: 1.65; }
  .topbar .month-label { font-size: 13px; }
  .mobile-ledger span:nth-child(2) { font-size: 13px; }
  .mobile-nav a { font-size: 9.5px; }
  .mobile-nav a .icon { width: 20px; height: 20px; }
  .mobile-add { width: 46px; height: 46px; }

  .hero-kicker { font-size: 10.5px; }
  .hero-delta, .hero-flows { font-size: 11px; }
  .hero-flows b { font-size: 14px; }
  .hero-chat-link { min-height: 28px; padding: 4px 9px; font-size: 10.5px; }
  .hero-side-label { font-size: 10px; }
  .hero-count span { font-size: 9.5px; }
  .hero-spark-meta { font-size: 9px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 24px; }
  .stat-foot { font-size: 10px; line-height: 1.5; }

  .tx-title { font-size: 14px; font-weight: 650; line-height: 1.45; }
  .tx-meta { gap: 5px 7px; font-size: 10.5px; line-height: 1.6; }
  .tx-meta .platform-chip { font-size: 10px; }
  .tx-amount strong { font-size: 16px; }
  .tx-date-left strong { font-size: 16px; }
  .tx-date-left span { font-size: 10.5px; }
  .tx-date-sum { font-size: 10px; }
  .tx-row { min-height: 69px; }
  .tx-icon { width: 38px; height: 38px; }
  .recent-main strong { font-size: 13.5px; }
  .recent-main span { font-size: 10px; line-height: 1.55; }
  .comment-count-inline { font-size: 9.5px; }
  .summary-strip { font-size: 11px; line-height: 1.6; }
  .summary-strip strong { font-size: 13px; }

  .filters { padding: 10px; }
  .search-box input { height: 40px; font-size: 14px; }
  .segmented button { height: 34px; font-size: 12px; }
  .select-wrap select { height: 40px; font-size: 12.5px; }
  .filter-clear { font-size: 11px; }
  .btn { min-height: 42px; font-size: 13px; }
  .page-head .btn, .head-actions .btn { font-size: 12px; }
  .head-actions .btn { min-height: 40px; }

  .cat-icon { width: 36px; height: 36px; }
  .cat-main strong { font-size: 13px; }
  .cat-main small { font-size: 10px; }
  .cat-amount strong { font-size: 14px; }
  .cat-amount span { font-size: 9.5px; }
  .merge-note { font-size: 10.5px; line-height: 1.65; }
  .platform-row-head { font-size: 11.5px; }
  .platform-row-head span { font-size: 13px; }
  .platform-total { font-size: 10px; }
  .platform-total strong { font-size: 15px; }

  .modal-head h2 { font-size: 26px; }
  .modal-head p { font-size: 11.5px; line-height: 1.6; }
  .amount-field input { font-size: 46px; }
  .amount-caption { font-size: 10px; }
  .category-choice { min-height: 64px; font-size: 10.5px; }
  .category-choice .icon { width: 19px; height: 19px; }
  .sheet-field > span, .field > span { font-size: 12px; }
  .sheet-field input, .sheet-field select, .sheet-field textarea { min-height: 44px; font-size: 14px; }
  .sheet-note { font-size: 10px; line-height: 1.6; }
  .mapping-hint { font-size: 10px; }
  .tx-comments-head strong { font-size: 12px; }
  .tx-comments-head span { font-size: 10px; }
  .tx-comment-body p { font-size: 11.5px; }
  .tx-comment-top strong { font-size: 10.5px; }
  .tx-comment-top span { font-size: 8.5px; }
  .tx-comment-input input { height: 40px; font-size: 13px; }
  .tx-comment-input .btn { min-height: 36px; font-size: 11px; }
  .tx-sheet-foot .btn { font-size: 12px; }

  .settings-card > p { font-size: 11.5px; }
  .settings-row-copy strong { font-size: 13px; }
  .settings-row-copy span { font-size: 11px; line-height: 1.65; }
  .settings-row .btn { min-height: 36px; font-size: 11.5px; }
  .settings-form .field input { font-size: 14px; }
  .form-note { font-size: 10.5px; line-height: 1.65; }
  .account-line strong { font-size: 13px; }
  .account-line span { font-size: 10.5px; }
  .settings-code strong { font-size: 23px; }
  .about-copy { font-size: 11px; line-height: 1.8; }

  .page-chat .page-head h1 { font-family: var(--font-body); font-size: 30px; font-weight: 650; }
  .page-chat .head-actions .btn { min-height: 38px; font-size: 11px; }
  .chat-bubble { padding: 11px 13px; font-size: 14px; line-height: 1.75; }
  .chat-meta { font-size: 9px; }
  .chat-avatar { width: 29px; height: 29px; }
  .chat-draft-head strong { font-size: 18px; }
  .chat-draft-total { font-size: 9.5px; }
  .draft-note { font-size: 14px; }
  .chat-draft-fields { grid-template-columns: 1fr 1fr; gap: 6px; }
  .draft-amount, .draft-select { height: 40px; }
  .draft-amount input { font-size: 16px; }
  .draft-select > span { font-size: 8.5px; }
  .draft-select select, .draft-select input { font-size: 11.5px; }
  .draft-date input { font-size: 10.5px; }
  .chat-draft-foot .btn { min-height: 36px; font-size: 11.5px; }
  .chat-composer { gap: 6px; padding-left: 8px; }
  .chat-composer textarea { min-height: 40px; font-size: 16px; line-height: 1.6; }
  .chat-voice { width: 40px; height: 40px; }
  .chat-voice .icon { width: 18px; height: 18px; }
  .chat-send { width: 38px; height: 38px; }
  .chat-composer-foot { font-size: 8.5px; }
  .chat-voice-status { font-size: 10px; }
  .chat-example { font-size: 10.5px; }
  .chat-tips strong { font-size: 10.5px; }
  .chat-tips span { font-size: 10px; }
  .chat-starter { font-size: 10px; }
}

@media (max-width: 560px) {
  .page-head h1 { font-size: 30px; }
  .page-chat .page-head h1 { font-size: 28px; }
  .hero-balance strong { font-size: 43px; }
  .stat-value { font-size: 23px; }
  .filters { gap: 6px; }
  .select-wrap select { font-size: 12px; }
  .tx-amount strong { font-size: 15px; }
  .tx-title { font-size: 13.5px; }
  .tx-meta { font-size: 10px; }
  .chat-draft-fields { grid-template-columns: 1fr 1fr; }
  .draft-date { grid-column: 1 / -1; height: 36px; }
  .draft-date input { font-size: 11px; }
  .chat-composer textarea { font-size: 16px; }
  .chat-voice { width: 38px; height: 38px; }
  .chat-send { width: 36px; height: 36px; }
  .settings-row { gap: 7px; }
}

/* ---------------------------------------------------------
   Apple-inspired visual system
   System type, grouped background, white cards, blue actions,
   translucent chrome and iMessage-style conversation.
   --------------------------------------------------------- */

html { background: var(--paper); }
body {
  background:
    radial-gradient(1000px 520px at 8% -10%, rgba(0, 122, 255, 0.09), transparent 62%),
    radial-gradient(820px 400px at 100% 0%, rgba(175, 82, 222, 0.055), transparent 58%),
    var(--paper);
  letter-spacing: -0.01em;
}
::selection { background: #cce4ff; color: #003b82; }
button, input, select, textarea { font-family: var(--font-body); }

.brand-mark {
  background: linear-gradient(145deg, #0a84ff, #0066d6);
  box-shadow: 0 8px 20px -12px rgba(0, 122, 255, 0.65);
}
.brand-mark svg circle:last-child { stroke: #ffffff; }
.brand-copy strong { font-family: var(--font-body); font-weight: 700; letter-spacing: 0.02em; }
.brand-copy small { letter-spacing: 0.14em; }

.sidebar {
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(60, 60, 67, 0.09);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.ledger-switch {
  border-color: transparent;
  background: rgba(118, 118, 128, 0.08);
}
.ledger-switch:hover { background: rgba(118, 118, 128, 0.13); border-color: transparent; }
.ledger-switch-avatar { background: #e8f0ff; color: #007aff; }
.btn-new {
  background: #007aff;
  box-shadow: 0 10px 24px -16px rgba(0, 122, 255, 0.8);
}
.btn-new:hover { background: #0071e3; }
.btn-new kbd { color: rgba(255, 255, 255, 0.65); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.09); }
.nav-link { color: #52525a; }
.nav-link:hover { background: rgba(118, 118, 128, 0.08); color: var(--ink); }
.nav-link.is-active { background: rgba(0, 122, 255, 0.1); color: #0066cc; box-shadow: none; }
.nav-link.is-active .icon { color: #007aff; }
.btn-chat-top .icon { color: #007aff; }
.nav-tag { background: rgba(118, 118, 128, 0.11); color: #8e8e93; }
.nav-link.is-active .nav-tag { background: rgba(0, 122, 255, 0.12); color: #007aff; }
.sidebar-note { border-style: solid; border-color: transparent; background: rgba(118, 118, 128, 0.07); }
.sidebar-note .icon { color: #007aff; }
.user-menu { border-color: rgba(60, 60, 67, 0.1); box-shadow: 0 20px 50px -22px rgba(0, 0, 0, 0.25); }

.topbar {
  background: rgba(242, 242, 247, 0.8);
  border-bottom-color: rgba(60, 60, 67, 0.1);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.month-nav { background: rgba(255, 255, 255, 0.72); border-color: rgba(60, 60, 67, 0.1); }
.month-label { font-family: var(--font-body); font-weight: 600; }
.btn-outline { background: rgba(255, 255, 255, 0.64); border-color: rgba(60, 60, 67, 0.16); color: #3a3a3c; }
.btn-outline:hover { background: #ffffff; border-color: rgba(60, 60, 67, 0.24); }
.btn-ghost { background: #f2f2f7; border-color: transparent; }
.btn-ghost:hover { background: #e9e9ee; }
.btn-primary { background: #007aff; color: #ffffff; box-shadow: 0 8px 20px -14px rgba(0, 122, 255, 0.8); }
.btn-primary:hover { background: #0071e3; }
.btn-danger { background: #ffeceb; color: #ff3b30; border-color: transparent; }
.btn-danger:hover { background: #ffdedb; }
.btn-quiet:hover { background: #f2f2f7; }
.page-head h1 { font-family: var(--font-body); font-weight: 700; letter-spacing: -0.035em; }
.eyebrow { color: #8e8e93; font-weight: 600; letter-spacing: 0.13em; }
.panel { border-color: rgba(60, 60, 67, 0.08); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.025), 0 16px 36px -30px rgba(0, 0, 0, 0.22); }
.panel-head h2 { font-family: var(--font-body); font-weight: 650; letter-spacing: -0.025em; }
.link-btn { color: #007aff; }
.link-btn:hover { color: #0066cc; }
.badge { background: #f2f2f7; color: #6e6e73; }
.badge-green { background: #e9f9ee; color: #248a3d; }
.badge-amber { background: #fff4e5; color: #b26a00; }
.badge-clay { background: #ffece8; color: #d70015; }

/* Overview */
.overview-hero {
  background:
    radial-gradient(640px 320px at 96% 0%, rgba(10, 132, 255, 0.42), transparent 62%),
    linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 58%, #1c1c1e 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 70px -48px rgba(0, 0, 0, 0.55);
}
.overview-hero::after { display: none; }
.overview-hero::before { border-color: rgba(255, 255, 255, 0.08); }
.hero-kicker { color: rgba(255, 255, 255, 0.52); }
.hero-kicker i { background: #64d2ff; }
.hero-balance .currency { color: rgba(255, 255, 255, 0.44); }
.hero-balance strong { font-weight: 600; letter-spacing: -0.05em; }
.hero-balance small { color: rgba(255, 255, 255, 0.44); }
.hero-delta { border-color: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.62); }
.hero-delta.is-up { background: rgba(255, 214, 10, 0.09); color: #ffd60a; }
.hero-delta.is-down { background: rgba(48, 209, 88, 0.09); color: #30d158; }
.hero-flows { color: rgba(255, 255, 255, 0.5); }
.hero-flows b { color: rgba(255, 255, 255, 0.92); }
.hero-chat-link { border-color: rgba(100, 210, 255, 0.28); background: rgba(10, 132, 255, 0.12); color: rgba(255, 255, 255, 0.8); }
.hero-chat-link:hover { background: rgba(10, 132, 255, 0.22); color: #fff; }
.hero-chat-link .icon { color: #64d2ff; }
.hero-side { border-left-color: rgba(255, 255, 255, 0.08); background: rgba(0, 0, 0, 0.14); }
.hero-side-label { color: rgba(255, 255, 255, 0.38); }
.hero-members span:last-child { color: rgba(255, 255, 255, 0.45); }
.hero-count span { color: rgba(255, 255, 255, 0.35); }
.hero-spark-meta { color: rgba(255, 255, 255, 0.32); }
.hero-spark-meta strong { color: rgba(255, 255, 255, 0.62); }
.stat-card { background: rgba(255, 255, 255, 0.9); border-color: rgba(60, 60, 67, 0.07); }
.stat-card:hover { background: #fff; border-color: rgba(60, 60, 67, 0.13); }
.stat-value { font-weight: 600; }
.stat-label { color: #6e6e73; }
.stat-label .icon { color: #8e8e93; }
.stat-foot { color: #8e8e93; }
.stat-foot em { color: #248a3d; }
.stat-foot em.warn { color: #d70015; }
.merge-note { background: #f2f2f7; }
.merge-note .icon { color: #007aff; }
.platform-track, .member-track { background: #e9e9ee; }
.invite-mini-inner { border-style: solid; border-color: transparent; background: #f2f2f7; }
.empty-welcome {
  background:
    radial-gradient(600px 300px at 94% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(135deg, #0066d6, #0a84ff 58%, #5ac8fa);
}
.empty-welcome .btn-primary { background: #ffffff; color: #0066cc; }
.empty-welcome .btn-primary:hover { background: #f2f7ff; }
.empty-welcome .btn-outline { border-color: rgba(255, 255, 255, 0.4); }
.paper-stamp { border-color: rgba(255, 255, 255, 0.5); color: #fff; }

/* Lists and controls */
.filters { background: rgba(255, 255, 255, 0.76); border-color: rgba(60, 60, 67, 0.07); box-shadow: none; }
.search-box input { background: #e9e9ee; }
.search-box input:focus { background: #fff; border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16); }
.segmented { background: #e9e9ee; }
.segmented button.is-active { background: #fff; color: #1d1d1f; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.select-wrap select { background: #fff; border-color: rgba(60, 60, 67, 0.1); }
.tx-rows { background: transparent; }
.tx-row:hover { background: rgba(255, 255, 255, 0.72); }
.tx-icon { border-radius: 12px; }
.tx-title { color: #1d1d1f; }
.tx-meta { color: #8e8e93; }
.tx-amount strong { color: #1d1d1f; font-weight: 600; }
.tx-amount strong.income { color: #248a3d; }
.tx-actions button:hover { background: #f2f2f7; }
.comment-count-inline { color: #8e8e93; }
.summary-strip { color: #8e8e93; }
.summary-strip strong { color: #3a3a3c; }
.tx-empty { border-color: rgba(60, 60, 67, 0.16); }
.tx-empty-icon { background: #f2f2f7; color: #8e8e93; }
.rule-pill { border-color: transparent; background: #f2f2f7; }
.rule-pill:hover { border-color: rgba(60, 60, 67, 0.12); background: #fff; }
.add-rule-pill { background: transparent; border-color: rgba(60, 60, 67, 0.18); }
.platform-card { background: rgba(255, 255, 255, 0.82); border-color: rgba(60, 60, 67, 0.08); }
.platform-card:hover { background: #fff; }
.platform-summary-bar { background: #f2f2f7; border-color: transparent; }
.invite-board {
  background:
    radial-gradient(540px 280px at 100% 0%, rgba(100, 210, 255, 0.22), transparent 62%),
    linear-gradient(135deg, #0066d6, #0a84ff 62%, #5ac8fa);
  box-shadow: 0 28px 62px -46px rgba(0, 102, 214, 0.6);
}
.invite-code-box { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.22); }
.member-card { background: rgba(255, 255, 255, 0.82); border-color: rgba(60, 60, 67, 0.08); }
.member-note { border-style: solid; border-color: transparent; background: #f2f2f7; }
.member-note .icon { color: #007aff; }
.settings-code { background: #f2f2f7; border-color: transparent; }
.account-line { background: #f2f2f7; }
.settings-row { border-bottom-color: rgba(60, 60, 67, 0.1); }
.ai-toggle { background: #f2f2f7; border-color: transparent; }

/* Form controls */
.field input, .field select, .field textarea,
.sheet-field input, .sheet-field select, .sheet-field textarea {
  background: #f7f7fa;
  border-color: transparent;
}
.field input:focus, .field select:focus, .field textarea:focus,
.sheet-field input:focus, .sheet-field select:focus, .sheet-field textarea:focus {
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.22);
  background: #fff;
}

/* Conversation */
.chat-bubble {
  border-color: transparent;
  background: #e9e9eb;
  color: #1d1d1f;
  border-radius: 18px 18px 18px 5px;
}
.chat-bubble b { color: #1d1d1f; }
.chat-message.is-user .chat-bubble { background: #007aff; color: #fff; border-radius: 18px 18px 5px 18px; }
.chat-message.is-success .chat-bubble { background: #e9f9ee; color: #248a3d; }
.chat-message.is-error .chat-bubble { background: #ffeceb; color: #d70015; }
.chat-avatar { background: linear-gradient(145deg, #0a84ff, #0066d6); }
.chat-thread { background: #f2f2f7; }
.chat-day-sep span { background: rgba(255, 255, 255, 0.8); border-color: transparent; color: #8e8e93; }
.chat-draft { border-color: rgba(60, 60, 67, 0.08); }
.chat-draft-head { background: #f7f7fa; }
.chat-draft-item { background: #f7f7fa; border-color: transparent; }
.draft-note { color: #1d1d1f; }
.draft-note:focus { background: #fff; border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16); }
.draft-amount, .draft-select { background: #fff; border-color: transparent; }
.draft-amount:focus-within, .draft-select:focus-within { border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16); }
.chat-composer { background: #e9e9ee; border-color: transparent; }
.chat-composer:focus-within { background: #f2f2f7; border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); }
.chat-voice { background: #fff; border-color: transparent; color: #007aff; }
.chat-voice:hover { background: #f7f7fa; }
.chat-voice.is-listening { background: #ff3b30; color: #fff; }
.chat-send { background: #007aff; }
.chat-send:hover { background: #0071e3; }
.chat-voice-status { color: #ff3b30; }
.chat-voice-status.is-error { color: #ff3b30; }
.chat-voice-status.is-hint { color: #007aff; }
.chat-example { background: #f2f2f7; border-color: transparent; }
.chat-example:hover { background: #fff; border-color: rgba(60, 60, 67, 0.1); color: #007aff; }
.chat-starter { background: transparent; border-color: rgba(60, 60, 67, 0.14); color: #6e6e73; }
.chat-starter:hover { background: #fff; border-style: solid; border-color: rgba(60, 60, 67, 0.1); color: #007aff; }
.chat-local-badge .icon { color: #007aff; }
.chat-ai-link { color: #007aff; }
.chat-composer-foot { color: #8e8e93; }
.quick-add-card { background: #fff; border-color: transparent; box-shadow: var(--shadow-card); }
.quick-add-card.is-chat { background: linear-gradient(135deg, #eef5ff, #ffffff); border-color: rgba(0, 122, 255, 0.12); }
.quick-add-icon { background: #f2f2f7; color: #007aff; }
.quick-add-card.is-chat .quick-add-icon { background: #007aff; color: #fff; }

/* Sheets and modals */
.modal { background: #fff; border-color: rgba(255, 255, 255, 0.6); }
.modal-head { background: rgba(255, 255, 255, 0.94); border-bottom-color: rgba(60, 60, 67, 0.1); }
.modal-close { background: #f2f2f7; border-color: transparent; }
.tx-type-toggle { background: #e9e9ee; }
.tx-type-toggle button.is-active { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.tx-type-toggle button[data-tx-type="expense"].is-active { color: #ff3b30; }
.tx-type-toggle button[data-tx-type="income"].is-active { color: #248a3d; }
.amount-field { border-bottom-color: rgba(60, 60, 67, 0.14); }
.category-choice { background: #f2f2f7; }
.category-choice:hover { background: #fff; border-color: rgba(60, 60, 67, 0.1); }
.category-choice.is-active { border-color: color-mix(in srgb, var(--cat-color) 45%, transparent); background: color-mix(in srgb, var(--cat-color) 9%, #fff); }
.platform-category-wrap input { background: #f7f7fa; border-color: transparent; }
.platform-category-wrap input:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.22); background: #fff; }
.tx-sheet-foot { background: rgba(255, 255, 255, 0.94); border-top-color: rgba(60, 60, 67, 0.1); }
.checkbox-line input { accent-color: #007aff; }
.tx-comment-body p { background: #f2f2f7; border-color: transparent; }
.tx-comment-input input { background: #f2f2f7; border-color: transparent; }
.tx-comment-input input:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); }
.confirm-card { background: #fff; }
.form-error { background: #ffeceb; color: #d70015; }
.total-platform, .platform-total { border-top-color: rgba(60, 60, 67, 0.1); }

/* Auth */
.auth { background: var(--paper); }
.auth-art {
  background:
    radial-gradient(900px 560px at 8% 0%, rgba(90, 200, 250, 0.28), transparent 58%),
    radial-gradient(600px 500px at 100% 100%, rgba(175, 82, 222, 0.22), transparent 62%),
    linear-gradient(145deg, #061a33 0%, #0a2d5c 48%, #0066d6 100%);
}
.auth-editorial h1 { font-family: var(--font-body); font-weight: 700; letter-spacing: -0.045em; }
.auth-editorial h1 em { color: #64d2ff; }
.auth-editorial h1 em::after { background: rgba(100, 210, 255, 0.2); }
.auth-demo-card { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.08); }
.auth-panel { background: var(--paper); }
.auth-heading h2 { font-family: var(--font-body); font-weight: 700; letter-spacing: -0.03em; }
.auth-tabs { background: #e9e9ee; border-color: transparent; }
.auth-tab.is-active { color: #1d1d1f; }
.auth-tab-indicator { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.auth-form .field input { background: #fff; border-color: transparent; }
.auth-form .field input:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.22); }
.btn-demo { background: rgba(255, 255, 255, 0.65); border-color: transparent; border-style: solid; }
.btn-demo:hover { background: #fff; border-style: solid; }
.auth-brand-copy strong { font-family: var(--font-body); font-weight: 700; }

/* Mobile chrome */
.mobile-ledger { background: rgba(255, 255, 255, 0.7); border-color: rgba(60, 60, 67, 0.1); }
.ledger-dot { background: #e8f0ff; color: #007aff; }
.mobile-nav {
  background: rgba(255, 255, 255, 0.86);
  border-top-color: rgba(60, 60, 67, 0.1);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.mobile-nav a { color: #8e8e93; }
.mobile-nav a.is-active { color: #007aff; }
.mobile-nav a.is-active .icon { color: #007aff; }
.mobile-add { background: #007aff; color: #fff; box-shadow: 0 9px 22px -8px rgba(0, 122, 255, 0.6); }
.toast { background: #1c1c1e; border-color: rgba(255, 255, 255, 0.08); }
.toast.is-error { background: #7a1d1a; }
.toast .icon { color: #64d2ff; }

/* Scrollbar */
.chat-thread::-webkit-scrollbar, .modal::-webkit-scrollbar, .tx-comment-list::-webkit-scrollbar { width: 6px; }
.chat-thread::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb, .tx-comment-list::-webkit-scrollbar-thumb { background: rgba(60, 60, 67, 0.18); border-radius: 6px; }

/* Larger UI / larger ledger numbers */
:root { --sidebar-w: 300px; }
body { font-size: 16px; }
.page { max-width: 1380px; padding: 34px 44px 70px; }
.sidebar { padding-left: 20px; padding-right: 20px; }
.brand-copy strong { font-size: 23px; }
.brand-copy small { font-size: 8px; }
.ledger-switch { padding: 10px 11px; }
.ledger-switch-copy strong { font-size: 13px; }
.ledger-switch-copy small { font-size: 9px; }
.nav-label { font-size: 9px; }
.nav-link { min-height: 44px; padding: 9px 11px; font-size: 13.5px; }
.nav-link .icon { width: 18px; height: 18px; }
.btn { min-height: 42px; font-size: 13.5px; }
.btn-new { min-height: 47px; font-size: 14px; }
.btn-invite, .btn-chat-top { min-height: 36px; font-size: 12px; }
.page-head h1 { font-size: 42px; }
.page-head p:last-child { font-size: 13.5px; line-height: 1.7; }
.eyebrow { font-size: 10.5px; }
.panel-head h2 { font-size: 24px; }
.panel-sub { font-size: 11.5px; }
.stat-card { min-height: 118px; padding: 18px 20px; }
.stat-label { font-size: 11px; }
.stat-value { font-size: 29px; }
.stat-value .unit { font-size: 11px; }
.stat-foot { font-size: 10.5px; }
.hero-balance strong { font-size: 66px; }
.hero-balance .currency { font-size: 26px; }
.hero-balance small { font-size: 28px; }
.hero-delta, .hero-flows { font-size: 11.5px; }
.hero-flows b { font-size: 15px; }
.hero-kicker { font-size: 10.5px; }
.hero-chat-link { font-size: 10.5px; }
.hero-side-label { font-size: 10px; }
.hero-spark-meta { font-size: 9px; }
.tx-row { min-height: 73px; padding: 11px 8px; }
.tx-icon { width: 40px; height: 40px; }
.tx-title { font-size: 14.5px; line-height: 1.45; }
.tx-meta { font-size: 10.5px; }
.tx-amount { min-width: 108px; }
.tx-amount strong { font-size: 19px; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.tx-amount span { font-size: 8.5px; }
.tx-date-left strong { font-size: 17px; }
.tx-date-left span { font-size: 10px; }
.tx-date-sum { font-size: 10px; }
.tx-date-sum b { font-size: 13px; }
.recent-row { padding: 12px 5px; }
.recent-main strong { font-size: 13.5px; }
.recent-main span { font-size: 9.5px; }
.recent-amount strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.cat-main strong { font-size: 12.5px; }
.cat-main small { font-size: 9.5px; }
.cat-amount strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.cat-amount span { font-size: 9px; }
.platform-row-head { font-size: 11.5px; }
.platform-row-head span { font-size: 14px; font-variant-numeric: tabular-nums; }
.platform-total strong { font-size: 16px; }
.summary-strip { font-size: 11px; }
.summary-strip strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.filters { padding: 12px 13px; }
.search-box input { min-height: 40px; font-size: 13px; }
.segmented button { height: 34px; font-size: 11.5px; }
.select-wrap select { height: 40px; font-size: 12px; }
.link-btn { font-size: 11px; }
.badge { font-size: 11px; }
.chat-bubble { font-size: 13px; line-height: 1.7; }
.chat-meta { font-size: 8px; }
.chat-draft-total { font-size: 10px; }
.chat-draft-head strong { font-size: 19px; }
.draft-note { font-size: 13px; }
.draft-amount input { font-size: 15px; }
.draft-select > span { font-size: 8px; }
.draft-select select, .draft-select input { font-size: 10.5px; }
.chat-composer textarea { font-size: 13px; }
.chat-composer-foot { font-size: 8.5px; }
.chat-voice-status { font-size: 9.5px; }
.modal-head h2 { font-size: 27px; }
.sheet-field > span, .field > span { font-size: 12px; }
.sheet-field input, .sheet-field select, .sheet-field textarea { font-size: 13px; }
.category-choice { font-size: 10px; }
.settings-row-copy strong { font-size: 13px; }
.settings-row-copy span { font-size: 10.5px; }
.form-note { font-size: 10.5px; }

@media (max-width: 860px) {
  :root { --sidebar-w: 252px; }
  body { font-size: 17px; }
  .page { padding: 16px 18px 88px; }
  .page.page-chat { padding-bottom: 84px; }
  .page-head h1 { font-size: 34px; }
  .page-chat .page-head h1 { font-size: 31px; }
  .panel-head h2 { font-size: 23px; }
  .panel-sub { font-size: 12px; }
  .btn { min-height: 44px; font-size: 14px; }
  .head-actions .btn, .page-head .btn { min-height: 43px; font-size: 13px; }
  .hero-balance strong { font-size: 46px; }
  .hero-balance .currency { font-size: 22px; }
  .hero-balance small { font-size: 24px; }
  .hero-kicker { font-size: 11px; }
  .hero-delta, .hero-flows { font-size: 12px; }
  .hero-flows b { font-size: 15px; }
  .hero-chat-link { min-height: 30px; font-size: 11.5px; }
  .stat-card { min-height: 108px; padding: 15px; }
  .stat-label { font-size: 12px; }
  .stat-value { font-size: 27px; }
  .stat-foot { font-size: 10.5px; }
  .tx-row { min-height: 80px; padding: 12px 5px; }
  .tx-icon { width: 42px; height: 42px; }
  .tx-title { font-size: 15.5px; }
  .tx-meta { font-size: 11.5px; }
  .tx-amount { min-width: 100px; }
  .tx-amount strong { font-size: 21px; }
  .tx-date-left strong { font-size: 18px; }
  .tx-date-left span { font-size: 11px; }
  .tx-date-sum { font-size: 10.5px; }
  .tx-date-sum b { font-size: 14px; }
  .recent-main strong { font-size: 15px; }
  .recent-main span { font-size: 11px; }
  .recent-amount strong { font-size: 19px; }
  .cat-main strong { font-size: 14px; }
  .cat-main small { font-size: 10.5px; }
  .cat-amount strong { font-size: 15px; }
  .cat-amount span { font-size: 10px; }
  .summary-strip { font-size: 12px; }
  .summary-strip strong { font-size: 15px; }
  .search-box input { height: 44px; font-size: 15px; }
  .segmented button { height: 38px; font-size: 13px; }
  .select-wrap select { height: 44px; font-size: 13.5px; }
  .filter-clear { font-size: 12px; }
  .mobile-ledger span:nth-child(2) { font-size: 14px; }
  .topbar .month-label { font-size: 14px; }
  .mobile-nav a { font-size: 10px; }
  .mobile-nav a .icon { width: 21px; height: 21px; }
  .chat-bubble { font-size: 15px; line-height: 1.8; }
  .chat-meta { font-size: 9.5px; }
  .chat-draft-head strong { font-size: 19px; }
  .draft-note { font-size: 15px; }
  .draft-amount, .draft-select { height: 42px; }
  .draft-amount input { font-size: 18px; }
  .draft-select > span { font-size: 9px; }
  .draft-select select, .draft-select input { font-size: 12px; }
  .chat-composer textarea { font-size: 17px; }
  .chat-voice { width: 42px; height: 42px; }
  .chat-send { width: 42px; height: 42px; }
  .chat-composer-foot { font-size: 9px; }
  .chat-voice-status { font-size: 11px; }
  .modal-head h2 { font-size: 28px; }
  .amount-field input { font-size: 50px; }
  .category-choice { min-height: 68px; font-size: 11.5px; }
  .sheet-field > span, .field > span { font-size: 13px; }
  .sheet-field input, .sheet-field select, .sheet-field textarea { font-size: 15px; }
  .settings-row-copy strong { font-size: 14px; }
  .settings-row-copy span { font-size: 12px; }
  .form-note { font-size: 11.5px; }
  .tx-comment-body p { font-size: 13px; }
  .tx-comment-input input { font-size: 14px; }
}

@media (max-width: 560px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .page-head h1 { font-size: 32px; }
  .page-chat .page-head h1 { font-size: 29px; }
  .hero-balance strong { font-size: 44px; }
  .tx-title { font-size: 15px; }
  .tx-amount strong { font-size: 20px; }
  .tx-amount { min-width: 92px; }
  .tx-date-left strong { font-size: 17px; }
  .stat-value { font-size: 26px; }
  .chat-shell { height: calc(100dvh - 178px); }
}

@media (max-width: 360px) {
  .filters .select-wrap { flex: 1 1 calc(50% - 4px); }
  .tx-amount { min-width: 88px; }
  .tx-amount strong { font-size: 19px; }
}

/* Bold scale: fewer, bigger, more prominent things. */
body { font-size: 17px; }
.page { max-width: 1420px; padding: 38px 48px 78px; }
.page-head h1 { font-size: 48px; font-weight: 760; letter-spacing: -0.045em; }
.page-head > div > p:last-child { font-size: 14px; line-height: 1.75; }
.eyebrow { font-size: 11px; font-weight: 700; }
.panel-head h2 { font-size: 27px; font-weight: 740; }
.panel-sub { font-size: 12px; }
.brand-copy strong { font-size: 25px; }
.ledger-switch-copy strong { font-size: 14px; }
.ledger-switch-copy small { font-size: 9.5px; }
.nav-link { min-height: 46px; font-size: 14.5px; font-weight: 600; }
.nav-link .icon { width: 19px; height: 19px; }
.nav-label { font-size: 9.5px; }
.btn { min-height: 46px; padding-left: 17px; padding-right: 17px; font-size: 14.5px; font-weight: 650; }
.btn-new { min-height: 50px; font-size: 15px; }
.btn-invite, .btn-chat-top { min-height: 40px; font-size: 13px; }
.hero-balance strong { font-size: 78px; font-weight: 700; }
.hero-balance .currency { font-size: 30px; }
.hero-balance small { font-size: 33px; }
.hero-kicker { font-size: 11.5px; }
.hero-delta, .hero-flows { font-size: 12.5px; }
.hero-flows b { font-size: 16px; }
.hero-chat-link { min-height: 34px; font-size: 12px; font-weight: 650; }
.hero-side-label { font-size: 10.5px; }
.stat-card { min-height: 130px; padding: 20px 22px; }
.stat-label { font-size: 12px; font-weight: 650; }
.stat-value { font-size: 34px; font-weight: 700; letter-spacing: -0.035em; }
.stat-foot { font-size: 11px; }
.tx-row { min-height: 84px; padding: 13px 10px; }
.tx-icon { width: 44px; height: 44px; border-radius: 13px; }
.tx-title { font-size: 16px; font-weight: 700; }
.tx-meta { font-size: 11.5px; }
.tx-amount { min-width: 130px; }
.tx-amount strong { font-size: 24px; font-weight: 750; letter-spacing: -0.035em; }
.tx-amount span { font-size: 9px; font-weight: 600; }
.tx-date-left strong { font-size: 19px; }
.tx-date-left span { font-size: 11px; }
.tx-date-sum { font-size: 11px; }
.tx-date-sum b { font-size: 15px; }
.recent-row { padding: 14px 6px; }
.recent-main strong { font-size: 15px; font-weight: 700; }
.recent-main span { font-size: 10.5px; }
.recent-amount strong { font-size: 20px; font-weight: 750; }
.cat-main strong { font-size: 14px; font-weight: 650; }
.cat-main small { font-size: 10.5px; }
.cat-amount strong { font-size: 17px; font-weight: 700; }
.cat-amount span { font-size: 9.5px; }
.platform-row-head { font-size: 12px; }
.platform-row-head span { font-size: 16px; font-weight: 700; }
.platform-total strong { font-size: 18px; }
.summary-strip { font-size: 12px; }
.summary-strip strong { font-size: 16px; font-weight: 700; }
.filters { padding: 14px 15px; }
.search-box input { min-height: 44px; font-size: 14px; }
.segmented button { height: 38px; font-size: 13px; font-weight: 650; }
.select-wrap select { height: 44px; font-size: 13px; font-weight: 600; }
.link-btn { font-size: 12px; font-weight: 650; }
.badge { font-size: 11px; font-weight: 650; }
.chat-bubble { font-size: 14px; line-height: 1.75; }
.chat-voice { background: #007aff; border-color: transparent; color: #ffffff; }
.chat-voice:hover { background: #0071e3; }
.chat-voice.is-listening { background: #ff3b30; color: #ffffff; }
.chat-starter { font-size: 12px; padding: 8px 11px; }
.chat-draft-head strong { font-size: 21px; }
.draft-note { font-size: 14px; }
.draft-amount input { font-size: 17px; }
.draft-select > span { font-size: 9px; }
.draft-select select, .draft-select input { font-size: 11.5px; }
.chat-composer textarea { font-size: 14px; }
.chat-voice-status { font-size: 10.5px; }
.modal-head h2 { font-size: 30px; }
.sheet-field > span, .field > span { font-size: 13px; }
.sheet-field input, .sheet-field select, .sheet-field textarea { font-size: 15px; }
.category-choice { min-height: 70px; font-size: 11.5px; font-weight: 650; }
.amount-field input { font-size: 52px; }
.tx-type-toggle button { font-size: 13px; }
.settings-row-copy strong { font-size: 14px; }
.settings-row-copy span { font-size: 11.5px; }
.form-note { font-size: 11px; }
.mobile-nav a { font-size: 10px; }
.mobile-ledger span:nth-child(2) { font-size: 14px; }
.mobile-add { width: 48px; height: 48px; }

/* Login rows */
.remember-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 2px 0 14px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}
.remember-line input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #007aff;
  flex: none;
}
.remember-line small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.biometric-wrap { margin-top: 12px; }
.biometric-wrap .btn-soft {
  background: rgba(118, 118, 128, 0.1);
  border-color: transparent;
  color: #007aff;
}
.biometric-wrap p {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 860px) {
  body { font-size: 18px; }
  .page { padding: 18px 17px 94px; }
  .page.page-chat { padding-bottom: 90px; }
  .page-head h1 { font-size: 38px; font-weight: 780; }
  .page-chat .page-head h1 { font-size: 35px; }
  .page-head > div > p:last-child { font-size: 14px; }
  .panel-head h2 { font-size: 25px; }
  .panel-sub { font-size: 12.5px; }
  .btn { min-height: 48px; font-size: 15px; }
  .head-actions .btn, .page-head .btn { min-height: 47px; font-size: 14px; }
  .mobile-ledger span:nth-child(2) { font-size: 15px; }
  .topbar .month-label { font-size: 15px; }
  .mobile-nav a { font-size: 10.5px; }
  .mobile-nav a .icon { width: 22px; height: 22px; }
  .mobile-add { width: 52px; height: 52px; }
  .hero-balance strong { font-size: 52px; font-weight: 720; }
  .hero-balance .currency { font-size: 24px; }
  .hero-balance small { font-size: 27px; }
  .hero-kicker { font-size: 12px; }
  .hero-delta, .hero-flows { font-size: 13px; }
  .hero-flows b { font-size: 17px; }
  .hero-chat-link { min-height: 34px; font-size: 12.5px; }
  .stat-card { min-height: 120px; padding: 17px; }
  .stat-label { font-size: 13px; }
  .stat-value { font-size: 31px; font-weight: 740; }
  .stat-foot { font-size: 11.5px; }
  .tx-row { min-height: 90px; padding: 14px 6px; }
  .tx-icon { width: 46px; height: 46px; }
  .tx-title { font-size: 17px; font-weight: 720; }
  .tx-meta { font-size: 12px; }
  .tx-amount { min-width: 108px; }
  .tx-amount strong { font-size: 25px; font-weight: 760; }
  .tx-amount span { font-size: 9.5px; }
  .tx-date-left strong { font-size: 20px; }
  .tx-date-left span { font-size: 11.5px; }
  .tx-date-sum { font-size: 11px; }
  .tx-date-sum b { font-size: 15px; }
  .recent-main strong { font-size: 16px; }
  .recent-main span { font-size: 11.5px; }
  .recent-amount strong { font-size: 21px; }
  .cat-main strong { font-size: 15px; }
  .cat-main small { font-size: 11px; }
  .cat-amount strong { font-size: 17px; }
  .cat-amount span { font-size: 10.5px; }
  .summary-strip { font-size: 13px; }
  .summary-strip strong { font-size: 17px; }
  .filters { padding: 13px 14px; }
  .filters .select-wrap { flex: 1 1 calc(50% - 5px); }
  .search-box input { height: 48px; font-size: 16px; }
  .segmented button { height: 42px; font-size: 14px; }
  .select-wrap select { height: 48px; font-size: 14px; }
  .filter-clear { font-size: 13px; }
  .chat-bubble { font-size: 16px; line-height: 1.8; }
  .chat-meta { font-size: 10.5px; }
  .chat-avatar { width: 33px; height: 33px; border-radius: 10px; }
  .chat-starter { font-size: 12.5px; padding: 9px 12px; }
  .chat-voice { background: #007aff; color: #ffffff; }
  .chat-draft-head strong { font-size: 20px; }
  .draft-note { font-size: 16px; }
  .draft-amount, .draft-select { height: 46px; }
  .draft-amount input { font-size: 20px; }
  .draft-select > span { font-size: 9.5px; }
  .draft-select select, .draft-select input { font-size: 13px; }
  .chat-composer textarea { font-size: 18px; }
  .chat-voice, .chat-send { width: 46px; height: 46px; }
  .chat-composer-foot { font-size: 9.5px; }
  .chat-voice-status { font-size: 12px; }
  .modal-head h2 { font-size: 30px; }
  .amount-field input { font-size: 56px; }
  .category-choice { min-height: 74px; font-size: 12.5px; }
  .sheet-field > span, .field > span { font-size: 14px; }
  .sheet-field input, .sheet-field select, .sheet-field textarea { font-size: 16px; }
  .settings-row-copy strong { font-size: 15px; }
  .settings-row-copy span { font-size: 13px; }
  .form-note { font-size: 12px; }
  .tx-comment-body p { font-size: 14px; }
  .tx-comment-input input { font-size: 15px; }
  .auth-heading h2 { font-size: 36px; }
  .auth-form .field input { height: 52px; font-size: 16px; }
  .remember-line { font-size: 13px; }
  .remember-line small { font-size: 10.5px; }
}

@media (max-width: 560px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .page-head h1 { font-size: 36px; }
  .page-chat .page-head h1 { font-size: 32px; }
  .hero-balance strong { font-size: 48px; }
  .tx-title { font-size: 16px; }
  .tx-amount strong { font-size: 24px; }
  .tx-amount { min-width: 104px; }
  .tx-date-left strong { font-size: 19px; }
  .stat-value { font-size: 29px; }
  .tx-icon { width: 44px; height: 44px; }
  .chat-shell { height: calc(100dvh - 186px); }
}

@media (max-width: 860px) {
  .stat-value { font-size: clamp(21px, 6.5vw, 27px); white-space: nowrap; }
}

@media (max-width: 360px) {
  .page-head h1 { font-size: 34px; }
  .tx-title { font-size: 15.5px; }
  .tx-amount strong { font-size: 23px; }
  .tx-amount { min-width: 100px; }
  .tx-icon { width: 42px; height: 42px; }
  .stat-value { font-size: 27px; }
  .topbar .mobile-ledger span:nth-child(2) { font-size: 13px; }
  .topbar .month-label { font-size: 13px; }
  .mobile-ledger { max-width: 152px; }
}

/* Voice entry directly under the main add button */
.voice-entry {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0 18px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink);
  text-decoration: none;
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  transition: 0.18s ease;
}
.voice-entry:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.9);
}
.voice-entry.is-active {
  background: rgba(0, 122, 255, 0.11);
  border-color: rgba(0, 122, 255, 0.17);
  color: #0066cc;
}
.voice-entry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 5px 12px -8px rgba(0, 122, 255, 0.9);
}
.voice-entry-icon .icon { width: 17px; height: 17px; }
.voice-entry-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.voice-entry-copy strong { font-size: 13px; font-weight: 700; line-height: 1.25; }
.voice-entry-copy small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.voice-entry-chevron { width: 14px; height: 14px; flex: none; color: var(--muted-soft); }
.voice-entry.is-active .voice-entry-chevron { color: #007aff; }

/* Prominent hold-to-talk button */
.chat-voice {
  width: 50px;
  height: 50px;
  min-width: 50px;
  background: #007aff;
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 16px -9px rgba(0, 122, 255, 0.75);
}
.chat-voice .icon { width: 21px; height: 21px; }
.chat-voice:hover { background: #0071e3; color: #ffffff; }
.chat-voice.is-listening { background: #ff3b30; color: #ffffff; }
.chat-voice.is-cancel {
  background: #1c1c1e;
  animation: none;
  transform: scale(0.9);
  box-shadow: 0 0 0 5px rgba(255, 59, 48, 0.18);
}

@media (max-width: 860px) {
  .chat-voice {
    width: 60px;
    height: 60px;
    min-width: 60px;
  }
  .chat-voice .icon { width: 26px; height: 26px; }
  .chat-send { width: 46px; height: 46px; }
}

@media (max-width: 560px) {
  .chat-voice { width: 58px; height: 58px; min-width: 58px; }
}

@media (max-width: 360px) {
  .chat-voice { width: 56px; height: 56px; min-width: 56px; }
  .chat-send { width: 42px; height: 42px; }
}

/* Frosted glass surfaces and Dynamic Island voice HUD */
body {
  background:
    radial-gradient(900px 720px at 0% 0%, rgba(10, 132, 255, 0.22), transparent 62%),
    radial-gradient(720px 620px at 100% 2%, rgba(175, 82, 222, 0.17), transparent 60%),
    radial-gradient(840px 620px at 52% 100%, rgba(90, 200, 250, 0.15), transparent 64%),
    #f2f2f7;
  background-attachment: fixed;
}
.sidebar,
.topbar,
.mobile-nav {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
}
.panel,
.stat-card,
.filters,
.member-card,
.platform-card,
.invite-mini-inner,
.sidebar-note,
.quick-add-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46));
  border-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(28px) saturate(175%);
  -webkit-backdrop-filter: blur(28px) saturate(175%);
  box-shadow:
    0 18px 45px -34px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.chat-shell {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.38));
  border-color: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(30px) saturate(175%);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
}
.chat-thread { background: rgba(242, 242, 247, 0.34); }
.chat-composer-wrap {
  background: rgba(255, 255, 255, 0.56);
  border-top-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}
.chat-composer {
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
}
.chat-bubble { background: rgba(233, 233, 235, 0.78); }
.chat-message.is-user .chat-bubble { background: rgba(0, 122, 255, 0.88); }
.chat-draft,
.chat-example,
.chat-starter,
.month-nav,
.mobile-ledger {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
}
.filters { background: rgba(255, 255, 255, 0.52); }
.search-box input,
.segmented,
.tx-type-toggle {
  background: rgba(233, 233, 238, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth-panel {
  background: rgba(242, 242, 247, 0.56);
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
}
.modal {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}
.modal-head,
.tx-sheet-foot {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}
.sheet-field input,
.sheet-field select,
.sheet-field textarea,
.field input,
.field select,
.field textarea {
  background: rgba(247, 247, 250, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Boot loading ring */
.boot-spinner {
  width: 28px;
  height: 28px;
  margin-top: 20px;
  border: 2.5px solid rgba(0, 122, 255, 0.16);
  border-top-color: #007aff;
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
  box-shadow: 0 0 18px rgba(0, 122, 255, 0.12);
}
@keyframes bootSpin { to { transform: rotate(360deg); } }

/* Spending habits */
.habit-panel { margin-bottom: 18px; }
.habit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.habit-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.habit-pill.is-neutral { background: rgba(0, 122, 255, 0.1); color: #0066cc; }
.habit-pill.is-good { background: rgba(52, 199, 89, 0.13); color: #248a3d; }
.habit-pill.is-watch { background: rgba(255, 159, 10, 0.15); color: #b26a00; }
.habit-body {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(0, 2.1fr);
  gap: 14px;
  align-items: stretch;
}
.habit-summary {
  padding: 17px 18px;
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.09), rgba(255, 255, 255, 0.36));
}
.habit-summary-label { color: #007aff; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.habit-summary p { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }
.habit-insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.habit-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
}
.habit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: rgba(0, 122, 255, 0.11);
  color: #007aff;
}
.habit-icon .icon { width: 17px; height: 17px; }
.habit-insight.is-good .habit-icon { background: rgba(52, 199, 89, 0.13); color: #248a3d; }
.habit-insight.is-watch .habit-icon { background: rgba(255, 159, 10, 0.15); color: #b26a00; }
.habit-copy { min-width: 0; }
.habit-label { color: var(--muted); font-size: 9px; font-weight: 700; }
.habit-copy strong { display: block; margin-top: 3px; color: var(--ink); font-size: 15px; font-weight: 750; line-height: 1.35; }
.habit-copy p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

@media (max-width: 980px) {
  .habit-body { grid-template-columns: 1fr; }
  .habit-insights { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .habit-panel { margin-bottom: 14px; }
  .habit-summary { padding: 15px; }
  .habit-summary p { font-size: 15px; line-height: 1.75; }
  .habit-insights { grid-template-columns: 1fr; gap: 8px; }
  .habit-insight { padding: 13px; }
  .habit-copy strong { font-size: 16px; }
  .habit-copy p { font-size: 11.5px; }
  .habit-label { font-size: 10px; }
  .habit-icon { width: 36px; height: 36px; }
}

/* Long, Dynamic-Island-like hold-to-talk control */
.chat-voice {
  width: auto;
  min-width: 108px;
  height: 46px;
  padding: 0 14px;
  gap: 7px;
  border-radius: 999px;
  flex: none;
}
.chat-voice-text {
  color: currentColor;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}
.chat-voice .icon { width: 19px; height: 19px; }
.chat-voice.is-cancel { transform: scale(0.94); }

@media (max-width: 860px) {
  .chat-voice { min-width: 116px; height: 50px; padding: 0 15px; }
  .chat-voice-text { font-size: 13px; }
  .chat-voice .icon { width: 21px; height: 21px; }
}

@media (max-width: 560px) {
  .chat-voice { min-width: 118px; height: 48px; padding: 0 14px; }
  .chat-voice-text { font-size: 12.5px; }
}

@media (max-width: 360px) {
  .chat-voice { min-width: 100px; height: 46px; padding: 0 11px; gap: 5px; }
  .chat-voice-text { font-size: 11px; }
  .chat-voice .icon { width: 18px; height: 18px; }
}

.voice-island {
  position: absolute;
  top: 11px;
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(326px, calc(100% - 24px));
  min-height: 58px;
  padding: 9px 15px 9px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(18, 18, 20, 0.9);
  color: #ffffff;
  box-shadow:
    0 16px 36px -18px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  pointer-events: none;
  animation: islandIn 0.22s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.voice-island-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: #0a84ff;
  color: #ffffff;
}
.voice-island-icon .icon { width: 19px; height: 19px; }
.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 28px;
  height: 24px;
  flex: none;
}
.voice-wave i {
  display: block;
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: #64d2ff;
  animation: voiceBar 0.9s ease-in-out infinite;
}
.voice-wave i:nth-child(2) { height: 11px; animation-delay: -0.15s; }
.voice-wave i:nth-child(3) { height: 22px; animation-delay: -0.3s; }
.voice-wave i:nth-child(4) { height: 14px; animation-delay: -0.45s; }
.voice-wave i:nth-child(5) { height: 8px; animation-delay: -0.6s; }
.voice-island-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.voice-island-copy strong { font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.voice-island-copy small { overflow: hidden; color: rgba(255, 255, 255, 0.68); font-size: 11.5px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.voice-island-time { color: rgba(255, 255, 255, 0.58); font-size: 10px; font-variant-numeric: tabular-nums; flex: none; }
.voice-island.is-cancel { background: rgba(74, 12, 12, 0.92); border-color: rgba(255, 69, 58, 0.34); }
.voice-island.is-cancel .voice-island-icon { background: #ff3b30; }
.voice-island.is-cancel .voice-wave i { background: #ff453a; animation-play-state: paused; }
.voice-island.is-cancel .voice-island-copy small { color: rgba(255, 120, 112, 0.8); }
.voice-island.is-pending .voice-island-icon { background: #30d158; }
.voice-island.is-pending .voice-wave i { background: #30d158; animation-duration: 1.5s; }
@keyframes islandIn {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes voiceBar {
  0%, 100% { transform: scaleY(0.5); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

@media (max-width: 560px) {
  .voice-island { top: 9px; width: calc(100% - 20px); min-height: 56px; }
}
/* Weather + daily note */
.daily-board {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.55fr);
  gap: 16px;
  margin-bottom: 18px;
}
.weather-card { min-height: 206px; }
.weather-head { margin-bottom: 10px; }
.weather-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 100px;
}
.weather-empty-icon { font-size: 40px; line-height: 1; flex: none; }
.weather-empty-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.weather-empty-copy strong { font-size: 15px; font-weight: 700; }
.weather-empty-copy span { color: var(--muted); font-size: 11px; line-height: 1.6; }
.weather-empty-actions { display: flex; gap: 7px; margin-left: auto; flex: none; }
.weather-loading { display: flex; align-items: center; gap: 9px; min-height: 100px; color: var(--muted); font-size: 12px; }
.weather-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 122, 255, 0.18);
  border-top-color: #007aff;
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}
.weather-note { margin: 0 0 8px; color: #b26a00; font-size: 10px; line-height: 1.5; }
.weather-current { display: flex; align-items: center; gap: 14px; }
.weather-now { display: flex; align-items: center; gap: 4px; flex: none; }
.weather-big-icon { font-size: 36px; line-height: 1; }
.weather-now strong { font-size: 46px; font-weight: 700; letter-spacing: -0.06em; line-height: 1; }
.weather-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.weather-copy strong { font-size: 15px; font-weight: 700; }
.weather-copy span { color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.weather-actions { display: flex; gap: 6px; margin-left: auto; align-self: flex-start; }
.weather-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.52);
  color: #007aff;
  cursor: pointer;
}
.weather-icon-btn .icon { width: 15px; height: 15px; }
.weather-icon-btn:active { transform: scale(0.94); }
.weather-days {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 15px;
}
.weather-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 3px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.38);
}
.weather-day.is-today { background: rgba(0, 122, 255, 0.08); border-color: rgba(0, 122, 255, 0.12); }
.weather-day span { color: var(--muted); font-size: 9px; }
.weather-day b { font-size: 18px; font-weight: 400; line-height: 1.2; }
.weather-day strong { font-size: 11px; font-weight: 700; }
.weather-day small { color: var(--muted); font-size: 9px; }
.weather-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--muted-soft); font-size: 8.5px; }
.quote-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 206px;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.13), rgba(255, 255, 255, 0.45));
}
.quote-mark { height: 32px; margin-top: 2px; color: #007aff; font-family: var(--font-display); font-size: 58px; line-height: 0.9; opacity: 0.32; }
.quote-text { margin: 4px 0 auto; color: var(--ink-soft); font-family: var(--font-display); font-size: 18px; line-height: 1.75; letter-spacing: -0.01em; }
.quote-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; color: var(--muted); font-size: 9px; }

@media (max-width: 980px) {
  .daily-board { grid-template-columns: 1fr; }
  .quote-card { min-height: 150px; }
}
@media (max-width: 560px) {
  .daily-board { gap: 10px; margin-bottom: 14px; }
  .weather-card { min-height: 0; }
  .weather-empty { flex-wrap: wrap; gap: 10px; }
  .weather-empty-copy { flex: 1 1 calc(100% - 58px); }
  .weather-empty-actions { width: 100%; margin-left: 0; }
  .weather-empty-actions .btn { flex: 1; min-height: 38px; font-size: 11px; }
  .weather-now strong { font-size: 42px; }
  .weather-days { gap: 5px; }
  .weather-day { padding: 7px 2px; }
  .weather-foot { font-size: 8px; }
  .quote-card { min-height: 140px; }
  .quote-text { font-size: 17px; }
}

/* Item name is the first, most important field in the manual entry sheet */
.tx-item-section { margin-top: 4px; }
.tx-item-field > span { font-size: 13px; font-weight: 650; }
.tx-item-input {
  height: 56px;
  padding: 0 14px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 14px;
  background: rgba(242, 242, 247, 0.72);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.tx-item-input:focus {
  border-color: rgba(0, 122, 255, 0.42);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.09);
}
@media (max-width: 860px) {
  .tx-item-input {
    height: 62px;
    font-size: 22px;
    border-radius: 16px;
  }
}

/* Movable floating recent-flows button */
.recent-fab {
  position: fixed;
  right: 14px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 27;
  display: none;
  align-items: center;
  gap: 6px;
  height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #007aff;
  box-shadow:
    0 16px 34px -16px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: opacity 0.18s ease, transform 0.16s ease;
}
.recent-fab .icon { width: 20px; height: 20px; }
.recent-fab.is-dragging { cursor: grabbing; transform: scale(1.03); }
.recent-fab.is-docked {
  gap: 0;
  padding: 0;
  opacity: 0.94;
  justify-content: center;
  outline: none;
}
.recent-fab.is-docked span { display: none; }
.recent-fab.is-docked[data-side="left"] { border-radius: 0 999px 999px 0; }
.recent-fab.is-docked[data-side="right"] { border-radius: 999px 0 0 999px; }
body.is-dragging-fab { user-select: none; }
[data-theme="dark"] .recent-fab {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(29, 29, 32, 0.9);
  color: #8fc7ff;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
@media (max-width: 860px) {
  .recent-fab { display: inline-flex !important; }
}

/* Mobile recent-flows sheet */
.recent-sheet-body { padding-top: 8px; }
.recent-sheet-list {
  max-height: 56vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.recent-sheet-list .recent-row {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px 3px;
}
.recent-sheet-list .recent-row .cat-icon { width: 38px; height: 38px; border-radius: 11px; }
.recent-sheet-list .recent-main strong { font-size: 15px; }
.recent-sheet-list .recent-main span { font-size: 10px; }
.recent-sheet-list .recent-amount strong { font-size: 17px; }
.recent-sheet-list .recent-amount span { font-size: 9px; }
.recent-sheet-foot {
  display: flex;
  justify-content: center;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.recent-sheet-foot .btn { width: 100%; }

/* Quick-add popup, not a bottom sheet */
.modal-backdrop-pop {
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-pop {
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  border-radius: 26px;
  animation: quickAddPop 0.28s cubic-bezier(0.16, 1.04, 0.3, 1) both;
}
.modal-pop .modal-head { border-radius: 26px 26px 0 0; }
@keyframes quickAddPop {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 860px) {
  .modal-backdrop-pop {
    align-items: center;
    justify-content: center;
    padding: 18px;
  }
  .modal.modal-pop {
    width: min(400px, calc(100vw - 28px));
    max-height: 82vh;
    margin: 0;
    border-radius: 24px;
  }
  .modal-pop .modal-head {
    padding: 18px 18px 14px;
    border-radius: 24px 24px 0 0;
  }
  .modal-pop .modal-body { padding: 16px 16px 20px; }
}

/* Profile avatar editor */
.profile-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.profile-preview-row { display: flex; align-items: center; gap: 13px; }
.profile-preview .avatar {
  width: 56px;
  height: 56px;
  font-size: 23px;
  box-shadow: 0 10px 22px -16px rgba(0, 0, 0, 0.45);
}
.profile-preview-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-preview-copy strong { font-size: 14px; font-weight: 700; }
.profile-preview-copy span { color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.profile-name-field { margin-top: 14px; }
.avatar-emoji-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.avatar-emoji-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}
.avatar-emoji-btn:hover { background: #fff; border-color: rgba(0, 122, 255, 0.22); }
.avatar-emoji-btn:active { transform: scale(0.92); }
.avatar-emoji-btn.is-text { color: var(--muted); font-size: 11px; font-weight: 700; }
.avatar-color-label { margin-top: 13px; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.avatar-color-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.avatar-color-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 42px;
  cursor: pointer;
}
.avatar-color-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.avatar-swatch {
  display: block;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  transition: transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 0.16s ease;
}
.avatar-color-choice input:checked + .avatar-swatch {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px #007aff;
}
.avatar-color-choice small { color: var(--muted); font-size: 9px; line-height: 1; }
.profile-form > .btn { margin-top: 15px; }

/* Springy, tactile interactions */
.user-chip {
  transition:
    transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1),
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}
.user-chip:active { transform: scale(0.97); }
.user-menu {
  transform-origin: 26px 100%;
  animation: userMenuPop 0.34s cubic-bezier(0.18, 0.9, 0.3, 1.16) both;
  will-change: transform, opacity;
}
.user-menu > a,
.user-menu > button {
  animation: userMenuItemIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.user-menu > :nth-child(1) { animation-delay: 0.03s; }
.user-menu > :nth-child(2) { animation-delay: 0.06s; }
.user-menu > :nth-child(3) { animation-delay: 0.09s; }
.user-menu > :nth-child(4) { animation-delay: 0.12s; }
.user-menu a:active,
.user-menu button:active { transform: scale(0.98); }

.btn,
.quick-add-card,
.chat-starter,
.category-choice,
.tx-row,
.mobile-add {
  transition:
    transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1),
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.btn:active,
.quick-add-card:active,
.chat-starter:active,
.category-choice:active,
.mobile-add:active { transform: scale(0.97); }
.tx-row:active { transform: scale(0.992); }

.modal { animation: modalIn 0.32s cubic-bezier(0.16, 1.04, 0.3, 1) both; }
.modal-backdrop { animation: fadeIn 0.2s ease both; }
.toast { animation: toastIn 0.26s cubic-bezier(0.16, 1.04, 0.3, 1) both; }

@keyframes userMenuPop {
  0% { opacity: 0; transform: translateY(14px) scale(0.84); }
  62% { opacity: 1; transform: translateY(-3px) scale(1.025); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes userMenuItemIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Prominent quick-add area */
.quick-actions-label {
  margin: 12px 2px 7px;
  color: var(--muted-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.btn-new {
  min-height: 56px;
  padding: 0 16px;
  border-radius: 15px;
  background: linear-gradient(135deg, #0a84ff 0%, #0066d6 100%);
  box-shadow:
    0 16px 28px -16px rgba(0, 122, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.btn-new:hover {
  background: linear-gradient(135deg, #1b90ff 0%, #0071e3 100%);
  transform: translateY(-1px);
}
.btn-new .icon { width: 20px; height: 20px; }
.btn-new kbd { font-size: 9px; }
.voice-entry {
  min-height: 64px;
  margin: 9px 0 18px;
  padding: 11px 12px;
  border-color: rgba(0, 122, 255, 0.16);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.14), rgba(90, 200, 250, 0.1));
  box-shadow:
    0 14px 28px -24px rgba(0, 122, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.voice-entry:hover {
  border-color: rgba(0, 122, 255, 0.28);
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.2), rgba(90, 200, 250, 0.14));
}
.voice-entry.is-active {
  border-color: rgba(0, 122, 255, 0.32);
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.22), rgba(90, 200, 250, 0.16));
}
.voice-entry-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, #0a84ff, #0066d6);
  box-shadow: 0 9px 18px -10px rgba(0, 122, 255, 0.9);
}
.voice-entry-icon .icon { width: 20px; height: 20px; }
.voice-entry-copy { gap: 3px; }
.voice-entry-copy strong { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; }
.voice-entry-copy small { color: #5e6b65; font-size: 10px; }
.voice-entry-chevron { width: 16px; height: 16px; }

/* Draggable column dividers */
.layout-resizer {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 38;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.layout-resizer.is-left { left: calc(var(--sidebar-w) - 5px); }
.layout-resizer.is-right { right: calc(var(--recent-w) - 5px); }
.layout-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 38px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.14);
  transform: translate(-50%, -50%);
  transition: height 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.layout-resizer:hover::after,
.layout-resizer:focus-visible::after,
body.is-resizing .layout-resizer::after {
  height: 64px;
  background: rgba(0, 122, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}
body.is-resizing {
  cursor: col-resize;
  user-select: none;
}
body.is-resizing * { cursor: col-resize !important; }
@media (max-width: 1320px) {
  .layout-resizer { display: none; }
}

/* Overview: full-height recent-flows sidebar on the right */
.app {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--recent-w);
  position: relative;
}
.app-main { min-width: 0; }
.sidebar-top { flex: 0 0 auto; }
.sidebar-foot { flex: 0 0 auto; margin-top: auto; }
.recent-sidebar {
  position: sticky;
  top: 0;
  z-index: 18;
  display: block;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 27px 13px 18px;
  border-left: 1px solid rgba(60, 60, 67, 0.09);
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.recent-sidebar-inner { display: flex; flex-direction: column; min-height: 100%; }
.recent-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}
.recent-sidebar-head h2 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.recent-sidebar-head .eyebrow { font-size: 8.5px; }
.recent-sidebar-head .link-btn { margin-top: 4px; font-size: 9.5px; white-space: nowrap; }
.recent-sidebar-list { margin-top: 12px; }
.recent-sidebar .recent-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 3px;
}
.recent-sidebar .recent-row .cat-icon { width: 34px; height: 34px; border-radius: 10px; }
.recent-sidebar .cat-icon .icon { width: 16px; height: 16px; }
.recent-sidebar .recent-main strong {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}
.recent-sidebar .recent-main span {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.35;
}
.recent-sidebar .recent-amount strong { font-size: 17px; font-weight: 600; }
.recent-sidebar .recent-amount span { font-size: 9px; }
.recent-sidebar-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 16px 4px 0;
  border-top: 1px solid rgba(60, 60, 67, 0.08);
  color: var(--muted);
  font-size: 10px;
}
.recent-sidebar-foot strong { color: var(--ink); font-family: var(--font-num); font-size: 18px; font-weight: 600; }
.habit-panel { margin-top: 12px; }
.overview-grid { grid-template-columns: 1fr; }
.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.member-panel-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 0 30px;
  margin-top: 17px;
}
.member-panel-wide .panel-head { grid-column: 1 / -1; }
.member-panel-wide .member-contrib { margin-top: 17px; }
.member-panel-wide .invite-mini { align-self: end; padding-top: 0; }
@media (max-width: 1320px) {
  .app { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .recent-sidebar { display: none; }
}
@media (max-width: 760px) {
  .member-panel-wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
}

/* Overview: main column + dedicated recent-flows rail */
.overview-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 17px;
  align-items: start;
  margin-top: 17px;
}
.overview-main-col { min-width: 0; }
.overview-main-col .overview-grid {
  grid-template-columns: 1fr;
  gap: 17px;
  margin-top: 0;
}
.overview-rail {
  display: flex;
  flex-direction: column;
  gap: 17px;
  min-width: 0;
}
.overview-rail .recent-panel { padding: 23px 20px 9px; }
.overview-rail .recent-row { grid-template-columns: 31px minmax(0, 1fr) auto; }
.overview-rail .recent-amount strong { font-size: 15px; }
@media (max-width: 1160px) {
  .overview-columns { grid-template-columns: minmax(0, 1fr) 300px; }
  .overview-rail .recent-panel { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 980px) {
  .overview-columns { grid-template-columns: 1fr; }
}

/* Black bank-card style balance card */
.overview-hero {
  background:
    radial-gradient(680px 300px at 92% 0%, rgba(197, 166, 92, 0.18), transparent 58%),
    radial-gradient(480px 260px at 4% 110%, rgba(255, 255, 255, 0.055), transparent 64%),
    linear-gradient(135deg, #050506 0%, #1b1b1d 48%, #08080a 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 32px 72px -48px rgba(0, 0, 0, 0.75);
}
.overview-hero::before {
  border-color: rgba(255, 255, 255, 0.13);
}
.overview-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.045) 44%, transparent 55%);
  pointer-events: none;
}
.hero-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.hero-kicker i { background: #d5b573; }
.bank-card-marks { display: flex; align-items: center; gap: 9px; opacity: 0.9; }
.bank-card-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.bank-chip {
  position: relative;
  display: block;
  width: 29px;
  height: 21px;
  overflow: hidden;
  border: 1px solid rgba(255, 235, 180, 0.6);
  border-radius: 4px;
  background: linear-gradient(135deg, #e8d29b 0%, #b18a42 50%, #f0ddb0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.bank-chip::before,
.bank-chip::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 1px;
  background: rgba(86, 60, 16, 0.52);
}
.bank-chip::before { top: 7px; }
.bank-chip::after { bottom: 6px; }
.bank-chip i {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 1px;
  background: rgba(86, 60, 16, 0.45);
}
.bank-contactless {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: rgba(226, 204, 157, 0.72);
  stroke-width: 1.6;
  stroke-linecap: round;
}
.hero-side {
  background: rgba(0, 0, 0, 0.3);
  border-left-color: rgba(255, 255, 255, 0.12);
}
.hero-chat-link {
  border-color: rgba(226, 204, 157, 0.26);
  background: rgba(226, 204, 157, 0.07);
  color: rgba(255, 255, 255, 0.82);
}
.hero-chat-link:hover { background: rgba(226, 204, 157, 0.13); color: #fff; }
.hero-chat-link .icon { color: #d5b573; }
.hero-delta.is-up { color: #e6c98c; background: rgba(213, 181, 115, 0.1); }
.hero-members .avatar { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
@media (max-width: 560px) {
  .bank-card-label { display: none; }
  .bank-chip { width: 25px; height: 19px; }
  .bank-contactless { width: 18px; height: 18px; }
}

/* Large quick-action block: roughly the upper half of the sidebar */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: clamp(320px, 46vh, 460px);
  min-height: 0;
  margin-bottom: 18px;
}
.quick-actions .quick-actions-label {
  flex: none;
  margin: 0 2px;
}
.quick-actions .btn-new {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  min-height: 0;
  height: auto;
  padding: 17px 18px;
  border-radius: 19px;
  font-size: 20px;
}
.quick-actions .btn-new .icon {
  width: 36px;
  height: 36px;
  margin-bottom: auto;
}
.quick-actions .btn-new span {
  margin-top: auto;
  font-size: 31px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
.quick-actions .btn-new small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.quick-actions .btn-new kbd {
  position: absolute;
  top: 17px;
  right: 17px;
  min-width: 24px;
  padding: 3px 5px;
  font-size: 9px;
}
.quick-actions .voice-entry {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 17px 18px;
  border-radius: 19px;
}
.quick-actions .voice-entry-icon {
  width: 46px;
  height: 46px;
  margin-bottom: auto;
}
.quick-actions .voice-entry-icon .icon { width: 23px; height: 23px; }
.quick-actions .voice-entry-copy {
  flex: 0 0 auto;
  margin-top: auto;
  gap: 3px;
}
.quick-actions .voice-entry-copy strong {
  font-size: 31px;
  font-weight: 760;
  letter-spacing: -0.025em;
  line-height: 1.12;
}
.quick-actions .voice-entry-copy small { font-size: 12px; }
.quick-actions .voice-entry-chevron {
  position: absolute;
  top: 19px;
  right: 17px;
  width: 18px;
  height: 18px;
}
@media (max-height: 760px) {
  .quick-actions { height: 280px; }
  .quick-actions .btn-new span,
  .quick-actions .voice-entry-copy strong { font-size: 24px; }
}

/* Compact weather + daily note in the top bar */
.topbar {
  display: block;
  height: auto;
  padding: 0;
}
.topbar-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  height: 72px;
  padding: 0 32px;
}
.btn-chat-top, .btn-invite { white-space: nowrap; }
.topbar-right { gap: 10px; min-width: 0; }
.topbar-brief {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 32px 8px;
  border-top: 1px solid rgba(60, 60, 67, 0.07);
  color: var(--muted);
}
.brief-weather-group { display: flex; align-items: center; gap: 4px; flex: none; }
.brief-weather {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 2px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.brief-weather:hover { background: rgba(0, 122, 255, 0.08); }
.brief-weather .icon { width: 13px; height: 13px; color: #007aff; }
.brief-weather.is-empty {
  color: #007aff;
  font-size: 10.5px;
  font-weight: 650;
}
.brief-weather.is-loading { color: var(--muted); font-size: 10px; cursor: default; }
.brief-weather-icon { font-size: 15px; line-height: 1; }
.brief-weather strong { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.brief-weather-city { overflow: hidden; max-width: 112px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.brief-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-soft);
  cursor: pointer;
}
.brief-refresh:hover { background: rgba(0, 122, 255, 0.08); color: #007aff; }
.brief-refresh .icon { width: 13px; height: 13px; }
.brief-spinner {
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(0, 122, 255, 0.18);
  border-top-color: #007aff;
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}
.brief-divider { width: 1px; height: 13px; flex: none; background: rgba(60, 60, 67, 0.14); }
.brief-quote {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1160px) {
  .topbar-main { padding: 0 24px; }
  .topbar-brief { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 860px) {
  .topbar-main {
    grid-template-columns: 1fr auto;
    height: 60px;
    padding: 0 16px;
    gap: 8px;
  }
  .topbar-brief {
    min-height: 32px;
    gap: 7px;
    padding: 2px 16px 7px;
  }
  .brief-weather { padding-left: 4px; padding-right: 4px; }
  .brief-weather-city { max-width: 78px; font-size: 9px; }
  .brief-quote { font-size: 9.5px; }
  .brief-weather strong { font-size: 11.5px; }
}
@media (max-width: 360px) {
  .brief-weather-city { max-width: 58px; }
  .brief-quote { font-size: 9px; }
}

/* Theme switch in account menus */
.theme-menu-action { display: flex; align-items: center; gap: 9px; }
.theme-menu-action .theme-menu-icon { flex: none; }
.theme-menu-action [data-theme-label] { flex: 1; text-align: left; }
.theme-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.28);
  transition: background-color 0.2s ease;
}
.theme-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.theme-switch.is-on { background: #34c759; }
.theme-switch.is-on i { transform: translateX(14px); }
.user-menu .theme-menu-action { width: 100%; }
.mobile-menu-action.theme-menu-action { width: 100%; text-align: left; }

/* Dark theme */
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b0b0d;
  --paper-deep: #141416;
  --paper-soft: #17171a;
  --card: #1c1c1f;
  --card-soft: #242427;
  --ink: #f5f5f7;
  --ink-soft: #d1d1d6;
  --muted: #9b9ba1;
  --muted-soft: #77777d;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --white: #1c1c1f;
  --amber-soft: #3b2b13;
  --clay-soft: #3a211c;
  --green-soft: #173522;
  --red-soft: #3a1b1a;
  --lime: #17243a;
  --sage: #284a72;
  --shadow-card: 0 18px 44px -30px rgba(0, 0, 0, 0.7);
  --shadow-float: 0 28px 80px -28px rgba(0, 0, 0, 0.75);
}
[data-theme="dark"] body {
  background:
    radial-gradient(900px 620px at 0% 0%, rgba(10, 132, 255, 0.14), transparent 62%),
    radial-gradient(720px 560px at 100% 2%, rgba(175, 82, 222, 0.11), transparent 60%),
    radial-gradient(840px 620px at 52% 100%, rgba(90, 200, 250, 0.08), transparent 64%),
    #0b0b0d;
}
[data-theme="dark"] ::selection { background: #164b86; color: #eaf4ff; }
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .recent-sidebar,
[data-theme="dark"] .mobile-nav {
  background: rgba(18, 18, 21, 0.84);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .sidebar { border-right-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .topbar { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .recent-sidebar { border-left-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .mobile-nav {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 38px -20px rgba(0, 0, 0, 0.7);
}
[data-theme="dark"] .panel,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .filters,
[data-theme="dark"] .member-card,
[data-theme="dark"] .platform-card,
[data-theme="dark"] .invite-mini-inner,
[data-theme="dark"] .sidebar-note,
[data-theme="dark"] .quick-add-card,
[data-theme="dark"] .chat-shell,
[data-theme="dark"] .chat-composer-wrap,
[data-theme="dark"] .chat-side,
[data-theme="dark"] .modal,
[data-theme="dark"] .invite-board,
[data-theme="dark"] .settings-code,
[data-theme="dark"] .habit-summary,
[data-theme="dark"] .habit-insight {
  background: linear-gradient(145deg, rgba(33, 33, 37, 0.94), rgba(23, 23, 26, 0.94));
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow:
    0 18px 45px -34px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
[data-theme="dark"] .topbar-brief { border-top-color: rgba(255, 255, 255, 0.07); }
[data-theme="dark"] .btn-outline,
[data-theme="dark"] .ledger-switch,
[data-theme="dark"] .month-nav,
[data-theme="dark"] .user-chip,
[data-theme="dark"] .theme-switch { border-color: rgba(255, 255, 255, 0.13); }
[data-theme="dark"] .btn-outline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}
[data-theme="dark"] .btn-outline:hover { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .ledger-switch,
[data-theme="dark"] .month-nav,
[data-theme="dark"] .user-chip {
  background: rgba(255, 255, 255, 0.055);
}
[data-theme="dark"] .ledger-switch:hover,
[data-theme="dark"] .month-arrow:hover,
[data-theme="dark"] .month-label:hover { background: rgba(255, 255, 255, 0.09); }
[data-theme="dark"] .month-arrow,
[data-theme="dark"] .month-label { color: var(--ink-soft); }
[data-theme="dark"] .nav-link { color: var(--muted); }
[data-theme="dark"] .nav-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
[data-theme="dark"] .nav-link.is-active { background: rgba(0, 122, 255, 0.18); color: #8fc7ff; }
[data-theme="dark"] .user-menu,
[data-theme="dark"] .mobile-user-menu {
  background: rgba(29, 29, 32, 0.97);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
}
[data-theme="dark"] .user-menu > a,
[data-theme="dark"] .user-menu > button,
[data-theme="dark"] .mobile-menu-action { color: var(--ink-soft); }
[data-theme="dark"] .user-menu > a:hover,
[data-theme="dark"] .user-menu > button:hover,
[data-theme="dark"] .mobile-menu-action:active { background: rgba(255, 255, 255, 0.07); }
[data-theme="dark"] .user-menu-sep,
[data-theme="dark"] .mobile-menu-sep { background: rgba(255, 255, 255, 0.09); }
[data-theme="dark"] .mobile-menu-ledger { background: rgba(0, 122, 255, 0.13); }
[data-theme="dark"] .mobile-menu-switch {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(100, 190, 255, 0.25);
  color: #8fc7ff;
}
[data-theme="dark"] .search-box input,
[data-theme="dark"] .select-wrap select,
[data-theme="dark"] .segmented,
[data-theme="dark"] .tx-type-toggle,
[data-theme="dark"] .category-choice,
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .sheet-field input,
[data-theme="dark"] .sheet-field select,
[data-theme="dark"] .sheet-field textarea,
[data-theme="dark"] .settings-form input,
[data-theme="dark"] .settings-form select,
[data-theme="dark"] .profile-name-field input,
[data-theme="dark"] .tx-item-input,
[data-theme="dark"] .chat-composer textarea,
[data-theme="dark"] .draft-amount input,
[data-theme="dark"] .draft-select select {
  background: #242428;
  border-color: rgba(255, 255, 255, 0.11);
  color: var(--ink);
}
[data-theme="dark"] .search-box input:focus,
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .sheet-field input:focus,
[data-theme="dark"] .settings-form input:focus,
[data-theme="dark"] .tx-item-input:focus,
[data-theme="dark"] .chat-composer textarea:focus {
  background: #2c2c31;
  border-color: rgba(100, 190, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
[data-theme="dark"] .segmented button.is-active,
[data-theme="dark"] .tx-type-toggle button.is-active {
  background: #3b3b41;
  color: var(--ink);
}
[data-theme="dark"] .tx-type-toggle button[data-tx-type="expense"].is-active { color: #ff6961; }
[data-theme="dark"] .tx-type-toggle button[data-tx-type="income"].is-active { color: #7ee2a0; }
[data-theme="dark"] .category-choice:hover { background: #333338; border-color: rgba(255, 255, 255, 0.16); }
[data-theme="dark"] .tx-row:hover,
[data-theme="dark"] .recent-row:hover { background: rgba(255, 255, 255, 0.055); }
[data-theme="dark"] .tx-date-head,
[data-theme="dark"] .settings-row,
[data-theme="dark"] .recent-sidebar-foot { border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .badge { background: #2b2b2f; color: var(--muted); }
[data-theme="dark"] .badge-green { background: #193a27; color: #7ee2a0; }
[data-theme="dark"] .badge-amber { background: #3b2b13; color: #ffd28a; }
[data-theme="dark"] .badge-clay { background: #3a211c; color: #ff9c86; }
[data-theme="dark"] .link-btn { color: #64b5ff; }
[data-theme="dark"] .link-btn:hover { color: #9bd0ff; }
[data-theme="dark"] .modal-head,
[data-theme="dark"] .tx-sheet-foot {
  background: rgba(29, 29, 32, 0.96);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .modal-close { background: #2c2c31; color: var(--ink); }
[data-theme="dark"] .amount-field { border-bottom-color: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] .amount-field input { color: var(--ink); }
[data-theme="dark"] .quick-add-card.is-chat { background: linear-gradient(135deg, #172b44, #1f1f23); }
[data-theme="dark"] .quick-add-icon { background: #2c2c31; color: #64b5ff; }
[data-theme="dark"] .quick-add-card.is-chat .quick-add-icon { background: #0a84ff; color: #fff; }
[data-theme="dark"] .habit-summary { background: linear-gradient(145deg, rgba(0, 122, 255, 0.14), rgba(33, 33, 37, 0.8)); }
[data-theme="dark"] .settings-code,
[data-theme="dark"] .invite-code-box { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .chat-bubble { color: var(--ink); }
[data-theme="dark"] .chat-bubble.is-assistant { background: #29292e; }
[data-theme="dark"] .mobile-settings-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--ink-soft);
}
[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}
[data-theme="dark"] .segmented button.is-active {
  background: #45454b;
  color: #ffffff;
}
[data-theme="dark"] .tx-title,
[data-theme="dark"] .recent-main strong,
[data-theme="dark"] .tx-amount strong:not(.income),
[data-theme="dark"] .recent-amount strong:not(.income),
[data-theme="dark"] .category-row strong,
[data-theme="dark"] .platform-row-head strong,
[data-theme="dark"] .member-contrib-head strong {
  color: var(--ink);
}
[data-theme="dark"] .tx-meta,
[data-theme="dark"] .recent-main span,
[data-theme="dark"] .tx-amount span,
[data-theme="dark"] .recent-amount span,
[data-theme="dark"] .tx-date-left span,
[data-theme="dark"] .tx-date-sum {
  color: var(--muted);
}
[data-theme="dark"] .tx-row,
[data-theme="dark"] .recent-row,
[data-theme="dark"] .category-row { color: var(--ink-soft); }
[data-theme="dark"] .tx-amount strong.income,
[data-theme="dark"] .recent-amount strong.income { color: #7ee2a0; }
[data-theme="dark"] .auth-panel { background: rgba(18, 18, 21, 0.94); color: var(--ink); }
[data-theme="dark"] .auth-art { background: #111114; }
[data-theme="dark"] .demo-card { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .toast { background: #2c2c31; }

/* Mobile topbar account menu and Dynamic Island add button */
.mobile-user { display: none; }
.mobile-settings-btn { display: none; }

@media (max-width: 860px) {
  .topbar-main {
    grid-template-columns: 1fr auto 1fr;
    gap: 4px;
    padding: 0 8px;
  }
  .mobile-ledger { display: none !important; }
  .topbar-left { gap: 0; }
  .month-remaining {
    margin-left: 0;
    padding: 5px 9px;
    font-size: 10.5px;
    font-weight: 700;
  }
  .month-remaining::before { width: 5px; height: 5px; box-shadow: 0 0 0 3px rgba(255, 159, 10, 0.14); }
  .topbar-right {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    min-width: 0;
  }
  .topbar-right > .avatar-stack,
  .topbar-right > .btn-chat-top,
  .topbar-right > .btn-invite { display: none; }
  .topbar-right .mobile-user { display: block; position: relative; }
  .mobile-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 104px;
    min-height: 42px;
    padding: 3px 4px 3px 3px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }
  .mobile-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(60, 60, 67, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.56);
    color: var(--muted);
    flex: none;
    cursor: pointer;
  }
  .mobile-settings-btn:active { transform: scale(0.94); }
  .mobile-settings-btn .icon { width: 15px; height: 15px; }
  .mobile-user-btn:active { background: rgba(118, 118, 128, 0.1); }
  .mobile-user-avatar {
    width: 36px;
    height: 36px;
    flex: none;
    font-size: 14px;
  }
  .mobile-user-name {
    overflow: hidden;
    max-width: 52px;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-user-chevron { width: 12px; height: 12px; flex: none; color: var(--muted-soft); }
  .mobile-user-menu {
    position: fixed;
    top: 64px;
    right: 10px;
    z-index: 70;
    width: min(252px, calc(100vw - 20px));
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    background: rgba(250, 248, 243, 0.96);
    box-shadow: 0 22px 50px -18px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    animation: userMenuPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.08) both;
  }
  .mobile-menu-ledger {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 2px 7px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(0, 122, 255, 0.08);
  }
  .mobile-menu-ledger-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
  .mobile-menu-ledger-copy span { color: var(--muted); font-size: 9px; }
  .mobile-menu-ledger-copy strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-menu-ledger-copy small { color: var(--muted); font-size: 9px; }
  .mobile-menu-switch {
    flex: none;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.65);
    color: #007aff;
    font: inherit;
    font-size: 10px;
    font-weight: 650;
    cursor: pointer;
  }
  .mobile-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 11px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
  }
  .mobile-menu-action:active { background: rgba(118, 118, 128, 0.1); }
  .mobile-menu-action .icon { width: 17px; height: 17px; color: var(--muted); }
  .mobile-menu-action.is-danger { color: #c0392b; }
  .mobile-menu-action.is-danger .icon { color: #c0392b; }
  .mobile-menu-sep { height: 1px; margin: 5px 10px; background: rgba(60, 60, 67, 0.08); }

  .mobile-ledger { gap: 5px; height: 32px; padding: 3px 5px; }
  .mobile-ledger span:nth-child(2) { max-width: 76px; font-size: 10.5px; }
  .mobile-ledger .icon { width: 11px; height: 11px; }
  .month-nav { gap: 0; padding: 2px; }
  .month-arrow { width: 20px; height: 27px; }
  .month-arrow .icon { width: 12px; height: 12px; }
  .month-label {
    min-width: 50px;
    height: 27px;
    padding: 0 2px;
    font-size: 11px;
    white-space: nowrap;
  }
  .month-full { display: none; }
  .month-short { display: inline; }

  .mobile-nav {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: center;
    justify-items: center;
    height: 60px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 23px;
    box-shadow:
      0 18px 38px -20px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
    overflow: visible;
  }
  .mobile-nav a,
  .mobile-nav-recent {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: auto;
    min-height: 48px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 10px;
    cursor: pointer;
    transform: translateY(-5px);
  }
  .mobile-nav-spacer { grid-column: 4; width: 1px; height: 1px; }
  .mobile-nav a[data-nav="platforms"] { grid-column: 5; }
  .mobile-add {
    position: relative;
    left: auto;
    top: -32px;
    bottom: auto;
    z-index: 32;
    transform: none;
    width: 132px;
    height: 64px;
    margin: 0;
    gap: 7px;
    border: 0;
    box-shadow:
      0 0 0 5px rgba(255, 255, 255, 0.84),
      0 16px 30px -10px rgba(0, 0, 0, 0.6),
      inset 0 1px 0 rgba(255, 255, 255, 0.16);
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 999px;
    background: linear-gradient(135deg, #e8f4ff 0%, #c9e3ff 100%) !important;
    color: #075bb8 !important;
    box-shadow:
      0 0 0 5px rgba(255, 255, 255, 0.84),
      0 16px 30px -12px rgba(0, 90, 190, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
    font-weight: 700;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-add:active { transform: scale(0.96); }
  .mobile-add .icon { width: 22px; height: 22px; }
}
@media (max-width: 360px) {
  .mobile-user-name { display: none; }
  .mobile-user-btn { max-width: 46px; padding-right: 2px; }
  .mobile-add { width: 100px; }
}

[data-theme="dark"] .mobile-add {
  background: linear-gradient(135deg, #17334f 0%, #10263c 100%) !important;
  color: #8fc7ff !important;
  box-shadow:
    0 0 0 5px rgba(20, 20, 23, 0.96),
    0 16px 30px -12px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .voice-wave i, .voice-island, .user-menu, .user-menu > a, .user-menu > button { animation: none !important; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
