/*!
 * EximIN Enterprise UI — eximin.css
 * SAP Fiori / MS Dynamics inspired design system on top of Bootstrap 5.3.
 * Theme switching via [data-bs-theme="light" | "dark"] on <html>.
 */

/* ============================================================ */
/* 1. Design tokens                                             */
/* ============================================================ */
:root {
    --ex-primary: #0a6ed1;          /* Fiori blue */
    --ex-primary-hover: #085caf;
    --ex-primary-subtle: #e8f2fc;
    --ex-secondary: #6a6d70;
    --ex-success: #107e3e;
    --ex-warning: #e9730c;
    --ex-danger: #bb0000;
    --ex-info: #0f828f;

    --ex-shell-bg: #f5f6f7;
    --ex-surface: #ffffff;
    --ex-surface-2: #fafbfc;
    --ex-border: #e2e6ea;
    --ex-text: #32363a;
    --ex-text-muted: #6a6d70;

    --ex-header-h: 3.25rem;
    --ex-sidebar-w: 16rem;
    --ex-sidebar-w-collapsed: 3.5rem;
    --ex-radius: 0.5rem;
    --ex-radius-sm: 0.375rem;

    --ex-shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.06), 0 1px 4px rgba(20, 30, 40, 0.06);
    --ex-shadow: 0 2px 6px rgba(20, 30, 40, 0.08), 0 4px 16px rgba(20, 30, 40, 0.06);
    --ex-shadow-lg: 0 8px 28px rgba(20, 30, 40, 0.16);

    --ex-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --ex-density-y: 0.45rem;        /* compact enterprise density */

    /* Single source of truth for the menu type scale. Form labels, inputs,
       selects and Select2 all read these, so the content area can never drift
       away from the sidebar again — it had, to 0.82/0.84/0.86rem. */
    --ex-font-size-menu: 0.8rem;        /* sidebar top-level nav-link */
    --ex-font-size-menu-sub: 0.76rem;   /* sidebar sub-nav link */

    --bs-primary: var(--ex-primary);
    --bs-primary-rgb: 10, 110, 209;
    --bs-body-font-family: var(--ex-font);

    /* Icon accent palette (menus, document flow, decorative icons) */
    --ex-icon-1: #0a6ed1;   /* blue */
    --ex-icon-2: #107e3e;   /* green */
    --ex-icon-3: #e9730c;   /* orange */
    --ex-icon-4: #7c3aed;   /* purple */
    --ex-icon-5: #0f828f;   /* teal */
    --ex-icon-6: #c2185b;   /* pink */
    --ex-icon-7: #b45309;   /* amber */
    --ex-icon-8: #d02670;   /* magenta */
}

[data-bs-theme="dark"] {
    --ex-primary: #4db1ff;
    --ex-primary-hover: #6cc0ff;
    --ex-primary-subtle: #10263c;
    --ex-shell-bg: #12171c;
    --ex-surface: #1c2228;
    --ex-surface-2: #171d23;
    --ex-border: #2c343c;
    --ex-text: #e4e8ec;
    --ex-text-muted: #97a0a9;
    --ex-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --ex-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    --ex-shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.6);
    --bs-primary-rgb: 77, 177, 255;

    /* Brighter icon accents for dark surfaces */
    --ex-icon-1: #4db1ff;
    --ex-icon-2: #4cd07d;
    --ex-icon-3: #ffa04d;
    --ex-icon-4: #b18aff;
    --ex-icon-5: #4dd0e1;
    --ex-icon-6: #ff7ab0;
    --ex-icon-7: #ffc247;
    --ex-icon-8: #ff7ac2;
}

/* ============================================================ */
/* 2. Shell layout                                              */
/* ============================================================ */
html, body { height: 100%; }

body.ex-shell {
    background: var(--ex-shell-bg);
    color: var(--ex-text);
    font-family: var(--ex-font);
    font-size: 0.875rem;
    padding-top: var(--ex-header-h);
    overflow-x: hidden;
}

/* --- Header --- */
.ex-header {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--ex-header-h);
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    background: var(--ex-surface);
    border-bottom: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-sm);
}

.ex-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ex-primary);
    text-decoration: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.ex-brand:hover { color: var(--ex-primary-hover); }
.ex-brand .ex-brand-logo { height: 1.75rem; width: auto; display: block; }
.ex-brand .ex-brand-icon { height: 1.75rem; width: auto; }
/* The blue logo needs to read on the dark header surface, same trick as the
   login brand panel. */
[data-bs-theme="dark"] .ex-brand .ex-brand-logo,
[data-bs-theme="dark"] .ex-brand .ex-brand-icon { filter: brightness(0) invert(1); opacity: 0.92; }
.ex-brand .ex-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.45rem;
    background: linear-gradient(135deg, var(--ex-primary), #0f828f);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
}

.ex-header .ex-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ex-text-muted);
    font-size: 1.05rem;
    position: relative;
}
.ex-header .ex-icon-btn:hover { background: var(--ex-primary-subtle); color: var(--ex-primary); }

/* Colorful header icons */
.ex-header .bi-moon-stars, .ex-header .bi-sun { color: var(--ex-icon-4); }
.ex-header .bi-bell { color: var(--ex-icon-3); }
.ex-header .ex-search-icon { color: var(--ex-icon-1); }

.ex-badge-dot {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 1rem;
    background: var(--ex-danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
}

/* Global search */
/* Header centre zone: global search + the assistant launcher, kept together
   in the middle of the bar so both are reachable from every screen. */
.ex-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.ex-global-search { max-width: 26rem; flex: 1 1 auto; }
.ex-global-search .form-control {
    background: var(--ex-shell-bg);
    border-color: transparent;
    border-radius: 2rem;
    padding-left: 2.4rem;
    font-size: 0.85rem;
}
.ex-global-search .form-control:focus {
    background: var(--ex-surface);
    border-color: var(--ex-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}
.ex-global-search .ex-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ex-text-muted);
    pointer-events: none;
}

/* --- Assistant: header launcher + docked panel --- */
.ex-assistant-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    border: 0;
    border-radius: 2rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: #fff;
    background: linear-gradient(135deg, var(--ex-primary), #6f42c1);
}
.ex-assistant-launcher:hover,
.ex-assistant-launcher.is-active { filter: brightness(1.08); }
.ex-assistant-launcher:focus-visible { outline: 2px solid var(--ex-primary); outline-offset: 2px; }
.ex-assistant-launcher .bi { font-size: 0.95rem; }

