/* ==========================================================================
   WalletPress
   Ported from the Claude Design prototype (WalletPress.dc.html). Values here
   match the prototype's inline styles; the prototype is the reference.

   Colours are declared twice: hex first, then the original oklch() inside an
   @supports block. Browsers that understand oklch get the exact design colour,
   older ones get a converted hex that is visually the same.
   ========================================================================== */

:root {
  --bg:            #F7F6F3;
  --ink:           #1D1C1A;
  --ink-2:         #3A3834;
  --ink-3:         #57534C;
  --muted:         #6E6A63;
  --muted-2:       #8A857D;
  --muted-3:       #A8A39A;
  --line:          #E6E3DD;
  --line-2:        #EFECE7;
  --line-3:        #F1EFEA;
  --field:         #DAD6CF;
  --field-strong:  #BDB8AF;
  --dash:          #CFCAC1;
  --surface:       #FFFFFF;
  --hover:         #FAF9F7;
  --hover-2:       #F4F2EE;
  --segment:       #EDEBE6;
  --stat-border:   #D6D2CA;
  --top-track:     #F4EFEE;

  --brand:         #264F8B;
  --brand-hover:   #18417C;
  --brand-dark:    #173C70;
  --brand-mid:     #5A81BC;
  --brand-tint:    #E6EFFC;
  --brand-tint-2:  #EAF3FF;
  --brand-soft:    #DCE9FC;
  --brand-line:    #B0C6E5;
  --brand-glow:    rgba(38, 79, 139, .7);

  --green:         #137738;
  --green-hover:   #00682A;
  --green-logo:    #429C5A;
  --green-mid:     #298646;
  --green-soft:    #DCF7E1;
  --green-bright:  #7CD591;

  --red:           #BE2F2C;
  --red-hover:     #AC1A1C;
  --red-border:    #F3C0B9;
  --red-bg:        #FFF2F0;
  --red-soft:      #FFE7E4;
  --red-bright:    #FF958A;
  --red-bar:       #C8645A;

  --amber-soft:    #FBEDD1;
  --amber-ink:     #694413;
  --amber:         #AA6A00;

  /* Ten tints for categories, payment modes, book marks and suggestion chips.
     A name is hashed to one of these, so "Food" is always the same colour
     everywhere it appears. Every bg/fg pair clears WCAG AA at 6.8:1 or better. */
  --t0-bg: #E0F0FF; --t0-fg: #284D83; --t0-solid: #5286D3;
  --t1-bg: #DFF6E2; --t1-fg: #195C2E; --t1-solid: #429C5A;
  --t2-bg: #FFE6E2; --t2-fg: #7A342E; --t2-solid: #C8645A;
  --t3-bg: #F9EDD5; --t3-fg: #664700; --t3-solid: #AA7E00;
  --t4-bg: #F9E7FE; --t4-fg: #65396F; --t4-solid: #A86AB6;
  --t5-bg: #D4F6F8; --t5-fg: #005C62; --t5-solid: #009CA5;
  --t6-bg: #FFE9D9; --t6-fg: #753B07; --t6-solid: #C16E2D;
  --t7-bg: #EEEBFF; --t7-fg: #4D427F; --t7-solid: #8677CE;
  --t8-bg: #D9F7EB; --t8-fg: #005E45; --t8-solid: #009F7A;
  --t9-bg: #FFE5E8; --t9-fg: #7A323E; --t9-solid: #C76171;

  --ease:  cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.64, 0, .78, 0);
  --ring:  0 0 0 3px var(--brand-soft);
  --pop:   0 8px 24px rgba(29, 28, 26, .08);
  --lift:  0 14px 28px -16px rgba(29, 28, 26, .22);
  --tip-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5);

  --tx: background-color .25s var(--ease), color .25s, border-color .25s,
        box-shadow .3s var(--ease), transform .3s var(--ease);
}

@supports (color: oklch(0.5 0.1 250)) {
  :root {
    --brand:        oklch(0.43 0.11 258);
    --brand-hover:  oklch(0.38 0.11 258);
    --brand-dark:   oklch(0.36 0.10 258);
    --brand-mid:    oklch(0.60 0.10 258);
    --brand-tint:   oklch(0.95 0.02 258);
    --brand-tint-2: oklch(0.96 0.02 258);
    --brand-soft:   oklch(0.93 0.03 258);
    --brand-line:   oklch(0.82 0.05 258);

    --green:        oklch(0.50 0.13 150);
    --green-hover:  oklch(0.45 0.13 150);
    --green-logo:   oklch(0.62 0.13 150);
    --green-mid:    oklch(0.55 0.13 150);
    --green-soft:   oklch(0.95 0.04 150);
    --green-bright: oklch(0.80 0.13 150);

    --red:          oklch(0.53 0.18 27);
    --red-hover:    oklch(0.48 0.18 27);
    --red-border:   oklch(0.85 0.06 27);
    --red-bg:       oklch(0.97 0.015 27);
    --red-soft:     oklch(0.95 0.03 27);
    --red-bright:   oklch(0.78 0.13 27);
    --red-bar:      oklch(0.62 0.13 27);

    --amber-soft:   oklch(0.95 0.04 85);
    --amber-ink:    oklch(0.42 0.08 70);
    --amber:        oklch(0.58 0.13 70);

    --t0-bg: oklch(0.95 0.035 258); --t0-fg: oklch(0.42 0.1 258); --t0-solid: oklch(0.62 0.13 258);
    --t1-bg: oklch(0.95 0.035 150); --t1-fg: oklch(0.42 0.1 150); --t1-solid: oklch(0.62 0.13 150);
    --t2-bg: oklch(0.95 0.035 27);  --t2-fg: oklch(0.42 0.1 27);  --t2-solid: oklch(0.62 0.13 27);
    --t3-bg: oklch(0.95 0.035 85);  --t3-fg: oklch(0.42 0.1 85);  --t3-solid: oklch(0.62 0.13 85);
    --t4-bg: oklch(0.95 0.035 320); --t4-fg: oklch(0.42 0.1 320); --t4-solid: oklch(0.62 0.13 320);
    --t5-bg: oklch(0.95 0.035 200); --t5-fg: oklch(0.42 0.1 200); --t5-solid: oklch(0.62 0.13 200);
    --t6-bg: oklch(0.95 0.035 55);  --t6-fg: oklch(0.42 0.1 55);  --t6-solid: oklch(0.62 0.13 55);
    --t7-bg: oklch(0.95 0.035 290); --t7-fg: oklch(0.42 0.1 290); --t7-solid: oklch(0.62 0.13 290);
    --t8-bg: oklch(0.95 0.035 170); --t8-fg: oklch(0.42 0.1 170); --t8-solid: oklch(0.62 0.13 170);
    --t9-bg: oklch(0.95 0.035 12);  --t9-fg: oklch(0.42 0.1 12);  --t9-solid: oklch(0.62 0.13 12);

    --ring: 0 0 0 3px var(--brand-soft);
  }
}

/* A hashed name resolves to one of these. */
.tint-0 { --tint-bg: var(--t0-bg); --tint-fg: var(--t0-fg); --tint-solid: var(--t0-solid); }
.tint-1 { --tint-bg: var(--t1-bg); --tint-fg: var(--t1-fg); --tint-solid: var(--t1-solid); }
.tint-2 { --tint-bg: var(--t2-bg); --tint-fg: var(--t2-fg); --tint-solid: var(--t2-solid); }
.tint-3 { --tint-bg: var(--t3-bg); --tint-fg: var(--t3-fg); --tint-solid: var(--t3-solid); }
.tint-4 { --tint-bg: var(--t4-bg); --tint-fg: var(--t4-fg); --tint-solid: var(--t4-solid); }
.tint-5 { --tint-bg: var(--t5-bg); --tint-fg: var(--t5-fg); --tint-solid: var(--t5-solid); }
.tint-6 { --tint-bg: var(--t6-bg); --tint-fg: var(--t6-fg); --tint-solid: var(--t6-solid); }
.tint-7 { --tint-bg: var(--t7-bg); --tint-fg: var(--t7-fg); --tint-solid: var(--t7-solid); }
.tint-8 { --tint-bg: var(--t8-bg); --tint-fg: var(--t8-fg); --tint-solid: var(--t8-solid); }
.tint-9 { --tint-bg: var(--t9-bg); --tint-fg: var(--t9-fg); --tint-solid: var(--t9-solid); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  transition: background-color .6s;
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

a { color: var(--brand); }
a:hover { color: var(--brand-hover); }

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }

/* A visible focus ring for keyboard users, suppressed for mouse clicks. */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wp-noscript { max-width: 460px; margin: 15vh auto; padding: 0 20px; line-height: 1.6; }

/* --------------------------------------------------------------------------
   Brand mark
   -------------------------------------------------------------------------- */

