/**
 * CHM ERP — Enterprise UI (component layer)
 * Tokens: chm-design-system.css | Theme semantics: chm-theme.css
 */

/* Component layer uses var(--chm-*) from design system + theme */

/* ─── Base ──────────────────────────────────────────────── */
.chm-ui.chm-app {
    font-family: var(--chm-font) !important;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--chm-text);
    background: var(--chm-bg) !important;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
}

.chm-ui .wrapper .topbar {
    box-shadow: none !important;
}

/* ─── Shell layout ──────────────────────────────────────── */
.chm-ui .sidebar-wrapper {
    width: var(--chm-sidebar-w) !important;
    background: var(--chm-sidebar-bg) !important;
    border-right: 1px solid var(--chm-border) !important;
    box-shadow: var(--chm-shadow-sidebar) !important;
    z-index: 1001;
}

.chm-ui .sidebar-header {
    width: var(--chm-sidebar-w) !important;
    height: var(--chm-topbar-h) !important;
    min-height: var(--chm-topbar-h) !important;
    padding: 0 1.25rem !important;
    background: var(--chm-sidebar-bg) !important;
    border-bottom: 1px solid var(--chm-border) !important;
    position: fixed !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem;
}

.chm-ui .sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--chm-sidebar-stripe);
    opacity: 0.85;
}

.chm-ui .sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: var(--chm-shadow);
}

.chm-ui .sidebar-header .logo-text {
    color: var(--chm-brand) !important;
    font-size: 0.9375rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.025em !important;
    margin: 0 !important;
}

.chm-ui .sidebar-header .toggle-icon {
    color: var(--chm-text-muted) !important;
    cursor: pointer;
    width: 2.125rem;
    height: 2.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--chm-radius-sm);
    border: 1px solid var(--chm-border);
    background: var(--chm-surface-2);
    transition: all var(--chm-ease);
}

.chm-ui .sidebar-header .toggle-icon:hover {
    background: var(--chm-primary-soft);
    border-color: var(--chm-primary);
    color: var(--chm-primary) !important;
}

.chm-ui .topbar {
    left: var(--chm-sidebar-w) !important;
    height: var(--chm-topbar-h) !important;
    min-height: var(--chm-topbar-h) !important;
    background: var(--chm-surface) !important;
    border-bottom: 1px solid var(--chm-border) !important;
    padding: 0 1.75rem !important;
    z-index: 999;
    box-shadow: var(--chm-shadow) !important;
}

.chm-ui .page-wrapper {
    margin-left: var(--chm-sidebar-w) !important;
    margin-top: var(--chm-topbar-h) !important;
    background: var(--chm-bg) !important;
    min-height: calc(100vh - var(--chm-topbar-h));
}

.chm-ui .page-footer {
    left: var(--chm-sidebar-w) !important;
    background: var(--chm-surface) !important;
    border-top: 1px solid var(--chm-border) !important;
    color: var(--chm-text-muted) !important;
    font-size: 0.75rem;
    padding: 0.875rem 1.75rem !important;
}

.chm-ui.wrapper.toggled .sidebar-wrapper,
.chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper {
    width: var(--chm-sidebar-collapsed) !important;
}

.chm-ui.wrapper.toggled .sidebar-header,
.chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-header {
    width: var(--chm-sidebar-collapsed) !important;
}

.chm-ui.wrapper.toggled .page-wrapper,
.chm-ui.wrapper.toggled .topbar,
.chm-ui.wrapper.toggled .page-footer {
    margin-left: var(--chm-sidebar-collapsed) !important;
    left: var(--chm-sidebar-collapsed) !important;
}

@media (max-width: 1024px) {
    .chm-ui .sidebar-wrapper {
        left: calc(-1 * var(--chm-sidebar-w));
        transition: left var(--chm-ease);
    }
    .chm-ui.wrapper.toggled .sidebar-wrapper {
        left: 0 !important;
        width: var(--chm-sidebar-w) !important;
    }
    .chm-ui .page-wrapper,
    .chm-ui .topbar,
    .chm-ui .page-footer {
        margin-left: 0 !important;
        left: 0 !important;
    }
}

.chm-ui .page-content {
    padding: 1.75rem 2rem 3rem;
    max-width: 1480px;
}

@media (max-width: 767.98px) {
    .chm-ui .page-content {
        padding: 1.25rem 1rem 2rem;
    }
}

/* ─── Sidebar nav ───────────────────────────────────────── */
.chm-ui .sidebar-wrapper .metismenu {
    margin-top: var(--chm-topbar-h) !important;
    padding: 0.625rem 0.75rem 1.25rem !important;
}

.chm-ui .sidebar-wrapper .metismenu .menu-label {
    color: var(--chm-sidebar-muted) !important;
    font-size: 0.625rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.14em !important;
    padding: 1rem 0.875rem 0.375rem !important;
    border: none !important;
    margin: 0 !important;
}

.chm-ui .sidebar-wrapper .metismenu .menu-label::before {
    display: none !important;
}

.chm-ui .sidebar-wrapper .metismenu > li > a {
    color: var(--chm-sidebar-text) !important;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    padding: 0.5625rem 0.875rem !important;
    margin: 0.125rem 0 !important;
    border-radius: var(--chm-radius-sm) !important;
    border-left: none !important;
    transition: all var(--chm-ease);
}

.chm-ui .sidebar-wrapper .metismenu > li > a .parent-icon {
    background: var(--chm-surface-2) !important;
    color: var(--chm-sidebar-muted) !important;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid var(--chm-border);
}

.chm-ui .sidebar-wrapper .metismenu ul {
    border: none !important;
    margin: 0.125rem 0 0.25rem 1.75rem !important;
    padding: 0.125rem 0 0.125rem 0.75rem !important;
    background: transparent !important;
    border-left: 2px solid var(--chm-border) !important;
}

.chm-ui .sidebar-wrapper .metismenu ul a {
    color: var(--chm-sidebar-muted) !important;
    font-size: 0.8125rem;
    padding: 0.375rem 0.625rem !important;
    border-radius: 6px !important;
}

.chm-ui .sidebar-wrapper .metismenu ul a::before {
    display: none !important;
}

.chm-ui .sidebar-wrapper .metismenu a:hover {
    background: var(--chm-surface-2) !important;
    color: var(--chm-brand) !important;
}

.chm-ui .sidebar-wrapper .metismenu .mm-active > a,
.chm-ui .sidebar-wrapper .metismenu a.chm-active {
    background: var(--chm-primary-soft) !important;
    color: var(--chm-primary) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.chm-ui .sidebar-wrapper .metismenu .mm-active > a .parent-icon,
.chm-ui .sidebar-wrapper .metismenu a.chm-active .parent-icon {
    background: var(--chm-primary) !important;
    color: #fff !important;
    border-color: var(--chm-primary) !important;
}

.chm-ui .chm-recent-pages,
.chm-ui .chm-favorites-pages {
    padding: 0.75rem 1rem !important;
    border-top: 1px solid var(--chm-border) !important;
    background: var(--chm-surface-2) !important;
}

.chm-ui .chm-recent-pages-title {
    color: var(--chm-sidebar-muted) !important;
    font-size: 0.625rem !important;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.chm-ui .chm-recent-pages a,
.chm-ui .chm-favorites-pages .chm-fav-row a {
    color: var(--chm-sidebar-text) !important;
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    display: block;
}

.chm-ui .chm-recent-pages a:hover,
.chm-ui .chm-favorites-pages .chm-fav-row a:hover {
    background: var(--chm-primary-soft);
    color: var(--chm-primary) !important;
}

/* Sidebar always expanded on desktop — no icon-rail collapse */
@media (min-width: 1025px) {
    .chm-ui .sidebar-header .toggle-icon {
        display: none !important;
    }

    .chm-ui.wrapper.toggled .sidebar-wrapper,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper {
        width: var(--chm-sidebar-w) !important;
        left: 0 !important;
    }

    .chm-ui.wrapper.toggled .sidebar-header,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-header {
        width: var(--chm-sidebar-w) !important;
    }

    .chm-ui.wrapper.toggled .page-wrapper,
    .chm-ui.wrapper.toggled .topbar,
    .chm-ui.wrapper.toggled .page-footer {
        margin-left: var(--chm-sidebar-w) !important;
        left: var(--chm-sidebar-w) !important;
    }

    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-header .logo-text,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .chm-recent-pages,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .chm-favorites-pages,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper .metismenu .menu-title,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper .metismenu .menu-label,
    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper .metismenu li ul {
        display: revert !important;
    }

    .chm-ui.wrapper.toggled:not(.sidebar-hovered) .sidebar-wrapper .metismenu > li > a {
        justify-content: flex-start !important;
        padding: var(--chm-nav-item-py) var(--chm-nav-item-px) !important;
    }
}

/* ─── Topbar ────────────────────────────────────────────── */
.chm-ui .topbar .nav-link {
    width: 2.375rem;
    height: 2.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--chm-radius-sm);
    color: var(--chm-text-secondary) !important;
    border: 1px solid transparent;
    transition: all var(--chm-ease);
}

.chm-ui .topbar .nav-link:hover {
    background: var(--chm-surface-2) !important;
    border-color: var(--chm-border);
    color: var(--chm-brand) !important;
}

.chm-ui .topbar .user-box {
    border-left: 1px solid var(--chm-border) !important;
    padding-left: 1rem !important;
    margin-left: 0.75rem;
}

.chm-ui .topbar .user-name {
    color: var(--chm-text) !important;
    font-weight: 700;
    font-size: 0.8125rem;
}

.chm-ui .topbar .designattion {
    color: var(--chm-text-muted) !important;
    font-size: 0.6875rem;
}

.chm-ui .topbar .user-img {
    width: 38px;
    height: 38px;
    border: 2px solid var(--chm-border);
    box-shadow: var(--chm-shadow);
}

.chm-ui .topbar .alert-count {
    background: var(--chm-gold) !important;
    font-size: 0.625rem;
}

.chm-ui .topbar .dropdown-menu {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius);
    box-shadow: var(--chm-shadow-md);
    padding: 0.375rem;
}

.chm-ui .topbar .dropdown-item {
    border-radius: var(--chm-radius-sm);
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

.chm-global-search-input-wrap {
    background: var(--chm-surface-2);
    border: 1px solid var(--chm-border);
    border-radius: 999px;
    padding: 0.4375rem 1rem;
}

.chm-global-search-input-wrap:focus-within {
    border-color: var(--chm-primary);
    box-shadow: 0 0 0 3px var(--chm-primary-ring);
    background: var(--chm-surface);
}

.chm-global-search input {
    font-size: 0.8125rem;
    color: var(--chm-text);
}

/* ─── Page headers ──────────────────────────────────────── */
.chm-ui .chm-page-header,
.chm-ui .page-breadcrumb,
.chm-ui .page-content > .page-breadcrumb {
    background: var(--chm-surface) !important;
    border: 1px solid var(--chm-border) !important;
    box-shadow: var(--chm-shadow) !important;
    border-radius: var(--chm-radius-lg) !important;
    padding: 1.25rem 1.5rem !important;
    margin-bottom: 1.5rem !important;
    position: relative;
    overflow: hidden;
}

.chm-ui .chm-page-header::before,
.chm-ui .page-breadcrumb::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--chm-primary) 0%, var(--chm-gold) 100%);
    display: block !important;
}

.chm-ui .chm-page-header-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.03em !important;
    color: var(--chm-brand) !important;
}

.chm-ui .chm-page-header-title i {
    color: var(--chm-gold) !important;
}

.chm-ui .chm-page-header-subtitle {
    color: var(--chm-text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.chm-ui .breadcrumb-item a {
    color: var(--chm-primary) !important;
    font-weight: 600;
    text-decoration: none;
}

.chm-ui .breadcrumb-item.active {
    color: var(--chm-text-muted) !important;
}

.chm-ui .page-breadcrumb .btn-light,
.chm-ui .page-breadcrumb .btn-primary,
.chm-ui .chm-page-header .btn-primary {
    background: var(--chm-primary) !important;
    border-color: var(--chm-primary) !important;
    color: #fff !important;
    border-radius: var(--chm-radius-sm);
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.5rem 1rem;
}

/* ─── Dashboard ─────────────────────────────────────────── */
.chm-dash-hero {
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-lg);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--chm-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.chm-dash-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--chm-bg-accent);
    opacity: 0.5;
    pointer-events: none;
}

.chm-dash-hero > * {
    position: relative;
    z-index: 1;
}

.chm-dash-hero-text h1 {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.375rem;
    color: var(--chm-brand);
}

.chm-dash-hero-text p {
    color: var(--chm-text-secondary);
    margin: 0;
    font-size: 0.9375rem;
    max-width: 36rem;
}

.chm-dash-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--chm-primary-soft);
    color: var(--chm-primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    border: 1px solid rgba(21, 128, 61, 0.2);
    white-space: nowrap;
}

.chm-dash-hero-badge i {
    color: var(--chm-gold);
}

.chm-dash-intro,
.chm-welcome-banner,
.chm-executive-header,
.chm-dash-header {
    all: unset;
    display: block;
}

/* Quick actions panel */
.chm-dash-actions {
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--chm-shadow);
}

.chm-dash-actions-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--chm-text-muted);
    margin-bottom: 0;
}

.chm-dash-actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chm-dash-actions-subtitle {
    font-size: 0.8125rem;
    color: var(--chm-text-muted);
    margin-top: 0.25rem;
}

.chm-quick-actions-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--chm-border);
}

@media (min-width: 768px) {
    .chm-quick-actions-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.chm-quick-actions-customize {
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.chm-quick-actions-empty {
    grid-column: 1 / -1;
    padding: 1rem;
    border: 1px dashed var(--chm-border);
    border-radius: var(--chm-radius);
    background: var(--chm-surface-2);
    text-align: center;
}

.chm-quick-actions-picker .chm-quick-actions-group + .chm-quick-actions-group {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--chm-border);
}

.chm-quick-actions-picker h6 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chm-text-muted);
    margin-bottom: 0.75rem;
}

