/* ==========================================================================
   TILL 14 — app design layer (light + dark)
   Loaded last in <head> on every app page, after js/t14-theme.js has set
   <html data-theme="light|dark">. It:
     1. defines the colour tokens for both themes and re-points every page's
        own CSS variables (--primary, --surface, --text ...) at them;
     2. lays out the shared sidebar (includes/sidebar.php);
     3. restyles the common components to match the landing page.
   Page styles hard-coded light colours are wrapped in var(--t14-*) fallbacks
   by the build step, so they follow the theme as well.
   Selectors are prefixed with `html body` to outrank page styles.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..800&family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&display=swap");

/* ------------------------------------------------------------- tokens --- */
:root,
:root[data-theme="light"] {
    color-scheme: light;

    --t14-bg: #F4F5F2;
    --t14-surface: #FFFFFF;
    --t14-surface-2: #F7F9F7;
    --t14-surface-3: #EDF1ED;
    --t14-text: #10231A;
    --t14-muted: #5F6E66;
    --t14-faint: #8E9A93;
    --t14-line: #DDE3DE;
    --t14-line-strong: #C9D1CB;
    --t14-head: #EEF2EE;
    --t14-hover: #FBF6E9;

    --t14-green: #0E5A3A;
    --t14-green-hover: #0A4630;
    --t14-link: #0E5A3A;
    --t14-deep: #0A4630;
    --t14-gold: #E8B13A;
    --t14-gold-text: #8A6A16;

    --t14-tint-green: #E8F3EC;
    --t14-tint-gold: #FDF5E1;
    --t14-tint-red: #FDECEA;
    --t14-tint-blue: #E7F0FB;
    --t14-tint-purple: #F1ECFB;
    --t14-on-green: #0E5A3A;
    --t14-on-gold: #8A5A00;
    --t14-on-red: #B42318;
    --t14-on-blue: #1D5FA8;
    --t14-on-purple: #5B3CC4;

    --t14-panel: #0A4630;
    --t14-sidebar: #0A4630;
    --t14-sidebar-text: rgba(255, 255, 255, 0.78);
    --t14-sidebar-muted: rgba(255, 255, 255, 0.45);
    --t14-sidebar-hover: rgba(255, 255, 255, 0.07);
    --t14-sidebar-line: rgba(255, 255, 255, 0.10);

    --t14-shadow: 0 1px 2px rgba(16, 35, 26, 0.05);
    --t14-shadow-lg: 0 18px 50px -24px rgba(16, 35, 26, 0.35);
    --t14-ring: rgba(232, 177, 58, 0.28);

    --font-main: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;                     /* body text */
    --font-heading: "Bricolage Grotesque", "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;   /* titles, menu, buttons */

    --t14-sb-w: 264px;
    --t14-rail-w: 76px;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --t14-bg: #0B1712;
    --t14-surface: #12211A;
    --t14-surface-2: #162820;
    --t14-surface-3: #1B3027;
    --t14-text: #E4ECE7;
    --t14-muted: #9DB0A6;
    --t14-faint: #6F8479;
    --t14-line: #233A2F;
    --t14-line-strong: #2F4A3D;
    --t14-head: #172B22;
    --t14-hover: #1D3329;

    --t14-green: #1F7A52;
    --t14-green-hover: #26905F;
    --t14-link: #5CCB97;
    --t14-deep: #0F2A1F;
    --t14-gold: #E8B13A;
    --t14-gold-text: #E8B13A;

    --t14-tint-green: rgba(76, 195, 138, 0.14);
    --t14-tint-gold: rgba(232, 177, 58, 0.14);
    --t14-tint-red: rgba(240, 82, 72, 0.15);
    --t14-tint-blue: rgba(96, 156, 230, 0.15);
    --t14-tint-purple: rgba(160, 130, 240, 0.16);
    --t14-on-green: #6FD3A2;
    --t14-on-gold: #F0C463;
    --t14-on-red: #FF8F86;
    --t14-on-blue: #8DBBF2;
    --t14-on-purple: #BCA8F7;

    --t14-panel: #0F2A1F;
    --t14-sidebar: #0D1E17;
    --t14-sidebar-text: rgba(228, 236, 231, 0.78);
    --t14-sidebar-muted: rgba(228, 236, 231, 0.42);
    --t14-sidebar-hover: rgba(255, 255, 255, 0.05);
    --t14-sidebar-line: rgba(255, 255, 255, 0.07);

    --t14-shadow: none;
    --t14-shadow-lg: 0 18px 50px -24px rgba(0, 0, 0, 0.8);
}

