/* =====================================================================================
   HireAce design layer (loaded last on every app page).
   - One set of colour tokens for light and dark mode. The older stylesheets use several
     variable names (--text-light, --background-card, ...); they are all mapped here so every
     page follows the selected theme.
   - Brand colours come from Admin > Platform settings (--primary-color etc. set in _Layout).
   ===================================================================================== */

/* ───────────── Tokens: light (default) ───────────── */
:root, :root[data-theme="light"] {
    color-scheme: light;
    --hx-bg: #f5f6fa;
    --hx-surface: #ffffff;
    --hx-surface-2: #f8f9fc;
    --hx-surface-3: #eef1f6;
    --hx-text: #111827;
    --hx-text-2: #4b5563;          /* secondary text, 7:1 on white */
    --hx-text-3: #6b7280;          /* hints, 4.8:1 on white */
    --hx-border: #e4e7ee;
    --hx-border-strong: #cfd5e1;
    --hx-hover: #f1f3f8;
    --hx-input-bg: #ffffff;
    --hx-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --hx-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .05);
    --hx-shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
    --hx-skeleton: #e9ecf3;
    --hx-skeleton-shine: #f6f7fb;
    --hx-backdrop: rgba(17, 24, 39, .45);
}

/* ───────────── Tokens: dark ───────────── */
:root[data-theme="dark"] {
    color-scheme: dark;
    --hx-bg: #0b1120;
    --hx-surface: #121a2e;
    --hx-surface-2: #172138;
    --hx-surface-3: #1d2944;
    --hx-text: #e9edf6;
    --hx-text-2: #b0b9cc;
    --hx-text-3: #8d97ad;
    --hx-border: #24304d;
    --hx-border-strong: #33415f;
    --hx-hover: #1b2643;
    --hx-input-bg: #0f172a;
    --hx-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --hx-shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 6px 16px rgba(0, 0, 0, .25);
    --hx-shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    --hx-skeleton: #1c2742;
    --hx-skeleton-shine: #243152;
    --hx-backdrop: rgba(0, 0, 0, .6);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] {
        color-scheme: dark;
        --hx-bg: #0b1120;
        --hx-surface: #121a2e;
        --hx-surface-2: #172138;
        --hx-surface-3: #1d2944;
        --hx-text: #e9edf6;
        --hx-text-2: #b0b9cc;
        --hx-text-3: #8d97ad;
        --hx-border: #24304d;
        --hx-border-strong: #33415f;
        --hx-hover: #1b2643;
        --hx-input-bg: #0f172a;
        --hx-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --hx-shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 6px 16px rgba(0, 0, 0, .25);
        --hx-shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
        --hx-skeleton: #1c2742;
        --hx-skeleton-shine: #243152;
        --hx-backdrop: rgba(0, 0, 0, .6);
    }
}

/* ───────────── Shared tokens + legacy variable names ───────────── */
:root, :root[data-theme] {
    --hx-radius-sm: 6px;
    --hx-radius: 10px;
    --hx-radius-lg: 14px;
    --hx-sidebar-w: 248px;
    --hx-topbar-h: 64px;
    --hx-focus: 0 0 0 3px color-mix(in srgb, var(--primary-color) 35%, transparent);
    --hx-primary-hover: color-mix(in srgb, var(--primary-color) 86%, #000);
    --hx-primary-soft: color-mix(in srgb, var(--primary-color) 12%, transparent);
    --hx-primary-text: color-mix(in srgb, var(--primary-color) 80%, var(--hx-text));
    --success-color: #12a37b;
    --warning-color: #d98e04;
    --danger-color: #e5484d;
    --info-color: #3b82f6;

    /* themes.css names */
    --bg-body: var(--hx-bg);
    --bg-card: var(--hx-surface);
    --bg-card-hover: var(--hx-surface-2);
    --text-main: var(--hx-text);
    --text-muted-dynamic: var(--hx-text-2);
    --border-color: var(--hx-border);
    --input-bg: var(--hx-input-bg);
    --input-border: var(--hx-border-strong);
    --input-text: var(--hx-text);
    --sidebar-bg: var(--hx-surface);
    --header-bg: var(--hx-surface);
    --table-header-bg: var(--hx-surface-2);
    --table-border: var(--hx-border);
    --btn-secondary-bg: var(--hx-surface);
    --btn-secondary-text: var(--hx-text);
    --hover-bg: var(--hx-hover);
    /* site.css / settings.css / older page names */
    --background-dark: var(--hx-bg);
    --background-card: var(--hx-surface);
    --background-input: var(--hx-input-bg);
    --background-input-hover: var(--hx-input-bg);
    --background-input-focus: var(--hx-input-bg);
    --border-color-hover: var(--hx-border-strong);
    --text-light: var(--hx-text);
    --text-dark: var(--hx-text);
    --text-muted: var(--hx-text-2);
    --text-primary: var(--hx-text);
    --text-secondary: var(--hx-text-2);
}

/* ───────────── Base ───────────── */
html { font-size: 15px; scroll-padding-top: calc(var(--hx-topbar-h) + 12px); }
body.hx-app {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--hx-bg) !important;
    color: var(--hx-text) !important;
    margin-bottom: 0;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
body.hx-app a { color: var(--hx-primary-text); }
body.hx-app a:hover { color: var(--primary-color); }
body.hx-app h1, body.hx-app h2, body.hx-app h3, body.hx-app h4, body.hx-app h5, body.hx-app h6 { color: inherit; letter-spacing: -.01em; }
body.hx-app .bg-white { background-color: var(--hx-surface) !important; }
body.hx-app .table-light, body.hx-app thead.table-light th { --bs-table-bg: var(--hx-surface-2); color: var(--hx-text-2) !important; }
body.hx-app .text-muted { color: var(--hx-text-2) !important; }
body.hx-app .text-dark { color: var(--hx-text) !important; }
body.hx-app .text-white:not(.btn):not(.badge) { color: var(--hx-text) !important; }
body.hx-app .text-primary { color: var(--hx-primary-text) !important; }
body.hx-app .bg-dark, body.hx-app .bg-light { background-color: var(--hx-surface-2) !important; color: var(--hx-text); }
body.hx-app hr { background-color: var(--hx-border); border: 0; opacity: 1; height: 1px; }
body.hx-app code { color: var(--hx-text-2); }
::selection { background: color-mix(in srgb, var(--primary-color) 28%, transparent); }

/* Keyboard focus that is always visible (mouse clicks do not show it). */
body.hx-app :focus { outline: none; }
body.hx-app :focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; border-radius: 4px; }
body.hx-app .btn:focus-visible, body.hx-app .form-control:focus, body.hx-app .form-select:focus,
body.hx-app .form-check-input:focus { box-shadow: var(--hx-focus) !important; outline: none; }

