/* ============================================================================
   eKash Admin Portal stylesheet
   ----------------------------------------------------------------------------
   Loaded once by the Facelets templates (templates/main.xhtml, public.xhtml),
   guaranteed AFTER the PrimeFaces theme and primeflex.min.css, so
   equal-specificity rules here override both without !important.

   Structure:
     1. Design tokens (eKash brand palette - the Phase 3 token layer builds on
        these; Phase 2 uses them for the consolidated page styles)
     2. Base (replaces the parts of Bootstrap's reboot the portal relied on)
     3. Bootstrap-compat layer (the handful of Bootstrap component classes
        still present in markup after the CDN removal; grid classes were
        renamed to PrimeFlex instead)
     4. Shared portal rules (deduplicated from 13 per-page <style> blocks)
     5. Per-page sections
   ============================================================================ */

/* ============================== 1. TOKENS ================================= */
:root {
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Poppins", "Inter", system-ui, sans-serif;

    --primary: #ffb71b;
    --primary-50: #fff7e5;
    --primary-100: #ffe6b0;
    --primary-600: #e8a317;
    --primary-foreground: #1a1a2e;
    --navy: #1a1a2e;

    --danger: #f9002b;
    --danger-bg: #ffebee;
    --danger-text: #842029;
    --danger-banner: #f5d9d9;

    --surface: #ffffff;
    --surface-1: #f5f7fa;
    --surface-2: #edf0f3;
    --surface-muted: #efefef;
    --border-strong: #d9d9d9;
    --border-light: #e6e6e6;

    --text-primary: #333333;
    --text-secondary: #808080;
    --text-muted: #8a8a8a;

    --status-success-bg: #dbeddb;  --status-success-text: #265926;
    --status-warning-bg: #fff5d9;  --status-warning-text: #7a640f;
    --status-refund-bg: #f5d9d9;   --status-refund-text: #8c2626;
    --status-canceled-bg: #c1cbd3; --status-canceled-text: #4d494a;
    --status-onhold-bg: #d1ecf1;   --status-onhold-text: #0c5460;

    --success: #4caf50;
    --success-dark: #2e7d32;
    --info: #1976d2;

    --radius-sm: 5px;
    --radius: 10px;
    --radius-badge: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-card: 0 2px 6px rgba(0, 0, 0, .06);
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, .1);
    --focus-ring: 0 0 0 3px rgba(255, 183, 27, .5);
}

/* Inter (variable, latin subset) - vendored from the inter-ui webjar so no
   external font CDN is needed. The EL below is evaluated by the JSF resource
   handler when this stylesheet is served. */
@font-face {
    font-family: "Inter";
    src: url("/faces/jakarta.faces.resource/Inter-roman-latin.var.woff2?ln=fonts") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ==================== 1b. PRIMEFACES THEME RE-POINT =======================
   The saga theme ships :root tokens but its compiled component rules DON'T
   consume them (colours are baked in), so retheming needs both moves:
   (1) re-point the theme tokens for anything that does read them, and
   (2) explicit .ui-* overrides below, which do the real recolouring.        */
:root {
    --font-family: var(--font-sans);
    --primary-color: var(--primary);
    --primary-color-text: var(--primary-foreground);
    --text-color: var(--text-primary);
    --text-color-secondary: var(--text-secondary);
    --surface-ground: var(--surface-1);
    --surface-section: var(--surface);
    --surface-card: var(--surface);
    --surface-overlay: var(--surface);
    --surface-border: var(--border-strong);
    --surface-hover: var(--primary-50);
    --border-radius: var(--radius-badge);
    --maskbg: rgba(26, 26, 46, .4);
}

/* --- Global widget typography & focus ---
   The eKash app's working UI base is 14px/20px. */
body .ui-widget, body .ui-widget .ui-widget {
    font-family: var(--font-sans);
    font-size: 14px;
}
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* --- Buttons: 32px, 14px semibold, radius 8 (ui/button.tsx geometry) --- */
body .ui-button {
    background: var(--primary);
    border: 1px solid transparent;
    color: var(--primary-foreground);
    border-radius: var(--radius-badge);
    font-size: 14px;
    font-weight: 600;
    padding: .3rem .625rem;
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
body .ui-button .ui-button-text { padding: 0 .1rem; font-size: 14px; }
body .ui-button:enabled:active { transform: translateY(1px); }
body .ui-button:enabled:hover, body .ui-button:focus:enabled:hover {
    background: var(--primary-600);
    border-color: transparent;
    color: var(--primary-foreground);
}
body .ui-button:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}
body .ui-button.ui-state-disabled { background: var(--surface-muted); color: var(--text-muted); opacity: 1; }
/* Secondary / outline: white, 1px border, muted hover */
body .ui-button.ui-button-secondary, body .ui-button.ui-button-secondary.ui-state-default {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
body .ui-button.ui-button-secondary:enabled:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
/* Danger: SOLID red.

   This was a 10%-opacity tint on a transparent border. Next to the disabled
   style below — a muted grey fill at full opacity — a pale wash reads as
   "unavailable" rather than "destructive", and delete buttons looked switched
   off. Destructive actions should be the most legible control in a row. */
body .ui-button.ui-button-danger, body .ui-button.ui-button-danger.ui-state-default {
    background: var(--danger);
    border: 1px solid var(--danger);
    color: #fff;
}
body .ui-button.ui-button-danger .ui-icon,
body .ui-button.ui-button-danger .ui-button-icon-left { color: #fff; }
body .ui-button.ui-button-danger:enabled:hover {
    background: #d40025;
    border-color: #d40025;
    color: #fff;
}
/* A disabled destructive button must not stay red, or it reads as armed. */
body .ui-button.ui-button-danger.ui-state-disabled,
body .ui-button.ui-button-danger:disabled {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--text-muted);
}
body .ui-button.ui-button-danger.ui-state-disabled .ui-icon,
body .ui-button.ui-button-danger:disabled .ui-icon { color: var(--text-muted); }
/* Info: navy */
body .ui-button.ui-button-info, body .ui-button.ui-button-info.ui-state-default {
    background: var(--navy);
    border: 1px solid transparent;
    color: #fff;
}
body .ui-button.ui-button-info:enabled:hover {
    background: #2c2c4a;
    border-color: transparent;
    color: #fff;
}
/* warning variant (retry automation etc.): gold-tinted */
body .ui-button.ui-button-warning, body .ui-button.ui-button-warning.ui-state-default {
    background: var(--primary-50);
    border: 1px solid transparent;
    color: var(--primary-600);
}
body .ui-button.ui-button-warning:enabled:hover { background: var(--primary-100); color: var(--primary-600); }

/* --- App shell: navy sidebar (256px) + sticky white topbar (64px) ---
   Mirrors the eKash web app shell 1:1 (app-shell.tsx / sidebar-nav.tsx). */
.ekash-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 256px;
    background: var(--navy);
    color: #e6e6e6;
    overflow-y: auto;
    z-index: 40;
    display: flex;
    flex-direction: column;
}
.ekash-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 20px;
}
/* The shipped wordmark is black artwork on transparency, drawn for light
   backgrounds. brightness(0) flattens it to pure black, invert(1) then takes it
   to pure white — so one asset serves the navy rail here and the light login
   card, with no second recoloured file to keep in sync. */
