:root {
    --navy-900: #0A1F3A;
    --navy-800: #0F2D52;
    --navy-700: #163E6E;
    --blue-600: #1D4ED8;
    --blue-700: #1E40AF;
    --blue-50: #EFF6FF;
    --blue-100: #DBEAFE;
    --slate-50: #F8FAFC;
    --slate-100: #F1F5F9;
    --slate-200: #E2E8F0;
    --slate-300: #CBD5E1;
    --slate-500: #64748B;
    --slate-600: #475569;
    --slate-800: #1E293B;
    --emerald-700: #15803D;
    --emerald-100: #DCFCE7;
    --amber-700: #B45309;
    --amber-100: #FEF3C7;
    --crimson-700: #B91C1C;
    --crimson-100: #FEE2E2;
    --white: #FFFFFF;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 45, 82, 0.06);
    --shadow-md: 0 4px 12px rgba(15, 45, 82, 0.10);
    --shadow-lg: 0 16px 36px rgba(10, 31, 58, 0.22);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--slate-800);
    background-color: var(--slate-50);
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

a {
    color: var(--blue-600);
    text-decoration: none;
}

a:hover {
    color: var(--blue-700);
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 14px;
}

/* Header & Navigation */
.app-header {
    background: var(--navy-800);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.header-top {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
    text-decoration: none;
}

.brand:hover {
    color: var(--white);
    text-decoration: none;
}

.brand-mark {
    width: 50px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-emblem {
    width: 50px;
    height: 40px;
    object-fit: contain;
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1.25;
}

.brand-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 11px;
    font-weight: 600;
    color: var(--white);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.header-link:hover,
.header-link.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
    text-decoration: none;
}

.header-link-logout {
    background: rgba(185, 28, 28, 0.25);
    border-color: rgba(254, 226, 226, 0.35);
}

.header-link-logout:hover {
    background: var(--crimson-700);
}

.main-nav {
    background: var(--navy-900);
}

.main-nav-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-size: 13.5px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.nav-tab.is-active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.10);
    border-bottom-color: #60A5FA;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--amber-700);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
}

.sub-nav {
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    color: var(--slate-800);
}

.sub-nav-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.sub-tab {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-600);
    background: var(--slate-100);
}

.sub-tab:hover {
    color: var(--navy-800);
    background: var(--slate-200);
    text-decoration: none;
}

.sub-tab.is-active {
    background: var(--blue-600);
    color: var(--white);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 0 32px;
}

.app-footer {
    background: var(--white);
    border-top: 1px solid var(--slate-200);
    color: var(--slate-500);
    font-size: 12px;
    padding: 12px 0;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Page Header & Cards */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy-800);
}

.page-subtitle {
    margin: 2px 0 0;
    color: var(--slate-500);
    font-size: 13px;
}

.card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy-800);
}

.card-body {
    padding: 16px;
}

/* Alerts & Flashes */
.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: var(--emerald-100);
    border-color: #86EFAC;
    color: #166534;
}

.alert-error {
    background: var(--crimson-100);
    border-color: #FCA5A5;
    color: #991B1B;
}

.alert-warning {
    background: var(--amber-100);
    border-color: #FCD34D;
    color: #92400E;
}

.alert-info {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--navy-800);
}

.alert-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.35;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: var(--blue-600);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--blue-700);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    border-color: var(--slate-300);
    color: var(--slate-800);
}

.btn-secondary:hover {
    background: var(--slate-100);
    color: var(--slate-800);
}

.btn-success {
    background: var(--emerald-700);
    color: var(--white);
}

.btn-success:hover {
    background: #166534;
    color: var(--white);
}

.btn-warning {
    background: var(--amber-700);
    color: var(--white);
}

.btn-warning:hover {
    background: #92400E;
    color: var(--white);
}

.btn-danger {
    background: var(--crimson-700);
    color: var(--white);
}

.btn-danger:hover {
    background: #991B1B;
    color: var(--white);
}

.btn-info {
    background: var(--blue-50);
    border-color: #BFDBFE;
    color: var(--blue-700);
}

.btn-info:hover {
    background: var(--blue-100);
    border-color: #93C5FD;
    color: var(--navy-800);
}

.btn-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-group-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.btn-group-stack .btn {
    width: 100%;
    justify-content: center;
}