.chm-quick-action-option {
    display: block;
    margin: 0;
    cursor: pointer;
}

.chm-quick-action-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chm-quick-action-option-body {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius);
    background: var(--chm-surface-2);
    transition: all var(--chm-ease);
    min-height: 100%;
}

.chm-quick-action-option-body i {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--chm-primary-soft);
    color: var(--chm-primary);
    flex-shrink: 0;
}

.chm-quick-action-option input:checked + .chm-quick-action-option-body {
    border-color: var(--chm-primary);
    background: var(--chm-primary-soft);
    box-shadow: inset 0 0 0 1px var(--chm-primary);
}

.chm-quick-action-option:hover .chm-quick-action-option-body {
    border-color: var(--chm-primary);
}

/* Quick actions customize modal — scrollable body, sticky footer */
.chm-quick-actions-modal .modal-dialog {
    max-height: calc(100vh - 2rem);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.chm-quick-actions-modal .modal-content {
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chm-quick-actions-modal .modal-header,
.chm-quick-actions-modal .modal-footer {
    flex-shrink: 0;
}

.chm-quick-actions-modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 12rem);
}

@media (max-width: 575.98px) {
    .chm-quick-actions-modal .modal-dialog {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }

    .chm-quick-actions-modal .modal-content {
        max-height: calc(100vh - 1rem);
    }

    .chm-quick-actions-modal .modal-body {
        max-height: calc(100vh - 10rem);
    }
}

/* Application tools — email, files, todos, calendar */
.chm-app-list-item-unread {
    border-left: 3px solid var(--chm-primary);
    background: var(--chm-primary-soft);
}

.chm-app-email-body {
    line-height: 1.7;
    white-space: pre-wrap;
}

.chm-app-meta dt {
    color: var(--chm-text-muted);
    font-size: 0.8125rem;
}

.chm-todo-check {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chm-todo-completed {
    opacity: 0.75;
}

.chm-todo-priority-high { background: #fee2e2; color: #991b1b; }
.chm-todo-priority-medium { background: #fef3c7; color: #92400e; }
.chm-todo-priority-low { background: #e0e7ff; color: #3730a3; }

.chm-calendar-upcoming-item {
    display: flex;
    gap: 0.625rem;
    align-items: flex-start;
}

.chm-calendar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 0.35rem;
    flex-shrink: 0;
}

#chmCalendar {
    min-height: 620px;
}

#chmCalendar .fc-toolbar-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.chm-command-bar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.chm-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.625rem;
    margin: 0;
}

.chm-quick-btn {
    background: var(--chm-surface-2);
    border: 1px solid var(--chm-border);
    color: var(--chm-text);
    border-radius: var(--chm-radius);
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--chm-ease);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-height: 72px;
}

.chm-quick-btn i {
    color: var(--chm-primary);
    font-size: 1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--chm-primary-soft);
    border-radius: 8px;
}

.chm-quick-btn:hover {
    background: var(--chm-primary);
    border-color: var(--chm-primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--chm-shadow-md);
}

.chm-quick-btn:hover i {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

/* Stat / KPI cards */
.chm-stat-card,
.chm-kpi-card {
    background: var(--chm-surface) !important;
    border: 1px solid var(--chm-border) !important;
    border-radius: var(--chm-radius) !important;
    padding: 1.375rem !important;
    box-shadow: var(--chm-shadow) !important;
    transition: box-shadow var(--chm-ease), transform var(--chm-ease);
    position: relative;
    overflow: hidden;
}

.chm-stat-card::before,
.chm-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--chm-sidebar-stripe);
    opacity: 0.85;
}

.chm-stat-card:hover,
.chm-kpi-card:hover {
    box-shadow: var(--chm-shadow-md) !important;
    transform: translateY(-2px);
}

.chm-stat-icon,
.chm-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 1.0625rem;
}

.chm-stat-value,
.chm-kpi-value {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--chm-brand);
}

.chm-stat-label,
.chm-kpi-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chm-text-muted);
}

.chm-stat-link,
.chm-kpi-link {
    color: var(--chm-primary);
    font-size: 0.75rem;
    font-weight: 600;
}

.chm-section {
    margin-bottom: 1.75rem;
}

.chm-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--chm-brand);
    border: none;
    margin-bottom: 1rem;
    padding: 0 0 0.5rem;
    border-bottom: 2px solid var(--chm-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chm-section-title i {
    color: var(--chm-gold);
}

/* ─── Cards ─────────────────────────────────────────────── */
.chm-ui .card,
.chm-card,
.chm-widget-card,
.chm-activity-card,
.chm-table-wrap {
    background: var(--chm-surface) !important;
    border: 1px solid var(--chm-border) !important;
    border-radius: var(--chm-radius-lg) !important;
    box-shadow: var(--chm-shadow) !important;
}

.chm-ui .card .card-header,
.chm-activity-card .card-header,
.chm-widget-card .card-header {
    background: var(--chm-surface-2) !important;
    border-bottom: 1px solid var(--chm-border) !important;
    padding: 1rem 1.375rem !important;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--chm-brand) !important;
    border-radius: var(--chm-radius-lg) var(--chm-radius-lg) 0 0 !important;
}

.chm-ui .card .card-body {
    padding: 1.375rem !important;
}

/* ─── Buttons ───────────────────────────────────────────── */
.chm-ui .btn-primary {
    background: var(--chm-primary) !important;
    border-color: var(--chm-primary) !important;
    font-weight: 600;
    border-radius: var(--chm-radius-sm);
}

.chm-ui .btn-primary:hover {
    background: var(--chm-primary-hover) !important;
    border-color: var(--chm-primary-hover) !important;
}

.chm-ui .btn {
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: var(--chm-radius-sm);
}

.chm-ui .btn-success {
    background: var(--chm-brand) !important;
    border-color: var(--chm-brand) !important;
}

/* ─── Forms ─────────────────────────────────────────────── */
.chm-ui .form-control,
.chm-ui .form-select {
    border: 1px solid var(--chm-border-strong);
    border-radius: var(--chm-radius-sm);
    padding: 0.5625rem 0.875rem;
    font-size: 0.875rem;
    background: var(--chm-surface);
    color: var(--chm-text);
}

.chm-ui .form-control:focus,
.chm-ui .form-select:focus {
    border-color: var(--chm-primary);
    box-shadow: 0 0 0 3px var(--chm-primary-ring);
}

.chm-ui .form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--chm-text);
}

/* ─── Tables ────────────────────────────────────────────── */
.chm-ui .table thead th {
    background: var(--chm-surface-2) !important;
    color: var(--chm-brand) !important;
    border-bottom: 2px solid var(--chm-border) !important;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.8125rem 1rem;
}

.chm-ui .table tbody td {
    padding: 0.875rem 1rem;
    border-color: var(--chm-border);
    font-size: 0.8125rem;
    vertical-align: middle;
}

.chm-ui .table tbody tr:hover {
    background: var(--chm-primary-soft) !important;
}

.chm-table-toolbar {
    padding: 0.875rem 1.375rem;
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface-2);
    border-radius: var(--chm-radius-lg) var(--chm-radius-lg) 0 0;
}

.chm-ui .dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--chm-border);
    border-radius: 999px;
    padding: 0.375rem 0.875rem;
}

.chm-ui .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--chm-primary) !important;
    border-color: var(--chm-primary) !important;
    color: #fff !important;
    border-radius: var(--chm-radius-sm) !important;
}

.chm-ui .dt-buttons .btn {
    font-size: 0.75rem;
    border-radius: var(--chm-radius-sm);
}

/* DataTables sort icons — hide default unicode arrows; use subtle active indicator */
.chm-ui table.dataTable > thead th.sorting:before,
.chm-ui table.dataTable > thead th.sorting:after,
.chm-ui table.dataTable > thead th.sorting_asc:before,
.chm-ui table.dataTable > thead th.sorting_asc:after,
.chm-ui table.dataTable > thead th.sorting_desc:before,
.chm-ui table.dataTable > thead th.sorting_desc:after,
.chm-ui table.dataTable > thead th.sorting_asc_disabled:before,
.chm-ui table.dataTable > thead th.sorting_asc_disabled:after,
.chm-ui table.dataTable > thead th.sorting_desc_disabled:before,
.chm-ui table.dataTable > thead th.sorting_desc_disabled:after {
    display: none !important;
}

.chm-ui table.dataTable > thead th.sorting_asc::after {
    content: "▴" !important;
    display: block !important;
    position: absolute;
    right: 0.65rem;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    font-size: 0.5rem;
    line-height: 1;
    opacity: 0.85;
    color: var(--chm-primary, #1e3a5f);
}

.chm-ui table.dataTable > thead th.sorting_desc::after {
    content: "▾" !important;
    display: block !important;
    position: absolute;
    right: 0.65rem;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    font-size: 0.5rem;
    line-height: 1;
    opacity: 0.85;
    color: var(--chm-primary, #1e3a5f);
}

div.dataTables_scrollBody thead,
div.dataTables_scrollBody table thead .sorting:before,
div.dataTables_scrollBody table thead .sorting:after,
div.dataTables_scrollBody table thead .sorting_asc:before,
div.dataTables_scrollBody table thead .sorting_asc:after,
div.dataTables_scrollBody table thead .sorting_desc:before,
div.dataTables_scrollBody table thead .sorting_desc:after {
    display: none !important;
}

.chm-ui .dataTables_wrapper .dataTables_length,
.chm-ui .dataTables_wrapper .dataTables_filter,
.chm-ui .dataTables_wrapper .dataTables_info,
.chm-ui .dataTables_wrapper .dataTables_paginate {
    font-size: 0.8125rem;
    color: var(--chm-text-muted);
    padding: 0.75rem 1.375rem;
}

.chm-ui .dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--chm-radius-sm) !important;
    padding: 0.3125rem 0.625rem !important;
    margin: 0 0.125rem;
}

/* ─── Badges & status ───────────────────────────────────── */
.chm-status-success { background: var(--chm-primary-soft); color: var(--chm-primary); }
.chm-status-danger  { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
.chm-status-warning { background: var(--chm-gold-soft); color: #92400e; }
.chm-status-info    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.chm-status-neutral { background: var(--chm-surface-2); color: var(--chm-text-muted); }

.chm-status {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}

/* ─── Modals, alerts, tabs ──────────────────────────────── */
.chm-ui .modal-content {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-lg);
    box-shadow: var(--chm-shadow-md);
}

.chm-ui .alert {
    border-radius: var(--chm-radius-sm);
    font-size: 0.8125rem;
}

.chm-ui .nav-tabs {
    border-bottom: 2px solid var(--chm-border);
}

.chm-ui .nav-tabs .nav-link.active {
    color: var(--chm-primary);
    border-bottom-color: var(--chm-primary);
    font-weight: 600;
}

/* ─── Notifications panel ───────────────────────────────── */
.chm-notifications-panel {
    width: 360px;
    border-radius: var(--chm-radius-lg) !important;
    overflow: hidden;
}

.chm-notifications-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface-2);
}

.chm-notification-item:hover {
    background: var(--chm-primary-soft);
}

/* ─── Theme toggle & favorites ──────────────────────────── */
.chm-ui #chmFavoriteToggle.is-active i {
    color: var(--chm-gold);
}

.chm-theme-option.active {
    color: var(--chm-primary) !important;
    font-weight: 600;
}

/* ─── Skeleton ──────────────────────────────────────────── */
.chm-page-skeleton {
    background: var(--chm-bg);
}

.chm-skeleton {
    background: linear-gradient(90deg, var(--chm-border) 0%, var(--chm-surface-2) 50%, var(--chm-border) 100%);
    background-size: 200% 100%;
    animation: chm-shimmer 1.2s ease-in-out infinite;
    border-radius: var(--chm-radius-sm);
}

@keyframes chm-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Auth pages ────────────────────────────────────────── */
@keyframes chm-auth-enter {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes chm-auth-banner-zoom {
    from { transform: scale(1); }
    to   { transform: scale(1.06); }
}

@keyframes chm-auth-spin {
    to { transform: rotate(360deg); }
}

@keyframes chm-auth-float {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(12px, -18px); }
}

.chm-auth {
    background: var(--chm-bg) !important;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    position: relative;
    overflow-x: hidden;
}

.chm-auth .wrapper {
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Decorative background orbs (right panel) */
.chm-auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.chm-auth-bg__orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
}

.chm-auth-bg__orb--1 {
    width: 420px;
    height: 420px;
    background: var(--chm-accent-soft);
    top: -120px;
    right: -80px;
    animation: chm-auth-float 14s ease-in-out infinite;
}

.chm-auth-bg__orb--2 {
    width: 320px;
    height: 320px;
    background: var(--chm-gold-soft);
    bottom: 10%;
    right: 15%;
    animation: chm-auth-float 18s ease-in-out infinite reverse;
}

.chm-auth-bg__orb--3 {
    width: 260px;
    height: 260px;
    background: var(--chm-primary-soft);
    top: 40%;
    right: 35%;
    animation: chm-auth-float 22s ease-in-out infinite;
}

.chm-auth-bg__grid {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(var(--chm-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--chm-border) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 75%);
}

[data-chm-theme="dark"] .chm-auth-bg__grid {
    opacity: 0.15;
}

/* Auth appearance preferences */
.chm-auth-prefs {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
}

.chm-auth-prefs-btn {
    width: 2.625rem;
    height: 2.625rem;
    border-radius: 50%;
    border: 1px solid var(--chm-border);
    background: var(--chm-surface);
    color: var(--chm-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    box-shadow: var(--chm-shadow-sm);
    transition: all var(--chm-duration-fast);
}

.chm-auth-prefs-btn:hover,
.chm-auth-prefs-btn.show {
    color: var(--chm-primary);
    border-color: var(--chm-primary);
    background: var(--chm-primary-soft);
}

.chm-auth-prefs-menu {
    width: 15.5rem;
    padding: 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md);
    box-shadow: var(--chm-shadow-lg);
    background: var(--chm-surface);
}