.ekash-brand-logo {
    height: 20px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}
/* "Admin" is the qualifier next to the product wordmark, so it is deliberately
   lighter and smaller than the logo rather than competing with it. */
.ekash-brand-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .01em;
    color: rgba(255, 255, 255, .72);
    padding-left: .55rem;
    margin-left: .1rem;
    border-left: 1px solid rgba(255, 255, 255, .22);
}
.ekash-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
}
.ekash-nav-section {
    padding: 12px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(230, 230, 230, .45);
}
a.ekash-nav-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 10px 12px;
    border-radius: var(--radius-badge);
    font-size: 14px;
    font-weight: 500;
    color: rgba(230, 230, 230, .8);
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
a.ekash-nav-item i { font-size: 18px; color: rgba(230, 230, 230, .6); }
a.ekash-nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
a.ekash-nav-item:hover i { color: #fff; }
a.ekash-nav-item.active { background: rgba(255, 183, 27, .12); color: var(--primary); }
a.ekash-nav-item.active i { color: var(--primary); }

/* still-processing count pill on the Payments item (red = signal, not fill) */
.ekash-count-pill {
    margin-left: auto;
    background: var(--surface);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    padding: 2px 8px;
}

.ekash-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    margin-left: 256px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 0 24px;
}
.ekash-topbar-spacer { flex: 1; }
.ekash-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-badge);
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s;
}
.ekash-logout-btn:hover { background: var(--surface-muted); }

/* Page column: shifted right of the sidebar only when the shell rendered
   (unauthenticated pages on the main template render no chrome). */
main.ekash-page { padding: 24px; }
body:has(.ekash-sidebar) main.ekash-page { margin-left: 256px; }
.ekash-page-inner { max-width: 1152px; margin-inline: auto; }

/* ---------------------------------------------------------------------------
   Login.

   Navy field with the brand gold used only where it should pull the eye — the
   submit button and the focus ring. The card itself stays white so the shipped
   black wordmark needs no recolouring here, unlike the sidebar.
   --------------------------------------------------------------------------- */

body.ekash-public { background: var(--navy); }

/* The public shell wraps content in main.ekash-page, which carries 24px padding;
   the login screen wants the full viewport so the card can sit centred. */
body.ekash-public main.ekash-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ekash-login {
    width: 100%;
    max-width: 420px;
}

.ekash-login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    padding: 36px 32px 32px;
}

.ekash-login-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 28px;
}

.ekash-login-logo {
    height: 24px;
    width: auto;
    display: block;
}

.ekash-login-badge {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: .6rem;
    border-left: 1px solid var(--border-strong);
}

.ekash-login-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.ekash-login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px;
}

.ekash-login-alert {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 18px;
}

.ekash-login-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Icon sits inside the field rather than in a separate prepend box, so the
   control reads as one element. */
.ekash-login-field {
    position: relative;
    margin-bottom: 4px;
}

.ekash-login-field i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.ekash-login-field input {
    width: 100%;
    height: 44px;
    padding: 0 12px 0 36px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ekash-login-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.ekash-login-field input.is-invalid {
    border-color: var(--danger);
}

.ekash-login-error {
    display: block;
    min-height: 18px;
    font-size: 12px;
    color: var(--danger-text);
    margin-bottom: 10px;
}

.ekash-login-button {
    width: 100%;
    height: 46px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-foreground);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s ease;
}

.ekash-login-button:hover { background: var(--primary-600); }
.ekash-login-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ekash-login-button:disabled { opacity: .7; cursor: default; }

