/* Money, Plans and Records as one page of cards each (run F-LP1), in clean
 * type, on the owner's palettes. Linked last, after every other sheet.
 *
 * The design is D-LP2/D-LP3's, as the owner decided it (design/ai-first/
 * layout-pass/v2/NOTES.md, v3/NOTES.md, v3/PARKED.md "Decided"); this file
 * ports the prototype's CSS (v3/src/proto.css) and its tokens
 * (v3/src/palettes.css), Plaster and Lamplit only.
 *
 * - The palette is the owner's choice in Settings, Lamplit (dark) by default
 *   and Plaster (light) (run F-TH1; js/theme-boot.js sets html[data-theme]).
 *   It dresses Money, Plans, Records, Settings, the
 *   sheets and the chrome over them. The Ember tab keeps today's dark
 *   chrome until F-LP2's smoke bars, so the room never sits under light bars.
 * - Figtree for every word and figure on the pages, figures in tabular
 *   digits: 38/44 a tab's hero, 30/36 a card's figure, 22/28 a second figure
 *   in a card, 24/30 a tile; prose and rows 14/20, a card's quieter words
 *   13/18 and 12/16; chips 26 px drawn (44 to the finger).
 * - §5's colours on a light ground: ochre (--lp-money) is the money colour,
 *   red only for a sync or backend failure, ▲ and ▼ drawn as shapes.
 * - The texture is "Refined" (tx=r1): grain on the page only, a soft warm
 *   glow from the top, two-layer warm shadows, a 1 px highlight on each card,
 *   the ember edge on a page's first card only.
 *
 * tests/test_flp1.py checks every text pair in both palettes against WCAG AA. */

/* ---- the palettes ----
 * Roles (the same in each; the prototype's names with an `lp-` in front, so
 * they never meet ember.css's --ground, --edge or --faint):
 *   ground  the page behind the cards     card     a card
 *   edge    a card's border, row rules     track    a bar's empty part
 *   ink     words and figures              soft     a figure's line, row notes
 *   faint   labels (small caps), meta      money    the strongest money colour (§5's amber)
 *   bar     a bar's filled part            accent   the lit tab, a chosen chip, links
 *   up/down ▲ and ▼                        cool     stale, offline
 *   red     a sync or backend failure only chrome   the bar and the tab bar
 *   steady/plenty/fast/over  a bucket's status (D-LP3 §2, "Quiet until it matters", sage on pace)
 *   mine/mineInk  the owner's own words in Ember's conversation (F-CV1)
 *   fg      the ink as an rgb channel, for the older sheets' rgba(cream, a) (see below) */

/* Lamplit (dark) is the base: today's deep page, the cards lifted well clear
 * of it, as if lit. It is also what shows when no theme has been set (and with
 * no script at all). Plaster (light) is the override below. The phone's own
 * light/dark setting is never read here: js/theme-boot.js sets
 * <html data-theme="dark|light"> from the owner's choice in Settings
 * (Dark, Light, or Match phone, which it resolves itself and follows live). */
:root {
  --lp-ground: #2A1E1C; --lp-card: #4A3831; --lp-edge: #634C42; --lp-track: #634C42;
  --lp-ink: #FFF3E6; --lp-soft: #ECD5C2; --lp-faint: #D2B8A4;
  --lp-money: #FFBF66; --lp-bar: #FFB454; --lp-accent: #FFA35E; --lp-accentBg: #553E31;
  --lp-up: #FFF3E6; --lp-down: #F7BC92; --lp-cool: #93C2E6; --lp-red: #FF9497;
  --lp-chrome: #1F1614; --lp-chromeInk: #FFF3E6; --lp-chromeSoft: #D2B8A4; --lp-chromeEdge: #3A2B26;
  --lp-steady: #9DBF8A; --lp-plenty: #FFD166; --lp-fast: #FFA14A; --lp-over: #FF8466;
  /* What you said, in Ember's conversation (F-CV1). Cream on it, 8.5:1. */
  --lp-mine: #5A4033; --lp-mineInk: #FFF1E0;
  --lp-fg: 255 243 230;
  --lp-fg2: 255 163 94;
  /* The light inside a chosen tab's icon (D-IC1). */
  --lp-lit: #FFD166; --lp-litEdge: #FFD166;
  --lp-scrim: rgba(10, 6, 5, .55);
  --lp-shadow: inset 0 1px 0 rgba(255, 217, 168, .14), 0 1px 2px rgba(0, 0, 0, .35), 0 12px 26px -14px rgba(255, 140, 66, .22);
  --lp-grain: .16;
  --lp-scheme: dark;
  /* The chrome's colours on the Ember tab: today's (index.html's theme-color). */
  --ember-chrome: #1C1412;
  /* Every older sheet's rgba(255, 241, 224, a) is rgb(var(--fg) / a): cream
   * here, the palette's ink where the palette applies. */
  --fg: 255 241 224;
  /* And rgba(244, 177, 131, a), the peach, is rgb(var(--fg2) / a): the accent there. */
  --fg2: 244 177 131;
}

