/* ---------------------------------------------------------------------------
   Pay ConnectX portal theme.

   Two brand colours carry the identity, and nothing else is allowed to:
     Orange  CMYK 2, 71, 100, 0   #F06D1B
     Blue    CMYK 67, 33, 8, 0    #5892C0

   The platform admin panel keeps the near black chrome it was built with. The
   four member panels the client redesigned are light - white cards on a soft
   tint - and each one wears one brand colour as its chrome and the other as its
   primary action, exactly as the supplied mock ups do:

     data-portal   panel                        chrome       action
     admin         platform admin               near black   orange
     rt            retailer                     white        orange
     dt            distributor                  orange       blue
     md, sd        master / super distributor   blue         orange

   Every component below reads from the tokens, so a panel is one block of
   variables rather than a second stylesheet. data-portal and data-bs-theme are
   both written onto the html element by _Layout.cshtml from the signed in
   member's hierarchy level.
   --------------------------------------------------------------------------- */
:root {
    /* Brand */
    --px-orange: #f06d1b;
    --px-orange-dark: #ce570d;
    --px-orange-light: #f9a369;
    --px-blue: #5892c0;
    --px-blue-dark: #35668d;
    --px-blue-deep: #2b5a7d;
    --px-blue-light: #8fb8d8;

    /* Semantic, kept outside the brand so meaning stays readable on any chrome.
       The -ink pair is the same meaning at text weight, darkened for white cards. */
    --px-success: #2ecc71;
    --px-danger: #ff5a4d;
    --px-warning: #f7b32b;
    --px-success-ink: var(--px-success);
    --px-danger-ink: var(--px-danger);
    --px-warning-ink: var(--px-warning);
    --px-navy-ink: var(--px-blue-light);

    --px-radius: 12px;
    --px-sidebar-width: 260px;
    --px-header-height: 64px;

    /* ---- Admin, the default: near black page and cards ---- */
    --px-accent: var(--px-orange);
    --px-accent-dark: var(--px-orange-dark);
    --px-accent-soft: rgba(240, 109, 27, .16);
    --px-accent-on: #fff;
    --px-accent-quiet: var(--px-orange-light);

    --px-bg: #050607;
    --px-surface: #0c0f14;
    --px-surface-2: #12161d;
    --px-surface-3: #1a2029;
    --px-border: #1e2733;
    --px-border-soft: #161d26;

    --px-text: #e6eaf0;
    --px-muted: #8a94a6;
    --px-heading: #ffffff;
    --px-link: var(--px-blue-light);
    --px-link-hover: var(--px-orange-light);

    /* Sidebar - pure black to match the baked-in background of logo-bg-black.jpg (no box) */
    --px-sidebar: #000000;
    --px-sidebar-border: var(--px-border);
    --px-brand-filter: none;
    --px-nav-text: rgba(255, 255, 255, .82);
    --px-nav-section: var(--px-muted);
    --px-nav-icon: var(--px-orange);
    --px-nav-hover-bg: rgba(88, 146, 192, .16);
    --px-nav-hover-text: #fff;
    --px-nav-active-bg: var(--px-blue);
    --px-nav-active-text: #fff;
    --px-nav-active-border: var(--px-blue);
    --px-nav-sub-bg: rgba(255, 255, 255, .04);
    --px-nav-sub-text: rgba(255, 255, 255, .7);
    --px-nav-sub-active-bg: rgba(88, 146, 192, .28);
    --px-nav-meta: rgba(255, 255, 255, .5);

    /* Header */
    --px-header-bg: var(--px-surface);
    --px-header-border: var(--px-border);
    --px-header-text: var(--px-text);
    --px-header-muted: var(--px-muted);
    --px-header-input-bg: var(--px-surface-2);
    --px-header-input-border: var(--px-border);
    --px-header-hover-bg: var(--px-surface-2);
    --px-header-focus-ring: rgba(240, 109, 27, .2);
    --px-chip-bg: rgba(240, 109, 27, .14);
    --px-chip-text: var(--px-orange-light);

    /* Data */
    --px-thead-bg: var(--px-blue);
    --px-thead-text: #fff;
    --px-row-hover: rgba(88, 146, 192, .10);
    --px-grid: rgba(255, 255, 255, .07);
    --px-tooltip-bg: #12161d;

    /* Depth */
    --px-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
    --px-shadow-lg: 0 6px 18px rgba(0, 0, 0, .5);
    --px-wallet-bg:
        radial-gradient(circle at 85% 10%, rgba(240, 109, 27, .20) 0%, transparent 60%),
        linear-gradient(135deg, #0e1a26 0%, #0a1119 100%);
    --px-wallet-text: #fff;
    --px-wallet-rule: rgba(255, 255, 255, .12);
    --px-seat-off-bg: #10151c;
    --px-seat-off-text: #4c5768;
}

/* Bootstrap's dark scheme, retuned to the admin panel the client supplied. */
[data-bs-theme="dark"] {
    --bs-body-bg: #050607;
    --bs-body-color: #e6eaf0;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: rgba(230, 234, 240, .7);
    --bs-tertiary-color: rgba(230, 234, 240, .5);
    --bs-border-color: #1e2733;
    --bs-border-color-translucent: rgba(255, 255, 255, .1);

    --bs-primary: #f06d1b;
    --bs-primary-rgb: 240, 109, 27;
    --bs-link-color: #8fb8d8;
    --bs-link-color-rgb: 143, 184, 216;
    --bs-link-hover-color: #f9a369;
    --bs-link-hover-color-rgb: 249, 163, 105;

    --bs-card-bg: #0c0f14;
    --bs-card-cap-bg: #0c0f14;
    --bs-secondary-bg: #12161d;
    --bs-tertiary-bg: #0c0f14;
}

/* ---------------------------------------------------------------------------
   The member panels
   ---------------------------------------------------------------------------
   Everything the four of them share: a light page, white cards, cool grey
   rules, ink type. Only the chrome and the action colour differ after this,
   and each panel sets those two things and nothing more.
   --------------------------------------------------------------------------- */
[data-portal="rt"],
[data-portal="dt"],
[data-portal="md"],
[data-portal="sd"] {
    --px-surface: #ffffff;
    --px-surface-2: #f2f6fa;
    --px-surface-3: #e4ecf4;
    --px-border: #dae3ed;
    --px-border-soft: #e9eff5;

    --px-text: #1d2b3a;
    --px-muted: #64748b;
    --px-heading: #12202e;
    --px-link: var(--px-blue-dark);
    --px-link-hover: var(--px-orange-dark);

    --px-nav-text: rgba(255, 255, 255, .92);
    --px-nav-section: rgba(255, 255, 255, .62);
    --px-nav-icon: #fff;
    --px-nav-hover-bg: rgba(255, 255, 255, .16);
    --px-nav-hover-text: #fff;
    --px-nav-active-bg: rgba(255, 255, 255, .95);
    --px-nav-active-text: var(--px-sidebar);
    --px-nav-sub-bg: rgba(0, 0, 0, .12);
    --px-nav-sub-text: rgba(255, 255, 255, .82);
    --px-nav-sub-active-bg: rgba(255, 255, 255, .22);
    --px-nav-meta: rgba(255, 255, 255, .72);
    --px-sidebar-border: rgba(255, 255, 255, .18);
    --px-brand-filter: brightness(0) invert(1);

    --px-header-text: #fff;
    --px-header-muted: rgba(255, 255, 255, .78);
    --px-header-input-bg: rgba(255, 255, 255, .18);
    --px-header-input-border: rgba(255, 255, 255, .28);
    --px-header-hover-bg: rgba(255, 255, 255, .16);
    --px-header-focus-ring: rgba(255, 255, 255, .3);
    --px-chip-bg: rgba(255, 255, 255, .2);
    --px-chip-text: #fff;

    --px-thead-bg: var(--px-blue-dark);
    --px-thead-text: #fff;
    --px-row-hover: rgba(88, 146, 192, .09);
    --px-grid: rgba(29, 43, 58, .10);
    --px-tooltip-bg: #1d2b3a;

    --px-shadow-sm: 0 1px 2px rgba(29, 43, 58, .06);
    --px-shadow-lg: 0 10px 24px rgba(29, 43, 58, .16);
    --px-seat-off-bg: #e6ecf2;
    --px-seat-off-text: #9aa8b8;

    --px-success-ink: #17663a;
    --px-danger-ink: #b03227;
    --px-warning-ink: #8a5d0c;
    --px-navy-ink: var(--px-blue-deep);
}

/* Retailer - the counter panel. White chrome, colour logo, orange action,
   blue for the things that are only navigation. */
[data-portal="rt"] {
    --px-bg: #f4f7fa;
    --px-accent: var(--px-orange);
    --px-accent-dark: var(--px-orange-dark);
    --px-accent-soft: rgba(240, 109, 27, .12);
    --px-accent-quiet: var(--px-orange-dark);
    /* Bootstrap builds .bg-primary and .text-bg-primary from the rgb triple, not the colour. */
    --bs-primary-rgb: 240, 109, 27;
    --bs-link-color-rgb: 53, 102, 141;

    --px-sidebar: #ffffff;
    --px-sidebar-border: var(--px-border);
    --px-brand-filter: none;
    --px-nav-text: #46586c;
    --px-nav-section: #8a97a6;
    --px-nav-icon: var(--px-orange);
    --px-nav-hover-bg: rgba(88, 146, 192, .12);
    --px-nav-hover-text: var(--px-blue-deep);
    --px-nav-active-bg: var(--px-blue-dark);
    --px-nav-active-text: #fff;
    --px-nav-active-border: var(--px-orange);
    --px-nav-sub-bg: #f2f6fa;
    --px-nav-sub-text: #5b6b7d;
    --px-nav-sub-active-bg: rgba(88, 146, 192, .18);
    --px-nav-meta: #7c8a99;

    --px-header-bg: #ffffff;
    --px-header-border: var(--px-border);
    --px-header-text: var(--px-text);
    --px-header-muted: var(--px-muted);
    --px-header-input-bg: #f2f6fa;
    --px-header-input-border: var(--px-border);
    --px-header-hover-bg: #eef3f8;
    --px-header-focus-ring: rgba(240, 109, 27, .22);
    --px-chip-bg: rgba(240, 109, 27, .12);
    --px-chip-text: var(--px-orange-dark);

    --px-wallet-bg: linear-gradient(135deg, var(--px-blue-dark) 0%, var(--px-blue-deep) 100%);
}

/* Distributor - orange chrome, blue action. */
[data-portal="dt"] {
    --px-bg: #fdf4ed;
    --px-accent: var(--px-blue-dark);
    --px-accent-dark: var(--px-blue-deep);
    --px-accent-soft: rgba(53, 102, 141, .12);
    --px-accent-quiet: var(--px-blue-dark);
    --bs-primary-rgb: 53, 102, 141;
    --bs-link-color-rgb: 53, 102, 141;

    /* exact baked-in background of logo-bg-orange.jpg (#ef6d22) so the logo blends with no box */
    --px-sidebar: #ef6d22;
    --px-header-bg: #ef6d22;
    --px-header-border: rgba(0, 0, 0, .12);
    --px-nav-active-text: var(--px-orange-dark);
    --px-nav-active-border: #fff;

    --px-wallet-bg: linear-gradient(135deg, var(--px-orange) 0%, var(--px-orange-dark) 100%);
}

/* Master distributor and super distributor - blue chrome, orange action. The
   two levels share one panel, as the client's mock up does. */
[data-portal="md"],
[data-portal="sd"] {
    --px-bg: #eff4f9;
    --px-accent: var(--px-orange);
    --px-accent-dark: var(--px-orange-dark);
    --px-accent-soft: rgba(240, 109, 27, .12);
    --px-accent-quiet: var(--px-orange-dark);
    --bs-primary-rgb: 240, 109, 27;
    --bs-link-color-rgb: 53, 102, 141;

    /* exact baked-in background of logo-bg-blue.jpg (#5693c2) so the logo blends with no box */
    --px-sidebar: #5693c2;
    --px-header-bg: #5693c2;
    --px-header-border: rgba(0, 0, 0, .14);
    --px-nav-active-text: var(--px-blue-deep);
    --px-nav-active-border: var(--px-orange);

    --px-thead-bg: var(--px-blue-deep);
    --px-wallet-bg: linear-gradient(135deg, var(--px-blue-dark) 0%, var(--px-blue-deep) 100%);
}

/* Super distributor sits one step above, so its chrome is one step deeper. */
[data-portal="sd"] {
    --px-sidebar: var(--px-blue-deep);
    --px-header-bg: var(--px-blue-deep);
}

/* Bootstrap's light scheme, retuned to the member panels. */
[data-bs-theme="light"] {
    --bs-body-bg: var(--px-bg);
    --bs-body-color: var(--px-text);
    --bs-emphasis-color: var(--px-heading);
    --bs-secondary-color: var(--px-muted);
    --bs-border-color: var(--px-border);
    --bs-border-color-translucent: rgba(29, 43, 58, .12);

    --bs-primary: var(--px-accent);
    --bs-link-color: var(--px-link);
    --bs-link-hover-color: var(--px-link-hover);

    --bs-card-bg: var(--px-surface);
    --bs-card-cap-bg: var(--px-surface);
    --bs-secondary-bg: var(--px-surface-2);
    --bs-tertiary-bg: var(--px-surface-2);
}

body {
    background: var(--px-bg);
    color: var(--px-text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
}

/* ---------- Bootstrap components on brand ---------- */
.btn-primary {
    --bs-btn-bg: var(--px-accent);
    --bs-btn-border-color: var(--px-accent);
    --bs-btn-color: var(--px-accent-on);
    --bs-btn-hover-bg: var(--px-accent-dark);
    --bs-btn-hover-border-color: var(--px-accent-dark);
    --bs-btn-hover-color: var(--px-accent-on);
    --bs-btn-active-bg: var(--px-accent-dark);
    --bs-btn-active-border-color: var(--px-accent-dark);
    --bs-btn-disabled-bg: var(--px-accent);
    --bs-btn-disabled-border-color: var(--px-accent);
}

/* The colour the panel does not use for its action still has a job: the second
   button on a screen is the other brand colour, never a grey. */
.btn-secondary {
    --bs-btn-bg: var(--px-blue-dark);
    --bs-btn-border-color: var(--px-blue-dark);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--px-blue-deep);
    --bs-btn-hover-border-color: var(--px-blue-deep);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--px-blue-deep);
    --bs-btn-active-border-color: var(--px-blue-deep);
}
[data-portal="dt"] .btn-secondary {
    --bs-btn-bg: var(--px-orange);
    --bs-btn-border-color: var(--px-orange);
    --bs-btn-hover-bg: var(--px-orange-dark);
    --bs-btn-hover-border-color: var(--px-orange-dark);
    --bs-btn-active-bg: var(--px-orange-dark);
    --bs-btn-active-border-color: var(--px-orange-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--px-accent-quiet);
    --bs-btn-border-color: var(--px-accent);
    --bs-btn-hover-bg: var(--px-accent);
    --bs-btn-hover-border-color: var(--px-accent);
    --bs-btn-hover-color: var(--px-accent-on);
    --bs-btn-active-bg: var(--px-accent-dark);
    --bs-btn-active-border-color: var(--px-accent-dark);
}

