/* app.css — giao diện Quản lý Đấu thầu (Bản Local R2)
   Bố cục: sidebar cố định bên trái + vùng nội dung cuộn.
   Khi IN (Ctrl+P hoặc nút "In / Xuất PDF") sidebar và mọi nút bấm bị ẩn,
   trang trở về dạng báo cáo một cột — xem khối @media print ở cuối file. */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Nền & bề mặt */
  --bg: #f4f6fa; --card: #ffffff; --surface-2: #f8fafc; --border: #e4e9f2;
  /* Chữ */
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --faint: #94a3b8;
  /* Màu chức năng */
  --primary: #2563eb; --primary-dark: #1d4ed8; --primary-soft: #eff6ff;
  --green: #16a34a; --amber: #d97706; --red: #dc2626; --purple: #7c3aed; --slate: #64748b;
  /* Trạng thái mục con — dùng thống nhất ở thanh xếp chồng, vòng tròn, badge */
  --done: #16a34a; --doing: #2563eb; --pending: #cbd5e1;
  /* Nhịp khoảng cách */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 22px; --sp-6: 30px;
  /* Đổ bóng & bo góc */
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.07);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
  --radius: 12px; --radius-sm: 8px;
  --side-w: 232px; --side-w-mini: 62px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 45%, #2563eb 100%); }
.login-box { background: var(--card); padding: 38px 34px; border-radius: 16px; width: 372px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { font-size: 42px; margin-bottom: 8px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 22px; }
.login-box label { display: block; text-align: left; font-weight: 600; margin-bottom: 14px; color: var(--text-2); }
.login-box input { width: 100%; margin-top: 5px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* ===== Inputs & buttons ===== */
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm);
  background: #fff; color: var(--text); width: 100%; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
input[type="range"] { padding: 0; border: none; }
input[type="checkbox"], input[type="radio"] { width: auto; }
select { cursor: pointer; }

.btn { font: inherit; font-weight: 600; padding: 8px 15px; border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; background: #eef2f7; color: var(--text-2); transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap; }
.btn:hover { background: #e2e8f0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-2); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.error-msg { background: #fee2e2; color: var(--red); padding: 9px 13px; border-radius: var(--radius-sm);
  margin-bottom: 12px; font-size: 13px; }

/* ===== Khung tổng: sidebar + nội dung ===== */
.shell { display: flex; min-height: 100vh; }

.sidebar { width: var(--side-w); flex: 0 0 var(--side-w); background: #fbfcfe; color: var(--text-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh;
  transition: width .16s, flex-basis .16s; }
.sidebar.mini { width: var(--side-w-mini); flex-basis: var(--side-w-mini); }

.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px;
  border-bottom: 1px solid var(--border); position: relative; }
.side-logo { font-size: 22px; line-height: 1; }
.side-title { font-weight: 700; font-size: 14.5px; color: var(--text); display: flex; flex-direction: column; line-height: 1.25; }
.side-title small { font-weight: 500; font-size: 11px; color: var(--muted); }
.side-collapse { position: absolute; right: -11px; top: 20px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; z-index: 60;
  box-shadow: var(--shadow); }
.side-collapse:hover { color: var(--primary); border-color: var(--primary); }
.sidebar.mini .side-title { display: none; }
.sidebar.mini .side-collapse { transform: rotate(180deg); }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; flex: 1; overflow-y: auto; }
.side-nav .tab { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-2); font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s, color .12s;
  position: relative; user-select: none; }