/* Plaster (light): warm limewashed plaster, brick for what you choose, ochre for money.
 * Sage is the prototype's #6F8F5E a shade darker (#6A8B59), so an on-pace
 * bar keeps 3:1 against its track (WCAG's non-text contrast; 2.9 before). */
:root[data-theme="light"] {
  --lp-ground: #F4EDE3; --lp-card: #FFFBF5; --lp-edge: #E6D9C8; --lp-track: #EFE4D4;
  --lp-ink: #2A1E1C; --lp-soft: #6B5A52; --lp-faint: #76655B;
  --lp-money: #985210; --lp-bar: #B86A1A; --lp-accent: #B04A2A; --lp-accentBg: #F9ECE4;
  --lp-up: #2A1E1C; --lp-down: #B04A2A; --lp-cool: #3D6B92; --lp-red: #C0353B;
  --lp-chrome: #FBF6EE; --lp-chromeInk: #2A1E1C; --lp-chromeSoft: #76655B; --lp-chromeEdge: #E6D9C8;
  --lp-steady: #6A8B59; --lp-plenty: #A87A00; --lp-fast: #C25E00; --lp-over: #A83A1C;
  /* What you said, in Ember's conversation (F-CV1): a peach tint of the
   * ground, so your words sit back and her answer leads. Ink on it, 11.1:1. */
  --lp-mine: #F6CFB0; --lp-mineInk: #2A1E1C;
  /* A shade darker than the ink, so the older sheets' 60% words still pass AA. */
  --lp-fg: 18 10 8;
  --lp-fg2: 176 74 42;
  /* The light inside a chosen tab's icon: the flame's amber, and a deep ember edge that holds 3:1 on this bar (D-IC1). */
  --lp-lit: #FFB454; --lp-litEdge: #D9652E;
  --lp-scrim: rgba(42, 30, 28, .42);
  --lp-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 2px rgba(74, 36, 16, .12), 0 10px 24px -14px rgba(138, 74, 24, .4);
  --lp-grain: .13;
  --lp-scheme: light;
}

/* ---- where the palette applies ----
 * The pages, Settings, the sheets, and the chrome on every tab but Ember's.
 * The older sheets' own tokens (app.css, ember.css) are pointed at the
 * palette's here, so Settings' forms, the accounts rows, the plan, the
 * strategies and the letters take it without a rule of their own. */
.convo, /* F-EW1: the conversation sheet follows the owner's palette (call 4) */
.lpage, .lpdetail, .lpnote, #settings, .sheet,
body:not([data-tab="ember"]) > .bar, body:not([data-tab="ember"]) > .tabbar {
  color-scheme: var(--lp-scheme);
  --fg: var(--lp-fg); --fg2: var(--lp-fg2);
  --cream: var(--lp-ink); --ink2: var(--lp-ink); --softc: var(--lp-soft); --faint: var(--lp-faint);
  --rail: var(--lp-faint); --mortar: var(--lp-faint); --peach: var(--lp-accent);
  --gold: var(--lp-accent); --amber: var(--lp-money); --ember: var(--lp-accent);
  --cool: var(--lp-cool); --red: var(--lp-red); --brickD: var(--lp-accent);
  --dark: var(--lp-chrome); --bg: var(--lp-ground); --wall: var(--lp-track);
  --ground: var(--lp-ground); --panel: var(--lp-card); --edge: var(--lp-edge);
  --mine: var(--lp-mine); --mineInk: var(--lp-mineInk);
  /* Words on a filled (accent) button. */
  --ink: var(--lp-card);
}
#settings { background: var(--lp-ground); color: var(--lp-ink); }
.sheet .card { background: var(--lp-card); color: var(--lp-ink); }
.sheet { background: var(--lp-scrim); }
.sheet.pair { background: var(--lp-ground); }
.sheet input { background: var(--lp-ground); }