.skip-link {
    position: fixed; left: 12px; top: -60px; z-index: 2000;
    background: var(--primary-color); color: #fff !important; padding: 10px 16px; border-radius: var(--hx-radius);
    font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }
.visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ───────────── App shell: sidebar ───────────── */
body.hx-app > .container-fluid { padding: 0; }
body.hx-app > .container-fluid > .row { margin: 0; }
body.hx-app .app-wrapper { padding: 0; min-height: 100vh; }

body.hx-app #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040;
    width: var(--hx-sidebar-w) !important; padding: 0;
    background: var(--hx-surface) !important; border-right: 1px solid var(--hx-border);
    box-shadow: none; display: flex !important; flex-direction: column;
    transition: transform .22s ease, visibility .22s;
}
body.hx-app:not(.sidebar-open) #sidebar { transform: translateX(-100%); visibility: hidden; }
body.hx-app #sidebar .sidebar-sticky { height: 100%; display: flex; flex-direction: column; padding: 0; overflow-y: auto; overflow-x: hidden; }
body.hx-app .sidebar-brand { display: flex; align-items: center; justify-content: center; padding: 18px 18px 14px; min-height: var(--hx-topbar-h); }
body.hx-app .sidebar-brand .logo-img { max-width: 168px; max-height: 40px; width: auto; object-fit: contain; }
body.hx-app .sidebar-section { padding: 14px 20px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: none; color: var(--hx-text-3); }
body.hx-app #sidebar .nav { padding: 0 10px; gap: 2px; }
body.hx-app #sidebar .nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: var(--hx-radius-sm); border-left: 0 !important;
    color: var(--hx-text-2) !important; font-weight: 500; font-size: .93rem; background: transparent;
}
body.hx-app #sidebar .nav-link i { width: 18px; margin: 0; text-align: center; font-size: .95rem; color: var(--hx-text-3); }
body.hx-app #sidebar .nav-link:hover { background: var(--hx-hover) !important; color: var(--hx-text) !important; }
body.hx-app #sidebar .nav-link.active {
    background: var(--hx-primary-soft) !important; color: var(--hx-primary-text) !important; font-weight: 600;
}
body.hx-app #sidebar .nav-link.active i { color: var(--primary-color); }
body.hx-app #sidebar .dropdown-menu { position: static !important; transform: none !important; box-shadow: none; border: 0 !important; background: transparent !important; padding: 2px 0 4px 30px; }
body.hx-app #sidebar .dropdown-item { border-radius: var(--hx-radius-sm); padding: 7px 12px; color: var(--hx-text-2) !important; font-size: .9rem; }
body.hx-app #sidebar .dropdown-item:hover, body.hx-app #sidebar .dropdown-item.active { background: var(--hx-hover) !important; color: var(--hx-text) !important; }
body.hx-app .sidebar-footer { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--hx-border); font-size: .8rem; color: var(--hx-text-3); }

.sidebar-backdrop { display: none; }

