/* =====================================================================
   Đ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;
}

/* 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; }