/* Anchored under the launcher it belongs to, not floating in a corner. */
.ex-assistant-panel {
    position: fixed;
    top: calc(var(--ex-header-h) + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1045;
    display: flex;
    flex-direction: column;
    width: min(32rem, calc(100vw - 2rem));
    height: min(32rem, calc(100vh - var(--ex-header-h) - 2rem));
    background: var(--ex-surface);
    color: var(--bs-body-color);
    border: 1px solid var(--ex-border);
    border-radius: 0.75rem;
    box-shadow: var(--ex-shadow-lg);
    overflow: hidden;
}
.ex-assistant-panel[hidden] { display: none; }

.ex-assistant-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--ex-border);
    background: var(--ex-shell-bg);
}
.ex-assistant-sub { font-size: 0.72rem; color: var(--ex-text-muted); }
.ex-assistant-head-actions { display: flex; gap: 0.1rem; }

.ex-assistant-log { flex: 1 1 auto; overflow-y: auto; padding: 0.85rem; font-size: 0.82rem; }
.ex-assistant-intro { color: var(--ex-text-muted); }

.ex-assistant-chip {
    border: 1px solid var(--ex-border);
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.35rem 0.6rem;
    text-align: left;
    font-size: 0.78rem;
    color: var(--bs-body-color);
}
.ex-assistant-chip:hover { background: var(--ex-shell-bg); }

.ex-assistant-msg { margin-bottom: 0.75rem; display: flex; }
.ex-assistant-msg.is-user { justify-content: flex-end; }
.ex-assistant-bubble {
    max-width: 88%;
    padding: 0.5rem 0.7rem;
    border-radius: 0.6rem;
    background: var(--ex-shell-bg);
    border: 1px solid var(--ex-border);
    overflow-wrap: anywhere;
}
.ex-assistant-msg.is-user .ex-assistant-bubble {
    background: var(--ex-primary);
    border-color: var(--ex-primary);
    color: #fff;
}
.ex-assistant-bubble p { margin: 0 0 0.4rem; }
.ex-assistant-bubble p:last-child { margin-bottom: 0; }
.ex-assistant-bubble ul { margin: 0 0 0.4rem; padding-left: 1.1rem; }
.ex-assistant-bubble a { text-decoration: underline; }

.ex-assistant-links { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.ex-assistant-links a {
    font-size: 0.72rem;
    padding: 0.18rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid var(--ex-primary);
    color: var(--ex-primary);
    text-decoration: none;
}
.ex-assistant-links a:hover { background: var(--ex-primary); color: #fff; }

.ex-assistant-form {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem 0.7rem;
    border-top: 1px solid var(--ex-border);
}

/* Notification dropdown */
.ex-notif-menu { width: 22rem; max-height: 24rem; overflow-y: auto; }
.ex-notif-item { display: flex; gap: 0.65rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--ex-border); }
.ex-notif-item:last-child { border-bottom: 0; }
.ex-notif-item .ex-notif-icon {
    flex: 0 0 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ex-primary-subtle);
    color: var(--ex-primary);
}
.ex-notif-item .ex-notif-title { font-weight: 600; font-size: 0.82rem; }
.ex-notif-item .ex-notif-body { font-size: 0.78rem; color: var(--ex-text-muted); }

.ex-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--ex-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* --- Sidebar --- */
.ex-sidebar {
    position: fixed;
    top: var(--ex-header-h);
    bottom: 0;
    left: 0;
    width: var(--ex-sidebar-w);
    z-index: 1030;
    background: var(--ex-surface);
    border-right: 1px solid var(--ex-border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.18s ease;
    scrollbar-width: thin;
}

.ex-sidebar .ex-nav { list-style: none; margin: 0; padding: 0.5rem 0.5rem 3rem; }
.ex-sidebar .ex-nav-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ex-text-muted);
    padding: 0.85rem 0.75rem 0.3rem;
    white-space: nowrap;
}
.ex-sidebar .ex-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: var(--ex-density-y) 0.75rem;
    border-radius: var(--ex-radius-sm);
    color: var(--ex-text);
    text-decoration: none;
    font-size: var(--ex-font-size-menu);
    white-space: normal;
    border-left: 3px solid transparent;
}
/* Long titles shrink-to-fit first, then wrap inside the rail. */
.ex-sidebar .ex-nav-link span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.ex-sidebar .ex-nav-link i { font-size: 1rem; width: 1.25rem; text-align: center; flex: 0 0 auto; color: var(--ex-text-muted); }
.ex-sidebar .ex-nav-link:hover { background: var(--ex-primary-subtle); color: var(--ex-primary); }
.ex-sidebar .ex-nav-link:hover i { color: var(--ex-primary); }
.ex-sidebar .ex-nav-link.active {
    background: var(--ex-primary-subtle);
    color: var(--ex-primary);
    font-weight: 600;
    border-left-color: var(--ex-primary);
}
.ex-sidebar .ex-nav-link.active i { color: var(--ex-primary); }
.ex-sidebar .ex-nav-link .ex-caret { margin-left: auto; font-size: 0.7rem; transition: transform 0.15s ease; }
.ex-sidebar .ex-nav-link[aria-expanded="true"] .ex-caret { transform: rotate(90deg); }
.ex-sidebar .ex-subnav { list-style: none; padding-left: 1.6rem; }
.ex-sidebar .ex-subnav .ex-nav-link { padding: 0.35rem 0.6rem; font-size: var(--ex-font-size-menu-sub); }

/* Colorful menu icons — 8-color cycle, kept on hover/active */
.ex-sidebar .ex-nav > li:nth-child(8n+1) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+1) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-1); }
.ex-sidebar .ex-nav > li:nth-child(8n+2) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+2) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-2); }
.ex-sidebar .ex-nav > li:nth-child(8n+3) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+3) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-3); }
.ex-sidebar .ex-nav > li:nth-child(8n+4) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+4) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-4); }
.ex-sidebar .ex-nav > li:nth-child(8n+5) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+5) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-5); }
.ex-sidebar .ex-nav > li:nth-child(8n+6) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+6) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-6); }
.ex-sidebar .ex-nav > li:nth-child(8n+7) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+7) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-7); }
.ex-sidebar .ex-nav > li:nth-child(8n+8) > .ex-nav-link > i.bi:first-child,
.ex-sidebar .ex-subnav > li:nth-child(8n+8) .ex-nav-link > i.bi:first-child { color: var(--ex-icon-8); }

