/* =====================================================================
   Điều Hành TDP — lớp giao diện trên nền AdminLTE 4 / Bootstrap 5.3
   ===================================================================== */

/* ---------- Font: Be Vietnam Pro (OFL), nhúng cục bộ ---------- */
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-vietnamese-400-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 400; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-vietnamese-500-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 500; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-vietnamese-600-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-vietnamese-700-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Be Vietnam Pro"; font-style: normal; font-weight: 700; font-display: swap; src: url("../lib/be-vietnam-pro/be-vietnam-pro-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root,
[data-bs-theme="light"] {
    --bs-font-sans-serif: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: 0.875rem;
    --bs-body-line-height: 1.55;
    --bs-body-color: #1f2937;
    --bs-secondary-color: #6b7280;
    --bs-body-bg: #ffffff;
    --bs-tertiary-bg: #f5f7fa;
    --bs-border-color: #e5e7eb;
    --bs-border-color-translucent: rgba(17, 24, 39, 0.08);
    --bs-border-radius: 0.5rem;
    --bs-border-radius-sm: 0.375rem;
    --bs-border-radius-lg: 0.75rem;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-primary-text-emphasis: #1e3a8a;
    --bs-primary-bg-subtle: #e8efff;
    --bs-primary-border-subtle: #c7d6fe;
    --bs-link-color: #1d4ed8;
    --bs-link-color-rgb: 29, 78, 216;
    --bs-link-hover-color: #1e40af;
    --bs-link-hover-color-rgb: 30, 64, 175;
    --app-page-bg: #f3f5f9;
    --app-card-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
}

[data-bs-theme="dark"] {
    --bs-body-color: #e5e7eb;
    --bs-secondary-color: #9ca3af;
    --bs-body-bg: #1a1d23;
    --bs-tertiary-bg: #22262e;
    --bs-border-color: #2f343d;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.08);
    --bs-link-color: #7aa2ff;
    --bs-link-color-rgb: 122, 162, 255;
    --bs-link-hover-color: #a5c0ff;
    --bs-link-hover-color-rgb: 165, 192, 255;
    --bs-primary-text-emphasis: #a5c0ff;
    --bs-primary-bg-subtle: #1b2a4d;
    --bs-primary-border-subtle: #2c427a;
    --app-page-bg: #111318;
    --app-card-shadow: none;
}

body {
    font-family: var(--bs-body-font-family);
    font-size: var(--bs-body-font-size);
    -webkit-font-smoothing: antialiased;
}

.app-main,
body.bg-body-tertiary {
    background-color: var(--app-page-bg) !important;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn, .nav-link, .dropdown-item, .page-link, .badge, .list-group-item-action, .brand-link, a.stat-card {
    text-decoration: none !important;
}

/* ---------- Buttons ---------- */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: 0.875rem;
}

.btn-sm {
    --bs-btn-font-size: 0.8125rem;
}

.btn-primary {
    --bs-btn-bg: #1d4ed8;
    --bs-btn-border-color: #1d4ed8;
    --bs-btn-hover-bg: #1e40af;
    --bs-btn-hover-border-color: #1e40af;
    --bs-btn-active-bg: #1e3a8a;
    --bs-btn-active-border-color: #1e3a8a;
    --bs-btn-disabled-bg: #1d4ed8;
    --bs-btn-disabled-border-color: #1d4ed8;
}

.btn-outline-primary {
    --bs-btn-color: #1d4ed8;
    --bs-btn-border-color: #c7d6fe;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af;
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #a5c0ff;
    --bs-btn-border-color: #2c427a;
}

/* Nút phụ: nền trắng, viền xám */
.btn-default {
    --bs-btn-bg: var(--bs-body-bg);
    --bs-btn-color: var(--bs-body-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-bg: var(--bs-tertiary-bg);
    --bs-btn-hover-border-color: #cfd4dc;
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-tertiary-bg);
    --bs-btn-active-color: var(--bs-body-color);
    --bs-btn-active-border-color: #cfd4dc;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Form ---------- */
.form-control, .form-select {
    border-color: var(--bs-border-color);
    font-size: 0.875rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.3rem;
}

.form-control:focus, .form-select:focus {
    border-color: #93b0f8;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.15);
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
}

.card.card-outline {
    border-top: 1px solid var(--bs-border-color-translucent);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    padding: 0.8rem 1.25rem;
}

.card-header:first-child {
    border-radius: var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0 0;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    float: none;
}

.card-title .bi {
    color: var(--bs-secondary-color);
}

.card-footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color-translucent);
}

/* ---------- Page header ---------- */
.app-content-header {
    padding-top: 1.25rem;
    padding-bottom: 0.75rem;
}

.page-header .breadcrumb {
    font-size: 0.8125rem;
    margin-bottom: 0.35rem;
    --bs-breadcrumb-divider-color: var(--bs-secondary-color);
}

.page-header .breadcrumb-item.active {
    color: var(--bs-secondary-color);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.25;
}

.page-subtitle {
    color: var(--bs-secondary-color);
    margin-top: 0.15rem;
    font-size: 0.875rem;
    max-width: 70rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Màn hình rộng: tiêu đề co lại (cắt bớt mô tả) để nút thao tác luôn nằm cùng hàng bên phải. */
@media (min-width: 992px) {
    .page-header { flex-wrap: nowrap !important; }
    .page-heading { flex: 1 1 auto; }
    .page-actions { flex: 0 0 auto; flex-wrap: nowrap; }
}

/* Chuyển văn bản trước / sau */
.doc-nav .doc-nav-pos {
    opacity: 1;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--bs-secondary-color);
    min-width: 4.5rem;
}

.doc-nav + * {
    margin-left: 0.25rem;
}

/* ---------- Tables ---------- */
.table {
    --bs-table-hover-bg: rgba(29, 78, 216, 0.035);
    margin-bottom: 0;
}

.table > thead > tr > th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    white-space: nowrap;
    padding: 0.6rem 0.75rem;
}

.table > thead > tr > th a {
    color: inherit;
}

.table > tbody > tr > td {
    padding: 0.65rem 0.75rem;
    vertical-align: middle;
    border-color: var(--bs-border-color-translucent);
}

.table > tbody > tr:last-child > td {
    border-bottom: 0;
}

.table .cell-title {
    min-width: 280px;
}

.table .cell-title a,
.table a.row-link {
    color: var(--bs-body-color);
    font-weight: 500;
}

.table .cell-title a:hover,
.table a.row-link:hover {
    color: var(--bs-link-color);
}

.min-w-0 { min-width: 0; }

.table .col-check {
    width: 2.5rem;
    text-align: center;
}

.doc-dir {
    color: var(--bs-secondary-color);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.table .cell-org {
    max-width: 11rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-sub {
    font-size: 0.775rem;
    color: var(--bs-secondary-color);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Số hiệu: cùng font với trang (Be Vietnam Pro có đủ dấu, kể cả "Đ" trong QĐ), chữ số đều cột để dễ dò. */
.doc-number {
    font-size: 0.8rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    color: var(--bs-secondary-color);
    padding: 3rem 1rem;
}

.empty-state .bi {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

/* Thanh công cụ của bảng (lọc nhanh, thao tác hàng loạt) */
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.bulk-bar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.6rem 1.25rem;
    background: var(--bs-primary-bg-subtle);
    border-bottom: 1px solid var(--bs-primary-border-subtle);
}

.bulk-bar.show {
    display: flex;
}

/* Điều kiện đang lọc: từng nhãn có thể bỏ riêng, hỗ trợ tên dài trên điện thoại. */
.active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .65rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    max-width: 100%;
    padding: .3rem .65rem;
    border: 1px solid var(--bs-primary-border-subtle);
    border-radius: 1rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: .8125rem;
    text-decoration: none;
}

.filter-chip span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.filter-chip:hover {
    border-color: var(--bs-primary);
}

.processing-menu {
    width: 22rem;
    max-width: calc(100vw - 2rem);
}

.processing-menu .dropdown-item {
    white-space: normal;
}

.processing-description {
    display: block;
    margin-top: .15rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    font-weight: normal;
}

.processing-menu .dropdown-item:active .processing-description {
    color: inherit;
}

.doc-processing-feedback[hidden] {
    display: none !important;
}

.empty-state .btn .bi {
    display: inline;
    font-size: inherit;
    margin-bottom: 0;
    opacity: 1;
}

@media (max-width: 767.98px) {
    .list-filter-form .btn,
    .filter-chip,
    .filter-clear,
    .resident-edit,
    .document-actions,
    .processing-retry .btn,
    .processing-menu .dropdown-item {
        min-height: 44px;
    }

    .resident-edit,
    .document-actions {
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Avatar chữ cái cho nhân khẩu */
.person-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
}

.person-avatar.female {
    color: #be185d;
    background: #fce7f3;
}

[data-bs-theme="dark"] .person-avatar.female {
    color: #f9a8d4;
    background: rgba(236, 72, 153, 0.18);
}

.table a.person-name {
    color: var(--bs-body-color);
    font-weight: 500;
}

.table a.person-name:hover {
    color: var(--bs-link-color);
}

/* ---------- Soft badges ---------- */
.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.32em 0.65em;
    border-radius: 999px;
}

.badge-soft-primary { color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle); }
.badge-soft-success { color: var(--bs-success-text-emphasis); background: var(--bs-success-bg-subtle); }
.badge-soft-warning { color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); }
.badge-soft-danger { color: var(--bs-danger-text-emphasis); background: var(--bs-danger-bg-subtle); }
.badge-soft-info { color: var(--bs-info-text-emphasis); background: var(--bs-info-bg-subtle); }
.badge-soft-secondary { color: var(--bs-secondary-text-emphasis); background: var(--bs-secondary-bg-subtle); }
.badge-soft-dark { color: var(--bs-body-color); background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); }

.tag {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    margin: 0.1rem 0.15rem 0.1rem 0;
    white-space: nowrap;
}

