/* nhat-ky.css — kiểu RIÊNG cho trang nhật ký (story 1.4), sao chép từ <style> của v1 2.upload.html + 10.noidung.html +
   3.nhatkylamviec.html (cắt phần đồng bộ ngoài / chatbox). Phần dùng chung (sidebar/header/toast → shell.css; nút/thẻ/banner/bảng → app.css)
   đã tách ở story 1.5. Màu/font chỉ dùng token của tokens.css (CLAUDE.md §3). */

.btn-ai { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 13px; color: #fff; border: none; cursor: pointer; background: linear-gradient(135deg, var(--color-ai-accent), #7C3AED); box-shadow: 0 4px 14px rgba(91,33,182,0.3); transition: opacity .15s; }
.btn-ai[disabled] { opacity: .7; cursor: not-allowed; }
.btn-rec { border-color: #7C3AED; color: #7C3AED; padding: 6px 14px; font-size: 13px; }
.btn-rec.is-recording { border-color: var(--color-error); color: var(--color-error); }
.btn-rec .material-symbols-outlined { color: inherit; }

/* Vùng upload (v1) */
.upload-zone { border: 2px dashed var(--color-border-strong); border-radius: 14px; transition: border-color .2s, background .2s; cursor: pointer; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--color-primary); background: rgba(14,121,96,0.04); }
.upload-zone.drag-over .upload-icon { transform: scale(1.1) translateY(-3px); }
.upload-icon { transition: transform .2s; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #F8F9FB; border: 1px solid var(--color-border); border-radius: 8px; font-size: 13px; }
.stt-step { flex: 1; height: 4px; border-radius: 9999px; background: var(--color-border); transition: background .3s; }
.stt-step.is-on { background: var(--color-primary); }

/* Transcript (10.noidung) */
#transcript-area { width: 100%; border: 1px solid var(--color-border); border-radius: 12px; padding: 16px 18px; resize: vertical; outline: none; background: #fff; font-family: var(--font-editor); font-size: 14.5px; line-height: 1.9; color: var(--color-text-main); min-height: 260px; box-sizing: border-box; }
#transcript-area:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14,121,96,0.1); }
.stat-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--color-background); color: var(--color-text-sub); }