/* Collapsed (icon-only) sidebar */
body.ex-sidebar-collapsed .ex-sidebar { width: var(--ex-sidebar-w-collapsed); }
body.ex-sidebar-collapsed .ex-sidebar .ex-nav-label,
body.ex-sidebar-collapsed .ex-sidebar .ex-nav-link span,
body.ex-sidebar-collapsed .ex-sidebar .ex-nav-link .ex-caret,
body.ex-sidebar-collapsed .ex-sidebar .ex-subnav { display: none; }
body.ex-sidebar-collapsed .ex-sidebar .ex-nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
body.ex-sidebar-collapsed .ex-main { margin-left: var(--ex-sidebar-w-collapsed); }

/* --- Main + footer --- */
.ex-main {
    margin-left: var(--ex-sidebar-w);
    min-height: calc(100vh - var(--ex-header-h));
    display: flex;
    flex-direction: column;
    transition: margin-left 0.18s ease;
}
.ex-content { flex: 1 1 auto; padding: 1.25rem 1.5rem; }
.ex-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ex-footer a:hover { color: var(--ex-primary, inherit); }

.ex-footer {
    padding: 0.6rem 1.5rem;
    border-top: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 0.78rem;
    background: var(--ex-surface);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 991.98px) {
    .ex-sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
    body.ex-sidebar-mobile-open .ex-sidebar { transform: translateX(0); box-shadow: var(--ex-shadow-lg); }
    .ex-main, body.ex-sidebar-collapsed .ex-main { margin-left: 0; }
    .ex-global-search { display: none; }

    /* The search folds away on small screens; the assistant stays, as an icon. */
    .ex-assistant-launcher { padding: 0.4rem 0.6rem; }
    .ex-assistant-launcher-text { display: none; }
}

/* ============================================================ */
/* 3. Cards / widgets                                           */
/* ============================================================ */
.card { border-color: var(--ex-border); border-radius: var(--ex-radius); box-shadow: var(--ex-shadow-sm); }
.card > .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ex-border);
    font-weight: 600;
    padding: 0.7rem 1rem;
}

.ex-page-header { margin-bottom: 1.1rem; }
.ex-page-header .ex-page-title { font-size: 1.3rem; font-weight: 700; margin: 0; }
.ex-page-header .ex-page-subtitle { color: var(--ex-text-muted); font-size: 0.84rem; margin: 0.1rem 0 0; }
.ex-page-header .breadcrumb { margin: 0 0 0.25rem; font-size: 0.78rem; }

/* Stat card */
.ex-stat-card { position: relative; overflow: hidden; height: 100%; }
.ex-stat-card .card-body { padding: 0.9rem 1rem 0.7rem; }
.ex-stat-card .ex-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ex-text-muted);
    font-weight: 600;
}
.ex-stat-card .ex-stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ex-stat-card .ex-stat-delta { font-size: 0.75rem; font-weight: 600; }
.ex-stat-card .ex-stat-delta.up { color: var(--ex-success); }
.ex-stat-card .ex-stat-delta.down { color: var(--ex-danger); }
.ex-stat-card .ex-stat-icon {
    position: absolute;
    top: 0.8rem;
    right: 0.9rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    background: var(--ex-primary-subtle);
    color: var(--ex-primary);
}
.ex-stat-card .ex-stat-spark { height: 34px; margin: 0.35rem -0.25rem -0.3rem; }
.ex-stat-card.border-start-accent { border-left: 3px solid var(--ex-primary); }

