:root {
    --gradient-primary: linear-gradient(135deg, #0f3145 0%, #1ca161 100%);
    --color-dark: #0f3145;
    --color-primary: #1ca161;
    --color-primary-light: #2ecc71;
    --color-primary-dark: #168a4f;
    --color-accent: #3db88a;
    --color-surface: #ffffff;
    --color-surface-alt: #f4f8f6;
    --color-border: #d8e8e0;
    --color-text: #1a2e35;
    --color-text-muted: #5a7a85;
    --color-text-light: #8aa5ad;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(15, 49, 69, 0.08);
    --shadow-md: 0 4px 16px rgba(15, 49, 69, 0.12);
    --shadow-lg: 0 8px 32px rgba(15, 49, 69, 0.16);
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-surface-alt);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 40%);
    pointer-events: none;
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-dark);
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--color-surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(28, 161, 97, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    width: 100%;
    padding: 0.85rem;
    box-shadow: 0 4px 14px rgba(28, 161, 97, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(28, 161, 97, 0.45);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-ghost:hover {
    color: var(--color-dark);
    background: rgba(15, 49, 69, 0.05);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.messages {
    margin-bottom: 1.25rem;
}

.messages .alert {
    margin-bottom: 0.5rem;
}

.field-error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #b91c1c;
}

.form-row {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr 1.2fr auto;
    gap: 1rem;
    align-items: start;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-actions label {
    visibility: hidden;
}

.btn-inline {
    width: auto;
    white-space: nowrap;
    padding: 0.7rem 1.25rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.form-control-sm {
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
    min-width: 0;
}

.status-select {
    min-width: 7.5rem;
}

.completion-status-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.completion-form-hidden {
    display: none;
}

.completion-status-form .form-control-sm[type="date"] {
    width: 9.5rem;
}

.data-table .btn-sm.btn-inline {
    padding: 0.35rem 0.65rem;
}

.btn-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.module-form-row {
    grid-template-columns: 1.4fr 1.4fr 1fr 0.9fr 1.1fr 1.2fr auto;
}

.module-form-actions .btn-group {
    flex-direction: column;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .module-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-list li {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text);
}

.autocomplete-list li:hover,
.autocomplete-list li.active {
    background: rgba(28, 161, 97, 0.08);
    color: var(--color-dark);
}

.autocomplete-list--portal {
    z-index: 11000;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-actions .btn-primary {
    width: auto;
    padding: 0.55rem 1.1rem;
    box-shadow: 0 2px 10px rgba(28, 161, 97, 0.3);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 49, 69, 0.45);
    backdrop-filter: blur(2px);
}

.modal-overlay.is-open {
    display: flex;
}

body.modal-open {
    overflow: hidden;
}

.modal-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 3rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-dialog-wide {
    max-width: 560px;
}

.modal-dialog-policy {
    max-width: 640px;
}

.modal-dialog-policy-xl {
    max-width: 920px;
    max-height: calc(100vh - 2rem);
}

.policy-modal-body {
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
}

.policy-modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.policy-modal-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.policy-modal-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 0.35rem;
}

.policy-modal-section-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 0.85rem;
}

.policy-editor {
    background: var(--color-surface);
    border-radius: 0 0 var(--radius) var(--radius);
}

.policy-editor .ql-toolbar {
    border-radius: var(--radius) var(--radius) 0 0;
    border-color: var(--color-border);
    background: var(--color-surface-alt);
}

.policy-editor .ql-container {
    min-height: 220px;
    max-height: 320px;
    overflow-y: auto;
    border-color: var(--color-border);
    font-family: var(--font-sans);
    font-size: 0.92rem;
}

.policy-view-card {
    overflow: hidden;
}

.policy-view-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.policy-view-header h2 {
    font-size: 1.35rem;
    color: var(--color-dark);
    margin-bottom: 0.75rem;
}

.policy-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.25rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.policy-view-body {
    padding: 1.75rem;
}

.policy-content-html {
    line-height: 1.65;
    color: var(--color-text);
}

.policy-content-html h1,
.policy-content-html h2,
.policy-content-html h3 {
    color: var(--color-dark);
    margin: 1.25rem 0 0.65rem;
    line-height: 1.3;
}

.policy-content-html h1 { font-size: 1.5rem; }
.policy-content-html h2 { font-size: 1.25rem; }
.policy-content-html h3 { font-size: 1.05rem; }

.policy-content-html p {
    margin-bottom: 0.85rem;
}

.policy-content-html ul,
.policy-content-html ol {
    margin: 0.5rem 0 1rem 1.5rem;
}

.policy-content-html li {
    margin-bottom: 0.35rem;
}

.policy-view-remarks {
    padding: 1rem 1.75rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.policy-view-remarks h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.policy-view-remarks p {
    font-size: 0.9rem;
    color: var(--color-text);
}

.policy-audit-card {
    margin-top: 1.25rem;
}

.policy-trail-card {
    margin-top: 1.25rem;
}

.policy-trail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.75rem;
}

.policy-trail-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.policy-trail-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: rgba(28, 161, 97, 0.08);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.policy-trail-body {
    padding: 1.25rem 1.75rem 1.75rem;
}

.policy-trail-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.policy-trail-item {
    position: relative;
    display: flex;
    gap: 1rem;
    padding: 0 0 1.35rem 0.25rem;
}

.policy-trail-item:last-child {
    padding-bottom: 0;
}

.policy-trail-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 0.4rem;
    top: 1.1rem;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.policy-trail-marker {
    flex-shrink: 0;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: 0.2rem;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    box-shadow: 0 0 0 3px rgba(28, 161, 97, 0.12);
    z-index: 1;
}

.policy-trail-content {
    flex: 1;
    min-width: 0;
    padding: 0.85rem 1rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.policy-trail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.policy-trail-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary-dark);
    background: rgba(28, 161, 97, 0.12);
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
}

.policy-trail-item--signed .policy-trail-marker,
.policy-trail-item--policy-signing-completed .policy-trail-marker {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.policy-trail-item--signed .policy-trail-badge,
.policy-trail-item--policy-signing-completed .policy-trail-badge {
    color: #065f46;
    background: #d1fae5;
}

.policy-trail-item--training-scheduled .policy-trail-marker {
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.policy-trail-item--training-scheduled .policy-trail-badge {
    color: #92400e;
    background: #fef3c7;
}

.policy-trail-item--submitted .policy-trail-marker {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.policy-trail-item--submitted .policy-trail-badge {
    color: #1e40af;
    background: #dbeafe;
}

.policy-trail-link {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--color-primary-dark);
    text-decoration: none;
}

.policy-trail-link:hover {
    text-decoration: underline;
}

.policy-trail-time {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.policy-trail-desc {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--color-text);
}

.policy-trail-meta {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.policy-audit-card h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.audit-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.audit-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.audit-list li:last-child {
    border-bottom: none;
}

.audit-meta {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.form-group.has-error .form-control,
.form-group.has-error select.form-control {
    border-color: var(--color-danger, #dc2626);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.policy-modal-section.has-error .policy-editor {
    border-color: var(--color-danger, #dc2626);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.form-group.has-error label {
    color: var(--color-danger, #dc2626);
}

.policy-result-meta {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.75rem;
}

.policy-result-errors {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    color: var(--color-danger, #b91c1c);
    font-size: 0.9rem;
}

.policy-result-errors li {
    margin-bottom: 0.35rem;
}

.modal-dialog-policy-result {
    max-width: 520px;
}

.alert.show {
    display: block;
}

.policy-renew-card {
    padding: 1.5rem;
}

.policy-renew-card .form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.system-settings-form {
    max-width: 36rem;
    padding: 0 0 1rem;
}

.system-settings-form .form-group {
    margin-bottom: 1rem;
}

.admin-settings-grid {
    align-items: start;
}

.admin-settings-card {
    overflow: visible;
}

.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    padding: 0 0.5rem;
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.admin-tab:hover {
    color: var(--color-dark);
}

.admin-tab.active {
    color: var(--color-primary-dark);
    border-bottom-color: var(--color-primary);
    background: var(--color-surface);
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(28, 161, 97, 0.12);
    color: var(--color-primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
}

.admin-tab-panel {
    padding: 0;
}

.admin-tab-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.admin-tab-desc {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.admin-add-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.lookup-add-row {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.lookup-add-row .form-control {
    flex: 1;
}

.lookup-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lookup-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.88rem;
}

.lookup-list li.lookup-empty {
    color: var(--color-text-muted);
    justify-content: center;
    font-style: italic;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label input {
    width: 1rem;
    height: 1rem;
}

.data-table.policy-register-table .col-wrap {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
}

.modal-close:hover {
    background: rgba(15, 49, 69, 0.06);
    color: var(--color-dark);
}

.modal-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

@media (max-width: 900px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions label {
        display: none;
    }

    .btn-inline {
        width: 100%;
    }
}

/* ── App Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.sidebar-brand span {
    font-size: 0.7rem;
    opacity: 0.7;
    font-weight: 400;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.18);
    color: white;
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.85;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-footer .user-info {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

.top-bar {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-dark);
    letter-spacing: -0.02em;
}

.page-content {
    padding: 1.75rem 2rem 2.5rem;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

/* ── Stats Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.35rem;
}

.stat-card.highlight {
    background: var(--gradient-primary);
    border: none;
}

.stat-card.highlight::before {
    display: none;
}

.stat-card.highlight .stat-label,
.stat-card.highlight .stat-value,
.stat-card.highlight .stat-sub {
    color: white;
}

.stat-card.highlight .stat-label {
    opacity: 0.85;
}

.stat-card.highlight .stat-sub {
    opacity: 0.75;
}

/* ── Section Cards ── */
.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.card-form {
    overflow: visible;
    position: relative;
    z-index: 10;
}

.card-form .card-body {
    overflow: visible;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.card-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-body {
    padding: 0;
}

/* ── Tables ── */
.table-wrap {
    overflow: auto;
    max-width: 100%;
    max-height: calc(100vh - var(--header-height) - 7rem);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--color-dark);
    color: white;
    font-weight: 600;
    text-align: left;
    padding: 0.7rem 1rem;
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.data-table th.sticky-col {
    left: 0;
    z-index: 5;
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.12);
}

.data-table thead tr:nth-child(2) th {
    top: 2.4rem;
}

.data-table.compact thead tr:nth-child(2) th {
    top: 2.1rem;
}

.data-table thead tr:nth-child(2) th.sticky-col {
    z-index: 6;
}

.data-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    background: var(--color-surface);
}

.data-table td.sticky-col {
    position: sticky;
    left: 0;
    background: var(--color-surface);
    z-index: 2;
    font-weight: 500;
    box-shadow: 1px 0 0 var(--color-border);
}

.data-table tbody tr:hover td {
    background: rgba(28, 161, 97, 0.04);
}

.data-table tbody tr:hover td.sticky-col {
    background: #eef7f2;
}

.data-table.compact td,
.data-table.compact th {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.filter-card {
    overflow: visible;
    position: relative;
    z-index: 20;
}

.filter-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.85fr 1fr auto;
    gap: 0.85rem;
    align-items: start;
}

.filter-row .form-group {
    margin-bottom: 0;
}

.filter-row label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-actions label {
    visibility: hidden;
}

@media (max-width: 900px) {
    .filter-row {
        grid-template-columns: 1fr 1fr;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

    .filter-actions label {
        display: none;
    }
}

/* Completion log — narrower columns with wrapped text */
.data-table.completion-log-table {
    table-layout: fixed;
    width: 100%;
    min-width: 800px;
}

.data-table.completion-log-table th,
.data-table.completion-log-table td {
    padding: 0.45rem 0.55rem;
    font-size: 0.8rem;
    vertical-align: top;
}

.data-table.completion-log-table .col-wrap {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.data-table.completion-log-table th.col-wrap,
.data-table.completion-log-table td.col-wrap {
    max-width: 0;
}

.data-table.completion-log-table th:nth-child(1),
.data-table.completion-log-table td:nth-child(1) {
    width: 10%;
}

.data-table.completion-log-table th:nth-child(2),
.data-table.completion-log-table td:nth-child(2) {
    width: 10%;
}

.data-table.completion-log-table th:nth-child(3),
.data-table.completion-log-table td:nth-child(3) {
    width: 9%;
}

.data-table.completion-log-table th:nth-child(4),
.data-table.completion-log-table td:nth-child(4) {
    width: 18%;
}

.data-table.completion-log-table th:nth-child(5),
.data-table.completion-log-table td:nth-child(5) {
    width: 10%;
}

.data-table.completion-log-table th:nth-child(6),
.data-table.completion-log-table td:nth-child(6) {
    width: 9%;
}

.data-table.completion-log-table th:nth-child(7),
.data-table.completion-log-table td:nth-child(7) {
    width: 9%;
}

.data-table.completion-log-table th:nth-child(8),
.data-table.completion-log-table td:nth-child(8) {
    width: 10%;
}

.data-table.completion-log-table th:nth-child(9),
.data-table.completion-log-table td:nth-child(9) {
    width: 7%;
}

.data-table.completion-log-table .col-date {
    white-space: normal;
    font-size: 0.78rem;
}

.data-table.completion-log-table .col-action {
    white-space: nowrap;
}

.data-table.completion-log-table .status-select {
    min-width: 6.5rem;
    width: 100%;
}

.data-table.completion-log-table .form-control-sm[type="date"] {
    width: 100%;
    min-width: 0;
    padding: 0.3rem 0.4rem;
}

.data-table.completion-log-table .btn-sm.btn-inline {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}

.data-table.completion-log-table td.sticky-col {
    max-width: none;
}

.data-table.out-of-schedule-table {
    table-layout: auto;
}

.data-table.out-of-schedule-table th,
.data-table.out-of-schedule-table td {
    vertical-align: middle;
}

.data-table.out-of-schedule-table .col-wrap {
    min-width: 7rem;
}

.data-table.out-of-schedule-table .col-date {
    min-width: 9rem;
    white-space: nowrap;
}

.data-table.out-of-schedule-table .col-action {
    min-width: 7.5rem;
    white-space: nowrap;
}

.data-table.out-of-schedule-table .form-control-sm {
    min-width: 6.5rem;
}

.data-table.out-of-schedule-table .form-control-sm[type="date"] {
    min-width: 9rem;
}

.data-table.out-of-schedule-table td.sticky-col {
    max-width: none;
}

.table-actions-stack {
    flex-direction: column;
    align-items: stretch;
}

.table-actions-stack .btn-sm {
    width: 100%;
}

.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.lms-link-sm {
    font-size: 0.82rem;
    color: var(--color-primary-dark);
}

/* ── Status Badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-not-required {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-not-approved {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Progress Ring ── */
.compliance-banner {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 1.75rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.compliance-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-primary) calc(var(--pct) * 1%),
        var(--color-border) 0
    );
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.compliance-ring-inner {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-dark);
}

.compliance-info h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 0.25rem;
}

.compliance-info p {
    color: var(--color-text-muted);
    font-size: 0.88rem;
}

/* ── Mini bar chart rows ── */
.bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.bar-row:last-child {
    border-bottom: none;
}

.bar-label {
    flex: 0 0 140px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.bar-fill-completed {
    background: var(--color-primary);
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.bar-fill-pending {
    background: #fbbf24;
    height: 100%;
}

.bar-counts {
    flex: 0 0 80px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--color-text-muted);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ── Page header row ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header .count-badge {
    background: rgba(28, 161, 97, 0.1);
    color: var(--color-primary-dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── Schedule matrix cell ── */
.page-header .schedule-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.schedule-legend-swatch {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.schedule-legend-pending {
    background: #fef3c7;
}

.schedule-legend-completed {
    background: #d1fae5;
}

.table-schedule .schedule-cell {
    text-align: center;
    vertical-align: middle;
    min-width: 5.5rem;
    padding: 0.45rem 0.35rem;
}

.table-schedule .schedule-cell-pending {
    background: #fef3c7;
    color: #92400e;
}

.data-table.table-schedule tbody tr:hover td.schedule-cell-pending {
    background: #fde68a;
}

.table-schedule .schedule-cell-completed {
    background: #d1fae5;
    color: #065f46;
}

.data-table.table-schedule tbody tr:hover td.schedule-cell-completed {
    background: #a7f3d0;
}

.table-schedule .schedule-cell-na,
.table-schedule .schedule-cell-empty {
    background: #f9fafb;
}

.data-table.table-schedule tbody tr:hover td.schedule-cell-na,
.data-table.table-schedule tbody tr:hover td.schedule-cell-empty {
    background: #f3f4f6;
}

.schedule-cell-date {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
}

.table-schedule .schedule-cell-pending .schedule-cell-date {
    color: #92400e;
}

.table-schedule .schedule-cell-completed .schedule-cell-date {
    color: #065f46;
}

.cell-date {
    font-size: 0.78rem;
    color: var(--color-dark);
}

.cell-na {
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar {
        width: 64px;
    }

    .sidebar-brand h2,
    .sidebar-brand span,
    .sidebar-nav a span,
    .sidebar-footer .user-info {
        display: none;
    }

    .sidebar-brand {
        justify-content: center;
        padding: 1rem;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 0.75rem;
    }

    .main-content {
        margin-left: 64px;
    }

    .page-content {
        padding: 1.25rem;
    }

    .compliance-banner {
        flex-direction: column;
        text-align: center;
    }
}