/* Forms & Filters */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.form-grid .form-group {
    margin-bottom: 0;
}

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate-800);
}

.required-mark {
    color: var(--crimson-700);
}

.form-control,
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--slate-800);
    background: var(--white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

textarea {
    resize: vertical;
    min-height: 74px;
}

.form-control-sm,
.select-sm {
    padding: 4px 8px;
    font-size: 12.5px;
}

.form-hint {
    font-size: 12px;
    color: var(--slate-500);
}

.filter-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: flex-end;
}

.filter-bar .form-group {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
}

.filter-bar .form-label {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-bar input,
.filter-bar select {
    padding: 6px 8px;
    font-size: 13px;
    height: 34px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.filter-actions .btn {
    height: 34px;
    padding: 6px 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-neutral {
    background: var(--slate-100);
    color: var(--slate-600);
    border: 1px solid var(--slate-200);
}

.badge-info {
    background: var(--blue-50);
    color: var(--blue-700);
    border: 1px solid var(--blue-100);
}

.badge-navy {
    background: var(--navy-800);
    color: var(--white);
}

.badge-success {
    background: var(--emerald-100);
    color: var(--emerald-700);
    border: 1px solid #86EFAC;
}

.badge-warning {
    background: var(--amber-100);
    color: var(--amber-700);
    border: 1px solid #FCD34D;
}

.badge-danger {
    background: var(--crimson-100);
    color: var(--crimson-700);
    border: 1px solid #FCA5A5;
}

.badge-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 8px 10px;
    border: 1px solid var(--slate-300);
    vertical-align: middle;
    text-align: center;
}

.data-table td .badge-stack {
    justify-content: center;
}

.data-table td .btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.data-table thead th {
    background: var(--slate-100);
    color: var(--navy-800);
    font-weight: 700;
    font-size: 12.5px;
    border-bottom: 2px solid var(--slate-300);
    white-space: nowrap;
}

.data-table tbody tr:nth-child(even) {
    background-color: #FAFCFF;
}

.data-table tbody tr:hover {
    background: var(--slate-100);
}

.endorsement-cell {
    min-width: 220px;
}

.endorsement-section {
    padding: 2px 0;
}

.endorsement-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 2px;
}

.endorsement-body {
    font-size: 12.5px;
    line-height: 1.4;
}

.endorsement-badge {
    margin-bottom: 4px;
}

.endorsement-divider {
    border-top: 1px solid var(--slate-300);
    margin: 7px -10px;
    height: 0;
}

.executor-cell {
    min-width: 165px;
}

.executor-line {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--slate-800);
}

.executor-line + .executor-line {
    margin-top: 3px;
}

.executor-collab {
    color: var(--slate-600);
}

.doc-type-sub {
    margin-top: 4px;
}

.cell-center {
    text-align: center;
}

.cell-nowrap {
    white-space: nowrap;
}

.text-muted {
    color: var(--slate-500);
    font-size: 12px;
}

.empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--slate-500);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 58, 0.56);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
}

.modal-backdrop.is-open {
    display: flex;
}

#modal-file-preview.modal-backdrop {
    padding: 8px;
}

.modal-dialog {
    width: 100%;
    max-width: 660px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--slate-200);
}

.modal-dialog-sm {
    max-width: 480px;
}

.modal-dialog-lg {
    max-width: 820px;
}

.modal-dialog-xl {
    max-width: 1680px;
    width: 97vw;
    height: 95vh;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-dialog-xl .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
}

#filePreviewBody {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.file-preview-header {
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.file-preview-meta {
    min-width: 0;
    flex: 1 1 260px;
}

.file-preview-meta .modal-title {
    word-break: break-word;
}

.file-preview-subtitle {
    margin-top: 2px;
    word-break: break-word;
}

.file-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-preview-frame {
    width: 100%;
    flex: 1;
    min-height: 82vh;
    height: 100%;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--slate-100);
    display: block;
}

.file-preview-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 78vh;
    padding: 12px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
}

.file-preview-img {
    max-width: 100%;
    max-height: 84vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

.file-preview-fallback {
    text-align: center;
    padding: 36px 24px;
    background: var(--slate-50);
    border: 1px dashed var(--slate-300);
    border-radius: var(--radius-md);
    color: var(--slate-800);
}

.file-preview-fallback-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--navy-800);
}