/* Hover only deepens the surface, so the label has to stay ink on a light panel
   and light on the black one - the same token the button starts from. */
.btn-outline-secondary {
    --bs-btn-color: var(--px-text);
    --bs-btn-border-color: var(--px-border);
    --bs-btn-hover-bg: var(--px-surface-2);
    --bs-btn-hover-border-color: var(--px-blue-dark);
    --bs-btn-hover-color: var(--px-heading);
    --bs-btn-active-bg: var(--px-surface-2);
    --bs-btn-active-border-color: var(--px-blue-dark);
    --bs-btn-active-color: var(--px-heading);
}

.btn-light {
    --bs-btn-bg: var(--px-surface-2);
    --bs-btn-border-color: var(--px-border);
    --bs-btn-color: var(--px-text);
    --bs-btn-hover-bg: var(--px-surface-3);
    --bs-btn-hover-border-color: var(--px-border);
    --bs-btn-hover-color: var(--px-heading);
    --bs-btn-active-bg: var(--px-surface-3);
    --bs-btn-active-border-color: var(--px-border);
    --bs-btn-active-color: var(--px-heading);
}

.form-control, .form-select {
    background-color: var(--px-surface-2);
    border-color: var(--px-border);
    color: var(--px-text);
}
.form-control::placeholder { color: rgba(138, 148, 166, .8); }
.form-control:focus, .form-select:focus {
    background-color: var(--px-surface-2);
    border-color: var(--px-accent);
    box-shadow: 0 0 0 .2rem var(--px-accent-soft);
    color: var(--px-text);
}
.form-check-input { background-color: var(--px-surface-2); border-color: var(--px-border); }
.form-check-input:checked { background-color: var(--px-accent); border-color: var(--px-accent); }
.form-text { color: var(--px-muted); }
.input-group-text { background: var(--px-surface-2); border-color: var(--px-border); color: var(--px-muted); }