.chm-auth-prefs-menu__header {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.25rem 0.375rem 0.625rem;
    margin-bottom: 0.375rem;
    border-bottom: 1px solid var(--chm-border);
}

.chm-auth-prefs-menu__header strong {
    font-size: var(--chm-text-sm);
    color: var(--chm-text);
}

.chm-auth-prefs-menu__header span {
    font-size: var(--chm-text-xs);
}

.chm-auth-prefs-section {
    padding: 0.5rem 0.375rem;
}

.chm-auth-prefs-section + .chm-auth-prefs-section {
    border-top: 1px solid var(--chm-border);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

.chm-auth-prefs-label {
    display: block;
    font-size: var(--chm-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--chm-text-muted);
    margin-bottom: 0.5rem;
}

.chm-auth-prefs-menu .chm-pref-options {
    display: flex;
    gap: 0.375rem;
}

.chm-auth-prefs-menu .chm-pref-option {
    flex: 1;
    justify-content: center;
    padding: 0.5rem;
    min-width: 0;
    font-size: 1.0625rem;
}

.chm-auth-palette-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chm-auth-palette-dot {
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform var(--chm-duration-fast), box-shadow var(--chm-duration-fast), border-color var(--chm-duration-fast);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.chm-auth-palette-dot:hover {
    transform: scale(1.12);
}

.chm-auth-palette-dot.active {
    border-color: var(--chm-text);
    box-shadow: 0 0 0 2px var(--chm-surface), 0 0 0 4px var(--chm-primary);
    transform: scale(1.08);
}

.chm-auth-palette-dot--slate    { background: linear-gradient(135deg, #1e293b, #64748b); }
.chm-auth-palette-dot--ocean    { background: linear-gradient(135deg, #0c4a6e, #0284c7); }
.chm-auth-palette-dot--forest   { background: linear-gradient(135deg, #14532d, #b8860b); }
.chm-auth-palette-dot--royal    { background: linear-gradient(135deg, #1e3a5f, #c9a227); }
.chm-auth-palette-dot--amethyst { background: linear-gradient(135deg, #581c87, #a855f7); }
.chm-auth-palette-dot--emerald  { background: linear-gradient(135deg, #064e3b, #14b8a6); }
.chm-auth-palette-dot--coral    { background: linear-gradient(135deg, #9a3412, #fb923c); }

.chm-auth-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 992px) {
    .chm-auth-page {
        flex-direction: row;
    }
}

/* Hero panel */
.chm-auth-hero {
    flex: 1.2;
    position: relative;
    display: none;
    overflow: hidden;
    background: linear-gradient(145deg, var(--chm-brand) 0%, var(--chm-brand-mid) 100%);
}

@media (min-width: 992px) {
    .chm-auth-hero {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
}

.chm-auth-hero__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.chm-auth-hero__media a {
    display: block;
    width: 100%;
    height: 100%;
}

.chm-auth-hero__banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: chm-auth-banner-zoom 28s ease-in-out infinite alternate;
}

.chm-auth-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        165deg,
        color-mix(in srgb, var(--chm-brand) 82%, transparent) 0%,
        color-mix(in srgb, var(--chm-accent) 45%, transparent) 42%,
        color-mix(in srgb, var(--chm-brand-mid) 88%, transparent) 100%
    );
}

.chm-auth-hero__content {
    position: relative;
    z-index: 2;
    padding: 3rem 3rem 3.5rem;
    color: #fff;
    max-width: 36rem;
    animation: chm-auth-enter 0.7s ease-out both;
}

.chm-auth-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: var(--chm-text-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(10px);
}

.chm-auth-hero__title {
    font-size: clamp(1.875rem, 3.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.875rem;
    letter-spacing: -0.025em;
}

.chm-auth-hero__subtitle {
    font-size: var(--chm-text-md);
    line-height: 1.65;
    opacity: 0.92;
    margin: 0 0 1.75rem;
}

.chm-auth-hero__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1.75rem;
}

.chm-auth-hero__features--departments li:last-child {
    grid-column: 1 / -1;
}

.chm-auth-hero__features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--chm-radius-sm);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: var(--chm-text-sm);
    font-weight: 500;
    backdrop-filter: blur(6px);
}

.chm-auth-hero__features li i {
    font-size: 1.125rem;
    opacity: 0.95;
    color: var(--chm-gold);
}

.chm-auth-hero__verse {
    margin: 0;
    padding: 1rem 1.125rem;
    border-left: 3px solid color-mix(in srgb, var(--chm-gold) 75%, white);
    background: rgba(0, 0, 0, 0.18);
    border-radius: 0 var(--chm-radius-sm) var(--chm-radius-sm) 0;
    backdrop-filter: blur(8px);
}

.chm-auth-hero__verse i {
    font-size: 1rem;
    opacity: 0.5;
    margin-bottom: 0.375rem;
    display: block;
}

.chm-auth-hero__verse p {
    margin: 0;
    font-size: var(--chm-text-sm);
    line-height: 1.6;
    font-style: italic;
    opacity: 0.95;
}

.chm-auth-hero__pattern {
    position: absolute;
    bottom: -3rem;
    right: -3rem;
    width: 50%;
    opacity: 0.07;
    pointer-events: none;
}

/* Mobile banner strip */
.chm-auth-mobile-banner {
    display: block;
    position: relative;
    height: 140px;
    overflow: hidden;
}

@media (min-width: 992px) {
    .chm-auth-mobile-banner { display: none; }
}

.chm-auth-mobile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chm-auth-mobile-banner__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--chm-brand) 45%, transparent) 0%,
        color-mix(in srgb, var(--chm-brand-mid) 88%, transparent) 100%
    );
}

/* Main panel */
.chm-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem 2.5rem;
    background: transparent;
    position: relative;
}

.chm-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-xl);
    box-shadow: var(--chm-shadow-lg);
    padding: 2.5rem 2.25rem 2rem;
    position: relative;
    overflow: hidden;
}

.chm-auth-card--enter {
    animation: chm-auth-enter 0.55s ease-out 0.1s both;
}

.chm-auth-card__accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--chm-sidebar-stripe);
}

.chm-auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.375rem;
}

.chm-auth-logo__ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--chm-surface-sunken);
    border: 2px solid var(--chm-border);
    box-shadow: 0 0 0 6px var(--chm-primary-soft);
}

.chm-auth-logo__ring img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.chm-auth-heading {
    text-align: center;
    margin-bottom: 1.625rem;
}

.chm-auth-heading h1 {
    font-size: var(--chm-text-2xl);
    font-weight: 700;
    color: var(--chm-text);
    margin: 0 0 0.375rem;
    letter-spacing: -0.02em;
}

.chm-auth-heading p {
    font-size: var(--chm-text-sm);
    color: var(--chm-text-muted);
    margin: 0;
}

.chm-auth-alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--chm-radius-sm);
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: var(--chm-danger);
    font-size: var(--chm-text-sm);
    font-weight: 500;
}

.chm-auth-alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Form fields */
.chm-auth-field {
    margin-bottom: 1.125rem;
}

.chm-auth-field label {
    display: block;
    font-size: var(--chm-text-sm);
    font-weight: 600;
    color: var(--chm-text-secondary);
    margin-bottom: 0.375rem;
}

.chm-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.chm-auth-input-wrap > i:first-child {
    position: absolute;
    left: 0.875rem;
    color: var(--chm-text-muted);
    font-size: 1.125rem;
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition:
        opacity var(--chm-duration-fast),
        transform var(--chm-duration-fast),
        visibility var(--chm-duration-fast),
        color var(--chm-duration-fast);
}

.chm-auth-input-wrap.is-focused > i:first-child,
.chm-auth-input-wrap.has-value > i:first-child {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
}

.chm-auth-input-wrap.is-focused > i:first-child {
    color: var(--chm-primary);
}

.chm-auth-input-wrap .form-control {
    padding-left: 2.625rem;
    padding-right: 2.625rem;
    border-radius: var(--chm-radius-sm);
    border: 1.5px solid var(--chm-border-strong);
    background: var(--chm-surface-sunken);
    font-size: var(--chm-text-base);
    height: 2.875rem;
    transition:
        border-color var(--chm-duration-fast),
        box-shadow var(--chm-duration-fast),
        background var(--chm-duration-fast),
        padding-left var(--chm-duration-fast);
}

.chm-auth-input-wrap.is-focused .form-control,
.chm-auth-input-wrap.has-value .form-control {
    padding-left: 0.875rem;
}

.chm-auth-input-wrap--password .form-control {
    padding-right: 2.75rem;
}

.chm-auth-input-wrap .form-control:focus {
    border-color: var(--chm-primary);
    box-shadow: 0 0 0 4px var(--chm-primary-ring);
    background: var(--chm-surface);
}

.chm-auth-input-wrap.is-invalid .form-control,
.chm-auth-input-wrap .form-control.is-invalid {
    border-color: var(--chm-danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

/* Honeypot — hidden from users and assistive tech */
.chm-auth-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.chm-auth-toggle-pw {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    background: none;
    border: none;
    color: var(--chm-text-muted);
    cursor: pointer;
    border-radius: 0 var(--chm-radius-sm) var(--chm-radius-sm) 0;
    transition: color var(--chm-duration-fast);
}

.chm-auth-toggle-pw:hover {
    color: var(--chm-primary);
}

.chm-auth-field-error {
    display: block;
    font-size: var(--chm-text-xs);
    color: var(--chm-danger);
    margin-top: 0.375rem;
}

.chm-auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.375rem;
    gap: 0.75rem;
}

.chm-auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
    font-size: var(--chm-text-sm);
    color: var(--chm-text-secondary);
    user-select: none;
}

.chm-auth-remember input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--chm-primary);
    cursor: pointer;
}

.chm-auth-forgot {
    font-size: var(--chm-text-sm);
    color: var(--chm-primary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.chm-auth-forgot:hover {
    color: var(--chm-primary-hover);
    text-decoration: underline;
}

.chm-auth-submit {
    width: 100%;
    height: 2.875rem;
    font-weight: 600;
    font-size: var(--chm-text-base);
    border-radius: var(--chm-radius-sm);
    background: linear-gradient(135deg, var(--chm-primary) 0%, var(--chm-brand-mid) 100%) !important;
    border: none !important;
    color: var(--chm-accent-contrast) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px var(--chm-primary-ring);
    transition: transform var(--chm-duration-fast), box-shadow var(--chm-duration-fast), opacity var(--chm-duration-fast);
}

.chm-auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--chm-primary-ring);
}

.chm-auth-submit:active:not(:disabled) {
    transform: translateY(0);
}

.chm-auth-submit:disabled {
    opacity: 0.85;
    cursor: not-allowed;
}

.chm-auth-submit.is-loading {
    background: var(--chm-primary) !important;
}

.chm-auth-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: chm-auth-spin 0.7s linear infinite;
    margin-right: 0.375rem;
    vertical-align: -2px;
}

.chm-auth-help {
    text-align: center;
    margin: 1.25rem 0 0;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
}

.chm-auth-help a {
    color: var(--chm-primary);
    text-decoration: none;
    font-weight: 500;
}

.chm-auth-help a:hover {
    text-decoration: underline;
}

/* Social section */
.chm-auth-social {
    margin-top: 1.5rem;
    padding-top: 1.375rem;
    border-top: 1px solid var(--chm-border);
    text-align: center;
}

.chm-auth-social-label {
    font-size: var(--chm-text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--chm-text-muted);
    margin-bottom: 0.875rem;
}

.chm-auth-social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.chm-auth-social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 50%;
    background: var(--chm-surface-sunken);
    border: 1px solid var(--chm-border);
    color: var(--chm-text-secondary);
    font-size: 1.0625rem;
    text-decoration: none;
    transition: all var(--chm-duration-fast);
}

.chm-auth-social-links a:hover {
    transform: translateY(-3px);
    box-shadow: var(--chm-shadow-sm);
}

.chm-auth-social--fb:hover  { background: #1877f2; border-color: #1877f2; color: #fff; }
.chm-auth-social--yt:hover  { background: #ff0000; border-color: #ff0000; color: #fff; }
.chm-auth-social--ig:hover  { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); border-color: #dc2743; color: #fff; }

.chm-auth-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    margin-top: 1.125rem;
    padding: 0.625rem;
    font-size: var(--chm-text-sm);
    font-weight: 500;
    color: var(--chm-text-secondary);
    text-decoration: none;
    border-radius: var(--chm-radius-sm);
    transition: color var(--chm-duration-fast), background var(--chm-duration-fast);
}

.chm-auth-back-link:hover {
    color: var(--chm-primary);
    background: var(--chm-primary-soft);
}

.chm-auth-password-rules {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    gap: 0.375rem;
}

.chm-auth-password-rule {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    transition: color var(--chm-duration-fast);
}

.chm-auth-password-rule i {
    font-size: 0.875rem;
    flex-shrink: 0;
}

.chm-auth-password-rule.is-valid {
    color: var(--chm-success);
}

.chm-auth-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.chm-auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
}

.chm-auth-footer__dot {
    opacity: 0.5;
}

/* Mobile brand */
.chm-auth-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 992px) {
    .chm-auth-mobile-brand { display: none; }
}

.chm-auth-mobile-brand span {
    font-weight: 700;
    font-size: var(--chm-text-lg);
    color: var(--chm-brand);
}

/* Dark theme auth tweaks */
[data-chm-theme="dark"] .chm-auth-card {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    background: var(--chm-surface-elevated, var(--chm-surface));
}

[data-chm-theme="dark"] .chm-auth-prefs-menu {
    background: var(--chm-surface-elevated, var(--chm-surface));
}

[data-chm-theme="dark"] .chm-auth-input-wrap .form-control {
    background: var(--chm-input-bg, var(--chm-surface-sunken));
    color: var(--chm-text);
}