.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-word { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.brand-word .press { color: var(--green); }
.logo { display: block; flex: none; }

/* --------------------------------------------------------------------------
   Buttons and fields
   -------------------------------------------------------------------------- */

.btn-primary {
  height: 46px; border: none; border-radius: 8px; background: var(--brand);
  color: #fff; font-size: 15px; font-weight: 600; transition: var(--tx);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover); transform: translateY(-1px);
  box-shadow: 0 10px 20px -10px var(--brand-glow);
}
.btn-primary:active:not(:disabled) { transform: scale(.97); }

.btn-outline {
  height: 38px; padding: 0 14px; border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); font-size: 14px; transition: var(--tx);
}
.btn-outline:hover:not(:disabled) { background: var(--line-3); }
.btn-outline:active:not(:disabled) { transform: scale(.97); }

/* Row actions: icon + label, readable rather than whispered. */
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; border-radius: 7px;
  padding: 7px 11px; font-size: 14px; font-weight: 500;
  color: var(--ink-3); transition: var(--tx);
}
.btn-ghost svg { flex: none; opacity: .75; }
.btn-ghost:hover { background: var(--line-3); border-color: var(--field); color: var(--ink); }
.btn-ghost:hover svg { opacity: 1; }
.btn-ghost:active { transform: scale(.97); }

.btn-link {
  background: none; border: none; padding: 0; font-size: 14px;
  color: var(--muted); transition: var(--tx);
}
.btn-link:hover { color: var(--ink); }
.btn-link:active { transform: scale(.97); }

.link-btn {
  background: none; border: none; padding: 0 6px; font-size: 13px;
  color: var(--brand); transition: var(--tx);
}
.link-btn:active { transform: scale(.97); }

.inline-link {
  align-self: flex-start; background: none; border: none; padding: 0;
  font-size: 13px; color: var(--brand); transition: var(--tx);
}
.inline-link:active { transform: scale(.97); }

.btn-danger {
  height: 42px; border: none; border-radius: 8px; background: var(--red);
  color: #fff; font-size: 14px; font-weight: 600; transition: var(--tx);
}
.btn-danger:active { transform: scale(.97); }

.btn-danger-outline {
  height: 34px; padding: 0 12px; border: 1px solid var(--red-border);
  border-radius: 8px; background: var(--surface); color: var(--red);
  font-size: 13px; font-weight: 500; transition: var(--tx);
}
.btn-danger-outline:active { transform: scale(.97); }

.btn-xs {
  height: 30px; padding: 0 10px; border: 1px solid var(--field);
  border-radius: 7px; background: var(--surface); font-size: 13px; transition: var(--tx);
}
.btn-xs:hover { border-color: var(--brand); color: var(--brand); }
.btn-xs:active { transform: scale(.97); }

.btn-sm-primary {
  align-self: flex-start; height: 34px; padding: 0 14px; border: none;
  border-radius: 8px; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 600; transition: var(--tx);
}
.btn-sm-primary:hover {
  background: var(--brand-hover); transform: translateY(-1px);
  box-shadow: 0 10px 20px -10px var(--brand-glow);
}
.btn-sm-primary:active { transform: scale(.97); }

.icon-btn {
  width: 30px; height: 30px; border: none; border-radius: 7px; background: none;
  font-size: 17px; color: var(--muted); padding: 0; flex: none; transition: var(--tx);
}
.icon-btn:hover { background: var(--line-3); color: var(--red); }
.icon-btn:active { transform: scale(.97); }

.icon-x {
  width: 28px; height: 28px; border: none; border-radius: 7px; background: none;
  font-size: 17px; color: var(--muted); padding: 0; transition: var(--tx);
}
.icon-x:hover { background: var(--line-2); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.field > span.note { font-weight: 400; }

.inp {
  height: 46px; width: 100%; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 12px; font-size: 15px; color: var(--ink); outline: none; background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.inp:focus { border-color: var(--brand); box-shadow: var(--ring); }

.inp-sm {
  height: 42px; width: 100%; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 12px; font-size: 14px; color: var(--ink); outline: none; background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.inp-sm:focus { border-color: var(--brand); }

.inp-40 {
  height: 40px; width: 100%; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 12px; font-size: 14px; outline: none; background: var(--surface);
  transition: border-color .2s;
}
.inp-40:focus { border-color: var(--brand); }

/* Native select arrows sit flush against the right edge and vary by platform,
   so the arrow is drawn here instead and given room to breathe. */
select.sel, select.sel-40, select.sel-sm, select.sel-xs, select.sel-36 {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--field);
  background-color: var(--surface);
  color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1.25 1.75 6 6.25l4.75-4.5' stroke='%236E6A63' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .2s, box-shadow .2s;
}
select.sel:focus, select.sel-40:focus, select.sel-sm:focus,
select.sel-xs:focus, select.sel-36:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
select.sel::-ms-expand, select.sel-40::-ms-expand, select.sel-sm::-ms-expand,
select.sel-xs::-ms-expand, select.sel-36::-ms-expand { display: none; }

select.sel    { height: 42px; border-radius: 8px; padding: 0 36px 0 12px; font-size: 14px; }
select.sel-40 { height: 40px; border-radius: 8px; padding: 0 34px 0 12px; font-size: 14px; }
select.sel-36 { height: 36px; border-radius: 8px; padding: 0 32px 0 10px; font-size: 13px; }
select.sel-sm { height: 34px; border-radius: 8px; padding: 0 32px 0 10px; font-size: 13px; }
select.sel-xs { height: 32px; border-radius: 7px; padding: 0 30px 0 9px;  font-size: 13px;
                background-position: right 9px center; }

/* Password field with a reveal button tucked inside it. */
.pw-wrap { position: relative; display: block; }
.pw-wrap .inp, .pw-wrap .inp-40, .pw-wrap .inp-sm { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: none; border-radius: 7px; background: none; color: var(--muted);
  padding: 0; transition: var(--tx);
}
.pw-toggle:hover { background: var(--line-3); color: var(--ink-3); }

/* Security panel rows */
.sec-row { display: flex; align-items: flex-start; gap: 12px; }
.sec-row + .sec-row { padding-top: 14px; border-top: 1px solid var(--line-2); }
.sec-ico {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.sec-ico.on  { background: var(--green-soft); color: var(--green); }
.sec-ico.off { background: var(--line-3); color: var(--muted); }
.sec-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sec-title { font-size: 15px; font-weight: 600; }
.sec-note { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Toggle switch */
.switch { position: relative; flex: none; display: inline-flex; align-items: center; cursor: pointer; }
.switch input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.switch-track {
  width: 42px; height: 24px; border-radius: 99px; background: var(--field);
  display: block; transition: background-color .25s var(--ease);
}
.switch-knob {
  display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(29, 28, 26, .3);
  transition: transform .25s var(--ease);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.notice {
  font-size: 13px; line-height: 1.5; padding: 12px 14px; border-radius: 10px;
  background: var(--green-soft); color: var(--t1-fg);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { font-size: 13px; color: var(--red); }
.hint { font-size: 12px; color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------------------
   Sign in
   -------------------------------------------------------------------------- */

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-col { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 24px; display: flex; flex-direction: column; gap: 16px;
}
.auth-title { margin: 0; font-size: 22px; font-weight: 600; }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-sub { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; text-wrap: pretty; }
.auth-sub strong { color: var(--ink); font-weight: 600; }
.auth-foot {
  font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5;
  display: flex; flex-direction: column; gap: 2px; text-wrap: pretty;
}
.auth-foot strong { color: var(--green); font-weight: 600; }

.btn-google {
  height: 46px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface);
  font-size: 15px; font-weight: 500; display: flex; align-items: center;
  justify-content: center; gap: 10px; transition: var(--tx);
}
.btn-google:hover { background: var(--hover); border-color: var(--field-strong); }
.btn-google:active { transform: scale(.97); }
/* Google's mark keeps its own colours — no filters, no currentColor. */
.g-logo { width: 18px; height: 18px; flex: none; display: block; }

.or-row { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted-2); }
.or-row span.rule { flex: 1; height: 1px; background: var(--line-2); }

.otp-input {
  height: 56px; width: 100%; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 12px; font-size: 26px; font-weight: 600; letter-spacing: .5em;
  text-align: center; color: var(--ink); outline: none;
  font-variant-numeric: tabular-nums; background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.otp-input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.otp-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.otp-row .resend { background: none; border: none; font-size: 14px; padding: 0; transition: var(--tx); }
.otp-row .resend:active { transform: scale(.97); }

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* --------------------------------------------------------------------------
   Installed-app chrome
   -------------------------------------------------------------------------- */

/* Offer to install, once, above the books list. */
.install-bar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px 14px 16px;
}
.install-icon { width: 40px; height: 40px; border-radius: 9px; flex: none; display: block; }
.install-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-title { font-size: 15px; font-weight: 600; }
.install-note { font-size: 13px; color: var(--muted); line-height: 1.45; }
.install-bar .btn-new, .install-bar .btn-outline { flex: none; }

/* Server has moved on from what this window is running. */
.update-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; padding: 10px 16px;
  background: var(--brand); color: #fff; font-size: 14px;
}
.update-text { font-weight: 500; }
.update-btn {
  height: 30px; padding: 0 14px; border: none; border-radius: 7px;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 13px; font-weight: 600;
  transition: var(--tx);
}
.update-btn:hover { background: rgba(255, 255, 255, .28); }
.update-btn:active { transform: scale(.97); }

/* In a standalone window there is no browser chrome, so keep clear of the
   notch and the home indicator. */
@supports (padding: max(0px)) {
  @media (display-mode: standalone) {
    .app-head { padding-top: env(safe-area-inset-top); height: auto; }
    .head-inner { min-height: 58px; }
    .cash-bar { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
    .drawer-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  }
}

.app-head {
  position: sticky; top: 0; z-index: 40; height: 58px;
  border-bottom: 1px solid var(--line);
}
/* The frosted background lives on a layer of its own. A backdrop-filter on the
   header itself would become the containing block for everything fixed inside
   it — the menu and bell scrims and the notification panel — and trap them in
   a 58px strip. */
.app-head::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--head-bg, var(--surface));
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.head-inner {
  width: 100%; max-width: 1180px; height: 100%; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}
.logo-btn {
  display: flex; align-items: center; gap: 10px; background: none;
  border: none; padding: 0; transition: var(--tx);
}
.logo-btn:active { transform: scale(.97); }
.logo-word { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.logo-word .press { color: var(--green); }

.acct { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: 10px; background: none;
  border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; transition: var(--tx);
}
.acct-btn:hover { background: var(--bg); }
.acct-btn:active { transform: scale(.97); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-hover); display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.acct-name { font-size: 14px; font-weight: 500; }
.caret {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-3); flex: none;
}
.acct-btn:hover .caret { color: var(--ink-3); }

.scrim { position: fixed; inset: 0; z-index: 41; }
.menu {
  transform-origin: top right; position: absolute; right: 0; top: 46px; z-index: 42;
  width: 290px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--pop); padding: 6px;
  display: flex; flex-direction: column;
}
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-name { font-size: 14px; font-weight: 600; }
.menu-email { font-size: 13px; color: var(--muted); }
.menu-section {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 12px;
  border-bottom: 1px solid var(--line-2); margin-bottom: 4px;
}
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.menu-item {
  text-align: left; background: none; border: none; border-radius: 6px;
  padding: 9px 10px; font-size: 14px; transition: var(--tx);
}
.menu-item:hover { background: var(--bg); }
.menu-item:active { transform: scale(.97); }
.menu-item.danger { color: var(--red); }

.app-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 0; flex: 1; }

/* --------------------------------------------------------------------------
   Books
   -------------------------------------------------------------------------- */

.books { display: flex; flex-direction: column; gap: 20px; padding-bottom: 48px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.page-sub { font-size: 14px; color: var(--muted); }
.btn-new {
  height: 42px; padding: 0 18px; border: none; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; transition: var(--tx);
}
.btn-new:hover {
  background: var(--brand-hover); transform: translateY(-1px);
  box-shadow: 0 10px 20px -10px var(--brand-glow);
}
.btn-new:active { transform: scale(.97); }

.tools { display: flex; flex-wrap: wrap; gap: 12px; }
.tools .inp-sm { flex: 1 1 260px; width: auto; }

.card-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.book-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px;
  align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2);
  cursor: pointer; transition: background-color .3s var(--ease);
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font: inherit; color: inherit;
}
.book-row:last-child { border-bottom: none; }
.book-row:hover { background: var(--hover); }
.book-icon {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--tint-bg, var(--brand-tint));
  color: var(--tint-fg, var(--brand-hover));
  display: grid; place-items: center; font-weight: 600; font-size: 15px;
}
.book-mid { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.book-name { font-size: 15px; font-weight: 500; }
.book-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pill { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line-3); color: var(--ink-3); }
.book-right { display: flex; align-items: center; gap: 14px; }
.book-bal { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 2px; }