/* The chrome, off the Ember tab: the palette's bar and tab bar. */
body:not([data-tab="ember"]) { background: var(--lp-chrome); }
body:not([data-tab="ember"]) > .bar { background: var(--lp-chrome); color: var(--lp-chromeInk); border-bottom: 1px solid var(--lp-chromeEdge); }
body:not([data-tab="ember"]) .stamp { color: var(--lp-chromeSoft); background: var(--lp-ground); border-color: var(--lp-chromeEdge); }
body:not([data-tab="ember"]) .stamp i { background: var(--lp-bar); }
body:not([data-tab="ember"]) .stamp.stale, body:not([data-tab="ember"]) .stamp.stale i { color: var(--lp-cool); }
body:not([data-tab="ember"]) .stamp.stale i { background: var(--lp-cool); }
body:not([data-tab="ember"]) .stamp.failed i { background: var(--lp-red); }
body:not([data-tab="ember"]) .coals i { background: var(--lp-bar); box-shadow: none; }
body:not([data-tab="ember"]) .coals.cool i { background: var(--lp-cool); }
body:not([data-tab="ember"]) .gear { color: var(--lp-chromeSoft); }
body:not([data-tab="ember"]) .gear[aria-pressed="true"] { color: var(--lp-accent); background: var(--lp-accentBg); }
body:not([data-tab="ember"]) .mode { color: var(--lp-accent); border-color: currentColor; }
body:not([data-tab="ember"]) .tabs { background: var(--lp-chrome); border-top: 1px solid var(--lp-chromeEdge); }
body:not([data-tab="ember"]) .tab { color: var(--lp-chromeSoft); }
body:not([data-tab="ember"]) .tab[aria-selected="true"] { color: var(--lp-accent); }
body:not([data-tab="ember"]) .tab svg { opacity: 1; }
body:not([data-tab="ember"]) .tab.waits::after { background: var(--lp-accent); }
body:not([data-tab="ember"]) .tabbar::before { background: linear-gradient(to right, var(--lp-chrome), transparent); }
body:not([data-tab="ember"]) .tabbar::after { background: linear-gradient(to left, var(--lp-chrome), transparent); }
body:not([data-tab="ember"]) .stage { background: var(--lp-ground); }
/* The gear's hole is the bar's own colour. */
.gear .hole { fill: var(--dark); }

/* The tab icons (D-IC1, set A): the flame's 8x8 grid at 24 px, 3 px a cell.
 * Bodies are currentColor, so they take the bar's colours; idle is an outline,
 * and a chosen tab lights the cells marked l (inside) and e (edge). */
.tab svg.pxi { opacity: 1; }
.tab svg.pxi .l { fill: none; }
.tab[aria-selected="true"] svg.pxi .l { fill: var(--lp-lit); }
.tab[aria-selected="true"] svg.pxi .e { fill: var(--lp-litEdge); }

/* ---- a tab's page: the strip of jump chips, then a column of cards ---- */
.screen.lpage {
  display: flex; flex-direction: column; overflow: hidden;
  background-color: var(--lp-ground); color: var(--lp-ink);
  font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}
.lpage .jump {
  flex: none; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 9px 12px;
  background: var(--lp-ground); border-bottom: 1px solid var(--lp-edge); position: relative; z-index: 2;
}
.lpage .jump::-webkit-scrollbar { display: none; }
.lpage .chip {
  flex: none; position: relative; height: var(--chip-h); padding: 0 11px; display: inline-flex; align-items: center; border-radius: calc(var(--chip-h) / 2);
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-soft); background: var(--lp-card); border: 1px solid var(--lp-edge);
  white-space: nowrap; cursor: pointer;
}
/* 44 px to the finger. */
.lpage .chip::before { content: ''; position: absolute; inset: -9px -3px; }
.lpage .chip[aria-current="true"] { color: var(--lp-accent); background: var(--lp-accentBg); border-color: transparent; }

/* The column scrolls; it fills the page under the strip (not accounts.css's absolute column). */
.screen.lpage > .section-scroll {
  position: relative; inset: auto; flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto;
  padding: 12px 12px 24px; display: flex; flex-direction: column; gap: 10px;
  touch-action: pan-y; overscroll-behavior-y: contain;
}