/* Bảng AI (2.upload) */
.ai-panel { background: #fff; border: 1px solid var(--color-border); border-radius: 14px; overflow: hidden; }
.ai-section { border-bottom: 1px solid var(--color-background); }
.ai-section:last-child { border-bottom: none; }
.ai-head { font-weight: 700; color: var(--color-text-main); font-size: 13.5px; margin: 12px 0 4px; }
.ai-line { color: var(--color-text-main); font-size: 13px; padding: 2px 0; }
.ai-line.is-bullet { padding-left: 12px; }
.ai-empty { font-style: italic; color: var(--color-text-sub); }

/* Form nhật ký (3.nhatkylamviec) */
.doc-canvas { background: #fff; border: 1px solid var(--color-border); border-radius: 16px; box-shadow: 0 4px 32px rgba(0,0,0,0.06); }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--color-primary); }
.doc-input { width: 100%; background: transparent; border: none; outline: none; resize: none; font-family: var(--font-ui); }
.doc-input:focus { outline: none; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { padding: 10px 16px; text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-sub); background: #FAFBFC; border-bottom: 1px solid var(--color-border); }
.doc-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-background); font-size: 13.5px; vertical-align: middle; }
.doc-table tbody tr:last-child td { border-bottom: none; }
.doc-table tbody tr:hover { background: rgba(14,121,96,0.02); }
.doc-table th:not(:first-child) { white-space: nowrap; width: 1%; }
.doc-table td:not(:first-child) { white-space: nowrap; }
.doc-table th:last-child { padding-left: 4px; padding-right: 8px; width: 32px; }
.doc-table td:last-child { padding-left: 4px; padding-right: 8px; }
.date-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.doc-table input[type="date"] { background: transparent; border: none; padding: 0; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--color-error); cursor: pointer; width: 110px; }
.doc-table input[type="date"]:focus { outline: none; }
.rich-editor { min-height: 220px; padding: 20px; outline: none; font-family: var(--font-editor); font-size: 14.5px; line-height: 1.85; color: var(--color-text-main); }
.rich-editor p { margin-bottom: 10px; }
.toolbar-btn { width: 30px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--color-text-sub); cursor: pointer; transition: background .15s, color .15s; border: none; background: transparent; }
.toolbar-btn:hover { background: var(--color-background); color: var(--color-text-main); }
.toolbar-btn .material-symbols-outlined { font-size: 17px; }
.doc-textarea { width: 100%; padding: 14px 16px; background: #FAFBFC; border: 1px solid var(--color-border); border-radius: 10px; font-family: var(--font-ui); font-size: 13.5px; line-height: 1.7; color: var(--color-text-main); resize: none; transition: border-color .2s, box-shadow .2s; box-sizing: border-box; }
.doc-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14,121,96,0.1); }
.doc-textarea::placeholder { color: var(--color-border-strong); }
.radio-pill input { display: none; }
.radio-pill label { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 100px; border: 1.5px solid var(--color-border); font-size: 12.5px; font-weight: 600; color: var(--color-text-sub); cursor: pointer; transition: all .15s; user-select: none; }
.radio-pill input:checked + label { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.radio-pill .material-symbols-outlined { font-size: 15px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 100px; font-size: 11px; font-weight: 700; letter-spacing: .05em; background: var(--color-warning-light); color: var(--color-warning); border: 1px solid #FEF0C7; }
.add-row-btn { width: 100%; padding: 11px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-primary); background: #FAFBFC; border: none; border-top: 1px solid var(--color-border); cursor: pointer; transition: background .15s; }
.add-row-btn:hover { background: rgba(14,121,96,0.04); }
.add-row-btn .material-symbols-outlined { font-size: 16px; }
.del-btn { padding: 5px; border-radius: 6px; color: var(--color-border-strong); cursor: pointer; transition: background .15s, color .15s; display: flex; align-items: center; border: none; background: transparent; }
.del-btn:hover { background: var(--color-error-light); color: var(--color-error); }
.del-btn .material-symbols-outlined { font-size: 17px; }
.export-btn { display: flex; align-items: center; gap: 8px; padding: 11px 22px; background: var(--color-primary); color: #fff; border-radius: 10px; font-weight: 700; font-size: 13px; letter-spacing: .04em; cursor: pointer; border: none; box-shadow: 0 4px 16px rgba(14,121,96,0.3); transition: background .15s, box-shadow .2s, transform .1s; }
.export-btn:hover { background: var(--color-primary-dark); box-shadow: 0 6px 20px rgba(14,121,96,0.35); transform: translateY(-1px); }
/* Khoá khi Buổi chưa lưu / đang xuất (story 3.7): như .btn-primary[disabled] — không hover, không nhấc, không bóng. */
.export-btn:disabled, .export-btn:disabled:hover { opacity: .6; cursor: not-allowed; background: var(--color-primary); box-shadow: none; transform: none; }
.customer-field { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #FAFBFC; border: 1px solid var(--color-border); border-radius: 10px; transition: border-color .2s, box-shadow .2s; }
.customer-field:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14,121,96,0.1); background: #fff; }
.customer-field input { background: transparent; border: none; outline: none; flex: 1; min-width: 0; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--color-text-main); }
.customer-field input::placeholder { color: var(--color-border-strong); }
.customer-field input.code { flex: 0 0 110px; font-family: var(--font-mono); letter-spacing: .04em; }
#participants-field { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--color-border); border-radius: 100px; background: #FAFBFC; min-width: 180px; flex: 1; }
#participants-field:focus-within { border-color: var(--color-primary); background: #fff; box-shadow: 0 0 0 3px rgba(14,121,96,0.1); }
#participants-input { background: transparent; border: none; outline: none; flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--color-text-main); }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-text-sub); }
.save-state.is-dirty { color: var(--color-warning); }
.save-state.is-error { color: var(--color-error); }
.draft-project { display: inline-flex; align-items: center; gap: 6px; max-width: 420px; padding: 2px 8px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-background); color: var(--color-text-main); font-size: 12px; font-weight: 600; text-decoration: none; }
.draft-project[href]:hover { border-color: var(--color-primary); color: var(--color-primary); }
.draft-project > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-project[hidden] { display: none; }
@media (max-width: 767px) { .draft-project { max-width: 100%; } }
/* Điện thoại: chip Dự án (tên dài) + trạng thái + mã nháp nằm trên thanh đầu trang cao cố định — nhóm nút phải được CO lại (cắt "…") thay vì đẩy trang
   rộng hơn màn hình; mục breadcrumb cũng cắt thay vì đè lên chip. */
@media (max-width: 767px) {
  .shell-breadcrumb { overflow: hidden; }
  #shell-header-actions { min-width: 0; flex: 0 1 auto; flex-wrap: nowrap; }
  #shell-header-actions .draft-project { min-width: 0; flex: 0 1 auto; }
  #shell-header-actions #draft-id { min-width: 0; max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
}

/* Giờ công & phân bổ (khối #time-block — lưu thành Buổi). Chỉ token của tokens.css; xuống một / hai cột dưới 768 px để trang không cuộn ngang. */
.time-records { display: flex; flex-direction: column; gap: 12px; }
.time-card { border: 1px solid var(--color-border); border-radius: 12px; padding: 14px 16px; background: var(--color-background); min-width: 0; }
.time-card.is-active { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.time-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.time-card-head select { flex: 1 1 180px; min-width: 0; max-width: 100%; }
.time-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--color-text-sub); }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.time-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.time-field label { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--color-text-sub); }
.time-field input { width: 100%; min-width: 0; box-sizing: border-box; height: 34px; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); font-family: var(--font-ui); font-size: 13px; color: var(--color-text-main); }
.time-field input:focus, .alloc-table input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.time-fee-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.time-fee { display: flex; flex-wrap: wrap; gap: 6px; }
#time-block input.is-bad, #time-block select.is-bad { border-color: var(--color-error); box-shadow: 0 0 0 2px var(--color-error-light); }
.time-msg { margin: 8px 0 0; font-size: 12.5px; font-weight: 600; color: var(--color-error); }
.time-add { margin-top: 12px; border: 1px dashed var(--color-border); border-radius: 10px; }
.time-add[disabled] { opacity: .5; cursor: not-allowed; }
.alloc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.alloc-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; font-size: 13px; color: var(--color-text-main); cursor: pointer; overflow-wrap: anywhere; }
.alloc-item input { flex: 0 0 auto; accent-color: var(--color-primary); }
.alloc-item.is-suggested { background: var(--color-primary-light); }
#alloc-suggest-note { overflow-wrap: anywhere; }
.alloc-item > span:not(.badge) { min-width: 0; flex: 1 1 200px; }
.alloc-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.alloc-table th:last-child, .alloc-table td:last-child { width: 1%; padding-left: 16px; padding-right: 16px; }
.alloc-table td input { width: 72px; height: 30px; padding: 2px 8px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); text-align: right; font-family: var(--font-ui); font-size: 13px; color: var(--color-text-main); }
.alloc-total td { padding: 10px 16px; font-weight: 700; border-top: 1px solid var(--color-border); font-size: 13.5px; }
.alloc-total td:not(:first-child) { text-align: right; }
.alloc-total.is-bad td { color: var(--color-error); }
@media (max-width: 767px) {
  .time-card { padding: 12px; }
  .time-grid { grid-template-columns: 1fr 1fr; }
}