.file-preview-fallback-text {
    margin: 0 auto 18px;
    color: var(--slate-600);
    font-size: 13.5px;
    max-width: 480px;
}

.summary-preview-trigger {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.data-table td.summary-preview-trigger:hover,
.summary-preview-trigger:hover,
.summary-preview-trigger:focus-visible {
    background-color: var(--blue-50);
    outline: none;
}

.summary-preview-trigger:focus-visible {
    box-shadow: inset 0 0 0 2px var(--blue-600);
}

.summary-eye-wrap {
    margin-top: 4px;
    display: flex;
    justify-content: center;
}

.summary-eye-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-600);
    transition: color 0.15s ease, transform 0.15s ease;
}

.summary-preview-trigger:hover .summary-eye-icon,
.summary-preview-trigger:focus-visible .summary-eye-icon {
    color: var(--navy-800);
    transform: scale(1.12);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--slate-50);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--navy-800);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--slate-500);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--slate-200);
    color: var(--slate-800);
}

.modal-body {
    padding: 18px;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    background: var(--slate-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Searchable Select & Multi-select */
.ss-wrapper,
.ms-wrap {
    position: relative;
    width: 100%;
}

.ss-native-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ss-trigger,
.ms-trigger {
    width: 100%;
    padding: 7px 32px 7px 10px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--slate-800);
    font-family: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-trigger::after,
.ms-trigger::after {
    content: "";
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--slate-500);
}

.ss-trigger:focus,
.ms-trigger:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.ss-dropdown,
.ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 1200;
    padding: 8px;
}

.ss-wrapper.is-open .ss-dropdown,
.ms-wrap.is-open .ms-dropdown {
    display: block;
}

.ss-search,
.ms-search {
    margin-bottom: 6px;
}

.ss-options,
.ms-options {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ss-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    color: var(--slate-800);
    cursor: pointer;
}

.ss-option:hover,
.ss-option.is-selected {
    background: var(--blue-50);
    color: var(--navy-800);
    font-weight: 600;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.ms-option:hover {
    background: var(--slate-100);
}

.ms-option input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--blue-600);
}

.ms-option.is-excluded {
    opacity: 0.48;
    cursor: not-allowed;
    text-decoration: line-through;
}

.ms-empty {
    padding: 8px;
    text-align: center;
    color: var(--slate-500);
    font-size: 12.5px;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 52%, var(--slate-100) 52%, var(--slate-50) 100%);
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--slate-200);
    overflow: visible;
}

.auth-card-header {
    background: var(--navy-800);
    color: var(--white);
    padding: 20px 24px;
    text-align: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.auth-card .ss-options {
    max-height: 280px;
}

.auth-card-header h1 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.4px;
}

.auth-card-header p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.8);
}

.auth-card-body {
    padding: 24px;
}

.btn-block {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
}

/* Two-column admin/detail layout helpers */
.split-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
    align-items: start;
}

.detail-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px 14px;
    margin: 0;
}

.detail-list dt {
    font-weight: 600;
    color: var(--slate-600);
}

.detail-list dd {
    margin: 0;
    color: var(--slate-800);
}

/* Column Header Filters */
.th-header-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.th-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--slate-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.th-filter-btn svg {
    display: block;
}

.th-filter-btn:hover {
    background: var(--slate-200);
    color: var(--navy-800);
}

.th-filter-btn:focus-visible {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.16);
}

.th-filter-btn.is-active {
    background: var(--blue-600);
    border-color: var(--blue-700);
    color: var(--white);
}

.th-filter-btn.is-active:hover {
    background: var(--navy-800);
    border-color: var(--navy-900);
    color: var(--white);
}

.cf-popover {
    position: fixed;
    z-index: 1200;
    width: 280px;
    max-width: calc(100vw - 24px);
    background: var(--white);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    text-align: left;
    color: var(--slate-800);
    font-size: 13px;
}

.cf-popover-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--navy-800);
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cf-sort-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.cf-sort-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
    color: var(--slate-800);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cf-sort-btn:hover {
    background: var(--slate-100);
    color: var(--navy-800);
}

.cf-sort-btn.is-active {
    background: var(--blue-50);
    border-color: var(--blue-600);
    color: var(--blue-700);
}

.cf-search {
    margin-bottom: 8px;
    padding: 5px 8px;
    font-size: 12.5px;
    height: 32px;
}