/* A card hugs what it holds. */
.lcard {
  position: relative; flex: none; background: var(--lp-card); border: 1px solid var(--lp-edge); border-radius: 14px;
  padding: 14px 16px; min-width: 0; scroll-margin-top: 0;
}

/* A screen in a card (a pane): the backend's label, figure and line, then every row.
 * It keeps the classes `screen panel` so hold-to-ask and the tests find it,
 * with none of the stage-tall panel's rules. */
.lpage .screen.panel, .lpdetail .screen.panel {
  position: relative; flex: none; width: auto; height: auto; margin: 0; overflow: visible; container-type: normal;
  scroll-snap-align: none;
}
.lpage .lab, .lpage .big, .lpage .sub, .lpage .rows .l, .lpage .rows .r,
.lpdetail .lab, .lpdetail .big, .lpdetail .sub, .lpdetail .rows .l, .lpdetail .rows .r,
.lpnote .lab, .lpnote .big {
  white-space: normal; overflow: visible; text-overflow: clip; max-width: none; font-family: var(--body-face);
  overflow-wrap: anywhere;
}
.lpage .head, .lpdetail .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lpage .lab, .lpdetail .lab, .lpnote .lab {
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--lp-faint);
}
.lpage .more, .lpdetail .more {
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-accent); white-space: nowrap; background: none; border: 0; padding: 0;
  cursor: pointer; position: relative;
}
.lpage .more::before, .lpdetail .more::before { content: ''; position: absolute; inset: -13px -8px; }
/* Above a row's or a tile's own tap. */
.lpage .more, .lpdetail .more { z-index: 2; }
.lpage .big, .lpdetail .big, .lpnote .big {
  font-family: var(--body-face); font-weight: 700; font-size: var(--t-figure); line-height: var(--lh-figure); letter-spacing: var(--ls-figure); margin-top: 2px; color: var(--lp-ink);
  font-variant-numeric: tabular-nums;
}
/* A details page's own figure leads it, as Money's does (F-TY1). */
.lpdetail .big { font-size: var(--t-display); line-height: var(--lh-display); }
.lpage .big.hero { font-family: var(--body-face); font-weight: 700; font-size: var(--t-display); line-height: var(--lh-display); letter-spacing: var(--ls-figure); }
.lpage .big.money, .lpage .big.amber, .lpdetail .big.amber { color: var(--lp-money); }
.lpage .sub, .lpdetail .sub { font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-soft); margin-top: 1px; opacity: 1; }
.lpage .sub.amber, .lpdetail .sub.amber { color: var(--lp-money); }
.lpage .note, .lpdetail .note { font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-faint); margin-top: 8px; }

/* ▲ and ▼ by shape as well as colour (§5): drawn triangles, the character kept, unseen. */
.lpage .arw, .lpdetail .arw {
  width: 10px; height: 7px; margin: 0 4px 0 0; vertical-align: 1px; -webkit-mask: none; mask: none; background: none;
  clip-path: none; border: 0; text-indent: 0; color: transparent; font-size: 0; position: relative;
}
.lpage .arw.up, .lpdetail .arw.up { background: var(--lp-up); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lpage .arw.dn, .lpdetail .arw.dn { background: var(--lp-down); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.lpage .d.up, .lpdetail .d.up { color: var(--lp-up); font-weight: 600; }
.lpage .d.dn, .lpdetail .d.dn { color: var(--lp-down); font-weight: 600; }

/* Rows: a name and its figure, wrapping, never cut; every row shown. */
.lpage .rows, .lpdetail .rows { list-style: none; margin: 10px 0 0; padding: 0; font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); }
.lpage .rows li, .lpdetail .rows li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px;
  padding: 8px 0; border-top: 1px solid var(--lp-edge); min-height: 37px; position: relative; opacity: 1; color: var(--lp-ink);
}
.lpage .rows li:first-child, .lpdetail .rows li:first-child { border-top: 0; padding-top: 4px; }
.lpage .rows .l, .lpdetail .rows .l { flex: 1 1 0; min-width: 0; }
.lpage .rows .r, .lpdetail .rows .r { flex: 0 1 auto; max-width: 72%; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.lpage .rows .r.money { color: var(--lp-money); }
.lpage .rows .s, .lpdetail .rows .s { flex-basis: 100%; font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-soft); margin-top: 1px; }
.lpage .rows li.note, .lpdetail .rows li.note { border-top: 0; min-height: 0; padding-top: 0; justify-content: flex-end; color: var(--lp-soft); font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); }
.lpage .rows li.more, .lpdetail .rows li.more { justify-content: flex-end; color: var(--lp-faint); }
/* The backend's amber on a row: a program's points expiring, a card due soon (F-R1). */
.lpage .rows li.over, .lpdetail .rows li.over, .lpage .rows li.amber .s { color: var(--lp-money); }
/* A1 (D-TY1): the › hangs in the card's right padding, so a value that opens
 * ends where every other value ends. */