[data-chm-theme="dark"] .chm-auth-logo__ring {
    background: var(--chm-surface-sunken);
    border-color: var(--chm-border);
}

/* Legacy overrides */
.chm-auth .section-authentication-cover {
    background: transparent;
}

.chm-auth .btn-primary {
    background: var(--chm-primary) !important;
    border-color: var(--chm-primary) !important;
    border-radius: var(--chm-radius-sm) !important;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
}

/* ─── Action bar ────────────────────────────────────────── */
.chm-action-bar {
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-lg);
    padding: 0.875rem 1.375rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--chm-shadow);
}

/* ─── Charts ────────────────────────────────────────────── */
.chm-chart-canvas { width: 100%; height: 340px; }
.chm-chart-canvas-sm { width: 100%; height: 280px; }
.chm-chart-canvas-pie { position: relative; height: 200px; }

/* ─── Verse strip ───────────────────────────────────────── */
.chm-ui .scrolling-verse marquee,
.chm-ui #bibleVerseMarquee {
    background: var(--chm-gold-soft) !important;
    border: 1px solid rgba(184, 134, 11, 0.25) !important;
    color: var(--chm-brand) !important;
    font-size: 0.6875rem !important;
    font-weight: 500;
    border-radius: 999px !important;
    padding: 0.375rem 0.875rem !important;
    box-shadow: none !important;
}

@media (max-width: 767.98px) {
    .chm-global-search { display: none; }
    .chm-dash-hero-text h1 { font-size: 1.375rem; }
    .chm-quick-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Sidebar collapsibles & navigation ─────────────────── */
.chm-ui .sidebar-wrapper .metismenu > li > a {
    padding: var(--chm-nav-item-py) var(--chm-nav-item-px) !important;
    position: relative;
}

.chm-ui .sidebar-wrapper .metismenu a.has-arrow {
    padding-right: 2.25rem !important;
}

.chm-ui .sidebar-wrapper .metismenu .chm-nav-chevron {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--chm-sidebar-muted);
    transition: transform var(--chm-ease);
    pointer-events: none;
    font-size: 1rem;
    line-height: 1;
}

.chm-ui .sidebar-wrapper .metismenu li.mm-active > a.has-arrow .chm-nav-chevron {
    transform: translateY(-50%) rotate(-180deg);
    color: var(--chm-accent);
}

/* Hide legacy metismenu arrow — we use .chm-nav-chevron */
.chm-ui .sidebar-wrapper .metismenu .has-arrow::after {
    display: none !important;
    content: none !important;
}

.chm-ui .sidebar-wrapper .metismenu ul a.has-arrow {
    padding-right: 2rem !important;
    font-size: 0.8125rem;
}

.chm-ui .sidebar-wrapper .metismenu ul ul {
    margin-left: 0.375rem !important;
    padding-left: 0.625rem !important;
}

.chm-ui .sidebar-wrapper .metismenu ul .chm-nav-chevron {
    right: 0.5rem;
    font-size: 0.875rem;
}

.chm-ui .sidebar-wrapper .metismenu li.mm-active > ul.mm-show {
    display: block;
}

.chm-ui .sidebar-wrapper .metismenu ul.mm-collapse:not(.mm-show) {
    display: none;
}

.chm-ui .sidebar-wrapper .metismenu ul.mm-show {
    display: block;
    animation: chm-submenu-in var(--chm-duration-normal) var(--chm-ease-out);
}

@keyframes chm-submenu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.chm-ui .sidebar-wrapper .metismenu a:focus-visible {
    outline: 2px solid var(--chm-accent);
    outline-offset: 2px;
}

.chm-nav-badge {
    margin-left: auto;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.4375rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
}

.chm-sidebar-empty {
    display: block;
    font-size: var(--chm-text-xs);
    color: var(--chm-sidebar-muted);
    padding: 0.25rem 0.5rem;
}

/* ─── Preferences panel ─────────────────────────────────── */
.chm-preferences-panel {
    width: min(400px, 100vw);
    border-left: 1px solid var(--chm-border);
}

.chm-preferences-panel .offcanvas-header {
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
}

.chm-pref-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--chm-border);
}

.chm-pref-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.chm-pref-section h6 {
    font-size: var(--chm-text-sm);
    font-weight: 700;
    color: var(--chm-brand);
    margin-bottom: 0.75rem;
}

.chm-pref-label {
    display: block;
    font-size: var(--chm-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--chm-text-muted);
    margin-bottom: 0.5rem;
}

.chm-pref-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.chm-pref-option {
    border: 1px solid var(--chm-border);
    background: var(--chm-surface);
    border-radius: var(--chm-radius-sm);
    padding: 0.625rem 0.5rem;
    font-size: var(--chm-text-xs);
    font-weight: 600;
    color: var(--chm-text-secondary);
    cursor: pointer;
    transition: all var(--chm-ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.chm-pref-option i {
    font-size: 1.125rem;
}

.chm-pref-option:hover {
    border-color: var(--chm-accent);
    color: var(--chm-accent);
}

.chm-pref-option.active {
    background: var(--chm-accent-soft);
    border-color: var(--chm-accent);
    color: var(--chm-accent);
    box-shadow: inset 0 0 0 1px var(--chm-accent);
}

.chm-pref-hint {
    font-size: var(--chm-text-sm);
    color: var(--chm-text-muted);
    margin: -0.25rem 0 1rem;
}

.chm-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
}

.chm-theme-card {
    border: 2px solid var(--chm-border);
    background: var(--chm-surface);
    border-radius: var(--chm-radius-md);
    padding: 0.625rem;
    cursor: pointer;
    text-align: left;
    transition: all var(--chm-ease);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.chm-theme-card:hover {
    border-color: var(--chm-accent);
    box-shadow: var(--chm-shadow-sm);
}

.chm-theme-card.active {
    border-color: var(--chm-accent);
    box-shadow: 0 0 0 3px var(--chm-accent-ring);
    background: var(--chm-accent-soft);
}

.chm-theme-card-preview {
    display: flex;
    gap: 3px;
    height: 2.5rem;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.chm-theme-card-preview span:first-child {
    width: 28%;
}

.chm-theme-card-preview span:nth-child(2) {
    flex: 1;
}

.chm-theme-card-preview span:nth-child(3) {
    width: 22%;
}

.chm-theme-preview-slate span { background: #e2e8f0; }
.chm-theme-preview-slate span:first-child { background: #1e293b; }
.chm-theme-preview-slate span:nth-child(3) { background: #2563eb; }

.chm-theme-preview-ocean span { background: #e0f2fe; }
.chm-theme-preview-ocean span:first-child { background: #0c4a6e; }
.chm-theme-preview-ocean span:nth-child(3) { background: #0284c7; }

.chm-theme-preview-forest span { background: #eae6de; }
.chm-theme-preview-forest span:first-child { background: #14532d; }
.chm-theme-preview-forest span:nth-child(3) { background: #15803d; }

.chm-theme-preview-royal span { background: #e2e8f4; }
.chm-theme-preview-royal span:first-child { background: #1e3a5f; }
.chm-theme-preview-royal span:nth-child(3) { background: #c9a227; }

.chm-theme-preview-amethyst span { background: #ede9fe; }
.chm-theme-preview-amethyst span:first-child { background: #581c87; }
.chm-theme-preview-amethyst span:nth-child(3) { background: #7c3aed; }

.chm-theme-preview-emerald span { background: #ccfbf1; }
.chm-theme-preview-emerald span:first-child { background: #115e59; }
.chm-theme-preview-emerald span:nth-child(3) { background: #0d9488; }

.chm-theme-preview-coral span { background: #ffedd5; }
.chm-theme-preview-coral span:first-child { background: #9a3412; }
.chm-theme-preview-coral span:nth-child(3) { background: #ea580c; }

.chm-theme-card-label {
    font-size: var(--chm-text-sm);
    font-weight: 700;
    color: var(--chm-text);
}

.chm-theme-card-desc {
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    line-height: 1.3;
}

.chm-pref-options-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* ─── Form sections ─────────────────────────────────────── */
.chm-form-section {
    margin-bottom: 1.25rem;
    border: 1px solid var(--chm-border) !important;
    border-radius: var(--chm-radius-lg) !important;
    overflow: hidden;
}

.chm-form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--chm-surface-sunken);
    border-bottom: 1px solid var(--chm-border);
}

.chm-form-section-collapsible {
    cursor: pointer;
    user-select: none;
}

.chm-form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.chm-form-section-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--chm-radius-sm);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chm-form-section-chevron {
    transition: transform var(--chm-ease);
    color: var(--chm-text-muted);
}

.chm-form-section-collapsible[aria-expanded="true"] .chm-form-section-chevron,
.chm-form-section .collapse.show ~ .chm-form-section-header .chm-form-section-chevron {
    transform: rotate(-180deg);
}

.chm-form-section-body {
    padding: 1.25rem;
}

.chm-form-floating > label {
    color: var(--chm-text-muted);
    font-weight: 500;
}

.chm-form-floating.has-value > label,
.chm-form-floating:focus-within > label {
    color: var(--chm-accent);
}

/* ─── Tables enterprise ─────────────────────────────────── */
.chm-table-wrap {
    overflow: hidden;
}

.chm-table-scroll {
    overflow-x: auto;
}

.chm-ui .chm-table-wrap:has(.dataTables_wrapper) .chm-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chm-ui .chm-table-wrap .dataTables_wrapper {
    overflow: visible;
    min-width: max-content;
}

.chm-table-scroll::-webkit-scrollbar,
.chm-ui .chm-table-wrap .dataTables_wrapper::-webkit-scrollbar {
    height: 6px;
}

.chm-table-scroll::-webkit-scrollbar-thumb,
.chm-ui .chm-table-wrap .dataTables_wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.chm-table-scroll::-webkit-scrollbar-track,
.chm-ui .chm-table-wrap .dataTables_wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.chm-table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--chm-border);
}

.chm-table-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--chm-text-secondary);
}

.chm-table-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chm-table-empty h6 {
    font-weight: 700;
    color: var(--chm-text);
    margin-bottom: 0.375rem;
}

.chm-table-empty p {
    font-size: var(--chm-text-sm);
    color: var(--chm-text-muted);
    margin-bottom: 1rem;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.chm-dt-toolbar {
    background: var(--chm-surface-sunken);
    border-bottom: 1px solid var(--chm-border);
}

.chm-ui .page-content {
    padding: var(--chm-page-py) var(--chm-page-px) 3rem;
}

.chm-ui .form-control,
.chm-ui .form-select {
    padding: var(--chm-input-py) var(--chm-input-px);
}

.chm-ui .table thead th,
.chm-ui .table tbody td {
    padding: var(--chm-table-cell-py) var(--chm-table-cell-px);
}

/* Dark sidebar text in dark theme */
[data-chm-theme="dark"] .chm-ui .sidebar-wrapper {
    background: var(--chm-sidebar-bg) !important;
}

[data-chm-theme="dark"] .chm-dash-hero::before {
    opacity: 0.35;
}

/* ─── Enterprise top bar ──────────────────────────────────── */
.chm-topbar {
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface) !important;
    box-shadow: var(--chm-shadow-xs);
}

.chm-topbar-inner {
    padding: 0 1.25rem;
    min-height: var(--chm-topbar-h);
    gap: 1rem;
}

.chm-topbar-greeting {
    line-height: 1.3;
}

.chm-topbar-greeting-text {
    display: block;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    font-weight: 500;
}

.chm-topbar-greeting-name {
    display: block;
    font-size: var(--chm-text-sm);
    font-weight: 700;
    color: var(--chm-text);
    letter-spacing: -0.02em;
}

.chm-topbar-center {
    flex: 1;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
    gap: 0.375rem;
}

.chm-topbar-verse {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--chm-accent-soft);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-full);
    padding: 0.3125rem 0.875rem;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-secondary);
    max-width: 100%;
    overflow: hidden;
}

.chm-topbar-verse i {
    color: var(--chm-accent);
    flex-shrink: 0;
    font-size: 0.875rem;
}

.chm-topbar-verse marquee {
    flex: 1;
    min-width: 0;
}

.chm-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--chm-surface-sunken);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-full);
    padding: 0.25rem;
}

.chm-topbar-icon-btn {
    width: 2.375rem;
    height: 2.375rem;
    border: none;
    background: transparent;
    border-radius: var(--chm-radius-full);
    color: var(--chm-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--chm-ease);
    position: relative;
    padding: 0;
}

.chm-topbar-icon-btn:hover,
.chm-topbar-icon-btn.show {
    background: var(--chm-surface);
    color: var(--chm-accent);
    box-shadow: var(--chm-shadow-xs);
}

.chm-topbar-icon-btn.is-active,
.chm-ui #chmFavoriteToggle.is-active {
    color: var(--chm-gold);
    background: var(--chm-gold-soft);
}

.dropdown-toggle-no-caret::after {
    display: none !important;
}

.chm-topbar-badge {
    position: absolute;
    top: 0.1875rem;
    right: 0.1875rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3125rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
    border: 2px solid var(--chm-surface);
}

.chm-topbar-badge-inline {
    font-size: var(--chm-text-xs);
    font-weight: 600;
    color: var(--chm-accent);
}

.chm-topbar-divider {
    width: 1px;
    height: 2rem;
    background: var(--chm-border);
}

.chm-topbar-panel {
    width: 340px;
    max-width: calc(100vw - 2rem);
    border: 1px solid var(--chm-border) !important;
    border-radius: var(--chm-radius-lg) !important;
    box-shadow: var(--chm-shadow-md) !important;
    padding: 0 !important;
    overflow: hidden;
    margin-top: 0.5rem !important;
}

.chm-topbar-panel-header {
    padding: 1rem 1.125rem;
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
}

.chm-topbar-panel-header h6 {
    margin: 0;
    font-size: var(--chm-text-sm);
    font-weight: 700;
    color: var(--chm-text);
}

.chm-topbar-panel-body {
    padding: 0.375rem;
    max-height: 320px;
    overflow-y: auto;
}

.chm-topbar-panel-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
}

.chm-topbar-panel-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--chm-radius-sm);
    text-decoration: none;
    color: var(--chm-text);
    transition: background var(--chm-ease);
}

.chm-topbar-panel-item:hover {
    background: var(--chm-accent-soft);
    color: var(--chm-text);
}

.chm-topbar-panel-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--chm-radius-sm);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.chm-topbar-panel-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.chm-topbar-panel-text strong {
    font-size: var(--chm-text-sm);
    font-weight: 600;
}

.chm-topbar-panel-text small {
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
}

.chm-topbar-panel-arrow {
    color: var(--chm-text-muted);
    font-size: 1rem;
}

.chm-notifications-list {
    padding: 0.375rem !important;
}

.chm-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--chm-radius-sm);
    text-decoration: none;
    color: var(--chm-text);
    transition: background var(--chm-ease);
}

.chm-notification-item img {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--chm-border);
}

.chm-notification-item .msg {
    font-size: var(--chm-text-sm);
    font-weight: 500;
    line-height: 1.4;
    color: var(--chm-text);
}

.chm-notification-item .time {
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    margin-top: 0.125rem;
}

.chm-notifications-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--chm-text-muted);
}

.chm-notifications-empty i {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.chm-topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
    border-radius: var(--chm-radius-full);
    padding: 0.3125rem 0.625rem 0.3125rem 0.3125rem;
    cursor: pointer;
    transition: all var(--chm-ease);
}

.chm-topbar-user-btn:hover,
.chm-topbar-user-btn.show {
    border-color: var(--chm-accent);
    box-shadow: var(--chm-shadow-xs);
}

.chm-topbar-avatar {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    border: 2px solid var(--chm-border);
}

.chm-topbar-user-meta {
    text-align: left;
    line-height: 1.25;
    max-width: 140px;
}

.chm-topbar-user-name {
    display: block;
    font-size: var(--chm-text-sm);
    font-weight: 700;
    color: var(--chm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chm-topbar-user-role {
    display: block;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    text-transform: capitalize;
}

.chm-topbar-user-chevron {
    font-size: 1rem;
    color: var(--chm-text-muted);
}

.chm-topbar-user-menu {
    min-width: 220px;
    border-radius: var(--chm-radius-lg) !important;
    border: 1px solid var(--chm-border) !important;
    box-shadow: var(--chm-shadow-md) !important;
    padding: 0.375rem !important;
    margin-top: 0.5rem !important;
}

.chm-topbar-user-menu .dropdown-item {
    border-radius: var(--chm-radius-sm);
    font-size: var(--chm-text-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chm-topbar-user-menu-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--chm-border);
    margin-bottom: 0.25rem;
}

.chm-topbar-theme-row {
    display: flex;
    gap: 0.375rem;
}

.chm-topbar-theme-row .chm-theme-option {
    flex: 1;
    border: 1px solid var(--chm-border);
    background: var(--chm-surface);
    border-radius: var(--chm-radius-sm);
    padding: 0.4375rem;
    font-size: 1rem;
    color: var(--chm-text-secondary);
    cursor: pointer;
    transition: all var(--chm-ease);
}

.chm-topbar-theme-row .chm-theme-option:hover,
.chm-topbar-theme-row .chm-theme-option.active {
    border-color: var(--chm-accent);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
}

@media (max-width: 767.98px) {
    .chm-topbar-inner {
        padding: 0 0.75rem;
    }

    .chm-topbar-actions {
        padding: 0.125rem;
        gap: 0.125rem;
    }

    .chm-topbar-icon-btn {
        width: 2.125rem;
        height: 2.125rem;
        font-size: 1.125rem;
    }
}

/* ─── Internal chat (staff messaging) ─────────────────────── */
.chm-chat {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-lg);
    overflow: hidden;
    background: var(--chm-surface);
    box-shadow: var(--chm-shadow-sm);
    min-height: 560px;
}

.chm-chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 560px;
}

@media (max-width: 767.98px) {
    .chm-chat-layout {
        grid-template-columns: 1fr;
    }

    .chm-chat-sidebar {
        border-right: none !important;
        border-bottom: 1px solid var(--chm-border);
        max-height: 240px;
    }
}

.chm-chat-sidebar {
    border-right: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
    display: flex;
    flex-direction: column;
}

.chm-chat-sidebar-header {
    padding: 1rem 1.125rem;
    border-bottom: 1px solid var(--chm-border);
}

.chm-chat-sidebar-header h6 {
    margin: 0 0 0.25rem;
    font-weight: 700;
    color: var(--chm-text);
}

.chm-chat-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-sm);
}