.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.empty-title { font-size: 15px; font-weight: 500; }
.empty-text { font-size: 14px; color: var(--muted); }

.panel-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 12px;
}
.panel-title { font-size: 15px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Suggestion chips carry the colour the book will get once it exists, so the
   swatch you pick is the swatch you end up with. */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px 0 11px; border: 1px solid transparent; border-radius: 99px;
  background: var(--tint-bg, var(--surface)); color: var(--tint-fg, var(--ink));
  font-size: 13px; font-weight: 500; transition: var(--tx);
}
.chip::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--tint-solid, var(--field-strong));
}
.chip:hover { border-color: var(--tint-solid, var(--brand)); transform: translateY(-1px); }
.chip:active { transform: scale(.97); }
.chip-sm { height: 32px; padding: 0 12px 0 10px; }

/* --------------------------------------------------------------------------
   One book
   -------------------------------------------------------------------------- */

.book-screen { display: flex; flex-direction: column; gap: 18px; }
.book-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.book-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.back-btn {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); flex: none; transition: var(--tx);
  display: grid; place-items: center; padding: 0; color: var(--ink);
}
.back-btn svg { display: block; }
.back-btn:hover { background: var(--line-3); }
.back-btn:active { transform: scale(.97); }
.book-title { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.role-pill { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--line-3); color: var(--ink-3); flex: none; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The filter row owns a layer of its own, above the summary cards and the
   sticky Cash in / Cash out bar (z 10) but below the header (z 40). Without an
   explicit context here, an open dropdown is at the mercy of whatever paints
   after it. */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  position: relative; z-index: 15;
}
.filter { position: relative; }
.filter-btn {
  height: 36px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); font-size: 13px; display: flex; align-items: center;
  gap: 6px; transition: var(--tx);
}
.filter-btn:hover { border-color: var(--field-strong); }
.filter-btn:active { transform: scale(.97); }
/* A filter that is actually doing something should look like it. */
.filter-btn.on {
  border-color: var(--brand); background: var(--brand-tint-2); color: var(--brand-hover);
}
.filter-btn.on .k { color: var(--brand-hover); opacity: .8; }
.filter-btn.on .c { color: var(--brand-hover); }
.filter-btn .k { color: var(--muted); }
.filter-btn .v { font-weight: 500; }
.filter-btn .c { display: inline-flex; align-items: center; color: var(--muted); flex: none; }
.filter-panel {
  transform-origin: top left; position: absolute; top: 42px; left: 0; z-index: 30;
  min-width: 200px; max-width: calc(100vw - 32px); max-height: 320px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--pop); padding: 6px; display: flex; flex-direction: column;
}
.filter-opt {
  display: flex; align-items: center; gap: 10px; text-align: left; background: none;
  border: none; border-radius: 6px; padding: 8px 10px; font-size: 14px; transition: var(--tx);
}
.filter-opt:hover { background: var(--bg); }
.filter-opt:active { transform: scale(.97); }
.radio {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--field-strong);
  display: grid; place-items: center; flex: none;
}
.radio-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.filter-scrim { position: fixed; inset: 0; z-index: 20; }

.segment { display: flex; gap: 4px; padding: 4px; background: var(--segment); border-radius: 10px; align-self: flex-start; }
.seg-btn {
  height: 34px; padding: 0 16px; border: none; border-radius: 7px; background: none;
  font-size: 14px; color: var(--ink-3); transition: var(--tx);
}
.seg-btn:active { transform: scale(.97); }
.seg-btn.on { background: var(--surface); font-weight: 600; color: var(--ink); box-shadow: 0 1px 2px rgba(29, 28, 26, .08); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--lift); border-color: var(--stat-border); }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.stat-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Entry table */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table-min { min-width: 820px; }
.tr {
  display: grid;
  grid-template-columns: 40px 116px minmax(180px, 2fr) minmax(110px, 1fr) 96px 120px 130px;
  gap: 12px; align-items: center; padding: 12px 16px;
  border-bottom: 1px solid var(--line-2); cursor: pointer;
  transition: background-color .3s var(--ease);
}
.tr:hover { background: var(--hover); }
.tr-head {
  display: grid;
  grid-template-columns: 40px 116px minmax(180px, 2fr) minmax(110px, 1fr) 96px 120px 130px;
  gap: 12px; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--hover);
  font-size: 12px; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.tr-head .r, .tr .r { text-align: right; }