/* The value's box reaches 11 px into the padding and the › fills those 11, so
 * its words end on the column and nothing overflows its own box. */
.lpage .chev, .lpdetail .chev { margin-right: -11px; }
.lpage .chev::after, .lpdetail .chev::after { content: '›'; display: inline-block; width: 7px; margin-left: 4px; text-align: right; color: var(--lp-faint); font-weight: 600; }
/* A row that opens something: the whole row is the button. */
.lpage .rows li.tap, .lpdetail .rows li.tap { cursor: pointer; }
.rowtap { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; padding: 0; margin: 0; background: none; cursor: pointer; }
.rowtap:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: -2px; border-radius: 6px; }
.lpage .emo.typed, .lpdetail .emo.typed, .lpnote .emo.typed { font-size: 15px; margin-right: 6px; }
.lpage .grp, .lpdetail .grp {
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--lp-faint);
  margin: 12px 0 2px;
}

/* A row with a bar: no divider (D-LP3 2b); the bar ends the row. */
.lpage .rows li.b, .lpdetail .rows li.b { border-top: 0; padding: 7px 0 10px; min-height: 0; }
.bar4 { position: relative; flex-basis: 100%; height: 3px; border-radius: 2px; background: var(--lp-track); margin-top: 4px; }
.bar4 > i { display: block; height: 100%; background: var(--lp-bar); border-radius: 2px; }
.bar4[data-status="steady"] > i { background: var(--lp-steady); }
.bar4[data-status="plenty"] > i { background: var(--lp-plenty); }
.bar4[data-status="fast"] > i { background: var(--lp-fast); }
.bar4[data-status="over"] > i { background: var(--lp-over); }
/* The pace tick: what would be left were it spent evenly to today. */
.bar4 > b { position: absolute; top: -3px; width: 2px; height: 9px; margin-left: -1px; background: var(--lp-ink); border-radius: 1px; }

/* A bucket's status: its shape and the backend's word; a tap opens the note. */
.stw {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 0; border: 0; background: none;
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-soft); white-space: nowrap; cursor: pointer; position: relative; z-index: 2;
  vertical-align: 1px;
}
.stw::before { content: ''; position: absolute; inset: -14px -1px; } /* 46 tall, 44 wide: inside its row (F-TY1) */
.sti { width: 11px; height: 11px; flex: none; }
.sti[data-status="steady"] { color: var(--lp-steady); }
.sti[data-status="plenty"] { color: var(--lp-plenty); }
.sti[data-status="fast"] { color: var(--lp-fast); }
.sti[data-status="over"] { color: var(--lp-over); }

/* A second figure inside a card (Due inside Before next pay; the buckets in Free to spend). */
.lcard .part, .lcard .screen.panel.part { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--lp-edge); }
.lcard .part .big { font-family: var(--body-face); font-weight: 700; font-size: var(--t-figure); line-height: var(--lh-figure); letter-spacing: var(--ls-figure); }
.lcard .part.lead .big { font-family: var(--body-face); font-weight: 700; font-size: var(--t-display); line-height: var(--lh-display); letter-spacing: var(--ls-figure); }
/* A NOW card's invitation (Could spare, No rent, Update due...): the quieter voice. */
.lcard .callout {
  position: relative; margin-top: 12px; padding: 10px 13px; border-radius: 10px; background: var(--lp-ground); /* A4: 13, the inset of every box in a card */
  font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-soft);
}
.lcard .callout .lab { display: block; margin-bottom: 2px; }
.lcard .callout .big { display: inline; font-family: var(--body-face); font-weight: 700; font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: normal; color: var(--lp-ink); margin: 0; }
.lcard .callout .sub { display: inline; font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); margin: 0; }
.lcard .callout .big + .sub::before { content: ' · '; color: var(--lp-faint); }
.lcard .callout.tap { padding-right: 26px; }
/* A6 (D-TY1): callouts stacked in one card (Could spare, then No rent)
 * touched: the panels' own margin: 0 beat the callout's 12. 12 above the
 * first, 8 between. */