.chm-chat-search i {
    color: var(--chm-text-muted);
}

.chm-chat-search input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: var(--chm-text-sm);
    outline: none;
    color: var(--chm-text);
}

.chm-chat-user-list {
    list-style: none;
    margin: 0;
    padding: 0.375rem;
    overflow-y: auto;
    flex: 1;
}

.chm-chat-user {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--chm-radius-sm);
    text-align: left;
    cursor: pointer;
    transition: background var(--chm-ease);
}

.chm-chat-user:hover,
.chm-chat-user.is-active {
    background: var(--chm-accent-soft);
}

.chm-chat-user-avatar {
    position: relative;
    flex-shrink: 0;
}

.chm-chat-user-avatar img,
.chm-chat-header-avatar,
.chm-chat-bubble-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    border: 2px solid var(--chm-border);
}

.chm-chat-bubble-avatar {
    width: 2rem;
    height: 2rem;
}

.chm-chat-online {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0.625rem;
    height: 0.625rem;
    background: #22c55e;
    border-radius: var(--chm-radius-full);
    border: 2px solid var(--chm-surface);
}

.chm-chat-user-info {
    flex: 1;
    min-width: 0;
}

.chm-chat-user-name {
    display: block;
    font-size: var(--chm-text-sm);
    font-weight: 600;
    color: var(--chm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chm-chat-user-role {
    display: block;
    font-size: var(--chm-text-xs);
    color: var(--chm-text-muted);
    text-transform: capitalize;
}

.chm-chat-unread {
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chm-chat-empty-users {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--chm-text-muted);
    font-size: var(--chm-text-sm);
}

.chm-chat-main {
    display: flex;
    flex-direction: column;
    background: var(--chm-surface);
    min-height: 560px;
}

.chm-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--chm-border);
    background: var(--chm-surface-sunken);
}

.chm-chat-status-pill {
    margin-left: auto;
    font-size: var(--chm-text-xs);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.chm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    background: var(--chm-bg);
}

.chm-chat-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 80%;
}

.chm-chat-bubble-row.is-mine {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chm-chat-bubble {
    padding: 0.625rem 0.875rem;
    border-radius: var(--chm-radius-md);
    box-shadow: var(--chm-shadow-xs);
}

.chm-chat-bubble-row.is-theirs .chm-chat-bubble {
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
}

.chm-chat-bubble-row.is-mine .chm-chat-bubble {
    background: var(--chm-accent);
    color: #fff;
}

.chm-chat-bubble p {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: var(--chm-text-sm);
}

.chm-chat-bubble time {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.625rem;
    opacity: 0.75;
}

.chm-chat-compose {
    display: flex;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--chm-border);
    background: var(--chm-surface);
}

.chm-chat-compose input {
    flex: 1;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-full);
    padding: 0.5625rem 1rem;
    font-size: var(--chm-text-sm);
    background: var(--chm-surface-sunken);
}

.chm-chat-compose input:focus {
    outline: none;
    border-color: var(--chm-accent);
    box-shadow: 0 0 0 3px var(--chm-accent-ring);
}

.chm-chat-placeholder,
.chm-chat-empty-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--chm-text-muted);
    padding: 2rem;
}

.chm-chat-placeholder i,
.chm-chat-empty-thread i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--chm-accent);
    opacity: 0.6;
}

.chm-chat-placeholder h5 {
    color: var(--chm-text);
    margin-bottom: 0.375rem;
}

/* ─── Profile page ─────────────────────────────────────────── */
.chm-profile-hero {
    overflow: hidden;
    border: 1px solid var(--chm-border);
    box-shadow: var(--chm-shadow-sm);
}

.chm-profile-hero-banner {
    height: 5.5rem;
    background: linear-gradient(135deg, var(--chm-accent) 0%, var(--chm-brand) 100%);
}

.chm-profile-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-top: -3.25rem;
}

.chm-profile-avatar {
    width: 7rem;
    height: 7rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    border: 4px solid var(--chm-surface);
    box-shadow: var(--chm-shadow-md);
    background: var(--chm-surface);
}

.chm-profile-avatar-status {
    position: absolute;
    bottom: 0.375rem;
    right: 0.375rem;
    width: 1rem;
    height: 1rem;
    border-radius: var(--chm-radius-full);
    background: #22c55e;
    border: 3px solid var(--chm-surface);
}

.chm-profile-name {
    font-weight: 700;
    color: var(--chm-text);
}

.chm-profile-preview-img {
    width: 8rem;
    height: 8rem;
    border-radius: var(--chm-radius-lg);
    object-fit: cover;
    border: 2px solid var(--chm-border);
    box-shadow: var(--chm-shadow-xs);
}

.chm-profile-quick-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--chm-radius-sm);
    color: var(--chm-text);
    text-decoration: none;
    font-size: var(--chm-text-sm);
    font-weight: 500;
    transition: background var(--chm-ease);
}

.chm-profile-quick-link:hover {
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
}

.chm-profile-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chm-profile-meta-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--chm-border);
    font-size: var(--chm-text-sm);
}

.chm-profile-meta-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.chm-profile-meta-list li span {
    color: var(--chm-text-muted);
}

.chm-profile-meta-list li strong {
    color: var(--chm-text);
    font-weight: 600;
    text-align: right;
}

.chm-profile-perm-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-sm);
    background: var(--chm-surface-sunken);
    font-size: var(--chm-text-sm);
}

.chm-profile-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--chm-border);
}

.chm-profile-notif-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.chm-profile-notif-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chm-profile-score-card {
    border: 1px solid var(--chm-border);
    box-shadow: var(--chm-shadow-sm);
}

.chm-profile-score-ring {
    --score: 0;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: var(--chm-radius-full);
    background:
        radial-gradient(closest-side, var(--chm-surface) 78%, transparent 80% 100%),
        conic-gradient(var(--chm-accent) calc(var(--score) * 1%), var(--chm-border) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chm-profile-score-ring span {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--chm-text);
}

.chm-profile-benchmark {
    border: 1px solid var(--chm-border);
    box-shadow: var(--chm-shadow-xs);
}

.chm-profile-benchmark-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--chm-radius-sm);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chm-profile-benchmark-you {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--chm-text);
    line-height: 1;
}

.chm-profile-benchmark-avg {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--chm-text-muted);
    line-height: 1;
}

.chm-profile-weekly-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    min-height: 180px;
    padding-top: 0.5rem;
}

.chm-profile-weekly-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    height: 180px;
    justify-content: flex-end;
}

.chm-profile-weekly-bar {
    width: 100%;
    max-width: 2.75rem;
    min-height: 8px;
    border-radius: var(--chm-radius-sm) var(--chm-radius-sm) 0 0;
    background: linear-gradient(180deg, var(--chm-accent) 0%, var(--chm-brand) 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.25rem;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
}

.chm-profile-weekly-bar-wrap small {
    color: var(--chm-text-muted);
    font-size: 0.625rem;
    text-align: center;
}

.chm-profile-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.chm-profile-timeline::before {
    content: "";
    position: absolute;
    left: 1.125rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--chm-border);
}

.chm-profile-timeline-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.25rem;
    position: relative;
}

.chm-profile-timeline-item:last-child {
    padding-bottom: 0;
}

.chm-profile-timeline-dot {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    z-index: 1;
    box-shadow: 0 0 0 3px var(--chm-surface);
}

.chm-profile-timeline-body {
    flex: 1;
    min-width: 0;
    padding-top: 0.125rem;
}

.chm-profile-module-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chm-profile-module-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-sm);
    background: var(--chm-surface-sunken);
    font-size: var(--chm-text-sm);
}

.chm-profile-module-icon {
    width: 2rem;
    height: 2rem;
    border-radius: var(--chm-radius-sm);
    background: var(--chm-surface);
    color: var(--chm-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chm-profile-work-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--chm-border);
}

.chm-profile-work-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.chm-profile-work-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--chm-radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chm-profile-work-icon-primary { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.chm-profile-work-icon-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.chm-profile-work-icon-info { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.chm-profile-work-icon-warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }

.chm-profile-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.chm-profile-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    border-radius: var(--chm-radius-sm);
    text-decoration: none;
    color: var(--chm-text);
    font-size: var(--chm-text-sm);
    background: var(--chm-surface-sunken);
    border: 1px solid var(--chm-border);
}

.chm-profile-nav-item:hover {
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
}

.chm-profile-security-list {
    margin: 0;
    padding-left: 1.125rem;
    color: var(--chm-text-muted);
    font-size: var(--chm-text-sm);
}

.chm-profile-security-list li + li {
    margin-top: 0.5rem;
}

/* ─── CFDP child profile ───────────────────────────────────── */
.chm-child-hero {
    border: 1px solid var(--chm-border);
    box-shadow: var(--chm-shadow-sm);
}

.chm-child-hero-photo {
    position: relative;
    aspect-ratio: 4 / 5;
    background: var(--chm-surface-sunken);
}

.chm-child-hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chm-child-hero-age {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--chm-radius-full);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: var(--chm-text-xs);
    font-weight: 700;
}

.chm-child-tabs-card {
    border: 1px solid var(--chm-border);
    box-shadow: var(--chm-shadow-sm);
}

.chm-child-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chm-child-meta-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--chm-border);
    font-size: var(--chm-text-sm);
}

.chm-child-meta-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.chm-child-meta-list li span {
    color: var(--chm-text-muted);
    flex-shrink: 0;
}

