/* =====================================================================
   MURBS Member Portal - design system
   Colours from the MURBS logo:
     hands teal-green #57a583 · roof sky-blue #75c5e2 · coin gold #e2cc75 / #bc9625 · lettering slate
   Mobile first, no framework: the whole portal is this file + murbs.js (small, cached 30 days).
   ===================================================================== */
:root {
    --ink: #1d5c43;            /* deep MURBS green (the hands in the logo): sidebar, banner, headings */
    --ink-2: #123d2c;
    --text: #1d2b2f;
    --muted: #5f6f73;
    --line: #e3ebe8;
    --surface: #f3f7f6;
    --card: #ffffff;

    /* gold, from the coin in the logo, leads; the text-on-white shades keep >= 5:1 contrast */
    --accent: #8a6a12;           /* gold text, icons and borders on white */
    --accent-2: #6b520c;
    --accent-logo: #e2cc75;
    --accent-soft: #fbf3d9;
    --accent-btn: linear-gradient(135deg, #ecd27a 0%, #d4a935 55%, #bc9625 100%);   /* gold buttons carry ink text */
    --accent-btn-hover: linear-gradient(135deg, #e3c45f 0%, #c99a2a 55%, #a9851d 100%);
    --green: #237a5b;            /* the logo's hands: kept for one chart colour */
    --sky: #75c5e2;
    --blue: #1d6f96;
    --blue-soft: #e6f3f9;
    --gold: #e2cc75;
    --gold-2: #bc9625;
    --gold-ink: #7d6210;
    --gold-soft: #fbf5e0;
    --gold-bar: linear-gradient(100deg, #c99a2e 0%, #dbb146 22%, #e9cb72 48%, #dcb34a 72%, #e5c466 88%, #c99a2e 100%);   /* metallic gold top bar (even, no washed-out shine) */
    --on-gold: #123d2c;        /* deep MURBS green text on gold: high contrast, matches the sidebar */
    --on-gold-2: #26493a;      /* secondary text on gold (solid, never faded) */
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --warn: #b7791f;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(18, 61, 44, .05), 0 4px 16px rgba(18, 61, 44, .06);
    --shadow-lg: 0 10px 30px rgba(18, 61, 44, .14);
    --sidebar: 264px;
    --sidebar-mini: 76px;
    --topbar: 60px;
    --bottomnav: 64px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--surface); }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
p { margin: 0 0 .75rem; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(117, 197, 226, .8); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 24px; height: 24px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0 !important; }

/* ---------------- buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 10px 20px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none !important;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent-btn); color: var(--ink); box-shadow: 0 4px 14px rgba(188, 150, 37, .35); }
.btn-primary:hover { background: var(--accent-btn-hover); color: var(--ink); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #d9bf5e; color: var(--ink); }
.btn-outline { background: #fff; color: var(--ink); border-color: #cfdcd8; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-block { width: 100%; }
.btn.is-busy { pointer-events: none; opacity: .85; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; box-shadow: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- form fields (floating labels, no JS) ---------------- */
.field { position: relative; margin-bottom: 16px; }
.field-input {
    width: 100%; height: 56px; padding: 22px 48px 6px 16px; font-size: 16px;   /* 16px: no zoom on focus in mobile browsers */
    border: 1.5px solid #cfdcd8; border-radius: 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201, 154, 46, .2); }
.field-label {
    position: absolute; left: 17px; top: 17px; font-size: 15px; color: var(--muted); pointer-events: none;
    transition: top .15s, font-size .15s, color .15s;
}
.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label { top: 7px; font-size: 12px; font-weight: 600; color: var(--accent); }
.field-input.is-invalid { border-color: var(--danger); animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.field-btn {
    position: absolute; right: 6px; top: 8px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--muted);
    display: flex; align-items: center; justify-content: center; border-radius: 10px; cursor: pointer;
}
.field-btn:hover { color: var(--accent); background: var(--accent-soft); }
.field-hint { font-size: 12.5px; color: var(--muted); margin: -8px 2px 14px; }

.select-wrap { position: relative; }
.select {
    width: 100%; height: 52px; padding: 0 44px 0 16px; font-size: 16px; border: 1.5px solid #cfdcd8; border-radius: 12px;
    background: #fff; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px rgba(201, 154, 46, .2); }
.select-wrap .ico { position: absolute; right: 14px; top: 16px; color: var(--muted); pointer-events: none; }
/* searchable dropdown (murbs.js searchableSelect): replaces every <select> */
.sel { position: relative; }
.sel-native { position: absolute !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sel-btn {
    width: 100%; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 16px; font-size: 16px; text-align: left;
    border: 1.5px solid #cfdcd8; border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.sel-btn:hover { border-color: #b9c9c4; }
.sel.open .sel-btn, .sel-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201, 154, 46, .2); outline: none; }
.sel-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn.is-placeholder .sel-text { color: var(--muted); }
.sel-caret { color: var(--muted); transition: transform .15s; }
.sel.open .sel-caret { transform: rotate(180deg); }
.sel-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 35; background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .15s; }
.sel-search { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.sel-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); }
.sel-list { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto; }
.sel-list li { padding: 11px 12px; border-radius: 10px; cursor: pointer; font-size: .95rem; }
.sel-list li:hover, .sel-list li.active { background: var(--accent-soft); }
.sel-list li[aria-selected="true"] { font-weight: 700; color: var(--accent-2); }
.sel-empty { padding: 14px; text-align: center; color: var(--muted); font-size: .9rem; }

.label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink); margin-bottom: 6px; }