.lcard .screen.panel.callout { margin-top: 12px; }
.lcard .screen.panel.callout + .screen.panel.callout { margin-top: 8px; }
.lcard .callout.tap::after { content: '›'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--lp-faint); font-weight: 600; }
.lcard .callout .rows { margin-top: 6px; font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); }

/* Tiles: two figures to a row, each a tap to its detail. */
.lcard.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; background: none; border: 0; box-shadow: none; }
.lcard.tiles::before { display: none; }
.tile { position: relative; min-width: 0; background: var(--lp-card); border: 1px solid var(--lp-edge); border-radius: 14px; padding: 12px 16px; } /* A3: the cards' column */
.tile .big { font-family: var(--body-face); font-weight: 700; font-size: var(--t-figure); line-height: var(--lh-figure); letter-spacing: var(--ls-figure); }
.tile .sub { font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); }

/* Controls: a button (F-TY1: --btn-h, 36 drawn; --tap, 44 to the finger). */
.lpage .ctl, .lpdetail .ctl, .lpnote .ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.lbtn {
  position: relative; height: var(--btn-h); padding: 0 14px; border-radius: 8px; border: 0; display: inline-flex; align-items: center;
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-accent); background: var(--lp-accentBg); cursor: pointer;
}
.lbtn.primary { color: var(--lp-card); background: var(--lp-accent); }
.lbtn:disabled { opacity: .55; cursor: default; }
.lbtn::before { content: ''; position: absolute; inset: -4px 0; }
.lbtn:focus-visible, .chip:focus-visible, .stw:focus-visible, .more:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.lpage .prose { font-family: var(--body-face); font-size: var(--t-read); line-height: var(--lh-read); margin: 8px 0 0; }

/* Ember's take under a card's figure (F-EM3), in the card's quieter voice. */
.lcard .take { margin: 10px 0 0; }

/* What a section draws itself (the plan, the strategies, the letters) sits
 * in its card as it is; its own heading is the card's. */
.lcard.own { padding: 14px 16px; }
.lcard.own > * { max-width: 100%; }
.lcard.own > .head { margin-bottom: 4px; }

/* ---- the four charts (D-LP3 §3): no dollar axes; every printed figure a backend string ---- */
.chart { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.chart text { font-family: var(--body-face); font-variant-numeric: tabular-nums; }
.chart .cm { font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); fill: var(--lp-faint); }
.chart .cl { font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); fill: var(--lp-ink); }
.chart .cv { font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); fill: var(--lp-ink); }
.chart .base { stroke: var(--lp-edge); stroke-width: 1; }
.chart .ref { stroke: var(--lp-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .line { fill: none; stroke: var(--lp-bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--lp-bar); stroke: var(--lp-card); stroke-width: 2; }
.chart .barc { fill: var(--lp-bar); }
.chart .barp { fill: var(--lp-bar); opacity: .55; }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--lp-track); margin-top: 10px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--lp-bar); min-width: 4px; }
.meterlab { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-faint); }
.tile .meter { margin-top: 8px; }

/* ---- a detail page: over the page, under the bar, with its own back ---- */
.lpdetail {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  background-color: var(--lp-ground); color: var(--lp-ink); font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body);
}
.lpdetail .dhead {
  flex: none; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px;
  background: var(--lp-ground); border-bottom: 1px solid var(--lp-edge);
}
.lpdetail .dback {
  position: relative; display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px; border: 0; background: none;
  font-family: var(--body-face); font-weight: 600; font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-accent); cursor: pointer;
}
.lpdetail .dback::before { content: ''; position: absolute; inset: -6px -4px; }
.lpdetail h2 { flex: 1; margin: 0; font-family: var(--body-face); font-weight: 600; font-size: var(--t-title); line-height: var(--lh-title); text-align: center; padding-right: 60px; overflow-wrap: anywhere; }
.lpdetail .dscroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 12px 24px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior-y: contain; }