/* Story 3.6 — dòng Vấn đề / Việc mang sang trong bảng Tồn đọng / Hành động (nội dung chỉ đọc, chip trạng thái, ô chọn đích, dòng cũ dạng chữ). */
.doc-table td.carry-main { white-space: normal; }
.carry-text { font-size: 13.5px; font-weight: 600; color: var(--color-text-main); white-space: pre-line; overflow-wrap: anywhere; }
.carry-text.is-legacy { font-weight: 500; color: var(--color-text-sub); }
.carry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.carry-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.carry-hint { font-size: 11.5px; color: var(--color-text-sub); white-space: normal; }
.carry-ro { font-size: 13px; color: var(--color-text-sub); white-space: normal; }
.doc-table select.carry-sel { height: 28px; font-size: 12px; max-width: 200px; }
.doc-table input.is-bad, .doc-table select.is-bad { outline: 2px solid var(--color-error); outline-offset: 1px; border-radius: 4px; }
.doc-table tr.is-stale td { background: var(--color-error-light); }
.badge.is-ok { background: var(--color-success-light); color: var(--color-success); }
.badge.is-bad { background: var(--color-error-light); color: var(--color-error); }
.badge.is-warn { background: var(--color-warning-light); color: var(--color-warning); }

/* Story 3.8 — khối "Tệp đính kèm" (Word, transcript, bản scan): danh sách tải. */
.attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attach-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); font-size: 13px; }
.attach-name { flex: 1 1 220px; min-width: 0; font-weight: 600; color: var(--color-text-main); overflow-wrap: anywhere; }
.attach-size { font-size: 12px; color: var(--color-text-sub); white-space: nowrap; }
.attach-dl { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.attach-dl:hover { color: var(--color-primary-dark); text-decoration: underline; }

/* Story 3.9 — khối "Người tham dự" (#atd-block): hai hàng chip (phía Digiwin / phía khách) + ô chọn "+ Chọn…", cờ vai Key user / PM khách, biểu mẫu "Người liên hệ mới".
   Chỉ token của tokens.css; chip xuống dòng tự do — không cuộn ngang trên điện thoại. */
.atd-block { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.atd-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.atd-side-label { flex: 0 0 120px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--color-text-sub); }
.atd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.atd-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 4px 2px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-full); background: var(--color-surface); font-size: 12.5px; font-weight: 600; color: var(--color-text-main); }
.atd-chip.is-ro { padding-right: 10px; }
.atd-chip.is-bad { border-color: var(--color-error); background: var(--color-error-light); }
.atd-chip-text { min-width: 0; overflow-wrap: anywhere; }
.atd-chip .badge { font-size: 11px; padding: 0 6px; }
.atd-chip-del { display: inline-flex; align-items: center; padding: 0 2px; border: none; background: transparent; color: var(--color-text-sub); cursor: pointer; }
.atd-chip-del:hover { color: var(--color-error); }
.atd-chip-del .material-symbols-outlined { font-size: 15px; }
.atd-empty { font-size: 12px; color: var(--color-text-sub); }
.atd-pick { height: 28px; font-size: 12px; max-width: 240px; }
.atd-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-lg); }
.atd-quick input.select-lite { flex: 1 1 200px; min-width: 0; }
.atd-quick input.is-bad, .atd-quick select.is-bad { border-color: var(--color-error); box-shadow: 0 0 0 2px var(--color-error-light); }
.atd-quick .note { flex: 1 1 100%; margin: 0; }
@media (max-width: 767px) { .atd-side-label { flex-basis: 100%; } }