/* password strength (rules mirror the server: 6-20 chars, upper, lower, digit) */
.pwd-rules { list-style: none; padding: 0; margin: -6px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.pwd-rules li { display: flex; align-items: center; gap: 6px; }
.pwd-rules li::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #c3cfcb; flex: 0 0 auto; transition: all .15s; }
.pwd-rules li.ok { color: var(--accent); font-weight: 600; }
.pwd-rules li.ok::before { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/9px no-repeat; }
.pwd-match { font-size: 12.5px; font-weight: 600; margin: -8px 2px 14px; min-height: 18px; }
.pwd-match.ok { color: var(--accent); }
.pwd-match.bad { color: var(--danger); }

/* ---------------- notices ---------------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: .9rem; margin-bottom: 16px; }
.notice .ico { margin-top: 1px; }
.notice-error { background: var(--danger-soft); color: #8e2a20; }
.notice-ok { background: var(--accent-soft); color: var(--accent-2); }
.notice-info { background: var(--blue-soft); color: #165a7a; }
.notice:empty, .notice.is-empty { display: none; }

/* =====================================================================
   AUTH PAGES (Site.Master): sign in, set password
   ===================================================================== */
body.auth { min-height: 100vh; background: var(--surface); }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* the picture from Business Central (Member Portal Setup), served by LoginImage.ashx; dark ink shows while it loads */
.auth-photo { display: none; position: relative; height: 38vh; min-height: 220px; max-height: 340px; background: var(--ink) center / cover no-repeat; }
.auth-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 40, 29, 0) 55%, rgba(12, 40, 29, .35) 100%); }

.auth-side { flex: 1; display: flex; flex-direction: column; }
.auth-main { flex: 1; display: flex; justify-content: center; padding: 28px 16px 24px; position: relative; z-index: 1; }
.has-photo .auth-photo { display: block; }
.has-photo .auth-main { margin-top: -56px; padding-top: 0; }   /* card overlaps the picture on phones */
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 22px 22px 20px; }
.auth-head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.auth-head img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; padding: 0; background: #fff; border: 3px solid var(--gold); box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 16px rgba(188, 150, 37, .25); flex: 0 0 auto; }
.auth-head b { display: block; color: var(--ink); font-size: 1.2rem; letter-spacing: .2px; }
.auth-head small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.auth-card h2 { font-size: 1.45rem; font-weight: 800; }
.auth-card .lead { color: var(--muted); font-size: .92rem; margin: 4px 0 20px; }

/* fields with a leading icon */
.has-ico .field-input { padding-left: 46px; }
.has-ico .field-label { left: 47px; }
.field-ico { position: absolute; left: 15px; top: 18px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; transition: color .15s; }
.field-input:focus ~ .field-ico { color: var(--accent); }