.side-nav .tab .ic { font-size: 15px; width: 18px; text-align: center; flex: 0 0 18px; }
.side-nav .tab:hover { background: #eef2f8; color: var(--text); }
/* Thẻ đang mở: nền xanh nhạt + vạch xanh bên trái — nổi vừa đủ trên nền sáng */
.side-nav .tab.active { background: #e8eefc; color: #1d4ed8; box-shadow: inset 3px 0 0 var(--primary); }
.side-nav .tab.active:hover { background: #dde7fb; color: #1d4ed8; }



/* Thẻ notification */
.notif-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start;
  transition: background .12s;
}
.notif-item.unread { border-left: 3px solid var(--primary); background: #f0f5ff; }
.notif-item .notif-icon { font-size: 20px; flex: 0 0 24px; }
.notif-item .notif-body { flex: 1; }
.notif-item .notif-title { font-weight: 600; margin-bottom: 4px; }
.notif-item .notif-msg { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.notif-item .notif-meta { font-size: 11.5px; color: var(--faint); }
.notif-item .notif-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.notif-item .notif-actions button {
  background: transparent; border: 1px solid var(--border); padding: 4px 8px;
  border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--muted);
}
.notif-item .notif-actions button:hover { background: var(--surface-2); color: var(--text); }

/* ===== Notification Badge & Dropdown ===== */
.notif-badge {
  margin-left: auto;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.4);
  animation: pulse-red 2s infinite ease-in-out;
  transform-origin: center center;
}
.notif-badge:hover {
  transform: scale(1.15);
}
.notif-badge.zero {
  background: var(--muted);
}
.notif-badge:empty,
.notif-badge[hidden],
.notif-badge[style*="display: none"] {
  display: none !important;
}
@keyframes pulse-red {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.sidebar.mini .notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  margin-left: 0;
  min-width: 14px;
  height: 14px;
  font-size: 9px;
  padding: 0 2px;
}

/* ===== Bell chuông rung cho KPI TKĐT ===== */
.kpi-bell {
  margin-left: auto;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transform-origin: top center;
  animation: bell-ring 1.3s infinite ease-in-out;
  filter: drop-shadow(0 1px 2px rgba(217, 119, 6, 0.4));
  flex-shrink: 0;
}
.kpi-bell[hidden] {
  display: none !important;
}
.sidebar.mini .kpi-bell {
  position: absolute;
  top: 4px;
  right: 4px;
  margin-left: 0;
  font-size: 12px;
}

/* ===== Chuông xoay đỏ báo quá hạn trên Dashboard ===== */
.dash-overdue-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 50%;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}
.dash-overdue-btn:hover {
  background: rgba(220, 38, 38, 0.15);
}
.dash-overdue-btn.has-overdue {
  opacity: 1;
  pointer-events: auto;
  animation: beacon-spin 1.2s linear infinite;
  color: #dc2626;
  filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.7));
}
@keyframes beacon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes bell-ring {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(18deg); }
  20% { transform: rotate(-16deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-10deg); }
  50% { transform: rotate(5deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.notif-dropdown {
  position: fixed;
  left: 260px;
  bottom: 20px;
  width: 380px;
  max-height: 500px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.notif-title { font-weight: 700; font-size: 14px; }
.notif-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 2px 6px;
}
.notif-close:hover { color: var(--red); }
.notif-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}
.notif-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: #dde7fb; }
.notif-item-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.notif-item-msg { font-size: 12px; color: var(--text-2); }
.notif-item-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); }
.notif-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.notif-dropdown[hidden] { display: none; }

.side-foot { border-top: 1px solid var(--border); padding: 12px 12px 14px; position: relative; flex-shrink: 0; background: inherit; }
.side-user { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.side-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.side-avatar.is-admin { background: var(--purple); }
.side-who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.side-who b { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-who span { color: var(--muted); font-size: 11.5px; }
.mini-logout-btn { background: #fee2e2; border: 1px solid #fecaca; color: var(--red); padding: 4px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.mini-logout-btn:hover { background: #fecaca; }
.sidebar.mini .mini-logout-btn { display: inline-flex !important; margin-left: 2px; }
.side-actions { display: flex; gap: 6px; }
.side-actions .btn { flex: 1; }
.sidebar.mini .side-who, .sidebar.mini .side-actions { display: none; }
.sidebar.mini .side-user { justify-content: center; }

.container { flex: 1; min-width: 0; max-width: 1420px; padding: var(--sp-5) var(--sp-6); }
.page { display: none; }
.page.active { display: block; }
[hidden] { display: none !important; }
/* .manager-only / .employee-only: bật tắt theo vai trò trong app.js */ /* attribute hidden phải thắng mọi display của CSS */

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: var(--sp-4); flex-wrap: wrap; }
.page-head h2 { font-size: 21px; letter-spacing: -.01em; }
.row-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
/* Ô hành động cuối bảng: giữ các nút trên một hàng, không bẻ chữ "Sửa" / "Xóa" */
td:last-child { white-space: nowrap; }
td.row-actions { display: table-cell; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--muted); font-weight: 600; white-space: nowrap; }
.inline-field input, .inline-field select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.inline-field input[type="number"] { width: 64px; }
.filter-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.scope-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 12.5px;
  padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: var(--sp-4); }