.page-item.active .page-link { background-color: var(--px-thead-bg); border-color: var(--px-thead-bg); color: var(--px-thead-text); }
.page-link { background: var(--px-surface); border-color: var(--px-border); color: var(--px-link); }
.page-link:hover { background: var(--px-surface-2); color: var(--px-link-hover); }

.nav-pills { --bs-nav-pills-link-active-bg: var(--px-thead-bg); }
.dropdown-menu { --bs-dropdown-bg: var(--px-surface); --bs-dropdown-border-color: var(--px-border); }
.modal-content { background: var(--px-surface); border: 1px solid var(--px-border); }
.text-muted { color: var(--px-muted) !important; }
.bg-light { background: var(--px-surface-2) !important; }
/* "Light" chips (member level, transaction type, permission, etc.) pick up the portal surface from
   .bg-light above, so their Bootstrap .text-dark would be unreadable on a dark surface (the level
   column looked blank/black). Render them like the neutral status pill, which stays legible in every
   portal and theme. */
.badge.bg-light.text-dark {
    background: var(--px-chip-bg, rgba(138, 148, 166, .16)) !important;
    color: var(--px-chip-text, var(--px-muted)) !important;
    border-color: transparent !important;
}
.border { border-color: var(--px-border) !important; }
hr { border-color: var(--px-border); opacity: 1; }
code { color: var(--px-accent-quiet); }
a { color: var(--px-link); }
a:hover { color: var(--px-link-hover); }

.alert-info {
    --bs-alert-color: #cfe2f1;
    --bs-alert-bg: rgba(88, 146, 192, .12);
    --bs-alert-border-color: rgba(88, 146, 192, .32);
}
.alert-warning {
    --bs-alert-color: #f7d9a6;
    --bs-alert-bg: rgba(247, 179, 43, .12);
    --bs-alert-border-color: rgba(247, 179, 43, .3);
}
.alert-danger {
    --bs-alert-color: #ffc4bf;
    --bs-alert-bg: rgba(255, 90, 77, .12);
    --bs-alert-border-color: rgba(255, 90, 77, .3);
}
.alert-secondary {
    --bs-alert-color: var(--px-text);
    --bs-alert-bg: var(--px-surface-2);
    --bs-alert-border-color: var(--px-border);
}

