/* ==========================================================================
   Organise by Design — a calm place to keep the record
   It's Me by Design · warm editorial theme · French Blue experience accent
   ========================================================================== */

:root {
  color-scheme: light;

  /* Foundation palette (It's Me by Design — warm editorial) */
  --ground: #f7f0e3;
  --surface: #fffdf8;
  --surface-alt: #f5efe2;
  --panel: #efe7d6;
  --line: #e4d9c4;
  --ink: #3b322b;
  --ink-soft: #6b6055;
  --ink-faint: #978a7b;

  /* Master brand accent — Soft Gold (used sparingly: brand moments only) */
  --gold: #bb915b;
  --gold-deep: #8c6838;
  --gold-wash: #f2e9d8;

  /* Experience accent — French Blue (Organise by Design, per Brand Code Book 6) */
  --accent: #476b82;
  --accent-bright: #7898ae;
  --accent-deep: #3a5a6e;
  --accent-wash: #dce8ef;
  --accent-tint: #eef4f7;

  /* Status (never bright red) */
  --ok: #6f9881;
  --ok-wash: #dce9e1;
  --info: #7898ae;
  --warn: #bb915b;
  --err: #8a5a63;
  --err-wash: #efe3e4;

  /* Importance scale */
  --imp-very: #8a5a63;
  --imp-high: #bb915b;
  --imp-mod: #7898ae;
  --imp-normal: #b7ab98;

  --radius-lg: 1.5rem;
  --radius: 1.15rem;
  --radius-sm: 0.7rem;
  --shadow-card: 0 1px 2px rgba(59, 50, 43, 0.04), 0 12px 30px -18px rgba(59, 50, 43, 0.22);
  --shadow-float: 0 8px 24px -8px rgba(58, 90, 110, 0.35);
  --shadow-sheet: 0 -8px 40px -12px rgba(59, 50, 43, 0.28);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Nunito", ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-script: "Parisienne", "Snell Roundhand", cursive;

  --page-max: 460px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; letter-spacing: -0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent-deep); text-underline-offset: 2px; }
::placeholder { color: var(--ink-faint); }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------------------
   App shell — a phone-width column that also sits calmly on desktop
   -------------------------------------------------------------------------- */
#app {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  background: var(--ground);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 80px -20px rgba(59, 50, 43, 0.18);
}
@media (min-width: 520px) {
  body { padding: 0; display: grid; place-items: center; background: #efe6d5; }
  #app { height: min(920px, 100%); border-radius: 28px; border: 1px solid var(--line); }
}

.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 12px) 20px calc(var(--tabbar-h) + var(--safe-b) + 28px);
  scroll-padding-top: 80px;
}
.screen--flush { padding-left: 0; padding-right: 0; }
.screen--nochrome { padding-bottom: calc(var(--safe-b) + 28px); }
.screen--chrome { padding-top: calc(var(--safe-t) + 56px); }