.ekash-login-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(26, 26, 46, .3);
    border-top-color: var(--primary-foreground);
    border-radius: 50%;
    animation: ekash-spinner .7s linear infinite;
}

.ekash-login-foot {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, .5);
    margin: 18px 0 0;
}
/* Data-dense screens opt out of the 1152px content cap by putting
   .ekash-wide on their wrapper (payments, client payments, payment
   reference sheet) - their grids then track the viewport width. */
.ekash-page-inner:has(.ekash-wide) { max-width: none; }

/* Page header: 30px bold tight title + 14px secondary subtitle. */
.ekash-page-header { margin-bottom: 24px; }
.ekash-page-header h1 {
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-primary);
    margin: 0;
}
.ekash-page-header p {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
}
.ekash-page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

/* ---------------------------------------------------------------------------
   Table toolbar and filter bar.

   Grids here previously put the page title, two date pickers, their Apply/Clear
   buttons and four page actions into a single `justify-content: space-between`
   flex. With eight unlike children that distributes them edge to edge, so a
   filter button ends up adjacent to an export button and the wrap order shifts
   with the viewport. Splitting it in two — actions in the toolbar, filters in
   their own bar — is what paymentReferenceSheet.xhtml already does.
   --------------------------------------------------------------------------- */

.ekash-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ekash-table-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* The action cluster stays together and right-aligned; only the cluster as a
   whole wraps, never individual buttons away from their neighbours. */
.ekash-toolbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---------------------------------------------------------------------------
   Tabs.

   Plain buttons rather than a PrimeFaces tab component: that one is a
   NamingContainer and would re-prefix every nested form id, breaking absolute
   update targets in the markup and in bean code. These are presentation only.
   --------------------------------------------------------------------------- */

.ekash-tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
    overflow-x: auto;
}

.ekash-tab {
    appearance: none;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease;
}

.ekash-tab:hover { color: var(--text-primary); }
.ekash-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

.ekash-tab.is-active {
    color: var(--text-primary);
    border-bottom-color: var(--primary);
}

/* Panels stay in the DOM either way — only visibility changes — so nothing in
   the component tree is disturbed by switching tabs. */
.ekash-tabpanel { display: none; }
.ekash-tabpanel.is-active { display: block; }

/* Conversion and Markup are two small lookup tables; side by side on a wide
   screen, stacked below it. Replaces a hand-tuned 38%/65% flex row. */
.ekash-fees-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.ekash-filter-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: var(--surface-1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.ekash-filter-bar-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    margin-right: .25rem;
}

.ekash-filter-field-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Date inputs in the bar are narrow by default so the row reads as one control
   group rather than two full-width fields. */
body .ekash-filter-bar .ui-datepicker input,
body .ekash-filter-bar input.ui-inputfield {
    width: 150px;
}

@media (max-width: 768px) {
    .ekash-filter-bar,
    .ekash-toolbar-actions {
        width: 100%;
    }

    body .ekash-filter-bar .ui-datepicker input,
    body .ekash-filter-bar input.ui-inputfield {
        width: 100%;
    }
}

/* --- DataTables: no header fill, hairline rows, no gridlines, no stripes ---
   (ui/table.tsx: th h-10 px-2 font-medium; td p-2; rows border-b only;
   hover muted/50; frame is the surrounding 16px-radius card.)             */