/* ───────────── App shell: main + topbar ───────────── */
body.hx-app #mainContent {
    margin-left: 0; padding: 0 28px 40px; min-height: 100vh; width: 100%;
    transition: padding-left .22s ease;
}
body.hx-app.sidebar-open #mainContent { padding-left: calc(var(--hx-sidebar-w) + 28px); margin-left: 0 !important; }
body.hx-app .app-topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 14px; min-height: var(--hx-topbar-h);
    margin: 0 -28px 24px; padding: 10px 28px;
    background: color-mix(in srgb, var(--hx-bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--hx-border);
}
body.hx-app .app-title { font-size: 1.3rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.hx-app .topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.btn-icon {
    width: 38px; height: 38px; padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center;
    border-radius: var(--hx-radius-sm) !important; border: 1px solid transparent !important; background: transparent !important;
    color: var(--hx-text-2) !important; flex: 0 0 auto;
}
.btn-icon:hover { background: var(--hx-hover) !important; color: var(--hx-text) !important; }
.topbar-avatar { width: 34px; height: 34px; font-size: .8rem; }
body.hx-app .user-avatar { background: var(--primary-color); color: #fff; text-transform: uppercase; }
.user-menu .dropdown-header { color: var(--hx-text); font-weight: 600; white-space: normal; }
.user-menu .dropdown-header small { display: block; font-weight: 400; color: var(--hx-text-3); }

/* Global search */
.app-search { position: relative; flex: 0 1 420px; margin-left: auto; }
.app-search + .topbar-actions { margin-left: 0; }
.app-search .search-input {
    width: 100%; height: 40px; padding: 0 64px 0 38px !important; border-radius: 999px !important;
    background: var(--hx-surface) !important; border: 1px solid var(--hx-border) !important; color: var(--hx-text) !important; font-size: .92rem;
}
.app-search .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--hx-text-3); pointer-events: none; }
.app-search .search-kbd {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font: 600 .7rem/1 'Inter', sans-serif; color: var(--hx-text-3); border: 1px solid var(--hx-border); border-radius: 5px; padding: 4px 6px; pointer-events: none;
}
.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1060; max-height: 70vh; overflow-y: auto;
    background: var(--hx-surface); border: 1px solid var(--hx-border); border-radius: var(--hx-radius); box-shadow: var(--hx-shadow-lg); padding: 6px;
}
.search-results[hidden] { display: none; }
.search-group-title { font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: none; color: var(--hx-text-3); padding: 8px 10px 4px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--hx-radius-sm); color: var(--hx-text) !important; text-decoration: none; }
.search-item i { width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: var(--hx-primary-soft); color: var(--primary-color); flex: 0 0 auto; font-size: .8rem; }
.search-item .si-title { font-weight: 500; line-height: 1.25; }
.search-item .si-sub { font-size: .8rem; color: var(--hx-text-3); }
.search-item[aria-selected="true"], .search-item:hover { background: var(--hx-hover); }
.search-empty { padding: 14px 10px; color: var(--hx-text-3); font-size: .9rem; }

/* Announcement banner */
#platformAnnouncement { border-radius: var(--hx-radius); }

/* ───────────── Footer ───────────── */
body.hx-app .footer {
    position: static; line-height: 1.6; white-space: normal; padding: 18px 28px; font-size: .85rem;
    background: transparent; border-top: 1px solid var(--hx-border); color: var(--hx-text-3) !important;
}
body.hx-app.sidebar-open .footer { padding-left: calc(var(--hx-sidebar-w) + 28px); }
body.hx-app .footer a { color: var(--hx-text-2); }

/* ───────────── Cards ───────────── */
body.hx-app .card {
    background: var(--hx-surface) !important; color: var(--hx-text) !important;
    border: 1px solid var(--hx-border) !important; border-radius: var(--hx-radius-lg) !important;
    box-shadow: var(--hx-shadow-sm) !important;
}
body.hx-app .card:hover, body.hx-app .card-hover:hover { transform: none; box-shadow: var(--hx-shadow-sm) !important; }
body.hx-app a.card:hover, body.hx-app .card.card-link:hover, body.hx-app .job-card:hover { box-shadow: var(--hx-shadow) !important; border-color: var(--hx-border-strong) !important; }
body.hx-app .card-header, body.hx-app .card-footer {
    background: transparent !important; border-color: var(--hx-border) !important; padding: 14px 18px; color: var(--hx-text);
}
body.hx-app .card-header h5, body.hx-app .card-header .h5, body.hx-app .card-header .card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0; }
body.hx-app .card-body { padding: 18px; }
body.hx-app .list-group-item { background: transparent !important; border-color: var(--hx-border) !important; color: var(--hx-text) !important; }

/* KPI cards */
.kpi-card { display: flex; align-items: center; gap: 14px; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex: 0 0 auto; }
.kpi-label { font-size: .82rem; color: var(--hx-text-2); font-weight: 500; margin: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0; color: var(--hx-text); }
.kpi-sub { font-size: .78rem; color: var(--hx-text-3); }
.tone-primary { background: var(--hx-primary-soft); color: var(--primary-color); }
.tone-success { background: color-mix(in srgb, var(--success-color) 14%, transparent); color: var(--success-color); }
.tone-warning { background: color-mix(in srgb, var(--warning-color) 16%, transparent); color: var(--warning-color); }
.tone-danger { background: color-mix(in srgb, var(--danger-color) 14%, transparent); color: var(--danger-color); }
.tone-info { background: color-mix(in srgb, var(--info-color) 14%, transparent); color: var(--info-color); }
body.hx-app .bg-primary.bg-opacity-10 { background: var(--hx-primary-soft) !important; }