.wrap { padding: 0 20px; }

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.page-title { font-size: 1.9rem; margin-bottom: 4px; }
.page-sub { color: var(--ink-soft); font-size: 0.98rem; margin-bottom: 20px; }
.section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 24px 0 10px;
}
.muted { color: var(--ink-soft); }
.script { font-family: var(--font-script); color: var(--accent); font-size: 1.4em; line-height: 1; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 48px;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:hover { background: var(--accent-deep); }
.btn--block { display: flex; width: 100%; }
.btn--ghost { background: transparent; color: var(--accent-deep); border: 1.5px solid var(--line); }
.btn--ghost:hover { background: var(--accent-tint); border-color: var(--accent-wash); }
.btn--quiet { background: var(--panel); color: var(--ink); }
.btn--quiet:hover { background: var(--line); }
.btn--danger { background: var(--err); }
.btn--danger:hover { background: #74474f; }
.btn--sm { padding: 8px 15px; min-height: 38px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.linkbtn { color: var(--accent-deep); font-weight: 700; font-family: var(--font-display); font-style: italic; }
.textlink { font-family: var(--font-display); font-style: italic; color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--accent-bright); }

/* --------------------------------------------------------------------------
   Cards, list rows
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 14px; }

.rowlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row:active { background: var(--accent-tint); }
.row__body { flex: 1; min-width: 0; }
.row__title { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { display: block; font-size: 0.85rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row__count { color: var(--ink-faint); font-size: 0.9rem; font-weight: 700; }
.row__chev { color: var(--ink-faint); flex-shrink: 0; }

.folder-ico, .avatar, .type-ico {
  flex-shrink: 0; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-wash); color: var(--accent-deep);
}
.avatar { border-radius: 50%; font-weight: 800; font-size: 0.9rem; text-transform: uppercase; background: var(--gold-wash); color: var(--gold-deep); }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  min-height: 54px;
}
.topbar__title { font-family: var(--font-display); font-size: 1.15rem; flex: 1; text-align: center; }
.iconbtn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--ink-soft);
}
.iconbtn:active { background: var(--panel); }
.iconbtn svg { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   Bottom tab bar
   -------------------------------------------------------------------------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around;
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-faint); font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.02em; padding: 6px 10px; border-radius: 12px;
  flex: 1;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab--fab {
  flex: 0 0 auto;
  margin-top: -22px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-float);
  justify-content: center;
}
.tab--fab svg { width: 26px; height: 26px; }
.tab--fab:active { transform: scale(0.94); }

/* --------------------------------------------------------------------------
   Welcome — "hello"
   -------------------------------------------------------------------------- */
.welcome {
  position: absolute; inset: 0; z-index: 95;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  background:
    radial-gradient(130% 90% at 50% 12%, var(--accent-wash) 0%, transparent 58%),
    linear-gradient(180deg, var(--gold-wash) 0%, var(--ground) 46%);
  text-align: center;
  transition: opacity 0.42s ease, transform 0.42s ease;
}
.welcome.is-leaving { opacity: 0; transform: scale(1.02); }
.welcome__brand {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(0.95rem, 3.4vw, 1.15rem);
  letter-spacing: 0.04em;
  color: var(--accent);
  opacity: 0;
  animation: welcomeBrand 0.9s ease forwards 0.15s;
}
.welcome__hello {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(4.5rem, 20vw, 12rem);
  line-height: 1.25;
  color: var(--accent-deep);
  padding: 0.28em 0.16em 0.22em;
  overflow: visible;
  -webkit-clip-path: inset(-30% 100% -30% 0);
  clip-path: inset(-30% 100% -30% 0);
  animation: helloWrite 1.3s cubic-bezier(0.6, 0, 0.2, 1) forwards 0.3s;
}
.welcome__hint {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--ink-faint);
  opacity: 0;
  animation: welcomeHint 0.7s ease forwards 1.7s;
}
@keyframes welcomeBrand { to { opacity: 1; } }
@keyframes helloWrite { to { -webkit-clip-path: inset(-30% -20% -30% 0); clip-path: inset(-30% -20% -30% 0); } }
@keyframes welcomeHint { to { opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) {
  .welcome__brand, .welcome__hint { opacity: 1; animation: none; }
  .welcome__hello { -webkit-clip-path: none; clip-path: none; animation: none; }
}

/* --------------------------------------------------------------------------
   Onboarding
   -------------------------------------------------------------------------- */
.onb {
  position: absolute; inset: 0; z-index: 80;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-wash), transparent 60%),
    linear-gradient(180deg, var(--gold-wash), var(--ground) 40%);
  display: flex; flex-direction: column;
}
.onb__track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.onb__track::-webkit-scrollbar { display: none; }
.onb__slide {
  flex: 0 0 100%; scroll-snap-align: center;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 32px calc(var(--safe-t) + 40px);
  text-align: left;
}
.onb__art {
  width: 96px; height: 96px; border-radius: 26px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--accent); box-shadow: var(--shadow-card);
  margin-bottom: 26px;
}
.onb__art svg { width: 46px; height: 46px; }
.onb__eyebrow { font-family: var(--font-display); font-style: italic; color: var(--accent); margin-bottom: 10px; }
.onb__slide h2 { font-size: 1.9rem; margin-bottom: 14px; }
.onb__slide p { color: var(--ink-soft); font-size: 1.03rem; margin-bottom: 12px; max-width: 33ch; }
.onb__slide--warn .onb__art { color: var(--err); border-color: #e2cdcf; background: var(--err-wash); }
.onb__alert {
  display: flex; gap: 10px; align-items: flex-start;
  max-width: 34ch; margin-bottom: 16px;
  padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--err-wash); border: 1px solid #e2cdcf; border-left: 3px solid var(--err);
  color: #6a3f45; font-size: 0.99rem; line-height: 1.5;
}
.onb__alert svg { flex: 0 0 auto; color: var(--err); margin-top: 2px; }
.onb__alert b { color: var(--err); }
.onb__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px calc(var(--safe-b) + 24px);
}
.onb__dots { display: flex; gap: 7px; }
.onb__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all 0.2s ease; }
.onb__dot.is-on { background: var(--accent); width: 22px; border-radius: 4px; }
.onb__skip { color: var(--ink-faint); font-weight: 700; font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Lock screen
   -------------------------------------------------------------------------- */
.lock {
  position: absolute; inset: 0; z-index: 90;
  background: linear-gradient(180deg, var(--accent-deep), #2c4553);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 32px calc(var(--safe-b) + 40px);
  text-align: center;
}
.lock__mark { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 6px; }
.lock__hint { color: rgba(255, 255, 255, 0.75); margin-bottom: 34px; font-size: 0.95rem; max-width: 26ch; }
.lock__dots { display: flex; gap: 16px; margin-bottom: 34px; min-height: 18px; }
.lock__dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.6); }
.lock__dot.is-filled { background: #fff; border-color: #fff; }
.lock.is-shake { animation: shake 0.4s; }

.lock--access .access-input {
  width: min(320px, 80vw); font: inherit; font-size: 1.1rem; letter-spacing: 0.08em;
  text-align: center; text-transform: uppercase;
  color: #fff; background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.lock--access .access-input::placeholder { color: rgba(255,255,255,0.55); letter-spacing: 0.02em; text-transform: none; }
.lock--access .access-input:focus { outline: none; border-color: #fff; background: rgba(255,255,255,0.16); }
.lock--access .btn { min-width: min(320px, 80vw); }
.lock--access .lock__err { color: rgba(255,255,255,0.9); min-height: 1.4em; max-width: 30ch; margin-top: 14px; font-size: 0.9rem; }

.lock--setup { background: linear-gradient(180deg, var(--accent-deep), #2c4553); }
.lock--setup .lock__mark { margin-bottom: 22px; }
.setup-card {
  background: var(--surface); color: var(--ink); border-radius: var(--radius-lg);
  padding: 28px 24px; max-width: 380px; width: 100%; text-align: left;
  box-shadow: var(--shadow-float);
}
.setup-card .onb__art { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 16px; }
.setup-card h2 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 10px; }
.setup-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 12px; }
.setup-card p.muted { font-size: 0.86rem; }
.setup-card .btn--block { margin: 6px 0 4px; }
.setup-card .linkbtn { display: block; width: 100%; text-align: center; padding: 10px; color: var(--ink-faint); font-weight: 700; font-size: 0.9rem; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 16px; }
.key {
  height: 74px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff; font-size: 1.6rem; font-family: var(--font-display);
  display: grid; place-items: center;
}
.key:active { background: rgba(255, 255, 255, 0.28); }
.key--blank { background: none; }
.key--action { font-size: 0.85rem; font-family: var(--font-body); font-weight: 700; background: none; }
.lock__err { color: #ffd9c2; min-height: 20px; margin-top: 18px; font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Home — "What would you like to document today?"
   -------------------------------------------------------------------------- */
.home__hero { padding: 20px 4px 4px; }
.home__hello { font-family: var(--font-display); font-style: italic; color: var(--accent); margin-bottom: 8px; }
.home__q { font-size: 2rem; line-height: 1.15; margin-bottom: 22px; }

.docpick {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  text-align: left;
}
.docpick__ico { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-wash); color: var(--accent-deep); display: grid; place-items: center; flex-shrink: 0; }
.docpick__label { flex: 1; }
.docpick__label b { display: block; font-weight: 800; }
.docpick__label span { font-size: 0.86rem; color: var(--ink-soft); }
.docpick__chev { color: var(--ink-faint); }

.quickstrip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.quickchip {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 13px; border-radius: var(--radius-sm);
  background: var(--surface-alt); border: 1px solid var(--line);
  font-weight: 700; font-size: 0.9rem; text-align: left;
}
.quickchip svg { width: 19px; height: 19px; color: var(--accent); flex-shrink: 0; }
.quickchip:active { background: var(--accent-tint); }

.home__recent .row__title { white-space: normal; }

.home__fineprint {
  display: block;
  width: 100%;
  margin-top: 26px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--ink-faint);
  text-align: center;
  padding: 4px 8px;
}
.home__fineprint u { color: var(--accent-deep); text-decoration-thickness: 1px; }
.home__fineprint:active { color: var(--ink-soft); }

.nudge {
  display: flex; gap: 12px;
  margin-top: 16px; padding: 15px 16px;
  background: var(--accent-tint);
  border: 1px solid var(--accent-wash);
  border-radius: var(--radius);
}
.nudge > div:first-child { color: var(--accent); flex-shrink: 0; }
.nudge__body b { display: block; font-family: var(--font-display); font-size: 1rem; margin-bottom: 3px; }
.nudge__body span { display: block; font-size: 0.86rem; color: var(--ink-soft); margin-bottom: 10px; }
.nudge__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.nudge__actions .btn { flex: 0 0 auto; }
.nudge__actions .linkbtn { font-size: 0.86rem; font-style: normal; }

/* --------------------------------------------------------------------------
   Composer (bottom sheet)
   -------------------------------------------------------------------------- */
.sheet-scrim {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(44, 37, 31, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 61;
  max-height: 92%;
  background: var(--ground);
  border-radius: 26px 26px 0 0;
  box-shadow: var(--shadow-sheet);
  transform: translateY(101%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
}
.sheet.is-open { transform: translateY(0); }
.sheet__grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 4px; flex-shrink: 0; }
.sheet__head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 12px; flex-shrink: 0; }
.sheet__head h2 { font-size: 1.25rem; flex: 1; }
.sheet__body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px calc(var(--safe-b) + 20px); -webkit-overflow-scrolling: touch; }
.sheet__foot {
  padding: 12px 20px calc(var(--safe-b) + 16px);
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; gap: 10px; flex-shrink: 0;
}

/* type selector */
.typegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.typebtn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.68rem; font-weight: 700; color: var(--ink-soft);
  text-align: center; line-height: 1.15;
}
.typebtn svg { width: 20px; height: 20px; }
.typebtn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* fields */
.field { margin-top: 16px; }
.field > label { display: block; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px; }
.input, .textarea, .select {
  width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px;
  font-size: 1rem;
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.field-note { font-size: 0.83rem; line-height: 1.5; color: var(--ink-soft); margin: 8px 2px 0; }
.field-note b { color: var(--ink); font-weight: 700; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6055' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-bright); outline: none; }

.dictate-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.dictate-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--accent-tint); color: var(--accent-deep);
  font-weight: 700; font-size: 0.85rem; border: 1px solid var(--accent-wash);
}
.dictate-btn.is-live { background: var(--err-wash); color: var(--err); border-color: #e8d3d5; }
.dictate-btn.is-live .dot { animation: pulse 1s infinite; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.25} }