/* ---- a bucket's note: a short sheet from the foot ---- */
.lpnote { position: absolute; inset: 0; z-index: 8; }
.lpnote .scrim { position: absolute; inset: 0; background: var(--lp-scrim); border: 0; padding: 0; width: 100%; cursor: pointer; }
.lpnote .pop {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--lp-card); color: var(--lp-ink); border-radius: 18px 18px 0 0;
  padding: 8px 20px calc(env(safe-area-inset-bottom, 0px) + 20px); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body);
}
.lpnote .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--lp-edge); margin: 0 auto 12px; }
.lpnote .popst { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); }
.lpnote .popst .sti { width: 14px; height: 14px; }
.lpnote .prose { margin: 8px 0 0; }
/* A full-width pair of equal buttons: the suggestion left, "Got it" filled on the right. */
.lpnote .ctl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lpnote .ctl .lbtn { justify-content: center; height: var(--ctl-h); }
.lpnote .ctl .lbtn:last-child { color: var(--lp-card); background: var(--lp-accent); }
.lpnote .ctl .lbtn:only-child { grid-column: 1 / -1; }

/* ---- texture: Refined (tx=r1) ---- */
.screen.lpage, .lpdetail {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
.screen.lpage > .section-scroll, .lpdetail .dscroll {
  background: radial-gradient(90% 38% at 50% -6%, color-mix(in srgb, var(--lp-bar) 16%, transparent), transparent 75%) no-repeat;
  background-attachment: local;
}
.lcard, .tile { border-color: color-mix(in srgb, var(--lp-edge) 60%, transparent); box-shadow: var(--lp-shadow); }
.screen.lpage > .section-scroll > .lcard:first-child::before {
  content: ''; position: absolute; left: 22%; right: 22%; top: -1px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--lp-bar) 30%, var(--lp-bar) 70%, transparent); opacity: .6; pointer-events: none;
}

/* Under reduced motion, nothing glides. */

/* F-AC1's accounts, in a card: its headline as a card's, its groups as rows
 * (no boxes), in the page's type. */
.lpage .acc { font-family: var(--body-face); color: var(--lp-ink); }
.lpage .acc-h { padding: 0; }
.lpage .acc-lab { font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--ls-label); color: var(--lp-faint); }
.lpage .acc-big { font-family: var(--body-face); font-weight: 700; font-size: var(--t-figure); line-height: var(--lh-figure); letter-spacing: var(--ls-figure); color: var(--lp-ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.lpage .acc-sub { font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-soft); margin-top: 1px; }
.lpage .acc-note { margin: 8px 0 0; font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-faint); }
.lpage .acc-grp { padding: 12px 0 2px; font-family: var(--body-face); font-weight: 600; font-size: var(--t-label); line-height: var(--lh-label); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--lp-faint); }
.lpage .acc-list { border: 0; border-radius: 0; background: none; margin: 0; overflow: visible; }
.lpage .acc-row, .lpage .acc-row + .acc-row { border-top: 1px solid var(--lp-edge); background: none; }
.lpage .acc-row.open { background: none; }
.lpage .acc-row:first-child { border-top: 0; }
.lpage .acc-head { align-items: flex-start; padding: 8px 0; color: var(--lp-ink); font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); }
.lpage .acc-amt { font-family: var(--body-face); font-weight: 600; font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-ink); font-variant-numeric: tabular-nums; }
.lpage .acc-age, .lpage .acc-ch { font-family: var(--body-face); font-size: var(--t-small); line-height: var(--lh-small); color: var(--lp-soft); }
.lpage .acc-age.stale { color: var(--lp-money); }
.lpage .acc-more { padding: 0 0 8px; border-top: 1px dashed var(--lp-edge); }
.lpage .acc-tx { font-family: var(--body-face); font-size: var(--t-body); line-height: var(--lh-body); color: var(--lp-soft); }
.lpage .acc-go { color: var(--lp-accent); font-family: var(--body-face); font-weight: 600; font-size: var(--t-small); line-height: var(--lh-small); }
#settings .group { color: var(--lp-accent); }

/* Tests only: a screen as the devices draw it, over the stage (app.js's panelLab). */
.stage > .screen.fitlab { position: absolute; inset: 0; z-index: 40; background: var(--bg); color: var(--cream); }