/* Gauge KPI — semicircular dial; the arc is the headline, the number stays small */
.ex-gauge-kpi { transition: transform .12s ease, box-shadow .12s ease; }
a.ex-gauge-kpi:hover { transform: translateY(-2px); box-shadow: var(--bs-box-shadow-sm); }
.ex-gauge-kpi .ex-gauge-title {
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--bs-secondary-color);
}
.ex-gauge-kpi .ex-gauge-icon { font-size: .78rem; flex: none; }
.ex-gauge-kpi .ex-gauge-dial { position: relative; margin: .15rem 0 .1rem; }
.ex-gauge-kpi .ex-gauge-svg { display: block; width: 100%; max-width: 104px; margin: 0 auto; overflow: visible; }
.ex-gauge-kpi .ex-gauge-track {
    fill: none;
    stroke: var(--bs-secondary-bg);
    stroke-width: 8;
    stroke-linecap: round;
}
.ex-gauge-kpi .ex-gauge-arc {
    fill: none;
    stroke: currentColor;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset .5s ease;
}
.ex-gauge-kpi .ex-gauge-pct {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--bs-body-color);
}
.ex-gauge-kpi .ex-gauge-value {
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-gauge-kpi .ex-gauge-caption {
    font-size: .63rem;
    line-height: 1.25;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (prefers-reduced-motion: reduce) {
    .ex-gauge-kpi .ex-gauge-arc { transition: none; }
}

/* Chart KPI — SAP analytic-card anatomy (dashboard-kpi.png): bold title,
   muted qualifier, big light figure, then a labeled mini chart with y-axis
   gutter, gridlines, point value labels and a bottom legend. */
.ex-kpi-card { transition: transform .12s ease, box-shadow .12s ease; }
a.ex-kpi-card:hover { transform: translateY(-2px); box-shadow: var(--bs-box-shadow-sm); }
.ex-kpi-card .ex-kpi-title {
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.25;
}
.ex-kpi-card .ex-kpi-sub {
    font-size: .68rem;
    color: var(--bs-secondary-color);
    min-height: 1em;
}
.ex-kpi-card .ex-kpi-value {
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ex-kpi-card .ex-kpi-delta {
    font-size: .68rem;
    font-weight: 600;
    line-height: 1;
    flex: none;
    font-variant-numeric: tabular-nums;
}
.ex-kpi-card .ex-kpi-delta.up { color: var(--bs-success); }
.ex-kpi-card .ex-kpi-delta.down { color: var(--bs-danger); }
.ex-kpi-card .ex-kpi-delta .bi { font-size: .8rem; vertical-align: -.1em; }

/* top margin leaves headroom for the peak value label */
.ex-kpi-card .ex-kpi-chart { margin: .9rem 0 .1rem; }
.ex-kpi-card .ex-kpi-plotwrap { display: flex; align-items: stretch; gap: .35rem; }
.ex-kpi-card .ex-kpi-yaxis { position: relative; flex: 0 0 2.1rem; }
.ex-kpi-card .ex-kpi-ylabel {
    position: absolute;
    right: 0;
    transform: translateY(-50%);
    font-size: .6rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ex-kpi-card .ex-kpi-plotarea { position: relative; flex: 1 1 auto; height: 72px; min-width: 0; }
.ex-kpi-card .ex-kpi-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ex-kpi-card .ex-kpi-grid { stroke: var(--bs-border-color); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ex-kpi-card .ex-kpi-grid.is-base { stroke: var(--bs-secondary-color); opacity: .55; }
.ex-kpi-card .ex-kpi-bar { fill: currentColor; opacity: .9; }
.ex-kpi-card .ex-kpi-bar.is-current { opacity: 1; }
.ex-kpi-card .ex-kpi-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.ex-kpi-card .ex-kpi-flat {
    stroke: var(--bs-secondary-bg);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}
.ex-kpi-card .ex-kpi-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.ex-kpi-card .ex-kpi-plabel {
    position: absolute;
    transform: translate(-50%, -135%);
    font-size: .6rem;
    font-weight: 600;
    line-height: 1;
    color: var(--bs-body-color);
    background: color-mix(in srgb, var(--bs-body-bg) 78%, transparent);
    padding: 0 .15rem;
    border-radius: .2rem;
    white-space: nowrap;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.ex-kpi-card .ex-kpi-xaxis {
    display: flex;
    justify-content: space-between;
    gap: .25rem;
    margin: .2rem 0 0 2.45rem;  /* clear of the y-axis gutter */
    font-size: .6rem;
    line-height: 1.2;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}
.ex-kpi-card .ex-kpi-legend {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .4rem;
    font-size: .66rem;
    color: var(--bs-secondary-color);
    min-width: 0;
}
.ex-kpi-card .ex-kpi-legend-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-kpi-card .ex-kpi-swatch { flex: none; width: .6rem; height: .6rem; border-radius: .15rem; background: currentColor; }
.ex-kpi-card .ex-kpi-swatch.line { height: 3px; width: .9rem; border-radius: 2px; position: relative; }
.ex-kpi-card .ex-kpi-swatch.line::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    transform: translate(-50%, -50%);
}

/* Breakdown cards — SAP chart palette (sapChart_OrderedColor 1-6), consumed
   via currentColor by donut strokes, column fills and legend swatches. */
.ex-seg-0 { color: #1b90ff; }
.ex-seg-1 { color: #e76500; }
.ex-seg-2 { color: #36a41d; }
.ex-seg-3 { color: #fa4f96; }
.ex-seg-4 { color: #7800a4; }
.ex-seg-5 { color: #049f9a; }
.ex-kpi-card .ex-kpi-chart.is-donut { margin-top: .5rem; }
.ex-kpi-card .ex-kpi-plotarea.is-donut { position: static; height: auto; }
.ex-kpi-card .ex-kpi-donut { display: block; width: 100%; height: 118px; }
.ex-kpi-card .ex-kpi-seg { stroke: currentColor; stroke-width: 15; }
.ex-kpi-card .ex-kpi-donut-label {
    font-size: 7px;
    font-weight: 600;
    fill: var(--bs-body-color);
}
.ex-kpi-card .ex-kpi-colbar { fill: currentColor; }
.ex-kpi-card .ex-kpi-seglegend {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem .7rem;
}
.ex-kpi-card .ex-kpi-legend-item {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-width: 0;
    max-width: 100%;
}

/* SAP monitor-page widget patterns (graph3.jpg): initiative progress rows,
   goal blocks with a status stripe, quick-link rows with chevrons. */
.ex-sap-count { font-size: .72rem; font-weight: 500; color: var(--bs-secondary-color); white-space: nowrap; }
.ex-sap-progress-list { display: flex; flex-direction: column; }
.ex-sap-prog-row { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; }
.ex-sap-prog-row + .ex-sap-prog-row { border-top: 1px solid var(--bs-border-color-translucent); }
.ex-sap-prog-name { flex: 0 0 38%; min-width: 0; font-size: .78rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-sap-prog-meter { flex: 1 1 auto; min-width: 0; }
.ex-sap-prog-top { display: flex; align-items: center; gap: .35rem; font-size: .66rem; font-weight: 600; line-height: 1; margin-bottom: .2rem; font-variant-numeric: tabular-nums; }
.ex-sap-prog-top .bi { font-size: .7rem; }
.ex-sap-prog-track { height: 5px; border-radius: 3px; background: var(--bs-secondary-bg); overflow: hidden; }
.ex-sap-prog-fill { height: 100%; border-radius: 3px; }
.ex-sap-prog-count { flex: none; min-width: 2.4rem; text-align: right; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.ex-sap-goal { border-left: 3px solid var(--bs-primary); padding: .15rem 0 .15rem .6rem; margin-bottom: .6rem; }
.ex-sap-goal-title { font-size: .78rem; font-weight: 600; line-height: 1.3; }
.ex-sap-goal-sub { font-size: .7rem; color: var(--bs-secondary-color); }
.ex-sap-goal-status { font-size: .72rem; font-weight: 600; white-space: nowrap; }
.ex-sap-goal-meta { font-size: .72rem; margin-top: .3rem; }

.ex-sap-link-row { transition: background-color .1s ease; }
.ex-sap-link-row:hover { background-color: var(--bs-tertiary-bg); }
.ex-sap-chevron { color: var(--bs-secondary-color); font-size: .72rem; flex: none; margin-left: .4rem; }

/* Widget card */
.ex-widget-card .card-header { display: flex; align-items: center; gap: 0.5rem; }
.ex-widget-card .card-header .ex-widget-actions { margin-left: auto; display: flex; gap: 0.35rem; }

/* Live indicator */
.ex-live-indicator { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--ex-text-muted); }
.ex-live-indicator .ex-live-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--ex-success);
    animation: ex-pulse 2s infinite;
}
.ex-live-indicator.paused .ex-live-dot { background: var(--ex-warning); animation: none; }
@keyframes ex-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 126, 62, 0.45); }
    70% { box-shadow: 0 0 0 6px rgba(16, 126, 62, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 126, 62, 0); }
}

/* ============================================================ */
/* 4. Timeline                                                  */
/* ============================================================ */
.ex-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.ex-timeline::before {
    content: "";
    position: absolute;
    left: 0.55rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--ex-border);
}
.ex-timeline-item { position: relative; padding: 0 0 1rem 2rem; }
.ex-timeline-item:last-child { padding-bottom: 0.2rem; }
.ex-timeline-item .ex-timeline-dot {
    position: absolute;
    left: 0;
    top: 0.2rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: var(--ex-surface);
    border: 2px solid var(--ex-primary);
    color: var(--ex-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
}
.ex-timeline-item .ex-timeline-time { font-size: 0.72rem; color: var(--ex-text-muted); }
.ex-timeline-item .ex-timeline-title { font-weight: 600; font-size: 0.84rem; }
.ex-timeline-item .ex-timeline-body { font-size: 0.8rem; color: var(--ex-text-muted); }

/* ============================================================ */
/* 5. Wizard                                                    */
/* ============================================================ */
.ex-wizard-steps { display: flex; gap: 0; margin-bottom: 1.25rem; padding: 0; list-style: none; }
.ex-wizard-steps .ex-wizard-step { flex: 1; text-align: center; position: relative; padding-top: 0.2rem; }
.ex-wizard-steps .ex-wizard-step::before {
    content: "";
    position: absolute;
    top: 1.15rem;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--ex-border);
}
.ex-wizard-steps .ex-wizard-step:first-child::before { display: none; }
.ex-wizard-steps .ex-step-index {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ex-surface);
    border: 2px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}
.ex-wizard-steps .ex-step-label { display: block; font-size: 0.76rem; margin-top: 0.3rem; color: var(--ex-text-muted); }
.ex-wizard-steps .ex-wizard-step.active .ex-step-index { border-color: var(--ex-primary); background: var(--ex-primary); color: #fff; }
.ex-wizard-steps .ex-wizard-step.active .ex-step-label { color: var(--ex-primary); font-weight: 600; }
.ex-wizard-steps .ex-wizard-step.done .ex-step-index { border-color: var(--ex-success); background: var(--ex-success); color: #fff; }
.ex-wizard-steps .ex-wizard-step.done::before,
.ex-wizard-steps .ex-wizard-step.active::before { background: var(--ex-primary); }
.ex-wizard-pane { display: none; }
.ex-wizard-pane.active { display: block; }

/* ============================================================ */
/* 6. Status badges / approval panel / empty state              */
/* ============================================================ */
.ex-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    border: 1px solid transparent;
}
.ex-status-draft     { background: var(--ex-surface-2); color: var(--ex-text-muted); border-color: var(--ex-border); }
.ex-status-pending   { background: rgba(233, 115, 12, 0.12); color: var(--ex-warning); }
.ex-status-approved,
.ex-status-completed { background: rgba(16, 126, 62, 0.12); color: var(--ex-success); }
.ex-status-rejected,
.ex-status-cancelled { background: rgba(187, 0, 0, 0.1); color: var(--ex-danger); }
.ex-status-info,
.ex-status-in-progress { background: rgba(15, 130, 143, 0.12); color: var(--ex-info); }

.ex-approval-panel { border: 1px dashed var(--ex-border); border-radius: var(--ex-radius); padding: 1rem; background: var(--ex-surface-2); }

.ex-empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--ex-text-muted); }
.ex-empty-state .ex-empty-icon { font-size: 2.6rem; opacity: 0.4; display: block; margin-bottom: 0.6rem; }
.ex-empty-state .ex-empty-title { font-weight: 600; color: var(--ex-text); }

/* ============================================================ */
/* 7. Tables & forms                                            */
/* ============================================================ */
.table { --bs-table-hover-bg: var(--ex-primary-subtle); font-size: var(--ex-font-size-menu); }
.table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ex-text-muted);
    border-bottom-width: 2px;
    white-space: nowrap;
}
div.dataTables_wrapper div.dataTables_filter input,
div.dt-container .dt-search input { border-radius: var(--ex-radius-sm); }

.form-label { font-weight: 600; font-size: var(--ex-font-size-menu); margin-bottom: 0.25rem; }
.form-label .ex-required { color: var(--ex-danger); }
.form-control, .form-select { font-size: var(--ex-font-size-menu); border-radius: var(--ex-radius-sm); }
.form-control:focus, .form-select:focus {
    border-color: var(--ex-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

/* Select2 Bootstrap harmony */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border: 1px solid var(--bs-border-color, var(--ex-border));
    border-radius: var(--ex-radius-sm);
    min-height: calc(1.5em + 0.75rem + 2px);
    background: var(--bs-body-bg, var(--ex-surface));
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem);
    color: var(--ex-text);
    padding-left: 0.75rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + 0.75rem); }
.select2-dropdown { background: var(--ex-surface); border-color: var(--ex-border); color: var(--ex-text); z-index: 1056; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--ex-primary);
}
[data-bs-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--ex-surface-2);
    color: var(--ex-text);
    border-color: var(--ex-border);
}