/* Every page's own variables follow the tokens. */
:root,
:root[data-theme] {
    --primary: var(--t14-green);
    --primary-light: var(--t14-green-hover);
    --primary-dark: var(--t14-green-hover);
    --primary-glow: var(--t14-tint-green);
    --accent: var(--t14-gold);
    --accent-light: var(--t14-tint-gold);
    --bg: var(--t14-bg);
    --surface: var(--t14-surface);
    --text: var(--t14-text);
    --text-muted: var(--t14-muted);
    --text-light: var(--t14-faint);
    --muted: var(--t14-muted);
    --border: var(--t14-line);
    --success-light: var(--t14-tint-green);
    --danger-light: var(--t14-tint-red);
    --warning-light: var(--t14-tint-gold);
    --info-light: var(--t14-tint-blue);
    --purple-light: var(--t14-tint-purple);
    --radius: 10px;
    --radius-sm: 8px;
    --shadow: var(--t14-shadow);
    --shadow-lg: var(--t14-shadow-lg);
}

:root[data-theme="dark"] {
    --primary: #2F9C6A;
    --primary-dark: #1F7A52;
    --primary-light: #3FB27F;
    --success: #34C186;
    --danger: #F0625A;
    --warning: #F2B33D;
    --info: #6AA8EE;
}

/* --------------------------------------------------------------- base --- */
html body {
    background: var(--t14-bg);
    color: var(--t14-text);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease;
}

html body h1,
html body h2,
html body h3,
html body h4 {
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

html body ::selection {
    background: var(--t14-gold);
    color: #10231A;
}

html body td,
html body .stat-number,
html body .stat-value,
html body .amount-cell {
    font-variant-numeric: tabular-nums;
}

html body :focus-visible {
    outline: 2px solid var(--t14-gold);
    outline-offset: 2px;
}

/* Elements that only show in one theme (theme toggle icons and labels). */
html[data-theme="dark"] body .t14-when-light,
html:not([data-theme="dark"]) body .t14-when-dark {
    display: none !important;
}

/* ------------------------------------------------------- svg icons --- */
/* Inline SVG icons from includes/icons.php draw with currentColor. */
html body .t14-icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ------------------------------------------------- shared sidebar shell --- */
/* Old per-role sidebar remnants, in case a cached page still has them. */
html body .toggle_btn,
html body .sidebar-toggle {
    display: none !important;
}

html body .t14-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--t14-sb-w);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background-color: var(--t14-sidebar);
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--t14-sidebar-text);
    border-right: 1px solid var(--t14-sidebar-line);
    transition: width 0.22s ease, transform 0.25s ease;
}

html body .t14-sidebar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--t14-gold) 0 34%, #0E5A3A 34% 100%);
}

html body .t14-sb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 20px 14px 16px 18px;
    border-bottom: 1px solid var(--t14-sidebar-line);
}

html body .t14-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    text-decoration: none;
    color: #fff;
}

html body .t14-brand img {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

html body .t14-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

html body .t14-brand-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.015em;
    color: #fff;
}

html body .t14-brand-name b {
    color: var(--t14-gold);
}

html body .t14-brand-panel {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--t14-sidebar-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html body .t14-rail-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--t14-sidebar-line);
    background: transparent;
    color: var(--t14-sidebar-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: color 0.2s, background 0.2s, transform 0.22s;
}

html body .t14-rail-btn:hover {
    color: #fff;
    background: var(--t14-sidebar-hover);
}

html body .t14-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

html body .t14-nav-label {
    margin: 16px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--t14-sidebar-muted);
    white-space: nowrap;
}

html body .t14-nav-label:first-child {
    margin-top: 6px;
}

html body .t14-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    margin: 1px 0;
    border-radius: 6px;
    color: var(--t14-sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

html body .t14-nav-link :is(i, .t14-icon) {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--t14-sidebar-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}

html body .t14-nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}

html body .t14-nav-link:hover {
    background: var(--t14-sidebar-hover);
    color: #fff;
}

html body .t14-nav-link:hover :is(i, .t14-icon) {
    color: #fff;
}