/* ───────────── Buttons ───────────── */
body.hx-app .btn { border-radius: var(--hx-radius-sm); font-weight: 500; font-size: .92rem; padding: 8px 14px; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
body.hx-app .btn-sm { padding: 5px 10px; font-size: .82rem; }
body.hx-app .btn-lg { padding: 11px 20px; font-size: 1rem; }
body.hx-app .btn-primary { background: var(--primary-color) !important; border: 1px solid var(--primary-color) !important; color: #fff !important; }
body.hx-app .btn-primary:hover { background: var(--hx-primary-hover) !important; border-color: var(--hx-primary-hover) !important; }
body.hx-app .btn-outline-primary { color: var(--hx-primary-text) !important; border: 1px solid color-mix(in srgb, var(--primary-color) 55%, transparent) !important; background: transparent !important; }
body.hx-app .btn-outline-primary:hover { background: var(--hx-primary-soft) !important; color: var(--hx-primary-text) !important; }
body.hx-app .btn-secondary, body.hx-app .btn-light, body.hx-app .btn-outline-secondary, body.hx-app .btn-outline-light {
    background: var(--hx-surface) !important; color: var(--hx-text) !important; border: 1px solid var(--hx-border-strong) !important;
}
body.hx-app .btn-secondary:hover, body.hx-app .btn-light:hover, body.hx-app .btn-outline-secondary:hover, body.hx-app .btn-outline-light:hover { background: var(--hx-hover) !important; }
body.hx-app .btn-outline-danger { color: var(--danger-color) !important; border-color: color-mix(in srgb, var(--danger-color) 55%, transparent) !important; background: transparent !important; }
body.hx-app .btn-outline-danger:hover { background: color-mix(in srgb, var(--danger-color) 10%, transparent) !important; }
body.hx-app .btn-danger { background: var(--danger-color) !important; border-color: var(--danger-color) !important; color: #fff !important; }
body.hx-app .btn-success { background: var(--success-color) !important; border-color: var(--success-color) !important; color: #fff !important; }
body.hx-app .btn-outline-success { color: var(--success-color) !important; border-color: color-mix(in srgb, var(--success-color) 55%, transparent) !important; background: transparent !important; }
body.hx-app .btn-outline-success:hover { background: color-mix(in srgb, var(--success-color) 10%, transparent) !important; }
body.hx-app .btn-outline-info { color: var(--info-color) !important; border-color: color-mix(in srgb, var(--info-color) 55%, transparent) !important; background: transparent !important; }
body.hx-app .btn-outline-warning { color: var(--warning-color) !important; border-color: color-mix(in srgb, var(--warning-color) 55%, transparent) !important; background: transparent !important; }
body.hx-app .btn:disabled, body.hx-app .btn.disabled { opacity: .55; }
body.hx-app .btn-link { color: var(--hx-primary-text) !important; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 1em; height: 1em;
    border: 2px solid currentColor; border-color: rgba(255,255,255,.9) rgba(255,255,255,.9) rgba(255,255,255,.25) rgba(255,255,255,.25);
    border-radius: 50%; animation: hx-spin .7s linear infinite;
}
.btn-outline-primary.is-busy::after, .btn-secondary.is-busy::after, .btn-light.is-busy::after, .btn-outline-secondary.is-busy::after {
    border-color: var(--primary-color) var(--primary-color) transparent transparent;
}
@keyframes hx-spin { to { transform: rotate(360deg); } }

/* ───────────── Forms ───────────── */
body.hx-app .form-control, body.hx-app .form-select {
    background-color: var(--hx-input-bg) !important; color: var(--hx-text) !important;
    border: 1px solid var(--hx-border-strong) !important; border-radius: var(--hx-radius-sm);
    padding: 8px 12px; font-size: .93rem; min-height: 40px;
}
body.hx-app textarea.form-control { min-height: 0; }
body.hx-app .form-control-sm, body.hx-app .form-select-sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
body.hx-app .form-control:focus, body.hx-app .form-select:focus { border-color: var(--primary-color) !important; }
body.hx-app .form-control::placeholder { color: var(--hx-text-3); opacity: 1; }
body.hx-app .form-control:disabled, body.hx-app .form-control[readonly] { background: var(--hx-surface-2) !important; color: var(--hx-text-2) !important; }
body.hx-app .form-control-color { padding: 4px; min-height: 40px; }
body.hx-app .form-label { font-size: .84rem; font-weight: 600; color: var(--hx-text-2); margin-bottom: 6px; text-transform: none; letter-spacing: 0; }
body.hx-app .form-text, body.hx-app small.text-muted { color: var(--hx-text-3) !important; }
body.hx-app .form-check-input { background-color: var(--hx-input-bg); border-color: var(--hx-border-strong); }
body.hx-app .form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
body.hx-app .input-group-text { background: var(--hx-surface-2) !important; border-color: var(--hx-border-strong) !important; color: var(--hx-text-2) !important; }
body.hx-app select option { background: var(--hx-surface); color: var(--hx-text); }

/* ───────────── Tables ───────────── */
body.hx-app .table { color: var(--hx-text) !important; border-color: var(--hx-border) !important; margin-bottom: 0; --bs-table-bg: transparent; --bs-table-striped-bg: var(--hx-surface-2); --bs-table-hover-bg: var(--hx-hover); --bs-table-striped-color: var(--hx-text); --bs-table-hover-color: var(--hx-text); }
body.hx-app .table > :not(caption) > * > * { background-color: transparent; }
body.hx-app .table th, body.hx-app .table thead th {
    background: var(--hx-surface-2) !important; color: var(--hx-text-2) !important; border-color: var(--hx-border) !important;
    font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: none; white-space: nowrap; padding: 10px 14px;
}
body.hx-app .table td { background: transparent !important; color: var(--hx-text) !important; border-color: var(--hx-border) !important; padding: 12px 14px; vertical-align: middle; }
body.hx-app .table-hover > tbody > tr:hover > * { background: var(--hx-hover) !important; }
body.hx-app .table-striped > tbody > tr:nth-of-type(odd) > * { background: var(--hx-surface-2) !important; }
body.hx-app .table-responsive { overflow-x: auto; }
body.hx-app .card > .table-responsive:last-child .table, body.hx-app .card-body.p-0 .table { margin-bottom: 0; }

/* ───────────── Badges, alerts, tabs, pills ───────────── */
body.hx-app .badge { font-weight: 600; border-radius: 999px; padding: .38em .7em; letter-spacing: .01em; }
/* Bootstrap keeps white text on .bg-warning / .bg-info badges, which is unreadable on yellow and light blue. */
body.hx-app .badge.bg-warning, body.hx-app .badge.bg-info, body.hx-app .badge.bg-light { color: #1f2937 !important; }
body.hx-app .alert { border-radius: var(--hx-radius); border-width: 1px; }
body.hx-app .alert-info { background: color-mix(in srgb, var(--info-color) 10%, var(--hx-surface)); color: var(--hx-text); border-color: color-mix(in srgb, var(--info-color) 35%, transparent); }
body.hx-app .alert-warning { background: color-mix(in srgb, var(--warning-color) 12%, var(--hx-surface)); color: var(--hx-text); border-color: color-mix(in srgb, var(--warning-color) 40%, transparent); }
body.hx-app .alert-danger { background: color-mix(in srgb, var(--danger-color) 10%, var(--hx-surface)); color: var(--hx-text); border-color: color-mix(in srgb, var(--danger-color) 40%, transparent); }
body.hx-app .alert-success { background: color-mix(in srgb, var(--success-color) 10%, var(--hx-surface)); color: var(--hx-text); border-color: color-mix(in srgb, var(--success-color) 40%, transparent); }
body.hx-app .nav-tabs { border-color: var(--hx-border); gap: 4px; }
body.hx-app .nav-tabs .nav-link { color: var(--hx-text-2); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 14px; font-weight: 500; background: transparent; }
body.hx-app .nav-tabs .nav-link:hover { color: var(--hx-text); }
body.hx-app .nav-tabs .nav-link.active { color: var(--hx-primary-text); border-bottom-color: var(--primary-color); background: transparent; }
body.hx-app .nav-pills .nav-link { color: var(--hx-text-2); border-radius: 999px; padding: 7px 14px; font-weight: 500; font-size: .9rem; }
body.hx-app .nav-pills .nav-link:hover { background: var(--hx-hover); color: var(--hx-text); }
body.hx-app .nav-pills .nav-link.active { background: var(--primary-color) !important; color: #fff !important; }
body.hx-app .page-link { background: var(--hx-surface); border-color: var(--hx-border); color: var(--hx-text-2); }
body.hx-app .page-item.active .page-link { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
body.hx-app .page-item.disabled .page-link { background: var(--hx-surface-2); color: var(--hx-text-3); }

/* ───────────── Dropdowns, modals ───────────── */
body.hx-app .dropdown-menu { background: var(--hx-surface) !important; border: 1px solid var(--hx-border) !important; border-radius: var(--hx-radius); box-shadow: var(--hx-shadow-lg); padding: 6px; }
body.hx-app .dropdown-item { border-radius: var(--hx-radius-sm); color: var(--hx-text) !important; padding: 7px 10px; font-size: .9rem; }
body.hx-app .dropdown-item i { width: 18px; text-align: center; color: var(--hx-text-3); margin-right: 6px; }
body.hx-app .dropdown-item:hover, body.hx-app .dropdown-item:focus, body.hx-app .dropdown-item.active { background: var(--hx-hover) !important; color: var(--hx-text) !important; }
body.hx-app .dropdown-item.active i { color: var(--primary-color); }
body.hx-app .modal-content { background: var(--hx-surface) !important; color: var(--hx-text) !important; border: 1px solid var(--hx-border) !important; border-radius: var(--hx-radius-lg); box-shadow: var(--hx-shadow-lg); }
body.hx-app .modal-header, body.hx-app .modal-footer { border-color: var(--hx-border) !important; }
body.hx-app .modal-backdrop.show { opacity: 1; background: var(--hx-backdrop); }
:root[data-theme="dark"] body.hx-app .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] body.hx-app .btn-close { filter: invert(1) grayscale(100%) brightness(200%); } }

/* ───────────── Toasts ───────────── */
#hxToasts { position: fixed; right: 20px; bottom: 20px; z-index: 2100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.hx-toast {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--hx-radius);
    background: var(--hx-surface); color: var(--hx-text); border: 1px solid var(--hx-border); border-left: 4px solid var(--info-color);
    box-shadow: var(--hx-shadow-lg); font-size: .92rem; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.hx-toast.show { opacity: 1; transform: none; }
.hx-toast .hx-toast-icon { margin-top: 2px; }
.hx-toast .hx-toast-msg { flex: 1; word-break: break-word; }
.hx-toast .hx-toast-close { background: none; border: 0; color: var(--hx-text-3); padding: 0 2px; line-height: 1; font-size: 1.1rem; cursor: pointer; }
.hx-toast.success { border-left-color: var(--success-color); } .hx-toast.success .hx-toast-icon { color: var(--success-color); }
.hx-toast.error { border-left-color: var(--danger-color); } .hx-toast.error .hx-toast-icon { color: var(--danger-color); }
.hx-toast.warning { border-left-color: var(--warning-color); } .hx-toast.warning .hx-toast-icon { color: var(--warning-color); }
.hx-toast.info .hx-toast-icon { color: var(--info-color); }

/* ───────────── Loading: top progress bar + skeletons ───────────── */
#hxProgress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2200; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
#hxProgress.active { opacity: 1; }
#hxProgress::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
    background: var(--primary-color);
    animation: hx-progress 1.1s ease-in-out infinite;
}
@keyframes hx-progress { to { left: 100%; } }
.skeleton {
    display: block; height: .9em; border-radius: 6px; background: var(--hx-skeleton);
    background-image: linear-gradient(90deg, var(--hx-skeleton) 0, var(--hx-skeleton-shine) 40%, var(--hx-skeleton) 80%);
    background-size: 300% 100%; animation: hx-shimmer 1.4s ease-in-out infinite;
}
.skeleton.sk-lg { height: 1.4em; } .skeleton.sk-circle { width: 34px; height: 34px; border-radius: 50%; }
@keyframes hx-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
tr.skeleton-row td { padding-top: 16px !important; padding-bottom: 16px !important; }
.skeleton-card { padding: 18px; border: 1px solid var(--hx-border); border-radius: var(--hx-radius-lg); background: var(--hx-surface); display: grid; gap: 10px; }
body.hx-app .spinner-border.text-primary { color: var(--primary-color) !important; }

/* ───────────── Empty states ───────────── */
.empty-state { text-align: center; padding: 44px 20px; color: var(--hx-text-2); }
.empty-state .es-icon {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
    background: var(--hx-primary-soft); color: var(--primary-color); font-size: 1.5rem;
}
.empty-state h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; color: var(--hx-text); }
.empty-state p { margin: 0 auto 16px; max-width: 420px; font-size: .92rem; }
td.empty-cell { padding: 0 !important; }
html.role-guest .empty-state .es-action.requires-member { display: none; }

/* ───────────── Page helpers ───────────── */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header h2 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.page-header p { margin: 4px 0 0; color: var(--hx-text-2); font-size: .92rem; }
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--hx-border); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.stat-delta { font-size: .78rem; font-weight: 600; }
.stat-delta.up { color: var(--success-color); } .stat-delta.down { color: var(--danger-color); }
.funnel-row { display: grid; grid-template-columns: minmax(110px, 42%) 1fr 44px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .9rem; }
.funnel-bar { height: 10px; border-radius: 999px; background: var(--hx-surface-3); overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary-color); }
.progress { background: var(--hx-surface-3) !important; border-radius: 999px; }
.progress-bar { background: var(--primary-color); }
.plan-card .plan-name { font-size: 1.15rem; font-weight: 700; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Settings pages: side navigation + content */
body.hx-app .settings-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; max-width: 1100px; }
body.hx-app .settings-nav { position: sticky; top: calc(var(--hx-topbar-h) + 16px); align-self: start; display: flex; flex-direction: column; gap: 2px; }
body.hx-app .settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--hx-radius-sm); color: var(--hx-text-2); text-decoration: none; font-weight: 500; font-size: .92rem; }
body.hx-app .settings-nav a i { width: 18px; text-align: center; color: var(--hx-text-3); }
body.hx-app .settings-nav a:hover { background: var(--hx-hover); color: var(--hx-text); }
body.hx-app .settings-nav a.active { background: var(--hx-primary-soft); color: var(--hx-primary-text); font-weight: 600; }
body.hx-app .settings-nav a.active i { color: var(--primary-color); }
body.hx-app .settings-nav .settings-nav-title { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: none; color: var(--hx-text-3); padding: 12px 12px 4px; }
body.hx-app .settings-container { max-width: none; margin: 0; padding: 0; }
body.hx-app .settings-content { background: var(--hx-surface); border: 1px solid var(--hx-border); border-radius: var(--hx-radius-lg); padding: 28px; box-shadow: var(--hx-shadow-sm); }
body.hx-app .settings-header { border-color: var(--hx-border); margin-bottom: 24px; padding-bottom: 18px; }
body.hx-app .settings-header h1, body.hx-app .settings-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--hx-text); margin: 0 0 4px; letter-spacing: -.01em; }
body.hx-app .settings-main { min-width: 0; }
body.hx-app .settings-main .settings-container { max-width: 860px; }
body.hx-app .settings-subtitle { color: var(--hx-text-2); font-size: .92rem; }
body.hx-app .settings-content .section-title { color: var(--hx-text); }
body.hx-app .btn-toggle-password { color: var(--hx-text-3); }
body.hx-app .toggle-slider { background-color: var(--hx-border-strong); }
body.hx-app .notification-item, body.hx-app .status-item { border-color: var(--hx-border) !important; }