.chm-child-meta-list li strong {
    color: var(--chm-text);
    font-weight: 600;
    text-align: right;
}

.chm-child-sponsor-card {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md);
    background: var(--chm-surface-sunken);
    height: 100%;
}

.chm-child-sponsor-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.chm-child-milestone {
    padding: 1rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md);
    background: var(--chm-surface-sunken);
    text-align: center;
    height: 100%;
}

.chm-child-milestone-label {
    display: block;
    font-size: var(--chm-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
    margin-bottom: 0.375rem;
}

.chm-child-timeline {
    position: relative;
    padding-left: 1.5rem;
}

.chm-child-timeline::before {
    content: '';
    position: absolute;
    left: 0.6875rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: var(--chm-border);
}

.chm-child-timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.chm-child-timeline-item:last-child {
    padding-bottom: 0;
}

.chm-child-timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 0.125rem;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: var(--chm-radius-full);
    background: var(--chm-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 2px solid var(--chm-surface);
    box-shadow: var(--chm-shadow-xs);
}

.chm-child-timeline-status .chm-child-timeline-marker {
    background: #2563eb;
}

.chm-child-timeline-card {
    padding: 1rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md);
    background: var(--chm-surface);
    box-shadow: var(--chm-shadow-xs);
}

.chm-child-timeline-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--chm-accent);
    margin-bottom: 0.125rem;
}

.chm-child-timeline-photo {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: var(--chm-radius-sm);
    border: 1px solid var(--chm-border);
}

.chm-child-update-list {
    padding-left: 1rem;
    margin: 0;
    font-size: var(--chm-text-sm);
}

.chm-child-update-list li + li {
    margin-top: 0.375rem;
}

.chm-child-gallery-item {
    display: block;
    border-radius: var(--chm-radius-md);
    overflow: hidden;
    background: var(--chm-surface-sunken);
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform var(--chm-ease), box-shadow var(--chm-ease);
}

.chm-child-gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--chm-shadow-md);
}

.chm-child-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chm-child-stat-chip {
    padding: 0.875rem 1rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md);
    background: var(--chm-surface-sunken);
    height: 100%;
}

.chm-child-stat-chip .label {
    display: block;
    font-size: var(--chm-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
    margin-bottom: 0.25rem;
}

.chm-child-stat-chip strong {
    display: block;
    font-size: 1.25rem;
    color: var(--chm-text);
    line-height: 1.2;
}

.chm-child-stat-chip small {
    display: block;
    color: var(--chm-text-muted);
    font-size: 0.6875rem;
    margin-top: 0.25rem;
}

.chm-child-meta-list-compact li {
    padding: 0.4375rem 0;
    font-size: 0.8125rem;
}

.chm-child-progress-row + .chm-child-progress-row {
    margin-top: 0.875rem;
}

.chm-child-milestone.is-done {
    border-color: var(--chm-accent);
    background: var(--chm-accent-soft);
}

/* ─── Staff org chart (tree view) ───────────────────────── */
.chm-orgchart-page .chm-tab-content {
    margin-top: 0.5rem !important;
}

.chm-orgchart-stats .chm-stat-card {
    padding: 0.65rem 0.75rem;
}

.chm-orgchart-stats .chm-stat-value {
    font-size: 1.25rem;
}

.chm-orgchart-card-wrap .card-body {
    padding: 0.75rem 0.75rem 0.5rem;
}

.chm-orgchart-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.chm-orgchart-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.chm-orgchart-toolbar-search {
    flex: 1 1 200px;
    max-width: 280px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
}

.chm-orgchart-toolbar-filter {
    flex: 1 1 180px;
    max-width: 220px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
}

.chm-orgchart-toolbar-search .select2-container,
.chm-orgchart-toolbar-filter .select2-container {
    width: 100% !important;
}

.chm-orgchart-toolbar-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
}

.chm-orgchart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 0.65rem;
    padding: 0.45rem 0.65rem;
    background: var(--chm-bg);
    border: 1px solid var(--chm-border);
    border-radius: 8px;
    font-size: 0.6875rem;
    color: var(--chm-text-muted);
}

.chm-orgchart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chm-orgchart-legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: var(--chm-border);
}

.chm-orgchart-legend-dot.is-path {
    background: var(--chm-accent);
    box-shadow: 0 0 0 2px var(--chm-accent-soft);
}

.chm-orgchart-legend-dot.is-team {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.chm-orgchart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 0.75rem;
    align-items: stretch;
}

.chm-orgchart-main {
    min-width: 0;
}

.chm-orgchart-detail {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    background: var(--chm-surface);
    padding: 0.85rem;
    min-height: 360px;
    max-height: calc(100vh - 14rem);
    overflow: auto;
}

.chm-orgchart-detail.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chm-orgchart-detail-empty {
    text-align: center;
    color: var(--chm-text-muted);
    font-size: 0.8125rem;
    padding: 1rem 0.5rem;
}

.chm-orgchart-detail-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.45;
}

.chm-orgchart-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.chm-orgchart-detail-header .chm-org-avatar {
    width: 56px;
    height: 56px;
}

.chm-orgchart-detail-name {
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.3;
}

.chm-orgchart-detail-role {
    font-size: 0.8125rem;
    color: var(--chm-text-muted);
}

.chm-orgchart-detail-dept {
    font-size: 0.75rem;
    color: var(--chm-accent);
    margin-top: 0.1rem;
}

.chm-orgchart-detail-email {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.chm-orgchart-detail-manager {
    font-size: 0.75rem;
    color: var(--chm-text-muted);
    margin-bottom: 0.75rem;
}

.chm-orgchart-detail-section {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--chm-border);
}

.chm-orgchart-detail-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
    margin-bottom: 0.5rem;
}

.chm-orgchart-detail-chain {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.chm-orgchart-detail-step-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--chm-text-muted);
    margin-bottom: 0.25rem;
}

.chm-orgchart-detail-step-users {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chm-orgchart-detail-person,
.chm-orgchart-detail-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--chm-border);
    background: var(--chm-bg);
    border-radius: 999px;
    padding: 0.15rem 0.5rem 0.15rem 0.15rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.chm-orgchart-detail-person:hover,
.chm-orgchart-detail-chip:hover {
    border-color: var(--chm-accent);
    background: var(--chm-accent-soft);
}

.chm-orgchart-detail-person img,
.chm-orgchart-detail-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.chm-orgchart-detail-reports {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chm-orgchart-viewport.is-panning {
    cursor: grabbing;
    user-select: none;
}

.chm-orgchart-viewport:not(.is-panning) {
    cursor: grab;
}

.chm-orgchart-card.is-dimmed {
    opacity: 0.22;
    filter: grayscale(0.35);
}

.chm-orgchart-card.is-team-member {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
}

.chm-orgchart-card.is-filtered-out {
    opacity: 0.1;
    pointer-events: none;
}

.chm-orgchart-node.is-filter-empty {
    display: none;
}

@media (max-width: 1100px) {
    .chm-orgchart-layout {
        grid-template-columns: 1fr;
    }

    .chm-orgchart-detail {
        max-height: none;
        min-height: auto;
    }
}

.chm-orgchart-node.is-filter-empty,
.chm-orgchart-node.is-depth-hidden {
    display: none !important;
}

.chm-orgchart-toolbar-depth {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    min-width: 120px;
}

.chm-orgchart-toolbar-depth .form-range {
    height: 0.35rem;
}

.chm-orgchart-depth-val {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--chm-text-muted);
    text-align: center;
}

.chm-orgchart-recent {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.chm-orgchart-recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chm-orgchart-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--chm-border);
    background: var(--chm-bg);
    border-radius: 999px;
    padding: 0.1rem 0.45rem 0.1rem 0.1rem;
    font-size: 0.6875rem;
    cursor: pointer;
}

.chm-orgchart-recent-chip img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.chm-orgchart-recent-chip:hover {
    border-color: var(--chm-accent);
    background: var(--chm-accent-soft);
}

.chm-orgchart-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0 0.65rem;
}

.chm-orgchart-quick-assign {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--chm-border);
}

.chm-orgchart-issues {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chm-orgchart-issue {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: 8px;
    background: var(--chm-bg);
}

.chm-orgchart-issue.is-warning { border-left: 3px solid #f59e0b; }
.chm-orgchart-issue.is-info { border-left: 3px solid #0ea5e9; }
.chm-orgchart-issue.is-danger { border-left: 3px solid #ef4444; }

.chm-orgchart-issue-message {
    font-size: 0.8125rem;
}

.chm-orgchart-issue-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chm-orgchart-directory tbody tr:hover {
    background: var(--chm-accent-soft);
}

.chm-orgchart-detail-person.is-static {
    cursor: default;
    opacity: 0.85;
}

@media print {
    .chm-orgchart-page .chm-page-header,
    .chm-orgchart-stats,
    .chm-tabs,
    .chm-orgchart-toolbar,
    .chm-orgchart-legend,
    .chm-orgchart-detail,
    .chm-tab-content > :not(#chart) {
        display: none !important;
    }

    .chm-orgchart-layout {
        display: block;
    }

    .chm-orgchart-viewport {
        overflow: visible !important;
        height: auto !important;
        min-height: 0 !important;
        border: 0;
        background: #fff;
    }

    .chm-orgchart-scale {
        transform: none !important;
    }

    .chm-orgchart-card {
        break-inside: avoid;
    }

    .chm-orgchart-card-link,
    .chm-orgchart-toggle {
        display: none !important;
    }
}

.chm-orgchart-zoom-pct {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 2.75rem;
    text-align: center;
    color: var(--chm-text-muted);
}

.chm-orgchart-viewport {
    min-height: 360px;
    overflow: auto;
    padding: 1rem 0.75rem;
    background:
        radial-gradient(circle at 1px 1px, var(--chm-border) 1px, transparent 0) 0 0 / 18px 18px,
        linear-gradient(180deg, var(--chm-surface) 0%, var(--chm-bg) 100%);
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    text-align: center;
    scroll-behavior: smooth;
}

.chm-orgchart-card-wrap.is-fullscreen {
    position: fixed;
    inset: 0.75rem;
    z-index: 1050;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    box-shadow: var(--chm-shadow-lg, 0 16px 48px rgba(0, 0, 0, 0.18));
}

.chm-orgchart-card-wrap.is-fullscreen .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chm-orgchart-card-wrap.is-fullscreen .chm-orgchart-viewport {
    flex: 1;
    min-height: 0;
}

body.chm-orgchart-fullscreen-active {
    overflow: hidden;
}

.chm-orgchart-scale {
    transform-origin: top center;
    transition: transform 0.15s ease;
    display: inline-block;
    vertical-align: top;
    text-align: center;
}

.chm-orgchart-tree {
    display: inline-block;
    text-align: center;
    vertical-align: top;
}

.chm-orgchart-tree,
.chm-orgchart-tree ul {
    padding-top: 10px;
    position: relative;
    margin: 0 auto;
}

.chm-orgchart-tree > ul {
    padding-top: 0;
}

.chm-orgchart-tree ul::after {
    content: '';
    display: block;
    clear: both;
}

.chm-orgchart-tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 10px 2px 0 2px;
}

.chm-orgchart-node:has(> .chm-orgchart-children) {
    padding-bottom: 0.35rem;
}

.chm-orgchart-tree li::before,
.chm-orgchart-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid color-mix(in srgb, var(--chm-accent) 35%, var(--chm-border));
    width: 50%;
    height: 10px;
}

.chm-orgchart-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid color-mix(in srgb, var(--chm-accent) 35%, var(--chm-border));
}

.chm-orgchart-tree li:only-child::after,
.chm-orgchart-tree li:only-child::before {
    display: none;
}

.chm-orgchart-tree li:only-child {
    padding-top: 0;
}

.chm-orgchart-tree li:first-child::before,
.chm-orgchart-tree li:last-child::after {
    border: 0 none;
}

.chm-orgchart-tree li:last-child::before {
    border-right: 2px solid color-mix(in srgb, var(--chm-accent) 35%, var(--chm-border));
    border-radius: 0 4px 0 0;
}

.chm-orgchart-tree li:first-child::after {
    border-radius: 4px 0 0 0;
}

.chm-orgchart-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid color-mix(in srgb, var(--chm-accent) 35%, var(--chm-border));
    width: 0;
    height: 10px;
}

.chm-orgchart-children.is-collapsed {
    display: none !important;
}

.chm-orgchart-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 0.7rem 0.55rem 0.55rem;
    width: 156px;
    background: var(--chm-surface);
    border: 1px solid var(--chm-border);
    border-radius: 12px;
    box-shadow: var(--chm-shadow-xs);
    position: relative;
    z-index: 1;
    transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
    cursor: pointer;
    outline: none;
}

