/* Additions that the prototype does not have (new screens only). app.css stays exactly as the prototype.
   Uses the prototype's tokens, so light and dark themes work without extra rules. */

/* Bank statement review rows */
.imp-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px 12px;align-items:start;padding:10px 0;border-top:1px solid var(--line)}
.imp-row:first-child{border-top:0}
.imp-row .amt{font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;text-align:right;padding-top:2px}
.imp-row .chip{min-width:64px;justify-content:center}
.imp-row .chip:disabled{opacity:.5}
.imp-row .r-s{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center}
.imp-row select.inp{width:100%;max-width:280px;padding:6px 10px;font-size:14px}

/* Prototype fix: .s6 is declared after the phone rule that stacks the grid, so it stayed half-width on phones. */
@media (max-width:959px){.grid>.s6{grid-column:1/-1}}

/* Prototype fix: the legend swatch class .lg.card also matches the .card container, giving it a big padded box. */
.legend .lg.card{padding:0;background:transparent;border:2px solid rgba(234,241,244,.85);border-radius:3px}

/* Sign-in: QR code for the authenticator app (needs a white background to scan in dark theme) and the typed-in key. */
.qr{display:grid;place-items:center;background:#fff;border-radius:16px;padding:6px;margin:0 auto 14px;width:fit-content}
.qr svg{width:min(240px,68vw);height:auto;aspect-ratio:1/1;display:block}
.secret{display:inline-block;margin-top:4px;padding:6px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface2);font-size:13px;letter-spacing:.06em;word-break:break-all}

/* Account button pinned to the bottom of the desktop sidebar (shows who is signed in; tap to edit username, password). */
.side .acct{margin-top:auto;border-top:1px solid var(--line);border-radius:0 0 12px 12px;padding-top:14px}
.acct-t{display:flex;flex-direction:column;line-height:1.25;min-width:0}
.acct-t b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-t small{font-weight:500;color:var(--ink3);font-size:12px}

/* runway: zoomed view is narrower, and the legend hosts the zoom button */
.tl.zoom{min-width:640px}
.legend .todaybtn{margin-left:auto}
@media (max-width:700px){.tl.zoom{min-width:560px;padding:0 24px}}

