/* ==========================================================================
   Giao diện theo mẫu (10/2026) — nạp SAU app.css, ghi đè các quy tắc trùng.
   Thanh bên đỏ tươi có hình núi, thanh trên trắng, tiêu đề có biểu tượng,
   thẻ số liệu có biểu tượng tròn và nhãn %, cảnh báo dạng thẻ nền nhạt.
   ========================================================================== */
:root {
  --red-600: #c0151c;          /* màu chính (5,9:1 trên nền trắng) */
  --red-700: #a91219;
  --red-800: #8e1016;
  --side-top: #c8171f;
  --side-bottom: #9c1117;
  --card-border: #e7e9ee;
  --card-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --radius: 12px;
  --bs-link-color-rgb: 192, 21, 28;
  --bs-link-hover-color-rgb: 142, 16, 22;
}
.card, .dept-card, .task-card { border-color: var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--radius); }

/* ---------- Thanh bên ---------- */
.sidebar, .sidebar.offcanvas-lg {
  border-top: 0;
  /* Cùng nền với khối đỏ bên trái trang đăng nhập: gradient đỏ + ngôi sao vàng lớn, mờ ở góc dưới bên phải. */
  background-color: var(--red-800);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='50,0 61.8,35.4 100,35.4 69.1,57.3 80.9,92.7 50,70.8 19.1,92.7 30.9,57.3 0,35.4 38.2,35.4' fill='%23f2c94c' fill-opacity='.09'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 0% 0%, var(--red-700) 0%, var(--red-800) 55%, var(--red-900) 100%);
  background-repeat: no-repeat;
  background-position: right -70px bottom -50px, 0 0;
  background-size: 300px 300px, 100% 100%;
}
@media (min-width: 992px) {
  .sidebar.offcanvas-lg { background-color: var(--red-800) !important; }
  .sidebar { transition: transform .2s ease; }
  .has-shell .shell { transition: margin-left .2s ease; }
  .sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-collapsed.has-shell .shell { margin-left: 0; }
}
.sidebar-brand { padding: 1rem 1rem .95rem; border-bottom-color: rgba(255, 255, 255, .14); }
.sidebar .brand-logo { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.side-link { color: rgba(255, 255, 255, .92); min-height: 44px; }
.side-link .ic { width: 21px; height: 21px; }
.side-link:hover { background: rgba(255, 255, 255, .10); }
.side-link.active { background: rgba(255, 255, 255, .20); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.side-link.active::before { display: none; }
.side-count { background: #fff; color: var(--red-600); }
.side-group { text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; color: rgba(255, 255, 255, .72); }
.sidebar-foot { padding: .6rem .65rem .8rem; border-top-color: rgba(255, 255, 255, .14); }
.sidebar-account { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 48px; padding: .45rem .7rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: #fff; text-align: left; }
.sidebar-account:hover, .sidebar-account[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.sidebar-account-text .sidebar-user { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-text .sidebar-role { font-size: .76rem; color: rgba(255, 255, 255, .8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account .ic-chevron { width: 16px; height: 16px; opacity: .85; }
.sidebar-foot .dropdown-menu { min-width: 220px; }

/* ---------- Thanh trên: trắng ở mọi màn hình ---------- */
.topbar { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--card-border); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.topbar-btn:hover, .topbar-user:hover { background: var(--line-2); }
.topbar-menu { background: #f3f4f6; }
.topbar-brand { color: var(--red-600); }
.topbar-brand:hover { color: var(--red-700); }
.topbar-brand .brand-logo { box-shadow: none; }
.avatar { background: var(--red-600); color: #fff; }
.bell-count { background: var(--red-600); color: #fff; box-shadow: 0 0 0 2px #fff; }
@media (min-width: 992px) { .topbar { padding: 0 1.5rem; gap: .75rem; } }

/* ---------- Tiêu đề trang, tiêu đề phần có biểu tượng ---------- */
.page-head { align-items: center; }
.page-head-main { display: flex; align-items: center; gap: .85rem; min-width: 0; }
/* Khối tiêu đề dùng chung: biểu tượng bên trái, tiêu đề và dòng phụ xếp chồng bên phải. */
.page-titles { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .85rem; align-items: center; min-width: 0; }
.page-titles > .page-icon { grid-row: span 2; }
.page-titles:not(:has(> .page-sub)) > .page-icon { grid-row: auto; }
.page-titles > .page-title, .page-titles > .page-sub { grid-column: 2; }
.page-titles > .page-sub { margin-top: .15rem; }
.page-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 12px; background: var(--red-50); color: var(--red-600); }
.page-icon .ic { width: 24px; height: 24px; }
@media (max-width: 575.98px) { .page-icon { width: 38px; height: 38px; border-radius: 10px; } .page-icon .ic { width: 20px; height: 20px; } }
.section-title { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.section-title > .ic { width: 20px; height: 20px; color: var(--red-600); }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.card-title-row h2 { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 700; margin: 0; }
.card-title-row h2 .ic { color: var(--red-600); }
.card-title-row p { margin: .2rem 0 0; }

/* ---------- Ô lọc có biểu tượng phía trước ---------- */
.field-icon { position: relative; }
.field-icon > .ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; z-index: 1; }
.field-icon > .form-select, .field-icon > .form-control { padding-left: 2.2rem; }

/* ---------- Nút ---------- */
.btn .ic { width: 17px; height: 17px; vertical-align: -3px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-excel { color: #107c41; border: 1px solid #9fd3b6; background: #f3fbf6; }
.btn-excel:hover, .btn-excel:focus { color: #fff; background: #107c41; border-color: #107c41; }
.btn-word { color: #185abd; border: 1px solid #a9c3ec; background: #f4f8fe; }
.btn-word:hover, .btn-word:focus { color: #fff; background: #185abd; border-color: #185abd; }
.btn-soft-brand { color: var(--red-600); border: 1px solid #f0b9bb; background: #fff; }
.btn-soft-brand:hover, .btn-soft-brand:focus, .btn-soft-brand[aria-expanded="true"] { color: #fff; background: var(--red-600); border-color: var(--red-600); }

/* ---------- Thẻ chỉ số (KPI) ---------- */
.kpi-grid { display: grid; gap: .85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.kpi { display: flex; align-items: center; gap: .75rem; height: 100%; padding: .85rem .9rem; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); color: inherit; text-decoration: none; }
a.kpi:hover { box-shadow: var(--shadow-2); color: inherit; }
a.kpi:hover .kpi-num { text-decoration: underline; text-decoration-thickness: 2px; }
.kpi.edge-ok { border-left: 4px solid var(--ok); }
.kpi.edge-info { border-left: 4px solid var(--info); }
.kpi.edge-danger { border-left: 4px solid var(--danger); }
.kpi.edge-warn { border-left: 4px solid var(--gold-500); }
.kpi-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none; }
.kpi-icon .ic { width: 23px; height: 23px; stroke-width: 2; }
.t-neutral.kpi-icon { background: #eef0f3; color: #4b5563; }
.t-ok.kpi-icon { background: var(--ok-bg); color: var(--ok); }
.t-info.kpi-icon { background: var(--info-bg); color: var(--info); }
.t-danger.kpi-icon { background: var(--danger-bg); color: var(--danger); }
.t-warn.kpi-icon { background: var(--warn-bg); color: #b07a00; }
.kpi-body { min-width: 0; flex: 1 1 auto; }
.kpi-label { font-size: .85rem; color: var(--muted); font-weight: 500; line-height: 1.3; }
.kpi-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .15rem; }
.kpi-num { font-size: 1.85rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .78rem; color: var(--muted); margin-top: .2rem; line-height: 1.35; }
.kpi-sub a { color: inherit; }
.kpi-plain { font-size: .85rem; line-height: 1.6; }
.pct { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-ok.pct { background: var(--ok-bg); color: var(--ok); }
.t-info.pct { background: var(--info-bg); color: var(--info); }
.t-danger.pct { background: var(--danger-bg); color: var(--danger); }
.t-warn.pct { background: var(--warn-bg); color: var(--warn); }
.num-ok { color: var(--ok); } .num-info { color: var(--info); } .num-danger { color: var(--danger); } .num-warn { color: #b07a00; }
/* 6 thẻ trên một hàng ở màn hình PC vừa: thu gọn biểu tượng để nhãn đủ chỗ. */
@media (min-width: 1200px) and (max-width: 1599.98px) {
  .kpi { gap: .55rem; padding: .8rem .7rem; }
  .kpi-icon { width: 34px; height: 34px; }
  .kpi-icon .ic { width: 18px; height: 18px; }
  .kpi-label { font-size: .8rem; }
  .kpi-num { font-size: 1.65rem; }
  .pct { padding: .1rem .4rem; font-size: .74rem; }
}
@media (max-width: 399.98px) { .kpi { gap: .6rem; padding: .75rem; } .kpi-icon { width: 38px; height: 38px; } .kpi-num { font-size: 1.5rem; } }

/* ---------- Dải tỷ lệ có thanh tiến độ ---------- */
.rates { display: grid; grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--card-shadow); }
@media (min-width: 768px) { .rates { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rate { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; color: inherit; text-decoration: none; }
a.rate:hover .rate-num { text-decoration: underline; }
.rate + .rate { border-top: 1px solid #eef0f3; }
@media (min-width: 768px) { .rate + .rate { border-top: 0; border-left: 1px solid #eef0f3; } }
.rate-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; flex: none; }
.rate-icon .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.rate-body { flex: 1 1 auto; min-width: 0; }
.rate-label { font-size: .88rem; color: var(--ink-2); font-weight: 500; }
.rate-line { display: flex; align-items: center; gap: .9rem; }
.rate-num { font-size: 1.75rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; min-width: 4.6ch; }
.rate-track { flex: 1 1 auto; height: 8px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.rate-track > span { display: block; height: 100%; border-radius: inherit; }
.rate.t-ok .rate-icon { background: var(--ok-bg); color: var(--ok); } .rate.t-ok .rate-num { color: var(--ok); } .rate.t-ok .rate-track > span { background: #6cc596; }
.rate.t-info .rate-icon { background: var(--info-bg); color: var(--info); } .rate.t-info .rate-num { color: var(--info); } .rate.t-info .rate-track > span { background: #8db8e8; }
.rate.t-danger .rate-icon { background: var(--danger-bg); color: var(--danger); } .rate.t-danger .rate-num { color: var(--danger); } .rate.t-danger .rate-track > span { background: #f19c96; }

/* ---------- Cảnh báo dạng thẻ có nền màu nhạt ---------- */
.alert-card { display: flex; flex-direction: column; height: 100%; padding: .9rem 1rem; border-radius: var(--radius); border: 1px solid; }
.alert-card.t-danger { background: #fff5f5; border-color: #f6c9c6; }
.alert-card.t-warn { background: #fffbeb; border-color: #f4dfa1; }
.alert-card.t-orange { background: #fff7ed; border-color: #f8d2a7; }
.alert-card-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .55rem; }
.alert-card-head .ic { width: 22px; height: 22px; flex: none; stroke-width: 2; }
.alert-card.t-danger .alert-card-head { color: var(--danger); }
.alert-card.t-warn .alert-card-head { color: #a16207; }
.alert-card.t-orange .alert-card-head { color: #c2410c; }
.alert-card-head h3 { font-size: .95rem; font-weight: 700; margin: 0; color: inherit; flex: 1 1 auto; }
.alert-card-head .alert-count { font-weight: 700; font-size: 1.1rem; color: inherit; }
.alert-card ul { list-style: none; padding: 0; margin: 0; flex: 1 1 auto; }
.alert-card li { padding: .35rem 0; border-bottom: 1px dashed rgba(0, 0, 0, .08); font-size: .87rem; }
.alert-card li:last-child { border-bottom: 0; }
.alert-card li a { color: var(--ink); text-decoration: none; font-weight: 500; }
.alert-card li a:hover { color: var(--red-600); text-decoration: underline; }
.alert-card .alert-empty { flex: 1 1 auto; font-size: .87rem; color: var(--muted); margin: 0; }
.alert-card .alert-more { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; padding-top: .4rem; font-size: .85rem; color: var(--ink-2); text-decoration: none; }
.alert-card .alert-more:hover { color: var(--red-600); }
.alert-card .alert-more .ic { width: 16px; height: 16px; }

/* ---------- Bảng ---------- */
.row-total td { background: #fafbfc; font-weight: 600; }
.chart-table { margin-top: .75rem; }
.table thead th, .table .table-light th { background: #f8f9fb; }

/* ---------- Chọn nhiều nhiệm vụ để xóa (Quản trị hệ thống) ---------- */
.bulk-bar { border-left: 4px solid var(--danger); }
.bulk-check { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.task-card-wrap { position: relative; }
.task-card-wrap .task-card { padding-bottom: 2.6rem; }
.task-select { position: absolute; right: .35rem; bottom: .2rem; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; cursor: pointer; z-index: 2; }
.task-select .bulk-check { width: 1.25rem; height: 1.25rem; }
.audit-lock { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; flex: none; margin-top: .15rem; }
.min-w-0 { min-width: 0; }

/* ---------- Ô nhập % của hạng mục con ---------- */
.subtask-pct { display: inline-flex; align-items: center; gap: .3rem; margin: 0; flex: none; }
.subtask-pct .form-control { width: 4.6rem; text-align: right; }
