/* Family Ledger: account screens, the loading state, desktop and tablet layouts, and the family board.
   Loaded after styles.css. */

/* ---------- visibility by size ---------- */
@media (max-width: 1023.98px) { .d-only { display: none !important; } .tabs.no-m { display: none; } }
@media (min-width: 1024px) { .m-only { display: none !important; } }

/* ---------- log in, sign up, join, new month ---------- */
.authv, .login { min-height: 100dvh; }
.auth-main { max-width: 440px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 12px) var(--gut) calc(var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 20px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.brand-l { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; color: var(--ink); }
.bmark { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--ink); display: grid; place-items: center; flex: none; }
.bmark svg { width: 22px; height: 22px; }
.hero-t { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; text-wrap: balance; }
.hero-t em { font-style: italic; }
.teaser { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--accent-tint); }
.teaser > div:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.teaser span { font-size: 12.5px; color: var(--ink-2); }
.teaser b { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.login-grid { display: flex; flex-direction: column; gap: 20px; }
.auth-fill { flex: 1; }
.auth-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.auth-main > .auth-foot { padding-top: 4px; }
.step-l { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--ink); } .steps i.cur { background: var(--accent); }
.authv .lt h1 { font-size: 34px; }
/* a big choice card: Just me / A household */
.opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); width: 100%; transition: border-color 0.12s ease, background-color 0.12s ease; }
.opt .grow { display: flex; flex-direction: column; gap: 3px; }
.opt b { font-size: 15.5px; font-weight: 600; }
.opt .grow > span { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.opt[aria-pressed="true"] { border: 1.5px solid var(--accent); background: var(--accent-tint); }
.opt[aria-pressed="true"] .tile { background: var(--paper); }
.check.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
/* the month's income card */
.inc-t { font-size: 46px; }
.lead { display: flex; flex-direction: column; }
.lead-r { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-block: -6px; font-size: 14px; color: var(--ink); background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.lead-r > i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lead-r > span:not(.dots) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.lead-r .dots { flex: 1; min-width: 12px; border-bottom: 1.5px dotted var(--d5); transform: translateY(4px); }
.lead-r b { font-weight: 600; white-space: nowrap; }
.inc-add { border-top: 1px solid var(--line-2); padding-top: 12px; }
.amt-pill { display: inline-flex; align-items: center; height: 40px; padding: 0 12px; border-radius: var(--r-sm); background: var(--ground); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.srow .lbl small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); line-height: 1.35; margin-top: 1px; }
.srow + .srow::before { left: 60px; }

/* ---------- loading ---------- */
.bootv { max-width: 440px; margin: 0 auto; padding: calc(var(--safe-t) + 72px) var(--gut); display: flex; flex-direction: column; gap: 16px; }
.sk { background: var(--line-2); border-radius: var(--r-sm); position: relative; overflow: hidden; }
.sk-title { height: 34px; width: 62%; }
.sk-dial { height: 220px; border-radius: var(--r-xl); margin: 8px 0; }
.sk-line { height: 14px; }
.sk-line.short { width: 48%; }
.sk-row { height: 58px; border-radius: var(--r-lg); }
@media (prefers-reduced-motion: no-preference) { .sk { animation: sk-pulse 1.6s ease-in-out infinite; } }
@keyframes sk-pulse { 50% { opacity: 0.55; } }

/* ---------- desktop and tablet (1024px and up) ---------- */
@media (min-width: 1024px) {
  :root { --gut: 48px; }
  .app { max-width: none; margin: 0; padding: 0 0 72px 272px; }
  .app.bare { padding: 0; }
  .top { height: 72px; padding: 0 32px; }
  main { max-width: 1160px; margin: 0 auto; padding: 8px var(--gut) 0; gap: 24px; }
  .app.tabpage main { padding-top: 36px; }
  #toasts { left: calc(50% + 136px); bottom: 32px; }
  body.nonav #toasts { bottom: 32px; }
  .offline-pill { top: 20px; }

  /* the tab bar becomes a sidebar */
  .tabs { position: fixed; inset: 0 auto 0 0; transform: none; width: 272px; height: auto; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 22px 16px; border: 0; border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; view-transition-name: sidebar; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
  .tabs a .ic { width: 22px; height: 22px; }
  .tabs a[aria-current="page"] { background: var(--ground); color: var(--ink); font-weight: 600; }
  .tabs .brand { order: -2; min-height: 48px; margin-bottom: 14px; font-size: 16px; font-weight: 600; color: var(--ink); padding: 0 6px; }
  .tabs .brand .bmark { width: 32px; height: 32px; border-radius: 10px; }
  .tabs .brand .bmark svg { width: 19px; height: 19px; }
  .tabs .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs a.plus { order: -1; width: auto; height: 50px; min-height: 50px; margin: 0 0 18px; border: 0; border-radius: var(--r-md); justify-content: center; font-weight: 600; font-size: 15px; color: var(--on-accent); background: var(--accent); box-shadow: none; gap: 8px; box-sizing: border-box; }
  .tabs a.plus .ic { width: 20px; height: 20px; }
  .tabs a.plus .kbd { background: transparent; border-color: color-mix(in srgb, var(--on-accent) 45%, transparent); color: var(--on-accent); margin-left: 4px; }
  .tabs .nav-h { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); padding: 20px 12px 6px; }
  .tabs .nav-sp { flex: 1; min-height: 20px; }

  /* page grids */
  .again, .mini-row { margin-right: 0; padding-right: 0; flex-wrap: wrap; }
  .home-grid { display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); gap: 32px 48px; align-items: start; }
  .lt h1.home-h1 { font-size: 40px !important; }
  .streak-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .cal-grid { display: grid; grid-template-columns: minmax(400px, 480px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .cal-grid > .stack:first-child { position: sticky; top: 24px; }
  /* the show filters (also the colour legend) wrap beside the month instead of scrolling */
  .cal-show.chips.nowrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .budget-grid, .detail-grid, .calc-grid { display: grid; grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .budget-grid > .bg-a, .calc-grid > .calc-in { position: sticky; top: 24px; }
  .settings-grid { display: block; column-count: 2; column-gap: 32px; }
  .settings-grid > * { break-inside: avoid; margin-bottom: 18px; }
  .mbody, .app.route-todo main > *, .app.route-routine main > *, .app.route-goals main > *, .app.route-loans main > *, .app.route-more main > * { max-width: 760px; width: 100%; }
  .addv, .formv, .added-main { margin-top: 32px; margin-bottom: 32px; background: var(--ground); }

  /* sheets become centered panels */
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: var(--r-xl); width: 460px; padding-bottom: 24px; }
  .sheet-grip { visibility: hidden; height: 14px; }
  .login .auth-main { max-width: 1040px; justify-content: center; }
  .login .login-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 72px; align-items: center; }
  .login .hero-t { font-size: 56px; }
}

/* time picker: the app's own control instead of the browser popup */
.wheels { position: relative; display: grid; grid-template-columns: 1fr 1fr 0.9fr; height: 220px; margin: 4px 0 0;
  -webkit-mask-image: linear-gradient(transparent, #000 32%, #000 68%, transparent); mask-image: linear-gradient(transparent, #000 32%, #000 68%, transparent); }
.wheel-band { position: absolute; inset: 88px 0 auto; height: 44px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line-2); pointer-events: none; }
.wheel { position: relative; overflow-y: auto; padding: 88px 0; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; outline: none; touch-action: pan-y; }
.wheel::-webkit-scrollbar { display: none; }
.wheel:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); border-radius: 14px; }
.wheel-i { height: 44px; display: grid; place-items: center; scroll-snap-align: center; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--ink-3); cursor: pointer; user-select: none; transition: color 120ms ease; }
.wheel-i.on { color: var(--ink); font-weight: 600; }
.wheel-hint { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 0; }