.check-cell { display: flex; padding: 6px 0; cursor: pointer; background: none; border: none; }
.check {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--field-strong);
  background: var(--surface); display: grid; place-items: center; flex: none;
}
.check.on { border-color: var(--brand); background: var(--brand); color: #fff; font-size: 11px; }
.cell-date { display: flex; flex-direction: column; gap: 2px; }
.cell-date .d1 { font-size: 14px; }
.cell-date .d2 { font-size: 12px; color: var(--muted); }
.cell-det { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cell-det .t1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-det .t2 { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edited { font-size: 12px; color: var(--muted-2); margin-left: 6px; }
.cat-chip {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 9px;
  border-radius: 99px; background: var(--tint-bg, var(--line-3)); color: var(--tint-fg, var(--ink-3));
}
.cell-mode { font-size: 13px; color: var(--ink-3); }
/* Payment mode reads as a quieter sibling of the category chip: same colour
   family, outlined rather than filled, so the two never compete. */
.mode-chip {
  display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px;
  border-radius: 99px; background: transparent; color: var(--tint-fg, var(--ink-3));
  box-shadow: inset 0 0 0 1px var(--tint-bg, var(--line-3));
}
.cell-amt { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-bal { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-3); }

.bulkbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--brand-tint-2); border-bottom: 1px solid var(--line);
}
.bulk-count { font-size: 14px; font-weight: 600; margin-right: 6px; }
.showing { font-size: 13px; color: var(--muted); padding-bottom: 8px; }

/* Mobile entry cards */
.m-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px;
  border-bottom: 1px solid var(--line-2); cursor: pointer;
  transition: background-color .3s var(--ease);
}
.m-row:last-child { border-bottom: none; }
.m-row:active { background: var(--hover-2); }
.m-left { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.m-remark { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-when { font-size: 12px; color: var(--muted); }
.m-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.m-chip {
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 99px;
  background: var(--tint-bg, var(--line-3)); color: var(--tint-fg, var(--ink-3));
}
.m-mode {
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 99px;
  color: var(--tint-fg, var(--muted-2));
  box-shadow: inset 0 0 0 1px var(--tint-bg, var(--line-3));
}
.m-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.m-amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.m-bal { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* Cash in / cash out bar */
.cash-bar {
  position: sticky; bottom: 0; z-index: 10; margin: 0 -24px; padding: 14px 24px;
  background: var(--bar-bg, rgba(247, 246, 243, .94)); border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.btn-in, .btn-out {
  flex: 1 1 0; max-width: 220px; height: 46px; border: none; border-radius: 9px;
  color: #fff; font-size: 15px; font-weight: 600; transition: var(--tx);
}
.btn-in { background: var(--green); }
.btn-in:hover { background: var(--green-hover); transform: translateY(-2px); box-shadow: 0 12px 22px -10px rgba(19, 119, 56, .7); }
.btn-out { background: var(--red); }
.btn-out:hover { background: var(--red-hover); transform: translateY(-2px); box-shadow: 0 12px 22px -10px rgba(190, 47, 44, .7); }
.btn-in:active, .btn-out:active { transform: scale(.97); }

/* --------------------------------------------------------------------------
   Statistics
   -------------------------------------------------------------------------- */

.stats-view { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.ins-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ins-label { font-size: 13px; color: var(--muted); }
.ins-value {
  font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ins-note { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.chart-title { font-size: 15px; font-weight: 600; }
.chart-sub { font-size: 13px; color: var(--muted); }
.chart-empty { padding: 40px 0; text-align: center; font-size: 14px; color: var(--muted); }
.seg-sm { display: flex; gap: 4px; padding: 3px; background: var(--line-3); border-radius: 8px; }
.seg-sm-btn {
  height: 28px; padding: 0 12px; border: none; border-radius: 6px; background: none;
  font-size: 13px; color: var(--ink-3); transition: var(--tx);
}
.seg-sm-btn.on { background: var(--surface); font-weight: 600; color: var(--ink); box-shadow: 0 1px 2px rgba(29, 28, 26, .08); }
.seg-sm-btn:active { transform: scale(.97); }

.pie-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
/* The size lives here and nowhere else. The SVG fills its box, so the ring and
   the centred text can never disagree about how big the chart is. */
.pie {
  position: relative; flex: none;
  width: clamp(150px, 56vw, 200px);
  height: clamp(150px, 56vw, 200px);
}
.pie svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pie-track { fill: none; stroke: var(--line-3); stroke-width: 26; }
.pie-seg { fill: none; cursor: pointer; transition: stroke-width .45s var(--ease), opacity .45s var(--ease); }
.pie-center {
  position: absolute; inset: 22%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; pointer-events: none; text-align: center;
}
.pie-center .pc-label { font-size: 12px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pie-center .pc-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pie-center .pc-sub { font-size: 11px; color: var(--muted-2); }

.legend { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.legend-item {
  display: flex; flex-direction: column; gap: 6px; text-align: left; border: none;
  border-radius: 8px; padding: 8px 10px; background: none;
  transition: background-color .3s, opacity .35s var(--ease);
}
.legend-item.on { background: var(--hover-2); }
.legend-item:active { transform: scale(.97); }
.legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 14px; width: 100%; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-amt { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; min-width: 84px; }
.legend-bar { height: 4px; border-radius: 99px; background: var(--line-3); overflow: hidden; width: 100%; }
.legend-fill { height: 100%; border-radius: 99px; transform-origin: left center; }
.pie-hint { font-size: 12px; color: var(--muted-2); }

.sel-panel {
  display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 10px;
  background: var(--hover); border: 1px solid var(--line-2);
}
.sel-head { display: flex; align-items: center; gap: 10px; }
.sel-sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.sel-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sel-name { font-size: 15px; font-weight: 600; }
.sel-meta { font-size: 12px; color: var(--muted); }
.sel-list { display: flex; flex-direction: column; }
.sel-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  text-align: left; border: none; background: none; border-top: 1px solid var(--line-2);
  padding: 9px 4px; font-size: 13px; transition: var(--tx);
}
.sel-item:hover { background: var(--hover-2); }
.sel-item:active { transform: scale(.97); }
.sel-item .si-mid { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sel-item .si-date { font-size: 12px; color: var(--muted-2); }
.sel-item .si-amt { font-weight: 600; font-variant-numeric: tabular-nums; }

.line-wrap { display: flex; flex-direction: column; gap: 6px; cursor: crosshair; }
.line-rel { position: relative; }
.line-rel svg { width: 100%; height: auto; display: block; overflow: visible; }
.ytick {
  position: absolute; left: 0; width: 8%; text-align: right;
  transform: translateY(-50%); font-size: 11px; color: var(--muted-2); white-space: nowrap;
}
.gridline { stroke: var(--line-2); stroke-width: 1; }
.zeroline { stroke: var(--field-strong); stroke-width: 1; stroke-dasharray: 4 4; }
.crosshair { stroke: var(--field-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.line-path { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.line-knob { fill: #fff; stroke: var(--brand); stroke-width: 2.5; }
.xticks { position: relative; height: 16px; }
.xtick { position: absolute; top: 0; font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.tip {
  position: absolute; background: var(--ink); color: #fff; border-radius: 8px;
  padding: 8px 11px; font-size: 12px; white-space: nowrap; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--tip-shadow);
  transition: left .18s var(--ease), top .18s var(--ease);
}
.tip .t-date { color: var(--field-strong); }
.tip .t-val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-label {
  position: absolute; transform: translate(-50%, -100%); font-size: 11px;
  font-weight: 600; white-space: nowrap; pointer-events: none; transition: opacity .35s;
}
/* Cash in sits a line above cash out so the pair never collides. */
.bar-label.lifted { transform: translate(-50%, calc(-100% - 15px)); }
.bar-tip {
  position: absolute; top: 6px; transform: translateX(-50%); background: var(--ink); color: #fff;
  border-radius: 8px; padding: 9px 12px; font-size: 12px; white-space: nowrap;
  pointer-events: none; display: grid; grid-template-columns: auto auto; gap: 3px 14px;
  box-shadow: var(--tip-shadow); transition: left .25s var(--ease);
}
.bar-tip .full { grid-column: 1 / -1; color: var(--field-strong); margin-bottom: 2px; }
.bar-tip .r { text-align: right; font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; gap: 16px; font-size: 13px; color: var(--ink-3); }
.legend-inline span { display: flex; align-items: center; gap: 6px; }
.axis { stroke: var(--line); stroke-width: 1; }
.bar { transform-box: fill-box; transform-origin: 50% 100%; pointer-events: none; transition: opacity .35s var(--ease); }

.top-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  text-align: left; border: none; background: none; border-radius: 8px; padding: 10px 8px;
  transition: var(--tx);
}
.top-item:hover { background: var(--hover); }
.top-item:active { transform: scale(.97); }
.top-rank { font-size: 12px; font-weight: 600; color: var(--muted-2); }
.top-mid { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.top-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { font-size: 12px; color: var(--muted-2); }
.top-track { display: block; height: 4px; border-radius: 99px; background: var(--top-track); overflow: hidden; }
.top-fill { display: block; height: 100%; border-radius: 99px; transform-origin: left center; background: var(--red-bar); }
.top-amt { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--red); }

.mode-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--line-3); }
.mode-bar > div { height: 100%; transform-origin: left center; }
.mode-rows { display: flex; flex-direction: column; gap: 10px; }
.mode-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 14px; }

/* --------------------------------------------------------------------------
   Drawer
   -------------------------------------------------------------------------- */

.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(29, 28, 26, .28); border: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(440px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line-2);
}
.drawer-title { font-size: 17px; font-weight: 600; }
.icon-close {
  width: 34px; height: 34px; border: none; border-radius: 8px; background: none;
  font-size: 20px; color: var(--muted); padding: 0; transition: var(--tx);
}
.icon-close:hover { background: var(--line-3); }
.icon-close:active { transform: scale(.97); }
.drawer-body { flex: 1; overflow: auto; padding: 22px; display: flex; flex-direction: column; gap: 18px; }
/* Tall content scrolls the body. Without this a flex child with its own
   overflow — the tab row — is the one that gives way, squashed to a sliver. */
.drawer-body > * { flex-shrink: 0; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); }
.drawer-foot.col { flex-direction: column; }
.drawer-foot.danger { background: var(--red-bg); }
.btn-half { flex: 1; height: 44px; border-radius: 8px; font-size: 14px; }
.btn-half.secondary { border: 1px solid var(--field); background: var(--surface); font-weight: 500; transition: var(--tx); }
.btn-half.secondary:hover { background: var(--line-3); }
.btn-half.primary { border: none; background: var(--brand); color: #fff; font-weight: 600; transition: var(--tx); }
.btn-half.primary:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 10px 20px -10px var(--brand-glow); }
.btn-half.destructive { border: 1px solid var(--red-border); background: var(--surface); color: var(--red); font-weight: 500; }
.btn-half.destructive-solid { border: none; background: var(--red); color: #fff; font-weight: 600; }
.btn-half:active { transform: scale(.97); }

.toggle2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--line-3); border-radius: 10px; }
.toggle-btn { height: 38px; border: none; border-radius: 7px; background: none; font-size: 14px; font-weight: 500; color: var(--ink-3); transition: var(--tx); }
.toggle-btn:active { transform: scale(.97); }
.toggle-btn.on-in { background: var(--green); color: #fff; font-weight: 600; }
.toggle-btn.on-out { background: var(--red); color: #fff; font-weight: 600; }

.amount-input {
  height: 52px; width: 100%; border: 1px solid var(--field); border-radius: 8px;
  padding: 0 14px; font-size: 22px; font-weight: 600; color: var(--ink); outline: none;
  font-variant-numeric: tabular-nums; background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.amount-input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.amount-hint { font-size: 13px; color: var(--ink-3); font-weight: 400; }

.bills { display: flex; flex-direction: column; gap: 8px; }
.bills-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.bills-label span { font-weight: 400; }
.bill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bill-thumb { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.bill-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bill-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none;
  border-radius: 50%; background: rgba(29, 28, 26, .72); color: #fff; font-size: 14px;
  line-height: 1; padding: 0; transition: var(--tx);
}
.bill-del:active { transform: scale(.97); }
.bill-add {
  width: 76px; height: 76px; border: 1.5px dashed var(--dash); border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; background: var(--hover);
  font-size: 13px; color: var(--ink-3); transition: var(--tx);
}
.bill-add:hover { border-color: var(--brand); color: var(--brand); }
.bill-busy { opacity: .55; }

.det-badge { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.det-amount { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.det-grid {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px 16px; font-size: 14px;
  padding: 16px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
}
.det-grid .k { color: var(--muted); }
.sec-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bill-btn {
  width: 88px; height: 88px; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; background: var(--surface); transition: var(--tx);
}
.bill-btn:hover { border-color: var(--brand); }
.bill-btn:active { transform: scale(.97); }
.bill-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.log-row { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 12px; }
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--field-strong); margin-top: 6px; }
.log-mid { display: flex; flex-direction: column; gap: 2px; }
.log-text { font-size: 14px; }
.log-meta { font-size: 12px; color: var(--muted); }

.tabs {
  display: flex; gap: 4px; padding: 4px; background: var(--line-3); border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* old Edge */
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1; height: 34px; padding: 0 10px; border: none; border-radius: 7px; background: none;
  font-size: 13px; color: var(--ink-3); white-space: nowrap; transition: var(--tx);
}
.tab.on { background: var(--surface); font-weight: 600; color: var(--ink); box-shadow: 0 1px 2px rgba(29, 28, 26, .08); }
.tab:active { transform: scale(.97); }

.invite-grid { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; }
.member-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.member:last-child { border-bottom: none; }
.m-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-hover); display: grid; place-items: center; font-size: 13px;
  font-weight: 600; flex: none;
}
.member .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.member .nm { font-size: 14px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.member .em { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-invited { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--amber-soft); color: var(--amber-ink); }
.roles-note { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--hover); border-radius: 10px; font-size: 13px; line-height: 1.45; }
.roles-note strong { font-weight: 600; }
.roles-note span { color: var(--ink-3); }

.list-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.btn-add { height: 40px; padding: 0 16px; border: none; border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; transition: var(--tx); }
.btn-add:active { transform: scale(.97); }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line-2); }
.item-row:last-child { border-bottom: none; }
.item-name { font-size: 14px; }
.item-uses { font-size: 12px; color: var(--muted-2); }
.item-right { display: flex; align-items: center; gap: 8px; }

.confirm-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--red-border); border-radius: 10px; background: var(--red-bg); font-size: 14px; line-height: 1.5; }
.confirm-row { display: flex; gap: 8px; }
.confirm-row button { flex: 1; height: 38px; border-radius: 8px; font-size: 14px; }

.panel { border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; flex-direction: column; gap: 2px; }
.drive-head { display: flex; align-items: center; gap: 12px; }
.drive-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--green-soft); display: grid; place-items: center; flex: none; }
.drive-icon i { width: 14px; height: 14px; border-radius: 4px; background: var(--green-mid); transform: rotate(45deg); display: block; }
.drive-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.drive-name { font-size: 15px; font-weight: 600; }
.drive-status { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.backup-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.backup-item:last-child { border-bottom: none; }
.backup-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.backup-when { font-size: 14px; }
.backup-meta { font-size: 12px; color: var(--muted-2); }
.pair { display: flex; flex-wrap: wrap; gap: 8px; }
.pair > * { flex: 1 1 150px; height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface); font-size: 14px; display: grid; place-items: center; transition: var(--tx); }
.pair > *:hover { background: var(--line-3); }
label.pair-item { cursor: pointer; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 16px; border: 1.5px dashed var(--dash); border-radius: 10px;
  background: var(--hover); cursor: pointer; text-align: center;
}
.dropzone .dz-1 { font-size: 14px; font-weight: 500; }
.dropzone .dz-2 { font-size: 12px; color: var(--muted); }
.map-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; }
.map-row .lbl { font-size: 14px; }
.preview-box { border: 1px solid var(--line); border-radius: 10px; }
.preview-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.preview-row:last-child { border-bottom: none; }
.preview-row .pd { color: var(--muted); }
.preview-row .pa { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Modals, lightbox, toast
   -------------------------------------------------------------------------- */

.modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(29, 28, 26, .28); display: grid; place-items: center; padding: 24px; }
.modal { width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-title { font-size: 17px; font-weight: 600; }
.keys-grid { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; font-size: 14px; }
.kbd { font-size: 12px; font-weight: 600; padding: 3px 8px; border: 1px solid var(--field); border-radius: 6px; background: var(--hover); justify-self: start; }

/* Bottom sheet — the phone stand-in for a dropdown. */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 65; background: rgba(29, 28, 26, .38);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 76vh;
  background: var(--surface); border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(29, 28, 26, .18);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--field); margin: 8px auto 0; flex: none; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px 18px; flex: none;
}
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 2px 8px 14px; display: flex; flex-direction: column; }
.sheet-opt {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  border: none; background: none; border-radius: 10px; padding: 14px 12px;
  font-size: 15px; color: var(--ink);
}
.sheet-opt:active { background: var(--hover-2); }
.sheet-opt.on { color: var(--brand-hover); font-weight: 600; }