body .ui-datatable .ui-datatable-header {
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    font-weight: 600;
    padding: 12px 16px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    text-align: left;
}
body .ui-datatable thead th {
    background: var(--surface);
    border: none;
    border-bottom: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    height: 40px;
    padding: 4px 8px;
    text-align: left;
}
body .ui-datatable thead th .ui-column-title { color: var(--text-primary); }
body .ui-datatable thead th .ui-sortable-column-icon { color: var(--text-secondary); opacity: .5; }
body .ui-datatable thead th.ui-state-hover { background: var(--surface-1); color: var(--text-primary); }
body .ui-datatable thead th.ui-state-active,
body .ui-datatable thead th.ui-sortable-column.ui-state-active {
    background: var(--surface);
    color: var(--text-primary);
}
body .ui-datatable thead th.ui-state-active .ui-sortable-column-icon { color: var(--primary-600); opacity: 1; }
body .ui-datatable .ui-datatable-data > tr {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
body .ui-datatable .ui-datatable-data > tr.ui-datatable-odd { background: var(--surface); }
body .ui-datatable .ui-datatable-data > tr.ui-state-hover,
body .ui-datatable .ui-datatable-data > tr:hover {
    background: rgba(239, 239, 239, .5);
    color: var(--text-primary);
}
body .ui-datatable .ui-datatable-data > tr.ui-state-highlight,
body .ui-datatable .ui-datatable-data > tr.ui-state-highlight > td {
    background: var(--surface-muted);
    color: var(--text-primary);
}
/* horizontal hairlines only - kill every vertical/cell gridline, including
   the gridlines variant the tables declare. Selector shapes mirror saga's
   own (body .ui-datatable.ui-datatable-gridlines .ui-datatable-data > tr > td)
   so source order decides. */
body .ui-datatable tbody td,
body .ui-datatable .ui-datatable-data > tr > td,
body .ui-datatable.ui-datatable-gridlines .ui-datatable-data > tr > td {
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: var(--border-strong);
    padding: 8px;
    font-size: 14px;
}
body .ui-datatable thead th,
body .ui-datatable.ui-datatable-gridlines thead th,
body .ui-datatable.ui-datatable-gridlines thead > tr > th {
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: var(--border-strong);
}
body .ui-datatable.ui-datatable-gridlines .ui-datatable-header { border-width: 0 0 1px 0; }
body .ui-datatable .ui-datatable-data > tr:last-child > td { border-bottom: 0; }
body .ui-datatable tfoot td { border: none; }

/* Row actions: quiet outline buttons inside table rows (the app's table
   screens use sm outline buttons; solid gold everywhere is deafening).
   Explicit variants keep their meaning. */
body .ui-datatable .ui-datatable-data .ui-button {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-size: 12.8px;
    padding: .2rem .5rem;
}
body .ui-datatable .ui-datatable-data .ui-button:enabled:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
body .ui-datatable .ui-datatable-data .ui-button .ui-icon,
body .ui-datatable .ui-datatable-data .ui-button .ui-button-icon-left { color: var(--text-secondary); }
/* Row buttons are downgraded to a quiet outline above; destructive ones opt back
   out so a delete never looks like a passive icon. */
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger .ui-icon,
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger .ui-button-icon-left { color: #fff; }
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger:enabled:hover {
    background: #d40025;
    border-color: #d40025;
    color: #fff;
}
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger.ui-state-disabled,
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger:disabled {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--text-muted);
}
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger.ui-state-disabled .ui-icon,
body .ui-datatable .ui-datatable-data .ui-button.ui-button-danger:disabled .ui-icon { color: var(--text-muted); }
body .ui-datatable .ui-datatable-data .ui-button.ui-button-warning {
    background: var(--primary-50);
    border-color: transparent;
    color: var(--primary-600);
}

/* --- Paginator: borderless, quiet, gold current page --- */
body .ui-paginator {
    background: var(--surface);
    border: none;
    border-top: 1px solid var(--border-light);
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}
body .ui-datatable .ui-paginator-bottom { border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
body .ui-paginator .ui-paginator-page,
body .ui-paginator .ui-paginator-first,
body .ui-paginator .ui-paginator-prev,
body .ui-paginator .ui-paginator-next,
body .ui-paginator .ui-paginator-last {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-badge);
    min-width: 28px;
    height: 28px;
    line-height: 28px;
}
body .ui-paginator .ui-paginator-page.ui-state-active {
    background: var(--primary);
    border: none;
    color: var(--primary-foreground);
    font-weight: 600;
}
body .ui-paginator .ui-paginator-page:not(.ui-state-active):hover { background: var(--surface-muted); }
body .ui-paginator .ui-paginator-current { color: var(--text-secondary); }

/* --- Inputs: 32px, 12px radius, gold focus (ui/input.tsx) --- */
body .ui-inputfield, body .ui-inputtext {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    padding: .3rem .625rem;
    background: var(--surface);
}
body .ui-inputfield.ui-state-focus, body .ui-inputtext.ui-state-focus, body .ui-inputfield:focus {
    box-shadow: var(--focus-ring);
    border-color: var(--primary);
    outline: none;
}
body .ui-selectonemenu {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
body .ui-selectonemenu .ui-selectonemenu-label { font-size: 14px; padding: .3rem .625rem; }
body .ui-selectonemenu.ui-state-focus { box-shadow: var(--focus-ring); border-color: var(--primary); }
body .ui-selectonemenu-panel {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(51, 51, 51, .1);
    box-shadow: var(--shadow-subtle);
}
body .ui-selectonemenu-panel .ui-selectonemenu-items .ui-selectonemenu-item {
    font-size: 14px;
    border-radius: var(--radius-sm);
}
body .ui-selectonemenu-panel .ui-selectonemenu-items .ui-selectonemenu-item.ui-state-highlight {
    background: var(--primary-50);
    color: var(--text-primary);
}
body .ui-selectonemenu-panel .ui-selectonemenu-items .ui-selectonemenu-item:hover { background: var(--surface-muted); }

/* --- Checkboxes / radios: gold accent --- */
body .ui-chkbox .ui-chkbox-box.ui-state-active,
body .ui-radiobutton .ui-radiobutton-box.ui-state-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}
body .ui-chkbox .ui-chkbox-box.ui-state-focus,
body .ui-radiobutton .ui-radiobutton-box.ui-state-focus { box-shadow: var(--focus-ring); }

/* --- Dialogs: white, 16px radius, quiet titlebar (ui/dialog style) --- */
body .ui-dialog {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(51, 51, 51, .1);
    overflow: hidden;
}
body .ui-dialog .ui-dialog-titlebar {
    background: var(--surface);
    color: var(--text-primary);
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 14px 16px;
    border-radius: 0;
}
body .ui-dialog .ui-dialog-titlebar .ui-dialog-title {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 500;
}
body .ui-dialog .ui-dialog-titlebar .ui-dialog-titlebar-icon {
    color: var(--text-secondary);
    border-radius: var(--radius-badge);
}
body .ui-dialog .ui-dialog-titlebar .ui-dialog-titlebar-icon:hover {
    color: var(--text-primary);
    background: var(--surface-muted);
}
body .ui-dialog .ui-dialog-content { background: var(--surface); color: var(--text-primary); }

/* --- Growl / messages: status token pairs --- */
body .ui-growl-item-container { border-radius: var(--radius); box-shadow: var(--shadow-card); opacity: .98; }
body .ui-growl-message-info    { background: var(--status-onhold-bg);  color: var(--status-onhold-text); }
body .ui-growl-message-warn    { background: var(--status-warning-bg); color: var(--status-warning-text); }
body .ui-growl-message-error   { background: var(--status-refund-bg);  color: var(--status-refund-text); }
body .ui-growl-message-fatal   { background: var(--status-refund-bg);  color: var(--status-refund-text); }
body .ui-messages-info  { background: var(--status-onhold-bg);  border-color: var(--status-onhold-text);  color: var(--status-onhold-text); }
body .ui-messages-warn  { background: var(--status-warning-bg); border-color: var(--status-warning-text); color: var(--status-warning-text); }
body .ui-messages-error { background: var(--status-refund-bg);  border-color: var(--status-refund-text);  color: var(--status-refund-text); }

/* --- Panels / generic headers --- */
body .ui-widget-header {
    background: var(--surface-1);
    border-color: var(--border-light);
    color: var(--navy);
}
body .ui-widget-content { border-color: var(--border-light); }

/* --- Responsive (Phase 6) ---
   Wide grids (the payments table is 11 columns) scroll horizontally inside
   their own wrapper instead of forcing the page to; card layouts already
   reflow via PrimeFlex columns. */
body .ui-datatable .ui-datatable-tablewrapper { overflow-x: auto; }

/* The grids' flex header toolbars (inline display:flex styles in markup)
   wrap at EVERY width instead of clipping at the card edge. */
body .ui-datatable-header > div { flex-wrap: wrap; gap: .5rem; }

@media (max-width: 768px) {
    .container, .container-fluid { padding-inline: .5rem; }
}

/* Below 992px the fixed sidebar becomes a compact top strip and the page
   column reclaims the full width. */
@media (max-width: 992px) {
    .ekash-sidebar {
        position: static;
        width: 100%;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .ekash-brand { padding: 12px; }
    .ekash-brand-name { display: none; }
    .ekash-nav-list { flex-direction: row; padding: 8px; gap: 2px; }
    .ekash-nav-section { display: none; }
    a.ekash-nav-item { padding: 8px 10px; white-space: nowrap; }
    a.ekash-nav-item span { display: none; }
    a.ekash-nav-item .ekash-count-pill { display: inline-block; margin-left: 4px; }
    .ekash-topbar { margin-left: 0; height: 52px; padding: 0 12px; }
    body:has(.ekash-sidebar) main.ekash-page { margin-left: 0; }
    main.ekash-page { padding: 12px; }
}

/* =============================== 2. BASE ==================================
   The portal previously loaded Bootstrap's reboot on 16 of 30 pages; these
   are the reboot rules the markup actually relies on, now applied uniformly. */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.43;
    color: var(--text-primary);
    background-color: var(--surface-1);
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: .5rem;
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--navy);
}