/* ---------- family board: sized by the viewport so it reads across a room ---------- */
.app.route-board { max-width: none; padding: 0; }
.bv { min-height: 100dvh; padding: clamp(18px, 2.4vw, 40px); display: flex; flex-direction: column; gap: clamp(16px, 1.6vw, 24px); }
.bv-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.bv-top h1 { font-size: clamp(30px, 3.4vw, 56px); line-height: 1; }
.bv-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; }
.bv-clock b { font-size: clamp(38px, 3.8vw, 64px); line-height: 1; }
.bv-clock b small { font-size: 0.46em; }
.bv-clock span { font-size: clamp(14px, 1.1vw, 18px); color: var(--ink-2); }
.bv-x { align-self: flex-start; }
.bv-grid { display: grid; gap: clamp(14px, 1.4vw, 22px); align-items: start; flex: 1; }
.bv-col { display: flex; flex-direction: column; gap: clamp(14px, 1.4vw, 22px); }
.bv-card { border-radius: 28px; padding: clamp(18px, 1.8vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.bv-money { align-items: stretch; gap: 18px; }
.bv-money .donut { align-self: center; }
.bv-money .donut-c span { font-size: 13px; }
.bv-legend { display: flex; flex-direction: column; gap: 9px; }
.bv-legend span { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.bv-legend i { width: 12px; height: 12px; border-radius: 3px; }
.bv-legend b { margin-left: auto; font-weight: 600; }
.av.bv-av { width: 48px; height: 48px; font-size: 18px; }
.bv-streak { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 6px; border-radius: 18px; background: var(--accent-tint); font-size: 14px; font-weight: 600; white-space: nowrap; }
.bv-streak svg { width: 26px; height: 26px; }
.bv-tasks > div { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: clamp(16px, 1.3vw, 19px); }
.bv-tasks .tm { width: 84px; font-size: 17px; white-space: nowrap; flex: none; }
.bv-tasks .tm small { font-size: 12px; color: var(--ink-3); letter-spacing: 0.06em; }
.bv-tasks .tile { width: 38px; height: 38px; }
.bv-tasks b { font-size: 14px; }
.bv-tasks .done .grow { text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; color: var(--ink-3); }
.bv-tasks .check { width: 24px; height: 24px; }
.bv-todos { border-top: 1px solid var(--line-2); padding-top: 10px; display: flex; flex-direction: column; }
.bv-todos > div { display: flex; align-items: center; gap: 10px; min-height: 38px; font-size: 16px; }
.bv-todos i { width: 18px; height: 18px; border-radius: 9px; border: 1.6px solid var(--d4); flex: none; }
.bv-todos em { font-style: normal; font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.bv-todos em.txt-bad { color: var(--bad); }
.bv-gl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bv-gl > div { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; text-align: center; }
.bv-gl b:not(.dsp) { font-size: 15px; font-weight: 600; }
.bv-gl > div > span:last-child { font-size: 13px; color: var(--ink-3); }
@media (max-width: 900px) { .bv-grid { grid-template-columns: 1fr !important; } .bv-top { flex-wrap: wrap; } }