/* ---------- Stat cards ---------- */
.stat-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.1rem;
    height: 100%;
    color: inherit;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

a.stat-card:hover {
    color: inherit;
    border-color: var(--bs-primary-border-subtle);
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
    transform: translateY(-1px);
}

.stat-icon {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    line-height: 1.3;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-hint {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.mini-stat {
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
}

.mini-stat .value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bs-body-color);
}

.mini-stat .label {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

a.mini-stat:hover {
    background: var(--bs-primary-bg-subtle);
}

.tone-primary { color: #1d4ed8; background: #e8efff; }
.tone-success { color: #047857; background: #dcfce7; }
.tone-warning { color: #b45309; background: #fef3c7; }
.tone-danger { color: #b91c1c; background: #fee2e2; }
.tone-info { color: #0e7490; background: #cffafe; }
.tone-secondary { color: #475569; background: #e2e8f0; }

[data-bs-theme="dark"] .tone-primary { color: #a5c0ff; background: #1b2a4d; }
[data-bs-theme="dark"] .tone-success { color: #6ee7b7; background: #0f3326; }
[data-bs-theme="dark"] .tone-warning { color: #fcd34d; background: #3a2c0a; }
[data-bs-theme="dark"] .tone-danger { color: #fca5a5; background: #3f1515; }
[data-bs-theme="dark"] .tone-info { color: #67e8f9; background: #0c3440; }
[data-bs-theme="dark"] .tone-secondary { color: #cbd5e1; background: #2a313c; }

/* ---------- Sidebar / header ---------- */
.sidebar-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.brand-text {
    font-weight: 600 !important;
    font-size: 0.975rem;
    color: #fff;
    line-height: 1.15;
}

.brand-sub {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
}

.sidebar-menu .nav-link {
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.sidebar-menu .nav-header {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4) !important;
    padding: 1rem 1rem 0.35rem;
}

.sidebar-menu .nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    border-radius: 0.375rem;
}

.sidebar-menu .nav-group-toggle:hover,
.sidebar-menu .nav-group-toggle:focus-visible {
    color: rgba(255, 255, 255, 0.75) !important;
}

.sidebar-menu .nav-group-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar-menu .nav-group-toggle.collapsed .nav-group-arrow {
    transform: rotate(-90deg);
}

.sidebar-menu .nav-group-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    display: none;
}

/* Chấm báo công việc chỉ hiện khi nhóm đang thu gọn. */
.sidebar-menu .nav-group-toggle.collapsed .nav-group-dot {
    display: inline-block;
}

.sidebar-menu .nav-group > .nav {
    flex-wrap: nowrap;
}

.app-sidebar .sidebar-menu .nav-link.active {
    background-color: #1d4ed8 !important;
    color: #fff !important;
}

.user-titles {
    font-size: 0.7rem;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-header {
    border-bottom: 1px solid var(--bs-border-color-translucent);
    box-shadow: none;
}

.header-search {
    max-width: 460px;
}

.header-search .form-control {
    background: var(--bs-tertiary-bg);
    border-color: transparent;
}

.header-search .form-control:focus {
    background: var(--bs-body-bg);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-footer {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--bs-border-color-translucent);
    padding: 0.75rem 1rem;
}

.app-toasts {
    z-index: 1090;
}

/* Dải nhãn môi trường (App:EnvironmentLabel), ví dụ DEV */
.environment-label {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    padding: 2px 16px;
    background: #fd7e14;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0 0 6px 6px;
    pointer-events: none;
}

/* ---------- Definition list (trang chi tiết) ---------- */
.info-list {
    margin: 0;
}

.info-list .info-row {
    display: grid;
    grid-template-columns: minmax(110px, 34%) 1fr;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.info-list .info-row:last-child {
    border-bottom: 0;
}

.info-list dt {
    font-weight: 500;
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
}

.info-list dd {
    margin: 0;
    word-break: break-word;
}

.muted-empty {
    color: var(--bs-secondary-color);
}

/* ---------- Timeline (lịch sử / hoạt động) ---------- */
.timeline-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
}

.timeline-list li {
    position: relative;
    padding: 0.5rem 1.25rem 0.5rem 2.6rem;
    font-size: 0.8125rem;
}

.timeline-list li::before {
    content: "";
    position: absolute;
    left: 1.35rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--bs-border-color);
}

.timeline-list li:first-child::before { top: 1rem; }
.timeline-list li:last-child::before { bottom: calc(100% - 1rem); }
.timeline-list li:only-child::before { display: none; }

.timeline-dot {
    position: absolute;
    left: calc(1.35rem - 0.3rem);
    top: 0.85rem;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 3px var(--bs-body-bg);
}

.timeline-dot.dot-primary { background: #1d4ed8; }
.timeline-dot.dot-success { background: #059669; }
.timeline-dot.dot-warning { background: #d97706; }
.timeline-dot.dot-danger { background: #dc2626; }

.timeline-time {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
}

/* ---------- PDF viewer ---------- */
.pdf-viewer-card {
    height: calc(100vh - 200px);
    min-height: 480px;
}

.pdf-viewer-body {
    overflow: auto;
    background: var(--bs-tertiary-bg);
    outline: none;
}

.pdf-canvas-wrapper {
    display: flex;
    justify-content: center;
    padding: 12px;
}

.pdf-canvas-wrapper canvas {
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    background: #fff;
}

.pdf-page-input {
    width: 112px;
}

.pdf-zoom-label {
    min-width: 58px;
}

.metadata-panel {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 2px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
}

@media (max-width: 991.98px) {
    .pdf-viewer-card { height: 70vh; }
    .metadata-panel { max-height: none; }
}

/* ---------- Trình xem PDF: kết quả tìm kiếm ---------- */
.pdf-page-box {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.pdf-highlight-layer {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}

.pdf-hl {
    position: absolute;
    background: rgba(250, 204, 21, 0.42);
    outline: 1px solid rgba(202, 138, 4, 0.55);
    border-radius: 2px;
    mix-blend-mode: multiply;
}

.pdf-search-bar {
    padding: 0.45rem 0.85rem;
    background: var(--bs-warning-bg-subtle);
    border-bottom: 1px solid var(--bs-warning-border-subtle);
}

.pdf-hit-page {
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.4;
    min-width: 1.8rem;
    padding: 0 0.45rem;
}

.pdf-hit-page:hover {
    border-color: var(--bs-primary);
}

.pdf-hit-page.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

/* ---------- Ô ngày dd/MM/yyyy (date-input.js) ---------- */
.vn-date {
    position: relative;
}

.vn-date > input[type="text"] {
    padding-right: 2.4rem;
}

.vn-date-btn {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    z-index: 2;
}

.vn-date-btn:hover:not(:disabled) { color: var(--bs-primary); }

/* Ô date gốc: vẫn nằm đúng chỗ để lịch của trình duyệt bật ra ngay dưới ô, nhưng không nhìn thấy/bấm được. */
.vn-date > .vn-date-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

/* ---------- Nhân sự tổ dân phố ---------- */
.staff-avatar {
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bs-tertiary-bg);
}

.staff-avatar-md { width: 3.25rem; height: 3.25rem; font-size: 1.15rem; }
.staff-avatar-xl { width: 8rem; height: 8rem; font-size: 2.75rem; }

.staff-section { margin-bottom: 1.5rem; }

.staff-section-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.staff-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.staff-section-title > .bi { color: var(--bs-primary); }

.staff-section-count {
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
}

.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
    gap: 0.75rem;
}

.staff-card {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.staff-card:hover {
    border-color: var(--bs-primary-border-subtle);
    box-shadow: 0 4px 14px -6px rgba(16, 24, 40, 0.18);
}

.staff-card.is-inactive { opacity: 0.7; }

/* Cả thẻ bấm được để xem chi tiết; số điện thoại nằm trên lớp này để bấm gọi. */
.staff-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.staff-card-body { min-width: 0; flex: 1 1 auto; }

.staff-card-name {
    font-weight: 600;
    line-height: 1.35;
}

.staff-card-title {
    font-size: 0.8rem;
    color: var(--bs-primary-text-emphasis);
    font-weight: 500;
}

.staff-card-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.staff-card-phone {
    position: relative;
    z-index: 2;
    width: fit-content;
    color: var(--bs-body-color);
    text-decoration: none;
}

.staff-card-phone:hover { color: var(--bs-link-color); }

/* Trang chi tiết */
.staff-profile .card-body { padding-top: 1.75rem; }

.staff-profile-name {
    margin-top: 0.85rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.staff-profile-titles {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.staff-profile-titles strong { color: var(--bs-primary-text-emphasis); font-weight: 600; }

.staff-contact {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--bs-border-color-translucent);
}

.staff-contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--bs-body-color);
    text-decoration: none;
}

.staff-contact-item + .staff-contact-item { border-top: 1px solid var(--bs-border-color-translucent); }
.staff-contact-item:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }

.staff-contact-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.6rem;
}

.staff-contact-label {
    display: block;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

/* Form */
.staff-photo-picker { display: inline-block; }

.staff-photo-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    border: 2px dashed var(--bs-border-color);
}

.staff-photo-empty[hidden] { display: none; }

.staff-positions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.staff-position-head,
.staff-position-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 2.25rem;
    gap: 0.5rem;
    align-items: center;
}

.staff-position-head {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

@media (max-width: 767.98px) {
    .staff-position-row {
        grid-template-columns: 1fr 1fr;
        padding: 0.75rem;
        border: 1px solid var(--bs-border-color-translucent);
        border-radius: var(--bs-border-radius);
    }

    .staff-position-row > select,
    .staff-position-row > [data-position-title] { grid-column: span 2; }
    .staff-position-row > [data-position-remove] { grid-column: span 2; justify-self: end; }
}

/* ---------- Danh sách văn bản: loại + số hiệu nổi bật ---------- */
.table-documents .cell-title { min-width: 18rem; }

.doc-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.doc-type {
    --tone: #475569;
    --tone-bg: #f1f5f9;
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--tone);
    background: var(--tone-bg);
    border-radius: 0.35rem;
    white-space: nowrap;
}

.doc-type-qd  { --tone: #b91c1c; --tone-bg: #fee2e2; }
.doc-type-cv  { --tone: #1d4ed8; --tone-bg: #dbeafe; }
.doc-type-tb  { --tone: #0e7490; --tone-bg: #cffafe; }
.doc-type-kh  { --tone: #047857; --tone-bg: #d1fae5; }
.doc-type-bc  { --tone: #b45309; --tone-bg: #fef3c7; }
.doc-type-gm  { --tone: #be185d; --tone-bg: #fce7f3; }
.doc-type-ttr { --tone: #6d28d9; --tone-bg: #ede9fe; }
.doc-type-bb  { --tone: #334155; --tone-bg: #e2e8f0; }
.doc-type-hd  { --tone: #92400e; --tone-bg: #ffedd5; }

[data-bs-theme="dark"] .doc-type       { --tone: #cbd5e1; --tone-bg: rgba(148, 163, 184, 0.16); }
[data-bs-theme="dark"] .doc-type-qd    { --tone: #fca5a5; --tone-bg: rgba(239, 68, 68, 0.18); }
[data-bs-theme="dark"] .doc-type-cv    { --tone: #93c5fd; --tone-bg: rgba(59, 130, 246, 0.18); }
[data-bs-theme="dark"] .doc-type-tb    { --tone: #67e8f9; --tone-bg: rgba(6, 182, 212, 0.18); }
[data-bs-theme="dark"] .doc-type-kh    { --tone: #6ee7b7; --tone-bg: rgba(16, 185, 129, 0.18); }
[data-bs-theme="dark"] .doc-type-bc    { --tone: #fcd34d; --tone-bg: rgba(245, 158, 11, 0.18); }
[data-bs-theme="dark"] .doc-type-gm    { --tone: #f9a8d4; --tone-bg: rgba(236, 72, 153, 0.18); }
[data-bs-theme="dark"] .doc-type-ttr   { --tone: #c4b5fd; --tone-bg: rgba(139, 92, 246, 0.18); }
[data-bs-theme="dark"] .doc-type-hd    { --tone: #fdba74; --tone-bg: rgba(249, 115, 22, 0.18); }

.doc-no {
    font-size: 0.84rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    color: var(--bs-body-color);
    white-space: nowrap;
}

.doc-no.is-missing {
    font-weight: 400;
    font-style: italic;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}

.doc-head-date { font-size: 0.78rem; color: var(--bs-secondary-color); }

.table-documents .doc-title {
    font-weight: 500;
    line-height: 1.45;
    color: var(--bs-body-color);
}

.table-documents .doc-title:hover { color: var(--bs-link-color); }
.table-documents .doc-date { font-variant-numeric: tabular-nums; }
.doc-meta-org { max-width: 16rem; }

.doc-confirmed { color: var(--bs-success); font-size: 1rem; opacity: 0.75; }

/* ---------- Ô chọn nhiều dạng chip ---------- */
.chip-select {
    position: relative;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.2rem 0.4rem;
    cursor: text;
}

.chip-select:focus-within {
    border-color: var(--bs-primary-border-subtle);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.chip-select-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.chip-select .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem 0.15rem 0.1rem 0.55rem;
    font-size: 0.8rem;
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    border-radius: 999px;
}

.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    line-height: 1;
}

.chip-remove:hover { background: rgba(var(--bs-primary-rgb), 0.15); }

.chip-select-input {
    flex: 1 1 6rem;
    min-width: 6rem;
    padding: 0.15rem 0.2rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 0.875rem;
}

.chip-select-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 16rem;
    overflow-y: auto;
    z-index: 30;
}

/* ---------- Chi tiết văn bản ---------- */
.doc-detail-head {
    margin: -0.25rem 0 1rem;
}

.doc-detail-head .doc-head { margin-bottom: 0.35rem; }

.doc-detail-meta {
    display: inline-flex;
    align-items: center;
    max-width: 28rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.doc-detail-sep { color: var(--bs-secondary-color); opacity: 0.6; }

.doc-detail-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tab ở cột phải: dính trên cùng khi cuộn trong khung thông tin. */
.doc-tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    margin-bottom: 0.75rem;
    background: var(--app-page-bg);
    border-bottom-color: var(--bs-border-color);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.doc-tabs .nav-link {
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bs-secondary-color);
    padding: 0.5rem 0.8rem;
}

.doc-tabs .nav-link.active {
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
}

.ai-keypoints-more { margin-top: 0.3rem; }

.ai-keypoints-more > summary {
    width: fit-content;
    margin: 0.1rem 0 0.3rem 1.2rem;
    font-size: 0.8rem;
    color: var(--bs-link-color);
    cursor: pointer;
}

@media (max-width: 991.98px) {
    .doc-detail-title { font-size: 1.05rem; -webkit-line-clamp: 3; }
    .doc-tabs { position: static; }
}

/* Đoạn nguồn của điểm then chốt (tóm tắt AI) trên PDF */
.pdf-hl.pdf-hl-passage {
    background: rgba(59, 130, 246, 0.22);
    outline: none;
    border-radius: 2px;
}

/* Trang soạn báo cáo: bố cục mô phỏng văn bản giấy */
.report-sheet .card-body {
    font-family: "Times New Roman", "Tinos", serif;
    font-size: 0.95rem;
    padding: 2rem 2.25rem;
}

.report-sheet .form-control { font-family: inherit; }

.report-head {
    display: grid;
    grid-template-columns: 42fr 58fr;
    gap: 1rem;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.4;
}

.report-rule {
    width: 30%;
    margin: 0.2rem auto 0.5rem;
    border-top: 1px solid currentColor;
}

.report-rule.wide { width: 62%; }

.report-field-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.report-field-inline .form-control { max-width: 12rem; }

.report-subject {
    margin: 0.25rem auto 0;
    max-width: 34rem;
    text-align: center;
    font-weight: 700;
    resize: vertical;
}

.report-body { line-height: 1.6; }

.report-actions { position: sticky; top: 1rem; }

@media (max-width: 767.98px) {
    .report-sheet .card-body { padding: 1rem; }
    .report-head { grid-template-columns: 1fr; }
}

/* ---------- Soạn văn bản ---------- */
.draft-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
}

.draft-template {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
    color: var(--bs-body-color);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.draft-template:hover { border-color: var(--bs-primary-border-subtle); transform: translateY(-1px); color: var(--bs-body-color); }

.draft-template-icon {
    width: 2.1rem;
    height: 2.1rem;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

/* ---------- Văn bản đến cần giao việc ---------- */
.doc-action {
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--bs-warning-border-subtle);
    border-left: 4px solid var(--bs-warning);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-warning-bg-subtle);
}

.doc-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--bs-warning-text-emphasis);
    background: var(--bs-body-bg);
}

/* ---------- Lịch công tác ---------- */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    border-top: 1px solid var(--bs-border-color-translucent);
}

.cal-head {
    padding: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.cal-day {
    min-height: 7.2rem;
    padding: 0.3rem;
    border-right: 1px solid var(--bs-border-color-translucent);
    border-bottom: 1px solid var(--bs-border-color-translucent);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-other { background: var(--bs-tertiary-bg); }
.cal-day.is-other .cal-day-num { opacity: 0.45; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--bs-primary); }
.cal-day.is-sunday .cal-day-num { color: var(--bs-danger); }

.cal-day-head { display: flex; align-items: center; }
.cal-day-num { font-size: 0.8rem; font-weight: 600; margin-right: auto; }
.cal-day.is-today .cal-day-num { color: var(--bs-primary); }

.cal-add {
    opacity: 0;
    color: var(--bs-secondary-color);
    line-height: 1;
    text-decoration: none;
}

.cal-day:hover .cal-add { opacity: 1; }

.cal-item {
    display: block;
    padding: 1px 5px;
    font-size: 0.72rem;
    line-height: 1.35;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
    border-left: 3px solid var(--cal, var(--bs-secondary-color));
}

.cal-item:hover { filter: brightness(0.96); color: var(--bs-body-color); }
.cal-item.is-overdue { color: var(--bs-danger); font-weight: 600; }
.cal-time { font-weight: 600; margin-right: 2px; }
.cal-more { font-size: 0.7rem; color: var(--bs-secondary-color); padding-left: 4px; }

.src-meeting { --cal: #2563eb; }
.src-event { --cal: #059669; }
.src-task { --cal: #d97706; }
.src-document { --cal: #dc2626; }
.src-holiday { --cal: #db2777; }

.cal-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--cal);
}

.cal-legend { align-items: center; gap: 0.35rem 0.6rem; font-size: 0.75rem; color: var(--bs-secondary-color); flex-wrap: wrap; }
.cal-legend .cal-dot { margin-left: 0.4rem; }

.cal-agenda-date { font-size: 0.75rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: 0.3rem; text-transform: capitalize; }

.cal-agenda-item {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.15rem 0;
    font-size: 0.85rem;
    color: var(--bs-body-color);
    text-decoration: none;
}

.cal-agenda-item:hover { color: var(--bs-link-color); }

@media (max-width: 767.98px) {
    .cal-day { min-height: 4.2rem; }
    .cal-item { font-size: 0; padding: 0; height: 6px; border-left-width: 0; background: var(--cal); }
    .cal-time { display: none; }
}

/* ---------- Danh sách đối tượng ---------- */
.target-group-title { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.6rem; }

.target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.6rem;
}

.target-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
    color: var(--bs-body-color);
    text-decoration: none;
}

.target-card:hover { border-color: var(--bs-primary-border-subtle); color: var(--bs-body-color); }
.target-card.is-empty { opacity: 0.6; }

.target-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    border-radius: 0.6rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.target-count { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Hỏi đáp AI ---------- */
.ask-answer .card-body p { margin-bottom: 0.5rem; line-height: 1.6; }
.ask-answer .card-body p:last-child { margin-bottom: 0; }
.ask-answer .ask-item { padding-left: 1rem; text-indent: -0.75rem; }
.ask-cite {
    display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem;
    margin: 0 0.1rem; border-radius: 0.6rem; font-size: 0.7rem; font-weight: 600; vertical-align: super; line-height: 1;
    background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); text-decoration: none; text-indent: 0;
}
a.ask-cite:hover { background: var(--bs-primary); color: #fff; }
.ask-cite-lg { min-width: 1.6rem; height: 1.6rem; font-size: 0.8rem; vertical-align: baseline; flex-shrink: 0; border-radius: 0.8rem; }
.ask-source-unused { opacity: 0.6; }
.ask-example { text-align: left; white-space: normal; }

/* ---------- Họp dân, hội nghị ---------- */
.meeting-date { min-width: 3.5rem; border-right: 1px solid var(--bs-border-color); padding-right: 0.75rem; }
.meeting-day { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--bs-primary); }
.meeting-filter { max-width: 14rem; }
.attendance-list .list-group-item { padding-block: 0.6rem; }
.attendance-list label { cursor: pointer; }
.attendance-check { width: 1.4rem; height: 1.4rem; flex-shrink: 0; margin-top: 0; }

/* ---------- Đợt thu quỹ ---------- */
.campaign-card { transition: border-color 0.15s; }
.campaign-card:hover { border-color: var(--bs-primary-border-subtle); }
.campaign-card.is-closed { opacity: 0.75; }
.campaign-row.state-paid td:first-child { box-shadow: inset 3px 0 0 var(--bs-success); }
.campaign-row.state-partial td:first-child { box-shadow: inset 3px 0 0 var(--bs-warning); }
.campaign-row:target { background: var(--bs-primary-bg-subtle); }

/* ---------- Công việc ---------- */
.task-people-names { display: inline-flex; align-items: center; gap: 0.5rem; max-width: 16rem; min-width: 0; }
.task-people-names .min-w-0 { min-width: 0; }

.staff-avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.7rem; }

.task-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.task-alert {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 999px;
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    text-decoration: none;
}

.task-alert.is-overdue { color: var(--bs-danger-text-emphasis); background: var(--bs-danger-bg-subtle); }
.task-alert.is-soon { color: var(--bs-warning-text-emphasis); background: var(--bs-warning-bg-subtle); }
.task-alert:hover { filter: brightness(0.96); }

.task-dash {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
}

.task-dash-label { font-weight: 600; margin-right: 0.25rem; }

/* Kanban */
.task-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.task-column {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    padding: 0.6rem;
    min-height: 12rem;
}

.task-column-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0.3rem 0.6rem;
    font-weight: 600;
}

.task-column-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--bs-secondary-color); }
.task-column-dot.status-inprogress { background: var(--bs-primary); }
.task-column-dot.status-done { background: var(--bs-success); }

.task-column-count {
    padding: 0 0.45rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    border-radius: 999px;
}

.task-column-hint { margin-left: auto; font-size: 0.72rem; font-weight: 400; color: var(--bs-secondary-color); }

.task-column-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 6rem;
    border-radius: var(--bs-border-radius);
    transition: background 0.15s;
}

.task-column-body.is-drop-target { background: var(--bs-primary-bg-subtle); outline: 2px dashed var(--bs-primary-border-subtle); }

.task-column-empty {
    display: none;
    padding: 1.25rem 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.task-column-body > .task-column-empty:only-child { display: block; }

.task-card {
    padding: 0.65rem 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-left: 3px solid transparent;
    border-radius: var(--bs-border-radius);
    box-shadow: var(--app-card-shadow);
}

.task-card[draggable="true"] { cursor: grab; }
.task-card.is-dragging { opacity: 0.5; }
.task-card.is-overdue { border-left-color: var(--bs-danger); }
.task-card.is-soon { border-left-color: var(--bs-warning); }
.task-card.is-done .task-card-title { color: var(--bs-secondary-color); }

.task-card-title {
    display: block;
    font-weight: 500;
    line-height: 1.4;
    color: var(--bs-body-color);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.task-card-title:hover { color: var(--bs-link-color); }

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.task-card-meta .bi { margin-right: 0.2rem; }
.task-card.is-overdue .task-due { color: var(--bs-danger); font-weight: 600; }
.task-card.is-soon .task-due { color: var(--bs-warning-text-emphasis); font-weight: 600; }
.task-due.is-done { color: var(--bs-success); }

.task-progress { height: 0.3rem; margin-top: 0.45rem; }

.task-card-list { display: flex; flex-direction: column; gap: 0.5rem; }

.task-people { display: inline-flex; align-items: center; }

.task-person {
    display: inline-flex;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--bs-body-bg);
}

.task-person + .task-person { margin-left: -0.4rem; }
.task-person.is-lead { box-shadow: 0 0 0 2px var(--bs-primary); position: relative; z-index: 1; }

.task-person-more {
    width: 1.75rem;
    height: 1.75rem;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

.task-unassigned { font-size: 0.75rem; font-style: italic; color: var(--bs-secondary-color); }
.task-row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--bs-danger); }

@media (max-width: 991.98px) {
    .task-board { grid-template-columns: 1fr; }
    .task-column { min-height: 0; }
}

/* Chi tiết */
.task-text { white-space: pre-line; }

.task-timeline { list-style: none; margin: 0; padding: 0.75rem 1.25rem; }

.task-timeline-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.55rem 0;
    position: relative;
}

.task-timeline-item + .task-timeline-item::before {
    content: "";
    position: absolute;
    left: 0.85rem;
    top: -0.3rem;
    height: 0.8rem;
    border-left: 1px dashed var(--bs-border-color);
}

.task-timeline-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
}

.task-timeline-item.is-commented .task-timeline-icon { color: var(--bs-primary); background: var(--bs-primary-bg-subtle); }
.task-timeline-item.is-statuschanged .task-timeline-icon { color: var(--bs-success); background: var(--bs-success-bg-subtle); }

.task-comment {
    margin-top: 0.25rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    white-space: pre-line;
    background: var(--bs-tertiary-bg);
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) var(--bs-border-radius);
}

/* Form */
.task-doc-list { display: flex; flex-direction: column; gap: 0.4rem; }

.task-doc {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
}

.task-doc > .bi { color: var(--bs-primary); }

.task-doc-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 20;
    max-height: 18rem;
    overflow-y: auto;
}

.task-staff-picker {
    max-height: 22rem;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.task-staff-option {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
}

.task-staff-option + .task-staff-option { border-top: 1px solid var(--bs-border-color-translucent); }
.task-staff-option:hover { background: var(--bs-tertiary-bg); }
.task-staff-option .form-check-input { margin-top: 0.2rem; flex: 0 0 auto; }
.task-staff-option.is-lead { opacity: 0.5; cursor: default; }

.task-flash {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    max-width: 22rem;
}

/* ---------- Thu chi ---------- */
.finance-value { font-variant-numeric: tabular-nums; }
.finance-table td, .finance-table th { font-variant-numeric: tabular-nums; }
.finance-row { cursor: pointer; }
.finance-opening td { background: var(--bs-tertiary-bg); font-style: italic; color: var(--bs-secondary-color); }
.finance-table tfoot td { background: var(--bs-tertiary-bg); }
.finance-periods { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.search-chip.active {
    color: #fff;
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}
.finance-amount { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.finance-form.is-income { border-top: 3px solid var(--bs-success); }
.finance-form.is-expense { border-top: 3px solid var(--bs-danger); }
.finance-form .stat-icon { width: 2rem; height: 2rem; font-size: 0.95rem; }
.finance-bar + .finance-bar { margin-top: 0.75rem; }
.finance-bar .progress { height: 0.4rem; margin-top: 0.25rem; }

/* ---------- Tìm trong nội dung ---------- */
.search-page {
    max-width: 60rem;
    margin: 0 auto;
}

/* Ô tìm dạng viên thuốc, dùng chung cho trang trống và trang kết quả */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.4rem 0.4rem 1.1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px -8px rgba(16, 24, 40, 0.12);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.12), 0 6px 20px -8px rgba(16, 24, 40, 0.15);
}

.search-box-icon {
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
}

.search-box-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--bs-body-color);
    font-size: 1.05rem;
    padding: 0.45rem 0;
}

.search-box-input::placeholder { color: var(--bs-secondary-color); opacity: 0.8; }
.search-box-input::-webkit-search-cancel-button { cursor: pointer; }

.search-box-kbd {
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.35rem;
    box-shadow: none;
}

.search-box:focus-within .search-box-kbd { display: none !important; }

.search-box-btn {
    border-radius: 999px;
    padding: 0.55rem 1.4rem;
    font-weight: 500;
}

/* Trang trống */
.search-hero {
    text-align: center;
    padding: 3.5rem 1rem 2rem;
}

.search-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    font-size: 1.6rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    box-shadow: inset 0 0 0 1px var(--bs-primary-border-subtle);
}

.search-hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.search-hero-sub {
    color: var(--bs-secondary-color);
    margin-bottom: 1.75rem;
}

.search-hero-sub strong { color: var(--bs-body-color); font-weight: 600; }

.search-hero .search-box {
    max-width: 44rem;
    margin: 0 auto;
}

.search-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
}

.search-chips[hidden] { display: none; }
.search-chips-list { display: contents; }

.search-chips-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    margin-right: 0.15rem;
}

.search-chip {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    text-decoration: none;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-chip:hover {
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary-border-subtle);
}

.search-pending {
    display: inline-flex;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    color: #0e7490;
    background: #ecfeff;
    border-radius: 999px;
}

[data-bs-theme="dark"] .search-pending { color: #67e8f9; background: #0c3440; }

.search-tips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding-bottom: 2rem;
}

.search-tip {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
}

.search-tip-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    font-size: 1rem;
}

.search-tip-title { font-weight: 600; margin-bottom: 0.15rem; }
.search-tip-text { font-size: 0.8rem; color: var(--bs-secondary-color); line-height: 1.5; }
.search-tip-text code { font-family: inherit; font-size: 0.8rem; font-weight: 500; }

@media (max-width: 767.98px) {
    .search-hero { padding-top: 1.5rem; }
    .search-hero-title { font-size: 1.4rem; }
    .search-tips { grid-template-columns: 1fr; }
}

/* Trang kết quả */
.search-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.25rem 0 0.75rem;
    background: var(--app-page-bg);
}

.search-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
    color: var(--bs-secondary-color);
}

.search-summary strong { color: var(--bs-body-color); }

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-result {
    padding: 1rem 1.1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius-lg);
    box-shadow: var(--app-card-shadow);
    transition: border-color 0.15s;
}

.search-result:hover { border-color: var(--bs-primary-border-subtle); }

.search-result-head {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.search-result-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.search-result-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--bs-body-color);
    text-decoration: none;
}

.search-result-title:hover {
    color: var(--bs-link-color);
    text-decoration: underline;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}

.search-result-meta > span + span::before {
    content: "·";
    margin: 0 0.4rem;
    opacity: 0.7;
}

.search-result-count {
    flex: 0 0 auto;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    border-radius: 999px;
    white-space: nowrap;
}

.search-hits {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.75rem 0 0 3rem;
}

.search-hit {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    border-left: 3px solid var(--bs-primary-border-subtle);
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: 0.85rem;
    line-height: 1.55;
    text-decoration: none;
}

.search-hit:hover {
    border-left-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-body-color);
}

.search-hit-page {
    flex: 0 0 auto;
    min-width: 2.6rem;
    padding-top: 0.1rem;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--bs-primary-text-emphasis);
}

.search-hit-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.search-hit-go {
    flex: 0 0 auto;
    padding-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--bs-primary);
    opacity: 0;
    transition: opacity 0.15s;
}

.search-hit:hover .search-hit-go { opacity: 1; }

.search-more > summary {
    width: fit-content;
    font-size: 0.8rem;
    color: var(--bs-link-color);
    cursor: pointer;
}

.search-more > .search-hits { margin: 0.4rem 0 0; }

.search-other-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.search-page-link {
    min-width: 1.9rem;
    padding: 0.1rem 0.45rem;
    text-align: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.4rem;
    color: var(--bs-body-color);
    text-decoration: none;
}

.search-page-link:hover {
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    border-color: var(--bs-primary-border-subtle);
}

.search-noresult-tips {
    display: inline-block;
    margin: 0.75rem 0 0;
    padding-left: 1.1rem;
    text-align: left;
    font-size: 0.8rem;
}

.search-hit mark,
.search-summary mark,
.search-results mark {
    padding: 0 0.1em;
    border-radius: 0.2em;
    background: rgba(250, 204, 21, 0.5);
    color: inherit;
}

@media (max-width: 575.98px) {
    .search-hits { margin-left: 0; }
    .search-hit { flex-direction: column; gap: 0.15rem; }
    .search-hit-go { display: none; }
    .search-box-btn { padding: 0.55rem 0.9rem; }
}

/* ---------- Tóm tắt AI ---------- */
.ai-summary-card {
    border-color: var(--bs-primary-border-subtle);
}

.ai-summary-card > .card-header {
    background: var(--bs-primary-bg-subtle);
}

.ai-summary-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-keypoints-title {
    margin: 0.85rem 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
}

.ai-keypoints {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.85rem;
    line-height: 1.55;
}

.ai-keypoints li + li {
    margin-top: 0.3rem;
}

.ai-page-link {
    border: 0;
    border-radius: 999px;
    padding: 0 0.45rem;
    margin-left: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bs-primary-text-emphasis);
    background: var(--bs-primary-bg-subtle);
    white-space: nowrap;
}

.ai-page-link:hover {
    background: var(--bs-primary);
    color: #fff;
}

.summary-spinner {
    width: 0.6rem;
    height: 0.6rem;
    border-width: 0.12em;
    vertical-align: -0.05em;
}

.ai-progress-bar {
    height: 0.35rem;
}

/* Thanh hàng đợi xử lý / tóm tắt trên danh sách văn bản */
.queue-banner {
    padding: 0.5rem 1.25rem;
    background: var(--bs-info-bg-subtle);
    border-bottom: 1px solid var(--bs-info-border-subtle);
    font-size: 0.8125rem;
}

.queue-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.queue-line + .queue-line {
    margin-top: 0.25rem;
}

.queue-line .summary-spinner {
    margin-right: 0.35rem !important;
}

.queue-doc {
    font-weight: 500;
    max-width: 36rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-progress {
    flex: 0 0 8rem;
    height: 0.35rem;
    margin-left: 0.5rem;
}

.btn-close-sm {
    width: 0.6rem;
    height: 0.6rem;
    background-size: 0.6rem;
}

/* ---------- Review / AI ---------- */
.ai-suggestion {
    border-left: 3px solid var(--bs-success);
    background: var(--bs-success-bg-subtle);
    border-radius: .375rem;
    padding: .35rem .6rem;
    font-size: .8125rem;
}

.ai-badge {
    font-size: .68rem;
    letter-spacing: .02em;
}

.content-preview {
    white-space: pre-wrap;
    font-size: .8125rem;
    max-height: 360px;
    overflow-y: auto;
}

.chart-box {
    position: relative;
    height: 280px;
}

.json-values {
    font-family: var(--bs-font-monospace);
    font-size: .72rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 420px;
}

/* ---------- Đăng nhập ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--bs-body-bg);
}

.auth-brand {
    background: radial-gradient(1200px 600px at 10% 10%, #3b6cf0 0%, #1d4ed8 45%, #172f8a 100%);
    color: #fff;
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

.auth-brand .feature {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1.1rem;
    color: rgba(255, 255, 255, .85);
}

.auth-brand .feature .bi {
    font-size: 1.2rem;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border-radius: .5rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.auth-brand .feature strong {
    color: #fff;
    display: block;
}

.auth-brand .brand-mark {
    background: rgba(255, 255, 255, .18);
}

.auth-body {
    background: var(--bs-body-bg);
}

.auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-form .form-box {
    width: 100%;
    max-width: 380px;
}

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

/* ---------- Upload nhiều file ---------- */
.upload-drop {
    border: 2px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-tertiary-bg);
    transition: border-color .15s, background .15s;
}

.upload-drop.drag-over {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}

.upload-drop {
    cursor: pointer;
}

.upload-drop .stat-icon {
    display: flex;
}

.form-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}

.upload-result-list {
    max-height: 360px;
    overflow-y: auto;
}

/* ---------- Điện thoại ---------- */
@media (max-width: 767.98px) {
    .pdf-canvas-wrapper { padding: 4px; }
    .pdf-viewer-card .card-header { padding-left: .5rem; padding-right: .5rem; }
    .pdf-page-input { width: 84px; }
    .page-title { font-size: 1.25rem; }
    .app-content-header .container-fluid,
    .app-content .container-fluid { padding-left: .75rem; padding-right: .75rem; }
    .table .cell-title { min-width: 0; }
    .stat-card { padding: .75rem; gap: .6rem; }
    .stat-icon { width: 2.25rem; height: 2.25rem; font-size: 1rem; }
    .stat-value { font-size: 1.25rem; }
    .info-list .info-row { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ---------- Hướng dẫn sử dụng ---------- */
.guide-sign { display: inline-block; font-family: "Times New Roman", Tinos, serif; font-size: 1rem; line-height: 1.5; padding: 0.75rem 1.5rem; border: 1px dashed var(--bs-border-color); border-radius: 0.5rem; background: var(--bs-tertiary-bg); color: var(--bs-body-color); font-weight: 700; white-space: pre; }
.guide-toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 4.5rem); }
.guide-toc-title { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: 0.5rem; }
.guide-toc .nav-link { padding: 0.35rem 0.75rem; border-radius: 0.5rem; color: var(--bs-body-color); font-size: 0.875rem; }
.guide-toc .nav-link:hover { background: var(--bs-tertiary-bg); }
.guide-toc .nav-link.active { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-weight: 600; }
.guide-section { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 0.75rem; padding: 1.5rem; margin-bottom: 1.5rem; scroll-margin-top: 5rem; }
.guide-section h2 { font-size: 1.35rem; font-weight: 700; display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.guide-section h2 .bi { color: var(--bs-primary); }
.guide-section h3 { font-size: 1.05rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.guide-section p, .guide-section li { line-height: 1.65; }
.guide-section li { margin-bottom: 0.3rem; }
.guide-shot { margin: 1rem 0 0.5rem; }
.guide-shot img { width: 100%; height: auto; border-radius: 0.5rem; border: 1px solid var(--bs-border-color); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06); cursor: zoom-in; }
.guide-shot figcaption { font-size: 0.8rem; color: var(--bs-secondary-color); text-align: center; margin-top: 0.4rem; }
.guide-shot-missing { display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 8rem; border: 1px dashed var(--bs-border-color); border-radius: 0.5rem; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); }
@media (max-width: 575.98px) { .guide-section { padding: 1rem; } }

/* ---------- Tài sản, kiểm kê ---------- */
.inventory-table tr.inventory-diff td:first-child { box-shadow: inset 3px 0 0 var(--bs-danger); }
.inventory-table input[type=number] { min-width: 5rem; }

/* ---------- Chụp văn bản giấy ---------- */
.photo-capture { border: 1px dashed var(--bs-border-color); border-radius: 0.75rem; padding: 0.9rem 1rem; background: var(--bs-tertiary-bg); }
.photo-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: 0.75rem; }
.photo-page { position: relative; border-radius: 0.5rem; overflow: hidden; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); }
.photo-page img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.photo-page-no { position: absolute; top: 0.3rem; left: 0.3rem; font-size: 0.7rem; font-weight: 600; padding: 0.1rem 0.4rem; border-radius: 0.4rem; background: rgba(0, 0, 0, 0.6); color: #fff; }
.photo-page-tools { display: flex; justify-content: space-between; padding: 0.25rem; gap: 0.25rem; }
.photo-page-tools .btn { padding: 0.1rem 0.4rem; }

/* ---------- Bình xét Gia đình văn hóa ---------- */
.culture-table .culture-score { width: 4.2rem; text-align: right; }
.culture-table th { white-space: nowrap; font-size: 0.75rem; }
.culture-penalties { min-width: 11rem; }
.culture-penalty { display: inline-flex; align-items: center; gap: 0.2rem; margin-right: 0.45rem; font-size: 0.75rem; cursor: pointer; white-space: nowrap; }
.culture-penalty .form-check-input { margin-top: 0; }
.culture-sheet td { font-size: 0.875rem; }
.culture-sheet .culture-sheet-section td { font-weight: 600; background: var(--bs-tertiary-bg); }
.culture-sheet .culture-sheet-parent td { font-weight: 500; }
.culture-sheet input[type=number] { max-width: 6rem; margin-left: auto; }
.culture-sheet input.is-lost { border-color: var(--bs-danger); color: var(--bs-danger); font-weight: 600; }
.culture-sheet-total { position: sticky; top: 0; }

/* ---------- Logo tổ dân phố ---------- */
.brand-logo { width: 2.25rem; height: 2.25rem; border-radius: 50%; flex-shrink: 0; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.auth-logo { width: 5.5rem; height: 5.5rem; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 18px rgba(0, 0, 0, .25); background: #fff; }
.auth-logo-sm { width: 6rem; height: 6rem; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.auth-logo-form { width: 7rem; height: 7rem; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.staff-avatar-logo { object-fit: cover; background: #fff; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1.5rem; }
.auth-features .feature { margin-bottom: 0.75rem; }
@media (max-width: 1199.98px) { .auth-features { grid-template-columns: 1fr; } }
/* Tổng hợp lỗi của form: ẩn khi chưa có lỗi. */
.validation-summary-valid { display: none !important; }
/* Nhập từ ảnh VNeID: ảnh xem trước */
.vneid-thumbs { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.vneid-thumbs:empty { display: none; }
.vneid-thumb { margin: 0; width: 6.5rem; text-align: center; }
.vneid-thumb img { width: 6.5rem; height: 11rem; object-fit: cover; object-position: top; border-radius: 0.5rem; border: 1px solid var(--bs-border-color); }
.vneid-thumb figcaption { font-size: 0.75rem; color: var(--bs-secondary-color); }

/* ---------- Cổng thông tin công khai ---------- */
.portal { margin: 0; background: #fafbf8; color: #243a35; font: 15px/1.65 "Be Vietnam Pro", sans-serif; }
.portal *, .portal *::before, .portal *::after { box-sizing: border-box; }
.portal a { color: inherit; text-decoration: none; }
.portal a:hover { text-decoration: underline; }
.portal a:focus-visible, .portal button:focus-visible, .portal input:focus-visible, .portal select:focus-visible { outline: 3px solid #b67826; outline-offset: 3px; }
.portal h1, .portal h2, .portal h3 { line-height: 1.35; letter-spacing: -.025em; margin: 0 0 16px; color: #123f37; }
.portal h1 { font-size: clamp(28px, 3.6vw, 44px); }
.portal h2 { font-size: 25px; }
.portal h3 { font-size: 19px; }
.portal p { margin: 0 0 14px; }
.portal img { max-width: 100%; display: block; }
.portal input, .portal select { font: inherit; min-width: 0; border: 1px solid #ccd6cd; border-radius: 7px; background: white; padding: 10px 14px; min-height: 46px; color: #243a35; }
.portal button { font: inherit; min-height: 46px; border: 0; border-radius: 7px; padding: 10px 22px; background: #123f37; color: white; cursor: pointer; }
.portal [hidden] { display: none !important; }
.portal-container { max-width: 1200px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
.portal-topline { background: #123f37; color: #f1f4ed; font-size: 11px; letter-spacing: .1em; padding: 9px 0; }
.portal-topline .portal-container { display: flex; justify-content: space-between; gap: 20px; }
.portal-topline span { letter-spacing: 0; }
.portal-header { padding-top: 25px; padding-bottom: 25px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.portal-brand { display: flex; gap: 15px; align-items: center; flex-shrink: 0; }
.portal-brand strong { display: block; font-size: 23px; line-height: 1.4; color: #123f37; }
.portal-brand small { font-size: 10px; letter-spacing: .14em; color: #73847a; }
.portal-brand-mark { display: flex; align-items: center; justify-content: center; gap: 1px; width: 58px; height: 58px; border-radius: 50%; border: 1px solid #b6c8b8; background: #eef3e8; font-size: 20px; font-weight: 700; color: #123f37; }
.portal-brand-mark span { color: #a36e27; font-size: 27px; }
.portal-search { display: flex; max-width: 440px; width: 100%; gap: 8px; }
.portal-search input { flex: 1; width: 100%; font-size: 13px; }
.portal-search button { padding-left: 17px; padding-right: 17px; }
.portal-nav { border-top: 1px solid #dde5dc; border-bottom: 1px solid #dde5dc; background: white; }
.portal-nav .portal-container { display: flex; align-items: stretch; gap: 25px; overflow-x: auto; }
.portal-nav a { display: flex; align-items: center; min-height: 54px; white-space: nowrap; font-size: 13px; font-weight: 700; border-bottom: 3px solid transparent; }
.portal-nav a.active { border-bottom-color: #b67826; color: #123f37; }
.portal-main { padding-top: 32px; padding-bottom: 64px; min-height: 55vh; }
.portal-welcome { display: grid; grid-template-columns: 1.45fr 1fr; gap: 48px; padding: 42px; background: #eaf0e2; border-radius: 14px; border: 1px solid #dce5d3; }
.portal-eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em; margin-bottom: 13px; color: #6a7b57; }
.portal-welcome h1 { margin-bottom: 18px; }
.portal-welcome p { max-width: 520px; color: #5d7065; }
.portal-welcome aside { padding: 25px 28px; background: #fff; border-radius: 10px; border-top: 3px solid #bd8d42; }
.portal-welcome aside h2 { font-size: 23px; }
.portal-welcome-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 23px; }
.portal-welcome-links a { padding: 11px 18px; border: 1px solid #bccaba; border-radius: 6px; min-height: 46px; font-size: 13px; font-weight: 700; }
.portal-welcome-links a:first-child { background: #123f37; color: white; border-color: #123f37; }
.portal-notice-link { display: flex; gap: 15px; padding: 16px 0; border-bottom: 1px solid #e3e9df; font-size: 13px; }
.portal-notice-link:last-child { border-bottom: 0; }
.portal-notice-link time { color: #997024; font-size: 12px; flex: 0 0 48px; }
.portal-section { margin-top: 40px; }
.portal-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 22px; }
.portal-section-heading h2 { margin-bottom: 0; }
.portal-section-heading a { font-size: 12px; font-weight: 700; color: #496d51; }
.portal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.portal-card { min-width: 0; border: 1px solid #e0e6da; border-radius: 10px; overflow: hidden; background: white; }
.portal-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.portal-card-placeholder { aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; background: #e8eee3; color: #608166; }
.portal-card:nth-child(3n+2) .portal-card-placeholder { background: #f1ede1; color: #a1854b; }
.portal-card:nth-child(3n+3) .portal-card-placeholder { background: #e6eef0; color: #637f85; }
.portal-card-placeholder span { padding: 13px 25px; border: 1px solid currentColor; font-size: 16px; font-weight: 700; }
.portal-card-body { padding: 22px; }
.portal-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #78877b; margin-bottom: 12px; }
.portal-meta span { color: #627b48; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.portal-card h3, .portal-card p { overflow-wrap: anywhere; }
.portal-card p { font-size: 13px; color: #6b7970; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.portal-read-more { font-size: 12px; font-weight: 700; color: #496d51 !important; }
.portal-read-more span { margin-left: 10px; }
.portal-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.portal-panel { border: 1px solid #e0e6da; border-radius: 10px; padding: 28px; background: white; }
.portal-panel h2 { font-size: 21px; }
.portal-panel p { font-size: 13px; color: #6b7970; }
.portal-document-link { display: flex; align-items: center; gap: 15px; padding: 16px 0; border-bottom: 1px solid #e3e9df; font-size: 13px; }
.portal-document-link small { display: block; color: #78877b; margin-top: 4px; }
.portal-document-icon { background: #f2eee4; color: #956b27; border-radius: 5px; padding: 13px 8px; font-size: 10px; flex-shrink: 0; }
.portal-community { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 32px; background: #eaf0e2; border-radius: 10px; margin-top: 40px; }
.portal-community p { max-width: 680px; font-size: 13px; margin-bottom: 0; }
.portal-community a { white-space: nowrap; font-size: 13px; font-weight: 700; }
.portal-footer { background: #123f37; color: #e0e9df; padding: 40px 0; font-size: 12px; }
.portal-footer .portal-container { display: flex; justify-content: space-between; gap: 35px; }
.portal-footer strong { font-size: 19px; color: white; display: block; margin-bottom: 10px; }
.portal-footer a { display: block; padding: 6px 0; }
.portal-breadcrumb { font-size: 12px; color: #6b7970; margin-bottom: 25px; }
.portal-page-heading { margin-bottom: 30px; }
.portal-page-heading p { color: #6b7970; font-size: 13px; }
.portal-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 20px; background: #eef2e8; border-radius: 10px; margin-bottom: 28px; }
.portal-filter input { flex: 1; min-width: 160px; }
.portal-filter a { font-size: 12px; padding: 10px; }
.portal-empty { text-align: center; padding: 50px 25px; background: white; border: 1px dashed #ccd6cd; border-radius: 10px; }
.portal-empty h2, .portal-empty h3 { font-size: 21px; }
.portal-empty p { color: #6b7970; font-size: 13px; }
.portal-pagination { display: flex; justify-content: center; gap: 24px; align-items: center; margin-top: 30px; font-size: 13px; }
.portal-pagination a { padding: 10px 15px; border: 1px solid #ccd6cd; border-radius: 6px; min-height: 44px; }
.portal-article { max-width: 950px; margin: 0 auto; background: white; padding: 38px; border: 1px solid #e0e6da; border-radius: 12px; }
.portal-article h1 { font-size: clamp(26px, 3vw, 38px); overflow-wrap: anywhere; }
.portal-source { color: #6b7970; font-size: 13px; }
.portal-date, .portal-phase { background: #eef2e8; padding: 10px 15px; border-radius: 6px; font-size: 13px; }
.portal-article-summary { font-size: 17px; font-weight: 700; color: #496d51; }
.portal-prose { margin-top: 25px; }
.portal-prose p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; margin-bottom: 22px; }
.portal-gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-top: 28px; }
.portal-gallery figure { margin: 0; }
.portal-gallery img { width: 100%; border-radius: 7px; }
.portal-gallery figcaption { color: #6b7970; font-size: 12px; margin-top: 6px; overflow-wrap: anywhere; }
.portal-attachments { margin-top: 35px; padding: 22px; background: #eef2e8; border-radius: 9px; }
.portal-attachments h2 { font-size: 22px; }
.portal-attachments > div { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; padding: 12px 0; font-size: 13px; }
.portal-attachments strong { flex: 1; min-width: 150px; overflow-wrap: anywhere; }
.portal-attachments a { padding: 10px; border: 1px solid #ccd6cd; border-radius: 5px; }
.portal-back { display: inline-block; margin-top: 35px; font-size: 13px; padding: 10px 0; }
.portal-culture { margin-top: 30px; }
.portal-culture > input { display: block; width: 100%; margin: 12px 0 20px; }
.portal-table-wrap { overflow-x: auto; }
.portal-culture table { width: 100%; border-collapse: collapse; font-size: 13px; }
.portal-culture th, .portal-culture td { padding: 12px; border-bottom: 1px solid #e0e6da; text-align: left; }
.portal-culture th { background: #eef2e8; color: #123f37; }
.portal-culture td:first-child { width: 45px; }
.portal-culture td:last-child { width: 155px; }
.portal-org-root { text-align: center; padding: 15px; border: 1px solid #b6c8b8; border-radius: 8px; max-width: 320px; margin: 20px auto 0; background: #eaf0e2; font-weight: 700; }
.portal-org-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; padding-top: 30px; border-top: 1px solid #b6c8b8; margin-top: 25px; }
.portal-org-card { position: relative; padding: 20px; border: 1px solid #dce5d3; border-radius: 8px; }
.portal-org-card::before { content: ""; position: absolute; height: 30px; width: 1px; background: #b6c8b8; left: 50%; top: -31px; }
.portal-org-card h3 { font-size: 18px; }
.portal-org-card ul { list-style: none; margin: 0; padding: 0; }
.portal-org-card li { padding: 8px 0; font-size: 13px; border-top: 1px solid #eef2e8; }
.portal-org-card li span { display: block; color: #6b7970; font-size: 12px; }
.portal-preview { background: #fff3cf; padding: 12px 20px; text-align: center; font-size: 13px; }
.portal-preview a { margin-left: 15px; text-decoration: underline; }
.portal-sr-only, .portal-skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.portal-skip:focus { position: fixed; top: 8px; left: 8px; z-index: 1000; background: white; padding: 12px; }
.portal-admin-rows { max-height: 420px; }
@media (max-width: 960px) {
    .portal-header { flex-wrap: wrap; gap: 20px; }
    .portal-search { max-width: none; }
    .portal-welcome { gap: 25px; padding: 28px; }
    .portal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .portal-topline span { display: none; }
}
@media (max-width: 640px) {
    .portal-container { padding-left: 18px; padding-right: 18px; }
    .portal-header { padding-top: 18px; padding-bottom: 18px; }
    .portal-brand strong { font-size: 19px; }
    .portal-brand-mark { width: 48px; height: 48px; }
    .portal-nav .portal-container { gap: 22px; }
    .portal-welcome, .portal-two-columns, .portal-grid, .portal-gallery, .portal-org-groups { grid-template-columns: 1fr; }
    .portal-welcome { padding: 24px; gap: 20px; }
    .portal-welcome aside { padding: 20px; }
    .portal-main { padding-top: 22px; }
    .portal-section-heading { align-items: flex-start; }
    .portal-section-heading h2 { font-size: 22px; }
    .portal-section-heading a { min-width: 70px; }
    .portal-card-body, .portal-panel { padding: 22px; }
    .portal-community, .portal-footer .portal-container { flex-direction: column; align-items: flex-start; }
    .portal-community { padding: 24px; }
    .portal-article { padding: 22px 18px; }
    .portal-filter { padding: 15px; }
    .portal-filter input { flex-basis: 100%; }
    .portal-culture th, .portal-culture td { padding: 10px 7px; }
    .portal-culture td:last-child { width: 100px; }
}

/* =====================================================================
   NHP.TDP Design System v1 — nền tảng → ngữ nghĩa → component
   ===================================================================== */
:root {
    --tdp-blue-700: #1d4ed8;
    --tdp-blue-800: #1e40af;
    --tdp-blue-900: #1e3a8a;
    --tdp-space-1: .25rem;
    --tdp-space-2: .5rem;
    --tdp-space-3: .75rem;
    --tdp-space-4: 1rem;
    --tdp-space-6: 1.5rem;
    --tdp-space-8: 2rem;
    --tdp-space-12: 3rem;
    --tdp-radius-control: .5rem;
    --tdp-radius-panel: .75rem;
    --tdp-control-height: 2.75rem;
    --tdp-motion-fast: 150ms;
    --tdp-motion-normal: 200ms;
}
:root, [data-bs-theme="light"] {
    --tdp-bg: #f8fafc;
    --tdp-surface: #ffffff;
    --tdp-surface-muted: #f1f5f9;
    --tdp-text: #1e293b;
    --tdp-text-muted: #475569;
    --tdp-border: #e2e8f0;
    --tdp-control-border: #64748b;
    --tdp-action: var(--tdp-blue-700);
    --tdp-action-hover: var(--tdp-blue-800);
    --tdp-link: var(--tdp-blue-700);
    --tdp-focus: var(--tdp-blue-700);
    --tdp-success: #166534;
    --tdp-success-bg: #dcfce7;
    --tdp-warning: #92400e;
    --tdp-warning-bg: #fef3c7;
    --tdp-danger: #b91c1c;
    --tdp-danger-bg: #fee2e2;
    --tdp-info: #075985;
    --tdp-info-bg: #e0f2fe;
    --tdp-shadow-panel: 0 1px 3px rgb(15 23 42 / 6%);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.6;
    --bs-body-color: var(--tdp-text);
    --bs-secondary-color: var(--tdp-text-muted);
    --bs-body-bg: var(--tdp-surface);
    --bs-tertiary-bg: var(--tdp-surface-muted);
    --bs-border-color: var(--tdp-border);
    --bs-link-color: var(--tdp-link);
    --app-page-bg: var(--tdp-bg);
    --app-card-shadow: var(--tdp-shadow-panel);
}
[data-bs-theme="dark"] {
    --tdp-bg: #0f172a;
    --tdp-surface: #1e293b;
    --tdp-surface-muted: #273449;
    --tdp-text: #f1f5f9;
    --tdp-text-muted: #cbd5e1;
    --tdp-border: #475569;
    --tdp-control-border: #94a3b8;
    --tdp-action: #2563eb;
    --tdp-action-hover: #1d4ed8;
    --tdp-link: #93c5fd;
    --tdp-focus: #93c5fd;
    --tdp-success: #86efac;
    --tdp-success-bg: #143b2b;
    --tdp-warning: #fcd34d;
    --tdp-warning-bg: #422f19;
    --tdp-danger: #fca5a5;
    --tdp-danger-bg: #481f2b;
    --tdp-info: #7dd3fc;
    --tdp-info-bg: #16364c;
    --tdp-shadow-panel: none;
    --bs-body-color: var(--tdp-text);
    --bs-secondary-color: var(--tdp-text-muted);
    --bs-body-bg: var(--tdp-surface);
    --bs-tertiary-bg: var(--tdp-surface-muted);
    --bs-border-color: var(--tdp-border);
    --bs-link-color: var(--tdp-link);
}
html { scroll-padding-block: 5rem; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 3px solid var(--tdp-focus);
    outline-offset: 3px;
}
.app-skip-link {
    position: fixed;
    top: var(--tdp-space-2);
    left: var(--tdp-space-2);
    transform: translateY(-200%);
    z-index: 1100;
    padding: var(--tdp-space-3) var(--tdp-space-4);
    background: var(--tdp-surface);
    color: var(--tdp-link);
    border: 2px solid var(--tdp-focus);
    border-radius: var(--tdp-radius-control);
}
.app-skip-link:focus { transform: translateY(0); }
.app-main { min-width: 0; }
.app-wrapper .app-content { padding-bottom: var(--tdp-space-8); }
.app-wrapper .app-content-header { padding-block: var(--tdp-space-6); }
.app-wrapper .page-header { flex-wrap: wrap !important; align-items: center !important; }
.app-wrapper .page-actions { flex-wrap: wrap; gap: var(--tdp-space-2); }
.app-wrapper .page-title { font-size: 1.75rem; font-weight: 600; line-height: 1.3; }
.app-wrapper .page-subtitle { display: block; overflow: visible; margin-top: var(--tdp-space-2); }
.app-wrapper .breadcrumb { font-size: .875rem; }
.app-wrapper .card { border-color: var(--tdp-border); border-radius: var(--tdp-radius-panel); }
.app-wrapper .card-body { padding: var(--tdp-space-6); }
.app-wrapper .card-header, .app-wrapper .card-footer { padding: var(--tdp-space-4) var(--tdp-space-6); }
.app-wrapper .card-title { font-size: 1.125rem; line-height: 1.5; }
.app-wrapper .btn {
    min-height: var(--tdp-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tdp-space-1);
    --bs-btn-font-size: .875rem;
    border-radius: var(--tdp-radius-control);
    transition: background-color var(--tdp-motion-fast), border-color var(--tdp-motion-fast), color var(--tdp-motion-fast);
}
.app-wrapper .btn-sm { min-height: 2.25rem; }
.app-wrapper .btn-icon { width: 2.25rem; height: 2.25rem; flex-shrink: 0; }
.app-wrapper .btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--tdp-action);
    --bs-btn-border-color: var(--tdp-action);
    --bs-btn-hover-bg: var(--tdp-action-hover);
    --bs-btn-hover-border-color: var(--tdp-action-hover);
    --bs-btn-active-bg: var(--tdp-blue-900);
    --bs-btn-active-border-color: var(--tdp-blue-900);
    --bs-btn-disabled-bg: var(--tdp-action);
    --bs-btn-disabled-border-color: var(--tdp-action);
}
.app-wrapper .btn-outline-primary {
    --bs-btn-color: var(--tdp-link);
    --bs-btn-border-color: var(--tdp-control-border);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--tdp-action);
    --bs-btn-hover-border-color: var(--tdp-action);
    --bs-btn-active-bg: var(--tdp-action-hover);
}
.app-wrapper .btn-default { --bs-btn-border-color: var(--tdp-control-border); }
.form-control, .form-select {
    min-height: var(--tdp-control-height);
    font-size: 1rem;
    border-color: var(--tdp-control-border);
    border-radius: var(--tdp-radius-control);
}
.form-label { color: var(--tdp-text); font-size: .875rem; margin-bottom: var(--tdp-space-2); }
.form-text { font-size: .875rem; color: var(--tdp-text-muted); }
.form-control::placeholder { color: var(--tdp-text-muted); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--tdp-focus); box-shadow: none; }
.form-check-input { border-color: var(--tdp-control-border); }
.app-wrapper .table { font-size: .875rem; --bs-table-hover-bg: var(--tdp-surface-muted); }
.app-wrapper .table > thead > tr > th {
    font-size: .875rem;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    color: var(--tdp-text);
    padding: var(--tdp-space-3) var(--tdp-space-4);
}
.app-wrapper .table > tbody > tr > td { padding: var(--tdp-space-3) var(--tdp-space-4); }
.app-wrapper .table td { overflow-wrap: anywhere; }
.app-wrapper .table .cell-sub { color: var(--tdp-text-muted); font-size: .8125rem; }
.app-wrapper .table-responsive { max-width: 100%; }
.table-scroll-hint { color: var(--tdp-text-muted); font-size: .875rem; margin: 0; padding: var(--tdp-space-2) var(--tdp-space-4); }
.table-scroll-hint[hidden] { display: none; }
.app-wrapper .page-link { min-width: 2.75rem; min-height: 2.75rem; display: flex; align-items: center; justify-content: center; }
.app-wrapper .pagination { flex-wrap: wrap; gap: var(--tdp-space-1); }
.app-wrapper .pagination .page-link { border-radius: var(--tdp-radius-control); }
.badge-soft-success { color: var(--tdp-success); background: var(--tdp-success-bg); }
.badge-soft-warning { color: var(--tdp-warning); background: var(--tdp-warning-bg); }
.badge-soft-danger { color: var(--tdp-danger); background: var(--tdp-danger-bg); }
.badge-soft-info { color: var(--tdp-info); background: var(--tdp-info-bg); }
.badge-soft-secondary { color: var(--tdp-text-muted); background: var(--tdp-surface-muted); }
[data-bs-theme="dark"] .badge-soft-success { color: var(--tdp-success); background: var(--tdp-success-bg); }
[data-bs-theme="dark"] .badge-soft-warning { color: var(--tdp-warning); background: var(--tdp-warning-bg); }
[data-bs-theme="dark"] .badge-soft-danger { color: var(--tdp-danger); background: var(--tdp-danger-bg); }
[data-bs-theme="dark"] .badge-soft-info { color: var(--tdp-info); background: var(--tdp-info-bg); }
.app-wrapper .badge { white-space: normal; line-height: 1.5; }
.app-wrapper .stat-value { font-size: 2rem; font-variant-numeric: tabular-nums; }
.app-wrapper .stat-label { font-size: .875rem; color: var(--tdp-text-muted); }
.app-wrapper .sidebar-menu .nav-link, .app-wrapper .sidebar-menu .nav-group-toggle { min-height: 2.75rem; }
.app-sidebar { --tdp-focus: #93c5fd; }
.app-wrapper .sidebar-menu .nav-header { font-size: .75rem; color: #cbd5e1 !important; }
.app-wrapper .sidebar-menu .nav-group-toggle:hover, .app-wrapper .sidebar-menu .nav-group-toggle:focus-visible { color: #fff !important; }
.app-wrapper .app-header { --bs-navbar-color: var(--tdp-text-muted); --bs-navbar-hover-color: var(--tdp-text); }
.app-wrapper .app-header .nav-link { min-height: 2.75rem; min-width: 2.75rem; color: var(--tdp-text); }
.chart-data summary { padding-block: var(--tdp-space-2); color: var(--tdp-link); cursor: pointer; }
.chart-data th[scope="row"] { font-weight: 500; vertical-align: middle; }
.chart-data td { font-variant-numeric: tabular-nums; }
.app-wrapper .stat-card { min-width: 0; border: 1px solid var(--tdp-border); }
.app-wrapper .empty-state { padding: var(--tdp-space-12) var(--tdp-space-6); }
.app-wrapper .empty-state .btn { margin: var(--tdp-space-1); }
.app-wrapper .modal-content { border-radius: var(--tdp-radius-panel); background: var(--tdp-surface); }
.modal-footer { gap: var(--tdp-space-2); }
.validation-summary-errors { border-inline-start: 4px solid var(--tdp-danger); }
.validation-summary-errors:focus { outline: 3px solid var(--tdp-focus); outline-offset: 3px; }
.validation-summary-errors a { color: inherit; text-decoration: underline; }
.field-validation-error { display: block; margin-top: var(--tdp-space-1); }
.toast { font-size: .875rem; }
.toast-body { overflow-wrap: anywhere; }
.app-wrapper .enterprise-form { max-width: 64rem; }
.enterprise-form .form-section-title { font-size: 1.125rem; margin: 0 0 var(--tdp-space-2); padding: 0; border: 0; }
.enterprise-form .form-section-start { margin-top: var(--tdp-space-4); padding-top: var(--tdp-space-6); border-top: 1px solid var(--tdp-border); }
/* Cổng công khai giữ nhận diện xanh lá; dùng chung kích thước và nhịp điệu. */
.portal {
    --tdp-focus: #123f37;
    --portal-brand: #123f37;
    --portal-text-muted: #465e50;
    color-scheme: light;
    font-size: 1rem;
    line-height: 1.65;
}
.portal :where(input, select, button) { font: inherit; min-height: var(--tdp-control-height); border-radius: var(--tdp-radius-control); }
.portal a:focus-visible, .portal button:focus-visible, .portal input:focus-visible, .portal select:focus-visible { outline-color: var(--tdp-focus); }
.portal :is(.portal-topline, .portal-brand small, .portal-eyebrow, .portal-meta, .portal-document-icon) { font-size: .75rem; }
.portal :is(.portal-nav a, .portal-card p, .portal-panel p, .portal-community p, .portal-empty p, .portal-page-heading p, .portal-org-card li, .portal-attachments > div) { font-size: 1rem; }
.portal :is(.portal-source, .portal-date, .portal-phase, .portal-document-link, .portal-notice-link, .portal-footer, .portal-pagination, .portal-breadcrumb, .portal-read-more, .portal-gallery figcaption, .portal-org-card li span) { font-size: .875rem; }
.portal :is(.portal-card p, .portal-panel p, .portal-source, .portal-meta, .portal-empty p, .portal-page-heading p, .portal-org-card li span, .portal-gallery figcaption) { color: var(--portal-text-muted); }
.portal :is(.portal-search input, .portal-filter input, .portal-filter select) { font-size: 1rem; border-color: #64786b; }
.portal .portal-nav a { white-space: normal; }
.portal .portal-culture table { font-size: 1rem; }
.portal .portal-prose { max-width: 70ch; }
.portal-footer { --tdp-focus: #fcd34d; }
.modal .btn { min-height: var(--tdp-control-height); }
.app-wrapper .text-danger { color: var(--tdp-danger) !important; }
.app-wrapper .text-success { color: var(--tdp-success) !important; }
.portal :where(.portal-card-body, .portal-panel) { padding: var(--tdp-space-6); }
@media (max-width: 991.98px) {
    .app-wrapper .page-actions { width: 100%; }
    .app-wrapper .page-title { font-size: 1.5rem; }
}
@media (max-width: 767.98px) {
    .app-wrapper .card-body { padding: var(--tdp-space-4); }
    .app-wrapper .card-header, .app-wrapper .card-footer { padding: var(--tdp-space-4); }
    .app-wrapper .btn-sm, .app-wrapper .btn-icon { min-height: var(--tdp-control-height); }
    .app-wrapper .btn-icon { min-width: var(--tdp-control-height); }
    .app-wrapper .table { font-size: 1rem; }
    .app-wrapper .table .cell-title { min-width: 12rem; }
    .app-wrapper .card-footer { flex-wrap: wrap; }
    .app-wrapper .stat-value { font-size: 1.75rem; }
    .enterprise-form .row > [class*="col-md-"] { width: 100%; }
    .app-wrapper .page-actions > .btn { flex: 1 1 auto; }
    .portal .portal-card-body, .portal .portal-panel { padding: var(--tdp-space-4); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