/* attach */
.attach-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.attach-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 84px; height: 84px; border-radius: 14px;
  border: 1.5px dashed var(--line); background: var(--surface);
  color: var(--accent-deep); font-size: 0.72rem; font-weight: 700;
  justify-content: center;
}
.attach-tile svg { width: 22px; height: 22px; }
.attach-thumb {
  position: relative; width: 84px; height: 84px; border-radius: 14px;
  overflow: hidden; border: 1px solid var(--line); background: var(--panel);
  flex-shrink: 0;
}
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-thumb .file-badge { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 6px; font-size: 0.64rem; font-weight: 700; color: var(--ink-soft); }
.attach-thumb .x {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(44, 37, 31, 0.72); color: #fff;
  display: grid; place-items: center; font-size: 0.8rem;
}

/* chips (people / folders / tags / importance) */
.chipwrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.86rem; font-weight: 700; color: var(--ink-soft);
}
.chip.is-on { background: var(--accent-wash); border-color: var(--accent-bright); color: var(--accent-deep); }
.chip--add { border-style: dashed; color: var(--accent-deep); }
.chip--imp.is-on { background: var(--imp-color, var(--accent-wash)); border-color: transparent; color: #fff; }

.imp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--imp-color); }

/* --------------------------------------------------------------------------
   Library — segmented control + views
   -------------------------------------------------------------------------- */
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.review-head .iconbtn { margin-top: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--accent-deep); }