.chm-orgchart-card.dept-tone-1 { border-top: 3px solid #6366f1; }
.chm-orgchart-card.dept-tone-2 { border-top: 3px solid #0ea5e9; }
.chm-orgchart-card.dept-tone-3 { border-top: 3px solid #10b981; }
.chm-orgchart-card.dept-tone-4 { border-top: 3px solid #f59e0b; }
.chm-orgchart-card.dept-tone-5 { border-top: 3px solid #ef4444; }
.chm-orgchart-card.dept-tone-6 { border-top: 3px solid #8b5cf6; }

.chm-orgchart-card:hover {
    border-color: var(--chm-accent);
    box-shadow: var(--chm-shadow-sm);
    transform: translateY(-2px);
}

.chm-orgchart-card.is-highlighted {
    border-color: var(--chm-accent);
    box-shadow: 0 0 0 3px var(--chm-accent-soft), var(--chm-shadow-sm);
    transform: translateY(-2px) scale(1.03);
    z-index: 3;
}

.chm-orgchart-card.is-path {
    border-color: color-mix(in srgb, var(--chm-accent) 70%, var(--chm-border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--chm-accent) 20%, transparent);
    z-index: 2;
}

.chm-orgchart-card.is-top-level {
    background: linear-gradient(180deg, color-mix(in srgb, var(--chm-accent) 6%, var(--chm-surface)) 0%, var(--chm-surface) 100%);
}

.chm-orgchart-level-badge {
    position: absolute;
    top: -0.4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: #fff;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
    z-index: 2;
}

.chm-orgchart-card .chm-org-avatar {
    width: 52px;
    height: 52px;
}

.chm-orgchart-card-name {
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.3;
    margin-top: 0.4rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.chm-orgchart-card-role {
    font-size: 0.75rem;
    color: var(--chm-text-muted);
    margin-top: 0.15rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chm-orgchart-card-dept {
    font-size: 0.75rem;
    color: var(--chm-accent);
    margin-top: 0.15rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chm-orgchart-card-manager {
    font-size: 0.6875rem;
    color: var(--chm-text-muted);
    margin-top: 0.2rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chm-orgchart-card-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.35rem;
}

.chm-orgchart-card-link {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--chm-text-muted);
    background: var(--chm-bg);
    border: 1px solid var(--chm-border);
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    font-size: 0.8rem;
}

.chm-orgchart-card:hover .chm-orgchart-card-link,
.chm-orgchart-card:focus-within .chm-orgchart-card-link {
    opacity: 1;
}

.chm-orgchart-card-link:hover {
    color: var(--chm-accent);
    border-color: var(--chm-accent);
}

.chm-orgchart-toggle {
    position: absolute;
    bottom: -0.65rem;
    left: 50%;
    transform: translateX(-50%);
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1px solid var(--chm-border);
    background: var(--chm-surface);
    color: var(--chm-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
    z-index: 2;
    box-shadow: var(--chm-shadow-xs);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chm-orgchart-toggle:hover {
    border-color: var(--chm-accent);
    color: var(--chm-accent);
    background: var(--chm-accent-soft);
}

.chm-orgchart-card.is-dept-head {
    border-color: color-mix(in srgb, var(--chm-accent) 55%, var(--chm-border));
    box-shadow: 0 0 0 1px var(--chm-accent-soft);
}

.chm-orgchart-hod-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--chm-accent);
    color: #fff;
}

.chm-orgchart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
}

.chm-org-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--chm-border);
    flex-shrink: 0;
}

.chm-org-avatar-sm {
    width: 32px;
    height: 32px;
}

/* Legacy list chart (kept for compatibility) */
.chm-org-chart {
    overflow-x: auto;
    padding: 1rem 0.5rem 2rem;
}

/* ─── Requisition wizard ────────────────────────────────── */
.chm-req-steps {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    overflow: hidden;
}

.chm-req-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    background: var(--chm-surface);
    color: var(--chm-text-muted);
    border-right: 1px solid var(--chm-border);
}

.chm-req-step:last-child { border-right: 0; }
.chm-req-step.is-active {
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    font-weight: 600;
}

.chm-req-step.is-done {
    color: var(--chm-success, #198754);
}

.chm-approval-chain {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chm-approval-stage {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    background: var(--chm-surface);
}

.chm-approval-stage-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
    margin-bottom: 0.25rem;
}

.chm-budget-picker-item {
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.chm-budget-picker-item:hover,
.chm-budget-picker-item.is-selected {
    border-color: var(--chm-accent) !important;
    background: var(--chm-accent-soft);
}

.chm-req-total-bar {
    font-size: 1.125rem;
    font-weight: 700;
    padding: 1rem;
    background: var(--chm-accent-soft);
    border-radius: var(--chm-radius-md, 10px);
    text-align: right;
}

.chm-req-upload-zone {
    border: 2px dashed var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    padding: 1.25rem;
    background: var(--chm-surface);
    transition: border-color 0.15s, background 0.15s;
}

.chm-req-upload-zone:hover,
.chm-req-upload-zone.is-dragover {
    border-color: var(--chm-accent);
    background: var(--chm-accent-soft);
}

.chm-req-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chm-req-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-sm, 8px);
    font-size: 0.8125rem;
    background: var(--chm-bg);
}

.chm-req-amount-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chm-req-review-table td {
    vertical-align: middle;
}

.chm-req-notify-box {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    padding: 1rem;
    background: var(--chm-surface);
}

.chm-req-lines-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chm-req-line-card {
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-md, 10px);
    padding: 1rem 1.25rem;
    background: var(--chm-surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.chm-req-line-card.is-over {
    border-color: var(--chm-danger, #dc3545);
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.15);
}

.chm-req-line-card.is-ok {
    border-color: rgba(25, 135, 84, 0.35);
}

.chm-req-line-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.chm-req-line-card__title {
    font-weight: 600;
    font-size: 0.9375rem;
}

.chm-req-line-card__meta {
    font-size: 0.75rem;
    color: var(--chm-text-muted);
    margin-top: 0.125rem;
}

.chm-req-line-card__balance {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--chm-accent-soft);
    border-radius: var(--chm-radius-sm, 8px);
}

.chm-req-line-card__balance-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
}

.chm-req-line-card__balance-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--chm-accent);
}

.chm-req-line-card__remaining {
    text-align: right;
}

.chm-req-line-card__remaining strong {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.chm-req-amount-input--large {
    font-size: 1.125rem;
    font-weight: 600;
    padding: 0.625rem 0.75rem;
}

.chm-req-total-bar--live {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
}

.chm-req-total-bar__label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted);
    font-weight: 500;
}

.chm-req-total-bar__value {
    font-size: 1.375rem;
    font-variant-numeric: tabular-nums;
}

.chm-req-upload-zone--compact {
    padding: 0.75rem;
}

.chm-req-lines-count {
    font-weight: 500;
}

.chm-approval-stage.is-current {
    border-color: var(--chm-warning, #ffc107);
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.25);
}

/* ─── Live auto-refresh ─────────────────────────────────── */
.chm-live-indicator {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: var(--chm-surface, #fff);
    border: 1px solid var(--chm-border);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--chm-success, #15803d);
    pointer-events: none;
    opacity: 0.85;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chm-live-indicator.is-pulse {
    transform: scale(1.04);
    opacity: 1;
}

.chm-live-updated {
    animation: chm-live-flash 1.2s ease;
}

@keyframes chm-live-flash {
    0% { background: rgba(21, 128, 61, 0.18); }
    100% { background: transparent; }
}

[data-chm-stat].chm-stat-value.chm-live-updated,
.chm-stat-value.chm-live-updated {
    border-radius: 4px;
}

/* Accounting report shell */
.chm-report-shell.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.chm-report-shell.is-fullscreen .chm-report-shell-body {
    flex: 1;
    overflow: auto;
    max-height: none;
}

body.chm-report-fullscreen-active {
    overflow: hidden;
}

.chm-report-launch-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--chm-radius-md);
    background: var(--chm-accent-soft);
    color: var(--chm-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.chm-report-shell-toolbar .form-control-sm {
    min-width: 9rem;
}

#chm-account-ledger-shell .journal-row {
    cursor: pointer;
}

#chm-account-ledger-shell .journal-row:hover {
    background: var(--chm-accent-soft);
}

/* Payment voucher — always fullscreen (no sidebar) */
body.chm-voucher-fullscreen-active {
    overflow: hidden;
}

.chm-voucher-fullscreen-shell {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.chm-voucher-fs-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.65rem 1rem;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chm-voucher-fs-toolbar .chm-voucher-mode-bar {
    flex: 1 1 auto;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.chm-voucher-fs-toolbar .chm-voucher-mode-bar .small.text-uppercase {
    display: none;
}

.chm-voucher-fullscreen-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chm-voucher-page .container-fluid {
    background-color: #f8f9fa;
    min-height: 100%;
}

@media print {
    .chm-voucher-fs-toolbar {
        display: none !important;
    }

    .chm-voucher-fullscreen-shell {
        position: static;
        inset: auto;
    }

    body.chm-voucher-fullscreen-active {
        overflow: visible;
    }
}

/* GRN intake (add / edit GRN) */
.chm-grn-intake-page .grn-type-panel {
    background: var(--chm-surface-muted, #f8f9fb);
    border: 1px solid var(--chm-border, #e9ecef);
    border-radius: var(--chm-radius-md, 0.5rem);
    padding: 1rem 1.25rem;
}

.chm-grn-intake-page .grn-type-panel__label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--chm-text-muted, #6c757d);
    margin-bottom: 0.75rem;
}

.chm-grn-intake-page .grn-faq-total-badge {
    font-size: 0.875rem;
    background: var(--chm-accent-soft, rgba(111, 79, 55, 0.1));
    color: var(--chm-accent, #6f4f37);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
}

.chm-grn-intake-page .grn-faq-total-badge--danger {
    background: rgba(220, 53, 69, 0.12);
    color: #b02a37;
    border: 1px solid rgba(220, 53, 69, 0.35);
}

.chm-grn-intake-page .grn-outturn-badge {
    font-size: 0.8125rem;
    background: rgba(25, 135, 84, 0.1);
    color: #146c43;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
}

.chm-grn-intake-page .grn-secondary-toggle {
    text-decoration: none;
    font-weight: 600;
}

.chm-grn-intake-page .grn-secondary-toggle[aria-expanded="true"] .bx-chevron-down {
    transform: rotate(180deg);
    display: inline-block;
}

.chm-grn-intake-page .grn-preview-photo-wrap {
    background: var(--chm-surface-muted, #f3f4f6);
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.chm-grn-intake-page .grn-preview-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chm-grn-intake-page .grn-meta-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chm-grn-intake-page .grn-meta-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--chm-border, #e9ecef);
    font-size: 0.8125rem;
}

.chm-grn-intake-page .grn-meta-list li:last-child {
    border-bottom: 0;
}

.chm-grn-intake-page .grn-meta-list span {
    color: var(--chm-text-muted, #6c757d);
}

.chm-grn-intake-page .grn-meta-list strong {
    text-align: right;
    color: var(--chm-text, #212529);
}

/* ─── SweetAlert2 — always visible above app chrome ─────── */
.swal2-container {
    z-index: 20000 !important;
}

.swal2-popup {
    font-family: var(--chm-font, 'Plus Jakarta Sans', sans-serif) !important;
}

/* ─── Payment voucher — today's purchase prices ─────────── */
.chm-voucher-daily-prices {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(111, 79, 55, 0.18);
    border-radius: 0.85rem;
    background: linear-gradient(135deg, rgba(111, 79, 55, 0.06) 0%, rgba(30, 58, 95, 0.04) 100%);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.chm-voucher-daily-prices__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.chm-voucher-daily-prices__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #6f4f37;
}

.chm-voucher-daily-prices__subtitle {
    font-size: 0.82rem;
    color: var(--chm-muted, #6c757d);
}

.chm-voucher-daily-prices__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.75rem;
}

.chm-voucher-daily-prices__field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chm-voucher-daily-prices__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--chm-muted, #6c757d);
}

.chm-voucher-daily-prices__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.btn-outline-coffee {
    color: #6f4f37;
    border-color: rgba(111, 79, 55, 0.45);
    background: #fff;
}

.btn-outline-coffee:hover {
    color: #fff;
    background: #6f4f37;
    border-color: #6f4f37;
}

/* ─── Payment voucher page (scoped) ─────────────────────── */
.chm-voucher-page .container-fluid {
    background-color: #f8f9fa;
}

.chm-voucher-page .card {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.chm-voucher-page .table thead th {
    background-color: #6f4e37 !important;
    color: #fff !important;
    font-size: 16px;
    font-weight: bold;
    padding: 12px;
    text-align: center;
}

.chm-voucher-page .table tbody td {
    font-size: 16px;
    padding: 10px;
    text-align: center;
    vertical-align: middle;
}

.chm-voucher-page .text-coffee {
    color: #6f4e37 !important;
}

.chm-voucher-page .border-bottom {
    border-bottom: 3px solid #6f4e37 !important;
}

.chm-voucher-page .small-row td {
    padding: 5px !important;
    font-size: 16px;
}

.chm-voucher-page .small-input {
    height: 35px !important;
    font-size: 26px !important;
    padding: 2px !important;
    text-align: center !important;
}

.chm-voucher-page .custom-table-border {
    border: 3px solid #000 !important;
}

.chm-voucher-page .custom-table-border th,
.chm-voucher-page .custom-table-border td {
    border: 2px solid #000 !important;
}

.chm-voucher-page .custom-table-border td[style="visibility: hidden;"] {
    border: none !important;
}

.chm-voucher-page .btn-coffee {
    background-color: #6f4e37;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    padding: 12px 25px;
    transition: background-color 0.3s, transform 0.2s ease;
}

.chm-voucher-page .btn-coffee:hover {
    background-color: #4b3827;
    transform: translateY(-3px);
}

.chm-voucher-page .btn-coffee:disabled {
    background-color: #a39b91;
    cursor: not-allowed;
}

/* MC deduction target picker */
.chm-mc-ded-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.chm-mc-ded-option {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--chm-border, #e5e7eb);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chm-mc-ded-option:has(input:checked) {
    border-color: #6f4e37;
    background: rgba(111, 79, 55, 0.06);
}

.chm-mc-ded-option input {
    margin-top: 0.2rem;
}

.chm-mc-ded-option__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* ─── Payment voucher registry ──────────────────────────── */
.chm-pv-registry-page .pv-workflow-panel {
    border-radius: var(--chm-radius);
}

.chm-pv-registry-page .pv-workflow-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 767.98px) {
    .chm-pv-registry-page .pv-workflow-steps {
        grid-template-columns: 1fr;
    }
}

.chm-pv-registry-page .pv-workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--chm-border);
    border-radius: var(--chm-radius-sm);
    text-decoration: none;
    color: inherit;
    background: var(--chm-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    position: relative;
}

.chm-pv-registry-page .pv-workflow-step:not(:last-child)::after {
    content: '\ea50';
    font-family: 'boxicons';
    position: absolute;
    right: -0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--chm-text-muted);
    font-size: 1rem;
    z-index: 1;
    background: var(--chm-surface);
    padding: 0 0.15rem;
}

@media (max-width: 767.98px) {
    .chm-pv-registry-page .pv-workflow-step:not(:last-child)::after {
        display: none;
    }
}

.chm-pv-registry-page .pv-workflow-step:hover {
    border-color: #6f4f37;
    box-shadow: var(--chm-shadow);
    transform: translateY(-1px);
    color: inherit;
}

.chm-pv-registry-page .pv-workflow-step--active {
    border-color: #6f4f37;
    background: rgba(111, 79, 55, 0.06);
    box-shadow: inset 0 0 0 1px rgba(111, 79, 55, 0.15);
}

.chm-pv-registry-page .pv-workflow-step__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(111, 79, 55, 0.12);
    color: #6f4f37;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.chm-pv-registry-page .pv-workflow-step--active .pv-workflow-step__icon {
    background: #6f4f37;
    color: #fff;
}

.chm-pv-registry-page .pv-workflow-step__count {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--chm-brand);
}

.chm-pv-registry-page .pv-workflow-step__title {
    font-weight: 600;
    font-size: 0.875rem;
}

.chm-pv-registry-page .pv-workflow-step__hint {
    font-size: 0.75rem;
    color: var(--chm-text-muted);
}

.chm-pv-registry-page .pv-attention-note {
    font-size: 0.8125rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--chm-radius-sm);
    background: var(--chm-gold-soft);
    color: #92400e;
}

.chm-pv-registry-page .pv-registry-tabs .nav-link {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--chm-text-muted);
    padding: 0.45rem 1rem;
}