label { display: inline-block; }
img { vertical-align: middle; }

/* ====================== 3. BOOTSTRAP-COMPAT LAYER =========================
   Bootstrap 5.0.2 (public CDN) was removed. Grid classes (row/col-*) were
   renamed to their PrimeFlex equivalents in markup; the component classes
   below had no PrimeFlex equivalent and are reimplemented here at visual
   parity. They get restyled onto the eKash design system in Phase 3/4.     */

.container {
    width: 100%;
    max-width: 1320px;
    margin-inline: auto;
    padding-inline: .75rem;
}

.container-fluid {
    width: 100%;
    margin-inline: auto;
    padding-inline: .75rem;
}

.card {
    position: relative;
    background-color: var(--surface);
    border: 1px solid rgba(51, 51, 51, .1);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

/* Inside the app shell the page-inner wrapper (max 1152px) is the width
   authority - legacy .container wrappers become passthrough there. */
.ekash-page-inner .container,
.ekash-page-inner .container-fluid {
    max-width: 100%;
    padding-inline: 0;
}

/* Forms (login / signup / inviteUser) */
.form-label { margin-bottom: .5rem; }

.form-control {
    display: block;
    width: 100%;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: .25rem;
}
.form-control:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: var(--focus-ring);
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}
.input-group > .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}
.input-group-text {
    display: flex;
    align-items: center;
    padding: .375rem .75rem;
    font-size: 1rem;
    color: #212529;
    text-align: center;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: .25rem 0 0 .25rem;
}
.input-group > .input-group-text:first-child + .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: .25rem;
    background-color: transparent;
    transition: color .15s, background-color .15s, border-color .15s;
}
.btn-primary {
    color: var(--primary-foreground);
    background-color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius-badge);
}
.btn-primary:hover {
    color: var(--primary-foreground);
    background-color: var(--primary-600);
    border-color: var(--primary-600);
}
.btn:disabled { opacity: .65; }

/* Validation states (login / signup client-side validation) */
.is-invalid { border-color: #dc3545; }
.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: .25rem;
    font-size: .875em;
    color: #dc3545;
}
.is-invalid ~ .invalid-feedback { display: block; }

