/* Baynunah: ivory paper, black ink, champagne gold. Status colours stay semantic. */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f1ede4;
  --ink: #111111;
  --ink-2: #4f4b44;
  --ink-3: #8a857c;
  --line: #e6e0d4;
  --brand: #111111;
  --brand-ink: #ffffff;
  --night: #0b0b0c;
  --gold: #b8955a;
  --gold-2: #e2cc9c;
  --accent: #b8955a;
  --ok: #2f7a3b;
  --ok-bg: #e8f2e6;
  --warn: #a8690a;
  --warn-bg: #fbf0dc;
  --bad: #b3352b;
  --bad-bg: #f9e7e3;
  --mute: #77736b;
  --mute-bg: #efebe3;
  --bar-track: #ece6da;
  --bar-low: #b8955a;
  --bar-mid: #c9821c;
  --bar-high: #b3352b;
  --shadow: 0 1px 2px rgba(17, 17, 17, .04), 0 6px 18px -10px rgba(17, 17, 17, .12);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0f; --surface: #171717; --surface-2: #1f1e1c; --ink: #f2eee6; --ink-2: #c9c3b8;
    --ink-3: #8f897f; --line: #2a2926; --brand: #f2eee6; --brand-ink: #111111; --accent: #d1b27a;
    --gold: #d1b27a; --ok: #6fbf73; --ok-bg: #18291a; --warn: #e7b04e; --warn-bg: #33270f; --bad: #ec7b6e; --bad-bg: #3a1c18;
    --mute: #9a948a; --mute-bg: #23221f; --bar-track: #2a2926; --bar-low: #d1b27a; --bar-mid: #e7a44e;
    --bar-high: #ec7b6e; --shadow: 0 1px 2px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0f; --surface: #171717; --surface-2: #1f1e1c; --ink: #f2eee6; --ink-2: #c9c3b8;
  --ink-3: #8f897f; --line: #2a2926; --brand: #f2eee6; --brand-ink: #111111; --accent: #d1b27a;
  --gold: #d1b27a; --ok: #6fbf73; --ok-bg: #18291a; --warn: #e7b04e; --warn-bg: #33270f; --bad: #ec7b6e; --bad-bg: #3a1c18;
  --mute: #9a948a; --mute-bg: #23221f; --bar-track: #2a2926; --bar-low: #d1b27a; --bar-mid: #e7a44e;
  --bar-high: #ec7b6e; --shadow: 0 1px 2px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.num { font-variant-numeric: tabular-nums; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--night); color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(194, 163, 107, .35);
}
.top .logo { height: 19px; width: auto; display: block; }
.top h1 { font: 500 18px/1.2 "Bodoni Moda", Didot, "Bodoni 72", Georgia, serif; margin: 0; flex: 1; letter-spacing: .1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sep { width: 1px; height: 18px; background: rgba(255, 255, 255, .22); }
.top .back { background: none; border: 0; color: inherit; font-size: 22px; padding: 0 2px 0 0; cursor: pointer; line-height: 1; }
.top .who { font-size: 12px; color: rgba(255, 255, 255, .7); text-align: right; line-height: 1.2; white-space: nowrap; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-2, #e2cc9c); display: inline-block; margin-right: 6px; }
.sync-dot.off { background: #f5a524; }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 24px; }

/* entity switcher */
.chips-wrap { position: relative; margin: 0 -4px 6px; }
.chips {
  position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 12px; scrollbar-width: none;
  scroll-behavior: smooth; scroll-padding: 0 44px; overscroll-behavior-x: contain; cursor: grab;
}
.chips.dragging { cursor: grabbing; scroll-behavior: auto; }
.chips.dragging .chip { pointer-events: none; }
.chips::-webkit-scrollbar { display: none; }
/* edge fades + arrows appear only on the side where more chips are hidden */
.chips-wrap.can-prev .chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px); mask-image: linear-gradient(90deg, transparent 0, #000 56px); }
.chips-wrap.can-next .chips { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent 100%); }
.chips-wrap.can-prev.can-next .chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%); }
.chips-nav {
  position: absolute; top: 9px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; display: none;
  align-items: center; justify-content: center; font-size: 22px; line-height: 1; padding: 0 0 3px; cursor: pointer;
  color: var(--ink); border: 1px solid rgba(184, 149, 90, .45);
  background: rgba(255, 255, 255, .7); -webkit-backdrop-filter: blur(10px) saturate(160%); backdrop-filter: blur(10px) saturate(160%);
  box-shadow: 0 6px 16px -8px rgba(60, 45, 20, .45), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.chips-nav.prev { left: 0; }
.chips-nav.next { right: 0; }
.chips-wrap.can-prev .chips-nav.prev, .chips-wrap.can-next .chips-nav.next { display: flex; }
.chips-nav:hover { background: rgba(255, 255, 255, .92); }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; font-size: 13.5px; cursor: pointer; color: var(--ink-2);
  transition: background .25s, box-shadow .25s, border-color .25s, transform .15s;
}
.chip:hover { border-color: rgba(184, 149, 90, .55); }
.chip:active { transform: scale(.97); }
/* selected entity: frosted gold glass */
.chip.on {
  position: relative; overflow: hidden; color: var(--ink); font-weight: 650;
  background: linear-gradient(135deg, rgba(255, 255, 255, .85) 0%, rgba(240, 223, 186, .55) 55%, rgba(201, 168, 106, .35) 100%);
  -webkit-backdrop-filter: blur(12px) saturate(170%); backdrop-filter: blur(12px) saturate(170%);
  border: 1px solid rgba(184, 149, 90, .7);
  box-shadow: 0 8px 20px -10px rgba(120, 88, 32, .55), 0 0 0 3px rgba(226, 204, 156, .35),
              inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(184, 149, 90, .3);
}
.chip.on::before { /* glossy reflection across the top half */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%; border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0)); pointer-events: none;
}
.chip.on > * { position: relative; }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--line);
}
.card.link { cursor: pointer; }
.card.link:active { transform: scale(.995); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 12.5px; }
.title { font-weight: 650; font-size: 15.5px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-h { font-size: 11px; text-transform: uppercase; letter-spacing: 2.2px; color: var(--gold); margin: 22px 2px 10px; font-weight: 650; }
.serif { font-family: "Bodoni Moda", Didot, "Bodoni 72", "Bodoni MT", Georgia, serif; }
.page-title { font: 500 26px/1.15 "Bodoni Moda", Didot, "Bodoni 72", Georgia, serif; margin: 6px 2px 14px; letter-spacing: -.2px; }
.page-title small { display: block; font: 650 11px/1.4 system-ui, sans-serif; letter-spacing: 2.2px; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }

/* mini Baynunah card used in lists */
.mini-card { flex: none; width: 46px; height: 30px; border-radius: 5px; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 0 0, #2c2c2e, #0a0a0a 70%); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .5); }
.mini-card::after { content: ""; position: absolute; right: 0; bottom: 0; width: 40%; aspect-ratio: 1; background: linear-gradient(135deg, #e2cc9c, #b8955a); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.mini-card b { position: absolute; left: 5px; bottom: 4px; font: 600 7.5px/1 ui-monospace, Consolas, monospace; color: rgba(255, 255, 255, .85); letter-spacing: .5px; }

/* entity logos - always on a white plate so every logo reads in light and dark mode */
.logo-tile { flex: none; width: 80px; height: 46px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; padding: 7px 8px; box-sizing: border-box; overflow: hidden; }
.logo-tile img.elogo { display: block; width: 100%; height: 100%; object-fit: contain; }
.initials { font: 700 12px/1 system-ui, sans-serif; letter-spacing: .6px; color: #122c55; }
.chip { display: inline-flex; align-items: center; }
.chip-logo { height: 18px; width: auto; max-width: 52px; object-fit: contain; margin-right: 7px; background: #fff; border-radius: 4px; padding: 2px 3px; box-sizing: content-box; }
.ent-line { display: flex; align-items: center; margin-bottom: 10px; }
.ent-title { display: flex; align-items: center; min-width: 0; }

/* card detail hero: the black Baynunah card */
.bcard { position: relative; overflow: hidden; border-radius: 16px; padding: 18px 20px; color: #fff; aspect-ratio: 1.586; max-width: 380px; margin: 4px auto 14px;
  background: radial-gradient(120% 90% at 0 0, #2c2c2e 0%, #121213 55%, #060606 100%); border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 24px 40px -22px rgba(0, 0, 0, .7); display: flex; flex-direction: column; justify-content: space-between; }
.bcard::before { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .07) 45%, transparent 60%); }
.bcard::after { content: ""; position: absolute; right: 0; bottom: 0; width: 30%; aspect-ratio: 1; background: linear-gradient(135deg, #e2cc9c, #b8955a); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.bcard > * { position: relative; z-index: 1; }
.bcard .r { display: flex; justify-content: space-between; align-items: flex-start; }
.bcard img { width: 92px; }
.bcard .ent { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 7px; min-height: 56px; }
.bcard .plate { background: #fff; border-radius: 8px; width: 118px; height: 38px; padding: 6px 10px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .6); }
.bcard .plate img.elogo { display: block; width: 100%; height: 100%; object-fit: contain; }
.bcard .r > img { margin-top: 6px; }
.bcard .t { font-size: 9px; letter-spacing: 2.4px; color: #e2cc9c; text-transform: uppercase; font-weight: 600; }
.bcard .chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f0dcae, #b8955a 60%, #e6cf9b); }
.bcard .no { font: 500 15px/1 ui-monospace, Consolas, monospace; letter-spacing: 3px; color: rgba(255, 255, 255, .85); }
.bcard .h small { display: block; font-size: 8px; letter-spacing: 1.6px; color: rgba(255, 255, 255, .45); margin-bottom: 3px; }
.bcard .h b { font-size: 12px; letter-spacing: 1.4px; font-weight: 600; }

/* limit bar */
.limit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; }
.limit-head .avail { font: 600 24px/1.15 "Bodoni Moda", Didot, "Bodoni 72", Georgia, serif; letter-spacing: -.2px; }
.limit-head .avail .ccy { font: 600 11px system-ui, sans-serif; letter-spacing: 1.5px; color: var(--ink-3); margin-right: 4px; vertical-align: 4px; }
.bar { height: 10px; background: var(--bar-track); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--bar-low); transition: width .5s ease; }
.bar.mid > span { background: var(--bar-mid); }
.bar.high > span { background: var(--bar-high); }
.bar.big { height: 14px; }
.legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.legend em, .limit-head .lbl { font-style: normal; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-right: 6px; }
.limit-head .lbl { display: block; margin: 0 0 2px; }
.limit-head .pct { text-align: right; }
.limit-head .pct b { font-size: 22px; font-weight: 500; line-height: 1.1; color: var(--ink); }
.limit-head .pct b i { font-style: normal; font-size: 13px; color: var(--ink-3); margin-left: 1px; }

/* limit utilisation: slim gold bar, threshold notches at 50% / 80%, marker at the current level */
.lbar { --fill: linear-gradient(90deg, #efdfb8, #b8955a); --knob: #b8955a; margin: 14px 0 9px; }
.lbar.mid { --fill: linear-gradient(90deg, #f3d39b, #c9821c); --knob: #c9821c; }
.lbar.high { --fill: linear-gradient(90deg, #eba69c, #b3352b); --knob: #b3352b; }
.lbar-track { position: relative; height: 6px; border-radius: 99px; background: var(--bar-track); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05); }
.lbar.big .lbar-track { height: 8px; }
.lbar-fill { position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 99px; background: var(--fill); }
.lbar .cut { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: var(--surface); z-index: 1; }
.lbar-knob { position: absolute; z-index: 2; top: 50%; left: clamp(6px, var(--p), calc(100% - 6px)); width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: var(--surface); border: 2.5px solid var(--knob); box-shadow: 0 1px 4px rgba(17, 17, 17, .2); }
.lbar.big .lbar-knob { width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; }
@media (prefers-reduced-motion: no-preference) {
  .lbar-fill { animation: lgrow .9s cubic-bezier(.2, .7, .2, 1) both; }
  .lbar-knob { animation: lknob .9s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes lgrow { from { width: 0; } }
  @keyframes lknob { from { left: 6px; opacity: 0; } }
}
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.mute { background: var(--mute-bg); color: var(--mute); }
.tag.info { background: var(--surface-2); color: var(--ink-2); }

.counts { display: flex; gap: 14px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.mute { background: var(--mute); }

/* transaction list */
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: var(--surface-2); border-radius: 10px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: var(--bg); font-weight: 600; }
.txn { display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.txn:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.txn:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: 0; }
.txn:only-child { border-radius: var(--radius); }
.list { box-shadow: var(--shadow); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.txn .stripe { width: 4px; align-self: stretch; border-radius: 4px; background: var(--mute); flex: none; }
.txn.Allocated .stripe { background: var(--ok); }
.txn.Review .stripe { background: var(--warn); }
.txn.Missing .stripe { background: var(--bad); }
.txn .amt { text-align: right; font-weight: 650; white-space: nowrap; }
.txn .amt .fx { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.month-sel { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 10px; }

/* buttons & forms */
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.block { width: 100%; display: block; }
.btn:disabled { opacity: .28; cursor: default; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 18px; height: 18px; }
/* reports */
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 9px 6px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.tg { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--ink-3); }
.tg .dot { opacity: .35; }
.tg.on { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.tg.on .dot { opacity: 1; }
.rep-form .row .in { flex: 1; min-width: 0; }
.rep-head { margin: 22px 2px 12px; }
.print-logo { display: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.kpi b { font-size: 28px; font-weight: 600; line-height: 1.1; }
.kpi .tag { align-self: flex-start; }
.tbl-wrap { overflow-x: auto; padding: 4px 6px; }
table.rep { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rep th { text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rep td { padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rep tr:last-child td { border-bottom: 0; }
table.rep .r { text-align: right; }
table.rep td small { display: block; color: var(--ink-3); font-size: 11px; }

/* Card owners table (Finance) */
table.owners td { vertical-align: top; }
table.owners tr.muted-row td { opacity: .55; }
.own-card { display: flex; align-items: center; gap: 2px; }
.own-card .chip-logo { height: 20px; max-width: 46px; }
table.owners td.own-cell { white-space: normal; width: 52%; }
.owner { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--surface); }
.owner .grow { min-width: 0; }
.owner b { font-size: 13px; }
.owner small { overflow: hidden; text-overflow: ellipsis; }
.owner.off { background: var(--surface-2); }
.owner.off b { color: var(--ink-2); }
.switch { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; color: var(--ok); font-weight: 600; }
.switch input { width: 16px; height: 16px; accent-color: var(--ok); margin: 0; }
.owner.off .switch { color: var(--bad); }
.btn.ic { flex: none; padding: 3px 9px; font-size: 13px; }
.own-warn { font-size: 12px; color: var(--bad); margin: -2px 0 6px; }
.add-own { display: flex; gap: 6px; }
.add-own .in { flex: 1; min-width: 0; padding: 5px 9px; font-size: 12.5px; }
.add-own .btn { flex: none; padding: 5px 12px; font-size: 12.5px; }
@media (max-width: 700px) { /* phone: one stacked block per card instead of columns */
  table.owners, table.owners tbody, table.owners tr, table.owners td { display: block; width: auto; }
  table.owners tr:first-child { display: none; }
  table.owners tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.owners tr:last-child { border-bottom: 0; }
  table.owners td, table.owners td.own-cell { border: 0; padding: 3px 2px; width: auto; }
  table.owners td:nth-child(2) { display: flex; gap: 8px; align-items: baseline; padding-left: 50px; }
}
#profTbl td { white-space: normal; vertical-align: middle; }
#profTbl .in { padding: 8px 9px; min-width: 130px; font-size: 13.5px; }

/* audit log */
.audit { background: var(--surface); padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 3px; }
.audit:last-child { border-bottom: 0; }
.who-chip { font-weight: 600; }
.diff { font-size: 12.5px; background: var(--surface-2); border-radius: 8px; padding: 6px 9px; margin: 3px 0; overflow-wrap: anywhere; }
.diff .k { font-weight: 600; color: var(--ink-2); }
.diff .arr { color: var(--gold); padding: 0 3px; }

@media print {
  body { background: #fff; padding: 0; }
  .top, .nav, .rep-form, .no-print, .page-title + .rep-form, main > .page-title, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .print-logo { display: block; width: 150px; margin-bottom: 10px; }
  .card, .kpi, .list { box-shadow: none; break-inside: avoid; }
  .txn { break-inside: avoid; }
}
.qr-box { display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px auto 8px; width: fit-content; }
.dl-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.dl-btns .btn { padding: 8px 14px; min-width: 64px; }
/* receipt previews */
.thumb { flex: none; width: 46px; height: 58px; border-radius: 6px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb span { display: none; font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--ink-3); }
.thumb.nothumb span { display: block; }
.thumb.thumb-lg { width: 110px; height: 140px; } /* not ".lg": that class is the sign-in page */
.big-prev { display: block; }
.big-prev .preview { max-height: 520px; border: 1px solid var(--line); }
.dups { display: grid; gap: 8px; margin-top: 8px; }
.dup { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); background: var(--surface);
  border-radius: 10px; padding: 6px 8px; }
.file-in { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* in-app camera */
.cam { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: camFlash .25s ease-out forwards; }
@keyframes camFlash { from { opacity: .8; } to { opacity: 0; } }
.cam-frame { position: absolute; inset: 14% 8% 22%; pointer-events: none; }
.cam-frame span { position: absolute; width: 28px; height: 28px; border: 2px solid #e2cc9c; }
.cam-frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.cam-frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; }
.cam-frame span:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; }
.cam-frame span:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.cam-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: linear-gradient(rgba(0, 0, 0, .65), transparent); font-size: 13px; }
.cam-top button, .cam-files { background: rgba(0, 0, 0, .45); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; min-width: 40px; height: 40px; font-size: 17px; cursor: pointer; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.cam-files { font-size: 13px; padding: 0 16px; }
.cam-gap { width: 64px; }
.cam-shot { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; cursor: pointer; }
.cam-shot i { display: block; width: 100%; height: 100%; border-radius: 50%; background: linear-gradient(135deg, #ecd9ac, #b8955a 70%); }
.cam-shot:active i { transform: scale(.92); }
.cam-msg { position: absolute; z-index: 2; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 18px; max-width: 420px; margin: 0 auto; }
.cam-msg p { color: var(--ink-2); font-size: 14px; margin: 6px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1; }
label.f { display: block; font-size: 12.5px; color: var(--ink-3); margin: 10px 0 4px; font-weight: 600; }
.in { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 12px; }
.in:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.in.changed { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
input[type="date"].in { min-width: 0; }

/* bottom nav + capture */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--night); border-top: 1px solid rgba(194, 163, 107, .35);
  display: flex; justify-content: space-around; align-items: center; padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
}
.nav a { flex: 1; text-align: center; text-decoration: none; color: rgba(255, 255, 255, .5); font-size: 11px; letter-spacing: .3px; padding: 4px 0; position: relative; }
.nav a.on { color: #fff; }
.nav a.on::after { content: ""; position: absolute; left: 50%; bottom: -3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--gold-2, #e2cc9c); }
.nav svg { width: 21px; height: 21px; display: block; margin: 0 auto 3px; stroke-width: 1.7; }
.nav .cap {
  flex: none; width: 58px; height: 58px; border-radius: 50%; color: #111; border: 4px solid var(--bg);
  background: linear-gradient(135deg, #ecd9ac, #b8955a 70%); margin-top: -28px; display: grid; place-items: center;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .45); cursor: pointer;
}
.nav .cap svg { width: 26px; height: 26px; margin: 0; }

/* sheets & dialogs */
.scrim { position: fixed; inset: 0; background: rgba(10, 15, 20, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto; animation: up .2s ease;
}
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.pick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 18px 10px; cursor: pointer; font-weight: 600; }
.pick svg { width: 30px; height: 30px; display: block; margin: 0 auto 8px; color: var(--brand); }
.preview { width: 100%; max-height: 260px; object-fit: contain; background: var(--surface-2); border-radius: 12px; display: block; }
.pdf-chip { padding: 26px; text-align: center; background: var(--surface-2); border-radius: 12px; color: var(--ink-2); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { border-radius: 14px; padding: 16px; margin-top: 12px; text-align: center; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.warn { background: var(--warn-bg); color: var(--warn); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.result b { display: block; font-size: 17px; margin-bottom: 2px; }

.banner { border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.banner.info { background: var(--surface-2); color: var(--ink-2); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}
.empty { text-align: center; color: var(--ink-3); padding: 30px 10px; }

/* ------------------------------------------------------------------ login (receipts -> digital wallpaper, black & gold glass card on top) */
body.is-login { padding-bottom: 0; background: #00091a; }
.serif { font-family: "Bodoni Moda", Didot, "Bodoni 72", "Bodoni MT", Georgia, serif; }
.lg {
  --gold: #c2a36b; --gold-2: #e2cc9c; --w-1: rgba(255, 255, 255, .94); --w-2: rgba(255, 255, 255, .72); --w-3: rgba(255, 255, 255, .58); --w-line: rgba(255, 255, 255, .16);
  --glass: linear-gradient(135deg, rgba(34, 34, 36, .58), rgba(8, 8, 9, .70));
  position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh; color: var(--w-1);
  /* phone / tablet: the wallpaper fills the screen, centred on the card and the flying receipts; the sign-in card sits low */
  background: #00091a url("/brand/login-bg.jpg") 74% center / cover no-repeat;
  display: flex;
}
.lg::after { /* darkens the bottom on phones so the card and footer stay readable over the picture */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 9, 26, .55) 75%, rgba(0, 9, 26, .8));
}
.lg-art { display: none; }
.lg-side {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(14px + env(safe-area-inset-bottom));
}

.cc {
  width: min(360px, 100%); aspect-ratio: 1.586; border-radius: 18px; padding: 18px 20px; position: relative; overflow: hidden;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 30px 60px -26px rgba(4, 30, 20, .65), inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .35);
  display: grid; grid-template-rows: auto 1fr auto auto; row-gap: 8px;
}
.cc::before { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255, 255, 255, .10) 0%, transparent 28%, rgba(255, 255, 255, .12) 44%, transparent 60%); pointer-events: none; }
.cc::after { content: ""; position: absolute; right: 0; bottom: 0; width: 30%; aspect-ratio: 1; background: linear-gradient(135deg, var(--gold-2), var(--gold)); clip-path: polygon(100% 0, 100% 100%, 0 100%); opacity: .92; pointer-events: none; }
.cc > * { position: relative; z-index: 1; }
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.cc-top img { width: 96px; height: auto; }
.cc-type { font-size: 9px; letter-spacing: 2.4px; color: var(--gold-2); text-transform: uppercase; font-weight: 600; }
.cc-mid { display: flex; align-items: center; gap: 12px; }
.cc-chip { width: 40px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #f0dcae, #b8955a 60%, #e6cf9b); position: relative; }
.cc-chip::before { content: ""; position: absolute; inset: 6px 9px; border: 1px solid rgba(0, 0, 0, .25); border-radius: 3px; }
.cc-nfc { width: 20px; height: 20px; color: rgba(255, 255, 255, .55); }
.cc-num { font: 500 14px/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 3px; color: rgba(255, 255, 255, .8); }
.cc-sign { /* Microsoft sign-in, on the card */
  justify-self: start; display: inline-flex; align-items: center; gap: 10px; border: 0; border-radius: 4px; cursor: pointer;
  background: #fff; color: #2f2f2f; padding: 10px 16px; font: 600 14px "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .6); transition: transform .15s, box-shadow .15s;
}
.cc-sign svg { width: 18px; height: 18px; }
.cc-sign:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(0, 0, 0, .7); }
.cc-sign:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.cc-sign:disabled { background: rgba(255, 255, 255, .14); color: var(--w-2); cursor: not-allowed; box-shadow: none; transform: none; }

/* the same dark glass as the card, for the title, the help line and the test sign-in */
.lg-note {
  width: min(360px, 100%); border-radius: 14px; padding: 12px 16px 10px; text-align: center;
  background: var(--glass); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.cc-title { font-size: 22px; line-height: 1.1; font-weight: 500; margin: 0; color: #fff; letter-spacing: .3px; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.lg-note:not(:has(.lg-fine, .lg-test, .lg-err:not(:empty))) { display: none; }
.lg-fine { font-size: 12px; color: var(--w-2); margin: 0; line-height: 1.5; }
.lg-fine + .lg-test { margin-top: 8px; }
.lg-test { margin-top: 0; }
.lg-fine.warn { color: var(--gold-2); }
.lg-test { margin-top: 8px; font-size: 12.5px; color: var(--w-3); text-align: left; }
.lg-test summary { cursor: pointer; text-align: center; }
.lg-test .in { background: rgba(255, 255, 255, .08); border-color: var(--w-line); color: #fff; margin-top: 10px; }
.lg-test .btn { background: transparent; border: 1px solid var(--gold); color: var(--gold-2); border-radius: 4px; }
.lg-err { color: #ffb4a6; font-size: 13px; margin-top: 4px; min-height: 0; }
.lg-err:empty { display: none; }
.lg-foot { text-align: center; font-size: 10.5px; color: rgba(255, 255, 255, .62); letter-spacing: .3px; line-height: 1.6; }
.lg-foot b { color: rgba(255, 255, 255, .9); font-weight: 650; }
.lg-foot i { color: var(--gold); font-style: normal; padding: 0 6px; }

@media (min-width: 700px) {
  .cc, .lg-note { width: 400px; }
  .cc { padding: 22px 24px; }
  .cc-top img { width: 110px; }
  .cc-sign { font-size: 15px; padding: 12px 20px; }
  .cc-title { font-size: 25px; }
}
/* wide screens: the whole picture fills the screen; the card sits in its empty dark left side */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .lg { background-position: right center; }
  .lg::after { background: linear-gradient(90deg, rgba(0, 9, 26, .35), transparent 45%); }
  .lg-side { flex: none; width: 46%; justify-content: center; gap: 14px; padding-left: 4vw; }
  .lg-foot { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .cc { animation: ccIn .8s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes ccIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
}


.conf-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
.conf-row .theirs { color: var(--warn); font-weight: 600; }
.who-bar { font-size: 12.5px; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); margin-bottom: 10px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.simple td, table.simple th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.hide { display: none !important; }

/* glass chips in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.on { color: #fff; background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(209, 178, 122, .22) 60%, rgba(209, 178, 122, .1)); border-color: rgba(209, 178, 122, .6); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .8), 0 0 0 3px rgba(209, 178, 122, .18), inset 0 1px 0 rgba(255, 255, 255, .25); }
  :root:not([data-theme="light"]) .chip.on::before { background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
  :root:not([data-theme="light"]) .chips-nav { color: #fff; background: rgba(30, 30, 30, .7); }
}
:root[data-theme="dark"] .chip.on { color: #fff; background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(209, 178, 122, .22) 60%, rgba(209, 178, 122, .1)); border-color: rgba(209, 178, 122, .6); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .8), 0 0 0 3px rgba(209, 178, 122, .18), inset 0 1px 0 rgba(255, 255, 255, .25); }
:root[data-theme="dark"] .chip.on::before { background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0)); }
:root[data-theme="dark"] .chips-nav { color: #fff; background: rgba(30, 30, 30, .7); }

/* ================================================================
   Glass effect - one recipe for every selectable item
   selected = full gold glass · hover/focus = light glass · cards & rows = soft lift
   (box-shadow insets are used as borders so nothing changes size)
   ================================================================ */
:root {
  --glass-gloss: linear-gradient(180deg, rgba(255, 255, 255, .7) 0%, rgba(255, 255, 255, .16) 46%, rgba(255, 255, 255, 0) 58%);
  --glass-tint: linear-gradient(135deg, rgba(255, 255, 255, .88) 0%, rgba(240, 223, 186, .6) 55%, rgba(201, 168, 106, .4) 100%);
  --glass-tint-hover: linear-gradient(135deg, rgba(255, 255, 255, .92) 0%, rgba(246, 236, 214, .7) 100%);
  --glass-tint-soft: linear-gradient(135deg, rgba(255, 255, 255, .99) 0%, rgba(249, 242, 228, .95) 100%);
  --glass-edge: rgba(184, 149, 90, .7);
  --glass-edge-hover: rgba(184, 149, 90, .45);
  --glass-glow: 0 8px 20px -10px rgba(120, 88, 32, .55), 0 0 0 3px rgba(226, 204, 156, .32);
  --glass-lift: 0 6px 14px -9px rgba(120, 88, 32, .5);
  --glass-ink: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-gloss: linear-gradient(180deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .05) 46%, rgba(255, 255, 255, 0) 58%);
    --glass-tint: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(209, 178, 122, .24) 60%, rgba(209, 178, 122, .1));
    --glass-tint-hover: linear-gradient(135deg, rgba(255, 255, 255, .1), rgba(209, 178, 122, .12));
    --glass-tint-soft: linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(209, 178, 122, .07));
    --glass-edge: rgba(209, 178, 122, .6); --glass-edge-hover: rgba(209, 178, 122, .4);
    --glass-glow: 0 8px 20px -10px rgba(0, 0, 0, .8), 0 0 0 3px rgba(209, 178, 122, .18);
    --glass-lift: 0 6px 14px -9px rgba(0, 0, 0, .8); --glass-ink: #fff;
  }
}
:root[data-theme="dark"] {
  --glass-gloss: linear-gradient(180deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, .05) 46%, rgba(255, 255, 255, 0) 58%);
  --glass-tint: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(209, 178, 122, .24) 60%, rgba(209, 178, 122, .1));
  --glass-tint-hover: linear-gradient(135deg, rgba(255, 255, 255, .1), rgba(209, 178, 122, .12));
  --glass-tint-soft: linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(209, 178, 122, .07));
  --glass-edge: rgba(209, 178, 122, .6); --glass-edge-hover: rgba(209, 178, 122, .4);
  --glass-glow: 0 8px 20px -10px rgba(0, 0, 0, .8), 0 0 0 3px rgba(209, 178, 122, .18);
  --glass-lift: 0 6px 14px -9px rgba(0, 0, 0, .8); --glass-ink: #fff;
}

.tabs button, .seg button, .tg, .chip, .btn, .month-sel, .txn, .card.link, .owner, .nav a, .pick button {
  transition: background .22s ease, box-shadow .22s ease, color .22s ease, transform .15s ease;
}

/* selected: full gold glass (tabs, segment toggles, report filters - like the entity chips) */
.tabs button.on, .seg button.on, .tg.on {
  color: var(--glass-ink); font-weight: 650;
  background: var(--glass-gloss), var(--glass-tint);
  -webkit-backdrop-filter: blur(12px) saturate(170%); backdrop-filter: blur(12px) saturate(170%);
  box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 rgba(255, 255, 255, .9), var(--glass-glow);
}
.chip.on { color: var(--glass-ink); }

/* hover / keyboard focus: light glass (only where a real pointer can hover) */
@media (hover: hover) {
  .tabs button:not(.on):hover, .seg button:not(.on):hover, .tg:not(.on):hover, .chip:not(.on):hover,
  .btn:not(.primary):not(.danger):not(.ok):not(:disabled):hover, .month-sel:hover, .pick button:hover {
    color: var(--glass-ink);
    background: var(--glass-gloss), var(--glass-tint-hover);
    -webkit-backdrop-filter: blur(10px) saturate(160%); backdrop-filter: blur(10px) saturate(160%);
    box-shadow: inset 0 0 0 1px var(--glass-edge-hover), inset 0 1px 0 rgba(255, 255, 255, .85), var(--glass-lift);
  }
  /* dark primary buttons: a dark glass shine with a gold edge */
  .btn.primary:not(:disabled):hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, .24) 0%, rgba(255, 255, 255, .05) 48%, rgba(255, 255, 255, 0) 58%), var(--brand);
    box-shadow: inset 0 0 0 1px rgba(226, 204, 156, .6), 0 8px 18px -8px rgba(0, 0, 0, .45);
  }
  .btn.danger:not(:disabled):hover, .btn.ok:not(:disabled):hover {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .45) 0%, rgba(255, 255, 255, .08) 48%, rgba(255, 255, 255, 0) 58%);
    box-shadow: inset 0 0 0 1px currentColor, var(--glass-lift);
  }
  /* cards and list rows: soft glass lift */
  .card.link:hover, .owner:hover {
    background: var(--glass-tint-soft);
    box-shadow: inset 0 0 0 1px var(--glass-edge-hover), 0 14px 28px -16px rgba(120, 88, 32, .45);
    transform: translateY(-1px);
  }
  .txn:hover { background: var(--glass-tint-soft); box-shadow: inset 0 0 0 1px var(--glass-edge-hover); }
  .nav a:not(.on):hover { color: rgba(255, 255, 255, .85); background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .02)); }
}
.tabs button:focus-visible, .seg button:focus-visible, .tg:focus-visible, .chip:focus-visible, .btn:focus-visible {
  outline: none; box-shadow: inset 0 0 0 1px var(--glass-edge), 0 0 0 3px rgba(226, 204, 156, .55);
}

/* bottom menu (dark bar): the open page sits in a dark glass pill */
.nav a { border-radius: 12px; margin: 0 4px; padding: 5px 0 4px; }
.nav a.on {
  background: linear-gradient(180deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .03) 55%), rgba(226, 204, 156, .1);
  box-shadow: inset 0 0 0 1px rgba(226, 204, 156, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* ------------------------------------------------------------------ the name at the top: a button with a menu */
.top .who { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; color: rgba(255, 255, 255, .85);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; padding: 6px 10px 6px 12px;
  cursor: pointer; max-width: 46vw; transition: background .15s, border-color .15s; }
.top .who:hover, .top .who[aria-expanded="true"] { background: rgba(255, 255, 255, .14); border-color: rgba(226, 204, 156, .55); }
.top .who:focus-visible { outline: 2px solid var(--gold-2, #e2cc9c); outline-offset: 2px; }
.top .who .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who .sync-dot { margin-right: 0; flex: none; }
.who-caret { font-size: 10px; opacity: .8; }
.user-menu { position: fixed; z-index: 60; top: calc(54px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px));
  width: min(290px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .35); padding: 6px; display: flex; flex-direction: column; }
.user-menu .um-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--line, #e6e1d6); margin-bottom: 4px; overflow-wrap: anywhere; }
.user-menu .um-role { margin-top: 6px; align-self: flex-start; }
.user-menu a, .user-menu .um-out { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none;
  font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.user-menu a svg { width: 18px; height: 18px; opacity: .75; }
.user-menu a:hover, .user-menu a:focus-visible, .user-menu .um-out:hover, .user-menu .um-out:focus-visible { background: var(--glass-hover, rgba(194, 163, 107, .14)); outline: none; }
.user-menu .um-out { color: var(--bad, #b3261e); border-top: 1px solid var(--line, #e6e1d6); margin-top: 4px; border-radius: 0 0 10px 10px; }

/* ------------------------------------------------------------------ background pattern (light + dark)
   The Baynunah logo's right-angle triangle as a quiet repeating motif with fine diagonal lines,
   plus a soft gold glow; cards stay solid on top so reading is never affected. */
:root {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='%23a8843f'%3E%3Cpath d='M30 6v12H18z' fill-opacity='.13'/%3E%3Cpath d='M66 42v12H54z' fill-opacity='.10'/%3E%3C/g%3E%3Cpath d='M0 72L72 0' stroke='%23a8843f' stroke-opacity='.07' stroke-width='1'/%3E%3Ccircle cx='54' cy='18' r='1.4' fill='%23a8843f' fill-opacity='.18'/%3E%3Ccircle cx='18' cy='54' r='1.4' fill='%23a8843f' fill-opacity='.18'/%3E%3C/svg%3E");
  --pattern-glow: radial-gradient(1100px 520px at 100% -8%, rgba(194, 163, 107, .16), transparent 62%),
                  radial-gradient(900px 480px at -10% 105%, rgba(194, 163, 107, .10), transparent 60%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='%23d6b46e'%3E%3Cpath d='M30 6v12H18z' fill-opacity='.12'/%3E%3Cpath d='M66 42v12H54z' fill-opacity='.08'/%3E%3C/g%3E%3Cpath d='M0 72L72 0' stroke='%23d6b46e' stroke-opacity='.07' stroke-width='1'/%3E%3Ccircle cx='54' cy='18' r='1.4' fill='%23d6b46e' fill-opacity='.20'/%3E%3Ccircle cx='18' cy='54' r='1.4' fill='%23d6b46e' fill-opacity='.20'/%3E%3C/svg%3E");
    --pattern-glow: radial-gradient(1100px 520px at 100% -8%, rgba(209, 178, 122, .14), transparent 62%),
                    radial-gradient(900px 480px at -10% 105%, rgba(209, 178, 122, .08), transparent 60%);
  }
}
:root[data-theme="dark"] {
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='%23d6b46e'%3E%3Cpath d='M30 6v12H18z' fill-opacity='.12'/%3E%3Cpath d='M66 42v12H54z' fill-opacity='.08'/%3E%3C/g%3E%3Cpath d='M0 72L72 0' stroke='%23d6b46e' stroke-opacity='.07' stroke-width='1'/%3E%3Ccircle cx='54' cy='18' r='1.4' fill='%23d6b46e' fill-opacity='.20'/%3E%3Ccircle cx='18' cy='54' r='1.4' fill='%23d6b46e' fill-opacity='.20'/%3E%3C/svg%3E");
  --pattern-glow: radial-gradient(1100px 520px at 100% -8%, rgba(209, 178, 122, .14), transparent 62%),
                  radial-gradient(900px 480px at -10% 105%, rgba(209, 178, 122, .08), transparent 60%);
}
body:not(.is-login) {
  background-color: var(--bg);
  background-image: var(--pattern-glow), var(--pattern);
  background-attachment: fixed, fixed;
}
/* the black header and menu bar carry the same motif, very faint */
.top, .nav {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cpath d='M30 6v12H18z' fill='%23e2cc9c' fill-opacity='.07'/%3E%3Cpath d='M0 72L72 0' stroke='%23e2cc9c' stroke-opacity='.05'/%3E%3C/svg%3E");
}
@media print { body:not(.is-login) { background-image: none; } }

/* ------------------------------------------------------------------ Finance page: collapsed list, one part open at a time */
.fin-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.fin-sec { display: block; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.fin-sec > summary, a.fin-link { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none;
  color: inherit; text-decoration: none; user-select: none; }
.fin-sec > summary::-webkit-details-marker { display: none; }
.fin-t { font-weight: 650; font-size: 15px; flex: 1; min-width: 0; }
.fin-n { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 55%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fin-c { flex: none; color: var(--ink-3); font-size: 20px; line-height: 1; transition: transform .18s; }
.fin-sec[open] > summary .fin-c { transform: rotate(90deg); }
.fin-sec[open] > summary { border-bottom: 1px solid var(--line); }
.fin-sec > summary:hover, a.fin-link:hover { background: color-mix(in srgb, var(--surface) 92%, var(--ink)); }
.fin-sec > summary:focus-visible, a.fin-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fin-b { padding: 12px 12px 4px; }
.fin-b > .card:last-child, .fin-b > .btn-row:last-child { margin-bottom: 8px; }