.auth-row { display: flex; justify-content: flex-end; margin: -6px 0 16px; }
.auth-link { font-weight: 600; font-size: .9rem; color: var(--accent); padding: 4px 2px; }
.auth-links { display: flex; justify-content: center; margin-top: 16px; }
.auth-links a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--accent); padding: 8px; }   /* icon beside the text */
.auth-help { display: grid; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.auth-help span { display: flex; align-items: center; gap: 8px; }
.auth-help .ico { color: var(--accent); }
/* one-time code (VerifyOtp.aspx) */
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 4px 0 12px; }
.otp-boxes input { width: 100%; min-width: 0; height: 58px; text-align: center; font-size: 26px; font-weight: 800; color: var(--ink);
    border: 1.5px solid #d6dcd9; border-radius: 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.otp-boxes input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(201, 154, 46, .2); }
.otp-boxes input:disabled { background: #f1f3f2; color: #9aa5a2; }
.otp-timer { text-align: center; font-size: .88rem; color: var(--muted); margin-bottom: 16px; min-height: 20px; }
.otp-timer.warn { color: var(--warn); font-weight: 600; }
.otp-timer.bad { color: var(--danger); font-weight: 600; }
.otp-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.otp-links .auth-link { display: inline-flex; align-items: center; gap: 4px; }
.auth-link.disabled { color: #a8b0ad; pointer-events: none; cursor: default; }.auth-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 16px 20px; }
.auth-foot a { color: var(--ink); font-weight: 600; }

/* Error.aspx */
.auth-logo { width: 104px; height: 104px; margin: 0 auto 14px; border-radius: 50%; background: #fff; padding: 0; border: 3px solid var(--gold); overflow: hidden; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }

@media (min-width: 992px) {
    .auth-shell { flex-direction: row; }
    .auth-photo { flex: 0 0 56%; height: auto; min-height: 100vh; max-height: none; position: sticky; top: 0; }
    .auth-photo::after { background: linear-gradient(90deg, rgba(12, 40, 29, 0) 80%, rgba(12, 40, 29, .18) 100%); }
    .auth-main, .has-photo .auth-main { margin-top: 0; align-items: center; padding: 40px; }
    .auth-card { padding: 32px 36px 28px; box-shadow: var(--shadow); max-width: 440px; }
}

/* =====================================================================
   PORTAL SHELL (pages/Main.Master)
   ===================================================================== */
.topbar {
    position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: 12px;
    padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--gold-bar); color: var(--on-gold); box-shadow: 0 2px 10px rgba(169, 123, 23, .3);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--on-gold); text-decoration: none !important; min-width: 0; }
.topbar-brand img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #fff; padding: 0; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(46, 35, 6, .25); }
.topbar-brand b { font-size: 1.05rem; letter-spacing: .6px; }
.topbar-title { flex: 1; min-width: 0; font-size: 1rem; font-weight: 700; color: var(--on-gold); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar .page-sub { display: none; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--ink); font-weight: 700; font-size: .9rem; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.6rem; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--on-gold); padding: 4px; border-radius: 30px; cursor: pointer; }
.user-btn:hover { background: rgba(255, 255, 255, .3); }
.user-btn .who { display: none; text-align: left; line-height: 1.2; }
.user-btn .who b { display: block; font-size: .9rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { color: var(--on-gold-2); font-size: .78rem; font-weight: 600; }

/* account menu: dropdown on desktop, bottom sheet on phones */
.menu-backdrop { position: fixed; inset: 0; background: rgba(12, 40, 29, .45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: #fff; border-radius: 22px 22px 0 0; padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
.menu::before { content: ''; display: block; width: 42px; height: 4px; border-radius: 4px; background: #d5dedb; margin: 2px auto 12px; }
.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
.menu-open .menu { transform: none; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 6px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; color: var(--ink); }
.menu-head small { color: var(--muted); }
.menu a, .menu .menu-item {
    display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px; color: var(--text); font-weight: 500; text-decoration: none !important;
}
.menu a:hover { background: var(--surface); }
.menu .ico { color: var(--accent); }
.menu .danger, .menu .danger .ico { color: var(--danger); }

.sidebar { display: none; }
.nav-toggle { display: none; }   /* phones use the bottom navigation */

/* breadcrumbs: Home › Statements › Member Statement */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0 0 14px; padding: 0; font-size: .82rem; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; gap: 5px; }
.crumbs li + li::before { content: ''; width: 6px; height: 6px; margin: 0 8px 0 4px; border-top: 1.5px solid #a3ada9; border-right: 1.5px solid #a3ada9; transform: rotate(45deg); }
.crumbs a { color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.crumbs .ico { width: 15px; height: 15px; }
.main { padding: 16px 16px calc(var(--bottomnav) + 24px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto;
    display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar)); min-height: calc(100dvh - var(--topbar)); }
.main > .wrap { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }
.page-head { display: none; }

.bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottomnav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(18, 61, 44, .06);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none !important; position: relative;
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
@media (max-width: 419.98px) { .bottomnav a { font-size: 10.5px; } }
@media (max-width: 359.98px) { .bottomnav a { font-size: 9.5px; } }
.bottomnav a .pill { display: flex; align-items: center; justify-content: center; width: 52px; height: 30px; border-radius: 16px; transition: background .2s; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active .pill { background: var(--accent-soft); }

.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 22px 8px 4px; margin-top: auto; }   /* pushed to the very bottom */
.footer a { color: var(--ink); font-weight: 600; }

@media (min-width: 992px) {
    .topbar { background: var(--gold-bar);
        background-attachment: fixed; color: var(--on-gold); border-bottom: 1px solid rgba(169, 123, 23, .55); box-shadow: 0 2px 12px rgba(169, 123, 23, .28); height: 68px; padding: 0 32px; margin-left: var(--sidebar); }
    .topbar-brand { display: none; }
    .topbar-title { color: var(--on-gold); font-size: 1.25rem; font-weight: 800; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
    .topbar .page-sub { display: block; color: var(--on-gold-2); font-weight: 600; text-shadow: 0 1px 0 rgba(255, 255, 255, .3); font-size: .82rem; }
    .user-btn { color: var(--on-gold); padding: 4px 12px 4px 4px; border: 1px solid rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .5); }
    .user-btn:hover { background: rgba(255, 255, 255, .85); border-color: #fff; }
    .user-btn .who { display: block; }
    .user-btn .who small { color: var(--on-gold-2); }

    .menu { position: fixed; left: auto; right: 32px; bottom: auto; top: 62px; width: 280px; border-radius: 16px; padding: 8px;
        transform: translateY(-6px); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
    .menu::before { display: none; }
    .menu-open .menu { opacity: 1; pointer-events: auto; transform: none; }
    .menu-backdrop { background: transparent; }

    .sidebar {
        display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 50; color: #fff; border-right: 1px solid rgba(226, 204, 117, .45);
        background:
            radial-gradient(120% 50% at 0% 100%, rgba(226, 204, 117, .22) 0%, rgba(87, 165, 131, 0) 60%),
            linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
    }
    .side-brand { display: flex; align-items: center; gap: 10px; height: 68px; flex: 0 0 auto; padding: 0 16px; color: #fff; text-decoration: none !important;
        background: var(--ink); border-bottom: 1px solid rgba(255, 255, 255, .1); }   /* same height as the top bar */
    .side-brand img { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: #fff; padding: 0; border: 2px solid var(--gold); }
    .side-brand b { display: block; font-size: 1.1rem; letter-spacing: .8px; line-height: 1.15; }
    .side-brand small { display: block; color: rgba(255, 255, 255, .7); font-size: .7rem; line-height: 1.25; font-weight: 600; }
    .side-nav { flex: 1; padding: 16px 12px 8px; overflow-y: auto; }
    .side-label { color: rgba(255, 255, 255, .45); font-size: .7rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 18px 12px 8px; }
    .side-nav a, .side-nav .side-link {
        display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin-bottom: 2px; border-radius: 12px;
        color: rgba(255, 255, 255, .82); font-weight: 500; text-decoration: none !important; transition: background .15s, color .15s;
    }
    .side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
    .side-nav a.active { background: rgba(226, 204, 117, .16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
    .side-nav a.active .ico { color: var(--gold); }
    .side-card { margin: 12px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); font-size: .8rem; color: rgba(255, 255, 255, .75); }
    .side-card b { color: #fff; display: block; font-size: .85rem; margin-bottom: 2px; }

    .main { margin-left: var(--sidebar); padding: 28px 32px 20px; max-width: none; min-height: calc(100vh - 68px); }

    /* ---- collapsible sidebar: full (264px) or an icon rail (76px) with hover labels ---- */
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto; margin-right: 4px;
        border: 1px solid rgba(255, 255, 255, .75); border-radius: 12px; background: rgba(255, 255, 255, .5); color: var(--on-gold); cursor: pointer; transition: background .15s, border-color .15s; }
    .nav-toggle:hover { background: rgba(255, 255, 255, .85); border-color: #fff; }
    .nav-toggle .ico { transition: transform .2s; }
    .nav-mini .nav-toggle .ico { transform: scaleX(-1); }
    .nav-anim .sidebar { transition: width .2s ease; }
    .nav-anim .topbar, .nav-anim .main { transition: margin-left .2s ease; }
    .nav-mini .sidebar { width: var(--sidebar-mini); }
    .nav-mini .topbar, .nav-mini .main { margin-left: var(--sidebar-mini); }
    .nav-mini .side-brand { justify-content: center; padding: 0 8px; }
    .nav-mini .side-brand img { width: 44px; height: 44px; }
    .nav-mini .side-brand span, .nav-mini .side-nav .lbl, .nav-mini .side-card { display: none; }
    .nav-mini .side-label { font-size: 0; padding: 0; height: 1px; margin: 12px 10px; background: rgba(255, 255, 255, .12); }
    .nav-mini .side-nav { padding: 8px 12px; overflow: visible; }
    .nav-mini .side-nav a { justify-content: center; padding: 12px; position: relative; }
    .nav-mini .side-nav a::after {
        content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%);
        background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .8rem; font-weight: 600; white-space: nowrap;
        box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 70;
    }
    .nav-mini .side-nav a:hover::after, .nav-mini .side-nav a:focus-visible::after { opacity: 1; }
    .main > .wrap { width: 100%; }   /* the dashboard uses the full width beside the sidebar */
    .bottomnav { display: none; }
}

/* top progress bar (link navigation) and blocking overlay (postbacks) */
#navProgress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--gold), var(--sky)); box-shadow: 0 0 8px rgba(226, 204, 117, .7); opacity: 0; transition: width .4s ease, opacity .3s; }
#navProgress.run { opacity: 1; width: 75%; transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity .2s; }
#busy { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(243, 247, 246, .72); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
#busy.on { display: flex; }
.busy-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 30px; max-width: 80vw; text-align: center; }
.busy-ring { width: 46px; height: 46px; position: relative; }
.busy-ring::before, .busy-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; }
.busy-ring::before { border-top-color: var(--green); border-right-color: var(--green); animation: spin .9s linear infinite; }
.busy-ring::after { inset: 8px; border-bottom-color: var(--gold-2); border-left-color: var(--gold-2); animation: spin 1.2s linear infinite reverse; }
.busy-text { font-weight: 700; color: var(--ink); text-shadow: 0 1px 2px rgba(255, 255, 255, .8); }
/* ".", "..", "..." in turn; fixed width so the words never shift */
.busy-dots { display: inline-block; width: 1.2em; text-align: left; }
.busy-dots::after { content: '...'; animation: busyDots 1.2s steps(1, end) infinite; }
@keyframes busyDots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .busy-dots::after { animation: none !important; content: '...'; } }

/* dialog (replaces browser alert()) */
.dlg-wrap { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(12, 40, 29, .5); animation: fade .15s; }
.dlg { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 26px 22px 20px; text-align: center; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2, .8, .2, 1.2); }
.dlg-ico { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.dlg-ico .ico { width: 30px; height: 30px; stroke-width: 2.4; }
.dlg-success .dlg-ico { background: var(--accent-soft); color: var(--accent); }
.dlg-error .dlg-ico { background: var(--danger-soft); color: var(--danger); }
.dlg-warning .dlg-ico { background: var(--gold-soft); color: var(--gold-ink); }
.dlg-info .dlg-ico { background: var(--blue-soft); color: var(--blue); }
.dlg h3 { font-size: 1.15rem; margin-bottom: 6px; }
.dlg p { color: var(--muted); font-size: .93rem; margin-bottom: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

/* =====================================================================
   CONTENT BUILDING BLOCKS
   ===================================================================== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card-body { padding: 18px; }
.chip-ico { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.grid { display: grid; gap: 16px; }
.section-title { font-size: .78rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin: 22px 2px 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-ok { background: var(--accent-soft); color: var(--accent-2); }
.badge-muted { background: #eef2f1; color: var(--muted); }
.badge-warn { background: var(--gold-soft); color: var(--gold-ink); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .chip-ico { width: 56px; height: 56px; border-radius: 18px; margin-bottom: 12px; }
.empty .chip-ico .ico { width: 26px; height: 26px; }
.empty b { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }

/* ---------- dashboard ---------- */
.hero {
    position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: 16px 16px 12px; margin-bottom: 14px;
    background:
        radial-gradient(100% 120% at 100% 0%, rgba(117, 197, 226, .38) 0%, rgba(117, 197, 226, 0) 55%),
        radial-gradient(90% 90% at 0% 100%, rgba(226, 204, 117, .32) 0%, rgba(226, 204, 117, 0) 65%),
        linear-gradient(140deg, var(--ink-2) 0%, var(--ink) 55%, #2b7656 100%);
    box-shadow: 0 10px 26px rgba(18, 61, 44, .22);
}
.hero::after { content: ''; position: absolute; width: 180px; height: 180px; right: -64px; top: -84px; border-radius: 50%; border: 22px solid rgba(226, 204, 117, .13); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hero-top > div { min-width: 0; }
.hero-hello { font-size: 1rem; font-weight: 600; color: rgba(255, 255, 255, .9); line-height: 1.3; }
.hero-hello b { color: #fff; }
/* one line: "No. 2862 • Maseno University" (a long sponsor name ends in ...) */
.hero-meta { display: flex; color: rgba(255, 255, 255, .7); font-size: .78rem; margin-top: 1px; white-space: nowrap; min-width: 0; }
.hero-meta span { overflow: hidden; text-overflow: ellipsis; }
.hero-meta span:first-child { flex: 0 0 auto; }
.hero-meta span + span::before { content: "\2022"; margin: 0 7px; opacity: .55; }
.hero-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); color: #fff; white-space: nowrap; }
.hero-status i { width: 7px; height: 7px; border-radius: 50%; background: #7ee2b0; box-shadow: 0 0 0 3px rgba(126, 226, 176, .22); }
.hero-label { margin-top: 12px; display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .72); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.eye-btn { background: rgba(255, 255, 255, .12); border: 0; color: #fff; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.eye-btn .ico { width: 14px; height: 14px; }
.eye-btn:hover { background: rgba(255, 255, 255, .22); }
.hero-amount { display: flex; align-items: baseline; flex-wrap: wrap; font-size: clamp(1.75rem, 8.2vw, 2.15rem); font-weight: 800; letter-spacing: -.5px; line-height: 1.1; margin-top: 2px; }
.hero-amount small { font-size: .85rem; font-weight: 700; color: var(--gold); margin-right: 7px; letter-spacing: .06em; }
/* interest and last contribution share one row */
.hero-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: .74rem; }
.hero-sub:empty { display: none; }
.hero-interest { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 3px; border-radius: 999px; white-space: nowrap;
    color: rgba(255, 255, 255, .85); background: rgba(226, 204, 117, .14); border: 1px solid rgba(226, 204, 117, .32); }
.hero-interest b { color: var(--gold); }
.hero-interest-ico { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: var(--ink-2); }
.hero-interest-ico .ico { width: 11px; height: 11px; }
.hero-last { display: inline-flex; align-items: center; gap: 5px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.hero-last .ico { width: 13px; height: 13px; }
.hero-last b { color: #fff; font-weight: 600; }
.masked .money { filter: blur(9px); user-select: none; }
.money { transition: filter .2s; }
/* phones: the shortcuts sit in a slim dock along the bottom of the card */
.hero-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin-top: 12px; padding: 8px 2px 7px; border-radius: 14px;
    background: rgba(0, 0, 0, .16); border: 1px solid rgba(255, 255, 255, .08); }
.qa { display: flex; flex-direction: column; align-items: center; gap: 4px; color: rgba(255, 255, 255, .92); font-size: .68rem; font-weight: 600; text-align: center; text-decoration: none !important; line-height: 1.2; min-width: 0; }
.qa .qa-ico { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #f4e3a1;
    background: linear-gradient(135deg, rgba(226, 204, 117, .26), rgba(226, 204, 117, .1)); border: 1px solid rgba(226, 204, 117, .3); transition: background .15s, transform .15s, color .15s; }
.qa .qa-ico .ico { width: 18px; height: 18px; }
.qa:hover .qa-ico, .qa:active .qa-ico { background: var(--gold); color: var(--ink); transform: translateY(-2px); }
.mix-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: #edf2f1; gap: 2px; }
.mix-bar span { display: block; height: 100%; width: 0; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.mix-legend { display: grid; gap: 2px; margin-top: 14px; }
.mix-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.mix-row:last-child { border-bottom: 0; }
.mix-row .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.mix-row .lbl { flex: 1; min-width: 0; }
.mix-row .pct { color: var(--muted); font-size: .8rem; min-width: 42px; text-align: right; }
.mix-row .amt { font-weight: 700; color: var(--ink); text-align: right; }
.c-ee { background: var(--green); }
.c-er { background: var(--blue); }
.c-avc { background: var(--gold-2); }

.stats { display: grid; gap: 10px; }
.stat { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .chip-ico { width: 44px; height: 44px; border-radius: 13px; }
.stat-txt { flex: 1; min-width: 0; }
.stat-lbl { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat-sub { font-size: .72rem; color: var(--muted); opacity: .85; }
.stat-val { font-weight: 800; color: var(--ink); font-size: 1.05rem; text-align: right; }
.stat-val small { font-weight: 600; font-size: .72rem; color: var(--muted); margin-right: 3px; }
.tone-teal .chip-ico { background: var(--accent-soft); color: var(--accent); }
.tone-blue .chip-ico { background: var(--blue-soft); color: var(--blue); }
.tone-gold .chip-ico { background: var(--gold-soft); color: var(--gold-ink); }
.tone-rose .chip-ico { background: #fcebee; color: #b23a55; }
.tone-ink .chip-ico { background: #e7eef0; color: var(--ink); }

.kv { display: grid; grid-template-columns: 1fr; margin: 0; }
.kv > div { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-size: .78rem; color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; color: var(--ink); word-break: break-word; }
.kv .chip-ico { width: 38px; height: 38px; }

.profile-hero { display: flex; align-items: center; gap: 16px; }
.profile-hero h2 { font-size: 1.2rem; }
.profile-hero .muted { font-size: .88rem; }

.ben-list { list-style: none; margin: 0; padding: 0; }
.ben { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ben:last-child { border-bottom: 0; }
.ben .avatar { background: var(--accent-soft); color: var(--accent); }
.ben-main { flex: 1; min-width: 0; }
.ben-name { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ben-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.ben-pct { text-align: right; min-width: 64px; }
.ben-pct b { display: block; font-size: 1.05rem; color: var(--ink); }
.ben-bar { height: 5px; border-radius: 3px; background: #edf2f1; margin-top: 5px; overflow: hidden; }
.ben-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.alloc { display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--accent) calc(var(--p) * 1%), #e6eeec 0); }
.ring::before { content: attr(data-label); width: 58px; height: 58px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--ink); font-size: .9rem; }
.ring.warn { background: conic-gradient(var(--danger) calc(var(--p) * 1%), #e6eeec 0); }

/* ---------- statements ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #e6eeec; padding: 4px; border-radius: 14px; margin-bottom: 16px; }
.seg a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: .85rem; text-align: center; text-decoration: none !important; }
.seg a small { font-weight: 500; font-size: .7rem; opacity: .85; }
.seg a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(18, 61, 44, .12); }
.stmt-form { display: grid; gap: 14px; }
.stmt-ready { display: flex; flex-direction: column; gap: 14px; }
.stmt-file { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.stmt-file .chip-ico { width: 48px; height: 52px; border-radius: 10px; background: #fdecea; color: var(--danger); }
.stmt-file b { display: block; color: var(--ink); }
.stmt-file small { color: var(--muted); }
.stmt-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stmt-actions .btn-share { grid-column: 1 / -1; }
.pdf-preview { display: block; width: 100%; min-width: 0; min-height: 340px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; scroll-margin-top: calc(var(--topbar) + 12px);
    background: #fafbfb url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='90' viewBox='0 0 240 90'><g transform='translate(120 26)'><circle r='18' fill='none' stroke='%23e6eeec' stroke-width='4'/><path d='M0-18a18 18 0 0 1 18 18' fill='none' stroke='%23237a5b' stroke-width='4' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='0' to='360' dur='.9s' repeatCount='indefinite'/></path><path d='M0 12a12 12 0 0 1-12-12' fill='none' stroke='%23bc9625' stroke-width='3' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='360' to='0' dur='1.2s' repeatCount='indefinite'/></path></g><text x='120' y='78' text-anchor='middle' font-family='Segoe UI,Roboto,Arial,sans-serif' font-size='14' font-weight='600' fill='%231d5c43'>Preparing your statement…</text></svg>") center 120px / 240px 90px no-repeat; }   /* shows while Business Central renders; the PDF covers it */
/* desktop: the browser's own PDF viewer (zoom, print) */
.pdf-preview iframe { display: block; width: 100%; height: 78vh; min-height: 520px; border: 0; background: transparent; }
/* phones (Android Chrome cannot show a PDF inside a page): every page drawn by PDF.js, pinch to zoom */
.pdf-preview.pages { background-color: #e9eeec; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.pdf-preview.pages.done { background-image: none; min-height: 0; }
.pdf-preview canvas { display: block; width: 100%; max-width: 100%; min-width: 0; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 1px 6px rgba(18, 61, 44, .18); }
/* the statement preview on the Statements page, zoomable on phones (murbs.js inlineZoom): sideways scrolling inside the frame,
   up / down is the page's own scrolling; two fingers are left to the zoom */
.pdf-frame { width: 100%; min-width: 0; overflow-x: auto; overflow-y: hidden; border-radius: 14px; touch-action: pan-x pan-y; overscroll-behavior-x: contain; }
.pdf-frame .pdf-preview { max-width: none; }
.pdf-zoombar { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); }
.pdf-zoombar span { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; }
.pdf-zoombar b { min-width: 44px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums; }
.pdf-zoombar button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #cfdcd8; background: #fff; color: var(--ink); font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer; }
.pdf-zoombar button:active { background: var(--accent-soft); }
.pdf-zoombar:has(+ .pdf-frame .pdf-msg) { display: none; }   /* nothing to zoom when the statement could not be prepared */
.pdf-msg { padding: 36px 18px; text-align: center; color: var(--muted); background: #fff; border-radius: 10px; }
.pdf-msg b { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- downloads ---------- */
.doc-search { position: relative; margin-bottom: 16px; }
.doc-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.doc-search input { width: 100%; min-height: 48px; padding: 10px 14px 10px 40px; border: 1px solid #cfdcd8; border-radius: 12px; background: #fff; }
.doc-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(188, 150, 37, .18); }
.doc-count { font-size: .8rem; font-weight: 700; background: var(--surface); border-radius: 10px; padding: 2px 9px; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc[hidden], .doc-group[hidden] { display: none; }
.doc-badge { flex: 0 0 auto; width: 44px; height: 50px; border-radius: 9px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px;
    font-size: .64rem; font-weight: 800; letter-spacing: .03em; color: #fff; background: #7b8a8e; position: relative; overflow: hidden; }
.doc-badge::before { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 13px 13px 0; border-color: transparent var(--card) rgba(0, 0, 0, .18) transparent; }
.doc-pdf { background: #d14b3d; }
.doc-word { background: #2f6db5; }
.doc-sheet { background: #237a5b; }
.doc-image { background: #bc9625; }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; line-height: 1.3; }
.doc-meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.doc-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.doc-actions .btn { min-height: 42px; padding: 8px 12px; font-size: .88rem; }
.doc-actions .btn span { display: none; }   /* phones: icon buttons */
.doc-none { padding-top: 24px; }

/* ---------- larger screens ---------- */
@media (min-width: 600px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .kv { grid-template-columns: 1fr 1fr; column-gap: 28px; }
    .kv > div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
    .stmt-form { grid-template-columns: 1fr auto; align-items: end; }
    .stmt-actions { grid-template-columns: auto auto auto; justify-content: start; }
    .stmt-actions .btn-share { grid-column: auto; }
    .doc-actions .btn span { display: inline; }
}
@media (min-width: 992px) {
    body { font-size: 15.5px; }
    .hero { padding: 20px 26px; display: grid; grid-template-columns: 1fr auto; column-gap: 32px; align-items: center; }
    .hero-amount { font-size: 2.4rem; }
    .hero-sub { font-size: .8rem; }
    .hero-actions { grid-column: 2; grid-row: 1; grid-template-columns: repeat(4, 84px); gap: 6px; margin-top: 0; padding: 12px 8px; border-radius: 18px; }
    .hero-actions .qa { font-size: .76rem; gap: 6px; }
    .hero-actions .qa-ico { width: 44px; height: 44px; border-radius: 14px; }
    .hero-actions .qa-ico .ico { width: 20px; height: 20px; }
    .dash-cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
    .stats { grid-template-columns: repeat(3, 1fr); }
    .stat { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; }
    .stat-val { text-align: left; font-size: 1.3rem; }
}
@media (max-width: 359.98px) {
    .main { padding-left: 12px; padding-right: 12px; }
    .hero-amount { font-size: 1.6rem; }
    .qa .qa-ico { width: 34px; height: 34px; }
    .qa { font-size: .64rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
    .sidebar, .topbar, .bottomnav, .hero-actions, .footer, .eye-btn { display: none !important; }
    .main { margin: 0; padding: 0; }
    .card, .stat { box-shadow: none; border: 1px solid #ddd; }
}
.topbar .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9); }   /* gold avatar stays distinct on the gold bar */

/* ---------- in-app viewer (documents and statements open over the page, same tab) ---------- */
html.viewer-on, html.viewer-on body { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: #e9eeec; animation: viewer-in .18s ease-out; }
@keyframes viewer-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.viewer-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top));
    min-height: var(--topbar); background: var(--gold-bar); color: var(--on-gold); box-shadow: 0 2px 10px rgba(18, 61, 44, .18); }
.viewer-back { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .35); color: var(--on-gold);
    display: flex; align-items: center; justify-content: center; cursor: pointer; }
.viewer-back:hover { background: rgba(255, 255, 255, .55); }
.viewer-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-dl { min-height: 42px; padding: 8px 14px; background: var(--ink); color: #fff; box-shadow: none; }
.viewer-dl:hover { background: var(--ink-2); color: #fff; }
.viewer-dl span { display: none; }
/* touch-action: one finger scrolls, two fingers are left to the viewer's own zoom (murbs.js zoomable), also in a WebView */
.viewer-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom);
    touch-action: pan-x pan-y; overscroll-behavior: contain; }
.viewer-body .pdf-preview { border: 0; border-radius: 0; min-height: 100%; background-color: transparent;
    background-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='90' viewBox='0 0 240 90'><g transform='translate(120 26)'><circle r='18' fill='none' stroke='%23e6eeec' stroke-width='4'/><path d='M0-18a18 18 0 0 1 18 18' fill='none' stroke='%23237a5b' stroke-width='4' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='0' to='360' dur='.9s' repeatCount='indefinite'/></path><path d='M0 12a12 12 0 0 1-12-12' fill='none' stroke='%23bc9625' stroke-width='3' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='360' to='0' dur='1.2s' repeatCount='indefinite'/></path></g><text x='120' y='78' text-anchor='middle' font-family='Segoe UI,Roboto,Arial,sans-serif' font-size='14' font-weight='600' fill='%231d5c43'>Opening…</text></svg>"); }
.viewer-body .pdf-preview.done { background-image: none; }
.viewer-body .pdf-preview iframe { height: 100%; min-height: 0; position: absolute; inset: 0; }
.viewer-body .pdf-preview:has(iframe) { position: relative; height: 100%; }
.viewer-body .pdf-msg { margin: 16px; }
.viewer-imgwrap { width: 100%; padding: 12px; }
.viewer-img { display: block; width: 100%; height: auto; }
.viewer-body.zoomed .pdf-preview.pages { min-height: 0; }
/* zoom buttons, bottom right over the document */
.viewer-zoom { position: absolute; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.viewer-zoom[hidden] { display: none; }
.viewer-zoom button { width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
    background: var(--ink); color: #fff; font-size: 24px; font-weight: 700; line-height: 1; box-shadow: 0 4px 14px rgba(18, 61, 44, .35); opacity: .92; }
.viewer-zoom button:active { transform: scale(.94); }
.viewer-body.is-image:not(.done) { background: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='90' viewBox='0 0 240 90'><g transform='translate(120 26)'><circle r='18' fill='none' stroke='%23e6eeec' stroke-width='4'/><path d='M0-18a18 18 0 0 1 18 18' fill='none' stroke='%23237a5b' stroke-width='4' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='0' to='360' dur='.9s' repeatCount='indefinite'/></path><path d='M0 12a12 12 0 0 1-12-12' fill='none' stroke='%23bc9625' stroke-width='3' stroke-linecap='round'><animateTransform attributeName='transform' type='rotate' from='360' to='0' dur='1.2s' repeatCount='indefinite'/></path></g><text x='120' y='78' text-anchor='middle' font-family='Segoe UI,Roboto,Arial,sans-serif' font-size='14' font-weight='600' fill='%231d5c43'>Opening…</text></svg>") center 120px / 240px 90px no-repeat; }
@media (min-width: 600px) { .viewer-dl span { display: inline; } }