html body .t14-nav-link.is-active {
    background: rgba(232, 177, 58, 0.14);
    color: #fff;
    font-weight: 600;
}

html body .t14-nav-link.is-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--t14-gold);
}

html body .t14-nav-link.is-active :is(i, .t14-icon) {
    color: var(--t14-gold);
}

html body .t14-sb-foot {
    padding: 12px;
    border-top: 1px solid var(--t14-sidebar-line);
    display: grid;
    gap: 10px;
}

html body .t14-theme-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--t14-sidebar-line);
    border-radius: 6px;
    background: transparent;
    color: var(--t14-sidebar-text);
    font: 500 13.5px var(--font-main);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

html body .t14-theme-btn :is(i, .t14-icon) {
    width: 20px;
    text-align: center;
    color: var(--t14-gold);
}

html body .t14-theme-btn:hover {
    background: var(--t14-sidebar-hover);
    color: #fff;
}

html body .t14-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 2px 2px 4px;
    min-width: 0;
}

html body .t14-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--t14-gold);
    color: #10231A;
    font: 800 12px var(--font-heading);
}

html body .t14-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}

html body .t14-user-text strong {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html body .t14-user-text small {
    color: var(--t14-sidebar-muted);
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html body .t14-logout {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--t14-sidebar-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

html body .t14-logout:hover {
    background: rgba(240, 82, 72, 0.18);
    color: #FF8F86;
}

/* Page content sits beside the sidebar. */
html body:has(.t14-sidebar) .main-content {
    margin-left: var(--t14-sb-w) !important;
    width: auto !important;
    max-width: none !important;
    transition: margin-left 0.22s ease;
}

/* Desktop: collapsed icon rail */
@media (min-width: 1025px) {
    html.t14-rail body .t14-sidebar {
        width: var(--t14-rail-w);
    }

    html.t14-rail body:has(.t14-sidebar) .main-content {
        margin-left: var(--t14-rail-w) !important;
    }

    html.t14-rail body .t14-sb-head {
        flex-direction: column;
        padding: 18px 10px 14px;
    }

    html.t14-rail body .t14-rail-btn {
        transform: rotate(180deg);
    }

    html.t14-rail body .t14-brand-text,
    html.t14-rail body .t14-nav-link span,
    html.t14-rail body .t14-theme-btn span,
    html.t14-rail body .t14-user-text {
        display: none;
    }

    html.t14-rail body .t14-nav-label {
        height: 1px;
        margin: 12px 8px;
        background: var(--t14-sidebar-line);
        font-size: 0;
    }

    html.t14-rail body .t14-nav-link,
    html.t14-rail body .t14-theme-btn {
        justify-content: center;
        padding: 10px 0;
    }

    html.t14-rail body .t14-user {
        flex-direction: column;
        padding: 0;
    }

    html body .t14-menu-btn,
    html body .t14-scrim {
        display: none;
    }
}

/* Mobile / tablet: off-canvas */
@media (max-width: 1024px) {
    html body .t14-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    html.t14-sb-open body .t14-sidebar {
        transform: none;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
    }

    html body .t14-rail-btn {
        display: none;
    }

    html body:has(.t14-sidebar) .main-content {
        margin-left: 0 !important;
        padding-top: 72px !important;
    }

    html body .t14-menu-btn {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 999;
        width: 44px;
        height: 44px;
        border-radius: 8px;
        border: 1px solid var(--t14-line);
        background: var(--t14-surface);
        color: var(--t14-text);
        box-shadow: var(--t14-shadow-lg);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 17px;
        cursor: pointer;
    }

    html body .t14-scrim {
        position: fixed;
        inset: 0;
        z-index: 998;
        background: rgba(6, 14, 10, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    html.t14-sb-open body .t14-scrim {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body .t14-sidebar,
    html body:has(.t14-sidebar) .main-content {
        transition: none;
    }
}

/* ---------------------------------------------------- header panels --- */
/* Same deep-green panel, dot grid and tick-ring as the landing page hero. */
html body .header-card,
html body .hero,
html body .hero-banner,
html body .page-header {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background-color: var(--t14-panel);
    background-image:
        radial-gradient(circle at 85% 30%, rgba(232, 177, 58, 0.14), transparent 45%),
        radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: auto, 22px 22px;
    color: #fff;
    border: 0;
    border-radius: 10px;
    box-shadow: none;
}

html body .header-card::before,
html body .hero::before,
html body .hero-banner::before,
html body .page-header::before {
    content: '';
    font-family: inherit;
    position: absolute;
    width: 220px;
    height: 220px;
    right: -60px;
    top: 50%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
    border-radius: 50%;
    background: repeating-conic-gradient(from -2deg, var(--t14-gold) 0deg 3.2deg, transparent 3.2deg 9deg);
    -webkit-mask: radial-gradient(circle closest-side, transparent 0 74%, #000 75% 96%, transparent 97%);
    mask: radial-gradient(circle closest-side, transparent 0 74%, #000 75% 96%, transparent 97%);
    opacity: 0.4;
    z-index: -1;
    pointer-events: none;
}

html body .header-card::after,
html body .hero::after,
html body .hero-banner::after,
html body .page-header::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    height: 3px;
    border-radius: 0;
    background: linear-gradient(90deg, var(--t14-gold) 0 34%, rgba(255, 255, 255, 0.12) 34% 100%);
    z-index: 0;
}

html body .header-card h1,
html body .header-card h2,
html body .hero h2,
html body .page-header h1,
html body .page-header h2 {
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.015em;
}

html body .header-card h1 i,
html body .header-card h2 i,
html body .page-header h1 i,
html body .page-header h2 i {
    color: var(--t14-gold);
}

html body .header-card p,
html body .page-header p {
    color: rgba(255, 255, 255, 0.72);
    opacity: 1;
}

html body .admin-badge,
html body .period-chip,
html body .hero-date-pill,
html body .hero-branch-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    color: #fff;
    backdrop-filter: none;
}

html body .admin-badge a {
    color: #fff;
}

html body .hero .eyebrow,
html body .header-card .eyebrow {
    color: var(--t14-gold);
}

html body .eyebrow {
    color: var(--t14-gold-text);
    letter-spacing: 0.16em;
}

html body .page-top {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--t14-line);
}

html body .page-top h1,
html body .page-subtitle,
html body .updated {
    color: var(--t14-text);
}

html body .page-subtitle,
html body .updated {
    color: var(--t14-muted);
}

/* --------------------------------------- admin page header (shared) --- */
/* Every admin page uses the dashboard's header: gold breadcrumb from the
   sidebar section (data-kicker), large title, muted description, and any
   page badges shown as neutral chips. */
html body:has(.t14-sidebar[data-role="admin"]) .header-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
    background: none;
    color: var(--t14-text);
    padding: 4px 0 20px;
    margin: 0 0 24px;
    border: 0;
    border-bottom: 1px solid var(--t14-line);
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    animation: none;
    min-height: 0;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card::before {
    content: attr(data-kicker);
    display: block;
    flex-basis: 100%;
    position: static;
    width: auto;
    height: auto;
    transform: none;
    background: none;
    -webkit-mask: none;
    mask: none;
    opacity: 1;
    border-radius: 0;
    font: 700 11.5px var(--font-main);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--t14-gold-text);
    margin-bottom: -4px;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card::after {
    display: none;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card > div:first-child:not([class]) {
    flex: 1 1 320px;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card h1,
html body:has(.t14-sidebar[data-role="admin"]) .header-card h2 {
    flex-basis: 100%;
    margin: 0;
    font: 800 clamp(24px, 2.6vw, 32px)/1.12 var(--font-heading);
    letter-spacing: -0.02em;
    color: var(--t14-text);
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card h2 i {
    display: none;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card p {
    flex-basis: 100%;
    margin: 2px 0 4px;
    max-width: 760px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--t14-muted);
    opacity: 1;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card :is(.admin-badge, .coord-badge, .formula-badge, .info-badge, .stats-badge, .welcome-badge, .distribution-badge, .stat-pill, .back-link) {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 6px 11px;
    border-radius: 6px;
    border: 1px solid var(--t14-line);
    background: var(--t14-surface) !important;
    color: var(--t14-text);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    backdrop-filter: none;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card :is(.admin-badge, .coord-badge, .formula-badge, .info-badge, .stats-badge, .welcome-badge, .distribution-badge, .stat-pill, .back-link) :is(a, span, strong) {
    color: inherit !important;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card :is(.admin-badge, .coord-badge, .formula-badge, .info-badge, .stats-badge, .welcome-badge, .distribution-badge, .stat-pill, .back-link) :is(i, .t14-icon) {
    color: var(--t14-gold-text);
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card .back-link:hover {
    border-color: var(--t14-line-strong);
    background: var(--t14-surface-3) !important;
}

/* "Logged in as …" chips repeat the sidebar's signed-in name. */
html body:has(.t14-sidebar[data-role="admin"]) .header-card .admin-badge:has(> .fa-user-shield):not(:has(a)),
html body:has(.t14-sidebar[data-role="admin"]) .header-card .welcome-badge {
    display: none;
}

html body:has(.t14-sidebar[data-role="admin"]) .header-card .stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* -------------------------------------------------------------- cards --- */
html body .stat-card,
html body .period-card,
html body .filter-card,
html body .table-container,
html body .chart-card,
html body .chart-box,
html body .card-box,
html body .panel,
html body .card,
html body .profile-card,
html body .form-card,
html body .info-card,
html body .summary-card,
html body .section-card,
html body .content-card {
    background: var(--t14-surface);
    color: var(--t14-text);
    border: 1px solid var(--t14-line);
    border-radius: 10px;
    box-shadow: var(--t14-shadow);
}

html body .stat-card,
html body .period-card {
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

html body .stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0;
    background: var(--t14-gold);
    opacity: 1;
}

html body .stat-card:hover,
html body .period-card:hover {
    transform: none;
    border-color: var(--t14-line-strong);
    box-shadow: var(--t14-shadow);
}

html body .stat-card .stat-icon,
html body .stat-icon {
    background: var(--t14-tint-green);
    color: var(--t14-on-green);
    opacity: 1;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

html body .stat-card .stat-icon i {
    font-size: 1rem;
    color: inherit;
}

html body .stat-card .stat-label,
html body .stat-label,
html body .period-label {
    color: var(--t14-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

html body .stat-card .stat-number,
html body .stat-number,
html body .stat-value,
html body .period-total {
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--t14-text);
}

html body .card-box-header,
html body .card-header,
html body .panel-header,
html body .table-header-wrapper,
html body .chart-header {
    background: transparent;
    border-bottom: 1px solid var(--t14-line);
    color: var(--t14-text);
}

html body .section-title,
html body .panel-title,
html body .card-box-header h3,
html body .table-header-wrapper h4,
html body .chart-card h3,
html body .chart-card h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--t14-text);
}

html body .section-title i,
html body .panel-title i,
html body .card-box-header i,
html body .table-header-wrapper h4 i {
    color: var(--t14-link);
}

/* --------------------------------------------------------------- forms --- */
html body input[type="text"],
html body input[type="email"],
html body input[type="password"],
html body input[type="number"],
html body input[type="tel"],
html body input[type="date"],
html body input[type="month"],
html body input[type="search"],
html body input[type="time"],
html body input[type="file"],
html body select,
html body textarea {
    background-color: var(--t14-surface);
    border: 1px solid var(--t14-line-strong);
    border-radius: 8px;
    color: var(--t14-text);
    box-shadow: none;
}

html body input::placeholder,
html body textarea::placeholder {
    color: var(--t14-faint);
}

html body input:focus,
html body select:focus,
html body textarea:focus {
    outline: none;
    border-color: var(--t14-green);
    box-shadow: 0 0 0 3px var(--t14-ring);
}

html body label,
html body .filter-field label,
html body .form-group label {
    color: var(--t14-muted);
}

html body .input-icon {
    color: var(--t14-faint);
}

/* ------------------------------------------------------------- buttons --- */
html body .btn-filter,
html body .btn-primary,
html body .login-btn,
html body .button.primary,
html body .btn-submit,
html body .submit-btn,
html body button[type="submit"]:not(.page-btn):not(.tab-btn):not(.password-toggle):not(.t14-theme-btn) {
    background: var(--t14-green);
    border: 1px solid var(--t14-green);
    color: #fff;
    border-radius: 8px;
    box-shadow: none;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0;
    transition: background 0.2s, border-color 0.2s;
}

html body .btn-filter:hover,
html body .btn-primary:hover,
html body .login-btn:hover,
html body .button.primary:hover,
html body .btn-submit:hover,
html body .submit-btn:hover,
html body button[type="submit"]:not(.page-btn):not(.tab-btn):not(.password-toggle):not(.t14-theme-btn):hover {
    background: var(--t14-green-hover);
    border-color: var(--t14-green-hover);
    box-shadow: none;
    transform: none;
}

html body .btn-reset,
html body .reset-btn,
html body .btn-secondary,
html body .icon-button,
html body .button,
html body .btn-action,
html body .btn-csv,
html body .btn-print,
html body .btn-pdf,
html body .btn-excel,
html body .action-btn {
    background: var(--t14-surface);
    border: 1px solid var(--t14-line-strong);
    color: var(--t14-text);
    border-radius: 8px;
    box-shadow: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

html body .btn-action i,
html body .btn-csv i,
html body .btn-print i,
html body .btn-pdf i,
html body .btn-excel i,
html body .action-btn i {
    color: var(--t14-link);
}

html body .btn-reset:hover,
html body .reset-btn:hover,
html body .btn-secondary:hover,
html body .icon-button:hover,
html body .button:hover,
html body .btn-action:hover,
html body .btn-csv:hover,
html body .btn-print:hover,
html body .btn-pdf:hover,
html body .btn-excel:hover,
html body .action-btn:hover {
    background: var(--t14-surface-3);
    border-color: var(--t14-line-strong);
    color: var(--t14-text);
    transform: none;
    box-shadow: none;
}

/* -------------------------------------------------------------- tables --- */
html body table th,
html body thead th {
    background: var(--t14-head);
    color: var(--t14-muted);
    font-family: var(--font-heading);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--t14-line-strong);
}

html body table td {
    color: var(--t14-text);
    border-bottom: 1px solid var(--t14-line);
}

html body table tbody tr:hover td,
html body table tr:hover td {
    background: var(--t14-hover);
}

html body .amount-cell {
    color: var(--t14-link);
    font-weight: 700;
}

/* --------------------------------------------------------- pagination --- */
html body .pagination-container {
    background: transparent;
    border-top: 1px solid var(--t14-line);
}

html body .page-info {
    color: var(--t14-muted);
}

html body .page-btn {
    border-radius: 8px;
    border: 1px solid var(--t14-line-strong);
    background: var(--t14-surface);
    color: var(--t14-text);
    min-width: 36px;
    justify-content: center;
}

html body .page-btn:hover {
    background: var(--t14-surface-3);
    border-color: var(--t14-line-strong);
    color: var(--t14-text);
}

html body .page-btn.active {
    background: var(--t14-green);
    border-color: var(--t14-green);
    color: #fff;
}

/* -------------------------------------------------------- badges, tabs --- */
html body .badge,
html body .status-badge,
html body .branch-badge {
    border-radius: 6px;
    font-weight: 600;
}

html body .branch-badge {
    background: var(--t14-tint-green);
    color: var(--t14-on-green);
}

html body .account-badge,
html body .debit-account-badge {
    background: var(--t14-tint-gold);
    color: var(--t14-on-gold);
    border-radius: 5px;
}

html body .tab-btn {
    border-radius: 8px;
}

html body .tab-btn.active {
    background: var(--t14-green);
    border-color: var(--t14-green);
    color: #fff;
}

html body .empty-state {
    color: var(--t14-muted);
}

html body .empty-state i {
    color: var(--t14-gold);
    opacity: 0.8;
}

html body .alert,
html body .message {
    border-radius: 8px;
    box-shadow: none;
}

/* -------------------------------------------------------------- modals --- */
html body .modal-content,
html body .modal-box {
    background: var(--t14-surface);
    color: var(--t14-text);
    border-radius: 12px;
    border: 1px solid var(--t14-line);
    box-shadow: var(--t14-shadow-lg);
    overflow: hidden;
}

html body .modal-header {
    background: var(--t14-panel);
    color: #fff;
    border-bottom: 3px solid var(--t14-gold);
}

html body .modal-header h2,
html body .modal-header h3,
html body .modal-header .close-modal,
html body .modal-header i {
    color: #fff;
}

html body .modal-footer {
    background: var(--t14-surface-2);
    border-top: 1px solid var(--t14-line);
}

/* --------------------------------------------- mobile banker app shell --- */
html body .dashboard-header {
    background: var(--t14-surface);
    border-bottom: 1px solid var(--t14-line);
    box-shadow: none;
    backdrop-filter: none;
}

html body .logo-premier {
    color: var(--t14-text);
}

html body .logo-premier b {
    color: var(--t14-link);
}

html body .logo-mobile {
    color: var(--t14-muted);
}

html body .menu-toggle .menu-icon {
    background: var(--t14-text);
}

html body .t14-theme-icon {
    width: 40px;
    height: 40px;
    margin-right: 8px;
    border-radius: 8px;
    border: 1px solid var(--t14-line-strong);
    background: var(--t14-surface);
    color: var(--t14-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
}

html body .t14-theme-icon .fa-sun {
    color: var(--t14-gold);
}

html body .logout-btn {
    background: var(--t14-surface);
    border: 1px solid var(--t14-line-strong);
    color: var(--t14-on-red);
    border-radius: 8px;
    box-shadow: none;
}

html body .logout-btn:hover {
    background: var(--t14-tint-red);
    color: var(--t14-on-red);
    transform: none;
}

html body .mobile-sidebar {
    background: var(--t14-surface);
}

html body .mobile-sidebar .sidebar-header {
    background: var(--t14-panel);
    border-bottom: 3px solid var(--t14-gold);
}

html body .mobile-sidebar .sidebar-header .logo-premier {
    color: #fff;
}

html body .mobile-sidebar .sidebar-header .logo-premier b {
    color: var(--t14-gold);
}

html body .mobile-sidebar .sidebar-header .logo-mobile {
    color: rgba(255, 255, 255, 0.7);
}

html body .mobile-sidebar .sidebar-close {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

html body .sidebar-link {
    border-radius: 8px;
    color: var(--t14-text);
}

html body .sidebar-link:hover {
    background: var(--t14-surface-3);
    color: var(--t14-text);
}

html body .sidebar-link.active {
    background: var(--t14-green);
    color: #fff;
}

html body .bottom-nav,
html body .mobile-bottom-nav,
html body .footer-nav {
    background: var(--t14-surface);
    border-top: 1px solid var(--t14-line);
}

/* ----------------------------------------- legacy role login screens --- */
html body:has(.login-card) {
    background: var(--t14-bg);
}

html body .login-card {
    background: var(--t14-surface);
    color: var(--t14-text);
    border: 1px solid var(--t14-line);
    border-top: 3px solid var(--t14-gold);
    border-radius: 12px;
    box-shadow: var(--t14-shadow-lg);
}

html body .login-header h1,
html body .login-header h2 {
    color: var(--t14-text);
}

html body .forgot-link,
html body .back-link,
html body .login-footer a {
    color: var(--t14-link);
}

html body .logo-section,
html body .logo-wrapper {
    box-shadow: none;
}

html body .info-box {
    background: var(--t14-surface-2);
    border: 1px solid var(--t14-line);
    border-left: 3px solid var(--t14-gold);
    border-radius: 8px;
    color: var(--t14-text);
}

/* --------------------------------------------- dark-mode extra polish --- */
html[data-theme="dark"] body img[src*="logo.png"] {
    filter: none;
}

html[data-theme="dark"] body .leaflet-container {
    filter: brightness(0.85) contrast(1.05);
}

html[data-theme="dark"] body canvas {
    filter: brightness(1.05);
}

html[data-theme="dark"] body hr {
    border-color: var(--t14-line);
}

html[data-theme="dark"] body a:not([class]) {
    color: var(--t14-link);
}

/* ---------------------------------------------------------------- print --- */
/* Reports always print on white, whatever theme is on screen. */
@media print {
    :root[data-theme="dark"] {
        color-scheme: light;
        --t14-bg: #fff;
        --t14-surface: #fff;
        --t14-surface-2: #F7F9F7;
        --t14-surface-3: #EDF1ED;
        --t14-text: #10231A;
        --t14-muted: #5F6E66;
        --t14-line: #DDE3DE;
        --t14-line-strong: #C9D1CB;
        --t14-head: #EEF2EE;
        --t14-link: #0E5A3A;
        --t14-green: #0E5A3A;
        --primary: #0E5A3A;
    }

    html body {
        background: #fff;
    }

    html body .t14-sidebar,
    html body .t14-menu-btn,
    html body .t14-scrim {
        display: none !important;
    }

    html body:has(.t14-sidebar) .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }

    html body .header-card::before,
    html body .hero::before,
    html body .page-header::before {
        display: none;
    }
}
