/* Sprout — phones: the bottom tab bar (js/tabbar.js) and Finance's phone layouts (js/pages/finance-mobile.js).
   Nothing here applies above 760px, so the desktop and tablet layouts are unchanged. */
.tabbar, .fin-m { display: none; }

@media (max-width: 760px) {
  :root { --tabbar-h: 76px; }

  /* ---------- Tab bar ---------- */
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; position: fixed; z-index: 30;
    left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); height: 64px; padding: 0 4px; border-radius: 24px;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; padding: 0;
    color: var(--muted); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar small { font-size: 10px; font-weight: 600; }
  .tabbar [aria-current="page"] { color: var(--accent); }
  [data-theme="dark"] .tabbar [aria-current="page"] { color: var(--accent-2); }
  .tabbar .tab-capture { justify-self: center; width: 54px; height: 54px; border-radius: 50%; background: var(--hero); color: #fff; transform: translateY(-12px);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 40%, transparent); transition: transform var(--dur-1) var(--ease-out); }
  .tabbar .tab-capture[aria-current="page"] { color: #fff; }
  .tabbar .tab-capture svg { width: 24px; height: 24px; }
  .tabbar .tab-capture:active { transform: translateY(-12px) scale(.94); }

  /* Room for the bar under the page, and under anything pinned to the bottom */
  .view { padding-bottom: calc(var(--tabbar-h) + 16px); }
  .listen-box, .td-focusbar, .fit-detail-actions { bottom: calc(var(--tabbar-h) + 12px); }
  .toast, .btoast { bottom: calc(var(--tabbar-h) + 16px); }
  .ask-card { bottom: calc(var(--tabbar-h) + 12px); }

  /* ---------- Finance on phones ---------- */
  .fin-m { display: grid; gap: 16px; margin-bottom: 20px; }
  .fin-over > .page-head, .fin-over > .fin-kpis, .fin-over > .fin-grid { display: none; }
  .fin-ins > .fin-grid > section:nth-child(2) { display: none; } /* "Where it went": the donut above shows it */
  .fm-hide .fm-amt { filter: blur(9px); user-select: none; }

  .fm-balance { position: relative; overflow: hidden; isolation: isolate; padding: 20px; border-radius: 24px; background: var(--hero); color: #fff; }
  .fm-balance::after { content: ""; position: absolute; z-index: -1; width: 260px; height: 260px; right: -90px; bottom: -130px; border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .16); box-shadow: 0 0 0 34px rgba(255, 255, 255, .04); }
  .fm-bal-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .8); }
  .fm-eye { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
  .fm-eye svg { width: 16px; height: 16px; }
  .fm-bal-top .fm-chip { margin-left: auto; background: rgba(255, 255, 255, .16); color: #fff; }
  .fm-bal-amt { margin: 12px 0 2px; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
  .fm-bal-sub { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .78); }
  .fm-bal-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-top: 20px; }
  .fm-pri, .fm-ghost { height: 46px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; }
  .fm-pri { border: 0; background: #fff; color: var(--accent-3); }
  .fm-ghost { border: 1px solid rgba(255, 255, 255, .35); color: #fff; background: transparent; }
  .fm-pri svg, .fm-ghost svg { width: 18px; height: 18px; }

  .fm-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .fm-quick a, .fm-quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0; border: 0; background: none; font: inherit; color: var(--text); text-decoration: none; cursor: pointer; }
  .fm-quick span { width: 58px; height: 58px; border-radius: 24px; display: grid; place-items: center; background: var(--surface); color: var(--accent); transition: transform var(--dur-1) var(--ease-out); }
  [data-theme="dark"] .fm-quick span { color: var(--accent-2); }
  .fm-quick svg { width: 22px; height: 22px; }
  .fm-quick small { font-size: 13px; font-weight: 600; }
  .fm-quick a:active span, .fm-quick button:active span { transform: scale(.94); }

  .fm-card { padding: 20px; border-radius: 24px; background: var(--surface); }
  .fm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
  .fm-card-head h3 { margin: 0; font-size: 16px; }
  .fm-eyebrow { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
  .fm-big { margin: 4px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .fm-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
    background: var(--accent-soft); color: var(--accent); }
  [data-theme="dark"] .fm-chip { color: var(--accent-2); }
  .fm-chip.bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
  .fm-chip svg { width: 14px; height: 14px; }

  .fm-bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .fm-trend { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-top: 24px; }
  .fm-bars li { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .fm-bar { position: relative; width: 100%; max-width: 30px; height: 92px; display: flex; align-items: flex-end; }
  .fm-bar i { display: block; width: 100%; border-radius: 8px; background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
  .fm-bars .is-top .fm-bar i { background: var(--accent); }
  .fm-bars .is-future .fm-bar i { opacity: .45; }
  .fm-bars small { font-size: 11px; color: var(--muted); }
  .fm-bars .is-top small { color: var(--text); font-weight: 700; }
  .fm-bar em { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); padding: 4px 8px; border-radius: 8px; font-style: normal; font-size: 11px; font-weight: 700;
    white-space: nowrap; background: var(--accent-3); color: #fff; }
  .fm-foot { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: 13px; color: var(--muted); }
  .fm-foot i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

  .fm-tip { display: block; padding: 16px 20px; border-radius: 24px; background: var(--hero); color: #fff; text-decoration: none; }
  .fm-chip-tip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: rgba(255, 255, 255, .16); }
  .fm-chip-tip svg { width: 13px; height: 13px; }
  .fm-tip p { margin: 12px 0 0; font-size: 16px; line-height: 1.4; letter-spacing: -0.005em; }

  .fm-list { padding: 8px 16px 8px; border-radius: 24px; background: var(--surface); }
  .fm-list-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
  .fm-list-head h3 { margin: 0; font-size: 16px; }
  .fm-list-head a { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
  [data-theme="dark"] .fm-list-head a { color: var(--accent-2); }
  .fm-list-head a svg { width: 14px; height: 14px; }
  .fm-list ul { list-style: none; margin: 0; padding: 0; }
  .fm-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
  .fm-list li + li { border-top: 1px solid var(--line); }
  .fm-tile { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 16px;
    background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--surface)); color: var(--c, var(--accent)); }
  .fm-tile-date { --c: var(--accent); display: flex; flex-direction: column; justify-content: center; gap: 0; line-height: 1; font-size: 16px; }
  .fm-tile-date small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
  .fm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .fm-main strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fm-main small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fm-list li > b { font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fm-list li > b.pos { color: var(--accent); }
  [data-theme="dark"] .fm-list li > b.pos { color: var(--accent-2); }
  .fm-empty { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }

  .fm-donut-wrap { position: relative; width: 210px; margin: 0 auto 16px; }
  .fm-donut { display: block; width: 100%; height: auto; transform: rotate(-90deg); }
  .fm-donut circle { fill: none; stroke-width: 16; }
  .fm-donut .fm-donut-track { stroke: var(--surface-2); }
  .fm-donut-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .fm-donut-in b { font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
  .fm-donut-in small { font-size: 13px; color: var(--muted); }
  .fm-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
  .fm-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
  .fm-legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--c); }
  .fm-legend span { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fm-legend b { font-variant-numeric: tabular-nums; }

  .fm-note { display: flex; align-items: center; gap: 12px; padding: 16px 16px; border-radius: 24px; background: var(--accent-soft); color: var(--text); text-decoration: none; }
  .fm-note.bad { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
  .fm-note-ico { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
  .fm-note.bad .fm-note-ico { color: var(--danger); }
  .fm-note-ico svg { width: 20px; height: 20px; }
  .fm-note > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  .fm-note strong { font-size: 14px; }
  .fm-note small { font-size: 13px; color: var(--muted); }
  .fm-note > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }

  /* Transactions read as a clean list: a coloured tile, the name, and the amount */
  .tx-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "dot main amt del"; column-gap: 12px; align-items: center; }
  .tx-row .tx-dot { grid-area: dot; width: 40px; height: 40px; border-radius: 12px; background: radial-gradient(circle, var(--c) 0 5px, transparent 5.5px), color-mix(in srgb, var(--c) 16%, var(--surface)); }
  .tx-row .tx-main { grid-area: main; min-width: 0; }
  .tx-row .tx-amt { grid-area: amt; }
  .tx-row .tx-main small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tx-row .tx-del { grid-area: del; width: 28px; height: 28px; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .tabbar .tab-capture, .fm-quick span { transition: none; }
}
