/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #15803d;
    --primary-light: #16a34a;
    --primary-dark: #14532d;
    --sidebar-bg: #14532d;
    --bg: #f1f5f3;
    --bg-card: #ffffff;
    --text: #14211b;
    --text-light: #6b7a73;
    --border: #e5e9e7;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #2563eb;
    --info-bg: #dbeafe;
    --pending: #d97706;
    --gray: #64748b;
    --gray-bg: #f1f5f9;
    --sidebar-width: 230px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #dcfce7;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #4ade80;
}

.brand-name {
    font-size: 15px;
    color: #fff;
    font-weight: 600;
}

.brand-sub {
    font-size: 11px;
    color: #a7f3c8;
}

.nav-group {
    font-size: 11px;
    color: #6ee7a8;
    letter-spacing: 0.4px;
    padding: 14px 16px 6px;
    text-transform: uppercase;
    font-weight: 500;
}

.nav-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 9px 16px;
    font-size: 13.5px;
    color: #c9f5d9;
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: #4ade80;
}

.nav-item i {
    font-size: 18px;
}

.badge {
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 500;
}

.user-info {
    margin-top: auto;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #4ade80;
}

.user-name {
    font-size: 13px;
    color: #fff;
}

.user-role {
    font-size: 11px;
    color: #a7f3c8;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER BAR === */
.header-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-bar .subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.2rem;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.refresh-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-family: inherit;
}

.refresh-btn:hover {
    background: rgba(255,255,255,0.3);
}

.last-update {
    font-size: 0.8rem;
    opacity: 0.85;
    background: rgba(255,255,255,0.15);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

/* === MOBILE MENU TOGGLE === */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 101;
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* === MAIN === */
main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* === KPI CARDS (Fix 1) === */
.kpi-cards,
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 14px 14px 0 0;
}