.cf-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--slate-200);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--navy-800);
    cursor: pointer;
    user-select: none;
}

.cf-select-all input[type="checkbox"],
input.cf-select-all {
    width: auto;
    margin: 0;
    accent-color: var(--blue-600);
}

.cf-options {
    max-height: 210px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0;
}

.cf-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--slate-800);
    cursor: pointer;
    user-select: none;
    word-break: break-word;
}

.cf-option:hover {
    background: var(--slate-100);
}

.cf-option input[type="checkbox"],
input.cf-option {
    width: auto;
    margin: 2px 0 0;
    flex-shrink: 0;
    accent-color: var(--blue-600);
}

.cf-empty {
    padding: 10px 8px;
    text-align: center;
    color: var(--slate-500);
    font-size: 12px;
}

.cf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--slate-200);
}

.cf-status-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--navy-800);
    font-size: 12px;
    font-weight: 600;
}

.cf-clear-inline {
    margin-left: 6px;
}

/* Remember-me, Multi-role Checkboxes & Header Notification Modals */
.remember-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-600);
    cursor: pointer;
    user-select: none;
}

.remember-check input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--blue-600);
    cursor: pointer;
}

.role-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.role-checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate-800);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.role-checkbox-item:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
}

.role-checkbox-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--blue-600);
    cursor: pointer;
}

.header-notif-btn {
    font-family: inherit;
    cursor: pointer;
    gap: 6px;
}

.header-notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--crimson-700);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.header-notif-badge.is-warning {
    background: var(--amber-700);
    color: var(--white);
}

.header-notif-badge.is-empty {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.85);
}

.due-soon-section + .due-soon-section {
    margin-top: 16px;
}

.due-soon-title {
    margin: 0 0 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--navy-800);
}

.due-soon-item {
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
}

.due-soon-item + .due-soon-item {
    margin-top: 8px;
}

.due-soon-item-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.due-soon-item-body {
    font-size: 13px;
    line-height: 1.45;
    color: var(--slate-800);
}

.due-soon-item-body a {
    font-weight: 600;
    color: var(--navy-800);
}

.due-soon-item-body a:hover {
    color: var(--blue-600);
}

.notif-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notif-item {
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-left: 3px solid var(--blue-600);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
}

.notif-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.notif-item-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--navy-800);
}

.notif-item-msg {
    font-size: 13px;
    line-height: 1.45;
    color: var(--slate-800);
    margin-bottom: 8px;
}

.notif-item-actions {
    display: flex;
    justify-content: flex-end;
}

/* Reports Module */
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.report-kpi-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-top: 3px solid var(--blue-600);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-kpi-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.report-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy-800);
    line-height: 1.25;
}

.report-kpi-sub {
    font-size: 12px;
    color: var(--slate-500);
    line-height: 1.4;
}

.report-preset-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.report-preset-link {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-300);
    background: var(--slate-50);
    color: var(--slate-800);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.report-preset-link:hover {
    background: var(--slate-100);
    color: var(--navy-800);
    text-decoration: none;
}

.report-preset-link.is-active {
    background: var(--blue-600);
    border-color: var(--blue-700);
    color: var(--white);
}

.report-preset-link.is-active:hover {
    background: var(--blue-700);
    color: var(--white);
}

.report-entry-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin: 14px 0;
}

.report-fieldset {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--slate-50);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-fieldset .form-group {
    margin-bottom: 0;
}

.report-fieldset-title {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-800);
}

.report-totals-row {
    background: var(--blue-50);
    font-weight: 700;
    color: var(--navy-800);
}

.report-totals-row td {
    border-top: 2px solid var(--slate-300);
    font-weight: 700;
    color: var(--navy-800);
}

/* Vietnamese dd/mm/yyyy Date Picker */
.vn-date-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.vn-date-wrap input[data-vn-date] {
    padding-right: 34px;
}

.vn-date-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.vn-date-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--slate-500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.vn-date-btn:hover {
    background: var(--slate-100);
    color: var(--navy-800);
}

@media (max-width: 1024px) {
    .filter-bar {
        flex-wrap: wrap;
    }
    .filter-bar .form-group {
        flex: 1 1 160px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
    .detail-list {
        grid-template-columns: 1fr;
    }
    .header-top-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