/* ===== Cards & KPI ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-4) 18px; margin-bottom: var(--sp-4); }
.card h3 { font-size: 15px; margin-bottom: var(--sp-3); display: flex; align-items: baseline; gap: 6px; }
.card h3 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-2); }
.card-head h3 { margin-bottom: 0; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-bottom: var(--sp-3); }
.hint b { color: var(--text-2); }
.callout { border-left: 4px solid var(--primary); background: linear-gradient(180deg, var(--primary-soft) 0%, #fff 55%); }
.steps { margin: 0 0 var(--sp-3) 20px; font-size: 13.5px; color: var(--text-2); line-height: 1.85; }
.warn-box { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 12.5px;
  padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: var(--sp-3); line-height: 1.6; }
.success-box { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 12.5px;
  padding: 9px 12px; border-radius: var(--radius-sm); margin-top: 8px; line-height: 1.6; }

/* ===== Feedback ===== */
.fb-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; transition: all 0.15s ease; }
.fb-item.open { border-left: 3px solid var(--amber); }
.fb-item.resolved { border-left: 3px solid var(--green); opacity: 0.85; }
.fb-item.hidden-item { border-left: 3px solid #94a3b8; opacity: 0.65; background: #f8fafc; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fb-body { color: var(--text); font-size: 13.5px; line-height: 1.55; }
.fb-resolve { margin-top: 6px; font-size: 12px; color: var(--green); }
.fb-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }

/* ===== Drag & Drop ===== */
.drag-handle { cursor: grab; color: var(--muted); margin-right: 4px; user-select: none; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
tr.proj-row { transition: background .1s; }
tr.proj-row:hover { background: var(--hover); }
.drag-over { background: var(--highlight) !important; }

/* ===== Badge màu ===== */
.b-slate { background: #e2e8f0; color: #475569; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: var(--sp-3);
  margin-bottom: var(--sp-4); }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 13px 15px; border-top: 3px solid var(--primary); }
