/* =============================================================================
   Module Công việc (view Workflow) - prefix cv-. Màu trạng thái lấy từ CongViecMau (C#),
   truyền vào bằng biến --cv-c trên từng phần tử.
   ============================================================================= */

.cv-muted { color: #5c6873; font-size: 0.85rem; }
.cv-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Ô màu trạng thái (lưới, lịch tuần, thẻ) */
.cv-mau {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    vertical-align: middle;
    flex: none;
}

/* Nhãn trạng thái */
.cv-badge {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: var(--cv-c, #78909c);
    white-space: nowrap;
}

/* 5 ô lọc màu trên thanh công cụ */
.cv-loc-mau { display: flex; gap: 4px; }
.cv-loc {
    width: 26px;
    height: 26px;
    border: 3px solid var(--cv-c);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-weight: 700;
    cursor: pointer;
    background: white;
    user-select: none;
}
.cv-loc.on { color: var(--cv-c); }

/* ---------- Form ---------- */
.cv-status-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 20px 8px;
    padding: 6px 10px;
    background: #f4f7fb;
    border: 1px solid #dfe7f1;
    border-radius: 6px;
}
.cv-dk-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 20px 8px;
    color: #2d3a4a;
}

/* ---------- Dialog định kỳ ---------- */
.cv-dk { padding: 16px 20px; }
.cv-dk-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cv-dk-lbl { min-width: 110px; color: #2d3a4a; }
.cv-dk-thu { display: flex; gap: 8px; margin-top: 6px; }
.cv-dk-day {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #9fbfe0;
    background: #e3eef9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}
.cv-dk-day.on { background: #2ecc71; border-color: #27ae60; color: white; font-weight: 700; }

/* ---------- Dialog chuyển trạng thái ---------- */
.cv-tt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-tt-opt {
    padding: 6px 14px;
    border-radius: 18px;
    border: 2px solid var(--cv-c);
    color: var(--cv-c);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}
.cv-tt-opt.on { background: var(--cv-c); color: white; }

/* Lịch sử: trái dòng thời gian (chấm theo màu trạng thái mới), phải ghi chú + file của mốc đang chọn */
.df-tl-item.cv-tl-mau::before { background: var(--cv-c); }
.cv-ls { display: flex; gap: 0; height: 65vh; position: relative; }
.cv-ls-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--mud-palette-surface, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #5c6873;
}
.cv-ls-list { flex: 0 0 52%; min-width: 0; overflow: auto; border-right: 1px solid #e4e7ea; }
.cv-ls-list .df-tl-item { margin-bottom: 12px; }
.cv-ls-detail { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 16px; }
.cv-tl-click { cursor: pointer; }
.cv-tl-click:hover { border-color: #90b8e0; }
.df-tl-item.cv-tl-chon { border-color: #1e88e5; background: #eef5fd; box-shadow: 0 0 0 1px #1e88e5; }
.cv-ls-title { font-weight: 600; font-size: 16px; padding-left: 8px; border-left: 4px solid #5bc0de; margin-bottom: 4px; }
.cv-ls-label { margin: 14px 0 4px; font-weight: 600; color: #37474f; }
.cv-ls-note { white-space: pre-wrap; word-break: break-word; padding: 8px 10px; background: #f7f9fb; border: 1px solid #e4e7ea; border-radius: 4px; }
@media (max-width: 760px) {
    .cv-ls { flex-direction: column; height: auto; max-height: 75vh; overflow: auto; }
    .cv-ls-list { flex: none; border-right: none; border-bottom: 1px solid #e4e7ea; }
}

/* Dialog chuyển trạng thái: khu đính kèm kết quả */
.cv-tt-nhan { margin: 12px 0 4px; font-size: 13px; font-weight: 600; color: #3a4350; }
.cv-tt-file { margin-top: 12px; padding: 8px; border: 1px dashed #c8ddf0; border-radius: 6px; }

/* Tiêu đề cột có ô "chọn hết" (Phối hợp / Để biết): chữ và ô tick cách nhau */
.cv-th-check { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Lịch tuần (danh sách theo ngày) ---------- */
.cv-tuan { display: flex; flex-direction: column; height: 100%; }
.cv-tuan-nav { display: flex; align-items: center; gap: 6px; padding: 4px 0 8px; flex: none; }
.cv-tuan-title { font-weight: 600; margin-left: 8px; }
.cv-tuan-body { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid #c8ddf0; }
.cv-tuan-table { width: 100%; border-collapse: collapse; }
.cv-tuan-table th {
    position: sticky;
    top: 0;
    background: #e8f1fb;
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    z-index: 1;
}
.cv-tuan-table td { border-top: 1px solid #c8ddf0; padding: 6px 8px; vertical-align: top; cursor: pointer; }
.cv-tuan-table tr:hover td { background: #f4f9ff; }
.cv-tuan-today td { background: #e3eefa; }
.cv-tuan-ngay { display: flex; align-items: center; gap: 8px; }
.cv-tuan-so { font-size: 30px; line-height: 1; font-weight: 300; }
.cv-tuan-time { color: #2d3a4a; white-space: nowrap; }
.cv-tuan-ev { display: flex; align-items: center; gap: 6px; }

/* ---------- Kiểu xem Thẻ (CV_Kanban) ---------- */
.cv-kb { display: flex; gap: 14px; align-items: flex-start; min-height: 100%; background: #eef2fb; padding: 10px; }
.cv-kb-col { width: 300px; flex: none; }
.cv-kb-head {
    background: white;
    border-top: 4px solid #1e88e5;
    border-radius: 4px;
    padding: 10px;
    font-weight: 700;
    margin-bottom: 8px;
}
.cv-kb-list { display: flex; flex-direction: column; gap: 8px; }
.cv-kb-card {
    background: white;
    border-left: 4px solid #1e88e5;
    border-radius: 4px;
    padding: 8px 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    cursor: pointer;
}
.cv-kb-card:hover { box-shadow: 0 3px 8px rgba(0, 0, 0, .18); }
.cv-kb-who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cv-kb-title { margin: 6px 0; }
.cv-kb-foot { display: flex; align-items: center; gap: 8px; }
.cv-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: none;
}

/* ---------- Home dashboard ---------- */
.cv-db {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 12px;
    padding: 10px;
    background: #eef1f6;
    min-height: 100%;
    align-content: start;
}
.cv-db-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cv-db-side { min-width: 0; }
.cv-db-full { grid-column: 1 / -1; }
.cv-db-card { background: white; border-radius: 8px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.cv-db-hello {
    border-radius: 8px;
    padding: 18px 20px;
    text-align: center;
    color: white;
    background: linear-gradient(110deg, #2ecc71 0%, #1abc9c 40%, #1e88e5 100%);
}
/* Logo ngang (~1.4 : 1): khung chữ nhật bo góc - khung tròn sẽ cắt mất 4 góc logo */
.cv-db-logo {
    height: 60px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    background: white;
    border-radius: 12px;
    padding: 4px 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.cv-db-hi { font-size: 17px; margin-top: 6px; }
.cv-db-name { font-size: 24px; font-weight: 600; }
.cv-db-sub { font-size: 14px; margin-top: 2px; }
.cv-db-month { display: flex; gap: 20px; }
.cv-db-month-left { width: 45%; }
.cv-db-month-right { flex: 1 1 auto; min-width: 0; }
.cv-db-big { font-size: 26px; font-weight: 700; color: #4a5568; }
.cv-db-cmp { margin-top: 18px; font-size: 13px; }
.cv-db-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 28px;
    border-top: 1px solid #e3e8ef;
    margin-top: 18px;
    padding-top: 16px;
}
.cv-db-stat { color: #4a5568; }
.cv-db-bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--cv-c) 18%, white); margin-top: 8px; overflow: hidden; }
.cv-db-bar > span { display: block; height: 100%; background: var(--cv-c); }
.cv-db-tb-head { display: flex; align-items: center; margin-bottom: 6px; }
.cv-db-tb-title { font-size: 18px; color: #4a5568; }
.cv-tb-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid #eef1f6; }
.cv-tb-item.click { cursor: pointer; }
.cv-tb-item.click:hover { background: #f4f9ff; }
.cv-tb-so {
    display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px;
    font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
    color: var(--cv-c); background: color-mix(in srgb, var(--cv-c) 12%, white);
}

/* Lịch nhỏ */
.cv-cal-head { display: flex; align-items: center; }
.cv-cal-title { color: #2e7d32; font-weight: 600; }
.cv-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 6px; text-align: center; }
.cv-cal-th { font-size: 12px; color: #4a5568; padding: 4px 0; }
.cv-cal-d {
    position: relative;
    padding: 4px 0 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2d3a4a;
}
.cv-cal-d.out { color: #5b9bd5; }
.cv-cal-d:hover { background: #eef5fc; }
.cv-cal-d.today span { font-weight: 700; }
.cv-cal-d.sel { background: #2ecc71; color: white; }
.cv-cal-dot {
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 6px;
    height: 6px;
    margin-left: -3px;
    border-radius: 50%;
    background: #1e88e5;
}
.cv-cal-d.sel .cv-cal-dot { background: white; }
.cv-cal-day { border-top: 1px solid #e3e8ef; margin-top: 10px; }
.cv-cal-day-head { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.cv-cal-day-date { color: #2e7d32; text-align: center; padding-right: 14px; border-right: 1px solid #e3e8ef; font-size: 13px; }
.cv-cal-day-title { color: #2e7d32; }
.cv-cal-ev { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; }
.cv-cal-ev:hover { background: #f4f9ff; }
.cv-cal-ev-time { width: 92px; color: #4a5568; flex: none; }

@media (max-width: 900px) {
    .cv-db { grid-template-columns: minmax(0, 1fr); }
    .cv-db-month { flex-direction: column; }
    .cv-db-month-left { width: 100%; }
}

/* Form công việc tạo từ phiếu: dòng giải thích trên cùng */
.cv-tu-phieu {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 20px 10px;
    padding: 8px 12px;
    border-left: 4px solid #1e88e5;
    background: #eef5fd;
    border-radius: 4px;
    color: #2d3a4a;
}

/* ---------- Kế hoạch ---------- */
/* svg mặc định inline -> ngồi trên baseline, lệch xuống chạm viền ô: cho block + căn giữa dọc */
.kh-tien-do { display: flex; align-items: center; gap: 8px; height: 100%; line-height: 1; }
.kh-tien-do svg { display: block; flex: none; }
.kh-tien-do-pt { min-width: 38px; font-weight: 700; }
.kh-cv { margin-inline: 20px; display: flex; flex-direction: column; gap: 6px; }
.kh-cv-head { display: flex; align-items: center; gap: 10px; }
.kh-tham-gia { display: flex; flex-wrap: wrap; gap: 6px; margin-inline: 20px; }
.kh-nguoi { padding: 2px 10px; border: 1px solid #c8ddf0; border-radius: 12px; background: #f4f9ff; font-size: 13px; }