/* Story 3.10 — sửa / xoá / lịch sử Buổi đã lưu: dải "đang sửa" (màu cảnh báo của tokens.css), khung lý do + "Lưu sửa", danh sách lịch sử. Chỉ token có sẵn. */
.banner.is-warn { background: var(--color-warning-light); border-color: var(--color-warning); color: var(--color-warning); }
.revise-bar { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--color-warning); border-radius: var(--radius-lg); background: var(--color-warning-light); }
.revise-bar .form-error { margin: 0; }
#delete-panel { gap: 8px; }
#delete-panel .form-error { margin: 0; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hist-item { padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); font-size: 13px; color: var(--color-text-main); }
.hist-item.is-current { border-color: var(--color-primary); }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 600; }
/* Ticket 16 — khung "Link ký từ xa": ô link chỉ đọc + "Sao chép" trên một hàng (xuống dòng khi hẹp). */
.signlink-new { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.signlink-copy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.signlink-copy .form-input { flex: 1 1 280px; min-width: 0; font-size: 13px; }
.hist-reason { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; color: var(--color-text-sub); }

/* Ticket 17 — "AI điền sẵn Buổi": nhãn "AI điền" là CHỮ THẬT (không chỉ màu) màu ai-accent của tokens.css; ô mang nhãn được tô viền qua :has(.badge.is-ai) —
   sửa ô / bấm "Xác nhận" thì nhãn mất và viền mất theo. Chỉ token có sẵn; Tailwind build sẵn nên không thêm class utility mới. */
.badge.is-ai { background: var(--color-ai-light); color: var(--color-ai-accent); border: 1px solid var(--color-ai-accent); font-size: 11px; padding: 0 6px; white-space: nowrap; }
.ai-field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
.ai-field > input, .ai-field > select, .ai-field > .date-wrap { min-width: 0; }
.ai-field:has(.badge.is-ai) > input, .ai-field:has(.badge.is-ai) > select, .ai-field:has(.badge.is-ai) > .date-wrap { outline: 2px solid var(--color-ai-accent); outline-offset: 1px; border-radius: 4px; }
td.carry-main > .ai-field { display: flex; }
.time-field > .badge.is-ai { align-self: flex-start; }
.time-field:has(> .badge.is-ai) input { border-color: var(--color-ai-accent); box-shadow: 0 0 0 2px var(--color-ai-light); }
.time-fee-row:has(> .badge.is-ai) .radio-pill input:checked + label { outline: 2px solid var(--color-ai-accent); outline-offset: 1px; }
.ai-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; padding: 6px 10px; border: 1px dashed var(--color-ai-accent); border-radius: var(--radius-lg); background: var(--color-ai-light); font-size: 12.5px; color: var(--color-ai-accent); }
.ai-bar-text { flex: 1 1 200px; min-width: 0; }
.ai-mark { display: inline-flex; align-items: center; gap: 6px; }
.alloc-items.is-ai label:has(input:checked) { box-shadow: inset 0 0 0 1px var(--color-ai-accent); background: var(--color-ai-light); }
.carry-cats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.carry-cats select.carry-sel { max-width: 160px; }
a.badge.ai-dup { text-decoration: none; }
a.badge.ai-dup:hover { text-decoration: underline; }