.kpi .num { font-size: 27px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-size: 12px; margin-top: 1px; }
.kpi.green { border-top-color: var(--green); } .kpi.green .num { color: var(--green); }
.kpi.amber { border-top-color: var(--amber); } .kpi.amber .num { color: var(--amber); }
.kpi.red { border-top-color: var(--red); } .kpi.red .num { color: var(--red); }
.kpi.purple { border-top-color: var(--purple); } .kpi.purple .num { color: var(--purple); }
.kpi.slate { border-top-color: var(--slate); } .kpi.slate .num { color: var(--slate); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== Tables ===== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: var(--surface-2); font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.cell-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.cell-note { color: var(--text-2); font-size: 12.5px; max-width: 320px; display: inline-block;
  white-space: pre-wrap; word-break: break-word; }
.filter-status { font-size: 12px; color: var(--muted); margin-bottom: var(--sp-2); }
.filter-status b { color: var(--text-2); }

/* ===== Badges & progress ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  white-space: nowrap; letter-spacing: .01em; }
.b-green { background: #dcfce7; color: #15803d; }
.b-blue { background: #dbeafe; color: #1d4ed8; }
.b-amber { background: #fef3c7; color: #b45309; }
.b-red { background: #fee2e2; color: #b91c1c; }
.b-gray { background: #e9edf4; color: #475569; }
.b-purple { background: #ede9fe; color: #6d28d9; }
.progress { background: #e6ebf3; border-radius: 99px; height: 7px; width: 104px; overflow: hidden;
  display: inline-block; vertical-align: middle; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .25s; }
.progress.done > i { background: var(--green); }
.pct-label { font-size: 12.5px; font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ===== Alerts ===== */
.alert-item { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13.5px; }
.alert-red { background: #fef2f2; border: 1px solid #fecaca; }
.alert-amber { background: #fffbeb; border: 1px solid #fde68a; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.alert-critical-card { border: 1.5px solid #f87171; background: linear-gradient(180deg, #fff5f5 0%, #fff 60%); }
.alert-critical-card > h3 { color: #b91c1c; }

/* ===== Tổng quan triển khai: thanh xếp chồng Done/Doing/Pending ===== */
.stack-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-size: 12px; color: var(--muted);
  margin-bottom: var(--sp-3); }
.stack-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.lg-done { background: var(--done); } .lg-doing { background: var(--doing); } .lg-pending { background: var(--pending); }

.stack-row { display: grid; grid-template-columns: 190px 1fr 74px; align-items: center; gap: var(--sp-3);
  padding: 5px 0; }
.stack-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-name b { font-weight: 700; }
.stack-name small { color: var(--muted); }
.stack-bar { display: flex; height: 18px; border-radius: 5px; overflow: hidden; background: #eef2f7; }
.stack-bar span { display: block; font-size: 10.5px; font-weight: 700; color: #fff; line-height: 18px;
  text-align: center; overflow: hidden; }
.sg-done { background: var(--done); } .sg-doing { background: var(--doing); }
.sg-pending { background: var(--pending); color: #475569 !important; }
.stack-meta { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.trend-wrap { margin-top: var(--sp-4); border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.trend-wrap h4 { font-size: 12.5px; color: var(--muted); margin-bottom: var(--sp-2); font-weight: 700; }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 74px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 3px; min-width: 0; }
.trend-bar { width: 100%; max-width: 26px; border-radius: 3px 3px 0 0; background: var(--done); min-height: 2px; }
.trend-bar.zero { background: #e6ebf3; }
.trend-num { font-size: 10px; font-weight: 700; color: var(--muted); }
.trend-lbl { font-size: 9.5px; color: var(--faint); white-space: nowrap; }
.trend-col.today .trend-lbl { color: var(--primary); font-weight: 700; }
.trend-col.due .trend-lbl::after { content: ' •'; color: var(--red); }

/* ===== Thẻ tiến độ từng dự án ===== */
.progress-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--sp-3); }
.pcard { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
  background: var(--card); position: relative; }
.pcard.is-late { border-color: #fca5a5; background: linear-gradient(180deg, #fff6f6 0%, #fff 45%); }
.pcard-tools { position: absolute; top: 7px; right: 8px; display: flex; gap: 2px; }
.pcard-x, .pcard-del { border: none; background: none; color: var(--faint);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 5px; border-radius: 5px; }
.pcard-x:hover { color: var(--text-2); background: var(--surface-2); }
.pcard-del:hover { color: var(--red); background: #fee2e2; }
.pcard h4 { font-size: 13.5px; line-height: 1.35; margin-bottom: 2px; padding-right: 48px; }
.pcard .pcard-sub { font-size: 11.5px; color: var(--muted); margin-bottom: var(--sp-3); }
.pcard-body { display: flex; align-items: center; gap: var(--sp-4); }
.donut { flex: 0 0 78px; width: 78px; height: 78px; border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center; }
.donut::after { content: ''; position: absolute; inset: 11px; background: var(--card); border-radius: 50%; }
.donut-num { position: relative; z-index: 1; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.pcard-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.pcard-legend div { display: flex; align-items: center; gap: 6px; }
.pcard-legend i { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }
.pcard-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.pcard-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: var(--sp-3); }
.pcard-people { margin-top: var(--sp-3); border-top: 1px dashed var(--border); padding-top: var(--sp-2);
  display: flex; flex-direction: column; gap: 5px; }
.ppl-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; font-size: 12px; }
.ppl-row .ppl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppl-row .ppl-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.ppl-row .ppl-late { color: var(--red); font-weight: 700; font-size: 11px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-3); align-items: center; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px;
  padding: 3px 10px; font-size: 11.5px; color: var(--muted); cursor: pointer; font-weight: 600; }
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ===== Charts (S/M/L + 2D/3D) ===== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--sp-4); }
.chart-card { position: relative; }
/* Chừa chỗ cho cụm nút 2D/3D + S/M/L ở góc phải, tránh tiêu đề dài chui xuống dưới nút */
.chart-card h3 { padding-right: 168px; min-height: 22px; }
.chart-card.size-L { grid-column: 1 / -1; }
.chart-card .chart-tools { display: flex; gap: 4px; position: absolute; top: 10px; right: 12px; }
.chart-tools .btn { padding: 3px 8px; font-size: 11.5px; }
.chart-tools .btn.on { background: var(--primary); color: #fff; }

/* ===== Sơ đồ tiến độ theo ngày (Gantt 30 ngày) ===== */
.schedule-wrap { overflow-x: auto; }
.sched-grid { display: grid; min-width: 1150px; font-size: 12px; } /* 30 cột ngày */
.sched-head { font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0;
  border-bottom: 1px solid var(--border); font-size: 10.5px; line-height: 1.25; }
.sched-head.today { color: var(--primary); }
.sched-head.weekend { color: #cbd5e1; }
.sched-label { padding: 6px 8px 6px 0; border-bottom: 1px dashed var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.sched-label small { color: var(--muted); }
.sched-cell { border-bottom: 1px dashed var(--border); border-left: 1px solid #f1f5f9; position: relative; }
.sched-cell.today { background: var(--primary-soft); }
.sched-bar { position: absolute; inset: 6px 1px; border-radius: 4px; }
.sb-red { background: #fca5a5; } .sb-red.sb-end { background: var(--red); }
.sb-amber { background: #fcd34d; } .sb-amber.sb-end { background: var(--amber); }
.sb-green { background: #86efac; } .sb-green.sb-end { background: var(--green); }
.sb-purple { background: #c4b5fd; } .sb-purple.sb-end { background: var(--purple); }
.sb-gray { background: #cbd5e1; } .sb-gray.sb-end { background: #64748b; }
.sched-days-left { font-size: 11px; font-weight: 700; padding-left: 6px; white-space: nowrap; }
.schedule-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.schedule-legend .sl { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.sl-red { background: var(--red); } .sl-amber { background: var(--amber); }
.sl-green { background: var(--green); } .sl-purple { background: var(--purple); } .sl-gray { background: #64748b; }

/* ===== Expand rows (subtasks) ===== */
.expander { cursor: pointer; user-select: none; }
.expander .caret { display: inline-block; transition: transform .15s; margin-right: 6px; color: var(--muted); }
.expander.open .caret { transform: rotate(90deg); }
.subtask-row td { background: var(--surface); padding: 0 10px 0 42px; }
.subtask-list { padding: var(--sp-2) 0; }
.subtask-item { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 0; font-size: 13px;
  border-bottom: 1px dashed var(--border); flex-wrap: wrap; transition: background .1s; }
.subtask-item:last-child { border-bottom: none; }
.subtask-item.drag-over { background: var(--highlight); }
.subtask-item .st-title { flex: 1; min-width: 160px; }
.subtask-item .st-owner { color: var(--muted); font-size: 12px; }
.subtask-item .st-note { color: var(--muted); font-size: 12px; flex-basis: 100%; padding-left: 26px; }
.flag-btn { border: none; background: none; cursor: pointer; font-size: 14px; line-height: 1;
  padding: 2px 4px; border-radius: 5px; filter: grayscale(1); opacity: .45; }
.flag-btn:hover { opacity: .9; background: #fef3c7; }
.flag-btn.on { filter: none; opacity: 1; }
.st-status-in { width: 106px; }
.dash-toggle { border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  border-radius: 99px; padding: 2px 9px; font-size: 11px; font-weight: 700; cursor: pointer; }
.dash-toggle.on { background: #dcfce7; border-color: #86efac; color: #15803d; }

/* ===== Note nhanh =====
   Form thêm và mỗi dòng trong danh sách dùng CHUNG một lưới cột, để ô nhập ở form
   thẳng hàng với ô tương ứng bên dưới — mắt không phải dò lại từng cột. */
.note-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.note-form, .note-row {
  display: grid;
  grid-template-columns: minmax(180px, 2.2fr) minmax(150px, 1.8fr) 130px 132px 108px 158px auto;
  gap: var(--sp-2); align-items: center;
  min-width: 950px;
}
.note-row { grid-template-columns: 26px 22px minmax(180px, 2.2fr) minmax(150px, 1.8fr) 130px 132px 108px 158px auto; min-width: 950px; }
.note-list-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 700; padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.note-row { padding: 5px 0; border-bottom: 1px dashed var(--border); }
.note-row:last-child { border-bottom: none; }
.note-row.done { opacity: .6; }
.note-row .note-idx { color: var(--faint); font-size: 12px; text-align: right; }
.note-row .note-conv { padding: 5px 10px; font-size: 12px; }
.note-row input, .note-row select { padding: 6px 8px; font-size: 12.5px; }
.note-row .note-done-tag { grid-column: 3 / -1; font-size: 11.5px; color: var(--green); font-weight: 600; }
.note-actions { display: flex; gap: 5px; align-items: center; }

/* Highlight chớp sáng khi nhảy tới công việc từ thông báo */
@keyframes highlightFlash {
  0% { background: #fef08a; transform: scale(1.01); box-shadow: 0 0 0 3px #facc15; }
  50% { background: #fef9c3; }
  100% { background: transparent; transform: scale(1); box-shadow: none; }
}
.highlight-flash {
  animation: highlightFlash 3s ease-out;
  border-radius: 6px;
}

/* Category filter buttons cho Thông báo */
.notif-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.notif-cat-btn { padding: 4px 10px; font-size: 12px; border-radius: 6px; cursor: pointer; }
.notif-cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
tr.notif-unread { background: rgba(59, 130, 246, 0.05); font-weight: 600; }
tr.notif-row { cursor: pointer; transition: background .15s; }
tr.notif-row:hover { background: var(--surface-2); }

/* Nút cờ trong subtask filter bar */
.filter-btn.flag-filter.active {
  background: #fef3c7;
  color: #b45309;
  border-color: #f59e0b;
  font-weight: 700;
}

/* Badge màu cam cho Quản lý trung */
.b-amber { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* ===== Bộ đếm nhỏ cạnh tiêu đề trang ===== */
.head-count { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ===== Lịch sử hoạt động ===== */
.act-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.act-access { background: #dbeafe; color: #1d4ed8; }
.act-data   { background: #dcfce7; color: #15803d; }
.act-admin  { background: #ede9fe; color: #6d28d9; }
.act-warn   { background: #fee2e2; color: #b91c1c; }
#actTable td { font-size: 12.5px; }
#actTable td:nth-child(2), #actTable td:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none;
  align-items: flex-start; justify-content: center; z-index: 100; padding: 44px 16px; overflow-y: auto; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; padding: 24px;
  box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 17px; margin-bottom: var(--sp-4); }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.modal .form-grid .full { grid-column: 1 / -1; }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.modal label > input, .modal label > select, .modal label > textarea { margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: 18px; }
.member-pick { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.member-pick .mp-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; }
.member-pick .mp-row .mp-name { flex: 1; }
.member-pick .mp-pic { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 3px; }

/* ===== Toast ===== */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #0f172a;
  color: #fff; padding: 10px 20px; border-radius: 99px; font-size: 13.5px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 200; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }

/* ===== Live dot ===== */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block;
  flex: 0 0 8px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ===== Import history detail ===== */
details.err-detail summary { cursor: pointer; color: var(--red); font-size: 12.5px; }
details.err-detail ul { margin: 6px 0 0 18px; font-size: 12.5px; color: var(--text-2); }

/* ===== Guide ===== */
.guide h4 { margin: 16px 0 6px; font-size: 14.5px; }
.guide h4:first-child { margin-top: 0; }
.guide p, .guide li { font-size: 13.5px; line-height: 1.7; color: var(--text-2); }
.guide ul { margin-left: 20px; }
.guide code { background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 12.5px; }

/* ===== Màn hình hẹp: sidebar rút về dạng icon ===== */
@media (max-width: 1000px) {
  .sidebar { width: var(--side-w-mini); flex-basis: var(--side-w-mini); }
  .sidebar .side-title, .sidebar .side-who, .sidebar .side-actions { display: none; }
  .sidebar .side-nav .tab { justify-content: center; padding: 10px 0; }
  .sidebar .side-nav .tab .tx { display: none; }
  .container { padding: var(--sp-4); }
}
@media (max-width: 760px) {
  .modal .form-grid { grid-template-columns: 1fr; }
  .stack-row { grid-template-columns: 120px 1fr 60px; }
  .progress-cards { grid-template-columns: 1fr; }
}

/* ===== KPI TKĐT (thẻ 🎯) =====
   Tiền tố .tk- để không đụng .kpi / .kpi-grid vốn là thẻ số của Dashboard. */
.tk-goal { white-space: pre-wrap; font-size: 13px; line-height: 1.75; color: var(--text-2);
  max-height: 260px; overflow-y: auto; }
.tk-filter { width: auto; max-width: 230px; padding: 5px 8px; font-size: 12.5px; }

/* Tiến độ từng nhóm mục tiêu */
.tk-cat { display: grid; grid-template-columns: minmax(200px, 1.6fr) minmax(160px, 1fr) auto;
  gap: var(--sp-3); align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.tk-cat:last-child { border-bottom: none; }
.tk-cat-name { font-weight: 600; font-size: 13px; color: var(--text-2); }
.tk-cat-bar { display: flex; align-items: center; gap: 6px; }
.tk-cat-bar .progress { flex: 1; height: 9px; }
.tk-cat-bar .pct-label { margin-left: 0; min-width: 38px; text-align: right; }
.tk-cat-meta { display: flex; gap: 6px; justify-content: flex-end; }

/* Bảng kế hoạch hành động */
#kpiTable td { vertical-align: top; }
#kpiTable .tk-title { min-width: 250px; max-width: 380px; font-weight: 600; color: var(--text); }
/* Cột nào cũng cần chỗ thở: thà cho bảng rộng ra và cuộn ngang (.table-wrap) còn hơn
   bóp cột Ghi chú lại thành một chữ mỗi dòng. */
#kpiTable { min-width: 1320px; }
#kpiTable .cell-note { max-width: 260px; }
#kpiTable td:nth-child(3) { min-width: 190px; }
#kpiTable td:nth-child(8) { min-width: 190px; }
.tk-nowrap { white-space: nowrap; }
.tk-row-cat td { background: #eef2fb; font-weight: 700; font-size: 12px; letter-spacing: .03em;
  text-transform: uppercase; color: #1d4ed8; }
.tk-row-sec td { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--text-2);
  padding-left: 24px; }
.tk-row-cat:hover td, .tk-row-sec:hover td { background: inherit; }
.kpi-pct { width: 92px; }

.tk-modal-sep { margin: 18px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; border-top: 1px solid var(--border); padding-top: 12px; }

/* Sơ đồ Gantt */
.tk-gantt { font-size: 12px; }
.tk-g-row { display: grid; grid-template-columns: 230px 1fr 44px; gap: var(--sp-3); align-items: center;
  padding: 5px 0; border-bottom: 1px dashed var(--border); }
.tk-g-row:last-child { border-bottom: none; }
.tk-g-head { position: sticky; top: 0; background: var(--card); z-index: 1; border-bottom: 1px solid var(--border); }
.tk-g-name { font-size: 12px; line-height: 1.35; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tk-g-months { display: flex; font-size: 10.5px; color: var(--muted); text-align: center; }
.tk-g-months span { border-left: 1px solid var(--border); overflow: hidden; }
.tk-g-track { position: relative; height: 22px; background: var(--surface-2); border-radius: 4px; }
.tk-g-bar { position: absolute; height: 8px; border-radius: 99px; }
.tk-b-plan { top: 3px; background: #bfdbfe; }
.tk-b-act  { top: 12px; background: var(--primary); }
.tk-b-done { top: 12px; background: var(--green); }
.tk-b-late { top: 12px; background: var(--red); }
.tk-g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .55; }
.tk-g-pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }
.tk-sl-plan { background: #bfdbfe; } .tk-sl-act { background: var(--primary); }
.tk-sl-done { background: var(--green); } .tk-sl-late { background: var(--red); }

/* Ma trận đào tạo: mỗi ô là 2 dòng — kế hoạch ở trên, thực hiện ở dưới */
.tk-matrix-cell { padding: 5px 6px; }
.tk-cell { display: block; text-align: center; font-size: 11.5px; font-weight: 700; border-radius: 5px;
  padding: 3px 4px; margin-bottom: 3px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; }
.tk-cell:last-child { margin-bottom: 0; }
.tk-cell:hover { border-color: var(--primary); }
.tk-cell-plan { background: #dbeafe; color: #1d4ed8; }
.tk-cell-act { background: #dcfce7; color: #15803d; }
.tk-cell-empty { background: var(--surface-2); color: var(--faint); font-weight: 500; }
.tk-cell-pending {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px dashed #f59e0b !important;
  animation: pulse-border 1.5s infinite ease-in-out;
}
@keyframes pulse-border {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.04); }
}

/* ===== KPI Head Alert & Banner đào tạo ===== */
.kpi-head-alert {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #c2410c;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.12);
  margin-left: 8px;
}
.kpi-head-alert:hover {
  background: #ffedd5;
  border-color: #fb923c;
  transform: translateY(-1px);
}
.kpi-head-alert .kpi-head-bell {
  font-size: 14px;
  display: inline-block;
  transform-origin: top center;
  animation: bell-ring 1.3s infinite ease-in-out;
}

.alert-kpi-train {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a !important;
  border-left: 5px solid #f59e0b !important;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}
.alert-kpi-train-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 50%;
  transform-origin: top center;
  animation: bell-ring 1.5s infinite ease-in-out;
}
.alert-kpi-train-body {
  flex: 1;
  min-width: 0;
}
.alert-kpi-train-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 3px;
}
.alert-kpi-train-desc {
  font-size: 13px;
  color: #78350f;
  line-height: 1.4;
}
.alert-kpi-train-desc b {
  color: #b45309;
}
.alert-kpi-train-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.alert-kpi-train-action .btn-success {
  background: #16a34a;
  color: #fff;
  border: none;
  font-weight: 600;
}
.alert-kpi-train-action .btn-success:hover {
  background: #15803d;
}

/* Khung khoá đào tạo theo cấp */
.tk-course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); }
.tk-course-col h4 { font-size: 12.5px; color: var(--primary); margin-bottom: var(--sp-2);
  text-transform: uppercase; letter-spacing: .03em; }
.tk-course-col ul, .tk-extra ul { list-style: none; }
.tk-course-col li, .tk-extra li { font-size: 12.5px; line-height: 1.6; padding: 3px 0;
  border-bottom: 1px dashed var(--border); color: var(--text-2); }
.tk-course-col li:last-child, .tk-extra li:last-child { border-bottom: none; }
.tk-course-col code, .tk-extra code { background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px;
  padding: 0 5px; font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.tk-extra { margin-top: var(--sp-4); border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.tk-extra h4 { font-size: 12.5px; color: var(--purple); margin-bottom: var(--sp-2);
  text-transform: uppercase; letter-spacing: .03em; }

@media (max-width: 1000px) {
  .tk-cat { grid-template-columns: 1fr; }
  .tk-cat-meta { justify-content: flex-start; }
  .tk-g-row { grid-template-columns: 140px 1fr 40px; }
}

/* ===== BẢN IN / XUẤT PDF =====
   Mục tiêu: ra đúng dạng báo cáo một cột — bỏ sidebar, bỏ mọi nút bấm và ô lọc,
   bung hết nội dung đang cuộn, và không cắt ngang một thẻ / một bảng giữa hai trang. */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  /* BẮT BUỘC: mặc định trình duyệt BỎ mọi màu nền khi in, làm vòng tròn donut, thanh
     xếp chồng Done/Doing/Pending, badge và vạch màu KPI biến mất trắng trơn.
     Dòng này ép in đúng màu như trên màn hình. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff; font-size: 11px; }
  .sidebar, .no-print, .modal-backdrop, #toast, .side-collapse { display: none !important; }
  .shell { display: block; }
  .container { max-width: none; padding: 0; }
  /* Chỉ in trang đang xem */
  .page { display: none !important; }
  .page.active { display: block !important; }
  .card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; border-color: #d7dee9;
    margin-bottom: 10px; padding: 10px 12px; }
  .pcard, .stack-row, .alert-item, tr { break-inside: avoid; page-break-inside: avoid; }
  thead { display: table-header-group; }  /* lặp lại tiêu đề bảng ở mỗi trang */
  .kpi { box-shadow: none; }
  .kpi .num { font-size: 20px; }
  .table-wrap, .schedule-wrap { overflow: visible !important; }
  .progress-cards { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-card.size-L { grid-column: span 2; }
  canvas { max-height: 220px !important; }
  .tk-goal { max-height: none; overflow: visible; }
  .tk-g-head { position: static; }
  .tk-g-row { grid-template-columns: 200px 1fr 40px; }
  a { text-decoration: none; color: inherit; }
}

/* ===== Subtask Filter Bar ===== */
.subtask-filter-bar {
  display: flex;
  gap: 4px;
  padding: 6px 0;
  background: transparent;
  border-radius: 0;
  margin-bottom: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
}
.filter-btn {
  font-size: 11.5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s;
}
.filter-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.filter-btn.active:hover {
  background: var(--primary-dark);
}

/* ===== Subtask Layout - Ghi chú cùng hàng & Màu trạng thái ===== */
.subtask-item {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background .15s, border-color .15s;
}
.subtask-item:hover {
  background: rgba(0, 0, 0, 0.015);
}
.subtask-item.saving { opacity: 0.7; }
.subtask-item.saved { animation: flash-green 0.8s ease-out; }
@keyframes flash-green { 0% { background: #dcfce7; } 100% { background: transparent; } }

.subtask-item .drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 14px;
  color: var(--muted);
  padding: 2px 4px;
  display: flex;
  align-items: center;
}
.subtask-item .drag-handle:active { cursor: grabbing; }

/* Hai ô Nội dung và Ghi chú chia đôi 50/50 */
.subtask-item .st-title-in,
.subtask-item .st-note-in {
  flex: 1 1 0 !important;
  min-width: 130px !important;
}

/* Ô Trạng thái có màu sắc trực quan (nhạt) */
.st-status-in {
  width: 95px !important;
  flex: 0 0 95px !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  padding: 6px 8px !important;
  border-radius: var(--radius-sm) !important;
  transition: all .15s !important;
}
.st-status-in.status-done, .st-status-in[data-val="Done"] {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.st-status-in.status-doing, .st-status-in[data-val="Doing"] {
  background-color: #fef9c3 !important;
  color: #a16207 !important;
  border-color: #fde047 !important;
}
.st-status-in.status-pending, .st-status-in[data-val="Pending"] {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
}

/* Cấp quản lý xem đầy đủ 100% nội dung và ghi chú */
.subtask-item .st-title {
  flex: 1 1 0;
  min-width: 130px;
  font-weight: 600;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
  color: var(--text);
}
.subtask-item .st-note {
  flex: 1 1 0;
  min-width: 130px;
  color: var(--muted);
  font-size: 12.5px;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}
.subtask-item .st-owner {
  color: var(--text-2);
  font-size: 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.subtask-item .st-due {
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ===== Responsive trên thiết bị di động (Mobile) ===== */
@media (max-width: 768px) {
  .shell { display: flex; flex-direction: column; min-height: 100dvh; }
  .sidebar {
    width: 100% !important;
    flex: 0 0 auto !important;
    height: auto !important;
    position: relative !important;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar.mini { width: 100% !important; flex-basis: auto !important; }
  .sidebar.mini .side-title, .sidebar.mini .side-who, .sidebar.mini .side-actions { display: flex !important; }
  .side-collapse { display: none !important; }
  .side-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 8px;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .side-nav .tab {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 12.5px;
  }
  .side-foot {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .side-user { margin-bottom: 0; flex: 1; min-width: 0; }
  .side-actions { flex: 0 0 auto; }
  .side-actions .btn { padding: 5px 9px; font-size: 12px; }
  .container { padding: 14px 10px; }
  .subtask-item { flex-wrap: wrap; }
}

/* v1.0.4 — nút ▲▼ sắp xếp (thứ tự riêng của từng người) */
.move-btns { display: inline-flex; flex-direction: column; gap: 1px; margin-right: 4px; vertical-align: middle; }
.mv-btn {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 11px; line-height: 1; padding: 2px 6px; border-radius: 4px; cursor: pointer;
}
.mv-btn:hover { color: var(--text, inherit); background: var(--highlight); }
.subtask-item .move-btns { flex: 0 0 auto; }