/* The same tints on a white card need ink, not the pale type the black panel uses. */
[data-bs-theme="light"] .alert-info { --bs-alert-color: #24506f; }
[data-bs-theme="light"] .alert-warning { --bs-alert-color: #7a5410; --bs-alert-bg: rgba(247, 179, 43, .16); }
[data-bs-theme="light"] .alert-danger { --bs-alert-color: #97281d; --bs-alert-bg: rgba(255, 90, 77, .12); }
[data-bs-theme="light"] .alert-success {
    --bs-alert-color: #17663a;
    --bs-alert-bg: rgba(46, 204, 113, .14);
    --bs-alert-border-color: rgba(46, 204, 113, .32);
}

/* ---------- Brand ----------
   The wordmark is the supplied artwork rather than type, so the letterforms and
   the X mark are exactly as drawn. Two files exist: logo-dark.png carries a
   lightened tagline for the dark chrome, logo.png keeps the original black one
   for paper and any light surface. */
.brand-logo {
    display: block;
    width: 100%;
    max-width: 196px;
    height: auto;
}
.brand-logo.lg { max-width: 340px; }

/* Each panel now uses the logo artwork already cut to its own background colour
   (black / white / orange / blue), so no colour-knockout filter is applied. */
.sidebar-brand .brand-logo { filter: none; }

/* Every member tier uses the transparent logo (no box/lines) so it blends into the chrome;
   render it a bit larger and drop the divider line so the logo is not fenced into its own
   header box - it should melt into the sidebar. */
[data-portal="rt"] .sidebar-brand,
[data-portal="dt"] .sidebar-brand,
[data-portal="md"] .sidebar-brand,
[data-portal="sd"] .sidebar-brand { padding-top: 1.35rem; padding-bottom: .5rem; border-bottom: none; }
[data-portal="rt"] .sidebar-brand .brand-logo,
[data-portal="dt"] .sidebar-brand .brand-logo,
[data-portal="md"] .sidebar-brand .brand-logo,
[data-portal="sd"] .sidebar-brand .brand-logo { max-width: 224px; }

@media (max-width: 575.98px) {
    .brand-logo.lg { max-width: 260px; }
}

/* ---------- Application shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--px-sidebar-width);
    background: var(--px-sidebar);
    border-right: 1px solid var(--px-sidebar-border);
    color: var(--px-nav-text);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
    overflow-y: scroll;                         /* always reserve the scrollbar so the thumb is not overlay/auto-hidden */
    scrollbar-gutter: stable;
    scrollbar-width: thin;                      /* Firefox */
    scrollbar-color: #f06d1b transparent;       /* Firefox: thumb, track */
}

/* Member/menu sidebar scrollbar: the same orange -> blue gradient as the News label (Chrome/Edge/Safari).
   Always visible (not overlay/hover-only) - the track keeps a faint lane and the gradient thumb stays on. */
.app-sidebar::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-track { background: rgba(0,0,0,.06); border-radius: 8px; }
.app-sidebar::-webkit-scrollbar-thumb,
.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f06d1b, #5892c0);
    border-radius: 8px;
    min-height: 40px;
}

/* ---------- News ticker (admin announcements on member dashboards) ---------- */
.news-ticker {
    display: flex; align-items: stretch; gap: 0; overflow: hidden;
    border-radius: 10px; border: 1px solid var(--px-border);
    background: linear-gradient(135deg, #fff7ef, #eef5fc);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.news-ticker-label {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem .9rem; font-weight: 700; font-size: .85rem; color: #fff; white-space: nowrap;
    background: linear-gradient(135deg, #f06d1b, #5892c0);
}
.news-ticker-viewport { position: relative; flex: 1 1 auto; overflow: hidden; }
.news-ticker-track {
    display: inline-flex; align-items: center; white-space: nowrap;
    padding: .55rem 0; will-change: transform;
    animation: news-ticker-scroll 30s linear infinite;
}
.news-ticker:hover .news-ticker-track { animation-play-state: paused; }
.news-ticker-item { font-size: .9rem; color: var(--px-text); font-weight: 500; padding: 0 .35rem; }
.news-ticker-sep { color: #f06d1b; padding: 0 .75rem; }
@keyframes news-ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ---------- Orange/blue KPI boxes (dashboards + report totals) ---------- */
.kpi-box { border-radius: 12px; padding: 14px 16px 16px; color: #fff; min-height: 128px; display: flex; flex-direction: column;
    justify-content: space-between; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.kpi-orange { background: linear-gradient(135deg, #f06d1b, #ce570d); }
.kpi-blue   { background: linear-gradient(135deg, #5892c0, #35668d); }
.kpi-head { display: flex; align-items: flex-start; gap: 10px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.2); display: inline-flex;
    align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.kpi-main { line-height: 1.25; }
.kpi-title { font-size: 13.5px; font-weight: 700; opacity: .95; }
.kpi-value { font-size: 17px; font-weight: 800; }
.kpi-sub { margin-top: 10px; font-size: 12.5px; line-height: 1.35; opacity: .92; }
.kpi-sub span { display: block; }

.app-main {
    flex: 1;
    margin-left: var(--px-sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-content { padding: 1.25rem 1.5rem 2rem; flex: 1; }
.app-footer { padding: .9rem 1.5rem; border-top: 1px solid var(--px-border); background: var(--px-surface); }

/* ---------- Sidebar ---------- */
.sidebar-brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--px-sidebar-border);
    text-decoration: none;
}
.sidebar-brand { opacity: 1; transition: opacity .15s ease; }
.sidebar-brand:hover { opacity: .85; }

.sidebar-member { padding: .85rem 1.25rem; border-bottom: 1px solid var(--px-sidebar-border); color: var(--px-nav-text); }
.sidebar-member-meta { font-size: 0.82rem; color: var(--px-nav-meta); }
.sidebar-nav { padding: .5rem 0 2rem; }

.sidebar-nav .nav-section {
    padding: 1rem 1.25rem .35rem;
    font-size: 0.73rem; text-transform: uppercase; letter-spacing: .12em;
    color: var(--px-nav-section);
}

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem 1.25rem;
    color: var(--px-nav-text);
    font-size: 0.96rem;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i { font-size: 1.1rem; width: 1.1rem; text-align: center; color: var(--px-nav-icon); }
.sidebar-nav .nav-link:hover { background: var(--px-nav-hover-bg); color: var(--px-nav-hover-text); }

.sidebar-nav .nav-link.active {
    background: var(--px-nav-active-bg);
    border-left-color: var(--px-nav-active-border);
    color: var(--px-nav-active-text);
    font-weight: 600;
}
.sidebar-nav .nav-link.active i { color: var(--px-nav-active-text); }

/* Reports opens a submenu rather than a page of its own, so the service reports are
   one click away from every panel. */
.sidebar-nav .nav-toggle { cursor: pointer; }
.sidebar-nav .nav-toggle .nav-caret {
    margin-left: auto;
    font-size: .75rem;
    transition: transform .2s ease;
}
.sidebar-nav .nav-toggle[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

.sidebar-nav .nav-sub { background: var(--px-nav-sub-bg); }
.sidebar-nav .nav-sub .nav-link {
    padding: .4rem 1.25rem .4rem 3rem;
    font-size: .9rem;
    color: var(--px-nav-sub-text);
}
.sidebar-nav .nav-sub .nav-link.active {
    background: var(--px-nav-sub-active-bg);
    border-left-color: var(--px-nav-active-border);
    color: var(--px-nav-hover-text);
    font-weight: 600;
}

/* ---------- Header ---------- */
.app-header {
    height: var(--px-header-height);
    background: var(--px-header-bg);
    border-bottom: 1px solid var(--px-header-border);
    color: var(--px-header-text);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    position: sticky; top: 0; z-index: 1030;
}

/* The header sits on brand colour in three of the four member panels, so the
   muted type inside it takes its contrast from the chrome and not from the page. */
.app-header .text-muted { color: var(--px-header-muted) !important; }

.header-search { position: relative; flex: 1; max-width: 460px; }
.header-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--px-header-muted); z-index: 4; }
.header-search input {
    padding-left: 2.2rem;
    background: var(--px-header-input-bg);
    border-color: var(--px-header-input-border);
    color: var(--px-header-text);
}
.header-search input::placeholder { color: var(--px-header-muted); opacity: 1; }
.header-search input:focus {
    background: var(--px-header-input-bg);
    border-color: var(--px-header-input-border);
    color: var(--px-header-text);
    box-shadow: 0 0 0 .2rem var(--px-header-focus-ring);
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.header-code { font-size: 0.78rem; }

.wallet-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--px-chip-bg); color: var(--px-chip-text);
    border-radius: 999px; padding: .35rem .85rem; font-weight: 600; font-size: 0.92rem;
}

.btn-icon { border: 0; background: transparent; padding: .4rem .55rem; border-radius: 8px; color: var(--px-header-text); }
.btn-icon:hover { background: var(--px-header-hover-bg); color: var(--px-header-text); }
.notification-count { position: absolute; top: 2px; right: 0; font-size: 0.67rem; }
.notification-menu { width: 340px; padding: 0; }
.notification-items { max-height: 330px; overflow-y: auto; }
.notification-item { padding: .6rem .9rem; border-bottom: 1px solid var(--px-border); }
.notification-item.unread { background: var(--px-accent-soft); }

/* The dropdowns hang off the header but land on the page, so they take the page
   colours back rather than inheriting the chrome's white on brand. */
.app-header .dropdown-menu { color: var(--px-text); }
.app-header .dropdown-menu .text-muted { color: var(--px-muted) !important; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--px-accent); color: var(--px-accent-on);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}

/* ---------- Page furniture ---------- */
.page-head {
    display: flex; flex-wrap: wrap; gap: .5rem;
    align-items: center; justify-content: space-between;
    margin-bottom: 1.1rem;
}

.page-title { font-size: 1.43rem; font-weight: 600; margin: 0; }
.page-subtitle { margin: .15rem 0 0; color: var(--px-muted); font-size: 0.92rem; }
.breadcrumb { background: transparent; font-size: 0.89rem; }

.card {
    border: 1px solid var(--px-border);
    border-radius: var(--px-radius);
    background: var(--px-surface);
    box-shadow: var(--px-shadow-sm);
}
.card-header { background: var(--px-surface); border-bottom: 1px solid var(--px-border); font-weight: 600; }

/* ---------- Stat tiles ---------- */
.stat-card { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.1rem; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.24rem; }
.stat-label { color: var(--px-muted); font-size: 0.84rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.46rem; font-weight: 600; line-height: 1.25; color: var(--px-heading); }
.stat-hint { font-size: 0.82rem; color: var(--px-muted); }

.tone-primary { background: rgba(240,109,27,.16); color: var(--px-orange); }
.tone-info    { background: rgba(88,146,192,.16); color: var(--px-blue); }
.tone-success { background: rgba(46,204,113,.16); color: var(--px-success-ink); }
.tone-warning { background: rgba(247,179,43,.16); color: var(--px-warning-ink); }
.tone-danger  { background: rgba(255,90,77,.16); color: var(--px-danger-ink); }
.tone-navy    { background: rgba(53,102,141,.20); color: var(--px-navy-ink); }

/* ---------- Tables ---------- */
.table > thead th {
    background: var(--px-thead-bg);
    color: var(--px-thead-text);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 0;
    white-space: nowrap;
}
table.dataTable thead th { background: var(--px-thead-bg); color: var(--px-thead-text); }
.table > tfoot th, .table > tfoot td {
    background: var(--px-surface-2);
    color: var(--px-text);
    border-top: 1px solid var(--px-border);
}
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table-hover tbody tr:hover { background: var(--px-row-hover); }
.amount { font-variant-numeric: tabular-nums; }
.amount-credit { color: var(--px-success-ink); font-weight: 600; }
.amount-debit { color: var(--px-danger-ink); font-weight: 600; }

.badge-status { font-weight: 600; font-size: 0.78rem; padding: .32rem .6rem; border-radius: 999px; }
.status-success { background: rgba(46,204,113,.16); color: var(--px-success-ink); }
.status-failed { background: rgba(255,90,77,.16); color: var(--px-danger-ink); }
.status-pending { background: rgba(247,179,43,.18); color: var(--px-warning-ink); }
.status-neutral { background: rgba(138,148,166,.16); color: var(--px-muted); }

/* ---------- Service tiles ---------- */
/* Service tiles follow the dashboard KPI colour pattern: alternating orange / blue gradients. */
.service-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
    padding: 1.1rem .5rem; border: 2px solid #000; border-radius: 12px;
    background: linear-gradient(135deg, #5892c0, #35668d); color: #fff; text-align: center; height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none; box-shadow: 0 6px 16px rgba(0,0,0,.14);
}

.service-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0,0,0,.22);
    color: #fff;
}
.service-tile .service-icon {
    width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.92);
    display: inline-flex; align-items: center; justify-content: center;
}
.service-tile i { font-size: 1.5rem; color: #111 !important; }
.service-tile span { font-size: 0.89rem; font-weight: 500; }
.service-tile .service-name { color: #fff; font-weight: 700; }
.service-tile .service-category { color: rgba(255,255,255,.85); font-size: 0.78rem; }

/* ---------- Seat map ---------- */
.seat-map { display: grid; gap: .35rem; }
.seat {
    border: 1px solid var(--px-border); border-radius: 6px; padding: .35rem .1rem;
    font-size: 0.76rem; text-align: center; cursor: pointer; background: var(--px-surface);
}
.seat.unavailable { background: var(--px-seat-off-bg); color: var(--px-seat-off-text); cursor: not-allowed; }
.seat.selected { background: var(--px-accent); color: #fff; border-color: var(--px-accent-dark); }
.seat.ladies { border-color: #d946a0; }

/* ---------- Auth ---------- */
.auth-body { background: var(--px-bg); }
.auth-wrapper { display: flex; min-height: 100vh; }

.auth-brand {
    flex: 1 1 50%;
    background:
        radial-gradient(circle at 20% 25%, rgba(88,146,192,.22) 0%, transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(240,109,27,.18) 0%, transparent 55%),
        var(--px-sidebar);
    border-right: 1px solid var(--px-border);
    color: #fff; display: flex; align-items: center; justify-content: center; padding: 3rem;
}

.auth-brand-inner { max-width: 460px; }
.auth-brand .brand-logo { margin-bottom: 1.6rem; }
.auth-brand p { color: rgba(255,255,255,.82); }
.auth-points { list-style: none; padding: 0; margin: 1.6rem 0 0; }
.auth-points li { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; color: rgba(255,255,255,.9); }
.auth-points i { color: var(--px-orange-light); }

.auth-panel { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; }
.toast-stack { z-index: 1080; }

/* Member panels (retailer/distributor/MD): success toasts use the brand orange, not green. */
[data-portal="rt"] .toast.text-bg-success,
[data-portal="dt"] .toast.text-bg-success,
[data-portal="md"] .toast.text-bg-success,
[data-portal="sd"] .toast.text-bg-success {
    background-color: #ef6d22 !important;
    color: #fff !important;
}

/* The sign-in panel sits on the dark brand background, where the default dark checkbox
   disappears. Give the "remember me" / "accept terms" boxes a visible light outline, and
   fill them with the brand accent when ticked. */
.auth-body .form-check-input {
    background-color: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .55);
}
.auth-body .form-check-input:checked {
    background-color: var(--px-orange);
    border-color: var(--px-orange);
}
.auth-body .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(240, 109, 27, .28); }
.auth-body .form-check-label { color: rgba(255, 255, 255, .85); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .auth-brand { display: none; }
}

@media (max-width: 575.98px) {
    .app-content { padding: 1rem .85rem 2rem; }
    .app-header { padding: 0 .85rem; }
    .stat-value { font-size: 1.24rem; }
}

/* ---------- Filters, detail lists and shared page furniture ---------- */
.filter-bar {
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    border-radius: var(--px-radius);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}

.detail-list dt { font-weight: 500; color: var(--px-muted); padding: .35rem 0; font-size: 0.92rem; }
.detail-list dd { padding: .35rem 0; margin-bottom: 0; font-size: 0.95rem; }

.confirm-table th { font-weight: 400; }
.confirm-table td, .confirm-table th { border-color: var(--px-border); padding: .4rem .25rem; }

.payload-box {
    background: #14293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: .75rem;
    font-size: 0.81rem;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

/* the API log details page shows a payload in full */
.payload-box.payload-box-full {
    max-height: 70vh;
}

.permission-group { padding: .5rem 0 1rem; border-bottom: 1px solid var(--px-border); }
.permission-group:last-child { border-bottom: 0; }

.section-block {
    border: 1px solid var(--px-border);
    border-radius: 8px;
    padding: .85rem;
    background: var(--px-surface-2);
}

.network-grid > div { border-left: 3px solid var(--px-accent); padding-left: .75rem; }

.alert-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: 0.86rem;
    color: var(--px-text);
    text-decoration: none;
}
.alert-chip:hover { border-color: var(--px-accent); color: var(--px-accent); }

/* ---------- Wallet panel ---------- */
.wallet-panel {
    background: var(--px-wallet-bg);
    border: 1px solid var(--px-border);
    color: var(--px-wallet-text);
    border-radius: var(--px-radius);
    padding: 1.4rem;
}
.wallet-panel .wallet-label { display: block; font-size: 0.86rem; opacity: .75; }
.wallet-panel .wallet-amount { display: block; font-size: 2.16rem; font-weight: 600; margin: .25rem 0 1rem; }
.wallet-panel .wallet-meta > div {
    display: flex;
    justify-content: space-between;
    font-size: 0.89rem;
    padding: .25rem 0;
    border-top: 1px solid var(--px-wallet-rule);
}
.wallet-panel .wallet-meta span { opacity: .75; }

/* ---------- Service launcher grid ---------- */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
}

/* ---------- Network tree ---------- */
.tree-root, .tree-branch { list-style: none; margin: 0; padding-left: 0; }
.tree-branch { padding-left: 1.75rem; border-left: 1px dashed var(--px-border); margin-left: 1rem; }
.tree-node { position: relative; padding: .35rem 0; }
.tree-card {
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    border-left: 4px solid var(--px-accent);
    border-radius: 8px;
    padding: .65rem .85rem;
    display: inline-block;
    min-width: 260px;
}
.tree-card.level-1 { border-left-color: var(--px-blue-light); }
.tree-card.level-2 { border-left-color: var(--px-blue-dark); }
.tree-card.level-3 { border-left-color: var(--px-blue); }
.tree-card.level-4 { border-left-color: var(--px-orange-light); }
.tree-card.level-5 { border-left-color: var(--px-warning); }
.tree-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.tree-badge { font-size: 0.76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--px-muted); }
.tree-balance { font-size: 0.86rem; font-weight: 600; }
.tree-name { display: block; font-weight: 600; font-size: 0.97rem; color: var(--px-text); text-decoration: none; }
.tree-name:hover { color: var(--px-accent); }
.tree-meta { display: block; font-size: 0.81rem; color: var(--px-muted); }

.upline-chip {
    border: 1px solid var(--px-border);
    border-radius: 999px;
    padding: .35rem .9rem;
    background: var(--px-surface-2);
}

/* ---------- Recharge plans ---------- */
.plan-list { max-height: 460px; overflow-y: auto; }
.plan-item {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--px-surface);
    border: 0;
    border-bottom: 1px solid var(--px-border);
    padding: .7rem 1rem;
}
.plan-item:hover { background: var(--px-surface-2); }
.plan-item.selected { background: var(--px-accent-soft); }
.plan-amount { display: block; font-weight: 600; }
.plan-meta { display: block; font-size: 0.84rem; color: var(--px-accent); }
.plan-desc { display: block; font-size: 0.84rem; color: var(--px-muted); }

/* ---------- BBPS ---------- */
.biller-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.biller-category {
    display: block;
    text-align: center;
    padding: .8rem .4rem;
    border: 1px solid var(--px-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--px-text);
    background: var(--px-surface);
}
.biller-category i { font-size: 1.51rem; color: var(--px-accent); }
.biller-category:hover, .biller-category.active { border-color: var(--px-accent); background: var(--px-accent-soft); }

.bill-result {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--px-border);
    border-radius: 8px;
    background: var(--px-surface-2);
}

/* ---------- Travel search results ---------- */
.trip-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.2fr auto;
    gap: 1rem;
    align-items: center;
}
.trip-operator { display: block; font-weight: 600; font-size: 0.97rem; }
.trip-times { display: flex; gap: .75rem; align-items: center; }
.trip-fare { text-align: right; }