.segmented {
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border-radius: 999px;
  margin: 4px 0 18px;
}
.segmented button {
  flex: 1; padding: 8px 6px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 800; color: var(--ink-soft);
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--accent-deep); box-shadow: var(--shadow-card); }

.searchbar { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; box-shadow: var(--shadow-card); }
.searchbar svg { width: 18px; height: 18px; color: var(--ink-faint); flex-shrink: 0; }
.searchbar input { flex: 1; border: none; background: none; font-size: 0.98rem; }
.searchbar input:focus { outline: none; }

.filterbar { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.filterbar::-webkit-scrollbar { display: none; }
.filterpill {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface-alt); border: 1px solid var(--line);
  font-size: 0.82rem; font-weight: 700; color: var(--ink-soft);
}
.filterpill.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* timeline */
.tl-daygroup { margin-top: 22px; }
.tl-daygroup:first-child { margin-top: 8px; }
.tl-date { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; }
.entry-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  box-shadow: var(--shadow-card); position: relative;
  border-left: 4px solid var(--imp-color, var(--line));
}
.entry-card + .entry-card { margin-top: 10px; }
.entry-card:active { background: var(--accent-tint); }
.entry-card__top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.entry-card__type { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.entry-card__time { font-size: 0.78rem; color: var(--ink-faint); margin-left: auto; }
.entry-card__title { font-family: var(--font-display); font-size: 1.08rem; margin-bottom: 3px; }
.entry-card__excerpt { font-size: 0.9rem; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.minitag { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink-soft); }
.minitag--person { background: var(--gold-wash); border-color: #ecdcc0; color: var(--gold-deep); }
.minitag--folder { background: var(--accent-tint); border-color: var(--accent-wash); color: var(--accent-deep); }
.entry-card__amount { font-weight: 800; font-family: var(--font-display); }
.amount-in { color: var(--ok); }
.amount-out { color: var(--err); }

/* calendar */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-card); }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal__month { font-family: var(--font-display); font-size: 1.2rem; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal__dow { text-align: center; font-size: 0.66rem; font-weight: 800; color: var(--ink-faint); padding-bottom: 6px; }
.cal__cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 0.9rem; font-weight: 600; position: relative; gap: 3px;
}
.cal__cell.is-out { color: var(--ink-faint); opacity: 0.5; }
.cal__cell.is-today { color: var(--accent-deep); font-weight: 800; }
.cal__cell.is-selected { background: var(--accent); color: #fff; }
.cal__cell.has-entries::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-bright); }
.cal__cell.is-selected.has-entries::after { background: #fff; }
.cal__daylist { margin-top: 18px; }

/* parenting schedule — calendar day washes */
.cal__cell.care-me:not(.is-selected) { background: var(--accent-wash); }
.cal__cell.care-other:not(.is-selected) { background: var(--gold-wash); }
.cal__cell.care-split:not(.is-selected) { background: linear-gradient(110deg, var(--accent-wash) 0 50%, var(--gold-wash) 50% 100%); }
.cal__cell.care-changed:not(.is-selected) { box-shadow: inset 0 0 0 2px var(--err); }
.cal__key--care-me { background: var(--accent-wash); border: 1.5px solid var(--accent); }
.cal__key--care-other { background: var(--gold-wash); border: 1.5px solid var(--gold); }

/* parenting schedule — day card in the calendar day list */
.care-daycard { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
.care-edge-me { border-left-color: var(--accent); }
.care-edge-other { border-left-color: var(--gold); }
.care-edge-split { border-left-color: var(--accent-bright); }
.care-daycard__head { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 8px; }
.care-changed-tag { color: var(--err); }
.carerow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.carerow:last-of-type { border-bottom: none; }
.care-txt-me { color: var(--accent-deep); font-weight: 700; }
.care-txt-other { color: var(--gold-deep); font-weight: 700; }
.care-txt-blank { color: var(--ink-faint); font-weight: 600; }
.care-daycard__note { font-size: 0.88rem; color: var(--ink-soft); margin-top: 8px; font-style: italic; }
.care-daycard__foot { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* parenting schedule — the day × time grid (composer + read-only) */
.care-dates { display: flex; gap: 10px; }
.care-dates > div { flex: 1; min-width: 0; }
.care-hint { font-size: 0.82rem; margin: 4px 0 10px; }
.caregrid { margin: 12px 0 4px; }
.caregrid__wk { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin: 12px 0 6px; }
.caregrid__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.caregrid table { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 300px; }
.caregrid thead th { font-size: 0.7rem; font-weight: 800; color: var(--ink-faint); text-align: center; padding: 2px; }
.caregrid tbody th { text-align: left; color: var(--ink-soft); font-weight: 700; white-space: nowrap; padding-right: 8px; font-size: 0.82rem; }
.carecell { width: 100%; min-width: 60px; display: block; text-align: center; padding: 9px 6px; border-radius: 8px; font-size: 0.78rem; font-weight: 700; border: 1px solid var(--line); background: var(--surface-alt); color: var(--ink-faint); }
button.carecell { cursor: pointer; }
.carecell.is-me { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }
.carecell.is-other { background: var(--gold-wash); border-color: var(--gold); color: var(--gold-deep); }
.seg--3 button { font-size: 0.82rem; padding: 9px 4px; }
.install-steps { margin: 4px 0 10px; padding-left: 1.3em; }
.install-steps li { margin-bottom: 8px; line-height: 1.5; }
.install-steps li::marker { color: var(--accent); font-weight: 700; }
.cc-rows { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.cc-row > span { display: block; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 5px; }

/* finance summary */
.fin-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.fin-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow-card); }
.fin-stat span { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.fin-stat b { display: block; font-family: var(--font-display); font-size: 1.5rem; margin-top: 4px; }

/* --------------------------------------------------------------------------
   Detail view
   -------------------------------------------------------------------------- */
.detail__type { display: inline-flex; align-items: center; gap: 8px; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.detail__title { font-size: 1.7rem; margin-bottom: 6px; }
.detail__when { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 18px; }
.detail__body { white-space: pre-wrap; line-height: 1.65; margin-bottom: 20px; }
.detail__section { margin-top: 20px; }
.detail__gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.detail__gallery a { aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; text-align: center; padding: 8px; font-size: 0.7rem; color: var(--ink-soft); font-weight: 700; }
.detail__gallery img { width: 100%; height: 100%; object-fit: cover; }
.kv { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.94rem; }
.kv:last-child { border-bottom: none; }
.kv b { flex: 0 0 40%; color: var(--ink-soft); font-weight: 700; }

/* --------------------------------------------------------------------------
   Misc: empty state, toast, modal
   -------------------------------------------------------------------------- */
.empty { text-align: center; padding: 50px 24px; color: var(--ink-soft); }
.empty svg { width: 42px; height: 42px; color: var(--accent-bright); margin-bottom: 14px; }
.empty h3 { font-size: 1.2rem; margin-bottom: 6px; color: var(--ink); }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--ground);
  padding: 12px 20px; border-radius: 999px; font-size: 0.9rem; font-weight: 700;
  box-shadow: var(--shadow-float); z-index: 70;
  opacity: 0; pointer-events: none; transition: all 0.25s ease; max-width: 90%;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal-scrim { position: fixed; inset: 0; z-index: 210; background: rgba(44,37,31,0.45); display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-scrim.is-open { opacity: 1; pointer-events: auto; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 340px; max-height: 86vh; overflow-y: auto; box-shadow: var(--shadow-float); }
.explainer { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.55; margin-bottom: 16px; }
.explainer p { margin-bottom: 9px; }
.explainer b { color: var(--ink); font-weight: 700; }
.report-overlay { position: fixed; inset: 0; z-index: 200; background: #fff; display: flex; flex-direction: column; }
.report-overlay__close { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 12px 16px; background: var(--ink); color: var(--ground); font-weight: 700; }
.report-overlay iframe { flex: 1; border: 0; width: 100%; }
.modal h3 { font-size: 1.25rem; margin-bottom: 8px; }
.modal p { color: var(--ink-soft); margin-bottom: 16px; font-size: 0.95rem; }
.modal__actions { display: flex; gap: 10px; }
.modal__actions .btn { flex: 1; }

.prompt-input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 1rem; margin-bottom: 16px; }
.modal .prompt-input:last-of-type { margin-bottom: 8px; }
.pf-msg { font-size: 0.82rem; color: var(--err); min-height: 1.1em; margin: 0 0 6px; }
.pf-msg.is-ok { color: var(--ok); }
.modal .sub-label { margin-top: 4px; }
.modal .rowlist .row__title { white-space: normal; }
.modal .rowlist .row { flex-wrap: wrap; row-gap: 2px; }
.modal .rowlist .row .linkbtn { font-size: 0.85rem; }
.pf-reveal {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.05rem; word-break: break-all;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 12px 0 2px; color: var(--ink);
}

/* settings */
.set-group { margin-top: 8px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-bottom: none; }
.set-group .set-row:last-child { border-bottom: 1px solid var(--line); }
.set-row:active { background: var(--accent-tint); }
.set-row > svg { color: var(--ink-faint); flex-shrink: 0; }
.set-row__body { flex: 1; }
.set-row__body b { font-weight: 700; display: block; }
.set-row__body span { font-size: 0.84rem; color: var(--ink-soft); }
.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; flex-shrink: 0; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.15s; }
.switch.is-on { background: var(--accent); }
.switch.is-on::after { transform: translateX(18px); }

.safety-note { background: var(--accent-tint); border: 1px solid var(--accent-wash); border-radius: var(--radius); padding: 16px; font-size: 0.9rem; color: var(--accent-deep); }
.safety-note b { font-weight: 700; }
.safety-note > b:first-child { display: block; margin-bottom: 4px; font-family: var(--font-display); font-weight: 400; font-size: 1.02rem; }
.safety-note .dsum-p { display: block; margin-top: 9px; }
.safety-note--warn { background: var(--err-wash); border-color: #e2cdcf; color: #6a3f45; }
.safety-note--warn > b:first-child { color: var(--err); }
.safety-note--warn b { color: var(--err); }

.quickexit {
  position: absolute; top: calc(var(--safe-t) + 10px); right: 14px; z-index: 45;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 6px 11px; border-radius: 999px;
  background: var(--err); color: #fff;
}
.offline-chip {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 10px); transform: translateX(-50%);
  z-index: 46;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--gold-wash); border: 1px solid #e6d6b3; color: var(--gold-deep);
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em;
  box-shadow: var(--shadow-card);
}
.offline-chip svg { width: 15px; height: 15px; }
@media (min-width: 820px) { .offline-chip { left: calc(50% + 124px); top: 14px; } }

.appmenu {
  position: absolute; top: calc(var(--safe-t) + 8px); left: 12px; z-index: 45;
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
}
.appmenu:active { background: var(--panel); }
.tab--settings { display: none; }

.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   New components (finance status, expected payments, sub-labels)
   -------------------------------------------------------------------------- */
.sub-label { display: block; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.field > label.checkrow, .checkrow {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 0.95rem; letter-spacing: normal;
  text-transform: none; color: var(--ink); padding: 4px 0; margin-bottom: 0;
}
.checkrow input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.checkrow span { flex: 1; }

.segmented button[aria-selected="true"] { background: var(--surface); color: var(--accent-deep); box-shadow: var(--shadow-card); }

.minitag--warn { background: var(--err-wash); border-color: #e8d3d5; color: var(--err); }
.minitag--ok { background: var(--ok-wash); border-color: #cfe0d6; color: #4f7a63; }

.tl-count { font-size: 0.8rem; color: var(--ink-faint); font-weight: 700; margin-bottom: 10px; }

.cal__legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.72rem; color: var(--ink-faint); margin-top: 12px; }
.cal__key { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal__key--entry { background: var(--accent-bright); }
.cal__key--exp { border: 1.5px solid var(--gold); background: transparent; }
.cal__cell.has-expected::before {
  content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%;
  border: 1.5px solid var(--gold); box-sizing: border-box;
}
.cal__cell.has-entries.has-expected::after { transform: translateX(-6px); }
.cal__cell.has-entries.has-expected::before { transform: translateX(6px); }
.cal__cell.is-selected.has-expected::before { border-color: #fff; }

.entry-card--expected { border-left-color: var(--gold); background: var(--gold-wash); box-shadow: none; }
.entry-card--expected .entry-card__foot { margin-top: 12px; }

.fin-outstanding { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 14px; margin: 10px 0 0; background: var(--err-wash); border: 1px solid #e8d3d5; border-radius: var(--radius-sm); font-size: 0.86rem; color: var(--err); }
.fin-outstanding b { font-weight: 800; }
.fin-actions { display: flex; gap: 10px; margin: 14px 0 4px; flex-wrap: wrap; }
.fin-actions .btn { flex: 1; min-width: 150px; }

.topbar--detail { padding-right: 110px; }

/* folders + housekeeping checklists */
.folders-intro { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5; margin-bottom: 14px; }
.folders-intro b { color: var(--accent-deep); }
.folder-ico { font-size: 1.1rem; font-weight: 700; }
.row__ring {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center;
}
.row__ring::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); }

.prep-head { margin: 4px 0 14px; }
.prep-bar { height: 8px; border-radius: 999px; background: var(--panel); overflow: hidden; margin-bottom: 8px; }
.prep-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.prep-head p { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.45; }
.prep-row { align-items: flex-start; }
.prep-row .row__title { white-space: normal; }
.prep-row .row__meta { white-space: normal; line-height: 1.4; }
.prep-tick { flex-shrink: 0; width: 24px; display: grid; place-items: center; color: var(--ok); margin-top: 1px; }
.prep-row.is-done { background: var(--ok-wash); }
.prep-row.is-done .row__title { color: #4f7a63; }
.prep-row:not(.is-done) .prep-tick::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid var(--line);
}

/* --------------------------------------------------------------------------
   Responsive — phone / small phone / tablet / desktop
   -------------------------------------------------------------------------- */

/* very small phones */
@media (max-width: 360px) {
  :root { --tabbar-h: 58px; }
  body { font-size: 15px; }
  .screen { padding-left: 15px; padding-right: 15px; }
  .home__q { font-size: 1.7rem; }
  .page-title { font-size: 1.6rem; }
  .typegrid { grid-template-columns: repeat(3, 1fr); }
}

/* the phone frame on medium+ screens (unchanged behaviour, tidied) */
@media (min-width: 520px) and (max-width: 819px) {
  body { padding: 24px; }
  #app { height: min(900px, 100%); }
}

/* TABLET & DESKTOP — left sidebar nav, roomier content */
@media (min-width: 820px) {
  :root { --page-max: 760px; }
  body { display: grid; place-items: center; padding: 0; background: #e9dfcb; }
  #app {
    max-width: 1180px;
    width: 100%;
    height: 100vh;
    border: none; border-radius: 0;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    box-shadow: 0 0 120px -30px rgba(59, 50, 43, 0.25);
  }
  @media (min-width: 1240px) {
    #app { height: min(940px, 100vh); border-radius: 24px; border: 1px solid var(--line); overflow: hidden; }
  }

  /* sidebar (was the bottom tab bar) */
  .tabbar {
    position: static;
    grid-column: 1; grid-row: 1;
    height: 100%; width: 248px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 28px 16px calc(var(--safe-b) + 20px);
    background: var(--surface-alt);
    border-top: none;
    border-right: 1px solid var(--line);
    backdrop-filter: none;
  }
  .tabbar::before {
    content: "Organised by Design";
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--accent);
    padding: 0 12px 20px;
  }
  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 0.92rem;
    padding: 11px 12px;
    border-radius: 12px;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: var(--accent-tint); }
  .tab--fab {
    order: -1;
    margin: 0 0 14px;
    width: auto; height: auto;
    border-radius: 999px;
    padding: 13px 16px;
    gap: 10px;
    box-shadow: var(--shadow-float);
  }
  .tab--fab::after { content: "New entry"; font-size: 0.92rem; font-weight: 800; }
  .tab--fab svg { width: 20px; height: 20px; }

  .screen, .screen--chrome {
    grid-column: 2; grid-row: 1;
    padding: 40px clamp(24px, 5vw, 64px) 64px;
  }
  .screen > *:not(.topbar):not(.cal):not(.report-overlay) { max-width: var(--page-max); }
  .cal { max-width: 620px; }

  /* composer becomes a centred modal, not a bottom sheet */
  .sheet-scrim { display: flex; align-items: center; justify-content: center; padding: 40px; }
  .sheet {
    position: relative;
    left: auto; right: auto; bottom: auto;
    width: 100%; max-width: 560px;
    max-height: min(88vh, 780px);
    border-radius: 22px;
    box-shadow: var(--shadow-float);
    transform: translateY(24px);
  }
  .sheet.is-open { transform: none; }
  .sheet__grip { display: none; }
  .sheet__head { padding-top: 16px; }

  .quickexit { top: 18px; right: 24px; }
  .appmenu { display: none; }
  .tab--settings { display: flex; order: 10; margin-top: auto; }

  /* onboarding / lock / welcome fill the whole app grid */
  .onb, .lock, .welcome, .sheet-scrim { grid-column: 1 / -1; grid-row: 1; }
  .onb__slide { align-items: center; text-align: center; }
  .onb__slide p, .onb__slide h2 { max-width: 42ch; }

  .typegrid { grid-template-columns: repeat(5, 1fr); }
  .fin-summary { max-width: var(--page-max); }
  .detail__gallery { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