/* Branding preview (Admin > Platform settings) */
.brand-preview { border: 1px solid var(--hx-border); border-radius: var(--hx-radius-lg); overflow: hidden; display: grid; grid-template-columns: 130px 1fr; min-height: 190px; font-size: .78rem; }
.brand-preview .bp-side { background: var(--hx-surface); border-right: 1px solid var(--hx-border); padding: 12px 8px; display: grid; align-content: start; gap: 4px; }
.brand-preview .bp-logo { height: 26px; max-width: 110px; object-fit: contain; margin: 0 auto 8px; }
.brand-preview .bp-link { padding: 6px 8px; border-radius: 6px; color: var(--hx-text-2); }
.brand-preview .bp-link.active { font-weight: 600; }
.brand-preview .bp-main { background: var(--hx-bg); padding: 14px; display: grid; gap: 10px; align-content: start; }
.brand-preview .bp-card { background: var(--hx-surface); border: 1px solid var(--hx-border); border-radius: 10px; padding: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand-preview .bp-btn { border-radius: 6px; padding: 6px 10px; color: #fff; font-weight: 600; border: 0; }
.brand-preview .bp-chip { border-radius: 999px; padding: 3px 8px; font-weight: 600; }
.contrast-note { font-size: .8rem; }
/* Favicon setting: a browser tab showing the icon at its real size */
.favicon-tile { height: 40px; width: 40px; object-fit: contain; border: 1px solid var(--hx-border); border-radius: 8px; padding: 4px; background: var(--hx-surface-2); flex: none; }
.favicon-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 7px 14px; border: 1px solid var(--hx-border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--hx-surface-2); color: var(--hx-text); font-size: .8rem; }
.favicon-tab img { width: 16px; height: 16px; object-fit: contain; flex: none; }
.favicon-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────────── Phones and tablets ───────────── */
@media (max-width: 991.98px) {
    body.hx-app #sidebar { box-shadow: var(--hx-shadow-lg); }
    body.hx-app.sidebar-open #mainContent, body.hx-app #mainContent { padding-left: 16px !important; padding-right: 16px; }
    body.hx-app .app-topbar { margin: 0 -16px 18px; padding: 8px 16px; gap: 8px; }
    body.hx-app.sidebar-open .footer, body.hx-app .footer { padding-left: 16px; }
    body.hx-app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: var(--hx-backdrop); }
    .app-search { flex: 1 1 auto; }
    .app-search .search-kbd { display: none; }
    body.hx-app .settings-shell { grid-template-columns: 1fr; gap: 16px; }
    body.hx-app .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
    body.hx-app .settings-nav .settings-nav-title { display: none; }
    body.hx-app .settings-nav a { white-space: nowrap; }
}
@media (max-width: 767.98px) {
    html { font-size: 14.5px; }
    body.hx-app .app-title { font-size: 1.08rem; }
    body.hx-app .app-search { position: static; flex: 0 0 auto; }
    body.hx-app .app-search .search-input { width: 38px; padding: 0 !important; color: transparent !important; cursor: pointer; border-color: transparent !important; background: transparent !important; }
    body.hx-app .app-search .search-icon { left: 50%; transform: translate(-50%, -50%); }
    body.hx-app .app-search:not(.open) .search-input::placeholder { color: transparent; }
    body.hx-app table.rt-cards td:empty { display: none; }
    body.hx-app .app-search.open { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 1065; }
    body.hx-app .app-search.open .search-input { width: 100%; padding: 0 16px 0 38px !important; color: var(--hx-text) !important; background: var(--hx-surface) !important; border-color: var(--hx-border) !important; cursor: text; }
    body.hx-app .app-search.open .search-icon { left: 14px; transform: translateY(-50%); }
    body.hx-app .app-search.open ~ .topbar-actions, body.hx-app .app-topbar:has(.app-search.open) .app-title { visibility: hidden; }
    body.hx-app .card-body { padding: 14px; }
    body.hx-app .settings-content { padding: 18px; }
    .page-header { align-items: stretch; }
    .page-header > .d-flex { flex-wrap: wrap; }
    body.hx-app .modal-dialog { margin: 10px; }
    #hxToasts { right: 12px; left: 12px; bottom: 12px; max-width: none; }
    .brand-preview { grid-template-columns: 1fr; }
    .brand-preview .bp-side { display: none; }

    /* Tables become stacked cards: each cell shows its column name (set by ui.js from the header). */
    body.hx-app table.rt-cards thead { display: none; }
    body.hx-app table.rt-cards, body.hx-app table.rt-cards tbody, body.hx-app table.rt-cards tr, body.hx-app table.rt-cards td { display: block; width: 100% !important; }
    body.hx-app table.rt-cards tr { border: 1px solid var(--hx-border); border-radius: var(--hx-radius); margin: 10px 0; padding: 6px 0; background: var(--hx-surface); }
    body.hx-app table.rt-cards td { border: 0 !important; padding: 6px 14px !important; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; min-height: 34px; }
    body.hx-app table.rt-cards td::before { content: attr(data-label); font-size: .72rem; font-weight: 600; text-transform: none; letter-spacing: .04em; color: var(--hx-text-3); text-align: left; flex: 0 0 38%; }
    body.hx-app table.rt-cards td:not([data-label])::before, body.hx-app table.rt-cards td[data-label=""]::before { display: none; }
    body.hx-app table.rt-cards td[colspan] { display: block; text-align: center; }
    body.hx-app table.rt-cards td[colspan]::before { display: none; }
    body.hx-app table.rt-cards tr.skeleton-row td::before { display: none; }
    body.hx-app table.rt-cards td .btn-group, body.hx-app table.rt-cards td .d-flex { justify-content: flex-end; flex-wrap: wrap; }
    body.hx-app table.rt-cards.table-striped > tbody > tr:nth-of-type(odd) > * { background: transparent !important; }
    body.hx-app .card > .card-body.p-0 > .table-responsive > table.rt-cards, body.hx-app .card .table-responsive > table.rt-cards { padding: 0 10px; }
}
@media (min-width: 992px) {
    /* Desktop: the sidebar can still be collapsed with the menu button. */
    body.hx-app .sidebar-backdrop { display: none !important; }
}