/* Dropzone */
.dropzone.ex-dropzone {
    border: 2px dashed var(--ex-border);
    border-radius: var(--ex-radius);
    background: var(--ex-surface-2);
    min-height: 8rem;
    color: var(--ex-text-muted);
}
.dropzone.ex-dropzone:hover { border-color: var(--ex-primary); }

/* Flatpickr dark support */
[data-bs-theme="dark"] .flatpickr-calendar {
    background: var(--ex-surface);
    border-color: var(--ex-border);
    box-shadow: var(--ex-shadow-lg);
    color: var(--ex-text);
}
[data-bs-theme="dark"] .flatpickr-day { color: var(--ex-text); }
[data-bs-theme="dark"] .flatpickr-day.flatpickr-disabled { color: var(--ex-text-muted); }
[data-bs-theme="dark"] .flatpickr-months .flatpickr-month,
[data-bs-theme="dark"] .flatpickr-weekday { color: var(--ex-text); fill: var(--ex-text); }

/* ============================================================ */
/* 8. Auth / login page CSS contract (blades owned by core)      */
/*    Core agent only needs: body.ex-auth-page > .ex-auth-card  */
/* ============================================================ */
body.ex-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    font-family: var(--ex-font);
    background:
        radial-gradient(60rem 30rem at 110% -10%, rgba(15, 130, 143, 0.25), transparent 60%),
        radial-gradient(50rem 30rem at -10% 110%, rgba(10, 110, 209, 0.35), transparent 60%),
        linear-gradient(160deg, #0b2540 0%, #0a3a66 55%, #0a6ed1 130%);
}
.ex-auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--ex-surface);
    border-radius: 0.9rem;
    box-shadow: var(--ex-shadow-lg);
    padding: 2rem 2rem 1.5rem;
}
.ex-auth-card .ex-auth-logo { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; font-weight: 800; font-size: 1.25rem; color: var(--ex-primary); }
.ex-auth-card .ex-auth-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.25rem; }
.ex-auth-card .ex-auth-subtitle { color: var(--ex-text-muted); font-size: 0.84rem; margin-bottom: 1.25rem; }
.ex-auth-footer { text-align: center; color: rgba(255, 255, 255, 0.75); font-size: 0.78rem; margin-top: 1rem; }