/* who is here right now: one small block per person, bottom right (you at the very corner) */
.presence{position:fixed;right:14px;bottom:14px;z-index:25;display:flex;flex-direction:row-reverse;gap:6px}
.presence[hidden]{display:none}
.pres{width:26px;height:26px;border-radius:8px;background:var(--c);color:#fff;font:600 13px/26px 'Bricolage Grotesque',system-ui,sans-serif;text-align:center;box-shadow:0 1px 4px rgba(0,0,0,.28);user-select:none;cursor:default}
.pres.me{box-shadow:0 0 0 2px var(--bg),0 0 0 3.5px var(--c)}
@media (max-width:959px){.presence{bottom:calc(var(--tabbar-h, 72px) + 8px)}}   /* just above the bottom bar, however tall it is on this phone */

/* ---- charts ---- */
.chart{position:relative;min-height:190px;color:var(--good)}
.chart svg{display:block;width:100%;height:auto;touch-action:pan-y}
.chart .gl{stroke:var(--line);stroke-width:1;stroke-dasharray:3 4}
.chart .ax{fill:var(--ink3);font:500 11px 'Instrument Sans',system-ui,sans-serif}
.chart .ln{stroke-width:2.4;stroke-linejoin:round;stroke-linecap:round}
.chart .ln.up,.chart .up{stroke:var(--good);color:var(--good)}
.chart .ln.down,.chart .down{stroke:var(--bad);color:var(--bad)}
.chart path.up:not(.ln),.chart path.down:not(.ln){stroke:none}
.chart .cur{stroke:var(--ink3);stroke-width:1}
.chart .dot{fill:var(--surface);stroke:var(--ink);stroke-width:2}
.chart .tip{position:absolute;top:0;pointer-events:none;background:var(--ink);color:var(--bg);border-radius:10px;padding:5px 9px;font-size:12px;display:flex;flex-direction:column;gap:1px;box-shadow:0 2px 10px rgba(0,0,0,.25);white-space:nowrap}
.chart .tip[hidden]{display:none}
.chart .tip b{font-weight:600}
.chart .tip span{opacity:.75}
.spark{display:block}
.spark path{stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.spark.up path{stroke:var(--good)}
.spark.down path{stroke:var(--bad)}
.spark-row{display:flex;align-items:center;gap:10px;margin:2px 0 8px}

/* ---- pop-up notices (what someone just did, and notifications that arrive while you are here) ---- */
.notices{position:fixed;top:calc(68px + env(safe-area-inset-top,0px));right:14px;z-index:70;display:flex;flex-direction:column;gap:8px;width:min(340px,calc(100vw - 28px));pointer-events:none}
.notice{pointer-events:auto;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:center;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:14px;padding:10px 10px 10px 12px;box-shadow:0 8px 28px rgba(8,18,24,.22);cursor:pointer;animation:notice-in .25s ease-out}
.notice.alert{border-left:4px solid var(--amber)}
.notice.out{opacity:0;transform:translateX(16px);transition:opacity .25s,transform .25s}
.notice .n-t{display:flex;flex-direction:column;font-size:13.5px;line-height:1.3;min-width:0}
.notice .n-t b{font-weight:600}
.notice .n-x{border:0;background:transparent;color:var(--ink3);font-size:18px;line-height:1;padding:2px 6px;border-radius:8px}
.notice .pres.bell{background:var(--amber);color:#3B2A00}
@keyframes notice-in{from{opacity:0;transform:translateX(16px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.notice{animation:none}}

/* a small coloured letter for a person (presence, notices, activity, assignments) */
.pres.sm{width:18px;height:18px;border-radius:6px;font-size:11px;line-height:18px;margin-left:6px;vertical-align:1px;display:inline-block;box-shadow:none}
.act{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:start;padding:9px 0;border-top:1px solid var(--line)}
.act:first-child{border-top:0}
.act .pres{position:static;margin-top:1px}
.act .r-t{font-weight:400;line-height:1.35}
.act .r-t b{font-weight:600}

/* ---- notes ---- */
.notes{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;margin-top:10px}
.nt{background:var(--surface2);border:1px solid var(--line);border-radius:14px;padding:10px 12px;display:flex;flex-direction:column;gap:4px;min-width:0}
.nt.pinned{border-color:var(--amber);box-shadow:inset 3px 0 0 var(--amber)}
.nt-h{display:flex;justify-content:space-between;align-items:flex-start;gap:6px}
.nt-h b{font-weight:600;font-size:14px;line-height:1.3;word-break:break-word}
.nt-b{margin:0;font-size:13.5px;line-height:1.4;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:7;-webkit-box-orient:vertical;overflow:hidden;color:var(--ink2)}
.nt-f{font-size:12px;color:var(--ink3);margin-top:auto}
.mini-b[aria-pressed="true"]{color:var(--amber)}

/* the shopping box is a one-line text area (so a pasted list keeps its lines) that grows as you add lines */
.add-row textarea.inp{height:42px;min-height:42px;max-height:130px;overflow:hidden;line-height:1.3;padding-top:9px;padding-bottom:9px;field-sizing:content}

/* ---- app lock: the plain cover while you are away, and the lock screen ---- */
body.is-covered #app,body.is-locked #app{visibility:hidden}
.lock-cover{position:fixed;inset:0;z-index:190;background:var(--bg);display:grid;place-items:center}
.lock-cover .brand-mark{width:64px;height:64px}
.lock{position:fixed;inset:0;z-index:200;background:var(--bg);display:grid;place-items:center;padding:20px;overflow:auto}
.lock-card{width:min(360px,100%);background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:26px 22px;display:flex;flex-direction:column;align-items:stretch;text-align:center;box-shadow:0 10px 40px rgba(8,18,24,.18)}
.lock-card .brand-mark{margin:0 auto 10px}
.lock-card h1{font:600 24px 'Bricolage Grotesque',system-ui,sans-serif;margin:0 0 4px}
.lock-card .sub{margin:0 0 16px;color:var(--ink2);font-size:14px}
.lock-card .set-s{text-align:left}
.lock-card .code{text-align:center;letter-spacing:.5em;font-size:22px}
.lock-card .auth-links{justify-content:center}

/* 0.9.0 polish: things that read badly at some widths */
.top h1{white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:clip}    /* a long name or page title wraps to two lines instead of being cut off */
.stat .v,.mini .v,.tile-v{overflow-wrap:normal}
@media (min-width:960px) and (max-width:1279px){.att-i{display:none}.att{grid-template-columns:minmax(0,1fr) auto;padding-left:12px}}   /* the narrow Needs attention column gives its text the room the icon used */
.goal-f{flex-wrap:wrap}
.goal-f .head-acts{display:inline-flex;align-items:center;gap:6px;flex:none;margin-left:auto}
.filters .chip.sm{padding-left:10px;padding-right:10px}
.set-row select.inp{max-width:240px;min-width:190px}
.presence{pointer-events:none}
.presence .pres{pointer-events:auto}
@media (max-width:959px){
  .presence{right:10px;bottom:calc(var(--tabbar-h, 72px) + 8px);gap:4px}
  .presence .pres{width:22px;height:22px;line-height:22px;font-size:12px;border-radius:7px;opacity:.85}
}
.lock-card label.set-s{margin-bottom:6px}
.lock-card .auth-err{margin:8px 0 0}

/* 0.9.1: a page that is loading says so; a newer release offers a reload */
.loading{display:flex;align-items:center;gap:10px;color:var(--ink2);font-size:14px;padding:32px 4px}
.spin{width:18px;height:18px;flex:none;border-radius:50%;border:2px solid var(--line);border-top-color:var(--accent);animation:lb-spin .8s linear infinite}
@keyframes lb-spin{to{transform:rotate(360deg)}}
.update-bar{position:sticky;top:0;z-index:30;display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;padding:8px 14px;background:var(--accent);color:#fff;font-size:14px;font-weight:500}
.update-bar .btn{background:#fff;color:#12242D;border-color:transparent}
.sheet{overflow-x:hidden}              /* a sub-pixel rounding must never show a sideways scroll bar in a form */

/* loans on the Cards and loans page: a paid-off bar instead of a limit */
.util.loanbar i{background:var(--good)}
.util.loanbar b{display:none}
.pair.loan-end{display:flex;gap:24px;margin-top:12px}
.pair.loan-end .k{display:block;font-size:12px;color:var(--ink2)}
.pair.loan-end .v{font-weight:600}
.pair.loan-end .v.over{color:var(--bad)}

/* repayment plan: the line on each card or loan, and the plan sheet */
.cc-plan{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;padding-top:10px;border-top:1px solid var(--line)}
.cc-plan .cc-l{margin:0}
.cc-plan .over{color:var(--bad)}
.cc-plan .btn{flex:none}
.pl-chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:4px 0 12px}
.pl-chips .k{font-size:12px;color:var(--ink2);margin-right:2px}
.pl-chips .chip.on{border-color:var(--accent);color:var(--ink)}
.pl-tgt{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.pl-outs{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:6px 0 14px}
.pl-out{border:1px solid var(--line);border-radius:14px;padding:10px 12px}
.pl-out .k{display:block;font-size:12px;color:var(--ink2)}
.pl-out .v{font-weight:600;font-size:18px;margin:2px 0}
.pl-out .v.over{color:var(--bad)}
.pl-out.mine{border-color:color-mix(in srgb,var(--c2) 55%,var(--line))}
.pl-out.save .v{color:var(--good)}

/* shopping list: how many of each (price for one x quantity) */
.qty{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:999px;height:28px}
.qty b{min-width:30px;text-align:center;font-size:13px;font-variant-numeric:tabular-nums}
.qty .qb{width:28px;height:26px;border:0;background:transparent;color:var(--ink2);font-size:16px;line-height:1;padding:0;border-radius:999px;cursor:pointer}
.qty .qb:disabled{opacity:.35;cursor:default}
.qty .qb:not(:disabled):hover{color:var(--ink)}
.row.shop .amt{text-align:right}
.row.shop .amt .each{font:400 11.5px 'Instrument Sans',sans-serif;color:var(--ink3)}
.row.shop.done .qty{opacity:.55}
.row.shop .r-t span{overflow-wrap:anywhere}
@media (max-width:560px){
  .row.shop{grid-template-columns:auto minmax(0,1fr) auto auto!important;row-gap:6px}
  .row.shop>.ck{grid-row:1 / span 2;align-self:center}
  .row.shop>.r-main{grid-column:2;grid-row:1}
  .row.shop>.qty{grid-column:2;grid-row:2;justify-self:start}
  .row.shop>.amt{grid-column:3;grid-row:1 / span 2;align-self:center}
  .row.shop>.head-acts{grid-column:4;grid-row:1 / span 2;align-self:center}
}

/* weather and tides: an outage or an old tide pattern, said plainly */
.wx-stale{display:flex;gap:8px;align-items:flex-start;margin:0 0 10px;padding:10px 12px;border-radius:12px;border:1px solid color-mix(in srgb,var(--amber) 55%,var(--line));background:color-mix(in srgb,var(--amber) 10%,transparent);font-size:13px;color:var(--ink)}
.wx-stale svg{flex:none;width:18px;height:18px;margin-top:0;color:var(--amber)}

/* investment alerts on the Investments page */
.inv-alert{width:30px;height:30px;border-radius:10px;display:grid;place-items:center;background:var(--surface2)}
.inv-alert svg{width:16px;height:16px}
.inv-alert.up,.inv-alert.ath{color:var(--good)}
.inv-alert.down{color:var(--bad)}

/* scrolling news strips: market news and events (Investments), South African news and warnings (Dashboard) */
/* Driven by JS (initTicker() in web/js/ticker.js), not a CSS animation: that is what lets a finger held on it stop it, a drag
   scroll it back, and letting go pick auto-scrolling up again from wherever it was left, on touch as well as with a mouse. */
/* .ntick is the frame (border, corners, background) and carries the two edge fades; .ntick-wrap inside it is what scrolls.
   Keep the fades off the scrolling element: anything absolutely positioned inside a scrolling element scrolls along with its
   content, so fades placed there (until 0.26.3) only sat at the edges before the strip moved, then drifted across it with the
   news and parked on one item as a dark box - the SARS headline on a desktop, a warning's "Extreme" badge on a phone. */
.ntick{position:relative;overflow:hidden;border:1px solid var(--line);border-radius:16px;background:var(--surface);margin:0 0 16px}
.ntick::before,.ntick::after{content:'';position:absolute;top:0;bottom:0;width:44px;z-index:2;pointer-events:none}
.ntick::before{left:0;background:linear-gradient(90deg,var(--surface),transparent)}
.ntick::after{right:0;background:linear-gradient(270deg,var(--surface),transparent)}
.ntick-wrap{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;touch-action:pan-x;-webkit-tap-highlight-color:transparent}
.ntick-wrap::-webkit-scrollbar{display:none}
.ntick-track{display:flex;width:max-content}
/* Android's own default tap highlight is a plain grey box sized to the tapped element, drawn over whatever colour is already
   there (most visible on the wider, tinted warning items) - it is turned off here in favour of the feedback below. */
.ntick-item{display:inline-flex;align-items:center;gap:7px;flex:none;border:0;border-right:1px solid var(--line);background:transparent;color:var(--ink);padding:11px 18px;font:500 13px 'Instrument Sans',sans-serif;white-space:nowrap;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
/* Press feedback is .ntick-pressed, a class web/js/ticker.js adds on press and removes itself, rather than :hover/:active:
   the content keeps moving, and on touch browsers :hover (and sometimes :active) can linger on a tapped item after the tap.
   :focus-visible stays for real keyboard use. (The dark box fixed in 0.26.3 was the edge fades above, not any of these.) */
.ntick-item:focus-visible,.ntick-item.ntick-pressed{background:var(--surface2)}
.ntick-item svg{width:15px;height:15px;flex:none}
.ntick-sym{background:var(--surface2);color:var(--ink2);border-radius:999px;padding:2px 8px;font-size:11px;font-weight:700;letter-spacing:.02em}
.ntick-h{color:var(--ink)}
.ntick-src,.ntick-date{color:var(--ink3);font-size:12px}
.ntick-date::before,.ntick-src::before{content:'·';margin-right:7px;color:var(--line)}
.ntick-item.evt svg{color:var(--ink3)}
.ntick-item.evt-high{background:color-mix(in srgb,var(--amber) 10%,transparent)}
.ntick-item.evt-high svg{color:var(--amber)}
.ntick-lab{font-weight:600}
.ntick-cd{color:var(--ink2);font-variant-numeric:tabular-nums;font-weight:600}
.ntick-badge{background:var(--amber);color:#1A1205;border-radius:999px;padding:2px 8px;font-size:10.5px;font-weight:700;letter-spacing:.02em}

/* South Africa news and weather warnings ticker (Dashboard), and its severity colours shared with any .ntick-item */
.ntick-item.sev-amber{background:color-mix(in srgb,var(--amber) 10%,transparent)}
.ntick-item.sev-amber svg,.ntick-item.sev-amber .ntick-sym{color:var(--amber)}
.ntick-item.sev-red{background:color-mix(in srgb,var(--bad) 12%,transparent)}
.ntick-item.sev-red svg,.ntick-item.sev-red .ntick-sym{color:var(--bad)}
.ntick-badge.sev-red{background:var(--bad);color:#fff}
.ntick-item.warn .ntick-lab{font-weight:600}
.tag.over{background:var(--bad-bg);color:var(--bad)}
.sa-detail{border:1px solid var(--line);border-radius:16px;background:var(--surface);margin:-8px 0 16px;padding:14px 16px 16px}
.sa-detail-in h3{margin:2px 0 4px;font-size:16px}
.sa-detail-in p{margin:6px 0}
.sa-detail-h{display:flex;align-items:center;justify-content:space-between;gap:8px}
.sa-close{margin-left:auto}

/* Calendar page: List/Month toggle, feed legend, and the month grid */
.viewtoggle{display:flex;gap:4px;background:var(--surface2);border:1px solid var(--line);border-radius:999px;padding:3px;flex:none}
.viewtoggle button{border:0;background:transparent;color:var(--ink2);border-radius:999px;padding:5px 13px;font:600 13px inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.viewtoggle button[aria-pressed="true"]{background:var(--accent);color:var(--accent-ink)}
.cal-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--ink2);margin:-2px 0 10px}
.cal-legend span{display:inline-flex;align-items:center;gap:5px}
.month-nav{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.month-nav .lbl{font:600 15px 'Bricolage Grotesque',system-ui,sans-serif}
.month-nav button{border:1px solid var(--line);background:var(--surface2);color:var(--ink);border-radius:10px;width:30px;height:30px;font-size:15px;line-height:1;cursor:pointer;-webkit-tap-highlight-color:transparent}
.month-nav button:disabled{opacity:.35;cursor:default}
.cal-dow{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-bottom:4px;font:600 11px inherit;color:var(--ink3);text-transform:uppercase;letter-spacing:.04em;text-align:center}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
/* min-width:0 matters here: a grid item's automatic minimum width defaults to its content's own min-content size, and an
   .evchip's unbreakable text (white-space:nowrap) is wide enough that without this, the Saturday column refuses to shrink
   to its 1fr share on a narrow phone and drags the whole grid past the edge of the screen - .evchip's own overflow:hidden
   never gets a chance to clip it, since it is the column that will not shrink, not the chip's text. */
.cday{min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--surface2);min-height:66px;padding:5px 4px;display:flex;flex-direction:column;gap:3px;text-align:left;font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.cday.pad{visibility:hidden;pointer-events:none}
.cday.today{border-color:var(--accent);border-width:2px;padding:4px 3px}
.cday .num{font:600 12.5px inherit;color:var(--ink2)}
.cday.today .num{color:var(--accent)}
.cday.selected{background:var(--accent);border-color:var(--accent)}
.cday.selected .num,.cday.selected .more{color:var(--accent-ink)}
.cday .chipline{display:flex;flex-direction:column;gap:2px;overflow:hidden}
.evchip{display:flex;align-items:center;gap:4px;font-size:10px;color:var(--ink);background:var(--surface);border-radius:5px;padding:2px 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cday.selected .evchip{background:rgba(255,255,255,.22);color:var(--accent-ink)}
.evchip i{width:6px;height:6px;border-radius:50%;background:var(--c);flex:none}
.cday .more{font-size:9.5px;color:var(--ink3);padding-left:2px}
.daydetail{border-top:1px solid var(--line);margin-top:12px;padding-top:10px}
@media (max-width:480px){.cday{min-height:56px}.evchip{font-size:9px}}