/* ───────────── Print ───────────── */
@media print {
    body.hx-app #sidebar, body.hx-app .app-topbar, body.hx-app .footer, #hxToasts, #hxProgress { display: none !important; }
    body.hx-app #mainContent { padding: 0 !important; }
}

/* Live interview page: its buttons sit in the top bar next to the title. */
body.hx-app .app-topbar #tp_hrd_cntnr:empty { display: none; }
body.hx-app .app-topbar #tp_hrd_cntnr #join-btn { float: none !important; margin: 0 !important; }
body.hx-app .app-topbar #precheck-btn { position: static; float: none; margin: 0; white-space: nowrap; }

/* Logo: most logos are made for dark backgrounds. In light mode show the optional light-background logo,
   or put the main logo on a dark tile so white lettering stays readable. */
.brand-link { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 10px; }
.brand-link .logo-for-light { display: none; }
:root[data-theme="light"] .brand-link.brand-tile { background: #0b1120; }
:root[data-theme="light"] .brand-link:not(.brand-tile) .logo-for-dark { display: none; }
:root[data-theme="light"] .brand-link:not(.brand-tile) .logo-for-light { display: inline-block; }
@media (prefers-color-scheme: light) {
    :root[data-theme="system"] .brand-link.brand-tile { background: #0b1120; }
    :root[data-theme="system"] .brand-link:not(.brand-tile) .logo-for-dark { display: none; }
    :root[data-theme="system"] .brand-link:not(.brand-tile) .logo-for-light { display: inline-block; }
}
.page-header .form-select { min-width: 170px; }

/* ── Uniform type (row 52, client 25 Oct) ───────────────────────────────────────────────────────────────────────
   One font and one size scale on every page; text is written in sentence case (no capitals by CSS, except avatar
   initials). Pages that set their own heading sizes inline are brought onto the same scale here. */
body.hx-app, body.hx-app button, body.hx-app input, body.hx-app select, body.hx-app textarea, body.hx-app .tooltip, body.hx-app .popover {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
body.hx-app .main-content h1, body.hx-app .main-content .h1 { font-size: 1.5rem; font-weight: 700; }
body.hx-app .main-content h2, body.hx-app .main-content .h2 { font-size: 1.3rem; font-weight: 700; }
body.hx-app .main-content h3, body.hx-app .main-content .h3 { font-size: 1.15rem; font-weight: 600; }
body.hx-app .main-content h4, body.hx-app .main-content .h4 { font-size: 1.05rem; font-weight: 600; }
body.hx-app .main-content h5, body.hx-app .main-content .h5,
body.hx-app .card-title, body.hx-app .modal-title { font-size: 1rem; font-weight: 600; }
body.hx-app .main-content h6, body.hx-app .main-content .h6 { font-size: .92rem; font-weight: 600; }
body.hx-app .table > thead > tr > th { font-size: .8rem; letter-spacing: 0; }
body.hx-app .sidebar-section, body.hx-app .search-group-title, body.hx-app .settings-nav .settings-nav-title { letter-spacing: .02em; font-size: .75rem; }

/* CV viewer drawn in the page (candidate-collab.js, client test sheet 10 Nov row 9) */
.hx-cv-body { background: #f1f3f5; }
.hx-cv-pages { padding: 16px; }
.hx-cv-page { display: block; margin: 0 auto 16px; max-width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