/* ============================================================ */
/* 9. Error pages                                               */
/* ============================================================ */
body.ex-error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ex-shell-bg);
    font-family: var(--ex-font);
    color: var(--ex-text);
    padding: 1.5rem;
}
.ex-error-card { text-align: center; max-width: 30rem; }
.ex-error-code {
    font-size: 5.5rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--ex-primary), #0f828f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.ex-error-title { font-size: 1.25rem; font-weight: 700; margin: 0.5rem 0; }
.ex-error-text { color: var(--ex-text-muted); margin-bottom: 1.25rem; }

/* ============================================================ */
/* 10. Accessibility & focus                                    */
/* ============================================================ */
:focus-visible {
    outline: 2px solid var(--ex-primary);
    outline-offset: 2px;
    border-radius: 2px;
}
.ex-skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 2000;
    background: var(--ex-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--ex-radius-sm) 0;
}
.ex-skip-link:focus { left: 0; color: #fff; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================ */
/* 11. Print                                                    */
/* ============================================================ */
@media print {
    body.ex-shell { padding-top: 0; background: #fff; }
    .ex-header, .ex-sidebar, .ex-footer, .ex-no-print,
    .btn, .ex-page-header .ex-page-actions { display: none !important; }
    .ex-main { margin-left: 0 !important; }
    .ex-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    a[href]::after { content: ""; }
}

/* ── Compact single-row KPI strip (dashboard) ─────────────────────────── */
.ex-kpi-row .ex-stat-card .card-body { padding: .55rem .7rem .5rem; }
.ex-kpi-row .ex-stat-icon {
    width: 26px; height: 26px; font-size: .8rem;
    position: absolute; top: .5rem; right: .6rem; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.ex-kpi-row .ex-stat-card { position: relative; min-height: 0; }
.ex-kpi-row .ex-stat-label {
    font-size: .6rem; letter-spacing: .04em; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-right: 28px; margin-bottom: .1rem;
}
.ex-kpi-row .ex-stat-value { font-size: 1.15rem; line-height: 1.2; margin-bottom: 0; }
.ex-kpi-row .ex-stat-delta { font-size: .62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-kpi-row .ex-stat-spark { display: none; }
@media (min-width: 1200px) {
    .ex-kpi-row > [class*='col'] { min-width: 0; }
}

/* ============================================================ */
/* Typography harmonisation — forms, tables & display text     */
/* match the left sidebar's font (size 0.86rem, weight, colour) */
/* ============================================================ */

/* Base body text scale aligned to the sidebar nav-link. */
body.ex-shell,
.ex-content,
.card,
.modal-content { font-size: 0.86rem; }

/* --- Form labels: like the sidebar nav-link (crisp, medium) --- */
.form-label,
.col-form-label,
.form-check-label,
.input-group-text {
    font-family: var(--ex-font);
    font-size: var(--ex-font-size-menu);
    font-weight: 600;
    color: var(--ex-text);
}
.form-text { font-size: var(--ex-font-size-menu-sub); color: var(--ex-text-muted); }

/* --- Inputs, selects, textareas --- */
.form-control,
.form-select,
textarea.form-control,
.input-group-text,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    font-family: var(--ex-font);
    font-size: var(--ex-font-size-menu);
    color: var(--ex-text);
}
.form-control::placeholder { color: var(--ex-text-muted); opacity: 0.8; }

/* --- Select2 (single & multi) matched to native inputs --- */
.select2-container .select2-selection { font-family: var(--ex-font); font-size: var(--ex-font-size-menu); }
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-selection__choice,
.select2-results__option,
.select2-search__field { font-family: var(--ex-font); font-size: var(--ex-font-size-menu); color: var(--ex-text); }

/* --- Buttons share the family & scale --- */
.btn { font-family: var(--ex-font); font-size: var(--ex-font-size-menu); }
.btn-sm { font-size: var(--ex-font-size-menu-sub); }

/* --- Tables & DataTables: headers mirror the sidebar section label --- */
.table { font-family: var(--ex-font); font-size: var(--ex-font-size-menu); color: var(--ex-text); }
.table > thead th,
table.dataTable > thead th {
    font-family: var(--ex-font);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ex-text-muted);
}
.table > tbody td,
table.dataTable > tbody td { font-size: var(--ex-font-size-menu); color: var(--ex-text); vertical-align: middle; }
.dataTables_wrapper,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { font-family: var(--ex-font); font-size: var(--ex-font-size-menu); color: var(--ex-text); }

/* --- Cards & panels: titles like an active nav item --- */
.card-title,
.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6,
.panel-title,
.ex-panel-title { font-family: var(--ex-font); font-weight: 600; color: var(--ex-text); }

/* --- Modal & offcanvas titles --- */
.modal-title, .offcanvas-title { font-family: var(--ex-font); font-weight: 600; font-size: 1rem; color: var(--ex-text); }

/* --- Breadcrumbs, badges, list groups, nav-tabs align to the family --- */
.breadcrumb, .badge, .list-group, .nav-tabs, .nav-pills,
.dropdown-menu, .alert { font-family: var(--ex-font); }
.nav-tabs .nav-link, .nav-pills .nav-link { font-size: 0.86rem; color: var(--ex-text); }

/* ============================================================ */
/* 12. Colorful sidebar icons + compact density                 */
/* ============================================================ */

/* --- Icon palette (cycles per top-level menu item; children   */
/*     inherit their section's colour for a cohesive look)  --- */
:root {
    --ex-ic-1: #0a6ed1;  /* blue    */
    --ex-ic-2: #e9730c;  /* orange  */
    --ex-ic-3: #107e3e;  /* green   */
    --ex-ic-4: #a100c2;  /* purple  */
    --ex-ic-5: #0f828f;  /* teal    */
    --ex-ic-6: #c4326b;  /* magenta */
    --ex-ic-7: #7b5cd6;  /* violet  */
    --ex-ic-8: #ad6800;  /* amber   */
}
[data-bs-theme="dark"] {
    --ex-ic-1: #4db1ff;
    --ex-ic-2: #ffa94d;
    --ex-ic-3: #51cf66;
    --ex-ic-4: #da77f2;
    --ex-ic-5: #3bc9db;
    --ex-ic-6: #f783ac;
    --ex-ic-7: #b197fc;
    --ex-ic-8: #ffd43b;
}
.ex-sidebar .ex-nav > li:nth-of-type(8n+1) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-1); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+2) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-2); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+3) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-3); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+4) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-4); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+5) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-5); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+6) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-6); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+7) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-7); }
.ex-sidebar .ex-nav > li:nth-of-type(8n+8) .ex-nav-link i:not(.ex-caret) { color: var(--ex-ic-8); }
/* Hover/active: keep the section colour (background still highlights) */
.ex-sidebar .ex-nav-link:hover i:not(.ex-caret),
.ex-sidebar .ex-nav-link.active i:not(.ex-caret) { filter: saturate(1.2); }
/* Sub-items: slightly softened version of the section colour */
.ex-sidebar .ex-subnav .ex-nav-link i:not(.ex-caret) { opacity: 0.85; font-size: 0.9rem; }