/* Misc utilities used in markup that PrimeFlex does not provide */
.d-grid { display: grid; }
.shadow { box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15); }
.rounded { border-radius: .25rem; }
.bg-white { background-color: #fff; }
.text-danger { color: #dc3545; }

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

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -.125em;
    border: .25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ekash-spinner .75s linear infinite;
}
@keyframes ekash-spinner { to { transform: rotate(360deg); } }
.text-white { color: #fff; }

/* ======================= 4. SHARED PORTAL RULES ===========================
   Deduplicated from the per-page <style> blocks. Provenance noted inline.  */

/* Row hover - was `background-color:#5656` (invalid 4-digit hex, silently
   dropped by browsers) duplicated across 7 pages. Fixed to a real colour:
   this is the first time table row hover has ever worked in the portal.   */
.table-hover tbody tr:hover {
    background-color: var(--surface-1);
    cursor: pointer;
}

/* Compact table marker (clientsList attachments dialog, paymentsList,
   paymentReferenceSheet). The old 2px-padding cramping is retired - the
   14px/8px table spec above IS the compact look now; the class remains as
   a harmless hook. */
.small-table { font-size: 14px; }

/* Fixed-width ellipsis columns (paymentsList, paymentReferenceSheet).
   Kept the width lock; table-layout makes the !important unnecessary.     */
.fixed-width-column-text,
.fixed-width-column-label {
    width: 120px;
    max-width: 130px;
    min-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading dialog (identical copies in history, paymentsList,
   paymentReferenceSheet). De-!important'd - these selectors outrank the
   theme's .ui-dialog rules on their own.                                  */
body .ui-dialog.loading-dialog {
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    border-radius: 12px;
    border: none;
}
body .ui-dialog.loading-dialog .ui-dialog-content { padding: 1.5rem; }
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.loading-icon { font-size: 3rem; color: #2196F3; margin-bottom: 1rem; }
.loading-text { font-size: 1.2rem; font-weight: 500; color: #455A64; }
.loading-animation { position: relative; height: 4rem; width: 4rem; margin-bottom: 1rem; }
.loading-animation .pi-spinner { position: absolute; font-size: 4rem; color: #2196F3; }
.loading-icon-secondary {
    position: absolute;
    font-size: 1.8rem;
    color: #455A64;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Payment row colouring (paymentsList; deleteAccount carried a stale copy).
   The old rules needed !important to beat the theme's row striping; the
   selectors below outrank the striping rules instead. Re-mapped from the
   saturated legacy fills onto the design system's status pairs.            */
body .ui-datatable .ui-datatable-data > tr.sent,
body .ui-datatable .ui-datatable-data > tr.sent > td {
    background-color: var(--status-success-bg);
    background-image: none;
    color: var(--status-success-text);
}
body .ui-datatable .ui-datatable-data > tr.yellow,
body .ui-datatable .ui-datatable-data > tr.yellow > td {
    background-color: var(--status-warning-bg);
    background-image: none;
    color: var(--status-warning-text);
}
body .ui-datatable .ui-datatable-data > tr.red,
body .ui-datatable .ui-datatable-data > tr.red > td {
    background-color: var(--status-refund-bg);
    background-image: none;
    color: var(--status-refund-text);
}
/* On-hold client marker. Was `background:red;color:white` (~4.0:1, below AA)
   and colour-only; now the AA-safe on-hold pair, and the grids add a lock
   icon + screen-reader text so the state is not conveyed by colour alone
   (WCAG 1.4.1). */
.red-row { background-color: var(--status-onhold-bg); color: var(--status-onhold-text); }
.onhold-indicator { margin-left: .35rem; color: var(--status-onhold-text); white-space: nowrap; }

/* Status badges (paymentsList set - the canonical one; providerBalances'
   pill variant is scoped under .balances-page in its page section).
   Values are the eKash status pairs - AA contrast at badge size.          */
/* Geometry per ui/badge.tsx: 12px semibold, 4px/12px padding, 8px radius,
   Title Case labels - NOT uppercase pills. */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-badge);
    font-weight: 600;
    font-size: 12px;
    line-height: 16px;
    text-transform: capitalize;
    white-space: nowrap;
}
.status-success   { background-color: var(--status-success-bg);  color: var(--status-success-text); }
.status-warning   { background-color: var(--status-warning-bg);  color: var(--status-warning-text); }
.status-ready     { background-color: var(--status-onhold-bg);   color: var(--status-onhold-text); }
.status-danger    { background-color: var(--status-refund-bg);   color: var(--status-refund-text); }
.status-canceled  { background-color: var(--status-canceled-bg); color: var(--status-canceled-text); }
.status-unclaimed { background-color: #ecd6c0; color: #60472d; }
.status-info      { background-color: var(--status-onhold-bg);   color: var(--status-onhold-text); }

/* "Still processing" count badge on the Clients grid (the sidebar pill is
   .ekash-count-pill in the shell section). Brand rule: red is a signal,
   never a fill - count in danger red on white with a red border.          */
body .ui-badge.ekash-count-badge {
    background: var(--surface);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 999px;
    font-weight: 700;
    font-size: 11px;
    min-width: 1.3rem;
    height: auto;
    line-height: 1.2;
    padding: 2px 8px;
}
body .ui-badge.ekash-count-badge .ui-badge-label {
    color: var(--danger);
    font-weight: 700;
}
body .ui-badge:empty { display: none; }

/* ========================= 5. PER-PAGE SECTIONS =========================== */

/* ------------------------------ login ------------------------------------ */
.error-message {
    color: #e74c3c;
    font-size: 14px;
    font-weight: bold;
    margin-top: 8px;
    display: block;
}
.form-left { background: #fff; border-radius: 10px; }
input.form-control { padding: 10px; }
button.btn-primary { font-size: 1.2rem; padding: 10px; }
.btn:disabled { position: relative; pointer-events: none; }
.btn:disabled #spinner { display: inline-block; }

/* ------------------------------- home ------------------------------------ */
.legacy .ui-panel, .legacy.div.ui-state-hover { margin: 10px; }
.legacy .ui-dashboard-column { width: 220px; }
body .ui-dashboard-active {
    /* was `var(- -primary-color)` - malformed (space inside the dashes) and
       silently dropped since it was written. Points at the theme token now. */
    border-color: var(--primary-color);
    border-width: 3px;
    border-style: dashed;
}
body .ui-dashboard-hover {
    border-color: #C2E085;
    border-width: 3px;
    border-style: solid;
}
body .ui-panel.chart-dashlet .ui-panel-content .ui-chart {
    height: 250px;
    max-height: 250px;
}

/* --------------------- paymentReferenceSheet ----------------------------- */
.download-menu { display: inline-block; }

/* ------------------------------ 403 --------------------------------------
   The original page styled body/html/a globally (dark page, white links);
   in a consolidated stylesheet those rules would restyle every page, so
   everything is scoped under .page-403 (added to the page's root element). */
.page-403 {
    min-height: 100vh;
    background-color: #27272a;
    padding: 10px;
    font-family: 'Raleway', sans-serif;
}
.page-403 a, .page-403 a:hover { color: #FFFFFF; text-decoration: none; }
.page-403 .text-wrapper {
    min-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.page-403 .title { font-size: 5em; font-weight: 700; color: #1FA9D6; }
.page-403 .subtitle { font-size: 40px; font-weight: 700; color: #1FA9D6; }
.page-403 .isi {
    font-size: 18px;
    text-align: center;
    margin: 30px;
    padding: 20px;
    color: white;
}
.page-403 .buttons {
    margin: 30px;
    font-weight: 700;
    border: 2px solid #1FA9D6;
    text-decoration: none;
    padding: 15px;
    text-transform: uppercase;
    color: #FFFFFF;
    border-radius: 26px;
    transition: all .2s ease-in-out;
    display: inline-block;
}
.page-403 .buttons:hover { background-color: #1FA9D6; }

/* ------------------------- providerBalances ------------------------------ */
.balances-page { padding: 2% 6%; max-width: 1400px; margin: 0 auto; }
.grand-total-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d6a9f 100%);
    color: #fff;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(30, 58, 95, .25);
}
.grand-total-card .headline { font-size: 2.5rem; font-weight: 700; margin: 0; }
.grand-total-card .sub-metric { font-size: 1.1rem; opacity: .9; }
.grand-total-card .footnote { font-size: .8rem; opacity: .75; margin-top: 1rem; }
.liquidity-card {
    border-radius: 16px;
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.liquidity-card .headline { font-size: 2rem; font-weight: 700; color: #1e3a5f; margin: 0; }
.provider-panel {
    border-radius: 12px;
    border: 1px solid #dee2e6;
    padding: 1.25rem;
    height: 100%;
    background: #fff;
    min-width: 0;
    overflow: hidden;
}
.provider-panel.wise { border-top: 4px solid #9fe870; }
.provider-panel.paypal { border-top: 4px solid #003087; }
.provider-panel.payoneer { border-top: 4px solid #ff4800; }
.provider-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.provider-panel-header h5 { margin: 0; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.provider-panel-header .status-badge { flex: 0 0 auto; white-space: nowrap; max-width: 100%; }
.provider-metric-list { list-style: none; padding: 0; margin: 0; }
.provider-metric-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    padding: .4rem 0;
    border-bottom: 1px solid #f1f3f5;
    min-width: 0;
}
.provider-metric-list li:last-child { border-bottom: none; }
.provider-metric-list .metric-label { color: #6c757d; font-size: .8rem; flex: 0 0 auto; }
.provider-metric-list .metric-value {
    font-weight: 600;
    text-align: right;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.provider-meta {
    font-size: .78rem;
    line-height: 1.45;
    margin-top: .75rem;
    color: #6c757d;
    word-break: break-word;
}
.provider-meta .meta-line { display: block; margin-top: .2rem; }
/* providerBalances' pill-shaped badge variant, scoped to avoid fighting the
   canonical .status-badge above */
.balances-page .status-badge {
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}
.status-ok    { background: #d1e7dd; color: #0f5132; }
.status-error { background: #f8d7da; color: #842029; }
.status-warn  { background: #fff3cd; color: #664d03; }
.balance-currency-card {
    border-radius: 10px;
    border: 1px solid #e9ecef;
    padding: 1rem;
    background: #fafbfc;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}
.balance-currency-card .currency-code { font-size: 1.1rem; font-weight: 700; color: #212529; }
.balance-currency-card .metric-row { margin-top: .65rem; min-width: 0; }
.balance-currency-card .metric-row small { display: block; margin-bottom: .15rem; }
.metric-available { color: #198754; font-weight: 600; word-break: break-word; overflow-wrap: anywhere; line-height: 1.35; }
.metric-pending { color: #fd7e14; font-weight: 600; word-break: break-word; overflow-wrap: anywhere; line-height: 1.35; }
.metric-total { color: #212529; font-weight: 700; font-size: 1.05rem; word-break: break-word; overflow-wrap: anywhere; line-height: 1.35; }
.section-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 1rem; color: #343a40; }
.section-block { margin-bottom: 2rem; }
.error-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.info-banner {
    background: #e7f1ff;
    border: 1px solid #b6d4fe;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .85rem;
    color: #084298;
}
.stat-tile.unavailable { opacity: .55; }
.stat-unavailable { font-size: 1.1rem; font-weight: 600; color: #6c757d; }
.activity-panel {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 1.25rem;
    height: 100%;
    background: #fff;
}
.activity-panel.wise { border-left: 4px solid #9fe870; }
.activity-panel.paypal { border-left: 4px solid #003087; }
.stat-tile { border-radius: 10px; background: #f8f9fa; padding: .9rem 1rem; height: 100%; }
.stat-tile .stat-label {
    font-size: .78rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .25rem;
}
.stat-tile .stat-value { font-size: 1.5rem; font-weight: 700; color: #212529; line-height: 1.2; }
.stat-tile .stat-value.money { font-size: 1.2rem; color: #1e3a5f; }
.stat-tile .stat-value.warn { color: #b45309; }
.stat-tile .stat-value.alert { color: #842029; }
.stat-tile .stat-hint { font-size: .75rem; color: #adb5bd; margin-top: .15rem; }
.subsection-label {
    font-size: .8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 1rem 0 .75rem;
}

/* ===========================================================================
   14. DASHBOARD (home.xhtml)

   Two blocks: a row of queue counters, then a 2-up grid of chart cards. The
   chart cards are `.card` plus a fixed-height body, because every chart here
   runs with maintainAspectRatio:false - Chart.js then sizes the canvas from
   its container, and a container with no height collapses to zero.
   =========================================================================== */

.ekash-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ekash-stat {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    padding: 1.125rem 1.25rem;
    background: var(--surface);
    border: 1px solid rgba(51, 51, 51, .1);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: inherit;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

/* Only the cards that actually go somewhere react to the pointer. */
a.ekash-stat:hover {
    box-shadow: var(--shadow-subtle);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    text-decoration: none;
}
a.ekash-stat:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ekash-stat--static { cursor: default; }

.ekash-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    font-size: 18px;
}

.ekash-stat-body { display: flex; flex-direction: column; min-width: 0; }

.ekash-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
}

.ekash-stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-primary);
    margin-top: 2px;
}

/* Wraps rather than truncating: at four-up these hints are ~35 characters in a ~200px
   column, so an ellipsis clipped every one of them mid-sentence. The grid row stretches
   cards to a common height, so a two-line hint does not leave the row ragged. */
.ekash-stat-hint {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Pushed to the far edge so the chevron reads as "this card is a link". */
.ekash-stat-go {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 14px;
    color: var(--text-muted);
}

.ekash-stat--warning .ekash-stat-icon { background: var(--primary-50);        color: var(--primary-600); }
.ekash-stat--primary .ekash-stat-icon { background: var(--surface-2);          color: var(--navy); }
.ekash-stat--info    .ekash-stat-icon { background: var(--status-onhold-bg);   color: var(--status-onhold-text); }
.ekash-stat--success .ekash-stat-icon { background: var(--status-success-bg);  color: var(--status-success-text); }

/* --- chart cards --- */

.ekash-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.ekash-chart-card { padding: 1.25rem 1.5rem 1.5rem; }

.ekash-chart-head { margin-bottom: 1rem; }

.ekash-chart-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.ekash-chart-sub {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Fixed height: see the block comment at the top of this section. */
.ekash-chart-body { height: 260px; }

/* --- donut + its HTML legend --- */

.ekash-donut-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* min-width:0 is load-bearing, not tidying. A <canvas> carries an intrinsic 300x150
   size, and a flex item's default min-width:auto resolves to its content's min-content
   width - which beats flex-basis. Without this the donut renders 300px wide instead of
   200px and steals the space the legend needs, clipping "Automation success" and
   "Automation fail" to the same "Automati...". */
.ekash-donut {
    flex: 0 0 200px;
    min-width: 0;
    height: 200px;
}

.ekash-legend {
    flex: 1 1 auto;
    min-width: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ekash-legend-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.4;
}

.ekash-legend-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.ekash-legend-label {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tabular figures so the counts and shares line up as columns. */
.ekash-legend-count {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.ekash-legend-share {
    flex: 0 0 46px;
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* --- currency converter --- */

.ekash-fx-row {
    display: flex;
    align-items: flex-end;
    gap: .75rem;
}

.ekash-fx-field { flex: 1 1 0; min-width: 0; }

.ekash-fx-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* The amount and its currency read as one control, so they share a border and
   only the outer corners are rounded. */
.ekash-fx-input { display: flex; }

body .ekash-fx-input .ekash-fx-amount {
    flex: 1 1 auto;
    min-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* min-width covers the label plus the dropdown trigger. PrimeFaces positions that
   trigger absolutely over the menu, so at the width this shrinks to on its own (49px,
   with a 38px trigger) the chevron lands on top of the "USD". */
body .ekash-fx-input .ekash-fx-currency {
    flex: 0 0 auto;
    min-width: 92px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
    background: var(--surface-1);
}

body .ekash-fx-swap.ui-button {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    margin-bottom: 1px;
    border-radius: 50%;
    color: var(--text-secondary);
}
body .ekash-fx-swap.ui-button:hover { background: var(--primary-50); color: var(--primary-600); }

.ekash-fx-rate {
    display: block;
    margin-top: .875rem;
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-height: 18px;
}

@media (max-width: 640px) {
    /* Under ~640px a 200px donut beside a legend leaves neither enough room. */
    .ekash-donut-wrap { flex-direction: column; align-items: stretch; }
    .ekash-donut { flex: 0 0 190px; height: 190px; }
    .ekash-legend { width: 100%; }

    .ekash-fx-row { flex-direction: column; align-items: stretch; }
    body .ekash-fx-swap.ui-button { align-self: center; transform: rotate(90deg); margin: 0; }
}