.kpi-card:nth-child(1)::before { background: #15803d; }
.kpi-card:nth-child(2)::before { background: #2563eb; }
.kpi-card:nth-child(3)::before { background: #16a34a; }
.kpi-card:nth-child(4)::before { background: #dc2626; }
.kpi-card:nth-child(5)::before { background: #d97706; }
.kpi-card:nth-child(6)::before { background: #64748b; }

.kpi-label {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

.kpi-number {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    margin-top: 6px;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.kpi-icon {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 22px;
    color: #94a3b8;
}

.kpi-label i {
    margin-right: 6px;
    font-size: 16px;
    vertical-align: middle;
}

/* === OLD CARD STYLES (for compatibility) === */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-icon {
    font-size: 1.75rem;
}

.card-icon.total { color: var(--primary); }
.card-icon.completed { color: var(--success); }
.card-icon.in-progress { color: var(--info); }
.card-icon.overdue { color: var(--danger); }
.card-icon.pending { color: var(--pending); }
.card-icon.no-report { color: var(--gray); }

.card-content {
    display: flex;
    flex-direction: column;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* === SECTION CARD === */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.section-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* === PROGRESS BAR === */
.progress-bar-container {
    position: relative;
    height: 2rem;
    background: #e5e9e7;
    border-radius: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 1rem;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

/* === CHARTS === */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    min-height: 280px;
}

.chart-container canvas {
    max-height: 280px;
}

.chart-small {
    max-height: 280px;
}

/* Donut center text (Fix 2) */
.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.donut-center-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.2;
}

.donut-center-label {
    font-size: 12px;
    color: var(--text-light);
}

/* === TABLES (Fix 4) === */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary-dark);
    color: white;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

th:first-child { border-radius: 8px 0 0 0; }
th:last-child { border-radius: 0 8px 0 0; }

tbody tr:nth-child(even) { background: #fafbfa; }
tbody tr:hover { background: #f1f5f3; }

/* === STATUS PILLS (Fix 4) === */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-hoan-thanh { background: #dcfce7; color: #15803d; }
.status-dang-thuc-hien { background: #dbeafe; color: #2563eb; }
.status-tre-han { background: #fee2e2; color: #dc2626; }
.status-cho-phe-duyet { background: #fef3c7; color: #d97706; }
.status-chua-bao-cao { background: #f1f5f9; color: #64748b; }

/* === PROGRESS IN TABLE === */
.progress-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-mini {
    width: 80px;
    height: 8px;
    background: #e5e9e7;
    border-radius: 6px;
    overflow: hidden;
}

.progress-mini-bar {
    height: 100%;
    background: var(--primary-light);
    border-radius: 6px;
}

/* === RANK BADGE === */
.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    background: #dcfce7;
    color: #15803d;
    flex-shrink: 0;
}

/* === NAME LINK === */
.name-link {
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.name-link:hover {
    text-decoration: underline;
}

/* === BACK BUTTON === */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    transition: all 0.2s;
    font-family: inherit;
}

.back-btn:hover {
    background: #f9fafb;
    border-color: var(--primary);
}

/* === FILTERS === */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    font-family: inherit;
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-bar input {
    min-width: 180px;
}

/* === BUTTON STYLES === */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: var(--primary);
}

/* === DEPT GRID (Fix 5 - KPI Phòng ban page) === */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.dept-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    position: relative;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
}

.dept-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .09);
    transform: translateY(-2px);
}

/* Ranking colors */
.dept-card:nth-child(1) { border-left-color: #fbbf24; }
.dept-card:nth-child(2) { border-left-color: #94a3b8; }
.dept-card:nth-child(3) { border-left-color: #b45309; }

.dept-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.dept-header h4 {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.dept-progress {
    margin-bottom: 1rem;
}

.dept-progress .progress-bar {
    height: 24px;
    background: #e5e9e7;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.dept-progress .progress-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s;
}

/* Progress color based on percentage */
.dept-progress .progress-fill.low { background: #dc2626; }
.dept-progress .progress-fill.medium { background: #d97706; }
.dept-progress .progress-fill.high { background: #16a34a; }
.dept-progress .progress-fill { background: linear-gradient(90deg, var(--primary-light), var(--primary)); }

.dept-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text);
}

.dept-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.stat-value.text-green { color: var(--success); }
.stat-value.text-red { color: var(--danger); }

.dept-tasks h5 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.dept-tasks ul {
    list-style: none;
    font-size: 13px;
}

.dept-tasks li {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.dept-tasks li:last-child {
    border-bottom: none;
}

.dept-tasks .task-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 0.5rem;
}

.dept-tasks .task-progress {
    font-weight: 600;
    color: var(--primary);
}

.dept-tasks .task-completed { color: var(--success); }
.dept-tasks .task-overdue { color: var(--danger); }
.dept-tasks .task-no-report { color: var(--gray); }

.dept-tasks .more {
    color: var(--text-light);
    font-style: italic;
}

/* === STAFF GRID (Fix 6 - Nhân sự page) === */
.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.staff-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid var(--primary);
}

.staff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.staff-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.staff-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}

/* Avatar colors by department */
.staff-avatar.dept-1 { background: #15803d; }
.staff-avatar.dept-2 { background: #2563eb; }
.staff-avatar.dept-3 { background: #d97706; }
.staff-avatar.dept-4 { background: #dc2626; }
.staff-avatar.dept-5 { background: #7c3aed; }

.staff-info {
    flex: 1;
}

.staff-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.1rem;
}

.staff-dept {
    font-size: 12px;
    color: var(--text-light);
}

.staff-progress {
    margin-bottom: 0.75rem;
}

.staff-progress .progress-bar {
    height: 20px;
    background: #e5e9e7;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.staff-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 10px;
}

.staff-progress .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
}

.staff-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stat-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.stat-pill.completed { background: #dcfce7; color: #15803d; }
.stat-pill.in-progress { background: #dbeafe; color: #2563eb; }
.stat-pill.overdue { background: #fee2e2; color: #dc2626; }
.stat-pill.no-report { background: #f1f5f9; color: #64748b; }

.staff-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}

/* === PROFILE HEADER (Staff profile) === */
.profile-header {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
}

.profile-info h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.profile-info p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
}

.profile-progress {
    margin-left: auto;
    text-align: center;
}

.progress-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--progress), #e5e9e7 var(--progress));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
}

.progress-circle span {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
}

.profile-progress > span {
    display: block;
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--text-light);
}

/* === PROFILE STATS === */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 14px;
    text-align: center;
    border-top: 3px solid var(--gray);
}

.stat-box.total { border-top-color: var(--primary); }
.stat-box.completed { border-top-color: var(--success); }
.stat-box.in-progress { border-top-color: var(--info); }
.stat-box.overdue { border-top-color: var(--danger); }
.stat-box.no-report { border-top-color: var(--gray); }

.stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.stat-box .stat-label {
    font-size: 12px;
    color: var(--text-light);
}

/* === URGENT/WARNING SECTIONS (Fix 7 - Cần cập nhật page) === */
.urgent-section {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 14px;
    padding: 1.25rem;
    border-left: 4px solid #dc2626;
    margin-bottom: 1.5rem;
}

.urgent-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 1rem;
}

.urgent-table th {
    background: #dc2626;
}

.warning-section {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 1.25rem;
    border-left: 4px solid #d97706;
    margin-bottom: 1.5rem;
}

.warning-section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #b45309;
    margin-bottom: 1rem;
}

.warning-table th {
    background: #d97706;
}

.empty-msg {
    color: var(--success);
    font-weight: 500;
    text-align: center;
    padding: 1rem;
}

/* === ERROR PAGE === */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    text-align: center;
    color: var(--danger);
}

.error-page i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-page p {
    margin-bottom: 1rem;
    color: var(--text);
}

/* === FOOTER === */
footer {
    text-align: center;
    padding: 1.25rem;
    color: var(--text-light);
    font-size: 0.8rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* === LOADING === */
.loading-page {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 4rem;
    color: var(--text-light);
    font-size: 1rem;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====================================================
   PAGE: BỘ KPI
   ==================================================== */
.kpi-table {
    width: 100%;
}

.kpi-table th {
    background: var(--primary-dark);
    color: white;
}

.eval-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.eval-pass { background: #dcfce7; color: #15803d; }
.eval-warning { background: #fef3c7; color: #b45309; }
.eval-fail { background: #fee2e2; color: #dc2626; }

.kpi-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #dcfce7;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.summary-content {
    flex: 1;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.summary-label {
    font-size: 12px;
    color: var(--text-light);
}

/* ====================================================
   PAGE: CẬP NHẬT SỐ LIỆU
   ==================================================== */
.capnhat-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.capnhat-guide h3 {
    margin-bottom: 1.5rem;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    color: var(--text);
    margin-bottom: 2px;
}

.step-content p {
    color: var(--text-light);
    font-size: 13px;
    margin: 0;
}

.btn-open-sheet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-open-sheet:hover {
    background: var(--primary-dark);
}

.capnhat-warning h3 {
    color: #b45309;
    margin-bottom: 1rem;
}

.warning-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.warning-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.warning-list li:last-child {
    border-bottom: none;
}

.warning-list li i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-list li i.ti-check { color: var(--success); }
.warning-list li i.ti-x { color: var(--danger); }
.warning-list li i.ti-clock { color: var(--info); }
.warning-list li i.ti-alert-triangle { color: var(--warning); }

.capnhat-status h3 {
    margin-bottom: 1rem;
}

.status-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
}

.status-item i {
    font-size: 24px;
    color: var(--text-light);
}

.status-item.highlight-red {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
}

.status-item.highlight-red i {
    color: #dc2626;
}

.status-progress {
    flex: 1;
    height: 20px;
    background: #e5e9e7;
    border-radius: 10px;
    overflow: hidden;
}

.status-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 10px;
}

.status-text {
    font-size: 14px;
}

.status-note {
    color: var(--text-light);
    font-size: 12px;
}

/* Phần Cán bộ */
.capnhat-canbo {
    border-left: 4px solid var(--primary);
}

.capnhat-note-inline {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 3px solid var(--warning);
}

.capnhat-note-inline h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #b45309;
    margin-bottom: 8px;
}

.capnhat-note-inline ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: var(--text-light);
}

.capnhat-note-inline li {
    padding: 3px 0;
}

/* Phần Admin */
.capnhat-admin {
    border-left: 4px solid var(--primary-dark);
    background: linear-gradient(to right, #f0fdf4 0%, var(--bg-card) 100%);
}

.capnhat-admin h3 {
    color: var(--primary-dark);
}

.admin-subtitle {
    color: var(--text-light);
    font-size: 13px;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.admin-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.admin-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--primary-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.admin-section h4 i {
    font-size: 18px;
}

.admin-steps {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 13px;
    color: var(--text);
}

.admin-steps li {
    padding: 4px 0;
}

.admin-tips {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
}

.admin-tips li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.admin-tips li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--primary);
}

.column-guide {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 12px;
}

.column-guide span {
    color: var(--text-light);
}

.column-guide strong {
    color: var(--primary-dark);
}

code {
    background: #e5e9e7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.link-internal {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.link-internal:hover {
    color: var(--primary-dark);
}

.btn-admin {
    background: var(--primary-dark);
}

.btn-admin:hover {
    background: #0f4025;
}

/* ====================================================
   PAGE: KPI CÁ NHÂN
   ==================================================== */
.kpi-canhan-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.kpi-canhan-header label {
    font-weight: 500;
    color: var(--text);
}

.staff-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    min-width: 250px;
    cursor: pointer;
}

.staff-select:focus {
    outline: none;
    border-color: var(--primary);
}

.kpi-canhan-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text-light);
}

.kpi-canhan-empty i {
    font-size: 48px;
    margin-bottom: 1rem;
    color: #94a3b8;
}

.kpi-canhan-profile {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.kpi-canhan-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.mini-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.mini-card.highlight-green {
    border-color: #16a34a;
    background: #f0fdf4;
}

.mini-card.highlight-red {
    border-color: #dc2626;
    background: #fef2f2;
}

.mini-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text);
}

.mini-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.row-unreported {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
}

.row-overdue {
    background: #fff7ed;
    border-left: 3px solid #f59e0b;
}

/* ====================================================
   PAGE: PHÂN CÔNG CÔNG VIỆC
   ==================================================== */
.phancong-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 14px;
}

.summary-item i {
    font-size: 18px;
    color: var(--primary);
}

.phancong-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phancong-dept {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.dept-header-pc {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f1f5f3;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.dept-header-pc:hover {
    background: #e5e9e7;
}

.dept-header-pc i.ti-folder {
    color: var(--primary);
    font-size: 20px;
}

.dept-meta-pc {
    color: var(--text-light);
    font-size: 12px;
    margin-left: auto;
    margin-right: 8px;
}

.toggle-icon {
    transition: transform 0.2s;
    color: var(--text-light);
}

.phancong-dept.collapsed .dept-body-pc {
    display: none;
}

.phancong-dept.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.dept-body-pc {
    padding: 8px 16px 16px;
}

.staff-group-pc {
    margin-bottom: 16px;
}

.staff-group-pc:last-child {
    margin-bottom: 0;
}

.staff-name-pc {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--primary);
    font-size: 13px;
    margin-bottom: 8px;
    padding-left: 8px;
}

.staff-meta-pc {
    color: var(--text-light);
    font-weight: 400;
    font-size: 12px;
    margin-left: auto;
}

.task-list-pc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 24px;
}

.task-row-pc {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    font-size: 13px;
    border-left: 2px solid #e5e9e7;
    background: #fafbfa;
    border-radius: 0 8px 8px 0;
}

.task-row-pc.task-unreported {
    border-left-color: #dc2626;
    background: #fef2f2;
}

.task-row-pc.task-overdue-pc {
    border-left-color: #f59e0b;
    background: #fff7ed;
}

.task-code-pc {
    color: var(--text-light);
    font-weight: 500;
    width: 55px;
    flex-shrink: 0;
}

.task-name-pc {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-pct-pc {
    width: 40px;
    text-align: right;
    font-weight: 500;
    color: var(--text);
}

/* ====================================================
   PAGE: NGƯỜI DÙNG
   ==================================================== */
.nguoidung-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 14px;
}

.nguoidung-table th {
    background: var(--primary-dark);
    color: white;
}

.role-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-admin {
    background: var(--primary-dark);
    color: white;
}

.role-user {
    background: #dcfce7;
    color: #15803d;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-pill.active {
    background: #dcfce7;
    color: #15803d;
}

.status-pill.active i {
    font-size: 8px;
}

.nguoidung-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 3px solid var(--primary);
    margin-top: 1.5rem;
    font-size: 13px;
    color: var(--text-light);
}

.nguoidung-note i {
    font-size: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-bar {
        padding: 1rem;
        padding-left: 60px;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-bar h1 {
        font-size: 1.25rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    main {
        padding: 1rem;
    }

    .kpi-cards,
    .kpi-grid,
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .kpi-card {
        padding: 12px 14px;
    }

    .kpi-number {
        font-size: 22px;
    }

    .kpi-label {
        font-size: 11px;
    }

    .kpi-icon {
        font-size: 18px;
        top: 12px;
        right: 14px;
    }

    .card {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .card-icon { font-size: 1.5rem; }
    .card-value { font-size: 1.25rem; }
    .card-label { font-size: 0.7rem; }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input,
    .filter-bar button {
        width: 100%;
    }

    table {
        font-size: 0.75rem;
        min-width: 600px;
    }

    th, td {
        padding: 8px 6px;
    }

    .progress-mini {
        width: 60px;
    }

    .status-badge {
        padding: 3px 6px;
        font-size: 10px;
    }

    .dept-grid,
    .staff-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-progress {
        margin-left: 0;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* New pages responsive */
    .kpi-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-canhan-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-canhan-header {
        flex-direction: column;
        align-items: stretch;
    }

    .staff-select {
        min-width: 100%;
    }

    .guide-step {
        flex-direction: column;
        text-align: center;
    }

    .step-number {
        align-self: center;
    }

    .btn-open-sheet {
        width: 100%;
    }

    .phancong-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .task-row-pc {
        flex-wrap: wrap;
    }

    .task-name-pc {
        width: 100%;
        order: 3;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .header-bar h1 {
        font-size: 1.1rem;
    }

    .kpi-cards,
    .kpi-grid,
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-number {
        font-size: 20px;
    }

    .card-value {
        font-size: 1.1rem;
    }
}

/* === ROLE SWITCHER (Chế độ xem mô phỏng) === */
.role-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 1.5rem;
    background: linear-gradient(135deg, #166534 0%, #14532d 100%);
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.role-label {
    color: #dcfce7;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.badge-demo {
    background: #fbbf24;
    color: #78350f;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-switcher select {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: #fff;
    color: #14211b;
    cursor: pointer;
    min-width: 140px;
}

.role-switcher select:focus {
    outline: none;
    border-color: #4ade80;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

/* === SCOPE BANNER === */
.scope-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: #fef3c7;
    border-left: 3px solid #d97706;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: #78350f;
}

.scope-banner i {
    font-size: 16px;
    color: #d97706;
}

.banner-demo {
    margin-left: auto;
    font-size: 11px;
    background: #d97706;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* === FOOTER DEMO NOTE === */
.footer-demo-note {
    font-size: 11px;
    color: #6b7a73;
    margin-top: 6px;
    line-height: 1.4;
}

/* === RESPONSIVE ROLE SWITCHER === */
@media (max-width: 768px) {
    .role-switcher {
        padding: 10px 1rem;
    }

    .role-switcher select {
        flex: 1;
        min-width: 120px;
    }

    .role-label {
        width: 100%;
        margin-bottom: 6px;
    }
}

@media (max-width: 480px) {
    .scope-banner {
        flex-wrap: wrap;
        font-size: 12px;
    }

    .banner-demo {
        margin-left: 0;
        margin-top: 6px;
    }
}

/* === SIDEBAR: THÔNG TIN NGƯỜI DÙNG THẬT (G7a) === */
/* Thay khối user cứng của Bước 2 — giờ dữ liệu đến từ /api/auth/me */

.user-info .user-text {
    flex: 1;
    min-width: 0;   /* cho phép text-overflow hoạt động trong flex */
}

.user-info .user-name,
.user-info .user-role,
.user-info .user-dept {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info .user-dept {
    font-size: .72rem;
    color: rgba(255, 255, 255, .55);
    margin-top: 1px;
}

.btn-logout {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, .7);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

/* Hai trạng thái mới ở Bước 3 (mục 3 ARCHITECTURE) */
.status-tam-dung {
    background: var(--gray-bg);
    color: var(--gray);
}

.status-yeu-cau-sua {
    background: var(--danger-bg);
    color: var(--danger);
}

/* === TRẠNG THÁI TRỐNG / ĐANG HOÀN THIỆN === */
.empty-state {
    padding: 2.5rem 2rem;
    text-align: center;
}

.empty-state > i {
    font-size: 2.5rem;
    color: var(--text-light);
}

.empty-state .empty-title {
    margin-top: .75rem;
    font-size: 1rem;
    font-weight: 500;
}

.empty-state .empty-sub {
    margin-top: .5rem;
    font-size: .85rem;
    color: var(--text-light);
}

.empty-state .btn-primary {
    margin-top: 1.25rem;
}

/* ============================================================
   TRANG CHI TIẾT NHIỆM VỤ (G7c)
   ============================================================ */

/* Tên nhiệm vụ bấm được ở mọi bảng */
.task-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dotted var(--border);
}

.task-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.task-row-pc[data-task] {
    cursor: pointer;
}

/* --- Khối 1: thông tin nhiệm vụ --- */
.task-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.task-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
}

.task-code {
    margin-top: .25rem;
    font-size: .85rem;
    color: var(--text-light);
}

.task-pills {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem 1.5rem;
}

.info-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.info-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--text-light);
}

.info-value {
    font-size: .9rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.task-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.task-block h4 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--text-light);
    margin-bottom: .4rem;
}

.task-block p {
    font-size: .92rem;
    line-height: 1.6;
    white-space: pre-wrap;   /* giữ xuống dòng người dùng gõ */
}

/* --- Nhãn nhỏ --- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    font-size: .75rem;
    font-weight: 500;
    border-radius: 999px;
}

.pill-tre-han {
    background: var(--danger-bg);
    color: var(--danger);
}

.pill-dung-han {
    background: var(--success-bg);
    color: var(--primary-dark);
}

.pill-nhap {
    background: var(--warning-bg);
    color: var(--warning);
}

/* --- Khối 2: tiến độ --- */
.progress-big {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.progress-bar-lg {
    flex: 1;
    height: 22px;
}

.progress-big-num {
    flex-shrink: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
    text-align: right;
}

/* Chỗ chừa cho nút hành động của G7d/G7e — rỗng thì không chiếm chỗ */
#taskActions:not(:empty) {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* --- Khối 3: dòng thời gian báo cáo --- */
.chua-bao-cao {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    padding: .75rem 1rem;
    font-size: .9rem;
    color: var(--danger);
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    border-radius: 8px;
}

.tl {
    position: relative;
    margin-top: 1rem;
    padding-left: 1.5rem;
}

/* Đường dọc nối các mốc */
.tl::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
}

.tl-item {
    position: relative;
    padding-bottom: 1.25rem;
}

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

.tl .dot {
    position: absolute;
    left: -1.5rem;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-card);
}

.tl-dau {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    font-size: .85rem;
}

.tl-ngay {
    font-weight: 600;
}

.tl-nguoi {
    color: var(--text-light);
}

.tl-pct {
    font-weight: 600;
    color: var(--primary);
}

.tl-van-ban {
    margin-top: .4rem;
    font-size: .9rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.tl-tep {
    margin-top: .4rem;
    font-size: .8rem;
    color: var(--text-light);
}

.tl-xuly {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .5rem;
    padding: .45rem .7rem;
    font-size: .82rem;
    border-radius: 7px;
}

.tl-duyet {
    background: var(--success-bg);
    color: var(--primary-dark);
}

.tl-tra-lai {
    background: var(--warning-bg);
    color: var(--warning);
}

@media (max-width: 640px) {
    .task-title-row {
        flex-direction: column;
    }
}

/* ============ G7d: FORM BÁO CÁO (panel trượt) ============ */

.btn-hanh-dong {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1.1rem;
    font-size: .9rem;
}

.lop-phu {
    position: fixed;
    inset: 0;
    background: rgba(20, 33, 27, .45);
    z-index: 200;
    animation: hienDan .18s ease-out;
}

@keyframes hienDan { from { opacity: 0; } to { opacity: 1; } }

.panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(520px, 100%);
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(20, 33, 27, .18);
    z-index: 201;
    display: flex;
    flex-direction: column;
    animation: truotVao .22s ease-out;
}

@keyframes truotVao { from { transform: translateX(100%); } to { transform: none; } }

.panel-dau {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.panel-dau h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.panel-phu {
    display: block;
    margin-top: .2rem;
    font-size: .82rem;
    color: var(--text-light);
}

.panel-dong {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.2rem;
    line-height: 1;
    padding: .2rem;
    border-radius: 6px;
}

.panel-dong:hover { background: var(--gray-bg); color: var(--text); }

.panel-than {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.panel-chan {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--border);
    background: #fafbfa;
}

.panel-chan button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.panel-chan button:disabled { opacity: .5; cursor: not-allowed; }

/* --- Các trường nhập --- */

.truong { margin-bottom: 1.35rem; }

.truong > label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .5rem;
}

.truong textarea,
.truong select {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .88rem;
    color: var(--text);
    background: white;
}

.truong textarea { resize: vertical; line-height: 1.5; }

.truong textarea:focus,
.truong select:focus,
.o-pct input:focus {
    outline: none;
    border-color: var(--primary);
}

.hang-pct {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hang-pct input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.o-pct {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .9rem;
    font-weight: 600;
}

.o-pct input {
    width: 62px;
    padding: .4rem .5rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-family: inherit;
    font-size: .9rem;
    text-align: right;
}

.ghi-chu-nho {
    margin-top: .4rem;
    font-size: .78rem;
    color: var(--text-light);
    line-height: 1.45;
}

.ghi-chu-nho.canh-bao { color: var(--warning); }

/* --- Khu đính kèm --- */

.khu-tep {
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 1.1rem;
    text-align: center;
    color: var(--text-light);
    font-size: .85rem;
}

.khu-tep i { font-size: 1.5rem; display: block; margin-bottom: .35rem; }

.khu-tep.keo-vao {
    border-color: var(--primary);
    background: var(--success-bg);
}

.khu-tep-tat {
    background: var(--gray-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.khu-tep-tat i { display: inline; font-size: 1rem; margin: 0; }

.lien-ket {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.ds-tep { margin-top: .6rem; }

.tep-hang {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: .4rem;
    font-size: .84rem;
}

.tep-hang > i { color: var(--text-light); font-size: 1.05rem; }

.tep-ten {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tep-co { color: var(--text-light); font-size: .78rem; }

.tep-nut {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: .25rem;
    border-radius: 6px;
    line-height: 1;
}

.tep-nut:hover { background: var(--gray-bg); color: var(--text); }
.tep-xoa:hover { background: var(--danger-bg); color: var(--danger); }

.tep-dang-tai { color: var(--text-light); }

/* --- Thông báo trong panel --- */

.bc-thong-bao {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .8rem;
    border-radius: 8px;
    font-size: .85rem;
    margin-bottom: 1rem;
}

.bc-loi { background: var(--danger-bg); color: var(--danger); }

.bc-xac-nhan {
    padding: .85rem;
    border: 1px solid var(--warning);
    background: var(--warning-bg);
    border-radius: 9px;
    font-size: .85rem;
    color: #7c4a03;
}

.bc-xac-nhan p { display: flex; gap: .5rem; line-height: 1.5; }

.bc-xac-nhan-nut {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: .7rem;
}

/* --- Link tệp trong timeline --- */

.tep-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .4rem;
    margin-right: .5rem;
    padding: .3rem .6rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: .8rem;
    color: var(--text);
    text-decoration: none;
    max-width: 100%;
}

.tep-link:hover { border-color: var(--primary); color: var(--primary); }

/* --- Toast --- */

#toast.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1rem;
    border-radius: 9px;
    font-size: .88rem;
    color: white;
    background: var(--primary);
    box-shadow: 0 6px 20px rgba(20, 33, 27, .22);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}

#toast.toast-loi { background: var(--danger); }

#toast.hien { opacity: 1; transform: none; }

@media (max-width: 640px) {
    .panel { width: 100%; }
    .panel-chan { flex-wrap: wrap; }
}

/* ============ G7e: DUYỆT / TRẢ LẠI ============ */

.btn-canh-bao {
    background: var(--warning);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-canh-bao:hover { background: #b45309; }

.nhom-nut-duyet {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.nhom-nut-duyet .btn-canh-bao {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1.1rem;
    font-size: .9rem;
}

/* --- Khối xác nhận trong trang (thay cho window.confirm) --- */

.khoi-xac-nhan {
    margin-top: .9rem;
    padding: .9rem 1rem;
    border-radius: 9px;
    font-size: .87rem;
    line-height: 1.55;
}

.khoi-xac-nhan p { display: flex; gap: .5rem; }

.xn-duyet {
    border: 1px solid var(--success);
    background: var(--success-bg);
    color: var(--primary-dark);
}

.xn-tra-lai {
    border: 1px solid var(--warning);
    background: var(--warning-bg);
    color: #7c4a03;
}

.xn-tra-lai label {
    display: block;
    font-weight: 600;
    margin-bottom: .45rem;
}

.xn-tra-lai textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .88rem;
    line-height: 1.5;
    resize: vertical;
    background: white;
    color: var(--text);
}

.xn-tra-lai textarea:focus { outline: none; border-color: var(--warning); }

.xn-nut {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: .7rem;
}

.xn-nhanh:not(:empty) { margin-top: .25rem; }

/* --- Trang Cần duyệt --- */

.can-duyet-dau {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

.can-duyet-dau h2 { font-size: 1.15rem; font-weight: 600; }

.dem-lon {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.the-duyet-ds {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
}

.the-duyet {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--pending);
    border-radius: 11px;
    padding: 1.1rem;
}

.the-duyet-dau {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.the-duyet-dau h4 {
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: .15rem;
}

.the-duyet .ma-viec {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: .02em;
}

.the-duyet-pct {
    text-align: right;
    flex-shrink: 0;
}

.the-duyet-pct .ghi-chu-nho { margin-top: .1rem; }

.the-duyet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-top: .8rem;
    font-size: .8rem;
    color: var(--text-light);
}

.the-duyet-meta span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.trich-bao-cao {
    margin-top: .75rem;
    padding: .6rem .75rem;
    background: var(--gray-bg);
    border-radius: 8px;
    font-size: .84rem;
    line-height: 1.55;
    /* Trích 2 dòng — thẻ trong lưới phải cao đều nhau mới quét mắt nhanh được */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.the-duyet-nut {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: .9rem;
}

.the-duyet-nut button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.badge-duyet { background: var(--pending); }

.phan-trang {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: .85rem;
    color: var(--text-light);
}

.phan-trang button {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.phan-trang button:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
    .the-duyet-ds { grid-template-columns: 1fr; }
}

/* ============ G7f: TRANG QUẢN TRỊ ============ */

.qt-dau {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.qt-dau h2 { font-size: 1.15rem; font-weight: 600; }

.qt-nut { display: flex; gap: .5rem; }

.qt-nut button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.qt-vung:not(:empty) { margin-bottom: 1.1rem; }

.qt-ghi-chu {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin-top: .9rem;
    font-size: .8rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* --- Bảng quản trị --- */

.qt-bang {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.qt-bang th {
    text-align: left;
    padding: .65rem .75rem;
    background: var(--gray-bg);
    color: var(--text-light);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}

.qt-bang td {
    padding: .65rem .75rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.qt-bang tbody tr:hover { background: #fafbfa; }

/* Dòng của bản ghi đã khóa / vô hiệu hóa / đã hủy */
.qt-bang .hang-mo td,
#tasksTable .hang-mo td { opacity: .55; }

.o-email, .o-ip, .o-gio { font-size: .8rem; color: var(--text-light); white-space: nowrap; }

.o-thao-tac { white-space: nowrap; }

.o-thao-tac .tep-nut { font-size: 1.05rem; }

.o-thao-tac .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .7rem;
    font-size: .8rem;
}

.nut-nho {
    padding: .3rem .6rem !important;
    font-size: .78rem !important;
    margin-left: .4rem;
}

.status-pill.khoa { background: var(--gray-bg); color: var(--text-light); }

.role-pill.role-chutich,
.role-pill.role-phochutich { background: var(--info-bg); color: var(--info); }

.role-pill.role-truongdonvi { background: var(--success-bg); color: var(--primary-dark); }

.role-pill.role-admin { background: var(--warning-bg); color: var(--warning); }

/* --- Form trong vùng thao tác --- */

.qt-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 11px;
    padding: 1.1rem 1.25rem;
}

.qt-form h4 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.qt-form .truong { margin-bottom: 1rem; }

.qt-hang {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 1rem;
}

.truong input[type="text"],
.truong input[type="email"],
.truong input[type="number"],
.truong input[type="date"] {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .88rem;
    color: var(--text);
    background: white;
}

.truong input:focus { outline: none; border-color: var(--primary); }

.truong select[multiple] {
    padding: .35rem;
    height: auto;
}

.truong select option:disabled { color: var(--text-light); }

.hang-radio { display: flex; gap: 1.25rem; }

.o-radio {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    cursor: pointer;
}

.o-tick {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--text-light);
    cursor: pointer;
    white-space: nowrap;
}

.day-phai { margin-left: auto; }

/* --- Mật khẩu hiện một lần --- */

.mat-khau-mot-lan {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: .6rem 0;
    flex-wrap: wrap;
}

.mat-khau-mot-lan code {
    flex: 1;
    min-width: 180px;
    padding: .55rem .8rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 1rem;
    letter-spacing: .04em;
    user-select: all;
}

/* --- Chốt kỳ bị chặn: hai danh sách --- */

.chan-chot-ky { max-width: 720px; }

.nhom-chan { margin-top: .9rem; }

.nhom-chan h5 {
    font-size: .88rem;
    font-weight: 600;
    margin-bottom: .15rem;
}

.ds-chan {
    list-style: none;
    margin-top: .5rem;
}

.ds-chan li {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .5rem .7rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: .4rem;
    font-size: .84rem;
}

.ds-chan .ten-viec { flex: 1; min-width: 160px; }

.ds-chan button {
    padding: .3rem .7rem;
    font-size: .78rem;
}

@media (max-width: 640px) {
    .qt-dau { flex-direction: column; }
    .day-phai { margin-left: 0; }
    .qt-bang { font-size: .8rem; }
}

/* ============ G7g: SỬA / HỦY NHIỆM VỤ ============ */

.btn-nguy-hiem {
    background: white;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.btn-nguy-hiem:hover { background: var(--danger); color: white; }

/* Khu hủy nhiệm vụ — tách hẳn khỏi các nút nghiệp vụ ở trên */
.vung-nguy-hiem { border-top: 2px solid var(--danger-bg); }

.nguy-hiem-dau {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.nguy-hiem-dau h4 {
    font-size: .92rem;
    font-weight: 600;
    color: var(--danger);
}

.xn-huy {
    border: 1px solid var(--danger);
    background: var(--danger-bg);
    color: #7f1d1d;
}

.xn-huy .ghi-chu-nho { color: #7f1d1d; }

.task-pills { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
