/* ==========================================================================
   iPhone mockups. The app screen is built at the real 430 × 932 pt size and
   phones.js scales it to fit the glass, so it looks the same at any size.

   --w is the phone's outer width. It follows the window HEIGHT as well as
   the width, so a whole phone always fits on a laptop screen.
   ========================================================================== */

.screen {
  --w: min(clamp(220px, 36vh, 280px), 78vw);
  position: relative;
  box-sizing: border-box;
  width: var(--w);
  padding: calc(var(--w) * .034);                /* titanium edge + bezel */
  border-radius: calc(var(--w) * .165);
  background: linear-gradient(140deg, #8a8f99 0%, #3b3f47 22%, #24272d 50%, #3b3f47 78%, #7d828c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .22),
    inset 0 0 0 2px rgba(0, 0, 0, .5),
    0 1px 2px rgba(0, 0, 0, .4),
    0 calc(var(--w) * .12) calc(var(--w) * .22) calc(var(--w) * -.08) rgba(0, 0, 0, .8);
}

/* Side buttons: action button and volume keys on the left, side key on the right. */
.screen::before, .screen::after {
  content: ""; position: absolute; width: 3px; border-radius: 2px;
}
.screen::before {
  left: -2px; top: 17%; height: 25%;
  background: linear-gradient(to bottom,
    #565b64 0 12%, transparent 12% 30%,
    #565b64 30% 62%, transparent 62% 70%,
    #565b64 70% 100%);
}
.screen::after { right: -2px; top: 27%; height: 13%; background: #565b64; }

/* The glass: black bezel ring, rounded display, app clipped inside. */
.screen > .glass {
  --k: .6;
  position: relative; overflow: hidden;
  aspect-ratio: 430 / 932;
  border-radius: calc(var(--w) * .135);
  background: #f2efe6;
  box-shadow: 0 0 0 calc(var(--w) * .022) #050608;
  isolation: isolate;
}

.glass > .app {
  position: absolute; top: 0; left: 0;
  width: 430px; height: 932px;
  transform: scale(var(--k)); transform-origin: 0 0;
}

/* ---------- App base ---------- */

.app {
  --sans: "Geist", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  --a-bg: #f2efe6;
  --a-card: #ffffff;
  --a-navy: #14213d;
  --a-brass: #b08d57;
  --a-line: #e3ddcd;
  --a-muted: #6b7180;
  --a-green: #3a7d5c;
  --a-red: #a93a3f;
  overflow: hidden;
  background: var(--a-bg);
  color: var(--a-navy);
  font: 400 15px/1.35 var(--sans);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  user-select: none; pointer-events: none;
}
.app svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app .mono { font-family: var(--mono); font-weight: 500; letter-spacing: -.02em; }

/* Status bar, Dynamic Island, home indicator */
.p-status { height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 46px; }
.p-time { font: 600 17px/1 -apple-system, "SF Pro Text", var(--sans); letter-spacing: -.01em; }
.p-sys { display: flex; align-items: center; gap: 6px; }
.p-sys svg { width: auto; height: 12px; stroke: none; fill: var(--a-navy); }
.p-island { position: absolute; top: 11px; left: 50%; width: 126px; height: 37px; margin-left: -63px; border-radius: 20px; background: #000; z-index: 5; }
.p-home-ind { position: absolute; bottom: 8px; left: 50%; width: 140px; height: 5px; margin-left: -70px; border-radius: 3px; background: var(--a-navy); z-index: 5; }

/* Header */
.p-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 14px; }
.p-brand { display: flex; align-items: center; gap: 11px; color: var(--a-navy); }
.app .p-seal { stroke: none; width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 3px 8px -3px rgba(120, 90, 40, .45); }
.app .p-word { width: auto; height: 20px; stroke: none; }
.p-tools { display: flex; align-items: center; height: 42px; padding: 0 6px; background: var(--a-card); border: 1px solid var(--a-line); border-radius: 14px; }
.p-tools > span { display: grid; place-items: center; width: 34px; height: 100%; color: #4a5266; font-size: 13px; font-weight: 700; }
.p-tools > span.mono { font-size: 12px; width: 38px; }
.p-tools > i { width: 1px; height: 26px; background: var(--a-line); margin: 0 3px; }
.p-tools svg { width: 18px; height: 18px; }

.p-body { padding: 0 20px; }

/* Bottom tab bar + floating add button */
.p-tabs { position: absolute; left: 0; right: 0; bottom: 0; height: 86px; display: flex; padding: 0 6px 30px; background: #fff; border-top: 1px solid var(--a-line); z-index: 4; }
.p-tabs > div { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #4a5266; font-size: 10.5px; font-weight: 500; }
.p-tabs > div.on { color: var(--a-brass); }
.p-tabs > div.on::before { content: ""; position: absolute; top: -1px; width: 26px; height: 3px; border-radius: 2px; background: var(--a-brass); }
.p-tabs svg { width: 22px; height: 22px; }
.p-fab { position: absolute; right: 20px; bottom: 106px; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--a-brass); color: #fff; box-shadow: 0 8px 18px -6px rgba(120, 90, 40, .55); z-index: 4; }
.p-fab svg { width: 28px; height: 28px; stroke-width: 2; }

/* Shared bits */
.p-card { background: var(--a-card); border-radius: 18px; }
.p-seg { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--a-line); border-radius: 14px; background: rgba(255,255,255,.35); }
.p-seg > span { flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; font-size: 14px; font-weight: 700; color: #4a5266; }
.p-seg > span.on { background: var(--a-navy); color: #fff; }
.p-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; }
.p-ico svg { width: 20px; height: 20px; }
.ic-car { background: #ece4d3; color: var(--a-brass); }
.ic-food { background: #f0dcdc; color: var(--a-red); }
.ic-other { background: #e6e4df; color: #4a5266; }
.ic-shop { background: #e9e6ef; color: #5b5470; }
.ic-bill { background: #dfe6ec; color: #3d5a73; }
.ic-health { background: #dfeadf; color: var(--a-green); }
.ic-pay { background: #dceae2; color: var(--a-green); }
.a-who .p-ico.ic-warn, .ic-warn { background: var(--a-red); color: #fff; }

/* ---------- Home ---------- */

.h-month { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 14px 0 12px; font-size: 16px; font-weight: 700; }
.h-month b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #fff; border: 1px solid var(--a-line); }
.h-month b.off { background: transparent; color: #b5b8c0; }
.h-month svg { width: 18px; height: 18px; }
.h-save { position: relative; overflow: hidden; padding: 30px 22px 22px; border-radius: 20px; background: var(--a-navy); color: #fff; }
.h-save::before { content: ""; position: absolute; top: 8px; left: 12px; right: 12px; height: 6px; background: radial-gradient(circle, #3a4766 2.2px, transparent 2.6px) 0 0 / 16px 6px repeat-x; }
.h-save small { display: block; font-size: 13px; color: #aab1c3; }
.h-save strong { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.h-save strong em { font: 600 12px/1 var(--mono); font-style: normal; padding: 6px 9px; border-radius: 99px; background: #2c3a5c; }
.h-save .mono { font-size: 13px; color: #aab1c3; }
.h-stamp { position: absolute; top: 24px; right: 16px; padding: 5px 13px; border: 1.5px solid var(--a-brass); border-radius: 99px; color: var(--a-brass); font: 600 12px/1 var(--mono); transform: rotate(-6deg); }
.h-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.h-pair .p-card { padding: 16px 18px; }
.h-pair small { font-size: 13px; color: var(--a-muted); }
.h-pair .mono { display: block; margin: 8px 0 2px; font-size: 21px; }
.h-break { margin-top: 14px; padding: 18px 20px 20px; }
.h-break h4 { margin: 0 0 14px; font-size: 14px; font-weight: 700; color: #4a5266; }
.h-ring { position: relative; width: 210px; height: 210px; margin: 4px auto 16px; }
.app .h-donut { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.h-donut circle { fill: none; stroke-width: 20; }
.h-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.h-center small { font-size: 12.5px; color: var(--a-muted); }
.h-center b { margin: 3px 0 2px; font-size: 22px; }
.h-center span { font-size: 11.5px; color: var(--a-muted); }
.h-legend { display: grid; gap: 9px; font-size: 13px; }
.h-legend div { display: flex; align-items: center; gap: 10px; }
.h-legend i { width: 10px; height: 10px; border-radius: 3px; }
.h-legend .mono { margin-left: auto; font-size: 13px; }
.h-legend small { width: 44px; text-align: right; color: var(--a-muted); font: 500 12px var(--mono); }

/* ---------- Ledger ---------- */

.l-search { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; background: #fff; border-radius: 14px; color: #9aa0ad; font-size: 16px; }
.l-search svg { width: 19px; height: 19px; color: #4a5266; }
.l-filter { display: flex; gap: 8px; margin: 12px 0 6px; }
.l-filter > span { flex: 1; display: grid; place-items: center; height: 42px; border-radius: 12px; background: #fff; border: 1px solid var(--a-line); font-size: 14px; font-weight: 700; color: #4a5266; }
.l-filter > span.on { background: var(--a-navy); border-color: var(--a-navy); color: #fff; }
.l-filter > span.sq { flex: 0 0 42px; color: var(--a-brass); }
.l-filter svg { width: 18px; height: 18px; }
.l-sum { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 0; font-size: 11px; color: var(--a-muted); }
.l-sum b { font-weight: 600; }
.l-sum .in { color: var(--a-green); }
.l-sum .out { color: var(--a-red); }
.l-day { margin: 16px 0 2px; font-size: 13px; font-weight: 700; color: #4a5266; }
.l-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.l-row + .l-row { border-top: 1px solid var(--a-line); }
.l-time { width: 42px; font-size: 12px; color: var(--a-navy); }
.l-txt { flex: 1; min-width: 0; }
.l-txt b { display: flex; align-items: center; gap: 7px; font-size: 15.5px; white-space: nowrap; }
.l-txt small { display: flex; align-items: center; gap: 5px; margin-top: 3px; overflow: hidden; white-space: nowrap; font-size: 12.5px; color: var(--a-muted); }
.l-txt small svg { flex: none; width: 13px; height: 13px; }
.l-check { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; background: #ece4d3; color: #7a5f30; font-size: 10.5px; font-weight: 700; }
.l-check svg { width: 11px; height: 11px; }
.l-amt { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.l-amt.out { color: var(--a-red); }
.l-amt.in { color: var(--a-green); }
.l-amt svg { width: 15px; height: 15px; color: #4a5266; }
.l-kebab { width: 10px; color: #a3a8b3; }
.l-kebab svg { width: 16px; height: 16px; }

/* ---------- Accounts ---------- */

.a-title { margin: 2px 0 6px; font-size: 17px; font-weight: 700; }
.a-note { margin: 0 0 12px; font-size: 12.5px; color: var(--a-muted); line-height: 1.55; }
.a-gmail { padding: 16px 18px; }
.a-who { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px dashed var(--a-line); }
.a-who .p-ico { background: var(--a-navy); color: #fff; }
.a-who > div:nth-child(2) { min-width: 0; }
.a-who b { display: block; font-size: 15px; }
.a-who small { display: block; font-size: 12px; color: var(--a-muted); line-height: 1.4; }
.a-ok { margin-left: auto; flex: none; display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--a-green); }
.a-ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--a-green); }
.a-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.a-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 42px; border-radius: 11px; background: #f2efe6; border: 1px solid var(--a-line); font-size: 13.5px; font-weight: 700; }
.a-btn.bad { background: #fff; border-color: var(--a-red); color: var(--a-red); }
.a-btn.navy { background: var(--a-navy); border-color: var(--a-navy); color: #fff; }
.a-btn svg { width: 15px; height: 15px; }
.a-big { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; margin-top: 12px; border-radius: 14px; background: var(--a-navy); color: #fff; font-size: 15px; font-weight: 700; }
.a-big svg { width: 18px; height: 18px; }
.a-row { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.a-row .a-title { margin: 0; }
.a-add { display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 700; color: var(--a-brass); }
.a-add svg { width: 15px; height: 15px; }
.a-rcpt { padding: 16px 18px; }
.a-fwd { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 16px; }
.a-fwd .p-ico { background: #ece4d3; color: var(--a-brass); }
.a-fwd b { display: block; font-size: 14.5px; }
.a-fwd small { font-size: 12px; color: var(--a-muted); }
.a-fwd svg.chev { margin-left: auto; width: 16px; height: 16px; color: #a3a8b3; }

/* ---------- Budgets ---------- */

.b-label { margin: 2px 0 12px; font-size: 13px; color: var(--a-muted); }
.b-total { padding: 16px 18px; margin-bottom: 12px; }
.b-total > small { font-size: 12.5px; color: var(--a-muted); }
.b-tot-row { display: flex; justify-content: space-between; margin-top: 8px; }
.b-tot-row span { display: flex; flex-direction: column; gap: 2px; }
.b-tot-row span + span { text-align: right; }
.b-tot-row em { font-style: normal; font-size: 11.5px; color: var(--a-muted); }
.b-tot-row b { font-size: 19px; }
.b-item { padding: 15px 18px 13px; margin-bottom: 11px; }
.b-top { display: flex; align-items: center; gap: 12px; }
.b-top b { font-size: 15px; }
.b-top .mono { margin-left: auto; font-size: 16px; font-weight: 500; }
.b-top svg.chev { width: 16px; height: 16px; color: #a3a8b3; }
.b-bar { height: 9px; margin: 13px 0 8px; border-radius: 99px; background: #e6e7ea; overflow: hidden; }
.b-bar i { display: block; height: 100%; min-width: 9px; border-radius: 99px; background: var(--a-brass); }
.b-bar.warm i { background: #c4703a; }
.b-foot { display: flex; justify-content: space-between; }
.b-foot small { font-size: 12.5px; color: var(--a-muted); }

/* ---------- Recurring ---------- */

.r-note { margin: 2px 0 12px; font-size: 13px; color: var(--a-muted); line-height: 1.55; }
.r-sum { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; margin-bottom: 12px; background: var(--a-navy); color: #fff; }
.r-sum small { font-size: 12px; color: #aab1c3; }
.r-sum b { font-size: 19px; }
.r-sum .mono { font-size: 13px; color: #e2c48e; }
.r-bill { padding: 15px 18px; margin-bottom: 11px; }
.r-txt { min-width: 0; }
.r-txt b { display: block; font-size: 15px; }
.r-txt small { font: 500 12.5px var(--mono); color: var(--a-muted); }
.r-due { margin-left: auto; padding: 4px 10px; border-radius: 99px; background: #ece4d3; color: #7a5f30; font-size: 11.5px; font-weight: 700; }
.r-due.soon { background: #f0dcdc; color: var(--a-red); }
.r-paid { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--a-green); }
.r-paid svg { width: 14px; height: 14px; stroke-width: 2.4; }
.r-bill.done { opacity: .78; }
.r-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; margin-top: 12px; border-radius: 11px; background: #f2efe6; border: 1px solid var(--a-line); font-size: 13.5px; font-weight: 700; }
.r-btn svg { width: 15px; height: 15px; stroke-width: 2.2; }
.r-add { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border: 1px dashed #cfc6b0; border-radius: 14px; font-size: 14px; font-weight: 700; color: #4a5266; }
.r-add svg { width: 16px; height: 16px; }