.class-tile {
    width: 100%;
    text-align: left;
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    border-radius: 8px;
    padding: .6rem .75rem;
}
.class-tile:hover { border-color: var(--px-accent); background: var(--px-accent-soft); }
.class-code { display: block; font-weight: 600; font-size: 0.89rem; }
.class-avail { display: block; font-size: 0.81rem; color: var(--px-success); }
.class-fare { display: block; font-size: 0.89rem; font-weight: 600; }

.fare-summary {
    border-top: 1px solid var(--px-border);
    padding-top: .75rem;
    font-size: 0.95rem;
}

.seat-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .75rem; font-size: 0.81rem; color: var(--px-muted); }
.seat-legend .seat.sample { width: 18px; height: 18px; display: inline-block; margin-right: .3rem; vertical-align: middle; }

.ticket-card, .receipt-card { max-width: 820px; }
.receipt-wrap { max-width: 820px; }

/* ---------- Timeline used by KYC history and ticket conversations ---------- */
.timeline { list-style: none; margin: 0; padding: 1rem 1rem 1rem 1.75rem; }
.timeline li { position: relative; padding: 0 0 1rem 1rem; border-left: 2px solid var(--px-border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: .35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--px-accent);
    border: 2px solid var(--px-surface);
}
.timeline li.internal::before { background: var(--px-muted); }
.timeline-time { display: block; font-size: 0.78rem; color: var(--px-muted); }
.timeline-title { display: block; font-size: 0.92rem; font-weight: 600; color: var(--px-heading); }
.timeline-meta { display: block; font-size: 0.89rem; color: var(--px-muted); }