.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(29, 28, 26, .82); display: grid; place-items: center; padding: 24px; cursor: zoom-out; border: none; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; display: block; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: #fff; font-size: 14px; padding: 10px 16px;
  border-radius: 8px; max-width: calc(100vw - 32px); text-align: center;
}

.busy { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(247, 246, 243, .6); }
.spinner {
  width: 30px; height: 30px; border: 3px solid var(--field); border-top-color: var(--brand);
  border-radius: 50%; animation: wp-spin .8s linear infinite;
}
@keyframes wp-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Phone layout. The design calls for the table to become a card list, the
   drawer to become a full-height sheet and the cash buttons to span the width.
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Colours for categories and payment methods
   -------------------------------------------------------------------------- */

/* The round button that shows an item's colour and opens the palette. */
.swatch-btn {
  width: 22px; height: 22px; flex: none; padding: 0; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--tint-solid, var(--field-strong));
  box-shadow: 0 0 0 1px var(--line); transition: var(--tx);
}
.swatch-btn:hover { transform: scale(1.12); }
.swatch-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand); }
.swatch-btn.open { box-shadow: 0 0 0 2px var(--brand); }
.swatch-btn.auto {
  background: conic-gradient(#E5484D, #FFB224, #30A46C, #05A2C2, #3E63DD, #AB4ABA, #E5484D);
}
.list-add.with-swatch { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }

.item-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-left .item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-palette { padding: 12px 14px 14px; border-bottom: 1px solid var(--line-2); background: var(--hover); }
.item-palette:last-child { border-bottom: none; border-radius: 0 0 10px 10px; }

.palette { display: flex; flex-direction: column; gap: 12px; }
.pal-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; justify-items: center; }
.pal-sw {
  width: 100%; max-width: 30px; aspect-ratio: 1; padding: 0; border: none; border-radius: 50%;
  background: var(--sw); display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(29, 28, 26, .1); transition: var(--tx);
}
.pal-sw:hover { transform: scale(1.12); }
.pal-sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.pal-sw:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.pal-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-opt {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px 0 7px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); font-size: 13px; color: var(--ink-3); cursor: pointer; transition: var(--tx);
}
.pal-opt:hover { border-color: var(--field-strong); }
.pal-opt.on { border-color: var(--brand); color: var(--brand-hover); background: var(--brand-tint-2); }
.pal-opt:focus-within { box-shadow: var(--ring); }
/* The system colour picker sits invisibly over its label, so a tap anywhere
   on "Custom…" opens it on every platform. */