/* --- Compact type scale: everything sized like the menu --- */
body.ex-shell, .ex-content, .card, .modal-content { font-size: 0.84rem; }
.ex-content h1 { font-size: 1.15rem; }
.ex-content h2 { font-size: 1.05rem; }
.ex-content h3 { font-size: 0.98rem; }
.ex-content h4 { font-size: 0.92rem; }
.ex-content h5 { font-size: 0.88rem; }
.ex-content h6 { font-size: 0.84rem; }
.ex-page-header .ex-page-title { font-size: 1.1rem; }
.ex-page-header { margin-bottom: 0.7rem; }
.form-label, .col-form-label, .form-check-label, .input-group-text { font-size: var(--ex-font-size-menu); }
/* Fields, buttons and table cells all track the sidebar nav-link. */
.form-control, .form-select, textarea.form-control,
.select2-container .select2-selection,
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-results__option, .select2-search__field,
.btn, .table, .table > tbody td, table.dataTable > tbody td { font-size: var(--ex-font-size-menu); }
.btn-sm { font-size: var(--ex-font-size-menu-sub); }
.dropdown-menu { font-size: 0.84rem; }
.alert { font-size: 0.84rem; }
.badge { font-size: 0.68rem; }

/* --- Density: tighter controls, cells and cards → more per page --- */
.ex-content { padding: 0.85rem 1.1rem; }
.card > .card-header { padding: 0.55rem 0.85rem; }
.card .card-body { padding: 0.85rem; }
.form-control, .form-select { padding: 0.3rem 0.6rem; }
textarea.form-control { padding: 0.4rem 0.6rem; }
.form-label { margin-bottom: 0.2rem; }
.ex-content .mb-3, .ex-content .form-group { margin-bottom: 0.7rem !important; }
.ex-content .row.g-3 { --bs-gutter-y: 0.7rem; --bs-gutter-x: 0.9rem; }
.btn { padding: 0.3rem 0.7rem; }
.btn-sm { padding: 0.22rem 0.5rem; }

/* Select2 height matched to the shorter inputs */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple { min-height: calc(1.5em + 0.6rem + 2px); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: calc(1.5em + 0.6rem); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: calc(1.5em + 0.6rem); }

/* Tables: compact rows */
.table > :not(caption) > * > * { padding: 0.35rem 0.5rem; }
.table thead th { padding-top: 0.4rem; padding-bottom: 0.4rem; }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate,
div.dt-container .dt-info, div.dt-container .dt-paging { font-size: 0.78rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button,
div.dt-container .dt-paging .dt-paging-button { padding: 0.2rem 0.55rem; }
.pagination { --bs-pagination-padding-y: 0.25rem; --bs-pagination-padding-x: 0.6rem; --bs-pagination-font-size: 0.8rem; }

/* Modals & offcanvas follow the compact scale */
.modal-header, .offcanvas-header { padding: 0.65rem 0.9rem; }
.modal-body { padding: 0.85rem 0.9rem; }
.modal-footer { padding: 0.5rem 0.9rem; }

/* ============================================================ */
/* Global search results panel                                  */
/* ============================================================ */
.ex-search-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    min-width: 20rem;
    max-height: 26rem;
    overflow-y: auto;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    box-shadow: var(--ex-shadow-lg);
    z-index: 1055;
    padding: 0.25rem 0;
}
.ex-search-group {
    padding: 0.5rem 0.9rem 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ex-text-muted);
}
.ex-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.9rem;
    color: var(--ex-text);
    text-decoration: none;
    font-size: 0.85rem;
}
.ex-search-item:hover,
.ex-search-item.active { background: var(--ex-primary-subtle); color: var(--ex-primary); }
.ex-search-item .ex-search-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ex-search-item .ex-search-sub {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--ex-text-muted);
    white-space: nowrap;
}
.ex-search-empty {
    padding: 1rem 0.9rem;
    text-align: center;
    color: var(--ex-text-muted);
    font-size: 0.85rem;
}

/* ============================================================ */
/* Sidebar favorite stars                                       */
/* ============================================================ */
.ex-sidebar .ex-nav li { position: relative; }
.ex-fav-toggle {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--ex-text-muted);
    padding: 0.1rem 0.3rem;
    border-radius: var(--ex-radius-sm);
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.ex-sidebar li:hover > .ex-fav-toggle,
.ex-fav-toggle:focus-visible,
.ex-fav-toggle.is-fav { opacity: 1; }
.ex-fav-toggle:hover { background: var(--ex-primary-subtle); color: var(--ex-primary); }
.ex-fav-toggle.is-fav { color: var(--ex-warning); }
/* Leave room for the star so labels don't sit underneath it */
.ex-sidebar li:hover > .ex-nav-link { padding-right: 1.9rem; }
body.ex-sidebar-collapsed .ex-fav-toggle { display: none; }

/* 2026-08-03: form typography follows the sidebar nav — same family
   (--ex-font is global), same weight-600 labels as .ex-nav-link. Sizes now
   read --ex-font-size-menu so this block cannot drift from the sidebar. */
