/* =====================================================================
   CV.CSS — Giao diện mới v3 cho trang Công việc (index.html)
   Tỷ lệ màu 60-30-10: nền xám nhạt · thẻ/bảng trắng · điểm nhấn đỏ thương hiệu.
   Thay thế hoàn toàn css/style.css trên trang này (dms/kms/admin vẫn dùng style.css cũ).
   Bố cục: sidebar trắng cố định 256px | header 64px dính trên | nội dung cuộn theo trang.
   ===================================================================== */

:root {
  --bg: #F1F5F9;            /* slate-100  – 60% nền */
  --bg-soft: #F8FAFC;       /* slate-50 */
  --surface: #FFFFFF;       /* 30% thẻ, bảng */
  --surface-2: #F8FAFC;
  --line: #E2E8F0;          /* slate-200 */
  --line-2: #F1F5F9;
  --ink: #0F172A;           /* slate-900 */
  --ink-2: #334155;         /* slate-700 */
  --muted: #64748B;         /* slate-500 */
  --faint: #94A3B8;         /* slate-400 */
  --accent: #DC2626;        /* red-600 – 10% điểm nhấn */
  --accent-2: #B91C1C;      /* red-700 */
  --accent-soft: #FEF2F2;   /* red-50 */
  --accent-line: #FECACA;   /* red-200 */
  --blue: #2563EB; --blue-soft: #EFF6FF; --blue-line: #DBEAFE;
  --amber: #B45309; --amber-dot: #F59E0B; --amber-soft: #FFFBEB; --amber-line: #FDE68A;
  --green: #047857; --green-dot: #10B981; --green-soft: #ECFDF5; --green-line: #A7F3D0;
  --violet: #6D28D9; --violet-soft: #F5F3FF;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 45px -12px rgba(15, 23, 42, .25);
  --radius: 12px;
  --radius-sm: 8px;
  --side-w: 280px;
  --top-h: 64px;
  --font: "Be Vietnam Pro", Inter, system-ui, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  /* biến cũ còn được portal-access.css dùng */
  --text: var(--ink);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: light; } /* trang tự chọn theo nút, mặc định sáng */
}
:root[data-theme="dark"] {
  --bg: #0B1220; --bg-soft: #0F172A; --surface: #111A2E; --surface-2: #0F172A;
  --line: #1E293B; --line-2: #162036; --ink: #E2E8F0; --ink-2: #CBD5E1; --muted: #94A3B8; --faint: #64748B;
  --accent: #EF4444; --accent-2: #DC2626; --accent-soft: rgba(239, 68, 68, .12); --accent-line: rgba(239, 68, 68, .35);
  --blue: #60A5FA; --blue-soft: rgba(96, 165, 250, .12); --blue-line: rgba(96, 165, 250, .3);
  --amber: #FBBF24; --amber-dot: #F59E0B; --amber-soft: rgba(245, 158, 11, .12); --amber-line: rgba(245, 158, 11, .35);
  --green: #34D399; --green-dot: #10B981; --green-soft: rgba(16, 185, 129, .12); --green-line: rgba(16, 185, 129, .35);
  --violet: #A78BFA; --violet-soft: rgba(167, 139, 250, .12);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 50px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------------- Nền tảng ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.cv {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.cv a { color: inherit; text-decoration: none; }
body.cv h1, body.cv h2, body.cv h3, body.cv h4, body.cv h5, body.cv h6 { color: var(--ink); font-family: var(--font); text-wrap: balance; }
body.cv p { margin: 0; }
body.cv button { font-family: inherit; }
[hidden] { display: none !important; }
.cv-svg { width: 1em; height: 1em; flex: none; display: block; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.cv-mono, .mono { font-family: var(--mono); font-size: .92em; }
.cv-muted { color: var(--muted); }
.cv-select { user-select: all; }
.cv-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-line); }
.cv ::-webkit-scrollbar { width: 9px; height: 9px; }
.cv ::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
[data-theme="dark"] .cv ::-webkit-scrollbar-thumb { background-color: #334155; }
.cv ::-webkit-scrollbar-track { background: transparent; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------------- Nút ---------------- */
.btn-kst {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-kst [data-icon] { font-size: 16px; }
.btn-kst-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-kst-primary:hover { background: var(--accent-2); color: #fff; }
.btn-kst-outline { border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-kst-outline:hover { border-color: #CBD5E1; background: var(--surface-2); color: var(--ink); }
.btn-kst-ghost { background: transparent; color: var(--muted); }
.btn-kst-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-kst-danger { background: var(--accent); color: #fff; }
.btn-kst-amber { background: var(--amber-dot); color: #fff; }
.btn-kst:disabled { opacity: .55; cursor: not-allowed; }
.cv-btn-block { width: 100%; height: 42px; }

.cv-icon-btn, .header-icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 0; background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer; transition: background .15s, color .15s;
}
.cv-icon-btn:hover, .header-icon-btn:hover { background: var(--line-2); color: var(--ink); }
.cv-icon-btn.sm { width: 30px; height: 30px; font-size: 16px; }
.cv-chip-btn { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.cv-chip-btn:hover { background: var(--line); }

/* Ô chọn & ô nhập trong thanh lọc */
.filter-bar select, .calendar-selects select, .cv-filter select,
.cv-field input, .cv-field textarea, .table-search-box input {
  height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background-color: var(--surface); color: var(--ink); font: 500 13px/1 var(--font); padding: 0 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.filter-bar select, .calendar-selects select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.filter-bar select:focus, .calendar-selects select:focus, .cv-field input:focus, .cv-field textarea:focus, .table-search-box input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.cv-field textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }

/* ---------------- Khung ứng dụng ---------------- */
.cv-shell { min-height: 100vh; }
.cv-main { margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* Sidebar */
.cv-side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 60;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px);
  transition: transform .25s ease;
}
.cv-brand { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); }
.cv-logo {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; letter-spacing: .04em;
}
.cv-logo.lg { width: 52px; height: 52px; border-radius: 13px; font-size: 18px; }
.cv-brand-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cv-brand-title { font-size: 12.5px; font-weight: 800; color: var(--ink); text-transform: uppercase; letter-spacing: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-brand-sub { font-size: 11.5px; color: var(--faint); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-side-close { display: none; }

.cv-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.cv-nav-group { margin: 16px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.cv-nav .sidebar-link {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; transition: background .15s, color .15s;
}
.cv-nav .sidebar-link:hover { background: var(--bg-soft); color: var(--ink); }
.cv-nav .sidebar-icon { font-size: 18px; color: var(--faint); width: 18px; }
.cv-nav .sidebar-link:hover .sidebar-icon { color: var(--muted); }
.cv-nav .sidebar-link.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 650; }
.cv-nav .sidebar-link.active .sidebar-icon { color: var(--accent); }
[data-theme="dark"] .cv-nav .sidebar-link.active { color: #FCA5A5; }
.cv-nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--line-2); color: var(--muted); font-variant-numeric: tabular-nums;
}
.cv-nav .sidebar-link.active .cv-nav-badge { background: var(--accent); color: #fff; }
.cv-nav-badge.is-warn { background: var(--accent-soft); color: var(--accent-2); }
.cv-nav-ext { margin-left: auto; font-size: 13px; color: var(--faint); }

.cv-side-foot { flex: none; padding: 12px; border-top: 1px solid var(--line-2); padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.cv-help {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2);
}
.cv-help:hover { border-color: #CBD5E1; }
.cv-help-ic { width: 32px; height: 32px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-size: 16px; }
.cv-help b { display: block; font-size: 12.5px; color: var(--ink); }
.cv-help small { display: block; font-size: 11px; color: var(--muted); }
.cv-side-ver { margin-top: 8px !important; text-align: center; font-size: 10.5px; color: var(--faint); }

.sidebar-overlay { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .4); display: none; }
.sidebar-overlay.open { display: block; }

/* Header */
.cv-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  height: var(--top-h); display: flex; align-items: center; gap: 24px;
  padding: 0 max(24px, env(safe-area-inset-right, 0px)) 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  transition: box-shadow .2s;
}
.cv-top.is-scrolled { box-shadow: 0 4px 16px -8px rgba(15, 23, 42, .15); }
body.cv::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 70; background: var(--surface); }
.cv-only-mobile { display: none; }
.cv-search { position: relative; flex: 1; max-width: 520px; min-width: 0; margin: 0 auto; }
.cv-search input {
  width: 100%; height: 40px; padding: 0 70px 0 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font: 500 13px var(--font); outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.cv-search input::placeholder { color: var(--faint); }
.cv-search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.cv-search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--faint); pointer-events: none; }
.cv-search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 600 10.5px var(--font); color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 0 7px; height: 22px; display: inline-flex; align-items: center; box-shadow: none;
}
.cv-search-mob { display: none; }
.cv-top-actions { flex: none; display: flex; align-items: center; gap: 4px; }
.cv-top-sep { width: 1px; height: 28px; background: var(--line); margin: 0 10px 0 8px; }
.cv-tinh { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); color: var(--accent); margin-right: 4px; font-size: 15px; }
.cv-tinh select { border: 0; background: transparent; color: var(--ink); font: 600 12.5px var(--font); height: 34px; outline: none; cursor: pointer; }
.cv-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cv-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
[data-theme="dark"] .cv-avatar { background: #334155; }
.cv-avatar.sm { width: 32px; height: 32px; font-size: 10.5px; }
.cv-avatar.xs { width: 24px; height: 24px; font-size: 9.5px; background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line); }
.cv-avatar.is-red { background: var(--accent); color: #fff; }
.cv-user-text { display: flex; flex-direction: column; justify-content: center; gap: 2px; line-height: 1.2; min-width: 0; }
.cv-user .hsh-user-name { font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.2; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-user-role { font-size: 11px; color: var(--faint); line-height: 1.2; white-space: nowrap; }
.btn-logout-custom { font-size: 18px; margin-left: 6px; }
.btn-logout-custom:hover { color: var(--accent); background: var(--accent-soft); }

/* Chuông thông báo */
.notif-bell-wrapper { cursor: pointer; }
.notif-badge-count {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 80; cursor: default; overflow: hidden; line-height: 1.45;
}
.notif-dropdown-menu.show { display: block; }
.notif-dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.notif-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.notif-mark-read-btn { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.notif-mark-read-btn:hover { background: var(--line-2); color: var(--ink); }
.notif-list-container { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line-2); text-align: left; }
.notif-item:hover { background: var(--bg-soft); }
.notif-item-icon { width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--line-2); font-size: 14px; }
.notif-item.unread .notif-item-icon { background: var(--accent-soft); }
.notif-item-content { min-width: 0; }
.notif-item-text { font-size: 12.5px; color: var(--ink-2); }
.notif-item.unread .notif-item-text { color: var(--ink); font-weight: 600; }
.notif-item-time { font-size: 11px; color: var(--faint); margin-top: 2px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.notif-dropdown-footer { padding: 10px 16px; text-align: center; border-top: 1px solid var(--line-2); }
.notif-dropdown-footer a { font-size: 12.5px; font-weight: 600; color: var(--accent) !important; }
.notif-highlight-flash { animation: cvFlash 1.2s ease 2; }
@keyframes cvFlash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--accent-line); } }

/* Nội dung */
.cv-content {
  flex: 1; width: 100%; max-width: 1480px; margin: 0 auto;
  padding: 28px max(28px, env(safe-area-inset-right, 0px)) 28px 28px;
  display: flex; flex-direction: column; gap: 0;
}
.cv-content > div, .cv-content > section { min-width: 0; }
#dashboardView, .content-view { display: flex; flex-direction: column; gap: 20px; }
#dashboardView[style*="none"], .content-view[style*="none"] { display: none !important; }

.cv-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cv-pagehead-text { min-width: 0; flex: 1 1 420px; }
.cv-crumb { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--faint); margin-bottom: 6px; }
.cv-crumb [data-icon] { font-size: 12px; }
.cv-crumb b { color: var(--ink-2); font-weight: 600; }
.hero-title { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.02em; line-height: 1.25; color: var(--ink); }
.hero-sub { margin-top: 4px !important; font-size: 13.5px; color: var(--muted); max-width: 70ch; }
.cv-pagehead-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.cv-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.cv-card-title { min-width: 0; }
.cv-card-title h2 { margin: 0; font-size: 15px; font-weight: 700; }
.cv-card-title p { font-size: 12px; color: var(--muted); margin-top: 2px !important; font-variant-numeric: tabular-nums; }
.cv-card-ic { font-size: 18px; color: var(--faint); }

/* ---------------- KPI ---------------- */
.cv-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.cv-kpi {
  display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: pointer;
  padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); color: inherit; font: inherit; min-width: 0;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cv-kpi:hover { border-color: #CBD5E1; box-shadow: 0 4px 14px -6px rgba(15, 23, 42, .18); }
.cv-kpi.is-active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--line); }
[data-theme="dark"] .cv-kpi.is-active { border-color: var(--ink-2); }
.cv-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cv-kpi .label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-kpi-ic { width: 34px; height: 34px; border-radius: 9px; flex: none; font-size: 17px; background: var(--line-2); color: var(--ink-2); }
.cv-kpi.in-progress .cv-kpi-ic { background: var(--blue-soft); color: var(--blue); }
.cv-kpi.duesoon .cv-kpi-ic { background: var(--amber-soft); color: var(--amber); }
.cv-kpi.done .cv-kpi-ic { background: var(--green-soft); color: var(--green); }
.cv-kpi.overdue .cv-kpi-ic { background: var(--accent-soft); color: var(--accent); }
.cv-kpi-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.cv-kpi .num { font-size: 30px; font-weight: 750; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cv-kpi-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.cv-kpi.in-progress .cv-kpi-badge { background: var(--blue-soft); color: var(--blue); }
.cv-kpi.duesoon .cv-kpi-badge { background: var(--amber-soft); color: var(--amber); }
.cv-kpi.done .cv-kpi-badge { background: var(--green-soft); color: var(--green); }
.cv-kpi.overdue .cv-kpi-badge.is-hot { background: var(--accent); color: #fff; }
.cv-kpi-bar { display: block; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.cv-kpi-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--faint); transition: width .5s ease; }
.cv-kpi.in-progress .cv-kpi-bar i { background: var(--blue); }
.cv-kpi.duesoon .cv-kpi-bar i { background: var(--amber-dot); }
.cv-kpi.done .cv-kpi-bar i { background: var(--green-dot); }
.cv-kpi.overdue .cv-kpi-bar i { background: var(--accent); }

/* KPI dạng cũ (trang Tồn đọng: .stat-card > .label + .num) */
.td-stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.td-stats-row .stat-card { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); border-top: 3px solid var(--faint); }
.td-stats-row .stat-card.duesoon { border-top-color: var(--amber-dot); }
.td-stats-row .stat-card.overdue { border-top-color: var(--accent); }
.td-stats-row .label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.td-stats-row .num { margin-top: 8px; font-size: 28px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.td-stats-row .overdue .num { color: var(--accent); }

/* ---------------- Banner khẩn ---------------- */
.urgent-banner-wrapper { min-width: 0; }
.urgent-banner-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.urgent-banner-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.urgent-banner-grid.count-3, .urgent-banner-grid.count-many { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.urgent-banner-card {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.urgent-badge-icon {
  flex: none; padding: 4px 8px; border-radius: 6px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.urgent-banner-text { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.urgent-banner-text strong { color: var(--ink); font-size: 13px; font-weight: 650; }
.btn-urgent-action {
  flex: none; height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.btn-urgent-action:hover { background: var(--accent-2); }

/* ---------------- Lịch ---------------- */
.cv-grid-cal { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cv-cal-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-week-nav { display: flex; align-items: center; gap: 4px; }
.cv-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--line-2); }
.cv-seg button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.cv-seg button [data-icon] { font-size: 15px; }
.cv-seg button { transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.cv-seg button:hover:not(.is-on) { color: var(--ink); background: rgba(255, 255, 255, .55); }
[data-theme="dark"] .cv-seg button:hover:not(.is-on) { background: var(--line); }
.cv-seg button.is-on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px var(--accent-line); font-weight: 700; }
.calendar-selects { display: flex; gap: 6px; }
.calendar-selects select { height: 32px; font-size: 12.5px; }

.cv-week-wrap { overflow-x: auto; }
.cv-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 630px; }
.cv-day { border-right: 1px solid var(--line-2); min-height: 172px; display: flex; flex-direction: column; }
.cv-day:last-child { border-right: 0; }
.cv-day.is-today { background: var(--bg-soft); }
.cv-day.is-selected { background: var(--accent-soft); }
.cv-day-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px; border: 0; background: none;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.cv-day-head:disabled { cursor: default; }
.cv-day-name { font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: .04em; }
.cv-day-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13.5px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cv-day.is-today .cv-day-name { color: var(--accent); }
.cv-day.is-today .cv-day-num { background: var(--accent); color: #fff; }
.cv-day-head:not(:disabled):hover .cv-day-num { box-shadow: 0 0 0 2px var(--line); }
.cv-day-body { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.cv-day-empty { font-size: 11px; color: var(--faint); padding: 2px 4px; opacity: .7; }
.cv-ev {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
  background: var(--surface-2); color: var(--ink-2); cursor: pointer; font: inherit;
}
.cv-ev:hover { filter: brightness(.97); }
.cv-ev-k { display: block; font-size: 10px; font-weight: 700; opacity: .8; }
.cv-ev-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 11.5px; font-weight: 550; line-height: 1.35; }
.cv-ev.ev-doing { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.cv-ev.ev-soon { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.cv-ev.ev-late { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.cv-ev.ev-done { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.cv-ev.ev-done .cv-ev-t { text-decoration: line-through; opacity: .8; }
[data-theme="dark"] .cv-ev.ev-late { color: #FCA5A5; }

/* Lịch tháng (chức năng cũ) */
.calendar-widget { padding: 12px 16px 6px; }
.calendar-dow, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--faint); padding: 4px 0; }
.calendar-day {
  position: relative; height: 46px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; cursor: default; border: 1px solid transparent;
}
.calendar-day.other-month { color: var(--faint); opacity: .45; }
.calendar-day.has-task { cursor: pointer; background: var(--bg-soft); }
.calendar-day.has-task:hover { border-color: var(--line); }
.calendar-day.today { color: var(--accent); border-color: var(--accent-line); }
.calendar-day.selected { background: var(--accent); color: #fff; }
.cal-dots { display: flex; gap: 3px; }
.cal-dots span, .cv-cal-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.d-overdue { background: var(--accent); }
.d-duesoon { background: var(--amber-dot); }
.d-new { background: var(--blue); }
.calendar-day.selected .cal-dots span { background: #fff; }
.cv-cal-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 2px 4px; font-size: 11px; color: var(--muted); }
.cv-cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-filter-hint:empty { display: none; }
.calendar-filter-hint { margin: 0 16px 14px; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--ink-2); font-size: 12.5px; }
.calendar-filter-hint .clear-x { color: var(--accent); font-weight: 700; cursor: pointer; margin-left: 4px; }

/* Sắp đến hạn */
.cv-upcoming { list-style: none; margin: 0; padding: 6px 8px 10px; }
.cv-upcoming li + li { border-top: 1px solid var(--line-2); }
.cv-up { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 10px; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.cv-up:hover { background: var(--bg-soft); }
.cv-up-date { flex: none; width: 42px; height: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.cv-up-date b { font-size: 16px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-up-date small { font-size: 10px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.cv-up-date.is-red { border-color: var(--accent-line); background: var(--accent-soft); }
.cv-up-date.is-red b { color: var(--accent); }
.cv-up-date.is-amber { border-color: var(--amber-line); background: var(--amber-soft); }
.cv-up-date.is-amber b { color: var(--amber); }
.cv-up-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cv-up-title { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-up-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-up-go { color: var(--faint); font-size: 16px; }
.cv-upcoming-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; color: var(--muted); font-size: 12.5px; text-align: center; }
.cv-upcoming-empty .cv-empty-ic { font-size: 28px; color: var(--green); }
.cv-upcoming-more button { width: 100%; border: 0; background: none; padding: 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); cursor: pointer; }

/* ---------------- Danh sách công việc ---------------- */
.cv-tasks { overflow: hidden; }
.cv-tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; flex-wrap: wrap; }
.cv-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--line-2); overflow-x: auto; max-width: 100%; }
.cv-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cv-tab { transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.cv-tab:hover:not(.is-on) { color: var(--ink); background: rgba(255, 255, 255, .55); }
[data-theme="dark"] .cv-tab:hover:not(.is-on) { background: var(--line); }
.cv-tab.is-on { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(220, 38, 38, .35); }
.cv-tab-n { min-width: 20px; height: 18px; padding: 0 5px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cv-tab.is-alert .cv-tab-n { background: var(--accent); color: #fff; }
.cv-tab.is-on .cv-tab-n, .cv-tab.is-on.is-alert .cv-tab-n { background: rgba(255, 255, 255, .22); color: #fff; }

.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar .spacer { flex: 1; }
.cv-filter { padding: 12px 20px; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.cv-filter-card { padding: 12px 16px; }
.cv-grow { flex: 1 1 260px; }
.table-search-box { position: relative; min-width: 200px; }
.table-search-box .ts-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 15px; pointer-events: none; }
.table-search-box input { width: 100%; padding-left: 34px; }

.task-grid.is-table { display: block; }
.task-grid.is-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; padding: 16px 20px 20px; }
.task-grid:not(.is-table):not(.is-cards) { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; padding: 16px 20px 20px; }
.cv-table-wrap { overflow-x: auto; }
.cv-table { width: 100%; min-width: 900px; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.cv-table col.c-prio { width: 112px; }
.cv-table col.c-owner { width: 170px; }
.cv-table col.c-due { width: 140px; }
.cv-table col.c-status { width: 146px; }
.cv-table col.c-act { width: 108px; }
.cv-table thead th {
  background: var(--surface-2); color: var(--muted); text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 11px 14px; white-space: nowrap;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cv-table thead th:first-child { padding-left: 24px; }
.cv-table td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; background: var(--surface); transition: background-color .15s; }
.cv-table td:first-child { padding-left: 20px; border-left: 4px solid transparent; }
.cv-table td:last-child, .cv-table th:last-child { padding-right: 20px; }
.cv-row { cursor: pointer; }
.cv-row:hover td { background: rgba(248, 250, 252, .8); }
[data-theme="dark"] .cv-row:hover td { background: var(--line-2); }
.cv-row.is-urgent td:first-child { border-left-color: var(--accent); }
.cv-row.is-done .cv-task-title { color: var(--muted); font-weight: 550; }
.ta-r { text-align: right; }
.cv-nowrap { white-space: nowrap; }
.cv-col-task { min-width: 0; }
.cv-task-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cv-task-ic { flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.cv-task-ic .cv-svg { stroke-width: 1.6; }
.cv-row:hover .cv-task-ic { color: var(--ink-2); border-color: #CBD5E1; }
.cv-task-emoji { flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: var(--line-2); border: 1px solid var(--line); line-height: 1; }
.cv-task-text { min-width: 0; flex: 1; }
.cv-task-title { font-weight: 600; color: var(--ink); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cv-task-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11.5px; color: var(--faint); margin-top: 4px !important; }
.cv-code { flex: none; font-family: var(--mono); font-size: 10px; color: var(--faint); background: var(--line-2); padding: 2px 6px; border-radius: 4px; line-height: 1.4; }
.cv-task-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.done-note { font-size: 11px; font-weight: 600; color: var(--green); margin-top: 3px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.cv-prio.is-red { color: var(--accent); font-weight: 650; }
.cv-prio.is-muted { color: var(--faint); }
.cv-prio .cv-svg { font-size: 14px; }
.cv-owner { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; color: var(--ink-2); font-size: 12.5px; min-width: 0; }
.cv-owner-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-date { font-weight: 550; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-due { font-size: 11.5px; color: var(--faint); margin-top: 2px !important; }
.cv-due.is-red { color: var(--accent); font-weight: 650; }
.cv-due.is-amber { color: #D97706; font-weight: 600; }
.cv-due.is-green { color: #059669; font-weight: 550; }
.cv-status {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 999px; border: 1px solid;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.cv-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cv-status.st-doing { background: #EFF6FF; border-color: rgba(191, 219, 254, .6); color: #2563EB; }
.cv-status.st-soon { background: #FFFBEB; border-color: rgba(253, 230, 138, .6); color: #D97706; }
.cv-status.st-late { background: #FEF2F2; border-color: rgba(254, 202, 202, .6); color: #DC2626; }
.cv-status.st-done { background: #ECFDF5; border-color: rgba(167, 243, 208, .6); color: #059669; }
[data-theme="dark"] .cv-status.st-doing { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
[data-theme="dark"] .cv-status.st-soon { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
[data-theme="dark"] .cv-status.st-late { background: var(--accent-soft); color: #FCA5A5; border-color: var(--accent-line); }
[data-theme="dark"] .cv-status.st-done { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.cv-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: color .15s; }
.cv-row:hover .cv-link, .cv-row:focus-visible .cv-link { color: var(--accent); }
.cv-row-btn { display: none; }

/* Phân trang */
.cv-pager { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.task-grid.is-cards .cv-pager { border: 1px solid var(--line); border-radius: var(--radius); }
.cv-pager-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cv-pager-info b { color: var(--ink); font-weight: 600; }
.cv-pager-nav { display: flex; align-items: center; gap: 4px; }
.cv-pg-btn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer; transition: border-color .15s, color .15s; }
.cv-pg-btn .cv-svg { font-size: 14px; }
.cv-pg-btn:hover:not(:disabled) { border-color: #CBD5E1; color: var(--ink); }
.cv-pg-btn:disabled { opacity: .4; cursor: default; }
.cv-pg-num { min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.cv-pg-num:hover { background: var(--line-2); }
.cv-pg-num.is-on { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.cv-pg-gap { padding: 0 4px; color: var(--faint); }

/* Dạng thẻ */
.cv-tcard {
  display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.cv-tcard:hover { border-color: #CBD5E1; box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .2); }
.cv-tcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cv-tcard-top .cv-task-emoji, .cv-tcard-top .cv-task-ic { margin-left: auto; width: 32px; height: 32px; font-size: 16px; }
.cv-tcard-title { margin: 0; font-size: 14.5px; font-weight: 650; line-height: 1.4; color: var(--ink); }
.cv-tcard-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cv-tcard-due { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.cv-tcard.is-urgent { border-left: 4px solid var(--accent); }
.cv-tcard.is-expired { border-left: 3px solid #FCA5A5; }
.cv-tcard.is-done { border-left: 3px solid var(--green-dot); }
.cv-tcard.is-done .cv-tcard-title { color: var(--ink-2); }

.empty-state, .cv-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; grid-column: 1 / -1; }
.empty-state .emoji { font-size: 30px; }
.cv-empty-ic { font-size: 30px; color: var(--faint); }
.empty-state b { color: var(--ink); }
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, var(--bg-soft) 50%, var(--line-2) 75%); background-size: 200% 100%; animation: cvShimmer 1.3s infinite; border-radius: var(--radius); }
.skeleton-card { height: 150px; }
@keyframes cvShimmer { to { background-position: -200% 0; } }

/* ---------------- Badge dùng chung (khung chi tiết) ---------------- */
.badge-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 6px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge-status-inprogress { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.badge-status-duesoon { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.badge-status-done, .badge-done-tag { background: var(--green-soft) !important; border-color: var(--green-line) !important; color: var(--green) !important; }
.badge-status-overdue, .badge-urgent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }

/* ---------------- Khung chi tiết công việc ---------------- */
.detail-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .35); display: none; }
.detail-overlay.open { display: block; }
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(560px, 100%);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .28s ease; overflow-y: auto;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.detail-panel.open { transform: translateX(0); }
.detail-header { padding: 20px 24px 18px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.detail-header .d-flex { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.detail-header .close-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--line-2); color: var(--muted); font-size: 15px; cursor: pointer; }
.detail-header .close-btn:hover { background: var(--line); color: var(--ink); }
.detail-header h2 { margin: 12px 0 14px; font-size: 18px; font-weight: 700; line-height: 1.4; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.dm-item { background: var(--surface); padding: 10px 12px; min-width: 0; }
.dm-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.dm-value { display: block; margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.dm-value[style] { color: var(--accent) !important; }
.countdown-box { display: flex; gap: 8px; margin-top: 14px; }
.countdown-box:empty { display: none; }
.countdown-unit { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--line); }
.countdown-unit .val { font-size: 18px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.countdown-unit .lbl { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.countdown-sec .val { color: var(--accent); }
.detail-body { padding: 20px 24px 28px; }
.detail-body .urgent-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink-2); font-size: 13px; }
.detail-body .fire { font-size: 15px; }
.done-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--green-soft); border: 1px solid var(--green-line); color: var(--green); }
.done-banner b { display: block; font-size: 13.5px; font-weight: 700; }
.done-banner span:not(.done-banner-ic) { display: block; font-size: 12.5px; margin-top: 2px; line-height: 1.45; color: var(--ink-2); }
.done-banner-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--green-dot); color: #fff; display: grid; place-items: center; font-weight: 800; }
.section-title { margin: 20px 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.detail-body .section-title:first-child { margin-top: 0; }
.content-box { padding: 14px 16px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 13.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.step-list { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
.step-item { position: relative; padding: 12px 14px 12px 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); counter-increment: step; }
.step-item::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.step-item h4 { margin: 0; font-size: 13.5px; font-weight: 650; }
.step-item p { margin-top: 4px !important; font-size: 12.5px; color: var(--muted); white-space: pre-line; }
.step-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; font-weight: 650; color: var(--accent) !important; }
.step-btn:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.link-row .lname { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.link-row .lopen { flex: none; height: 28px; padding: 0 12px; border-radius: 7px; display: inline-grid; place-items: center; background: var(--accent); color: #fff !important; font-size: 11.5px; font-weight: 700; }
.task-submit-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-2); text-align: center; }
.task-submit-footer .text-muted { color: var(--muted) !important; font-size: 12px; margin-top: 8px !important; }
.btn-submit-complete-exact {
  width: 100%; height: 46px; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); transition: background .15s;
}
.btn-submit-complete-exact:hover:not(:disabled) { background: var(--accent-2); }
.btn-submit-complete-exact:disabled { background: var(--green-soft) !important; color: var(--green) !important; border: 1px solid var(--green-line) !important; box-shadow: none !important; cursor: not-allowed !important; }
.clock-pulse { display: inline-block; }

/* Hộp xác nhận chung */
.confirm-modal { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; padding: 16px; }
.confirm-modal.open { display: flex; }
.confirm-card { width: min(420px, 100%); background: var(--surface); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 24px; text-align: center; }
.confirm-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); font-size: 22px; }
.confirm-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.confirm-card p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.confirm-actions { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.confirm-actions .btn-kst { flex: 1; }

/* ---------------- Modal dùng chung ---------------- */
.cv-modal, .change-pass-overlay, .notif-detail-overlay { position: fixed; inset: 0; z-index: 130; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; padding: 16px; }
.change-pass-overlay.open, .notif-detail-overlay.open { display: flex; }
.cv-modal-card { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); }
.notif-detail-card { width: min(600px, 100%); }
.cv-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.cv-modal-head h3, .notif-detail-head-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.cv-modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.cv-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.notif-detail-title { margin: 0; font-size: 17px; font-weight: 700; }
.notif-detail-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.notif-detail-content { font-size: 13.5px; line-height: 1.7; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }

.cv-field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.cv-field > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cv-field em { color: var(--accent); font-style: normal; }
.cv-field input, .cv-field textarea { width: 100%; height: 42px; font-size: 13.5px; }
.cv-field textarea { height: auto; }
.password-input-wrap { position: relative; display: block; }
.password-input-wrap input { padding-right: 44px; }
.toggle-eye-v2 { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--faint); font-size: 17px; cursor: pointer; display: grid; place-items: center; }
.toggle-eye-v2:hover { color: var(--ink); background: var(--line-2); }
.login-gate-error, .login-gate-success { padding: 10px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.login-gate-error { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-2); }
.login-gate-success { background: var(--green-soft); border: 1px solid var(--green-line); color: var(--green); }

/* ---------------- Đăng nhập ---------------- */
.login-gate-overlay {
  position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--bg); overflow-y: auto;
}
.login-gate-overlay.open { display: flex !important; }
.cv-login { width: min(880px, 100%); display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cv-login-side { padding: 40px 36px; background: var(--bg-soft); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.cv-login-brand { margin-top: 10px !important; font-size: 20px; font-weight: 800; letter-spacing: .04em; color: var(--ink); }
.cv-login-slogan { font-size: 12.5px; color: var(--muted); }
.cv-login-points { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 12px; }
.cv-login-points li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.cv-login-points [data-icon] { width: 30px; height: 30px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-size: 15px; }
.cv-login-form { padding: 40px 36px; display: flex; flex-direction: column; }
.login-split-title { margin: 0; font-size: 22px; font-weight: 750; }
.login-split-sub { margin: 4px 0 22px !important; font-size: 13px; color: var(--muted); }
.cv-login-form .form-kst { display: flex; flex-direction: column; gap: 14px; }
.login-options-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.login-checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; margin: 0; }
.login-checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }
.login-forgot-link { color: var(--accent) !important; font-weight: 600; }
.login-split-footer-note { margin-top: 22px !important; font-size: 11px; color: var(--faint); text-align: center; }

/* ---------------- Thi đua ---------------- */
.podium-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.podium-row:empty { display: none; }
.podium-card { position: relative; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.podium-card.podium-1 { border-top: 3px solid #EAB308; }
.podium-card.podium-2 { border-top: 3px solid #94A3B8; }
.podium-card.podium-3 { border-top: 3px solid #C2410C; }
.p-rank { position: absolute; top: 14px; right: 16px; font-size: 12px; font-weight: 700; color: var(--faint); }
.medal { font-size: 26px; line-height: 1; }
.p-name { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.p-score { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.comp-kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.comp-kpi-strip:empty { display: none; }
.comp-ov-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.comp-ov-icon { width: 42px; height: 42px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 19px; background: var(--line-2); }
.comp-ov-icon.blue { background: var(--blue-soft); }
.comp-ov-icon.green { background: var(--green-soft); }
.comp-ov-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.comp-ov-value { font-size: 19px; font-weight: 750; color: var(--ink); }
.comp-ov-note { font-size: 12px; color: var(--muted); }
.cv-table-card { overflow: hidden; }
.cv-table-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.comp-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--line-2); overflow-x: auto; max-width: 100%; }
.comp-tab { flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.comp-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.comp-table-wrap, .td-table-wrap, .td-top-wrap { overflow-x: auto; }
.comp-table, .td-table, .td-top-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.comp-table { min-width: 760px; }
.comp-table th, .td-table th, .td-top-table th { background: var(--surface-2); color: var(--muted); text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.comp-table td, .td-table td, .td-top-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; color: var(--ink-2); }
.comp-table tbody tr:hover, .td-top-table tbody tr:hover { background: var(--bg-soft); }
.comp-rank { font-size: 15px; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.comp-store-name { font-weight: 650; color: var(--ink); }
.comp-progress-cell { display: flex; align-items: center; gap: 10px; }
.comp-progress { height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.comp-progress-fill { height: 100%; border-radius: 6px; background: var(--blue); }
.pf-green { background: var(--green-dot); }
.pf-amber { background: var(--amber-dot); }
.pf-red { background: var(--accent); }
.pct { font-size: 12px; font-weight: 700; color: var(--ink-2); width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.comp-kpi-cell { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.comp-kpi-cell b { color: var(--ink); }
.comp-status { display: inline-flex; height: 24px; align-items: center; padding: 0 9px; border-radius: 6px; font-size: 11.5px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.st-excellent { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.st-good { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.st-warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.st-bad { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.comp-empty { text-align: center; padding: 36px 16px !important; color: var(--muted) !important; }

/* ---------------- Tồn đọng ---------------- */
.td-top-panel { overflow: hidden; }
.td-top-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.td-top-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.td-top-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.td-top-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.td-top-leg { display: inline-flex; align-items: center; gap: 6px; }
.td-top-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.td-top-table { min-width: 680px; }
.td-top-row { cursor: pointer; }
.td-top-row.is-selected { background: var(--accent-soft) !important; }
.td-top-medal { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--ink-2); }
.td-top-medal.r1 { background: #FEF3C7; color: #92400E; }
.td-top-medal.r2 { background: #E2E8F0; color: #334155; }
.td-top-medal.r3 { background: #FFEDD5; color: #9A3412; }
.td-top-store { font-weight: 650; color: var(--ink) !important; }
.td-top-barcell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.td-top-bar { flex: 1; display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line-2); }
.td-top-seg { height: 100%; }
.td-top-num { font-variant-numeric: tabular-nums; color: var(--ink); }
.td-top-cat { font-size: 12px; }
.td-top-dash { color: var(--faint); }
.td-store-list { display: flex; flex-direction: column; gap: 16px; }
.td-store-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.td-store-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.td-store-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.td-store-sub { font-size: 12px; color: var(--muted); }
.td-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 11.5px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.td-badge-red { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.td-badge-orange { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.td-badge-yellow { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.td-badge-gray { background: var(--line-2); border-color: var(--line); color: var(--muted); }
.td-table { min-width: 760px; }
.td-badge-muctieu { display: inline-flex; padding: 3px 8px; border-radius: 6px; background: var(--violet-soft); color: var(--violet); font-size: 11.5px; font-weight: 650; }
.td-noidung { color: var(--ink) !important; font-weight: 500; }
.td-huongxuly { font-size: 12.5px; color: var(--ink-2); white-space: pre-line; }
.td-luyke-badge { display: inline-flex; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.td-luyke-red { background: var(--accent-soft); color: var(--accent-2); }
.td-luyke-orange { background: var(--amber-soft); color: var(--amber); }
.td-luyke-yellow { background: #FEFCE8; color: #A16207; }
.td-st { display: inline-flex; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.td-st-new { background: var(--blue-soft); color: var(--blue); }
.td-st-open, .td-st-relapse { background: var(--accent-soft); color: var(--accent-2); }
.td-st-wait { background: var(--amber-soft); color: var(--amber); }
.td-st-done { background: var(--green-soft); color: var(--green); }

/* ---------------- Nhắc nhở ---------------- */
.nn-list-container { display: flex; flex-direction: column; gap: 20px; }
.nn-card { height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.nn-card:hover { border-color: #CBD5E1; box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .2); }
.nn-card-img-wrapper { aspect-ratio: 16 / 9; max-width: 100%; background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line-2); }
.nn-card-img { width: 100%; height: 100%; object-fit: cover; }
.nn-card-img-placeholder { font-size: 30px; opacity: .7; }
.nn-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nn-card-badge { align-self: flex-start; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-2); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.nn-card-title { font-size: 14px; font-weight: 650; color: var(--ink); line-height: 1.4; }
.nn-card-meta { font-size: 12px; color: var(--muted); }
.nn-card-link { margin-top: auto; padding-top: 6px; font-size: 12.5px; font-weight: 650; color: var(--accent) !important; }
.nn-empty-state, .v-empty-state, .library-empty { padding: 32px 20px; border-radius: var(--radius); border: 1px dashed var(--line); background: var(--surface); text-align: center; color: var(--muted); font-size: 13px; }
.nn-article { padding: 28px 32px; }
.nn-article-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.cv-pill { display: inline-flex; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--ink-2); }
.cv-pill.is-red { background: var(--accent-soft); color: var(--accent-2); }
.cv-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.nn-article-title { margin: 12px 0 16px !important; font-size: 22px; font-weight: 750; line-height: 1.35; }
.nn-article-body { font-size: 14.5px; line-height: 1.8; color: var(--ink-2); max-width: 78ch; overflow-wrap: anywhere; }
.nn-article-body h3 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.nn-article-body ul { padding-left: 20px; }
.nn-article-img { margin-top: 24px; text-align: center; }
.nn-article-img img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

/* ---------------- Video ---------------- */
.cv-video-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cv-video-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.video-player-wrapper { aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: #0F172A; border: 1px solid var(--line); }
.video-player-wrapper iframe { width: 100%; height: 100%; display: block; }
.cv-video-info { padding: 16px 18px; }
.cv-video-info h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.cv-video-by { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.cv-video-by strong { display: block; color: var(--ink); }
.cv-video-list { padding: 16px; }
.cv-video-list-title { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.cv-video-items { display: flex; flex-direction: column; gap: 8px; }
.v-playlist-item { display: flex; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.v-playlist-item:hover { background: var(--bg-soft); }
.v-playlist-item.active { background: var(--accent-soft); border-color: var(--accent-line); }
.v-thumb-box { position: relative; width: 112px; flex: none; aspect-ratio: 16 / 9; border-radius: 7px; overflow: hidden; background: var(--line-2); }
.v-thumb-box img { width: 100%; height: 100%; object-fit: cover; }
.v-duration-badge { position: absolute; right: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px; background: rgba(15, 23, 42, .8); color: #fff; font-size: 10px; font-weight: 600; }
.v-item-title { font-size: 12.5px; font-weight: 650; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-item-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------------- Thư viện ---------------- */
.policy-grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.policy-card-item { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; min-width: 0; }
.policy-card-item:hover { border-color: var(--accent-line); box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .2); }
.lib-emoji { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--line-2); font-size: 18px; }
.lib-name { font-size: 13.5px; font-weight: 650; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
.lib-note { font-size: 12px; color: var(--muted); }
.policy-card-tag { margin-top: auto; align-self: flex-start; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); font-size: 11px; font-weight: 650; }

/* ---------------- Hộp hỗ trợ, nút nổi, toast ---------------- */
.floating-support-wrapper {
  position: fixed; z-index: 70; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; border-radius: 999px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); cursor: pointer; font-size: 13px; font-weight: 650;
}
[data-theme="dark"] .floating-support-wrapper { background: #1E293B; border: 1px solid #334155; }
.floating-support-wrapper:hover { background: #1E293B; }
.support-icon-box { font-size: 18px; }
.chat-badge { position: absolute; top: -4px; right: -2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.chat-widget-box {
  position: fixed; z-index: 140; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: min(370px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.chat-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.chat-head-text { display: flex; align-items: center; gap: 10px; }
.chat-header h6 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.chat-header p { font-size: 11.5px; color: var(--muted); }
.chat-body { padding: 14px 16px 16px; }
.chat-body form { display: flex; flex-direction: column; gap: 10px; }
.chat-welcome-msg { margin-bottom: 12px; padding: 10px 12px; border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.chat-body .cv-field input { height: 38px; font-size: 13px; }

.toast-stack { position: fixed; z-index: 300; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast-item { padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-lg); animation: cvToast .25s ease; border-left: 3px solid var(--green-dot); }
[data-theme="dark"] .toast-item { background: #1E293B; border: 1px solid #334155; border-left: 3px solid var(--green-dot); }
.toast-item.error { border-left-color: var(--accent); }
@keyframes cvToast { from { opacity: 0; transform: translateY(8px); } }

.scroll-top-btn {
  position: fixed; z-index: 65; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 18px;
  display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .2s;
}
.scroll-top-btn.show { opacity: 1; visibility: visible; transform: none; }
.scroll-top-btn:hover { color: var(--accent); border-color: var(--accent-line); }

/* Chặn quyền quản trị */
.custom-modal-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .45); align-items: center; justify-content: center; padding: 16px; }
.access-denied-card { width: min(420px, 100%); padding: 28px 24px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); text-align: center; }
.cv-denied-ic { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.denied-title { margin: 0 0 8px; font-size: 17px; font-weight: 750; }
.denied-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.denied-actions { margin-top: 18px; }

/* Chân trang v5.1 — 1 CARD trắng chứa 2 cột (Thông tin chi nhánh | Trung tâm hỗ trợ KSNB) + vạch đứng; dòng bản quyền / phiên bản nằm dưới card.
   Chừa chỗ cho nút "Hỗ trợ" nổi ở góc phải dưới. */
.cv-foot { flex: none; margin-top: 8px; background: transparent; border-top: 0; }
.cv-foot-inner {
  max-width: 1480px; margin: 0 auto;
  padding: 20px max(28px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 28px;
}
.cv-foot-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.cv-foot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cv-foot-col { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-right: 28px; }
.cv-foot-support { padding-right: 0; padding-left: 28px; border-left: 1px solid var(--line); }   /* vạch ngăn cách đứng giữa 2 cột */
.cv-foot-k { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.cv-foot-name { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.cv-foot-name.is-person { font-weight: 600; }
.cv-foot-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cv-foot-list li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; line-height: 1.5; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.cv-foot-list b { font-weight: 600; color: var(--ink-2); }
.cv-foot-ic { flex: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line-2); color: var(--muted); font-size: 15px; }
.cv-foot-ic .cv-svg, .cv-foot-ic svg { width: 16px; height: 16px; }
.cv-foot-bottom { margin-top: 16px; padding-top: 12px; padding-right: 132px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 4px 24px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.cv-foot-bottom p { margin: 0; }
.cv-foot .d-none { display: none !important; }
.cv-content { padding-bottom: 32px; }

/* Popup "BẠN CHƯA CÓ QUYỀN TRUY CẬP" (portal-access.js) — bản sáng chuẩn Enterprise, chỉ áp dụng trên trang Công việc */
body.cv .pa-overlay { background: rgba(15, 23, 42, .4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: 16px; transition: opacity .2s ease, visibility .2s; }
body.cv .pa-card {
  width: min(440px, 100%); padding: 32px 28px 24px; border-radius: 16px; text-align: center; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 48px -12px rgba(15, 23, 42, .3);
  transform: translateY(12px) scale(.97); transition: transform .25s ease, opacity .2s ease;
}
body.cv .pa-overlay.is-open .pa-card { transform: none; }
body.cv .pa-shine, body.cv .pa-sparkles, body.cv .pa-ring, body.cv .pa-divider, body.cv .pa-lock::before { display: none; }
body.cv .pa-close { top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--faint); font-size: 20px; }
body.cv .pa-close:hover { background: var(--line-2); color: var(--ink); transform: none; }
body.cv .pa-lock { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; background: var(--accent-soft); box-shadow: 0 0 0 8px rgba(254, 242, 242, .6); }
[data-theme="dark"] body.cv .pa-lock { box-shadow: 0 0 0 8px rgba(239, 68, 68, .08); }
body.cv .pa-lock svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 4px rgba(154, 107, 18, .35)); animation: paShake .6s cubic-bezier(.36, .07, .19, .97) .2s both; }
body.cv .pa-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--accent); margin-bottom: 6px; }
body.cv .pa-card h2 {
  font-size: 19px; font-weight: 800; letter-spacing: .02em; line-height: 1.35; color: var(--ink);
  background: none; -webkit-background-clip: border-box; background-clip: border-box; text-shadow: none;
}
body.cv .pa-module { margin: 16px 0 6px; font-size: 14.5px; font-weight: 700; color: var(--ink); }
body.cv .pa-msg { font-size: 13.5px; line-height: 1.65; color: var(--muted); }
body.cv .pa-msg b { color: var(--ink); font-weight: 700; word-break: break-word; }
body.cv .pa-actions { gap: 10px; margin-top: 24px; flex-wrap: nowrap; }
body.cv .pa-btn {
  flex: 1; min-width: 0; height: 42px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  box-shadow: none; transition: background .15s, color .15s;
}
body.cv .pa-btn.gold { order: 1; border: 1px solid var(--line); background: var(--line-2); color: var(--ink-2); }
body.cv .pa-btn.gold:hover { background: var(--line); transform: none; box-shadow: none; }
body.cv .pa-btn.ghost { order: 2; border: 0; background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 1px 2px rgba(220, 38, 38, .3); }
body.cv .pa-btn.ghost:hover { background: var(--accent-2); transform: none; }
body.cv .pa-btn:focus-visible, body.cv .pa-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.cv .pa-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 10.5px; letter-spacing: .14em; color: var(--faint); }
@media (max-width: 420px) { body.cv .pa-actions { flex-wrap: wrap; } body.cv .pa-btn { flex: 1 1 100%; } body.cv .pa-card { padding: 28px 20px 20px; } }


/* =====================================================================
   HIỆU ỨNG THỊ GIÁC (micro-interactions) — v3.5
   Tắt toàn bộ khi người dùng bật "giảm chuyển động" (prefers-reduced-motion).
   ===================================================================== */
@keyframes cvRedPulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .38); } 70% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
@keyframes cvFlame { 0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; } 25% { transform: scale(1.12) rotate(-6deg); } 50% { transform: scale(.94) rotate(4deg); opacity: .8; } 75% { transform: scale(1.08) rotate(-3deg); } }
@keyframes cvBell { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
@keyframes cvRedPulseSm { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35); } 70% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
@keyframes cvBadgePop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* KHẨN / QUÁ HẠN: vòng sáng đỏ nhịp nhẹ quanh thẻ + lửa lập loè */
.cv-tcard { position: relative; }
.cv-tcard.is-urgent::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  animation: cvRedPulse 2.4s ease-out infinite;
}
.cv-prio.is-red .cv-svg, .urgent-badge-icon { animation: cvFlame 1.6s ease-in-out infinite; transform-origin: 50% 80%; }
.urgent-badge-icon { display: inline-block; animation: cvRedPulseSm 2.4s ease-out infinite; }
.cv-status.st-late { animation: cvRedPulseSm 2.4s ease-out infinite; }
.cv-row.is-urgent .cv-prio.is-red { text-shadow: 0 0 12px rgba(220, 38, 38, .25); }
.urgent-banner-card { animation: cvRedPulse 3s ease-out 1s 3; }

/* Chuông thông báo: rung nhẹ khi vào trang, lặp lại mỗi ~8 giây nếu còn thông báo chưa đọc */
.notif-bell-wrapper [data-icon="bell"] { transform-origin: 50% 10%; animation: cvBell 1s ease-in-out .8s 2; }
@supports selector(:has(*)) {
  .notif-bell-wrapper:has(.notif-badge-count:not([style*="none"])) [data-icon="bell"] { animation: cvBellLoop 8s ease-in-out .8s infinite; }
}
@keyframes cvBellLoop { 0%, 15%, 100% { transform: rotate(0); } 2% { transform: rotate(14deg); } 4% { transform: rotate(-12deg); } 6% { transform: rotate(9deg); } 8% { transform: rotate(-6deg); } 10% { transform: rotate(3deg); } }
.notif-badge-count { animation: cvBadgePop .5s ease 1s 2; }

/* ĐÃ HOÀN THÀNH: ánh xanh lá dịu */
.cv-status.st-done { box-shadow: 0 0 0 3px rgba(16, 185, 129, .10), 0 2px 8px -2px rgba(16, 185, 129, .35); }
.cv-tcard.is-done { border-color: rgba(167, 243, 208, .9); box-shadow: 0 0 0 1px rgba(16, 185, 129, .08), 0 6px 18px -10px rgba(16, 185, 129, .45); }
.cv-ev.ev-done { box-shadow: 0 0 0 2px rgba(16, 185, 129, .08); }
[data-theme="dark"] .cv-tcard.is-done { border-color: var(--green-line); }

/* RÊ CHUỘT: thẻ nổi nhẹ, nút & menu đổi màu mượt */
.cv-tcard, .cv-kpi, .nn-card, .policy-card-item, .podium-card, .comp-ov-card, .td-store-card, .cv-up {
  transition: transform .2s ease-in-out, box-shadow .2s ease-in-out, border-color .2s ease-in-out, background-color .2s ease-in-out;
}
.cv-tcard:hover, .cv-kpi:hover, .nn-card:hover, .policy-card-item:hover, .podium-card:hover, .comp-ov-card:hover {
  transform: translateY(-4px); box-shadow: 0 12px 24px -12px rgba(15, 23, 42, .25), 0 4px 8px -4px rgba(15, 23, 42, .08);
}
.cv-tcard.is-done:hover { box-shadow: 0 0 0 1px rgba(16, 185, 129, .12), 0 14px 26px -12px rgba(16, 185, 129, .45); }
.cv-up:hover { transform: translateX(2px); }
.btn-kst, .cv-icon-btn, .header-icon-btn, .cv-chip-btn, .btn-urgent-action, .cv-pg-btn, .cv-pg-num, .comp-tab, .cv-help, .floating-support-wrapper {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.btn-kst-primary:hover, .btn-urgent-action:hover { box-shadow: 0 6px 14px -6px rgba(220, 38, 38, .55); transform: translateY(-1px); }
.btn-kst:active, .btn-urgent-action:active, .cv-pg-btn:active, .cv-pg-num:active { transform: translateY(0) scale(.98); }
.floating-support-wrapper:hover { transform: translateY(-2px); }
.cv-nav .sidebar-link { transition: background-color .2s ease, color .2s ease, padding-left .2s ease; }
.cv-nav .sidebar-link .sidebar-icon { transition: color .2s ease, transform .2s ease; }
.cv-nav .sidebar-link:hover:not(.active) { padding-left: 15px; }
.cv-nav .sidebar-link:hover .sidebar-icon { color: var(--accent); }
.cv-nav .sidebar-link.active { box-shadow: inset 3px 0 0 var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .cv-tcard.is-urgent::after, .cv-prio.is-red .cv-svg, .urgent-badge-icon, .cv-status.st-late, .urgent-banner-card,
  .notif-bell-wrapper [data-icon="bell"], .notif-badge-count { animation: none !important; }
  .cv-tcard:hover, .cv-kpi:hover, .nn-card:hover, .policy-card-item:hover, .podium-card:hover, .comp-ov-card:hover, .cv-up:hover { transform: none; }
}

/* Bootstrap: đồng bộ màu khi giao diện tối */
[data-theme="dark"] .text-dark { color: var(--ink) !important; }
[data-theme="dark"] .text-muted, [data-theme="dark"] .text-secondary { color: var(--muted) !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1279px) {
  .cv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cv-grid-cal { grid-template-columns: minmax(0, 1fr); }
  .cv-video-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .cv-main { margin-left: 0; }
  .cv-side { transform: translateX(-105%); box-shadow: var(--shadow-lg); }
  .cv-side.open { transform: translateX(0); }
  .cv-side-close { display: inline-flex; }
  .cv-only-mobile { display: inline-flex; }
  .cv-top { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 8px; }
  .cv-content { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
  .cv-user-text { display: none; }
}
@media (max-width: 767px) {
  .cv-search-desk, .cv-search kbd { display: none; }
  .cv-search-mob { display: block; }
  .cv-search input { padding-right: 12px; }
  .cv-hide-sm { display: none !important; }
  .cv-top-sep { display: none; }
  .cv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cv-kpis .cv-kpi:first-child { grid-column: 1 / -1; }
  .cv-kpi { padding: 14px; }
  .cv-kpi .num { font-size: 26px; }
  .cv-kpi .label { font-size: 10.5px; letter-spacing: .02em; }
  .cv-kpi-ic { width: 30px; height: 30px; font-size: 15px; }
  .td-stats-row { grid-template-columns: minmax(0, 1fr); }
  .hero-title { font-size: 20px; }
  .cv-pagehead-actions { width: 100%; }
  .cv-pagehead-actions .btn-kst { flex: 1; }
  .cv-card-head, .cv-tasks-head, .cv-filter { padding-left: 14px; padding-right: 14px; }
  .task-grid.is-cards, .task-grid:not(.is-table):not(.is-cards) { padding: 14px; grid-template-columns: minmax(0, 1fr); }
  .urgent-banner-grid.count-2, .urgent-banner-grid.count-3, .urgent-banner-grid.count-many { grid-template-columns: minmax(0, 1fr); }
  .urgent-banner-card { flex-wrap: wrap; }
  .btn-urgent-action { width: 100%; }
  .filter-bar select { flex: 1 1 140px; min-width: 0; }
  .filter-bar .spacer { display: none; }
  .table-search-box { flex: 1 1 100%; min-width: 0; }
  .podium-row { grid-template-columns: minmax(0, 1fr); }
  .cv-pager { padding: 12px 14px; justify-content: center; }
  .cv-pg-btn span { display: none; }
  .cv-pg-btn { padding: 0 9px; }
  .cv-login { grid-template-columns: minmax(0, 1fr); }
  .cv-login-side { display: none; }
  .cv-login-form { padding: 28px 22px; }
  .detail-header, .detail-body { padding-left: 18px; padding-right: 18px; }
  .nn-article { padding: 20px 18px; }
  .cv-foot-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cv-foot-col { padding-right: 0; }
  .cv-foot-support { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .cv-foot-bottom { padding-right: 0; }
  .cv-foot-inner { padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(88px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .floating-support-wrapper { padding: 0 12px; }
  .floating-support-wrapper .support-label { display: none; }
  .scroll-top-btn { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 380px) {
  .cv-top-actions .cv-icon-btn { width: 34px; }
}

/* ---- Khung chi tiết v3.6: đầu khung (icon + tiêu đề), nút đóng góc phải, hoa sen mờ nền ---- */
.detail-panel {
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 240 170%22 fill=%22none%22 stroke=%22%23B91C1C%22 stroke-opacity=%22.09%22 stroke-width=%221.1%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 40 C133 62 133 100 120 122 C107 100 107 62 120 40Z%22/%3E%3Cg transform=%22translate%28120 134%29 rotate%2828%29 scale%280.94%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 44 C132 64 132 100 120 120 C108 100 108 64 120 44Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-28%29 scale%280.94%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 44 C132 64 132 100 120 120 C108 100 108 64 120 44Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%2856%29 scale%280.84%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-56%29 scale%280.84%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%2882%29 scale%280.68%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-82%29 scale%280.68%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cpath d=%22M44 142 Q120 158 196 142%22/%3E%3Cpath d=%22M70 152 Q120 164 170 152%22/%3E%3C/svg%3E") no-repeat center 58% / 94% auto, var(--surface);
}
[data-theme="dark"] .detail-panel { background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 240 170%22 fill=%22none%22 stroke=%22%23FFFFFF%22 stroke-opacity=%22.07%22 stroke-width=%221.1%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 40 C133 62 133 100 120 122 C107 100 107 62 120 40Z%22/%3E%3Cg transform=%22translate%28120 134%29 rotate%2828%29 scale%280.94%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 44 C132 64 132 100 120 120 C108 100 108 64 120 44Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-28%29 scale%280.94%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3Cpath d=%22M120 44 C132 64 132 100 120 120 C108 100 108 64 120 44Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%2856%29 scale%280.84%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-56%29 scale%280.84%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%2882%29 scale%280.68%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cg transform=%22translate%28120 134%29 rotate%28-82%29 scale%280.68%29 translate%28-120 -134%29%22%3E%3Cpath d=%22M120 12 C148 46 148 100 120 134 C92 100 92 46 120 12Z%22/%3E%3C/g%3E%3Cpath d=%22M44 142 Q120 158 196 142%22/%3E%3Cpath d=%22M70 152 Q120 164 170 152%22/%3E%3C/svg%3E") no-repeat center 58% / 94% auto, var(--surface); }
.detail-header.cv-dh { position: relative; background: transparent; padding: 20px 24px 18px; }
.cv-dh .cv-dh-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-right: 52px; min-height: 34px; }
.cv-dh .cv-dh-title { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; margin-bottom: 14px; }
.cv-dh .cv-dh-ic { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.cv-dh .cv-dh-ic .cv-svg { width: 18px; height: 18px; }
.cv-dh .cv-dh-title h2 { margin: 0; padding-top: 3px; font-family: Inter, 'Be Vietnam Pro', system-ui, sans-serif; font-size: 18px; font-weight: 700; line-height: 1.375; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.detail-header .close-btn.cv-dh-close { position: absolute; top: 16px; right: 16px; z-index: 2; width: auto; height: auto; padding: 8px; border-radius: 999px; display: grid; place-items: center; background: #F1F5F9; color: #64748B; transition: background .15s ease, color .15s ease; }
.detail-header .close-btn.cv-dh-close:hover { background: #E2E8F0; color: #0F172A; }
[data-theme="dark"] .detail-header .close-btn.cv-dh-close { background: rgba(255,255,255,.08); color: #CBD5E1; }
[data-theme="dark"] .detail-header .close-btn.cv-dh-close:hover { background: rgba(255,255,255,.16); color: #fff; }
.detail-header .close-btn.cv-dh-close .cv-svg { width: 18px; height: 18px; }
.detail-panel .detail-body { background: transparent; }
@media (max-width: 640px) { .detail-header.cv-dh { padding: 18px 18px 16px; } .detail-header .close-btn.cv-dh-close { top: 14px; right: 14px; } }

/* ---- v3.7: chân trang — nút "Liên hệ KST phụ trách" + bảng danh bạ; tên chi nhánh IN HOA ---- */
#footBranch { text-transform: uppercase; }
.cv-foot-contact-btn {
  align-self: flex-start; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 12px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent-2); font: inherit; font-size: 12px; font-weight: 500; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.cv-foot-contact-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-foot-contact-ic { display: inline-grid; place-items: center; color: currentColor; }
.cv-foot-contact-ic .cv-svg { width: 14px; height: 14px; }

.cv-ct-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s ease; }
.cv-ct-overlay.is-open { opacity: 1; }
.cv-ct-card { width: min(440px, 100%); max-height: min(86vh, 680px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(8px) scale(.98); transition: transform .2s ease; }
.cv-ct-overlay.is-open .cv-ct-card { transform: none; }
.cv-ct-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 56px 16px 20px; border-bottom: 1px solid var(--line-2); }
.cv-ct-hic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.cv-ct-hic .cv-svg { width: 19px; height: 19px; }
.cv-ct-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.cv-ct-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.cv-ct-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 999px; background: #F1F5F9; color: #64748B; cursor: pointer; transition: background .15s ease, color .15s ease; }
.cv-ct-close:hover { background: #E2E8F0; color: #0F172A; }
[data-theme="dark"] .cv-ct-close { background: rgba(255, 255, 255, .08); color: #CBD5E1; }
[data-theme="dark"] .cv-ct-close:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.cv-ct-close .cv-svg { width: 17px; height: 17px; }
.cv-ct-body { padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.cv-ct-group { margin-top: 16px; display: grid; gap: 8px; }
.cv-ct-gname { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.cv-ct-mine { text-transform: none; letter-spacing: 0; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); border: 1px solid var(--green-line); color: var(--green); }
.cv-ct-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.cv-ct-row:hover { border-color: var(--green-line); background: var(--green-soft); transform: translateY(-1px); }
.cv-ct-av { flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.cv-ct-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.cv-ct-phone { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.cv-ct-phone .cv-svg { width: 14px; height: 14px; }
@media (max-width: 420px) { .cv-ct-row { padding: 9px 10px; gap: 10px; } .cv-ct-phone { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .cv-ct-overlay, .cv-ct-card { transition: none; } .cv-ct-row:hover { transform: none; } }

/* ---- v3.8: màn đăng nhập trang Công việc — đồng bộ với KMS ---- */
#loginGateOverlay.kl-overlay {
  display: none; align-items: center; justify-content: center; padding: 24px 16px !important;
  overflow-y: auto !important; background:
    radial-gradient(ellipse 60% 50% at 12% 0%, rgba(177,16,22,.10) 0%, transparent 70%),
    radial-gradient(ellipse 50% 45% at 92% 100%, rgba(217,174,69,.16) 0%, transparent 70%),
    linear-gradient(180deg, #EEF2F7 0%, #F8FAFC 60%, #FFFFFF 100%) !important;
  font-family: 'Plus Jakarta Sans', 'Be Vietnam Pro', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#loginGateOverlay.kl-overlay.open { display: flex !important; }

/* Hoa sen nét mảnh mờ làm nền */
.kl-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; user-select: none; color: #991B1B; }
.kl-bg svg { position: absolute; max-width: none; }
.kl-bg .b1 { left: 50%; top: 50%; width: 1200px; transform: translate(-50%, -30%); opacity: .07; }
.kl-bg .b2 { left: -96px; bottom: -40px; width: 560px; transform: rotate(-12deg); opacity: .08; }
.kl-bg .b3 { right: -112px; top: -20px; width: 520px; transform: rotate(14deg); opacity: .08; }
.kl-lotus { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.kl-lotus * { vector-effect: non-scaling-stroke; }

#loginCard.kl-card {
  position: relative; z-index: 1; width: 100%; max-width: 440px; margin: auto;
  background: #fff !important; border: 1px solid rgba(226,232,240,.85) !important; border-radius: 16px !important;
  box-shadow: 0 25px 50px -12px rgba(100,116,139,.30) !important;
  padding: 36px !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  animation: klIn .35s ease both; text-align: left;
}
@keyframes klIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) { #loginCard.kl-card { padding: 26px 22px !important; } }

.kl-head { display: flex; align-items: center; gap: 16px; }
.kl-logo { width: 56px; height: 56px; border-radius: 14px; flex: 0 0 auto; object-fit: cover; box-shadow: 0 6px 16px rgba(177,16,22,.25); }
.kl-title { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; color: #0F172A; }
.kl-bar { display: block; width: 32px; height: 2px; border-radius: 99px; margin: 6px 0 0; background: linear-gradient(90deg, #FBBF24, #FCD34D); }
.kl-sub { margin: 6px 0 0; font-size: 13px; line-height: 1.35; color: #64748B; }

.kl-points { list-style: none; margin: 24px 0 0; padding: 0 0 24px; border-bottom: 1px solid #F1F5F9; display: grid; gap: 10px; }
.kl-points li { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #475569; }
.kl-points svg { width: 18px; height: 18px; flex: 0 0 auto; color: #94A3B8; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.kl-form { margin-top: 24px; display: grid; gap: 16px; }
.kl-label { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 700; color: #334155; }
.kl-input {
  display: block; width: 100%; box-sizing: border-box; padding: 12px 16px; font: inherit; font-size: 14px; color: #0F172A;
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px; outline: none; transition: all .15s ease;
}
.kl-input::placeholder { color: #94A3B8; }
.kl-input:focus { background: #fff; border-color: #EF4444; box-shadow: 0 0 0 4px rgba(239,68,68,.10); }
.kl-pw { position: relative; }
.kl-pw .kl-input { padding-right: 48px; }
.kl-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: 8px; color: #94A3B8; cursor: pointer; padding: 0; transition: all .15s ease;
}
.kl-eye:hover { color: #334155; background: #F1F5F9; }
.kl-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kl-eye .off { display: none; }
.kl-eye.is-showing .on { display: none; }
.kl-eye.is-showing .off { display: block; }

.kl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kl-remember { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #475569; cursor: pointer; user-select: none; margin: 0; }
.kl-remember input { width: 16px; height: 16px; accent-color: #DC2626; margin: 0; cursor: pointer; }
.kl-link { font-size: 12px; font-weight: 700; color: var(--accent) !important; text-decoration: none; }
.kl-link:hover { text-decoration: underline; }

#loginGateOverlay .login-gate-error {
  margin: 0; background: #FEF2F2; color: #B91C1C; border: 1px solid #FEE2E2; border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 600;
}
.kl-btn {
  display: block; width: 100%; box-sizing: border-box; border: 0; border-radius: 12px; padding: 14px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 800; letter-spacing: .03em; color: #fff;
  background: linear-gradient(90deg, #DC2626, #B91C1C); box-shadow: 0 10px 20px -6px rgba(220,38,38,.35); transition: all .2s ease;
}
.kl-btn:hover { background: linear-gradient(90deg, #B91C1C, #991B1B); transform: translateY(-1px); }
.kl-btn:active { transform: none; }
.kl-btn:disabled { opacity: .7; cursor: progress; transform: none; }

.kl-foot { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid #F1F5F9; text-align: center; font-size: 11px; color: #64748B; line-height: 1.6; }
.kl-foot small { display: block; margin-top: 4px; font-size: 10px; color: #94A3B8; }
#loginGateOverlay .app-version-badge { color: #94A3B8; background: #F8FAFC; border-color: #E2E8F0; margin: 0 0 0 4px; }

@media (prefers-reduced-motion: reduce) { #loginCard.kl-card { animation: none; } .kl-btn:hover { transform: none; } }
#loginGateOverlay .login-gate-error.d-none { display: none !important; }

/* Giao diện tối */
[data-theme="dark"] #loginGateOverlay.kl-overlay { background: radial-gradient(ellipse 60% 50% at 12% 0%, rgba(220,38,38,.14) 0%, transparent 70%), var(--bg) !important; }
[data-theme="dark"] .kl-bg { color: #FCA5A5; }
[data-theme="dark"] #loginCard.kl-card { background: var(--surface) !important; border-color: var(--line) !important; box-shadow: 0 25px 50px -12px rgba(0,0,0,.6) !important; }
[data-theme="dark"] .kl-title { color: var(--ink); }
[data-theme="dark"] .kl-sub, [data-theme="dark"] .kl-foot { color: var(--muted); }
[data-theme="dark"] .kl-points li, [data-theme="dark"] .kl-remember { color: var(--ink-2); }
[data-theme="dark"] .kl-points, [data-theme="dark"] .kl-foot { border-color: var(--line); }
[data-theme="dark"] .kl-label { color: var(--ink-2); }
[data-theme="dark"] .kl-input { background: var(--bg-soft); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .kl-input:focus { background: var(--surface); }
[data-theme="dark"] .kl-eye:hover { background: var(--line-2); color: var(--ink); }
.kl-eye .cv-svg { width: 18px; height: 18px; }
#loginGateOverlay .kl-eye { font-size: 0; }
#loginGateOverlay.kl-overlay { z-index: 200; }

#loginGateOverlay .kl-points { gap: 12px; }
#loginGateOverlay .kl-btn { border-radius: 12px; box-shadow: 0 10px 20px -6px rgba(220,38,38,.30); transition: all .2s ease; }
#loginGateOverlay .kl-btn:hover { transform: scale(1.01); }
#loginGateOverlay .kl-btn:active { transform: scale(.99); }
#loginGateOverlay .kl-btn:disabled { transform: none; }

/* ---- v1.4: nền C2 — mỗi dải 2 dòng chữ rỗng nét mảnh chạy song song; 4 góc có vòng cung vàng kim ---- */
#loginGateOverlay .kl-bg .kl-rows { position: absolute; inset: -36% -26%; transform: rotate(-12deg); display: flex; flex-direction: column; justify-content: center; gap: 38px;
  -webkit-mask-image: radial-gradient(ellipse 100% 90% at 50% 50%, #000 52%, rgba(0, 0, 0, .45) 100%); mask-image: radial-gradient(ellipse 100% 90% at 50% 50%, #000 52%, rgba(0, 0, 0, .45) 100%); }
#loginGateOverlay .kl-band { display: flex; flex-direction: column; gap: 6px; }
#loginGateOverlay .kl-trk { display: flex; width: max-content; white-space: nowrap; animation: klMv var(--t, 120s) linear var(--dl, 0s) infinite; will-change: transform; }
#loginGateOverlay .kl-band.rev .kl-trk { animation-direction: reverse; }
@keyframes klMv { to { transform: translateX(calc(var(--w, 1000px) * -1)); } }
#loginGateOverlay .kl-trk span { display: inline-flex; align-items: center; gap: .5em; padding-right: .5em; color: transparent; }
#loginGateOverlay .kl-bg .kl-trk svg { position: static; flex: none; width: 1.3em; height: .9em; max-width: none; color: rgba(201, 151, 43, .36); }
#loginGateOverlay .kl-bg .kl-trk svg .kl-lotus { stroke-width: 1.1; }
#loginGateOverlay .kl-l1 { font-weight: 800; font-size: clamp(30px, 4.2vw, 58px); line-height: 1; letter-spacing: .06em; }
#loginGateOverlay .kl-l1 span { -webkit-text-stroke: 1px rgba(185, 28, 28, .17); }
#loginGateOverlay .kl-l2 { font-weight: 700; font-size: clamp(15px, 2.1vw, 29px); line-height: 1; letter-spacing: .34em; padding-left: .2em; }
#loginGateOverlay .kl-l2 span { -webkit-text-stroke: .8px rgba(201, 151, 43, .42); }
#loginGateOverlay .kl-bg .kl-l2 svg { width: 1.6em; height: 1.1em; color: rgba(201, 151, 43, .35); }
#loginGateOverlay .kl-band:nth-child(even) .kl-l1 span { -webkit-text-stroke-color: rgba(100, 116, 139, .18); }

/* 4 góc: vòng cung vàng kim + hoa sen nhỏ (lấp chỗ trống ở các góc) */
#loginGateOverlay .kl-bg .kl-cn { position: absolute; --s: clamp(280px, 34vw, 470px); width: var(--s); height: var(--s); pointer-events: none; }
#loginGateOverlay .kl-bg .kl-cn.tl { left: calc(var(--s) * -.36); top: calc(var(--s) * -.36); }
#loginGateOverlay .kl-bg .kl-cn.tr { right: calc(var(--s) * -.36); top: calc(var(--s) * -.36); }
#loginGateOverlay .kl-bg .kl-cn.bl { left: calc(var(--s) * -.36); bottom: calc(var(--s) * -.36); }
#loginGateOverlay .kl-bg .kl-cn.br { right: calc(var(--s) * -.36); bottom: calc(var(--s) * -.36); }
#loginGateOverlay .kl-bg .kl-cn svg { position: static; width: 100%; height: 100%; max-width: none; overflow: visible; fill: none; }
#loginGateOverlay .kl-cn .a { stroke: rgba(201, 151, 43, .34); stroke-width: 1; fill: none; }
#loginGateOverlay .kl-cn .b { stroke: rgba(201, 151, 43, .42); stroke-width: 1; stroke-dasharray: 3 9; fill: none; }
#loginGateOverlay .kl-cn .dots circle { fill: rgba(201, 151, 43, .5); stroke: none; }
#loginGateOverlay .kl-cn .lt { color: rgba(185, 28, 28, .28); }
#loginGateOverlay .kl-cn .lt .kl-lotus { stroke-width: 1.2; }
#loginGateOverlay .kl-cn-spin { transform-box: fill-box; transform-origin: center; animation: klSpin2 160s linear infinite; }
#loginGateOverlay .kl-cn-spin.rev { animation-direction: reverse; }
@keyframes klSpin2 { to { transform: rotate(360deg); } }
#loginGateOverlay .kl-bg .kl-spot { position: absolute; inset: 0; background: radial-gradient(ellipse 42% 52% at 50% 50%, rgba(255, 255, 255, .96), rgba(255, 255, 255, 0) 76%); }
[data-theme="dark"] #loginGateOverlay .kl-bg .kl-spot { background: radial-gradient(ellipse 42% 52% at 50% 50%, rgba(11, 18, 32, .92), rgba(11, 18, 32, 0) 76%); }
[data-theme="dark"] #loginGateOverlay .kl-l1 span { -webkit-text-stroke-color: rgba(248, 113, 113, .18); }
[data-theme="dark"] #loginGateOverlay .kl-band:nth-child(even) .kl-l1 span { -webkit-text-stroke-color: rgba(148, 163, 184, .18); }
[data-theme="dark"] #loginGateOverlay .kl-cn .lt { color: rgba(248, 113, 113, .45); }
@media (max-width: 520px) { #loginGateOverlay .kl-bg .kl-rows { gap: 26px; } }
@media (prefers-reduced-motion: reduce) { #loginGateOverlay .kl-trk, #loginGateOverlay .kl-cn-spin { animation: none !important; } #loginGateOverlay .kl-btn:hover, #loginGateOverlay .kl-btn:active { transform: none; } }

/* ===== Tồn đọng: phân quyền xem chi tiết (v2.4.2) ===== */
.td-own-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 1px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; line-height: 1.6; letter-spacing: 0; vertical-align: 1px; white-space: nowrap; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.td-top-row.is-own td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); border-top: 1px solid var(--accent-line); border-bottom: 1px solid var(--accent-line); }
.td-top-row.is-own td:first-child { box-shadow: inset 3px 0 0 var(--accent); border-left: 1px solid var(--accent-line); }
.td-top-row.is-own td:last-child { border-right: 1px solid var(--accent-line); }
.td-top-row.is-locked { cursor: default; }
.td-top-row { transition: background-color .15s ease; }
.td-top-row:hover td { background: var(--line-2); }
.td-top-row.is-own:hover td { background: var(--accent-soft); }
.td-top-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.td-access-note { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); }
.td-store-card .td-own-badge { margin-left: 10px; }
.td-modal-ov { position: fixed; inset: 0; z-index: 280; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); opacity: 0; transition: opacity .16s ease; }
.td-modal-ov.is-on { opacity: 1; }
.td-modal { width: min(980px, 100%); max-height: min(90vh, 860px); display: flex; flex-direction: column; background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(8px) scale(.985); transition: transform .18s ease; }
.td-modal-ov.is-on .td-modal { transform: none; }
.td-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.td-modal-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.td-modal-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.td-modal-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 99px; background: var(--line-2); color: var(--muted); font-size: 15px; cursor: pointer; transition: background .15s, color .15s; }
.td-modal-x:hover { background: var(--accent); color: #fff; }
.td-modal-body { padding: 16px 18px 20px; overflow: auto; }
body.td-modal-open { overflow: hidden; }
@media (max-width: 640px) { .td-modal-ov { padding: 0; } .td-modal { max-height: 100%; height: 100%; border-radius: 0; border: 0; } }

/* =====================================================================
   v4.5.0 — ENTERPRISE WORKSPACE (Trang chủ Công việc)
   Chỉ thêm luật mới gắn với class/id mới của index.html (cockpit, KPI 1+4, chip lọc, lịch tuần, sắp đến hạn,
   Command Palette, thanh điều hướng dưới). Không đổi luật dùng chung với dms.html. Light + Dark qua biến màu.
   ===================================================================== */

/* ---------- Chuông thông báo: nút <button> + danh sách thả xuống là phần tử anh em ---------- */
.cv-bell { position: relative; display: inline-flex; flex: none; }
.cv-bell .notif-dropdown-menu { right: 0; top: calc(100% + 8px); }
.cv-bell .notif-bell-wrapper { padding: 0; }

/* ---------- Ô tìm kiếm trên đầu trang: giờ là nút mở Command Palette ---------- */
.cv-search.is-launcher input { cursor: pointer; }
.cv-search.is-launcher:hover input { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
/* Điện thoại hẹp (< 440px): ô tìm kiếm chỉ còn biểu tượng kính lúp (bấm để mở Command Palette) — hết cảnh placeholder bị cắt "Tìm ı"
   và biểu tượng chủ đề bị đè lên ô tìm kiếm ở màn hình 320–360px. */
@media (max-width: 440px) {
  .cv-search-mob.is-launcher { flex: 0 0 40px; width: 40px; max-width: 40px; margin: 0 auto 0 0; }
  .cv-search-mob.is-launcher input { width: 40px; padding: 0; color: transparent; caret-color: transparent; text-shadow: none; }
  .cv-search-mob.is-launcher input::placeholder { color: transparent; }
  .cv-search-mob.is-launcher .cv-search-ic { left: 0; width: 100%; justify-content: center; color: var(--muted); }
}

/* ---------- 1. Morning Cockpit ---------- */
.cv-cockpit { align-items: flex-end; row-gap: 14px; }
.cv-cockpit .cv-pagehead-text { flex: 1 1 380px; }
.cv-greet { display: flex; align-items: center; gap: 12px; font-size: 26px; line-height: 1.22; }
.cv-greet-ic {
  flex: none; width: 42px; height: 42px; border-radius: 13px; font-size: 22px;
  background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber);
}
.cv-greet-ic.is-eve { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.cv-greet-t { min-width: 0; overflow-wrap: anywhere; }
.cv-greet-name { color: var(--accent); }
.cv-greet-comma { color: var(--ink); }
.cv-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin-top: 6px !important; }
.cv-kicker #cvToday { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cv-sep { color: var(--faint); }
.cv-brief { margin-top: 10px; max-width: 74ch; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.cv-brief b { font-weight: 700; color: var(--ink); }
.cv-brief-link {
  display: inline; padding: 0 2px; margin: 0; border: 0; border-radius: 4px; background: none; cursor: pointer; font: inherit; font-weight: 700;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 3px;
  transition: color .15s, text-decoration-color .15s, background .15s;
}
.cv-brief-link:hover { color: var(--accent); text-decoration-color: var(--accent-line); background: var(--accent-soft); }
.cv-brief-link.is-late { color: var(--accent); }
.cv-brief-link.is-soon { color: var(--amber); }
.cv-brief-ok { color: var(--green); font-weight: 600; }
.cv-qa { align-items: center; }
.cv-qa-btn { position: relative; }
.cv-qa-btn [data-icon] { color: var(--muted); transition: color .15s; }
.cv-qa-btn:hover [data-icon] { color: var(--accent); }
.cv-qa-ext { font-size: 12px; opacity: .65; }
.cv-qa-n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; line-height: 1; background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line);
  font-variant-numeric: tabular-nums;
}
.cv-qa-n.is-hot { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-qa-t { min-width: 0; }
@media (max-width: 400px) { .cv-qa-ext { display: none; } }

/* ---------- 2. KPI 1 + 4 ---------- */
#statsRow.cv-kpis { display: block; container: cvkpi / inline-size; }
.cv-kpi-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.cv-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; min-width: 0; }
#statsRow .cv-kpi { grid-column: auto; position: relative; }
#statsRow .cv-kpi:hover { transform: translateY(-1px); }
/* Nhãn thẻ trạng thái được xuống dòng (tối đa 2 dòng, vẫn nằm gọn trong chiều cao của ô biểu tượng) thay vì bị cắt "ĐANG THỰC HI…" */
#statsRow .cv-kpi-grid .cv-kpi .label { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; letter-spacing: .04em; min-width: 0; overflow-wrap: anywhere; }
#statsRow .cv-kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Màu theo trạng thái cho thẻ đang chọn */
#statsRow .cv-kpi.in-progress { --tone: var(--blue); --tone-soft: var(--blue-soft); --tone-line: var(--blue-line); --tone-ink: var(--blue); }
#statsRow .cv-kpi.duesoon { --tone: var(--amber-dot); --tone-soft: var(--amber-soft); --tone-line: var(--amber-line); --tone-ink: var(--amber); }
#statsRow .cv-kpi.done { --tone: var(--green-dot); --tone-soft: var(--green-soft); --tone-line: var(--green-line); --tone-ink: var(--green); }
#statsRow .cv-kpi.overdue { --tone: var(--accent); --tone-soft: var(--accent-soft); --tone-line: var(--accent-line); --tone-ink: var(--accent); }
#statsRow .cv-kpi:not(.cv-kpi-hero).is-active {
  border-color: var(--tone); background: linear-gradient(180deg, var(--tone-soft), var(--surface) 78%);
  box-shadow: 0 0 0 3px var(--tone-line), var(--shadow);
}
[data-theme="dark"] #statsRow .cv-kpi:not(.cv-kpi-hero).is-active { border-color: var(--tone); }
#statsRow .cv-kpi:not(.cv-kpi-hero).is-active .num { color: var(--tone-ink); }
#statsRow .cv-kpi:not(.cv-kpi-hero).is-active .cv-kpi-ic { background: var(--tone); color: #fff; }
#statsRow .cv-kpi:not(.cv-kpi-hero).is-active .cv-kpi-bar { background: var(--tone-line); }
.cv-kpi .cv-kpi-check {
  position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; display: none; place-items: center;
  background: var(--tone, var(--ink)); color: #fff; font-size: 13px; box-shadow: 0 0 0 3px var(--surface); pointer-events: none;
}
.cv-kpi .cv-kpi-check .cv-svg { stroke-width: 3; }
.cv-kpi.is-active .cv-kpi-check { display: grid; animation: cvKpiPop .28s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes cvKpiPop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* Thẻ 1: vòng tròn tiến độ SVG */
.cv-kpi-hero { flex-direction: row; align-items: center; gap: 20px; padding: 18px 22px; background: linear-gradient(135deg, var(--surface) 0%, var(--surface) 55%, var(--green-soft) 100%); }
.cv-ring { --ring: var(--faint); position: relative; flex: none; width: 104px; height: 104px; }
.cv-ring[data-tier="high"] { --ring: var(--green-dot); }
.cv-ring[data-tier="mid"] { --ring: var(--blue); }
.cv-ring[data-tier="low"] { --ring: var(--amber-dot); }
.cv-ring svg { display: block; width: 100%; height: 100%; }
.cv-ring-track, .cv-ring-val { fill: none; stroke-width: 11; }
.cv-ring-track { stroke: var(--line); }
.cv-ring-val { stroke: var(--ring); stroke-linecap: round; stroke-dasharray: 314.159; stroke-dashoffset: 314.159; transition: stroke-dashoffset .9s cubic-bezier(.22, .8, .3, 1), stroke .3s ease; }
.cv-ring-txt { position: absolute; inset: 0; display: grid; grid-auto-flow: column; place-content: center; align-items: baseline; column-gap: 1px; line-height: 1; }
.cv-ring-txt b { font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cv-ring-txt small { font-size: 12px; font-weight: 700; color: var(--muted); }
.cv-kpi-hero-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cv-kpi-hero .num { font-size: 34px; }
.cv-kpi-hero-sub { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.cv-kpi-hero-sub b { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.cv-kpi-hero .cv-kpi-bar { display: none; }
.cv-kpi-hero .cv-kpi-badge { background: var(--line-2); }

/* Thanh phân bổ theo trạng thái (chỉ hiện khi thẻ 1 chiếm cả hàng) */
.cv-kpi-dist { display: none; flex: 1.15; min-width: 0; flex-direction: column; gap: 10px; padding-left: 22px; border-left: 1px solid var(--line-2); }
.cv-dist-bar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.cv-dist-bar i { display: block; height: 100%; min-width: 4px; flex-basis: 0; transition: flex-grow .6s ease; }
.cv-dist-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11.5px; color: var(--muted); }
.cv-dist-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cv-dist-legend b { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.cv-dist-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cv-dist-bar .d-done, .cv-dist-legend .d-done { background: var(--green-dot); }
.cv-dist-bar .d-doing, .cv-dist-legend .d-doing { background: var(--blue); }
.cv-dist-bar .d-soon, .cv-dist-legend .d-soon { background: var(--amber-dot); }
.cv-dist-bar .d-late, .cv-dist-legend .d-late { background: var(--accent); }

/* Bố cục theo bề rộng KHUNG (có Sidebar hay không đều đúng): ≥1040px: thẻ 1 | 4 thẻ 4 cột; 641–1039px: thẻ 1 trên, 4 thẻ 4 cột dưới; ≤640px: 2×2 */
@container cvkpi (min-width: 1040px) { .cv-kpi-wrap { grid-template-columns: 340px minmax(0, 1fr); } }
@container cvkpi (min-width: 641px) and (max-width: 1039px) { .cv-kpi-dist { display: flex; } }
@container cvkpi (max-width: 640px) {
  .cv-kpi-wrap { gap: 12px; }
  .cv-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cv-kpi-hero { gap: 14px; padding: 14px 16px; }
  .cv-ring { width: 88px; height: 88px; }
  .cv-ring-txt b { font-size: 22px; }
  .cv-kpi-hero .num { font-size: 30px; }
  .cv-kpi-grid .cv-kpi { padding: 12px 12px 14px; gap: 8px; }
  .cv-kpi-grid .cv-kpi .label { white-space: normal; line-height: 1.25; letter-spacing: .02em; }
  .cv-kpi-grid .cv-kpi-top { align-items: flex-start; }
  .cv-kpi-grid .cv-kpi-ic { width: 28px; height: 28px; font-size: 14px; }
  .cv-kpi-grid .cv-kpi-mid { flex-wrap: wrap; row-gap: 4px; }
  .cv-kpi-grid .num { font-size: 26px; }
}
@supports not (container-type: inline-size) {
  @media (min-width: 1360px) { .cv-kpi-wrap { grid-template-columns: 340px minmax(0, 1fr); } }
  @media (min-width: 768px) and (max-width: 1359px) { .cv-kpi-dist { display: flex; } }
  @media (max-width: 767px) {
    .cv-kpi-wrap { gap: 12px; }
    .cv-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .cv-kpi-hero { gap: 14px; padding: 14px 16px; }
    .cv-ring { width: 88px; height: 88px; }
    .cv-kpi-grid .cv-kpi { padding: 12px 12px 14px; gap: 8px; }
    .cv-kpi-grid .cv-kpi .label { white-space: normal; line-height: 1.25; }
    .cv-kpi-grid .cv-kpi-ic { width: 28px; height: 28px; font-size: 14px; }
  }
}

/* ---------- 3. Chip bộ lọc đang áp dụng (đầu #cvTasks) ---------- */
.cv-chipbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 20px 12px; outline: none; }
.cv-chipbar[hidden] { display: none !important; }
.cv-chipbar-l { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cv-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 3px 0 10px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-2); font-size: 12px; font-weight: 600; line-height: 1;
}
.cv-chip-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-chip-t b { font-weight: 700; }
.cv-chip-x { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: inherit; font-size: 13px; cursor: pointer; transition: background .15s, color .15s; }
.cv-chip-x:hover { background: var(--accent); color: #fff; }
.cv-chip.t-blue { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.cv-chip.t-blue .cv-chip-x:hover { background: var(--blue); }
.cv-chip.t-amber { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.cv-chip.t-amber .cv-chip-x:hover { background: var(--amber-dot); color: #1F1300; }
.cv-chip.t-green { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.cv-chip.t-green .cv-chip-x:hover { background: var(--green-dot); }
.cv-chip.t-ink { background: var(--line-2); border-color: var(--line); color: var(--ink-2); }
.cv-chip.t-ink .cv-chip-x:hover { background: var(--ink-2); color: var(--surface); }
[data-theme="dark"] .cv-chip { color: #FCA5A5; }
[data-theme="dark"] .cv-chip.t-blue { color: var(--blue); }
[data-theme="dark"] .cv-chip.t-amber { color: var(--amber); }
[data-theme="dark"] .cv-chip.t-green { color: var(--green); }
[data-theme="dark"] .cv-chip.t-ink { color: var(--ink-2); }
.cv-chip-clear { margin-left: auto; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.cv-chip-clear:hover { background: var(--accent-soft); }

/* ---------- 4. Lịch tuần: nổi bật hôm nay, chấm màu + số lượng theo mức độ ---------- */
.cv-day { position: relative; transition: background .2s; }
.cv-day.is-today { background: linear-gradient(180deg, var(--accent-soft) 0, transparent 150px); box-shadow: inset 0 3px 0 var(--accent); }
.cv-day.is-selected { background: var(--accent-soft); }
.cv-day.is-today.is-selected { background: var(--accent-soft); }
.cv-day.is-past:not(.is-today) .cv-day-name, .cv-day.is-past:not(.is-today) .cv-day-num { opacity: .6; }
.cv-day-head { flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 4px 8px; padding: 10px 12px 8px; }
.cv-day-id { display: inline-flex; align-items: center; gap: 8px; }
.cv-day-flag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.cv-day-sum { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 4px; min-height: 18px; }
.cv-lvl { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px 0 5px; border-radius: 999px; font-size: 10.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; background: var(--line-2); color: var(--ink-2); }
.cv-lvl i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cv-lvl.t-late { background: var(--accent-soft); color: var(--accent); }
.cv-lvl.t-soon { background: var(--amber-soft); color: var(--amber); }
.cv-lvl.t-doing { background: var(--blue-soft); color: var(--blue); }
.cv-lvl.t-done { background: var(--green-soft); color: var(--green); }
.cv-day-head:not(:disabled):hover .cv-day-num { box-shadow: 0 0 0 2px var(--line); }
.cv-day.is-today .cv-day-head:not(:disabled):hover .cv-day-num { box-shadow: 0 0 0 3px var(--accent-line); }
.cv-ev-more { display: block; width: 100%; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 700; text-align: left; cursor: pointer; }
.cv-ev-more:hover { background: var(--line-2); color: var(--accent); }

/* Điện thoại: lịch tuần thành danh sách theo ngày (mỗi ngày 1 hàng) thay vì cuộn ngang */
@media (max-width: 767px) {
  .cv-week-wrap { overflow: visible; }
  .cv-week { grid-template-columns: minmax(0, 1fr); min-width: 0; }
  .cv-day { flex-direction: row; align-items: stretch; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .cv-day:last-child { border-bottom: 0; }
  .cv-day.is-today { background: linear-gradient(90deg, var(--accent-soft) 0, transparent 160px); box-shadow: inset 3px 0 0 var(--accent); }
  .cv-day-head { flex: none; width: 104px; flex-direction: column; align-items: flex-start; justify-content: flex-start; flex-wrap: nowrap; gap: 6px; padding: 12px 8px 12px 14px; }
  .cv-day-id { gap: 8px; }
  .cv-day-sum { flex: none; }
  .cv-day-body { flex: 1; min-width: 0; padding: 10px 12px 10px 0; justify-content: center; }
  .cv-day-empty { padding: 4px 0; }
}

/* ---------- 5. Sắp đến hạn: nhóm + huy hiệu đếm ngược ---------- */
.cv-upcoming .cv-up-sec + .cv-up-sec { margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 4px; }
.cv-upcoming li.cv-up-sec { border-top: 0; }
.cv-upcoming li.cv-up-sec + li.cv-up-sec { border-top: 1px solid var(--line-2); }
.cv-up-gh { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cv-up-gh .cv-up-gn { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 10.5px; letter-spacing: 0; background: var(--line); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cv-up-gh.is-red { color: var(--accent); }
.cv-up-gh.is-red .cv-up-gn { background: var(--accent); color: #fff; }
.cv-up-list { list-style: none; margin: 0; padding: 0; }
.cv-up-list > li + li { border-top: 1px solid var(--line-2); }
.cv-up-none { padding: 6px 10px 10px; font-size: 12px; color: var(--muted); }
.cv-up-none.is-ok { color: var(--green); }
.cv-up-cd { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-line); font-variant-numeric: tabular-nums; }
.cv-up-cd.is-late { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-up-cd.is-today { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.cv-up-cd.is-soon { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
[data-theme="dark"] .cv-up-cd.is-today { color: #FCA5A5; }
.cv-up-flame { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--accent); font-weight: 700; }
.cv-up-flame .cv-svg { width: 12px; height: 12px; }
.cv-up .cv-up-go { display: none; }
@media (max-width: 420px) { .cv-up { gap: 10px; padding: 10px 6px; } .cv-up-cd { padding: 0 7px; font-size: 10.5px; } }

/* ---------- 6. Command Palette (Ctrl K) ---------- */
.cv-pal-ov {
  position: fixed; inset: 0; z-index: 1250; display: flex; align-items: flex-start; justify-content: center;
  padding: min(11vh, 110px) 16px 16px; background: rgba(15, 23, 42, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .16s ease;
}
.cv-pal-ov.is-open { opacity: 1; }
.cv-pal {
  width: min(700px, 100%); max-height: min(74vh, 660px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(-10px) scale(.985); transition: transform .18s cubic-bezier(.2, .8, .3, 1);
}
.cv-pal-ov.is-open .cv-pal { transform: none; }
.cv-pal-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--line-2); }
.cv-pal-head:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.cv-pal-head > .cv-pal-ic { flex: none; font-size: 19px; color: var(--faint); }
.cv-pal-input {
  flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent;
  color: var(--ink); font: 500 16px var(--font); -webkit-appearance: none; appearance: none;
}
.cv-pal-input:focus { outline: 0; box-shadow: none; background: transparent; border: 0; }
.cv-pal-input::placeholder { color: var(--faint); font-weight: 400; }
.cv-pal-kbd, .cv-pal-foot kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--muted); font: 600 11px var(--font); box-shadow: none;
}
.cv-pal-close { display: none; width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; background: var(--line-2); color: var(--ink-2); font-size: 18px; cursor: pointer; }
.cv-pal-scopes { display: flex; gap: 6px; padding: 8px 14px; overflow-x: auto; border-bottom: 1px solid var(--line-2); scrollbar-width: none; }
.cv-pal-scopes::-webkit-scrollbar { display: none; }
.cv-pal-scope {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 12px var(--font); white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.cv-pal-scope:hover:not(.is-on) { background: var(--line-2); }
.cv-pal-scope.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cv-pal-scope .n { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--line-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.cv-pal-scope.is-on .n { background: rgba(255, 255, 255, .25); color: #fff; }
.cv-pal-list { flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 8px; }
.cv-pal-gh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.cv-pal-more { border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--accent); font: 700 11px var(--font); letter-spacing: 0; text-transform: none; cursor: pointer; }
.cv-pal-more:hover { background: var(--accent-soft); }
.cv-pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; scroll-margin: 40px 0 8px; }
.cv-pal-item.is-active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.cv-pal-ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: var(--line-2); color: var(--ink-2); }
.cv-pal-ico.k-task { background: var(--blue-soft); color: var(--blue); }
.cv-pal-ico.k-form { background: var(--violet-soft); color: var(--violet); }
.cv-pal-ico.k-policy { background: var(--green-soft); color: var(--green); }
.cv-pal-ico.k-video { background: var(--accent-soft); color: var(--accent); }
.cv-pal-ico.k-warn { background: var(--amber-soft); color: var(--amber); }
.cv-pal-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cv-pal-t { font-size: 13.5px; font-weight: 600; line-height: 1.35; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-pal mark { padding: 0; margin: 0; background: var(--accent-soft); color: var(--accent); border-radius: 3px; box-shadow: 0 0 0 1px var(--accent-soft); font-weight: inherit; text-decoration: none; }
.cv-pal-t mark { font-weight: 700; }
.cv-pal-s { font-size: 11.5px; line-height: 1.35; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-pal-end { flex: none; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--faint); }
.cv-pal-end .cv-svg { width: 15px; height: 15px; }
.cv-pal-item.is-active .cv-pal-end { color: var(--accent); }
.cv-pal-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.cv-pal-badge.t-late { background: var(--accent); color: #fff; }
.cv-pal-badge.t-soon { background: var(--amber-soft); color: var(--amber); }
.cv-pal-badge.t-doing { background: var(--blue-soft); color: var(--blue); }
.cv-pal-badge.t-done { background: var(--green-soft); color: var(--green); }
.cv-pal-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 38px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.cv-pal-empty .cv-empty-ic { font-size: 30px; color: var(--faint); }
.cv-pal-empty b { color: var(--ink-2); }
.cv-pal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line-2); background: var(--surface-2); font-size: 11.5px; color: var(--muted); }
.cv-pal-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.cv-pal-hints span { display: inline-flex; align-items: center; gap: 5px; }
.cv-pal-recent-x { border: 0; background: none; padding: 2px 6px; border-radius: 6px; color: var(--muted); font: 600 11px var(--font); letter-spacing: 0; text-transform: none; cursor: pointer; }
.cv-pal-recent-x:hover { background: var(--line-2); color: var(--accent); }
@media (max-width: 767px) {
  .cv-pal-ov { padding: 0; align-items: stretch; }
  .cv-pal { width: 100%; max-height: none; border: 0; border-radius: 0; transform: translateY(12px); padding-top: env(safe-area-inset-top, 0px); }
  .cv-pal-head { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .cv-pal-kbd { display: none; }
  .cv-pal-close { display: grid; place-items: center; }
  .cv-pal-hints { display: none; }
  .cv-pal-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cv-pal-item { padding: 11px 10px; }
  .cv-pal-list { padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .cv-pal-ov, .cv-pal { transition: none; } }

html.cv-pal-lock, html.cv-pal-lock body { overflow: hidden; }

/* ---------- 7. Thanh điều hướng dưới (chỉ điện thoại < 768px) ---------- */
.cv-bnav { display: none; }
@media (max-width: 767px) {
  body.has-bnav { --bnav-h: 60px; --bnav-total: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px)); }
  .cv-bnav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: var(--bnav-total); padding: 6px max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 22px -14px rgba(15, 23, 42, .28);
  }
  [data-theme="dark"] .cv-bnav { box-shadow: 0 -8px 22px -14px rgba(0, 0, 0, .6); }
  .cv-bnav-btn {
    position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 2px;
    border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: 600 10.5px/1.1 var(--font); cursor: pointer;
    -webkit-tap-highlight-color: transparent; transition: color .2s;
  }
  .cv-bnav-btn:active .cv-bnav-ic { transform: scale(.92); }
  .cv-bnav-ic { position: relative; display: grid; place-items: center; width: 46px; height: 28px; border-radius: 14px; font-size: 20px; transition: background .2s, transform .15s; }
  .cv-bnav-btn.is-on { color: var(--accent); }
  .cv-bnav-btn.is-on .cv-bnav-ic { background: var(--accent-soft); }
  .cv-bnav-btn.is-on .cv-bnav-t { font-weight: 700; }
  .cv-bnav-t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cv-bnav-n {
    position: absolute; top: -4px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff;
    font-size: 9.5px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
  }
  .cv-bnav-n.is-warn { background: var(--amber-dot); color: #1F1300; }
  .cv-bnav-n[hidden] { display: none; }

  /* Nhường chỗ cho thanh dưới: nội dung, chân trang, nút nổi, nút lên đầu trang, hộp hỗ trợ, thông báo */
  body.has-bnav .cv-content { padding-bottom: calc(var(--bnav-total) + 16px); }
  body.has-bnav .cv-foot-inner { padding-bottom: calc(var(--bnav-total) + 72px); }
  body.has-bnav .floating-support-wrapper, body.has-bnav #chatWidgetBtn.sp-fab { bottom: calc(var(--bnav-total) + 12px); }
  body.has-bnav .scroll-top-btn { bottom: calc(var(--bnav-total) + 12px + 44px + 10px); }
  body.has-bnav .chat-widget-box, body.has-bnav #chatWidgetBox.chat-widget-box { bottom: calc(var(--bnav-total) + 12px + 44px + 10px); max-height: calc(100vh - var(--bnav-total) - 140px); max-height: calc(100dvh - var(--bnav-total) - 140px); }
  body.has-bnav .toast-stack { bottom: calc(var(--bnav-total) + 14px); }

  /* Đầu trang (cockpit) trên điện thoại */
  .cv-greet { font-size: 21px; gap: 10px; }
  .cv-greet-ic { width: 36px; height: 36px; font-size: 19px; border-radius: 11px; }
  .cv-qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; align-items: stretch; }   /* 4 nút = lưới 2×2 cân đối */
  .cv-qa .btn-kst { flex: none; width: 100%; min-width: 0; justify-content: center; padding: 0 10px; gap: 6px; }
  .cv-qa-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cv-chipbar { padding: 0 14px 12px; }
}

/* Màn hình rất hẹp (≤ 360px): nhãn nút Quick Actions được xuống dòng thay vì bị cắt */
@media (max-width: 360px) {
  .cv-qa .btn-kst { height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
  .cv-qa-t { white-space: normal; line-height: 1.15; text-align: left; overflow: visible; text-overflow: clip; }
}