/* ---------- Service module tabs ---------- */
.service-tabs .nav-link {
    color: var(--px-text);
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    margin-right: .4rem;
    font-size: 0.95rem;
}
.service-tabs .nav-link.active { background: var(--px-accent); border-color: var(--px-accent); color: #fff; }

/* ---------- Notification list ---------- */
.list-group-item.unread { background: var(--px-accent-soft); }

/* ---------- Print ----------
   The screen theme is black on purpose, but a receipt or an MIS report goes on
   paper. Printing flips the whole page back to ink on white. */
@media print {
    .app-sidebar, .app-header, .app-topbar, .app-footer, .filter-bar, .page-head nav,
    .btn, .toast-container, .d-print-none { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    .content-brand { background: #fff !important; }

    html, body {
        background: #fff !important;
        color: #111 !important;
    }
    .card, .card-header, .card-body, .wallet-panel, .section-block, .filter-bar, .bill-result {
        background: #fff !important;
        color: #111 !important;
        border: 0 !important;
        box-shadow: none !important;
    }
    .table, .table th, .table td, dl, dt, dd, h1, h2, h3, h4, h5, h6, code, pre {
        color: #111 !important;
        background: transparent !important;
    }
    .table th, .table td { border-color: #ccc !important; }
    .text-muted, .timeline-meta, .timeline-time { color: #555 !important; }
    .badge-status { border: 1px solid #999 !important; color: #111 !important; background: transparent !important; }
    .amount-credit, .amount-debit { color: #111 !important; }
    table.dataTable thead th { background: #eee !important; color: #111 !important; }
}

/* ---------- DataTables on the dark scheme ----------
   The plugin ships its own light chrome for the search box, the length menu and
   the pager, none of which follows data-bs-theme. */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    background: var(--px-surface-2);
    border: 1px solid var(--px-border);
    color: var(--px-text);
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { color: var(--px-muted); }
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--px-text) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--px-thead-bg) !important;
    border-color: var(--px-thead-bg) !important;
    color: #fff !important;
}
table.dataTable.table-hover tbody tr:hover { background: var(--px-row-hover); }

/* Headings sit in the brand blue, as they do on the client's tiles. */
.card-header { color: var(--px-heading); }
.page-title { color: var(--px-heading); }
.breadcrumb-item a { color: var(--px-link); }
.breadcrumb-item.active { color: var(--px-muted); }
.detail-list dt { color: var(--px-muted); }
.detail-list dd { color: var(--px-text); }

/* ---------------------------------------------------------------------------
   Distributor top bar

   The distributor panel is the only one whose menu runs across the top rather
   than down the side, so the shell becomes one column and the bar carries the
   brand, the menu and the member actions. Every colour still comes from the
   same tokens the sidebar uses, which is why the bar is orange without naming
   orange once.
   --------------------------------------------------------------------------- */
.app-shell-top { display: block; }
.app-shell-top .app-main { margin-left: 0; }

.app-topbar {
    background: var(--px-header-bg);
    color: var(--px-header-text);
    position: sticky; top: 0; z-index: 1030;
    box-shadow: 0 2px 12px rgba(29, 43, 58, .16);
}

.topbar-inner {
    display: flex; align-items: center; gap: .75rem;
    min-height: var(--px-header-height);
    padding: 0 1.5rem;
}

.topbar-brand { display: inline-flex; align-items: center; padding: .45rem 0; text-decoration: none; }
.topbar-brand .brand-logo { max-width: 168px; filter: var(--px-brand-filter); }

.topnav-toggle {
    color: var(--px-header-text); font-size: 1.5rem;
    padding: .15rem .5rem; text-decoration: none;
}
.topnav-toggle:hover { color: var(--px-header-text); }

.topbar-nav { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; margin-left: 1.25rem; }

.topbar-link {
    display: inline-flex; align-items: center; gap: .35rem;
    background: transparent; border: 0;
    padding: .45rem .85rem; border-radius: 999px;
    color: var(--px-nav-text); text-decoration: none;
    font-size: .95rem; font-weight: 500;
    white-space: nowrap;
}
.topbar-link:hover { background: var(--px-nav-hover-bg); color: var(--px-nav-hover-text); }
.topbar-link.active {
    background: var(--px-nav-active-bg);
    color: var(--px-nav-active-text);
    font-weight: 600;
}
.topbar-caret { font-size: .7rem; opacity: .75; transition: transform .2s ease; }
.topbar-link[aria-expanded="true"] .topbar-caret { transform: rotate(180deg); }

.topbar-menu { min-width: 232px; padding: .35rem; border-radius: var(--px-radius); box-shadow: var(--px-shadow-lg); }
.topbar-menu .dropdown-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .6rem; border-radius: 8px;
}
.topbar-menu .dropdown-item i { width: 1.05rem; text-align: center; color: var(--px-accent); }
.topbar-menu .dropdown-item.active { background: var(--px-accent); color: var(--px-accent-on); }
.topbar-menu .dropdown-item.active i { color: var(--px-accent-on); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.topbar-avatar-button { padding: .1rem; border-radius: 50%; }
.topbar-avatar-button .avatar { background: rgba(255, 255, 255, .95); color: var(--px-header-bg); }

/* The menus hang off brand chrome but land on the page, so they take the page
   colours back rather than inheriting white on orange. */
.app-topbar .dropdown-menu { color: var(--px-text); }
.app-topbar .dropdown-menu .text-muted { color: var(--px-muted) !important; }

@media (max-width: 991.98px) {
    .topbar-inner { flex-wrap: wrap; padding: 0 .85rem; }
    .topbar-brand { order: 1; }
    .topbar-actions { order: 2; margin-left: auto; }
    .topnav-toggle { order: 3; }
    .topbar-nav {
        order: 4; width: 100%; margin-left: 0;
        display: none; flex-direction: column; align-items: stretch;
        padding-bottom: .75rem;
    }
    .topbar-nav.open { display: flex; }
    .topbar-link { width: 100%; justify-content: space-between; border-radius: 8px; }
    .topbar-menu {
        position: static !important; transform: none !important;
        width: 100%; border: 0; box-shadow: none;
        background: var(--px-nav-sub-bg);
    }
    .topbar-menu .dropdown-item { color: var(--px-nav-sub-text); }
    .topbar-menu .dropdown-item i { color: inherit; }
    .topbar-menu .dropdown-item:hover { background: var(--px-nav-hover-bg); color: var(--px-nav-hover-text); }
}

/* ---------------------------------------------------------------------------
   A page painted on brand

   The distributor dashboard runs straight out of the bar above it, so its
   canvas is the chrome colour and the cards sit on it as white panels. Only a
   page that asks for it gets this; every other distributor page keeps the soft
   page tint, where a table of figures is far easier to read.
   --------------------------------------------------------------------------- */
.content-brand { background: var(--px-header-bg); }
.content-brand .page-title,
.content-brand .page-subtitle,
.content-brand .hero-stat-label { color: #fff; }
.content-brand .page-subtitle,
.content-brand .hero-stat-label { color: rgba(255, 255, 255, .82); }

.hero-stats { display: flex; flex-wrap: wrap; gap: 1.75rem; margin-bottom: 1.25rem; }
.hero-stat { min-width: 8.5rem; }
.hero-stat-label {
    display: block; font-size: .78rem; text-transform: uppercase;
    letter-spacing: .07em; margin-bottom: .1rem;
}
.hero-stat-value { display: block; font-size: 1.42rem; font-weight: 700; color: #fff; line-height: 1.2; }
.hero-stat-caption { display: block; font-size: .8rem; color: rgba(255, 255, 255, .78); }

/* The filter sits on brand here, so it becomes a white panel of its own rather
   than the tinted strip it is on a tinted page. */
.content-brand .breadcrumb a,
.content-brand .breadcrumb-item.active,
.content-brand .breadcrumb-item + .breadcrumb-item::before { color: rgba(255, 255, 255, .85); }
.content-brand .breadcrumb a:hover { color: #fff; }

.content-brand .filter-bar { background: var(--px-surface); border-color: var(--px-surface); }
.content-brand .filter-bar .text-muted { color: var(--px-muted) !important; }

/* ---------- Ranked downline list ---------- */
/* The mock ups head the two figure columns rather than repeating the words on
   every row, so the header carries them and the rows stay quiet. */
.rank-head {
    display: flex; align-items: flex-end; gap: .8rem;
    padding: .4rem 1rem .3rem;
    font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--px-muted);
    border-bottom: 1px solid var(--px-border);
}
.rank-head-spacer { flex: 1; }
.rank-head-figure { width: 6.5rem; text-align: right; }
.rank-head-figure + .rank-head-figure { width: 5.5rem; }

.rank-list { display: flex; flex-direction: column; }
.rank-row {
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem 1rem; border-bottom: 1px solid var(--px-border-soft);
    text-decoration: none; color: inherit;
}
.rank-list .rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: var(--px-row-hover); }
.rank-badge {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
    background: var(--px-accent); color: var(--px-accent-on);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 700;
}
.rank-main { min-width: 0; flex: 1; }
.rank-name { display: block; font-weight: 600; color: var(--px-link); }
.rank-meta { display: block; font-size: .8rem; color: var(--px-muted); }
.rank-figure { width: 6.5rem; text-align: right; white-space: nowrap; }
.rank-signups { width: 5.5rem; }
.rank-signups .rank-amount { color: var(--px-accent-quiet); }
.rank-figure .rank-amount { display: block; font-weight: 700; color: var(--px-heading); }
.rank-figure .rank-count { display: block; font-size: .8rem; color: var(--px-muted); }

/* ---------- Quick actions ---------- */
.quick-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.quick-actions .btn { flex: 1 1 auto; }

/* ---------- Compact ticket list ---------- */
.ticket-row {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .65rem 1rem; border-bottom: 1px solid var(--px-border-soft);
    text-decoration: none; color: inherit;
}
.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: var(--px-row-hover); }
.ticket-main { min-width: 0; flex: 1; }
.ticket-subject { display: block; font-weight: 600; color: var(--px-link); }
.ticket-meta { display: block; font-size: .8rem; color: var(--px-muted); }

/* ---------------------------------------------------------------------------
   Fund requests

   A member pays into one of the company's accounts and asks their upline to
   credit it. These are the two pieces the screens need that nothing else on
   the platform already draws: the account cards on the request form, and the
   proof image on the approver's detail page.
   --------------------------------------------------------------------------- */
/* The panel leads the page, so it wears the accent rather than the card grey - a
   member cannot pay in without reading it. */
.pay-into { border-color: var(--px-accent); border-width: 2px; box-shadow: var(--px-shadow-lg); }
.pay-into > .card-header {
    background: var(--px-accent);
    color: var(--px-accent-on);
    border-bottom-color: var(--px-accent);
    font-size: 1.02rem;
}
.pay-into-hint { font-size: .82rem; color: rgba(255, 255, 255, .88); font-weight: 400; }
.pay-into > .card-body { background: var(--px-accent-soft); }

.bank-card {
    padding: .9rem 1rem;
    background: var(--px-surface);
    border: 1px solid var(--px-border);
    border-radius: var(--px-radius);
}
.bank-card-head { margin-bottom: .6rem; }
.bank-card-name { display: block; font-weight: 600; color: var(--px-heading); }
.bank-card-holder { display: block; font-size: .82rem; color: var(--px-muted); }

/* The account number is the one thing that gets transcribed by hand, so it is set
   large, spaced and monospaced rather than buried in the definition list. */
.bank-account-number {
    background: var(--px-surface-2);
    border: 1px dashed var(--px-border);
    border-radius: 8px;
    padding: .5rem .7rem;
    margin-bottom: .6rem;
}
.bank-account-label {
    display: block; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .07em; color: var(--px-muted);
}
.bank-account-value {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.16rem; font-weight: 700; letter-spacing: .06em;
    color: var(--px-heading);
    word-break: break-all;
}

.bank-note {
    margin-top: .6rem; padding: .5rem .65rem; border-radius: 8px;
    background: rgba(247, 179, 43, .16); color: var(--px-warning-ink);
    font-size: .82rem;
}

.bank-lines { display: grid; grid-template-columns: auto 1fr; gap: .1rem .75rem; margin: 0; }
.bank-lines dt { font-size: .78rem; color: var(--px-muted); font-weight: 500; }
.bank-lines dd { margin: 0; font-size: .88rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.proof-image { max-height: 420px; object-fit: contain; border: 1px solid var(--px-border); }

/* The status words come from FundRequestStatus, which does not reuse the
   transaction vocabulary the badges were built for. */
.status-approved { background: rgba(46, 204, 113, .16); color: var(--px-success-ink); }
.status-rejected { background: rgba(255, 90, 77, .16); color: var(--px-danger-ink); }
.status-cancelled { background: rgba(138, 148, 166, .16); color: var(--px-muted); }

/* The required marker on the fund request form. Red on any panel, because it means the
   same thing whichever brand colour the chrome is wearing. */
.req { color: var(--px-danger-ink); font-weight: 700; }