.ex-content .form-label { font-size: var(--ex-font-size-menu); font-weight: 600; color: var(--ex-text); }
.ex-content .form-label i { font-size: 0.95rem; width: 1.15rem; text-align: center; display: inline-block; }
.ex-content .form-control, .ex-content .form-select,
.ex-content .input-group-text, .ex-content .form-check-label,
.ex-content .col-form-label { font-size: var(--ex-font-size-menu); }
.ex-content .form-control-sm, .ex-content .form-select-sm { font-size: var(--ex-font-size-menu-sub); }
.ex-content .form-text { font-size: var(--ex-font-size-menu-sub); }
/* select2 renders outside .form-select — pin it (and its body-portal
   dropdown) to the same 0.8rem as the sidebar nav. */
.ex-content .select2-container .select2-selection,
.ex-content .select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-dropdown, .select2-results__option, .select2-search__field { font-size: var(--ex-font-size-menu) !important; }

/* 2026-08-03: tight 5px rhythm between cards (user request) — rows whose
   columns hold cards get 5px gutters, and stacked cards' mt/mb-3 collapse
   to 5px. Field rows inside card bodies are untouched. */
.ex-content .row:has(> [class*="col-"] > .card),
.ex-content .row:has(> [class*="col-"] > a.card) {
    --bs-gutter-x: 5px;
    --bs-gutter-y: 5px;
}
.ex-content .card.mb-3 { margin-bottom: 5px !important; }
.ex-content .card.mt-3 { margin-top: 5px !important; }
.ex-content .card .card { margin-bottom: 5px; }

/* ============================================================ */
/* 2026-08-12: Report views — compact scale (user request)       */
/*                                                              */
/* Report pages are read, not filled in: the win is rows per     */
/* screen, not touch targets. Everything inside .ex-report drops */
/* one notch below the sidebar scale and headings render in the  */
/* Proper Case the datasets already author them in, instead of   */
/* being shouted by text-transform.                              */
/* ============================================================ */
:root {
    --ex-font-size-report: 0.72rem;      /* body cells — one notch under the sidebar sub-nav */
    --ex-font-size-report-head: 0.7rem;  /* column headings */
}

.ex-report { font-size: var(--ex-font-size-report); }

/* --- Table: smaller type and a tighter row rhythm --- */
.ex-report .table { font-size: var(--ex-font-size-report); }
.ex-report .table > tbody td,
.ex-report .table > tbody th,
.ex-report .table > tfoot td,
.ex-report table.dataTable > tbody td {
    font-size: var(--ex-font-size-report);
    padding: 0.22rem 0.45rem;
    line-height: 1.35;
}
.ex-report .table > thead th,
.ex-report .table thead th,
.ex-report table.dataTable > thead th {
    font-size: var(--ex-font-size-report-head);
    font-weight: 700;
    text-transform: none;      /* headings keep the Proper Case the dataset defines */
    letter-spacing: 0.01em;
    color: var(--ex-text);
    padding: 0.3rem 0.45rem;
}
.ex-report .table > thead th .ex-report-sort i { font-size: 0.62rem; }

/* --- Headline tiles: same information, less vertical cost --- */
.ex-report .ex-stat-card .card-body { padding: 0.5rem 0.65rem 0.45rem; }
.ex-report .ex-stat-card .ex-stat-label {
    font-size: 0.66rem;
    text-transform: none;      /* "Total EO Amount", not "TOTAL EO AMOUNT" */
    letter-spacing: 0.01em;
    font-weight: 600;
    padding-right: 2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Long unabbreviated figures (AR/AP aging shows full rupees) wrap rather than
   truncate — a clipped money value is worse than a two-line one — so keep them
   clear of the absolutely positioned icon. */
.ex-report .ex-stat-card .ex-stat-value {
    font-size: 1.15rem;
    padding-right: 2rem;
    word-break: break-word;
}
.ex-report .ex-stat-icon {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
    top: 0.5rem;
    right: 0.6rem;
}

/* --- Card headers, toolbar and pager follow the same scale --- */
.ex-report .card > .card-header { padding: 0.4rem 0.7rem; font-size: var(--ex-font-size-report); }
.ex-report .card > .card-footer { padding: 0.35rem 0.7rem; font-size: var(--ex-font-size-report); }
.ex-report .form-control,
.ex-report .form-select,
.ex-report .input-group-text,
.ex-report .form-check-label,
.ex-report .btn { font-size: var(--ex-font-size-report); }
.ex-report .form-control-sm,
.ex-report .btn-sm { font-size: var(--ex-font-size-report); padding: 0.15rem 0.45rem; }
/* Selects keep Bootstrap's right gutter — the caret is painted inside the
   padding box, so a symmetric shorthand would run the caret over the value. */
.ex-report .form-select-sm { font-size: var(--ex-font-size-report); padding: 0.15rem 1.9rem 0.15rem 0.45rem; }
.ex-report .input-group-sm > .form-control,
.ex-report .input-group-sm > .input-group-text { padding: 0.15rem 0.45rem; }
.ex-report .badge { font-size: 0.65rem; }
.ex-report .page-link { font-size: var(--ex-font-size-report); padding: 0.15rem 0.45rem; }
.ex-report .small, .ex-report small { font-size: 0.68rem; }
.ex-report form.border-bottom { padding: 0.5rem !important; }

/* --- DataTables chrome (search / length / info / pager) on report pages --- */
.ex-report .dataTables_wrapper,
.ex-report .dataTables_wrapper .dataTables_filter,
.ex-report .dataTables_wrapper .dataTables_filter input,
.ex-report .dataTables_wrapper .dataTables_length,
.ex-report .dataTables_wrapper .dataTables_length select,
.ex-report .dataTables_wrapper .dataTables_info,
.ex-report .dataTables_wrapper .dataTables_paginate,
.ex-report div.dt-container,
.ex-report div.dt-container .dt-search input,
.ex-report div.dt-container .dt-length select,
.ex-report div.dt-container .dt-info { font-size: var(--ex-font-size-report); }

/* --- ?hl= document highlight (Live EXIM Operations Network click-through) --- */
@keyframes ex-row-flash {
    0%, 100% { background-color: rgba(233, 115, 12, .12); }
    50% { background-color: rgba(233, 115, 12, .34); }
}
tr.ex-row-highlight > td {
    background-color: rgba(233, 115, 12, .12) !important;
    animation: ex-row-flash 1.1s ease-in-out 3;
}
tr.ex-row-highlight > td:first-child { box-shadow: inset 3px 0 0 #e9730c; }
[data-bs-theme="dark"] tr.ex-row-highlight > td {
    background-color: rgba(233, 115, 12, .22) !important;
}