.chm-pv-registry-page .pv-registry-tabs .nav-link.active {
    background: #6f4f37;
    color: #fff;
}

.chm-pv-registry-page .pv-registry-table thead th {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--chm-text-muted);
    background: var(--chm-surface-2);
    border-bottom: 1px solid var(--chm-border);
    white-space: nowrap;
}

.chm-pv-registry-page .pv-registry-table tbody td {
    border-bottom: 1px solid var(--chm-border);
    vertical-align: middle;
}

.chm-pv-registry-page .pv-voucher-no {
    font-weight: 700;
    color: #6f4f37;
}

.chm-pv-registry-page .pv-net-pay {
    color: var(--chm-primary);
}

.chm-pv-registry-page .pv-inline-search {
    max-width: 260px;
}

.chm-pv-registry-page .chm-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.chm-pv-registry-page .pv-empty-state i {
    font-size: 2.5rem;
    color: var(--chm-text-muted);
    opacity: 0.5;
    display: block;
    margin-bottom: 0.5rem;
}

.chm-pv-registry-page .pv-row-actions .dropdown-toggle::after {
    display: none;
}

/* ─── Global pagination (Bootstrap / CHM) ───────────────── */
.chm-pagination,
nav[aria-label="Pagination"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.chm-ui .pagination,
.chm-app .pagination {
    margin-bottom: 0;
    gap: 0.2rem;
}

.chm-ui .pagination .page-link,
.chm-app .pagination .page-link {
    font-size: 0.8125rem;
    line-height: 1.2;
    min-width: 2rem;
    padding: 0.35rem 0.55rem;
    text-align: center;
    color: var(--chm-text);
    border-color: var(--chm-border);
    box-shadow: none;
}

.chm-ui .pagination .page-link i,
.chm-app .pagination .page-link i {
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
}

.chm-ui .pagination .page-item.active .page-link,
.chm-app .pagination .page-item.active .page-link {
    background-color: #6f4f37;
    border-color: #6f4f37;
    color: #fff;
}

.chm-ui .pagination .page-link:hover,
.chm-app .pagination .page-link:hover {
    color: #6f4f37;
    background: rgba(111, 79, 55, 0.06);
    border-color: rgba(111, 79, 55, 0.35);
}

.chm-ui .pagination .page-item.disabled .page-link,
.chm-app .pagination .page-item.disabled .page-link {
    opacity: 0.55;
}

/* Safety net if Tailwind pagination view is ever used without Tailwind CSS */
nav[aria-label="Pagination Navigation"] svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
    max-width: 1.25rem;
    max-height: 1.25rem;
    display: inline-block;
    vertical-align: middle;
}

/* ─── Photo & avatar utilities (app-wide) ─────────────────── */

.chm-avatar,
img.chm-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 1px solid var(--chm-border, #e5e7eb);
}

.chm-avatar-sm {
    width: 3.125rem;
    height: 3.125rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
}

.chm-avatar-md {
    width: 3.75rem;
    height: 3.75rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 1px solid var(--chm-border, #e5e7eb);
    box-shadow: var(--chm-shadow-xs);
}

.chm-photo-preview {
    width: 5rem;
    height: 5rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 2px solid var(--chm-accent, var(--chm-brand));
    padding: 2px;
}

.chm-photo-preview-lg {
    width: 9.375rem;
    height: 9.375rem;
    max-width: 100%;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    display: block;
    background: var(--chm-surface-sunken, #f3f4f6);
}

.chm-photo-preview-profile {
    width: 6.875rem;
    height: 6.875rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 2px solid var(--chm-accent, var(--chm-brand));
    padding: 2px;
}

.chm-voucher-farmer-photo {
    width: 9.375rem;
    height: 9.375rem;
    max-width: 100%;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
}

.chm-farmer-photo-block {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: var(--chm-radius-full);
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
    border: 3px solid var(--coffee-brown, #6F4F37);
}

.chm-card-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.chm-status-card-photo {
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 20rem;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.chm-brand-preview {
    width: 5rem;
    height: 5rem;
    object-fit: contain;
    object-position: center;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 1px solid var(--chm-border, #e5e7eb);
    border-radius: var(--chm-radius-full);
    padding: 4px;
}

.chm-brand-preview-banner {
    width: 8rem;
    height: 5rem;
    object-fit: cover;
    object-position: center;
    display: inline-block;
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 1px solid var(--chm-border, #e5e7eb);
    border-radius: var(--chm-radius-md);
    padding: 4px;
}

/* ─── Journal entry detail page ─────────────────────────────── */

.chm-journal-show .chm-journal-balance-hero {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--chm-radius-lg);
    background: linear-gradient(135deg, var(--chm-surface) 0%, var(--chm-surface-sunken, #f8fafc) 100%);
    border: 1px solid var(--chm-border, #e5e7eb);
    box-shadow: var(--chm-shadow-xs);
}

.chm-journal-show .chm-journal-balance-hero.is-unbalanced {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fff7f7 0%, var(--chm-surface) 100%);
}

.chm-journal-show .chm-journal-balance-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: var(--chm-radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.chm-journal-show .chm-journal-balance-icon.is-balanced {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.chm-journal-show .chm-journal-balance-icon.is-unbalanced {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.chm-journal-show .chm-journal-scale {
    display: flex;
    height: 0.5rem;
    border-radius: 999px;
    overflow: hidden;
    max-width: 320px;
    background: var(--chm-border, #e5e7eb);
}

.chm-journal-show .chm-journal-scale-debit {
    background: linear-gradient(90deg, #f87171, #dc2626);
}

.chm-journal-show .chm-journal-scale-credit {
    background: linear-gradient(90deg, #4ade80, #16a34a);
}

.chm-journal-show .chm-journal-legend {
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 999px;
    margin-right: 0.25rem;
    vertical-align: middle;
}

.chm-journal-show .chm-journal-legend--debit { background: #dc2626; }
.chm-journal-show .chm-journal-legend--credit { background: #16a34a; }

.chm-journal-show .chm-journal-kpi {
    background: var(--chm-surface);
    border: 1px solid var(--chm-border, #e5e7eb);
    border-radius: var(--chm-radius-md);
    padding: 0.875rem 1rem;
    height: 100%;
    box-shadow: var(--chm-shadow-xs);
}

.chm-journal-show .chm-journal-kpi__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted, #6b7280);
    margin-bottom: 0.25rem;
}

.chm-journal-show .chm-journal-kpi__value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--chm-text, #111827);
    line-height: 1.2;
}

.chm-journal-show .chm-journal-kpi__value--debit { color: #dc2626; }
.chm-journal-show .chm-journal-kpi__value--credit { color: #16a34a; }

.chm-journal-show .chm-journal-kpi__sub {
    font-size: 0.75rem;
    color: var(--chm-text-muted, #6b7280);
    margin-top: 0.125rem;
}

.chm-journal-show .chm-journal-note {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    padding: 1rem 1.125rem;
    border-radius: var(--chm-radius-md);
    background: var(--chm-surface-sunken, #f8fafc);
    border: 1px solid var(--chm-border, #e5e7eb);
}

.chm-journal-show .chm-journal-note > i {
    font-size: 1.25rem;
    color: var(--chm-accent, var(--chm-brand));
    margin-top: 0.125rem;
}

.chm-journal-show .chm-journal-note__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted, #6b7280);
}

.chm-journal-show .chm-journal-note__text {
    font-size: 0.9375rem;
    color: var(--chm-text, #111827);
}

.chm-journal-show .chm-journal-lines-table thead th {
    background: var(--chm-surface-sunken, #f3f4f6);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted, #6b7280);
    border-bottom: 1px solid var(--chm-border, #e5e7eb);
}

.chm-journal-show .chm-journal-line-row:hover {
    background: var(--chm-surface-sunken, #f9fafb);
}

.chm-journal-show .chm-journal-lines-total {
    background: var(--chm-surface-sunken, #f3f4f6);
    border-top: 2px solid var(--chm-border, #e5e7eb);
}

.chm-journal-show .chm-ledger-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.chm-journal-show .chm-ledger-amount--debit { color: #dc2626; }
.chm-journal-show .chm-ledger-amount--credit { color: #16a34a; }

.chm-journal-show .chm-acct-type {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.chm-journal-show .chm-acct-type--asset { background: #dbeafe; color: #1d4ed8; }
.chm-journal-show .chm-acct-type--liability { background: #fef3c7; color: #b45309; }
.chm-journal-show .chm-acct-type--equity { background: #f3f4f6; color: #374151; }
.chm-journal-show .chm-acct-type--income { background: #dcfce7; color: #15803d; }
.chm-journal-show .chm-acct-type--expense { background: #fee2e2; color: #b91c1c; }
.chm-journal-show .chm-acct-type--neutral { background: #f3f4f6; color: #6b7280; }

/* ─── Journal entry edit form ─────────────────────────────────── */

.chm-journal-form .chm-journal-balance-hero {
    transition: border-color 0.2s ease, background 0.2s ease;
}

.chm-journal-form .form-control.is-invalid,
.chm-journal-form .form-select.is-invalid {
    border-color: #dc2626;
}

.chm-journal-form .debit-field:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.12);
}

.chm-journal-form .credit-field:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.12);
}

.chm-journal-form #submitBtn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.chm-journal-form .select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
}

/* ─── Journal entries index ───────────────────────────────────── */

.chm-journal-index .chm-journal-index-note {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    padding: 1rem 1.125rem;
    border-radius: var(--chm-radius-md);
    background: linear-gradient(135deg, #eff6ff 0%, var(--chm-surface) 100%);
    border: 1px solid #bfdbfe;
}

.chm-journal-index .chm-journal-index-note > i {
    font-size: 1.35rem;
    color: #2563eb;
    margin-top: 0.125rem;
}

.chm-journal-index .chm-journal-queue-tabs {
    gap: 0.5rem;
}

.chm-journal-index .chm-journal-queue-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--chm-border, #e5e7eb);
    background: var(--chm-surface);
    color: var(--chm-text-muted, #6b7280);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chm-journal-index .chm-journal-queue-tab:hover {
    border-color: var(--chm-primary, #2563eb);
    color: var(--chm-primary, #2563eb);
}

.chm-journal-index .chm-journal-queue-tab.is-active {
    background: var(--chm-primary, #2563eb);
    border-color: var(--chm-primary, #2563eb);
    color: #fff;
}

.chm-journal-index .chm-journal-queue-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.6875rem;
    font-weight: 700;
}

.chm-journal-index .chm-journal-queue-tab.is-active .chm-journal-queue-tab__count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.chm-journal-index .chm-journal-index-table thead th {
    background: var(--chm-surface-sunken, #f3f4f6);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--chm-text-muted, #6b7280);
    border-bottom: 1px solid var(--chm-border, #e5e7eb);
}

.chm-journal-index .chm-journal-index-row.is-unbalanced {
    background: #fff7f7;
}

.chm-journal-index .chm-journal-index-row.is-unbalanced:hover {
    background: #fee2e2;
}

.chm-journal-index .chm-journal-ref {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--chm-radius-sm, 0.375rem);
    background: var(--chm-surface-sunken, #f3f4f6);
    border: 1px solid var(--chm-border, #e5e7eb);
}

.chm-journal-index .chm-journal-desc {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chm-journal-index .chm-ledger-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.chm-journal-index .chm-ledger-amount--debit { color: #dc2626; }
.chm-journal-index .chm-ledger-amount--credit { color: #16a34a; }

.chm-journal-index .chm-stat-card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    height: 100%;
}

/* Database backup (Super Admin) */
.chm-db-backup .chm-db-backup-validation {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    border-radius: var(--chm-radius-md, 0.5rem);
    background: rgba(22, 163, 74, 0.08);
    border: 1px solid rgba(22, 163, 74, 0.18);
    color: var(--chm-text-secondary, #64748b);
}

.chm-db-backup .chm-db-backup-validation > i {
    font-size: 1.25rem;
    color: #16a34a;
    margin-top: 0.125rem;
}

.chm-db-backup .chm-db-backup-callout {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.875rem 1rem;
    border-radius: var(--chm-radius-md, 0.5rem);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.18);
    color: var(--chm-text-secondary, #64748b);
}

.chm-db-backup .chm-db-backup-callout > i {
    font-size: 1.25rem;
    color: #2563eb;
    margin-top: 0.125rem;
}

.chm-db-backup .chm-empty-state {
    padding: 2rem 1rem;
}