.pal-opt input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  border: none; padding: 0; cursor: pointer;
}
.pal-dot { width: 18px; height: 18px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(29, 28, 26, .12); }
.pal-dot.rainbow {
  background: conic-gradient(#E5484D, #FFB224, #30A46C, #05A2C2, #3E63DD, #AB4ABA, #E5484D);
}
.pal-dot.auto { background: linear-gradient(135deg, var(--t0-solid) 0 50%, var(--t6-solid) 50% 100%); }

/* Suggested items from the user's other books. */
.suggest {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px;
  border: 1px dashed var(--dash); border-radius: 10px; background: var(--hover);
}
.suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.suggest .chips { gap: 6px; }
.suggest .chip { background: var(--tint-bg, var(--surface)); }
.chip-plus { font-weight: 600; font-size: 15px; line-height: 1; opacity: .65; margin-left: 1px; }

/* Chips that show rather than do. */
.chip-static { cursor: default; }
.chip-static:hover { transform: none; border-color: transparent; }

/* --------------------------------------------------------------------------
   Your books: a bar that stays put, whatever the length of the list
   -------------------------------------------------------------------------- */

.books-bar {
  position: sticky; top: 58px; z-index: 30;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  /* Bleed to the page edges so the list scrolls away cleanly beneath it. */
  margin: -10px -24px; padding: 10px 24px; background: var(--bg);
}
.books-bar .sel { width: auto; min-width: 200px; }
.bar-manage { height: 42px; padding: 0 14px; }
.search-wrap { position: relative; min-width: 0; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-wrap .inp-sm { padding-left: 36px; }
.search-wrap .inp-sm::-webkit-search-cancel-button { cursor: pointer; }
.sq-btn {
  width: 42px; height: 42px; flex: none; padding: 0; border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); color: var(--ink-3); display: grid; place-items: center; transition: var(--tx);
}
.sq-btn:hover { background: var(--line-3); }
.sq-btn:active { transform: scale(.95); }
.sq-btn.on { border-color: var(--brand); color: var(--brand-hover); background: var(--brand-tint-2); }

.fab {
  position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 35;
  display: inline-flex; align-items: center; gap: 6px; height: 50px; padding: 0 20px 0 16px;
  border: none; border-radius: 99px; background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 12px 24px -10px var(--brand-glow); transition: var(--tx);
}
.fab:active { transform: scale(.96); }
/* Room for the floating button under the last book. */
.books.has-fab { padding-bottom: 96px; }

.empty-start { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px 30px; text-align: center; }
.empty-start .empty-text { max-width: 380px; line-height: 1.5; }
.empty-start .chips { justify-content: center; padding-top: 4px; }

/* The New book drawer's "this book will start with". */
.start-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.start-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.start-head .btn-outline { height: 34px; padding: 0 12px; font-size: 13px; flex: none; }
.start-label { font-size: 12px; color: var(--muted); margin-bottom: -4px; }

/* The library drawer. */
.lib-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--line-2); }
.lib-row:last-child { border-bottom: none; }
.lib-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lib-meta { font-size: 12px; color: var(--muted-2); }
.def-toggle {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); font-size: 12px; color: var(--muted); transition: var(--tx);
}
.def-toggle:hover { border-color: var(--field-strong); color: var(--ink-3); }
.def-toggle.on { border-color: transparent; background: var(--green-soft); color: var(--green-hover); font-weight: 500; }
.def-toggle:active { transform: scale(.96); }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--ink-3); line-height: 1.4; cursor: pointer; }
.check-row input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--brand); }
.confirm-col { display: flex; flex-direction: column; gap: 8px; }
.confirm-col button { flex: none; height: 38px; }

/* --------------------------------------------------------------------------
   Account menu extras and deleting an account
   -------------------------------------------------------------------------- */

.menu-sep { height: 1px; background: var(--line-2); margin: 4px 0; }
.menu-item.menu-quiet { font-size: 13px; color: var(--muted); }
.menu-item.menu-quiet:hover { color: var(--red); background: var(--red-bg); }

.danger-hero {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border: 1px solid var(--red-border); border-radius: 10px; background: var(--red-bg);
}
.danger-ico {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: var(--red-soft); color: var(--red);
}
.danger-title { font-size: 15px; font-weight: 600; color: var(--red-hover); }
.danger-text { font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.del-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 14px; line-height: 1.45; }
.del-list li { display: flex; gap: 10px; align-items: flex-start; }
.del-list li::before { content: ''; width: 6px; height: 6px; margin-top: 8px; flex: none; border-radius: 50%; background: var(--red); }
.del-list.keep li::before { background: var(--green); }
.btn-row { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: inherit; }
.kbd-inline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; font-weight: 600; color: var(--red); letter-spacing: .06em; }
.confirm-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; }
.confirm-input.ok { border-color: var(--red); }

/* --------------------------------------------------------------------------
   Appearance: the coloured backdrop and the picker
   -------------------------------------------------------------------------- */

.theme-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.tb-band {
  position: absolute; left: -10%; right: -10%; top: -260px; height: 560px;
  transform: skewY(-8deg); transform-origin: 0 0; opacity: .9;
  background: linear-gradient(100deg, var(--tb-d), var(--tb-a) 25%, var(--tb-b) 50%, var(--tb-c) 75%, var(--tb-d));
  background-size: 220% 100%;
  animation: wp-band 22s ease-in-out infinite;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.tb-blob { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; }
.tb-1 { width: 46vw; height: 46vw; left: -12vw; top: 30vh; background: var(--tb-a); opacity: .28; animation: wp-drift-a 26s ease-in-out infinite; }
.tb-2 { width: 40vw; height: 40vw; right: -10vw; top: 45vh; background: var(--tb-c); opacity: .26; animation: wp-drift-b 30s ease-in-out infinite; }
.tb-3 { width: 34vw; height: 34vw; left: 35vw; bottom: -18vw; background: var(--tb-b); opacity: .22; animation: wp-drift-c 34s ease-in-out infinite; }
@keyframes wp-band { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes wp-drift-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(8vw, 6vh) scale(1.15); } }
@keyframes wp-drift-b { 0%, 100% { transform: translate(0, 0) scale(1.1); } 50% { transform: translate(-10vw, 4vh) scale(.9); } }
@keyframes wp-drift-c { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(4vw, -6vh) rotate(25deg); } }

/* Over a coloured backdrop the sticky books bar is frosted like the header,
   rather than a flat stripe cutting through the colour. */
html:not([data-theme="classic"]) .books-bar {
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}

.theme-section { gap: 8px; }
.theme-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0;
  border: none; background: none; font-size: 12px; color: var(--ink); transition: var(--tx);
}
.theme-opt.on { font-weight: 600; }
.theme-opt:active { transform: scale(.96); }
.theme-chip {
  display: block; width: 100%; height: 34px; border-radius: 8px;
  border: 2px solid var(--line); box-shadow: inset 0 0 0 2px #fff; transition: border-color .25s;
}
.theme-opt:hover .theme-chip { border-color: var(--field-strong); }
.theme-opt.on .theme-chip { border-color: var(--brand); }

/* --------------------------------------------------------------------------
   Delete book / Leave this book: full width, one line tall
   -------------------------------------------------------------------------- */

/* These used .btn-half, whose flex: 1 is meant for a row of two buttons. In
   the drawer's column it grew the button down the whole height of the panel. */
.btn-wide {
  flex: none; width: 100%; height: 40px; padding: 0 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500; transition: var(--tx);
}
.btn-wide.danger { border: 1px solid var(--red-border); background: var(--surface); color: var(--red); }
.btn-wide.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-wide:active { transform: scale(.97); }
.danger-zone { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }

/* --------------------------------------------------------------------------
   Header: the super admin's bell
   -------------------------------------------------------------------------- */

.head-right { display: flex; align-items: center; gap: 4px; }
.bell-wrap { position: relative; }
.bell-btn {
  position: relative; width: 40px; height: 40px; border: 1px solid transparent; border-radius: 8px;
  background: none; display: grid; place-items: center; color: var(--ink-3); padding: 0; transition: var(--tx);
}
.bell-btn:hover { background: var(--bg); color: var(--ink); }
.bell-btn:active { transform: scale(.95); }
.bell-btn[aria-expanded="true"] { background: var(--bg); }
.bell-badge {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface); font-variant-numeric: tabular-nums;
}
.bell-panel {
  transform-origin: top right; position: fixed; top: 62px; z-index: 42;
  width: min(360px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(29, 28, 26, .12);
  display: flex; flex-direction: column; overflow: hidden;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.bell-title { font-size: 15px; font-weight: 600; }
.bell-sub { font-size: 12px; color: var(--muted); }
.bell-list { max-height: min(460px, calc(100vh - 200px)); overflow: auto; display: flex; flex-direction: column; }
.note-row {
  display: grid; grid-template-columns: 8px 32px minmax(0, 1fr); gap: 10px; align-items: start;
  width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line-2);
  background: var(--surface); padding: 12px 16px; transition: background-color .25s var(--ease);
}
.note-row.unread { background: var(--brand-tint); }
.note-row:hover { background: var(--hover); }
.note-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 12px; }
.note-row.unread .note-dot { background: var(--brand); }
.note-mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.note-text { font-size: 14px; }
.note-text strong { font-weight: 600; }
.note-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-meta { font-size: 12px; color: var(--muted-2); }
.bell-more {
  flex: none; height: 44px; border: none; background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--brand); transition: var(--tx);
}
.bell-more:hover { background: var(--hover); }
.bell-empty { padding: 28px 16px; text-align: center; font-size: 14px; color: var(--muted); }
.bell-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--hover);
}
.menu-item.menu-split { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.owner-pill {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: var(--brand-tint); color: var(--brand-hover); font-weight: 500;
}

/* --------------------------------------------------------------------------
   Super admin dashboard
   -------------------------------------------------------------------------- */

.admin { display: flex; flex-direction: column; gap: 20px; padding-bottom: 48px; }
.admin-head { display: flex; align-items: center; gap: 12px; }
.admin-head-mid { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sa-pill {
  font-size: 12px; padding: 2px 9px; border-radius: 99px;
  background: var(--brand-tint); color: var(--brand-hover); font-weight: 500;
}
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-note { font-size: 12px; color: var(--muted); }

.users-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.users-top { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.users-top-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.users-title { font-size: 15px; font-weight: 600; }
.users-search { flex: 0 1 260px; min-width: 180px; }
.users-search .inp-sm { height: 38px; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip {
  height: 32px; padding: 0 12px; border-radius: 99px; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--field); background: var(--surface); color: var(--ink-3); transition: var(--tx);
}
.fchip:hover { border-color: var(--field-strong); }
.fchip:active { transform: scale(.97); }
.fchip.on { border-color: var(--brand); background: var(--brand-tint-2); color: var(--brand-hover); font-weight: 600; }
.fchip .n { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }

/* 220 + 110 + 100 + 64 + 110 + 84 + 184 columns, 6 x 12 gaps and 2 x 18
   padding: 980. The old 940 was narrower than a row, which is why the row
   rules stopped short and the action buttons hung past the card's edge. */
.ut-min { min-width: 980px; }
.ut-head, .ut-row {
  display: grid; grid-template-columns: minmax(220px, 2fr) 110px 100px 64px 110px 84px 184px;
  gap: 12px; align-items: center;
}
.ut-head {
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--hover);
  font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.ut-head .c, .ut-row .c { text-align: center; }
.ut-head .r { text-align: right; }
.ut-row { padding: 12px 18px; border-bottom: 1px solid var(--line-2); transition: background-color .3s var(--ease); }
.ut-row:last-child { border-bottom: none; }
.ut-row:hover { background: var(--hover); }
.ut-row.hl, .u-card.hl { background: var(--brand-tint); }
.u-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.u-who .m-avatar.dim, .u-card .m-avatar.dim { opacity: .5; }
.u-mid { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.u-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-cell { font-size: 13px; }
.u-cell.soft { color: var(--ink-3); }
.u-cell.c { font-variant-numeric: tabular-nums; }
.st-pill { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 99px; font-weight: 500; white-space: nowrap; flex: none; }
.st-active   { background: var(--green-soft); color: var(--t1-fg); }
.st-inactive { background: var(--line-3); color: var(--ink-3); }
.st-blocked  { background: var(--red-soft); color: var(--red-hover); }
.st-invited  { background: var(--brand-tint); color: var(--brand-hover); }
.u-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.u-you { font-size: 13px; color: var(--muted-2); }
.ubtn {
  height: 32px; padding: 0 12px; border-radius: 7px; background: var(--surface);
  font-size: 13px; font-weight: 500; transition: var(--tx);
}
.ubtn:active { transform: scale(.97); }
.ubtn.block { border: 1px solid var(--red-border); color: var(--red); }
.ubtn.block:hover { background: var(--red-bg); }
.ubtn.unblock { border: 1px solid var(--brand-line); color: var(--brand); }
.ubtn.unblock:hover { background: var(--brand-tint); }
.ubtn.del { border: 1px solid var(--field); color: var(--ink-3); }
.ubtn.del:hover { border-color: var(--red-border); color: var(--red); }
.u-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.u-card:last-child { border-bottom: none; }
.u-card-top { display: flex; align-items: center; gap: 10px; }
.u-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.u-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.u-card-actions:empty { display: none; }
.u-card .ubtn { height: 44px; padding: 0 16px; border-radius: 8px; font-size: 14px; }
.u-actions .ubtn, .u-card-actions .ubtn { white-space: nowrap; flex: none; }

/* Tablet: the card keeps its details on the left and puts the actions in a
   column of their own on the right, vertically centred. */
@media (min-width: 720px) and (max-width: 1079px) {
  .u-card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px; row-gap: 8px; align-items: center; padding: 14px 18px;
  }
  .u-card-top { grid-column: 1; grid-row: 1; }
  .u-facts { grid-column: 1; grid-row: 2; padding-left: 42px; }
  .u-card-actions { grid-column: 2; grid-row: 1 / span 2; flex-wrap: nowrap; justify-content: flex-end; }
  .u-card .ubtn { height: 38px; padding: 0 14px; font-size: 13px; }
}

/* Confirmations for Block and Delete. */
.modal.wide { max-width: 420px; }
.modal-text { font-size: 14px; color: var(--ink-3); line-height: 1.55; text-wrap: pretty; }
.modal-meta { font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 8px; background: var(--hover); border: 1px solid var(--line-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions button { height: 40px; padding: 0 16px; border-radius: 8px; font-size: 14px; }
.modal-actions .btn-outline { height: 40px; }
.btn-danger-solid { border: none; background: var(--red); color: #fff; font-weight: 600; transition: var(--tx); }
.btn-danger-solid:hover { background: var(--red-hover); }
.btn-danger-solid:active { transform: scale(.97); }

/* "Your access is paused" */
.paused-text { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; text-wrap: pretty; }
.paused-text strong { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   Budget
   -------------------------------------------------------------------------- */

.budget { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.bud-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.bud-nav { display: flex; align-items: center; gap: 6px; }
.bud-arrow {
  width: 36px; height: 36px; border: 1px solid var(--field); border-radius: 8px; padding: 0;
  background: var(--surface); color: var(--ink); display: grid; place-items: center; transition: var(--tx);
}
.bud-arrow:hover:not(:disabled) { background: var(--line-3); }
.bud-arrow:active:not(:disabled) { transform: scale(.95); }
.bud-arrow:disabled { opacity: .35; cursor: default; }
.bud-month { min-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.bud-month-name { font-size: 16px; font-weight: 600; }
.bud-month-sub { font-size: 12px; color: var(--muted); }

.bud-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.bud-empty { padding: 40px 20px; align-items: center; gap: 8px; text-align: center; }
.bud-empty-title { font-size: 15px; font-weight: 500; }
.bud-empty-text { font-size: 14px; color: var(--muted); max-width: 380px; line-height: 1.5; text-wrap: pretty; }
.bud-empty .btn-new { margin-top: 8px; }
.bud-sum-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.bud-sum-left { display: flex; flex-direction: column; gap: 4px; }
.bud-label { font-size: 13px; color: var(--muted); }
.bud-figs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.bud-spent { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bud-of { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bud-pct { font-size: 14px; font-weight: 600; }
.bud-track { height: 10px; border-radius: 99px; background: var(--line-3); overflow: hidden; }
.bud-fill { height: 100%; border-radius: 99px; transform-origin: 0 50%; }
.bud-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding-top: 4px; }
.bud-fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bud-fact-l { font-size: 12px; color: var(--muted); }
.bud-fact-v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bud-alert {
  --alert-ink: #B02B27;
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border-radius: 12px; border: 1px solid #FDC9C2; background: #FFF0EE;
}
.bud-alert.amb { --alert-ink: #915200; border-color: #F0D3A3; background: #FFF3DF; }
@supports (color: oklch(0.5 0.1 250)) {
  .bud-alert { --alert-ink: oklch(0.5 0.17 27); border-color: oklch(0.88 0.06 27); background: oklch(0.97 0.02 27); }
  .bud-alert.amb { --alert-ink: oklch(0.5 0.12 65); border-color: oklch(0.88 0.07 80); background: oklch(0.97 0.03 80); }
}
.bud-alert-ico {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--alert-ink);
  color: var(--alert-ink); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.bud-alert-mid { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bud-alert-title { font-size: 14px; font-weight: 600; color: var(--alert-ink); }
.bud-alert-text { font-size: 13px; color: var(--ink-3); line-height: 1.5; text-wrap: pretty; }

.bud-pace { gap: 12px; padding: 18px 20px; }
.bud-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.bud-legend span { display: flex; align-items: center; gap: 6px; }
.lg-line { width: 14px; height: 3px; border-radius: 2px; background: var(--brand); }
.lg-dash { width: 14px; height: 0; border-top: 2px dashed #A9A39A; }
.pace-svg { display: block; width: 100%; height: auto; overflow: visible; }
.pace-svg text { font-family: inherit; font-size: 12px; }
.pace-axis { stroke: var(--line); stroke-width: 1; }
.pace-budget { stroke: var(--red); stroke-width: 1; stroke-dasharray: 2 4; opacity: .6; }
.pace-budget-label { fill: var(--red); }
.pace-ideal { fill: none; stroke: #A9A39A; stroke-width: 1.5; stroke-dasharray: 5 5; }
/* fill- and stroke-opacity rather than opacity: the entrance fades opacity
   from 0 to 1, and would flash these at full strength on the way. */
.pace-area { fill: var(--brand); fill-opacity: .07; }
.pace-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.pace-proj { fill: none; stroke: var(--brand); stroke-width: 2; stroke-dasharray: 3 5; stroke-opacity: .45; }
.pace-dot { fill: #fff; stroke: var(--brand); stroke-width: 2.5; }
.pace-tick { fill: var(--muted-2); }
.pace-note { font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.pace-note.over { color: var(--red); }

.bud-list { padding: 18px 20px 6px; gap: 0; }
.bud-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 4px; }
.bud-list-sub { font-size: 12px; color: var(--muted-2); }
.bud-row {
  display: flex; flex-direction: column; gap: 7px; padding: 12px 8px; margin: 0 -8px;
  width: calc(100% + 16px); border: none; border-bottom: 1px solid var(--line-2); border-radius: 6px;
  background: none; text-align: left; font: inherit; color: inherit; transition: background-color .25s;
}
.bud-row:last-child { border-bottom: none; }
.bud-row:hover { background: var(--hover); }
.br-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; }
.br-name { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-fig { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; flex: none; }
.br-fig strong { color: var(--ink); font-weight: 600; }
.br-fig svg { color: #A9A39A; }
.br-track { display: block; width: 100%; height: 6px; border-radius: 99px; background: var(--line-3); overflow: hidden; }
.br-fill { display: block; height: 100%; border-radius: 99px; transform-origin: 0 50%; }
.br-note { font-size: 12px; }
.bud-none { padding: 26px 0; text-align: center; font-size: 14px; color: var(--muted); }

.bh-row {
  display: grid; grid-template-columns: minmax(90px, 120px) minmax(0, 1fr) auto; gap: 14px; align-items: center;
  width: 100%; padding: 12px 0; border: none; border-bottom: 1px solid var(--line-2);
  background: none; text-align: left; font: inherit; color: inherit; transition: background-color .25s;
}
.bh-row:last-child { border-bottom: none; }
.bh-row:hover { background: var(--hover); }
.bh-label { font-size: 14px; font-weight: 500; }
.bh-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.bh-fig { font-size: 13px; font-variant-numeric: tabular-nums; }
.bh-fig strong { font-weight: 600; }
.bh-fig span { color: var(--muted); }
.bh-note { font-size: 12px; }

.bud-edit { gap: 16px; }
.bud-edit-title { font-size: 15px; font-weight: 600; }
.bud-edit-text { font-size: 13px; color: var(--muted); line-height: 1.5; text-wrap: pretty; }
.bud-total-inp { font-size: 15px; height: 44px; font-variant-numeric: tabular-nums; }
.bud-table { display: flex; flex-direction: column; }
.bud-thead, .bud-erow { display: grid; grid-template-columns: minmax(0, 1fr) 130px 36px; gap: 10px; }
.bud-thead { padding-bottom: 6px; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.bud-thead .r { text-align: right; }
.bud-erow { align-items: start; padding: 8px 0; border-top: 1px solid var(--line-2); }
.bud-erow .inp-sm { height: 38px; min-width: 0; }
.bud-erow .inp-sm:focus { box-shadow: var(--ring); }
.bud-name-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bud-hint { font-size: 12px; color: var(--muted-2); }
.bud-hint.accent { color: var(--brand); }
.bud-limit { text-align: right; font-variant-numeric: tabular-nums; }
.bud-x {
  width: 36px; height: 38px; border: none; border-radius: 8px; background: none; padding: 0;
  font-size: 18px; color: var(--muted-2); transition: var(--tx);
}
.bud-x:hover { background: var(--line-3); color: var(--ink); }
.bud-add {
  align-self: flex-start; margin-top: 10px; height: 38px; padding: 0 14px;
  border: 1px dashed var(--field-strong); border-radius: 8px; background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink-3); transition: var(--tx);
}
.bud-add:hover { border-color: var(--brand); color: var(--brand); }
.bud-add:active { transform: scale(.97); }
.bud-draft-note { font-size: 13px; color: var(--muted); min-height: 1px; }
.bud-draft-note.warn { color: var(--amber); }
.bud-draft-note.err { color: var(--red); }
.bud-edit-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.bud-edit-foot .btn-outline { height: 42px; padding: 0 16px; }
.bud-edit-foot .btn-new { height: 42px; }

@media (max-width: 719px) {
  .books-bar { margin: -10px -16px; padding: 10px 16px; gap: 8px; }
  .pal-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .pal-sw { max-width: 36px; }
  .def-toggle { padding: 0 8px; }
}

@media (max-width: 719px) {
  .head-inner { padding: 0 16px; }
  .app-main { padding: 18px 16px 0; }
  .cash-bar { margin: 0 -16px; padding: 14px 16px; }
  .cash-bar .btn-in, .cash-bar .btn-out { max-width: none; }
  .page-title { font-size: 23px; }
  .book-title { font-size: 21px; }
  .drawer { width: 100vw; border-left: none; }
  .pie-wrap { gap: 16px; justify-content: center; }
  .det-grid { grid-template-columns: 104px minmax(0, 1fr); }

  /* ------------------------------------------------------------------
     Book header on a phone.

     The action buttons and the filters each become one line that scrolls
     sideways, bleeding to the screen edges so it reads as a strip rather
     than a wrapped pile. No scrollbar: the partially visible next chip is
     the affordance, which is how CashBook and most phone apps do it.
     ------------------------------------------------------------------ */
  .book-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .book-head-left { gap: 8px; }

  .head-actions,
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    /* Bleed past the 16px page gutter, then pad it back so the first and
       last chips still line up with everything else. */
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    gap: 8px;
  }
  .head-actions::-webkit-scrollbar,
  .filters::-webkit-scrollbar { display: none; }
  .head-actions > *,
  .filters > * { flex: 0 0 auto; }

  /* Filters open as a sheet on phones, so the row needs no stacking context
     of its own and can scroll freely. */
  .filters { position: static; z-index: auto; }

  .btn-outline { height: 36px; }
  .filter-btn { height: 34px; }
  .menu { width: min(290px, calc(100vw - 32px)); }

  /* Four tab labels will not fit across a phone, so they wrap two-by-two
     rather than hiding behind a sideways scroll. */
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tab { flex: 1 1 calc(50% - 4px); }

  .chart-card { padding: 16px 14px; }
  .bar-label { font-size: 10px; }

  .bud-card { padding: 16px 14px; }
  .bud-list { padding: 16px 14px 4px; }
  .bud-thead, .bud-erow { grid-template-columns: minmax(0, 1fr) 104px 32px; gap: 8px; }
  .bud-x { width: 32px; }
  .bud-month { min-width: 128px; }
  .users-search { flex: 1 1 100%; }
  .admin-head .page-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
