/* =====================================================================
   Giao diện v7 – "Văn phòng số" cho doanh nghiệp kỹ thuật môi trường.
   Màu nước hồ lắng (teal đậm), nền xám-xanh mát, font Be Vietnam Pro.
   Khung: menu dọc bên trái theo nhóm, thanh trên mảnh; khối nội dung viền mảnh, không đổ bóng.
   ===================================================================== */
:root {
  --ink: #0f2f2b;
  --ink-2: #16413b;
  --lagoon: #0b6e62;
  --lagoon-600: #095a50;
  --lagoon-50: #e4f2ef;
  --lagoon-200: #9ccbc2;
  --lagoon-700: #074a42;
  --brand-rgb: 11, 110, 98;
  --paper: #f2f5f4;
  --surface: #ffffff;
  --line: #d9e3e0;
  --line-strong: #b9cac5;
  --text: #1b2b28;
  --muted: #5e716c;
  --amber: #9a5b0f;
  --amber-50: #fbf0de;
  --red: #b3261e;
  --red-50: #fbe7e5;
  --green: #1f7a4d;
  --green-50: #e2f3ea;
  --blue: #2d5f99;
  --blue-50: #e5eef8;
  --nav-w: 248px;
  --top-h: 56px;
  --radius: 10px;
  --radius-sm: 7px;

  --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.55;
  --bs-body-color: var(--text);
  --bs-body-bg: #ffffff;   /* nền ô nhập, bảng, danh sách; nền trang dùng --paper ở body */
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--radius);
  --bs-primary: var(--lagoon);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--lagoon);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--lagoon-600);
  --bs-link-hover-color-rgb: 9, 90, 80;
  --bs-heading-color: var(--ink);
  --bs-focus-ring-color: rgba(var(--brand-rgb), .28);
}

body { background: var(--paper); font-feature-settings: "tnum" 0; -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1, .h4 { font-size: 1.35rem; }
.h5 { font-size: 1.1rem; }
.h6 { font-size: .95rem; }
.text-muted, .form-text { color: var(--muted) !important; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; }
.num, table td.num, .clock { font-variant-numeric: tabular-nums; }

/* ---------- Khung trang ---------- */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 2000; background: var(--surface); padding: .5rem 1rem; }
.skip-link:focus { left: 1rem; top: 1rem; }

.shell-nav {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w); z-index: 1040;
  background: var(--ink); color: #c9dbd6; display: flex; flex-direction: column;
}
.shell-brand { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 .9rem 0 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.07); }
.shell-brand-link { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.shell-brand-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; color: #7fd1c3; flex: none; }
.shell-menu { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.shell-group + .shell-group { margin-top: .9rem; }
.shell-group-title { font-size: .75rem; color: #7f9a94; padding: 0 .65rem .3rem; font-weight: 500; }
.shell-link {
  position: relative; display: flex; align-items: center; gap: .7rem; padding: .48rem .65rem; border-radius: 8px;
  color: #c9dbd6; text-decoration: none; font-size: .92rem; line-height: 1.3;
}
.shell-link .ico { width: 19px; height: 19px; flex: none; opacity: .85; }
.shell-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.shell-link.active { background: var(--ink-2); color: #fff; font-weight: 600; }
.shell-link.active::before { content: ""; position: absolute; left: -.6rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: #7fd1c3; }
.shell-link.active .ico { opacity: 1; color: #7fd1c3; }
.nav-count { margin-left: auto; min-width: 1.4rem; padding: .05rem .4rem; border-radius: 99px; background: #e0563f; color: #fff; font-size: .72rem;
  font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.shell-company { padding: .8rem 1.1rem 1rem; font-size: .75rem; color: #7f9a94; border-top: 1px solid rgba(255,255,255,.07); }
.shell-close, .shell-burger { display: none; border: 0; background: transparent; padding: .35rem; border-radius: 8px; color: inherit; line-height: 0; }
.shell-close .ico, .shell-burger .ico { width: 22px; height: 22px; }

.shell-top {
  position: sticky; top: 0; z-index: 1020; height: var(--top-h); margin-left: var(--nav-w);
  display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem 0 1.75rem;
  background: rgba(242, 245, 244, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.shell-title { font-weight: 600; color: var(--ink); font-size: .98rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-bell { position: relative; color: var(--ink); line-height: 0; padding: .45rem; border-radius: 8px; }
.shell-bell:hover { background: var(--lagoon-50); }
.shell-bell .ico { width: 22px; height: 22px; }
.notif-badge { position: absolute; top: 0; right: -.15rem; font-size: .65rem; }

.shell-user { position: relative; }
.shell-user summary { list-style: none; display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .25rem .4rem; border-radius: 10px; }
.shell-user summary::-webkit-details-marker { display: none; }
.shell-user summary:hover { background: var(--lagoon-50); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--lagoon); color: #fff; font-weight: 600; font-size: .82rem; letter-spacing: .02em; }
.shell-user-name { display: flex; flex-direction: column; line-height: 1.15; font-weight: 600; font-size: .88rem; color: var(--ink); max-width: 12rem; }
.shell-user-name small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.shell-user-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(15, 47, 43, .14); padding: .35rem; z-index: 1050; }
.shell-user-menu a, .shell-user-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border: 0;
  background: none; border-radius: 7px; color: var(--text); text-decoration: none; font: inherit; font-size: .9rem; text-align: left; }
.shell-user-menu a:hover, .shell-user-menu button:hover { background: var(--lagoon-50); }
.shell-user-menu .ico { width: 18px; height: 18px; color: var(--muted); }
.shell-user-menu form { margin: 0; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }

.shell-main { margin-left: var(--nav-w); padding: 1.5rem 1.75rem 4rem; max-width: calc(1360px + var(--nav-w)); }
.no-shell .shell-main { margin: 0 auto; max-width: 1180px; padding: 1.5rem 1rem 4rem; }
.public-top { height: var(--top-h); display: flex; align-items: center; padding: 0 1.25rem; background: var(--ink); }
.ico { width: 18px; height: 18px; vertical-align: -.2em; }
.shell-backdrop { display: none; }

@media (max-width: 991.98px) {
  .shell-nav { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  body.nav-open .shell-nav { transform: none; }
  body.nav-open .shell-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 47, 43, .45); z-index: 1030; }
  body.nav-open { overflow: hidden; }
  .shell-close, .shell-burger { display: inline-flex; }
  .shell-close { color: #c9dbd6; }
  .shell-top, .shell-main { margin-left: 0; }
  .shell-top { padding: 0 .75rem; }
  .shell-main { padding: 1rem 1rem 4rem; }
  .shell-user-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { .shell-nav { transition: none; } }

/* ---------- Khối nội dung ---------- */
.card { --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius); --bs-card-inner-border-radius: calc(var(--radius) - 1px);
  --bs-card-cap-bg: transparent; --bs-card-cap-padding-y: .8rem; background: var(--surface); }
.card.shadow-sm, .shadow-sm.card { box-shadow: none !important; }
.card-header { font-weight: 600; color: var(--ink); border-bottom-color: var(--line); }
.card-header .small, .card-header a { font-weight: 500; }
a.card { transition: border-color .15s; }
a.card:hover { border-color: var(--lagoon); }
.list-group { --bs-list-group-border-color: var(--line); }
.alert { --bs-alert-border-radius: var(--radius); border-width: 1px; }
.alert-success { --bs-alert-bg: var(--green-50); --bs-alert-color: #145536; --bs-alert-border-color: #bfe3cf; }
.alert-danger { --bs-alert-bg: var(--red-50); --bs-alert-color: #7c1a14; --bs-alert-border-color: #f2c4bf; }
.alert-warning { --bs-alert-bg: var(--amber-50); --bs-alert-color: #6b3f08; --bs-alert-border-color: #efd3a6; }
.alert-info { --bs-alert-bg: var(--blue-50); --bs-alert-color: #1f4470; --bs-alert-border-color: #c6d8ee; }
.alert-secondary { --bs-alert-bg: #edf1f0; --bs-alert-color: var(--text); --bs-alert-border-color: var(--line); }

/* Bảng: tiêu đề nhạt, dòng thưa vừa phải */
.table { --bs-table-border-color: var(--line); --bs-table-hover-bg: #f3f8f7; --bs-table-striped-bg: #f7faf9; }
.table > thead > tr > th, .table-light, .table > thead.table-light th {
  --bs-table-bg: #f5f8f7; --bs-table-color: var(--muted); font-weight: 600; font-size: .82rem; border-bottom-color: var(--line-strong); }
.table > :not(caption) > * > * { padding: .55rem .65rem; }
.table-sm > :not(caption) > * > * { padding: .4rem .55rem; }
.card > .table-responsive > .table, .card > .table { margin-bottom: 0; }

/* Nút */
.btn { --bs-btn-font-weight: 500; --bs-btn-border-radius: 8px; --bs-btn-padding-x: .9rem; }
.btn-sm { --bs-btn-border-radius: 7px; --bs-btn-padding-x: .6rem; }
.btn-primary { --bs-btn-bg: var(--lagoon); --bs-btn-border-color: var(--lagoon); --bs-btn-hover-bg: var(--lagoon-600); --bs-btn-hover-border-color: var(--lagoon-600);
  --bs-btn-active-bg: var(--lagoon-700); --bs-btn-active-border-color: var(--lagoon-700); --bs-btn-disabled-bg: var(--lagoon); --bs-btn-disabled-border-color: var(--lagoon); }
.btn-outline-primary { --bs-btn-color: var(--lagoon); --bs-btn-border-color: var(--lagoon-200); --bs-btn-hover-bg: var(--lagoon); --bs-btn-hover-border-color: var(--lagoon);
  --bs-btn-active-bg: var(--lagoon-600); --bs-btn-active-border-color: var(--lagoon-600); }
.btn-outline-secondary { --bs-btn-color: var(--text); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: #e9efed; --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: var(--line-strong); --bs-btn-active-bg: #dde6e3; --bs-btn-active-color: var(--ink); }
.btn-success { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: #186240; --bs-btn-hover-border-color: #186240; }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); }

/* Ô nhập */
.form-control, .form-select { border-color: var(--line-strong); }
.form-control:focus, .form-select:focus { border-color: var(--lagoon); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .18); }
.form-check-input:checked { background-color: var(--lagoon); border-color: var(--lagoon); }
.form-label { font-weight: 500; color: var(--ink); font-size: .88rem; }
.input-group-text { background: #eef3f1; border-color: var(--line-strong); color: var(--muted); }

/* Nhãn trạng thái: nền nhạt, chữ đậm màu (giữ nguyên lớp bg-* của Bootstrap trong mã) */
.badge { font-weight: 600; letter-spacing: 0; padding: .3em .55em; border-radius: 6px; }
.badge.bg-success { background: var(--green-50) !important; color: #165c3a !important; }
.badge.bg-danger { background: var(--red-50) !important; color: #8f1d17 !important; }
.badge.bg-warning { background: var(--amber-50) !important; color: #7a4609 !important; }
.badge.bg-info { background: #e1f1f6 !important; color: #1d5a6b !important; }
.badge.bg-primary { background: var(--lagoon-50) !important; color: var(--lagoon-600) !important; }
.badge.bg-secondary { background: #e7ecea !important; color: #3e504c !important; }
.badge.bg-dark { background: #dfe5e3 !important; color: #26332f !important; }
.badge.bg-light { background: #f1f4f3 !important; color: var(--muted) !important; border: 1px solid var(--line); }
.badge.rounded-pill.bg-danger.notif-badge, .nav-link .badge.bg-danger { background: #e0563f !important; color: #fff !important; }

/* Thanh tab con (CRM, Nhân sự, Quy trình…) và tab trong trang: gạch chân thay cho viên thuốc */
.nav-pills, .nav-tabs { gap: .25rem; border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-pills::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar { display: none; }
.nav-pills .nav-link, .nav-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none !important; color: var(--muted);
  padding: .55rem .75rem !important; font-weight: 500; white-space: nowrap; margin-bottom: -1px;
}
.nav-pills .nav-link:hover, .nav-tabs .nav-link:hover { color: var(--ink); }
.nav-pills .nav-link.active, .nav-tabs .nav-link.active { color: var(--lagoon-600) !important; border-bottom-color: var(--lagoon); font-weight: 600; }
.nav-tabs + .card { border-top-left-radius: 0; border-top-right-radius: 0; }

.pagination { --bs-pagination-color: var(--lagoon); --bs-pagination-active-bg: var(--lagoon); --bs-pagination-active-border-color: var(--lagoon);
  --bs-pagination-border-color: var(--line); }
.progress { --bs-progress-bar-bg: var(--lagoon); background: #e3ebe9; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

/* ---------- Đăng nhập ---------- */
.login-wrap { display: grid; place-items: center; }

@media print {
  .shell-nav, .shell-top, .shell-backdrop, .public-top { display: none !important; }
  .shell-main { margin: 0 !important; padding: 0 !important; max-width: none; }
}

/* Liên kết trong bảng, danh sách, tiêu đề khối: không gạch chân (gạch khi rê chuột) */
.table a:not(.btn), .list-group a:not(.btn), .card-header a:not(.btn), .nav a, a.card, .card-body > a.d-block { text-decoration: none; }
.table a:not(.btn):hover, .list-group a:not(.btn):hover, .card-header a:not(.btn):hover { text-decoration: underline; }
.table a:not(.btn) { font-weight: 500; }

/* ---------- Chuyển cách xem ---------- */
.view-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
.view-switch a { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; font-size: .85rem; color: var(--muted); text-decoration: none; }
.view-switch a + a { border-left: 1px solid var(--line-strong); }
.view-switch a.active { background: var(--lagoon-50); color: var(--lagoon-600); font-weight: 600; }
.view-switch .ico { width: 16px; height: 16px; }
.btn-secondary { --bs-btn-bg: var(--ink-2); --bs-btn-border-color: var(--ink-2); --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); }

/* ---------- Bảng Kanban ---------- */
.kb-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem;
  scroll-snap-type: x proximity; }
.kb-col { background: #e9efed; border-radius: var(--radius); display: flex; flex-direction: column; min-height: 260px; scroll-snap-align: start; }
.kb-col-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .65rem .8rem .5rem; font-weight: 600; font-size: .88rem; color: var(--ink); }
.kb-col-head .kb-count { min-width: 1.6rem; text-align: center; font-size: .75rem; padding: .05rem .45rem; border-radius: 99px; background: rgba(15,47,43,.08); color: var(--muted); }
.kb-col-head small { font-weight: 500; color: var(--muted); }
.kb-col-head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.kb-col-head > span:first-child { flex: 1; }
.kb-col-in_progress .kb-col-head::before, .kb-col-quoted .kb-col-head::before { background: var(--lagoon); }
.kb-col-review .kb-col-head::before, .kb-col-negotiation .kb-col-head::before { background: #d39028; }
.kb-col-done .kb-col-head::before, .kb-col-won .kb-col-head::before { background: var(--green); }
.kb-col-lost .kb-col-head::before { background: var(--red); }
.kb-col-qualified .kb-col-head::before { background: var(--blue); }
.kb-col-body { flex: 1; padding: .15rem .5rem .6rem; display: flex; flex-direction: column; gap: .5rem; min-height: 80px; border-radius: 0 0 var(--radius) var(--radius);
  transition: background .15s; max-height: 72vh; overflow-y: auto; }
.is-dragging .kb-col-body { outline: 2px dashed transparent; }
.kb-col-body.kb-over { background: rgba(var(--brand-rgb),.08); outline: 2px dashed rgba(var(--brand-rgb),.35); outline-offset: -4px; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .6rem .7rem .55rem; cursor: grab; touch-action: manipulation;
  font-size: .86rem; position: relative; }
.kb-card:hover { border-color: var(--line-strong); }
.kb-card.is-locked { cursor: default; }
.kb-card.is-overdue { border-left: 3px solid var(--red); }
.kb-card.is-saving { opacity: .55; }
.kb-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .4rem; margin-bottom: .3rem; }
.kb-due { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.is-overdue .kb-due { color: var(--red); font-weight: 600; }
.kb-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.35; word-break: break-word; }
.kb-title:hover { color: var(--lagoon); text-decoration: underline; }
.kb-sub { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.kb-value { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: .25rem; }
.kb-progress { height: 3px; background: #e3ebe9; border-radius: 3px; margin: .45rem 0 .4rem; overflow: hidden; }
.kb-progress span { display: block; height: 100%; background: var(--lagoon); }
.kb-meta { display: flex; align-items: center; gap: .4rem; font-size: .76rem; color: var(--muted); }
.kb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-cmt { margin-left: auto; white-space: nowrap; }
.kb-stars { color: #c98a14; margin-left: auto; letter-spacing: .05em; }
.avatar-xs { width: 22px; height: 22px; font-size: .62rem; }
.kb-ghost { opacity: .35; background: var(--lagoon-50); border-style: dashed; }
.kb-chosen { box-shadow: 0 10px 24px rgba(15,47,43,.18); cursor: grabbing; }
.kb-drag { transform: rotate(1.5deg); }
@media (max-width: 575.98px) { .kb-board { grid-auto-columns: 82vw; } }

/* Hộp thoại xác nhận khi kéo thả */
.kb-dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.25rem; width: min(420px, 92vw); box-shadow: 0 24px 60px rgba(15,47,43,.25); }
.kb-dialog::backdrop { background: rgba(15,47,43,.4); }
.star-pick { display: inline-flex; flex-direction: row-reverse; gap: .15rem; }
.star-pick input { position: absolute; opacity: 0; pointer-events: none; }
.star-pick label { font-size: 1.7rem; line-height: 1; color: #cfd8d5; cursor: pointer; }
.star-pick input:checked ~ label, .star-pick label:hover, .star-pick label:hover ~ label { color: #d6951a; }
.star-pick input:focus-visible + label { outline: 2px solid var(--lagoon); border-radius: 4px; }

/* Thông báo nhanh */
#toast-box { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast-msg { padding: .65rem .9rem; border-radius: 9px; background: var(--ink); color: #fff; font-size: .88rem; box-shadow: 0 10px 30px rgba(15,47,43,.25);
  transition: opacity .3s, transform .3s; }
.toast-msg.toast-danger { background: #8f1d17; }
.toast-msg.out { opacity: 0; transform: translateY(6px); }

/* Vùng kéo thả file */
.dropzone { position: relative; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: .9rem 1rem; text-align: center; color: var(--muted);
  font-size: .86rem; background: #f8fbfa; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--lagoon); background: var(--lagoon-50); color: var(--lagoon-600); }
.dropzone .ico { width: 22px; height: 22px; display: block; margin: 0 auto .3rem; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone-files { list-style: none; padding: 0; margin: .5rem 0 0; text-align: left; font-size: .82rem; color: var(--text); }
.dropzone-files li { display: flex; justify-content: space-between; gap: .5rem; padding: .15rem 0; }
.dropzone-files li span:last-child { color: var(--muted); white-space: nowrap; }

/* Kéo sắp xếp các bước quy trình */
.drag-handle { cursor: grab; color: var(--muted); line-height: 0; padding: .25rem; border-radius: 6px; touch-action: none; }
.drag-handle:hover { background: var(--lagoon-50); color: var(--lagoon); }
.drag-handle .ico { width: 18px; height: 18px; }
.sort-ghost { opacity: .4; background: var(--lagoon-50) !important; }
.kb-col-sum { padding: 0 .8rem .45rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.kb-board-deals { grid-auto-columns: minmax(215px, 1fr); }

/* ---------- Thẻ chấm công (điểm nhấn của trang chủ) ---------- */
.checkin { background: var(--ink); color: #d6e7e2; border-radius: 14px; padding: 1.4rem 1.4rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.checkin-date { font-size: .9rem; color: #9fbab3; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.checkin-tag { background: rgba(255,255,255,.1); color: #f2d7a6; padding: .1rem .5rem; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.checkin .clock { font-size: clamp(3.2rem, 7vw, 4.4rem); font-weight: 700; line-height: 1; color: #fff; letter-spacing: -.03em; margin: 0; }
.checkin-day-track { height: 8px; border-radius: 8px; background: rgba(255,255,255,.1); overflow: hidden; }
.checkin-day-track span { display: block; height: 100%; background: linear-gradient(90deg, #3fae9c, #7fd1c3); border-radius: 8px; }
.checkin-day-labels { display: flex; justify-content: space-between; font-size: .75rem; color: #8aa8a1; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.checkin-times { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 0; }
.checkin-times > div { background: rgba(255,255,255,.06); border-radius: 10px; padding: .6rem .75rem; }
.checkin-times dt { font-weight: 400; font-size: .78rem; color: #9fbab3; }
.checkin-times dd { margin: 0; font-size: 1.35rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.checkin-btn { width: 100%; border: 0; border-radius: 10px; padding: .85rem 1rem; font: inherit; font-weight: 700; font-size: 1.05rem;
  background: #7fd1c3; color: var(--ink); transition: background .15s, transform .1s; }
.checkin-btn:hover { background: #9adccf; }
.checkin-btn:active { transform: translateY(1px); }
.checkin-btn.is-out { background: #f2b8a8; color: #4a1610; }
.checkin-btn.is-out:hover { background: #f6cabd; }
.checkin-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.checkin-note { background: rgba(255,255,255,.08); border-radius: 10px; padding: .65rem .8rem; font-size: .9rem; color: #e6f1ee; }

.table-nowrap td, .table-nowrap th { white-space: nowrap; }
/* Đăng nhập: khối thương hiệu màu hồ lắng + biểu mẫu */
body.no-shell:has(.login-wrap) .public-top { display: none; }
.login-wrap { min-height: calc(100vh - 3rem); }
.login-split { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 860px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; }
.login-brand { background: var(--ink); color: #c9dbd6; padding: 2.5rem 2.25rem; display: flex; flex-direction: column; justify-content: flex-end; min-height: 380px;
  background-image: radial-gradient(120% 70% at 0% 100%, rgba(63,174,156,.35), transparent 60%); }
.login-mark { width: 44px; height: 44px; color: #7fd1c3; margin-bottom: auto; }
.login-app { font-size: 1.9rem; font-weight: 700; color: #fff; letter-spacing: -.02em; line-height: 1.15; }
.login-company { color: #9fbab3; margin-top: .25rem; }
.login-lead { margin: 1.25rem 0 0; font-size: .92rem; max-width: 30ch; color: #c9dbd6; }
.login-form { padding: 2.5rem 2.25rem; }
.login-form h1 { font-size: 1.5rem; }
@media (max-width: 767.98px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { min-height: 0; padding: 1.5rem; }
  .login-mark { margin-bottom: 1rem; }
  .login-app { font-size: 1.4rem; }
  .login-lead { display: none; }
  .login-form { padding: 1.5rem; }
}

/* ---------- Kế toán ---------- */
.acc-chart .acc-lv2 { padding-left: 1.4rem; }
.acc-chart .acc-lv3 { padding-left: 2.6rem; }
.acc-lines-table th, .acc-lines-table td { padding-left: .25rem; padding-right: .25rem; }
.acc-lines-table th:first-child, .acc-lines-table td:first-child { padding-left: .75rem; }
.acc-lines-table td { min-width: 7rem; }
.acc-lines-table td:first-child { min-width: 11rem; }
.acc-lines-table select.acc-acct { min-width: 11rem; }
.acc-lines-table td.c-unit { min-width: 4rem; width: 4.5rem; }
.acc-lines-table td.c-qty { min-width: 4.5rem; width: 5rem; }
.acc-lines-table td.c-rate { min-width: 5rem; width: 5.5rem; }
.acc-lines-table td.c-money { min-width: 7.5rem; width: 8rem; }
.acc-lines-table td.c-apply { min-width: 14rem; }
.acc-lines-table td.c-btn { min-width: 0; width: 2.5rem; padding-right: .75rem; }
.acc-lines-table .num, .acc-form input.num { text-align: right; }
.acc-totals { font-variant-numeric: tabular-nums; }
.stat { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--text); text-decoration: none; height: 100%; }
a.stat:hover { border-color: var(--lagoon); }
.stat-label { font-size: .84rem; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.25; }
.stat-note { font-size: .78rem; color: var(--muted); }
.stat-note.bad { color: var(--red); font-weight: 600; }
.tb-total td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.voucher-print { max-width: 820px; margin: 0 auto; background: #fff; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); }
.voucher-print p { margin-bottom: .45rem; }
.voucher-sign .col { min-height: 7rem; }
@media print { .voucher-print { border: 0; padding: 0; } }
.cf-chart { width: 100%; height: auto; display: block; }
.cf-in { fill: #0e8a7a; }
.cf-out { fill: #c4791f; }
.cf-grid { stroke: #e3ebe9; stroke-width: 1; }
.cf-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cf-hit { fill: transparent; }
.cf-hit:hover { fill: rgba(15,47,43,.04); }
.chart-legend { color: var(--muted); font-weight: 500; }
.chart-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.lg-in { background: #0e8a7a; }
.lg-out { background: #c4791f; }

/* Bộ lọc dạng hàng: ô chọn dài (tên tài khoản) không làm tràn ngang trên điện thoại */
form.d-flex .form-select.w-auto { max-width: 100%; }
/* Chứng từ mới lập: trên điện thoại, diễn giải không bị ép thành cột chữ hẹp */
.acc-recent td:nth-child(2) { min-width: 12rem; }
@media (max-width: 575.98px) { .acc-recent td:nth-child(2) { min-width: 9rem; } .acc-recent td:last-child { white-space: nowrap; } }

/* ---------- Sản xuất (v9) ---------- */
.pre-wrap { white-space: pre-wrap; }
.form-narrow { max-width: 760px; }
.kb-prod .kb-card-top { gap: .35rem; }
.kb-prod .kb-title { font-size: .9rem; }
.kb-col-done .kb-col-head { color: var(--green); }
.prod-progress-lg { height: 8px; border-radius: 4px; }
.prod-prog-cell { min-width: 9rem; }
.prod-prog-cell .kb-progress { margin: .2rem 0; }
.prod-dl dt { font-weight: 500; color: var(--muted); }
.prod-dl dd { margin-bottom: .35rem; }
.prod-steps tr.step-done td { color: var(--muted); }
.prod-steps tr.step-done td:nth-child(2) { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.worker-pick { position: relative; }
.worker-pick > summary { cursor: pointer; list-style: none; padding: .2rem .5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); max-width: 22rem; }
.worker-pick > summary::-webkit-details-marker { display: none; }
.worker-pick[open] > summary { border-style: solid; border-color: var(--lagoon); }
.worker-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 16rem; max-height: 18rem; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(15, 47, 43, .14); padding: .5rem .75rem; }
.worker-list .form-check { margin-bottom: .25rem; }
.acc-lines-table td.c-qty2 { min-width: 7rem; width: 9rem; }
.qc-table td:nth-child(n+2):nth-child(-n+4) { width: 6rem; }
.sign-cell { min-width: 7rem; }
.prod-print { max-width: 900px; }
.prod-deliver .form-control { min-width: 10rem; }
@media print {
  .prod-print table { font-size: 11px; }
  .worker-pick > summary { border: 0; padding: 0; }
}
/* Bảng sản xuất trên điện thoại: giữ chữ 1 dòng, cuộn ngang trong khung thay vì ép cột hẹp */
@media (max-width: 767.98px) {
  .prod-tbl th, .prod-tbl td { white-space: nowrap; }
  .prod-tbl td.pre-wrap, .prod-tbl .worker-list, .prod-tbl .worker-list * { white-space: normal; }
  .prod-tbl .worker-pick > summary { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- v10: sơ đồ khối quy trình ---------- */
.flowchart { display: block; width: 100%; max-width: 680px; height: auto; margin: 0 auto; font-family: inherit; }
.flowchart .fc-t { fill: var(--text); font-size: 13px; }
.flowchart .fc-tb { font-weight: 600; }
.flowchart .fc-ts { font-size: 11.5px; fill: var(--muted); font-weight: 400; }
.flowchart .fc-box { fill: #fff; stroke: var(--line-strong); stroke-width: 1.4; }
.flowchart .fc-decision { fill: var(--amber-50); stroke: #c99a52; }
.flowchart .fc-document { fill: var(--blue-50); stroke: #8fb0d6; }
.flowchart .fc-terminal { fill: var(--lagoon-50); stroke: var(--lagoon); stroke-width: 1.4; }
.flowchart .fc-branch { fill: var(--red-50); stroke: #e3a39e; stroke-dasharray: 4 3; }
.flowchart .fc-line { stroke: #7d918c; stroke-width: 1.5; fill: none; }
.flowchart .fc-no { stroke: #c0564f; stroke-dasharray: 5 4; }
.flowchart .fc-arrow { fill: #7d918c; }
.flowchart .fc-lab { font-size: 11px; fill: var(--muted); font-style: italic; }
.flowchart .fc-done { fill: var(--green-50); stroke: var(--green); }
.flowchart .fc-current { stroke: var(--lagoon); stroke-width: 3; }
.flowchart .fc-stopped { stroke: var(--red); stroke-width: 2.5; }
.flowchart .fc-mark { fill: var(--green); font-size: 16px; font-weight: 700; }
.flowchart .fc-mark-cur { fill: var(--lagoon); }
.flow-preview { background: var(--paper); max-height: 760px; overflow-y: auto; }
details.flow-card > summary { cursor: pointer; list-style: none; }
details.flow-card > summary::-webkit-details-marker { display: none; }
.handbook-cover { min-height: 60vh; padding: 3rem 1rem; }
.handbook-toc { columns: 2; column-gap: 2rem; }
.handbook-proc { border-top: 2px solid var(--line); padding-top: 1.5rem; margin-top: 2rem; }
@media print {
  .handbook-proc { break-before: page; border-top: 0; margin-top: 0; }
  .handbook-cover { min-height: auto; }
  .handbook-flow .flowchart { max-height: 24cm; }
}
/* ---------- nhắc tên @ ---------- */
.mention { background: var(--lagoon-50); color: var(--lagoon-600); border-radius: 4px; padding: 0 .2em; font-weight: 600; }
.mention-me { background: #fde9b8; color: #6b4300; }
.mention-box { position: absolute; left: var(--mx, 0); top: var(--my, 0); width: var(--mw, 320px); z-index: 1080; list-style: none; margin: 0; padding: .25rem 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(15, 47, 43, .16); max-height: 18rem; overflow-y: auto; }
.mention-box li { padding: .35rem .7rem; cursor: pointer; display: flex; flex-direction: column; line-height: 1.25; }
.mention-box li span { font-size: .78rem; color: var(--muted); }
.mention-box li.is-active, .mention-box li:hover { background: var(--lagoon-50); }
.mention-hint { margin-top: -.25rem; margin-bottom: .4rem; }
/* ---------- chấm công định vị ---------- */
.checkin-geo { margin-top: .3rem; }
.checkin-geo .badge { font-size: .7rem; }
.checkin .geo-map { color: #9fd3c8; }
.checkin-hint { font-size: .8rem; color: #9fbab3; display: flex; gap: .35rem; align-items: center; }
.checkin-hint .ico { width: 1rem; height: 1rem; flex: none; }
.checkin-geo-msg { margin-top: .6rem; background: rgba(255, 120, 110, .16); color: #ffd6d2; border-radius: 8px; padding: .5rem .7rem; font-size: .85rem; }
.att-geo { margin-top: .15rem; white-space: nowrap; }
.att-geo .badge, .geo-badge { font-size: .68rem; font-weight: 600; }
/* ---------- công tác ---------- */
.trip-flow { list-style: none; padding: 0; margin: 0 0 .75rem; }
.trip-flow li { position: relative; padding: 0 0 .65rem 1.6rem; color: var(--muted); }
.trip-flow li::before { content: ""; position: absolute; left: .3rem; top: .3rem; width: .7rem; height: .7rem; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; }
.trip-flow li:not(:last-child)::after { content: ""; position: absolute; left: .6rem; top: 1.05rem; bottom: 0; width: 2px; background: var(--line); }
.trip-flow li.is-done { color: var(--text); }
.trip-flow li.is-done::before { background: var(--green); border-color: var(--green); }
.trip-flow li.is-current { color: var(--lagoon-600); font-weight: 600; }
.trip-flow li.is-current::before { border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-50); }
.trip-flow li.is-stop::before { background: var(--red); border-color: var(--red); }

/* ---------- v11: Soạn quy trình bằng khối ---------- */
.view-switch button { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; font-size: .85rem; color: var(--muted); background: none; border: 0; }
.view-switch button + button { border-left: 1px solid var(--line-strong); }
.view-switch button.active { background: var(--lagoon-50); color: var(--lagoon-600); font-weight: 600; }
.view-switch button:focus-visible { outline: 2px solid var(--lagoon); outline-offset: -2px; }
.fb-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.fb-palette { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; min-width: 0; }
.fb-pal-title { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-right: .1rem; }
.fb-pal-sep { margin-left: .5rem; }
.fb-chip { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: .28rem .75rem .28rem .5rem; font-size: .82rem; color: var(--text); cursor: grab; user-select: none; -webkit-user-select: none; transition: box-shadow .15s, border-color .15s; }
.fb-chip:hover { border-color: var(--lagoon); box-shadow: 0 2px 8px rgba(15,47,43,.12); }
.fb-chip:active { cursor: grabbing; }
.fb-chip-decision { background: var(--amber-50); border-color: #e2c48f; }
.fb-chip-document { background: var(--blue-50); border-color: #b7cbe4; }
.fb-chip-preset { border-style: dashed; }
.fb-mini { width: 18px; height: 12px; border: 1.6px solid var(--ink-2); border-radius: 3px; flex: none; background: var(--surface); }
.fb-mini-decision { width: 11px; height: 11px; transform: rotate(45deg); border-radius: 1px; margin: 0 3px; border-color: #b07a26; background: var(--amber-50); }
.fb-mini-document { border-radius: 2px 2px 7px 1px; border-color: var(--blue); background: var(--blue-50); }
.fb-starter { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin: 0; }
.fb-starter span { white-space: nowrap; }
.fb-starter select { max-width: 16rem; }
.fb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.fb-canvas { padding: 1.25rem 1rem 1.75rem; background-color: var(--paper); background-image: radial-gradient(#d3dfdb 1px, transparent 1.2px); background-size: 18px 18px;
  min-height: 440px; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.fb-term { background: var(--lagoon-50); border: 1.6px solid var(--lagoon); color: var(--ink); border-radius: 999px; padding: .45rem 1.4rem; font-weight: 600; font-size: .86rem;
  text-align: center; max-width: 340px; position: relative; z-index: 1; }
.fb-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; min-height: 24px; }
.fb-list.is-empty { min-height: 96px; max-width: 380px; margin-top: 18px; border: 2px dashed var(--line-strong); border-radius: 14px; justify-content: center; background: rgba(255,255,255,.6); }
.fb-list.is-empty::after { content: "Kéo khối từ thanh trên thả vào đây, hoặc bấm + bên dưới"; color: var(--muted); font-size: .85rem; text-align: center; padding: 0 1rem; }
.fb-list > .fb-chip { margin: 14px auto 0; }
.fb-link { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; padding-top: 46px; }
.fb-link::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 40px; margin-left: -1px; background: #7d918c; }
.fb-link::after { content: ""; position: absolute; top: 36px; left: 50%; margin-left: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid #7d918c; }
.fb-ins { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--lagoon); font-weight: 700; font-size: 15px; line-height: 1; padding: 0; opacity: .6; transition: opacity .15s, transform .15s, border-color .15s; }
.fb-link:hover > .fb-ins, .fb-ins:focus-visible { opacity: 1; border-color: var(--lagoon); }
.fb-ins:hover { transform: translateX(-50%) scale(1.15); }
.fb-ins:focus-visible { outline: 3px solid rgba(var(--brand-rgb),.35); }
.fb-yes { position: absolute; top: 12px; left: calc(50% + 18px); font-size: .72rem; font-style: italic; color: var(--muted); }
.fb-box { position: relative; width: 100%; max-width: 380px; min-height: 64px; background: var(--surface); border: 1.6px solid var(--line-strong); border-radius: 10px;
  padding: .6rem .9rem .6rem 2.5rem; cursor: pointer; box-shadow: 0 1px 2px rgba(15,47,43,.06); transition: box-shadow .15s, border-color .15s; z-index: 1; }
.fb-box:hover { border-color: var(--lagoon); box-shadow: 0 4px 14px rgba(15,47,43,.12); }
.fb-box:focus-visible { outline: 3px solid rgba(var(--brand-rgb),.35); outline-offset: 3px; }
.fb-node.is-selected .fb-box { border-color: var(--lagoon); box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.22); }
.fb-node.is-warn .fb-box { border-style: dashed; border-color: #d48a84; }
.fb-body { position: relative; z-index: 1; min-width: 0; }
.fb-no { position: absolute; left: -1.9rem; top: .05rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ink-2); color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.fb-name { font-weight: 600; font-size: .9rem; line-height: 1.32; overflow-wrap: anywhere; }
.fb-noname { color: var(--red); font-style: italic; font-weight: 500; }
.fb-who, .fb-meta { font-size: .76rem; color: var(--muted); margin-top: .2rem; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; overflow-wrap: anywhere; }
.fb-who .ico { width: 13px; height: 13px; flex: none; }
.fb-warn { color: var(--red); font-weight: 500; }
.fb-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 0; pointer-events: none; }
.fb-shape path { stroke-width: 1.6px; transition: stroke .15s; }
.fb-s-decision .fb-box, .fb-s-document .fb-box { background: transparent; border: 0; box-shadow: none; }
.fb-s-decision .fb-shape path { fill: var(--amber-50); stroke: #c99a52; }
.fb-s-document .fb-shape path { fill: var(--blue-50); stroke: #8fb0d6; }
.fb-s-decision .fb-box:hover .fb-shape path, .fb-s-document .fb-box:hover .fb-shape path,
.fb-s-decision.is-selected .fb-shape path, .fb-s-document.is-selected .fb-shape path { stroke: var(--lagoon); stroke-width: 2.4px; }
.fb-node.is-selected .fb-shape { filter: drop-shadow(0 0 4px rgba(var(--brand-rgb),.45)); }
.fb-s-decision.is-warn .fb-shape path, .fb-s-document.is-warn .fb-shape path { stroke: #d48a84; stroke-dasharray: 5 4; }
.fb-s-decision .fb-box { max-width: 430px; min-height: 140px; padding: 1.7rem 23%; display: flex; align-items: center; justify-content: center; text-align: center; }
.fb-s-decision .fb-no { position: static; display: inline-flex; margin: 0 auto .2rem; }
.fb-s-decision .fb-who, .fb-s-decision .fb-meta { justify-content: center; }
.fb-s-document .fb-box { padding-bottom: 1.5rem; }
.fb-branch { margin-top: .4rem; font-size: .74rem; color: var(--red); background: var(--red-50); border: 1px dashed #e3a39e; border-radius: 8px; padding: .2rem .6rem; max-width: 380px; text-align: center; }
.fb-ghost { opacity: .35; }
.fb-chosen .fb-box { box-shadow: 0 10px 24px rgba(15,47,43,.2); }
.fb-inspector { border-left: 1px solid var(--line); background: var(--surface); padding: 1rem; min-width: 0; }
.fb-insp-inner { position: sticky; top: calc(var(--top-h) + 12px); }
.fb-insp-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.fb-insp-tools { display: flex; gap: .25rem; }
.fb-insp-tools .btn { padding: .15rem .45rem; }
.fb-shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.fb-shape-btn { border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); padding: .45rem .2rem .35rem; font-size: .76rem; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.fb-shape-btn[aria-pressed="true"] { border-color: var(--lagoon); background: var(--lagoon-50); color: var(--lagoon-600); font-weight: 600; box-shadow: inset 0 0 0 1px var(--lagoon); }
.fb-insp-warn { color: var(--red); min-height: 1.2em; }
.fb-insp-warn:empty { display: none; }
@media (max-width: 991.98px) {
  .fb-layout { grid-template-columns: minmax(0, 1fr); }
  .fb-inspector { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1060; max-height: 72vh; overflow-y: auto; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0; box-shadow: 0 -12px 32px rgba(15,47,43,.22); transform: translateY(105%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .fb-inspector.is-open { transform: none; visibility: visible; }
  .fb-insp-inner { position: static; }
  .fb-canvas { padding: 1rem .75rem 1.5rem; min-height: 360px; }
  .fb-starter { width: 100%; }
  .fb-starter select { max-width: none; flex: 1; }
  .fb-ins { opacity: 1; }
}
@media (hover: none) { .fb-ins { opacity: 1; } }
@media print { .fb-card { display: none; } }

/* ---------- v11: Dự án ---------- */
.min-w-0 { min-width: 0; }
.proj-c-teal { --pj: #0b6e62; --pj-50: #e4f2ef; }
.proj-c-blue { --pj: #2d5f99; --pj-50: #e5eef8; }
.proj-c-green { --pj: #1f7a4d; --pj-50: #e2f3ea; }
.proj-c-amber { --pj: #9a5b0f; --pj-50: #fbf0de; }
.proj-c-red { --pj: #b3261e; --pj-50: #fbe7e5; }
.proj-c-purple { --pj: #6b3fa0; --pj-50: #f0e9f8; }
.proj-c-gray { --pj: #4f5f5b; --pj-50: #edf1f0; }
.proj-tag { display: inline-block; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: .72rem; font-weight: 600;
  padding: .05rem .5rem; border-radius: 999px; color: var(--pj); background: var(--pj-50); border: 1px solid var(--pj); text-decoration: none; line-height: 1.5; }
a.proj-tag:hover { background: var(--pj); color: #fff; }
.kb-proj { margin: -.15rem 0 .3rem; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .9rem; }
.proj-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--pj); border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: 0 1px 2px rgba(15,47,43,.05); transition: box-shadow .15s, transform .15s; }
.proj-card:hover { box-shadow: 0 6px 20px rgba(15,47,43,.12); transform: translateY(-1px); }
.proj-code { font-size: .72rem; font-weight: 700; letter-spacing: .03em; color: var(--pj); text-transform: uppercase; }
.proj-name { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.proj-bar { height: 7px; border-radius: 7px; background: #e3ebe9; overflow: hidden; }
.proj-bar span { display: block; height: 100%; background: var(--pj, var(--lagoon)); border-radius: 7px; }
.proj-bar-lg { height: 10px; }
.proj-people { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; position: relative; z-index: 2; }
.proj-people .avatar { border: 2px solid var(--surface); }
.proj-owner { box-shadow: 0 0 0 2px var(--pj); }
.proj-head { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--pj); border-radius: var(--radius); padding: 1rem 1.1rem; }
.proj-prog-cell { min-width: 6rem; }
.proj-swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.proj-swatch { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line-strong); border-radius: 999px; padding: .2rem .7rem .2rem .3rem; cursor: pointer; font-size: .82rem; }
.proj-swatch input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--pj); margin: 0; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--pj); }
.proj-swatch input:checked { box-shadow: 0 0 0 2px var(--pj), 0 0 0 4px var(--pj-50); }
.proj-swatch:has(input:checked) { border-color: var(--pj); background: var(--pj-50); font-weight: 600; }
.proj-swatch input:focus-visible { outline: 2px solid var(--pj); outline-offset: 2px; }
.member-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .25rem .75rem; max-height: 320px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .5rem .75rem; background: var(--surface); }
.member-opt { display: flex; align-items: center; gap: .45rem; padding: .2rem .25rem; border-radius: 6px; cursor: pointer; font-size: .88rem; min-width: 0; }
.member-opt:hover { background: var(--paper); }
.member-opt > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-node.is-selected.fb-s-decision .fb-box, .fb-node.is-selected.fb-s-document .fb-box { box-shadow: none; }
.fb-who { flex-wrap: nowrap; align-items: flex-start; }
.fb-who .ico { margin-top: .15rem; }
.fb-who > span { min-width: 0; }
.fb-node { scroll-margin-top: calc(var(--top-h) + 8px); }

/* ---------- v12: Phân quyền module ---------- */
.mod-wrap { max-height: 72vh; }
.mod-table thead th { position: sticky; top: 0; z-index: 2; background: #f3f6f5; vertical-align: bottom; }
.mod-table th.mod-emp, .mod-table td.mod-emp { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 13rem; max-width: 17rem; box-shadow: 1px 0 0 var(--line); }
.mod-table thead th.mod-emp { z-index: 3; background: #f3f6f5; }
.mod-col { display: inline-flex; flex-direction: column; align-items: center; gap: .15rem; border: 0; background: none; padding: .2rem .25rem; font-size: .76rem; font-weight: 600;
  color: var(--ink); line-height: 1.2; min-width: 3.6rem; max-width: 5.6rem; border-radius: 6px; }
button.mod-col:hover { background: var(--lagoon-50); color: var(--lagoon-600); }
.mod-col .ico { width: 18px; height: 18px; }
.mod-col small { font-weight: 400; color: var(--muted); }
.mod-chk { width: 1.15rem; height: 1.15rem; cursor: pointer; }
.mod-prod { min-width: 7.2rem; }
.mod-table td, .mod-table th { padding-left: .3rem; padding-right: .3rem; }
.mod-admin td { background: var(--paper); }
.mod-rowbtn { font-size: .74rem; white-space: nowrap; }
.mod-foot { position: sticky; bottom: 0; background: var(--surface); z-index: 2; }

/* ---------- v12: Tài liệu đính kèm lệnh sản xuất ---------- */
.prod-files { border-top: 1px solid var(--line); padding-top: .75rem; }
.pf-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .4rem; }
.pf-item { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.pf-thumb { flex: none; width: 46px; height: 46px; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--paper); }
.pf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pf-ext { font-size: .66rem; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--ink-2); }
.pf-ext-pdf { background: #b3261e; }
.pf-ext-cad { background: #2d5f99; }
.pf-ext-xls { background: #1f7a4d; }
.pf-ext-doc { background: #2b579a; }
.pf-ext-zip { background: #7a5b16; }
.pf-info { flex: 1; }
.pf-name { display: block; font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-upload { background: var(--paper); border-radius: var(--radius-sm); padding: .6rem; }

/* ---------- v13: Hợp đồng lao động ---------- */
.hd-doc { font-family: "Times New Roman", Times, serif; font-size: 15px; line-height: 1.55; color: #111; }
.hd-paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 2.2rem 2.6rem; border: 1px solid var(--line); box-shadow: 0 2px 14px rgba(15,47,43,.08); }
.hd-doc p { margin: 0 0 .55rem; text-align: justify; }
.hd-doc .hd-center { text-align: center; margin: 0; }
.hd-doc .hd-title { text-align: center; font-size: 1.35rem; font-weight: 700; margin: 1.1rem 0 .2rem; font-family: inherit; }
.hd-doc .hd-h { font-size: 1rem; font-weight: 700; margin: .9rem 0 .35rem; font-family: inherit; }
.hd-doc ul { margin: 0 0 .55rem; padding-left: 1.3rem; }
.hd-doc li { margin-bottom: .2rem; text-align: justify; }
.hd-var { background: #fff3c4; border-radius: 2px; padding: 0 .1rem; }
.hd-paper .hd-var { background: transparent; padding: 0; }
.hd-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; text-align: center; margin-top: 1.6rem; }
.hd-sig-img { display: block; width: 220px; max-width: 100%; height: auto; margin: .3rem auto; }
.hd-sig-blank { min-height: 80px; padding-top: .4rem; font-style: italic; font-size: .85rem; color: #555; }
.hd-sig-meta { font-size: .72rem; color: #555; line-height: 1.35; margin-top: .2rem; }
.hd-foot { font-size: .72rem !important; color: #666; border-top: 1px solid #ddd; padding-top: .5rem; margin-top: 1.4rem !important; }
.hd-vars { display: flex; flex-wrap: wrap; gap: .3rem; }
.hd-vars .btn { font-size: .72rem; padding: .1rem .45rem; }
.hd-editor { font-size: .8rem; line-height: 1.45; }
.sign-pad { display: block; width: 100%; max-width: 600px; aspect-ratio: 3 / 1; height: auto; background: #fff; border: 2px dashed var(--line-strong); border-radius: var(--radius-sm);
  touch-action: none; cursor: crosshair; }
@media (max-width: 575.98px) { .hd-paper { padding: 1.1rem .9rem; } .hd-doc { font-size: 14px; } }
@media print {
  .hd-paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .hd-doc { font-size: 13pt; }
}
.fb-link-flag { margin-top: .25rem; font-size: .72rem; font-weight: 600; color: #8a5a00; background: #fff3c4; border-radius: 99px; padding: .05rem .5rem; display: inline-block; }
.link-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem .9rem; background: var(--paper); }
.link-box legend { float: none; width: auto; font-size: .9rem; font-weight: 600; padding: 0 .4rem; margin: 0; color: var(--ink); }
.link-lines td { vertical-align: middle; }
.link-card { border: 1px solid #f0d78a; background: #fffbeb; border-radius: var(--radius-sm); padding: .75rem 1rem; }

/* ===== v14: Màn hình điều hành ===== */
.exec-jump { display: flex; flex-wrap: wrap; gap: .4rem; }
.exec-jump a { font-size: .82rem; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); text-decoration: none; }
.exec-jump a:hover { border-color: var(--lagoon); color: var(--lagoon-600); }
.exec-sec { scroll-margin-top: calc(var(--top-h) + 12px); }
#retention, #stock, #pending { scroll-margin-top: calc(var(--top-h) + 12px); }
.cf-axis-strong { fill: var(--ink-2); font-weight: 600; }
.exec-bal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; }
.exec-bal-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .6rem; font-variant-numeric: tabular-nums; min-width: 0; }
.exec-bal-item .num { text-align: left; overflow-wrap: anywhere; }
.exec-bal-item.neg { border-color: var(--red); background: var(--red-50); }
@media (max-width: 575.98px) { .exec-bal { grid-template-columns: repeat(2, minmax(0, 1fr)); } .exec-bal-item:first-child { grid-column: 1 / -1; } }
.exec-debt th:first-child { min-width: 11rem; white-space: nowrap; }
.exec-debt td { white-space: nowrap; }
.exec-late td:first-child { min-width: 12rem; }
.exec-prog-col { width: 8rem; min-width: 7rem; }
.exec-people { display: flex; flex-wrap: wrap; gap: .5rem; }
.exec-person { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .35rem .6rem; color: var(--text); text-decoration: none; min-width: 9rem; }
.exec-person:hover { border-color: var(--lagoon); }
.exec-person .badge { margin-left: .4rem; }
.exec-profit td, .exec-profit th { white-space: nowrap; }
.exec-profit td:first-child { white-space: normal; min-width: 13rem; }
.exec-profit thead th.exec-grp { border-bottom: 1px solid var(--line-strong); }
.exec-profit { font-size: .86rem; }
.exec-profit td, .exec-profit th { padding-left: .4rem; padding-right: .4rem; }
/* Điện thoại: bảng trong màn hình điều hành cuộn ngang trong khung thay vì bóp chữ thành cột hẹp */
.exec-sec .table td.num, .exec-sec .table th.num { white-space: nowrap; }
@media (max-width: 767.98px) {
  .exec-sec .table td:first-child, .exec-sec .table th:first-child { min-width: 9.5rem; }
  .exec-sec .table td:not(.num):not(:first-child) { min-width: 7rem; }
  .exec-plans .table td:nth-child(2) { min-width: 11rem; }
}

/* ===== v15: Công văn đến – đi ===== */
.doc-info th { width: 9.5rem; font-weight: 600; color: var(--muted); }
.doc-ext { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 1.9rem; border-radius: 6px; background: var(--blue-50); color: var(--blue); font-size: .68rem; font-weight: 700; letter-spacing: .02em; }
.doc-results { position: absolute; left: calc(var(--bs-gutter-x) * .5); right: calc(var(--bs-gutter-x) * .5); top: 100%; z-index: 20; max-height: 16rem; overflow-y: auto; box-shadow: 0 6px 18px rgba(15,47,43,.14); }
.doc-pick { max-height: 11rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .25rem; display: block; }
.doc-unseen td:first-child { box-shadow: inset 3px 0 0 var(--lagoon); }
.doc-unseen td:nth-child(3) a { font-weight: 600; }
.doc-table td:nth-child(3) { min-width: 15rem; }
.doc-table td:nth-child(2) { min-width: 9rem; }
.doc-directive { border-left: 3px solid var(--amber); }
.doc-log li { line-height: 1.4; }
.doc-q { min-width: 12rem; }
.doc-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; counter-reset: st; }
.doc-steps li { counter-increment: st; flex: 1 1 8rem; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem .6rem; background: var(--surface); }
.doc-steps li span::before { content: counter(st) ". "; color: var(--muted); }
.doc-steps li span { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); }
.doc-steps li small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-steps li.done { border-color: var(--green); background: var(--green-50); }
.doc-steps li.done span { color: var(--green); }
.doc-steps li.cur { border-color: var(--amber); background: var(--amber-50); }
.doc-steps li.cur span { color: var(--amber); }
.doc-box .list-group-item { overflow-wrap: anywhere; }
details.card > summary { cursor: pointer; }
.ot-reason { min-width: 13rem; }
.ot-state { min-width: 8.5rem; }
.privacy-text { white-space: normal; line-height: 1.55; }
.sel-shrink { max-width: min(100%, 22rem); min-width: 0; }
form.d-flex:has(> .sel-shrink) { min-width: 0; max-width: 100%; }
/* Ô tìm kiếm chung trên thanh trên cùng (v16.2) */
.shell-search { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); height: 34px; flex: 0 1 15rem; min-width: 0; }
.shell-search input { border: 0; background: transparent; padding: 0 .55rem; font-size: .88rem; min-width: 0; width: 100%; height: 100%; color: var(--text); outline: none; }
.shell-search button { border: 0; background: transparent; color: var(--muted); padding: 0 .5rem; line-height: 0; height: 100%; }
.shell-search:focus-within { border-color: var(--lagoon); }
@media (max-width: 575.98px) { .shell-search { flex-basis: 6.5rem; } .shell-search input::placeholder { color: transparent; } }
.xc-card .list-group-item a { text-decoration: none; }
/* Hợp đồng bán hàng (v16.3) */
.sc-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; counter-reset: sc; }
.sc-steps li { counter-increment: sc; flex: 1 1 9rem; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .65rem; background: var(--surface); font-size: .86rem; font-weight: 600; color: var(--muted); }
.sc-steps li::before { content: counter(sc) ". "; }
.sc-steps li.done { border-color: var(--green); background: var(--green-50); color: var(--green); }
.sc-steps li.done::before { content: "✓ "; }
.sc-steps li.cur { border-color: var(--amber); background: var(--amber-50); color: var(--amber); }

/* ---- Công trình (v16.4) ---- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.site-card { border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.site-card:hover { border-color: var(--lagoon); box-shadow: 0 2px 10px rgba(var(--brand-rgb), .08); }
.site-prog .proj-bar + .proj-bar { margin-top: 3px; }
.proj-bar-acc span { background: var(--green); }
.proj-bar-over span { background: var(--red); }
.site-tabs .nav-link { padding: .45rem .75rem; font-size: .9rem; }
.site-items-table td:nth-child(1) { min-width: 5.5rem; }
.site-items-table td:nth-child(2) { min-width: 15rem; }
.site-items-table td:nth-child(3) { min-width: 4.5rem; }
.site-items-table td:nth-child(4), .site-items-table td:nth-child(5) { min-width: 7.5rem; }
.site-budget-table td:nth-child(1) { min-width: 8.5rem; }
.site-budget-table td:nth-child(2) { min-width: 9rem; }
.site-budget-table td:nth-child(3), .site-budget-table td:nth-child(4) { min-width: 12rem; }
.site-budget-table td:nth-child(6), .site-budget-table td:nth-child(7) { min-width: 7rem; }
.site-qty-in { min-width: 8.5rem; width: 9.5rem; }
.site-photos { display: flex; flex-wrap: wrap; gap: .6rem; }
.site-photos figure { margin: 0; width: 132px; }
.site-photos .pf-thumb { width: 132px; height: 100px; }
.site-events { max-height: 520px; overflow-y: auto; }
.site-gantt-wrap { overflow-x: auto; }
.site-gantt { width: 100%; min-width: 620px; height: auto; font-family: inherit; }
.site-gantt .g-label { font-size: 11px; fill: var(--text); }
.site-gantt .g-month { font-size: 10px; fill: var(--muted); }
.site-gantt .g-grid { stroke: var(--line); stroke-width: 1; }
.site-gantt .g-today { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 3 2; }
.site-gantt .g-bar { fill: var(--blue); }
.site-gantt .g-bar.g-done { fill: var(--green); }
.site-gantt .g-bar.g-late { fill: var(--red); }
.site-gantt .g-bar.g-cancel { fill: var(--line-strong); }
.site-gantt .g-prog { fill: var(--ink); opacity: .55; }
.site-gantt a:hover .g-label { fill: var(--lagoon); text-decoration: underline; }
.g-key { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin: 0 .2rem 0 .6rem; background: var(--blue); }
.g-key.g-done { background: var(--green); }
.g-key.g-late { background: var(--red); }
.site-print-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .5rem; }
.site-print-photos img { width: 31%; max-height: 170px; object-fit: cover; border: 1px solid var(--line); }
@media print { .site-print-log { break-inside: avoid; } }
.site-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.site-tabs .nav-link { white-space: nowrap; }
@media (max-width: 575.98px) {
  .site-stats .stat { padding: .7rem .75rem; }
  .site-stats .stat-value { font-size: 1.12rem; overflow-wrap: anywhere; }
}
.site-req-table td:nth-child(1) { min-width: 15rem; }
.site-req-table td:nth-child(2) { min-width: 5.5rem; width: 7rem; }
.site-req-table td:nth-child(3) { min-width: 8rem; }
.site-print-table td:nth-child(2) { min-width: 14rem; }
.site-print-table th { font-size: .78rem; vertical-align: bottom; }
/* ---------- Mua hàng (v16.5) ---------- */
.pur-lines-table td:nth-child(2) { min-width: 15rem; }
.pur-lines-table td:nth-child(1) { min-width: 7rem; }
.pur-qty-in { min-width: 6rem; width: 7.5rem; }
.pur-price-in { min-width: 8rem; width: 9.5rem; }
.pur-compare th, .pur-compare td { white-space: nowrap; }
.pur-compare td:first-child { white-space: normal; min-width: 12rem; }
.pur-compare .pur-min { color: var(--green); font-weight: 600; }
.pur-compare .pur-sel { background: var(--green-50); }
/* ---------- Tài sản, máy móc (v16.5) ---------- */
.asset-facts b { color: var(--ink); }
.asset-photo { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; margin: 0 auto; }
.asset-qr { width: 132px; height: 132px; image-rendering: pixelated; display: block; margin: 0 auto .25rem; }
.asset-actions details > summary { cursor: pointer; list-style: none; }
.asset-actions details > summary::-webkit-details-marker { display: none; }
.asset-actions details > summary::before { content: "▸ "; }
.asset-actions details[open] > summary::before { content: "▾ "; }
.asset-gallery { display: flex; flex-wrap: wrap; gap: 6px; }
.asset-gallery img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.asset-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.asset-labels-big { grid-template-columns: repeat(2, 1fr); }
.asset-label { display: flex; gap: 3mm; align-items: center; border: 1px dashed var(--line-strong); border-radius: 3mm; padding: 2.5mm; background: #fff; break-inside: avoid; page-break-inside: avoid; min-width: 0; }
.asset-label img { width: 24mm; height: 24mm; flex: 0 0 auto; image-rendering: pixelated; }
.asset-labels-big .asset-label img { width: 34mm; height: 34mm; }
.asset-label-text { min-width: 0; line-height: 1.25; color: #000; }
.asset-label-co { font-size: 7pt; text-transform: uppercase; letter-spacing: .02em; }
.asset-label-code { font-size: 12pt; font-weight: 700; }
.asset-labels-big .asset-label-code { font-size: 15pt; }
.asset-label-name { font-size: 8pt; overflow-wrap: anywhere; }
.asset-label-sn { font-size: 7pt; }
@media (max-width: 575.98px) { .asset-labels, .asset-labels-big { grid-template-columns: 1fr; } }
@media print { .asset-labels { grid-template-columns: repeat(3, 1fr); } .asset-labels-big { grid-template-columns: repeat(2, 1fr); } .asset-label { border-color: #999; } }

/* ===== v17.1: ảnh xem trước + phóng to ===== */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .4rem; }
.img-tile { display: block; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile:hover { border-color: var(--lagoon); }
.img-tile-pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: .3rem; text-decoration: none; background: #fff5f3; }
.img-tile-pdf .pdf-ico { font-weight: 700; font-size: .8rem; color: #fff; background: #c8452f; border-radius: 4px; padding: .1rem .4rem; }
.img-tile-pdf .pdf-name { font-size: .68rem; color: var(--ink, #223); text-align: center; line-height: 1.15; overflow-wrap: anywhere; max-height: 3.5em; overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 2000; background: rgba(8, 20, 18, .92); display: none; flex-direction: column; }
.lb.open { display: flex; }
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; padding: .45rem .7rem; color: #e8f1ef; background: rgba(0, 0, 0, .35); }
.lb-cap { font-size: .85rem; overflow-wrap: anywhere; min-width: 0; flex: 1 1 12rem; }
.lb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.lb-page { font-size: .78rem; color: #b9d3cd; margin-right: .3rem; }
.lb-t { border: 0; background: rgba(255, 255, 255, .12); color: #fff; min-width: 36px; height: 34px; border-radius: 8px; font-size: 1.05rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0 .55rem; cursor: pointer; text-decoration: none; }
.lb-t:hover, .lb-t:focus-visible { background: rgba(255, 255, 255, .26); color: #fff; }
.lb-zoom { font-size: .8rem; min-width: 56px; }
.lb-open { font-size: .8rem; }
.lb-stage { position: relative; flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; }
.lb.lb-is-pdf .lb-stage { overflow: auto; align-items: flex-start; touch-action: pan-x pan-y; cursor: default; }
.lb-inner { display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: none; transform-origin: center center; border-radius: 4px; background: #fff; user-select: none; -webkit-user-drag: none; will-change: transform; }
.lb-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 16px 60px; }
.lb-pdfpage { background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .45); max-width: none; }
.lb-msg { color: #e8f1ef; padding: 2rem; text-align: center; }
.lb-btn { position: absolute; border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 1.8rem; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-btn:hover { background: rgba(255, 255, 255, .28); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
body.lb-lock { overflow: hidden; }
@media (max-width: 575.98px) { .lb-prev, .lb-next { top: auto; bottom: 12px; transform: none; } .lb-prev { left: 30%; } .lb-next { right: 30%; } .lb-t { min-width: 32px; height: 32px; } }
.paid-track { background: var(--paper, #f6faf9); border: 1px solid var(--line, #dfe8e6); border-radius: 10px; padding: .6rem .8rem; }
.paid-track .progress { height: 8px; }
.pw-0 { width: 0%; } .pw-5 { width: 5%; } .pw-10 { width: 10%; } .pw-15 { width: 15%; } .pw-20 { width: 20%; } .pw-25 { width: 25%; } .pw-30 { width: 30%; } .pw-35 { width: 35%; } .pw-40 { width: 40%; } .pw-45 { width: 45%; } .pw-50 { width: 50%; } .pw-55 { width: 55%; } .pw-60 { width: 60%; } .pw-65 { width: 65%; } .pw-70 { width: 70%; } .pw-75 { width: 75%; } .pw-80 { width: 80%; } .pw-85 { width: 85%; } .pw-90 { width: 90%; } .pw-95 { width: 95%; } .pw-100 { width: 100%; } 
.chk-flag { display: block; min-height: 1.1em; }
.chk-flag.ok { color: #198754; } .chk-flag.bad { color: #c8452f; font-weight: 600; }
.chk-raw { max-height: 14rem; overflow: auto; white-space: pre-wrap; font-size: .75rem; background: var(--paper, #f6faf9); border: 1px solid var(--line, #dfe8e6); border-radius: 6px; padding: .5rem; }
.ocr-hit { background: #fff3c4; }

/* ===================== v17.1 · Bàn làm việc ===================== */
.ws-apps { overflow: hidden; border: 0; background: linear-gradient(120deg, #0b5f86 0%, #0b6e62 55%, #138a74 100%); color: #fff; }
.ws-apps-head { padding: .9rem 1.1rem .2rem; }
.ws-hello { font-size: 1.15rem; font-weight: 600; }
.ws-apps .text-muted { color: rgba(255, 255, 255, .78) !important; }
.ws-apps .text-danger { color: #ffd6d2 !important; }
.ws-app-row { display: flex; gap: .35rem; overflow-x: auto; padding: .7rem .8rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
.ws-app { flex: 0 0 84px; display: flex; flex-direction: column; align-items: center; gap: .35rem; color: #fff; text-decoration: none; padding: .35rem .2rem; border-radius: 12px; }
.ws-app:hover, .ws-app:focus-visible { background: rgba(255, 255, 255, .12); color: #fff; }
.ws-app-ico { position: relative; width: 50px; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0, 0, 0, .18); }
.ws-app-ico .ico { width: 26px; height: 26px; color: #fff; stroke-width: 1.8; }
.ws-app-lbl { font-size: .74rem; line-height: 1.2; text-align: center; max-width: 84px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ws-badge { position: absolute; top: -6px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #e5383b; color: #fff; font-size: .7rem; font-weight: 700; line-height: 20px; text-align: center; border: 2px solid #fff; }
.ws-c0 { background: #f2994a; } .ws-c1 { background: #2f80ed; } .ws-c2 { background: #27ae60; } .ws-c3 { background: #9b51e0; } .ws-c4 { background: #eb5757; }
.ws-c5 { background: #00a3bf; } .ws-c6 { background: #f2c94c; } .ws-c6 .ico { color: #5a4300; } .ws-c7 { background: #56ccf2; } .ws-c7 .ico { color: #08394a; } .ws-c8 { background: #6fcf97; } .ws-c8 .ico { color: #0d3d22; } .ws-c9 { background: #bb6bd9; }
.ws-profile .ws-av-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.ws-nav .list-group-item { border: 0; padding: .55rem .9rem; font-size: .9rem; }
.ws-nav .list-group-item .ico { width: 18px; height: 18px; color: var(--lagoon); }
.ws-nav .list-group-item.active { background: var(--lagoon-50); color: var(--lagoon-600); font-weight: 600; }
.ws-nav .list-group-item.active .ico { color: var(--lagoon-600); }
.ws-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.ws-q { flex-direction: row; align-items: center; gap: .6rem; padding: .6rem .7rem; text-decoration: none; color: var(--text); border: 1px solid var(--line); }
.ws-q:hover { border-color: var(--lagoon); color: var(--text); }
.ws-q b { display: block; font-size: .86rem; line-height: 1.2; }
.ws-q small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.2; }
.ws-q-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--lagoon-50); display: flex; align-items: center; justify-content: center; flex: none; }
.ws-q-ico .ico { width: 20px; height: 20px; color: var(--lagoon); }
.ws-bday .ico { width: 20px; height: 20px; color: #d6336c; }
.ws-bday-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.ws-bday-item { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; background: #fff7fb; border: 1px solid #f6d5e5; min-width: 0; }
.ws-bday-item.today { background: #ffe9f3; border-color: #f0a3c6; }
.ws-notes .ws-unread { background: var(--blue-50); }
.ws-notes .ws-unread::before { content: ""; float: right; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: .35rem; }
.ws-top li + li { margin-top: .55rem; }
.ws-bar { height: 8px; border-radius: 4px; background: var(--paper); overflow: hidden; margin-top: .15rem; }
.ws-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2f80ed, #0b6e62); }
.ws-health { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .3rem .75rem; padding: .6rem .9rem; }
.ws-health dt { font-weight: 500; color: var(--muted); }
.ws-health dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.ws-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2100; background: #12332e; color: #fff; padding: .55rem 1rem; border-radius: 8px; font-size: .88rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: opacity .4s; max-width: calc(100vw - 32px); }
.ws-toast.bad { background: #8a1c16; }
.ws-toast.out { opacity: 0; }
.min-w-0 { min-width: 0; }

/* ===================== Bảng tin ===================== */
.sp-av-0 { background: #2f80ed; color: #fff; } .sp-av-1 { background: #27ae60; color: #fff; } .sp-av-2 { background: #eb5757; color: #fff; } .sp-av-3 { background: #9b51e0; color: #fff; }
.sp-av-4 { background: #f2994a; color: #fff; } .sp-av-5 { background: #00a3bf; color: #fff; } .sp-av-6 { background: #0b6e62; color: #fff; } .sp-av-7 { background: #5b6b8c; color: #fff; }
.sp-composer .sp-kinds { display: flex; flex-wrap: wrap; gap: .35rem; }
.sp-kind input { position: absolute; opacity: 0; pointer-events: none; }
.sp-kind span { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); font-size: .82rem; cursor: pointer; }
.sp-kind span .ico { width: 16px; height: 16px; }
.sp-kind input:checked + span { background: var(--lagoon); border-color: var(--lagoon); color: #fff; }
.sp-kind input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.sp-attach { cursor: pointer; }
.sp-post.sp-pinned { border: 1px solid #f2c94c; }
.sp-kind-news { border-left: 4px solid #2f80ed; }
.sp-kind-idea { border-left: 4px solid #f2c94c; }
.sp-kind-poll { border-left: 4px solid #9b51e0; }
.sp-kind-badge { background: var(--lagoon-50); color: var(--lagoon-600); font-weight: 600; }
.sp-menu { position: relative; }
.sp-menu summary { list-style: none; cursor: pointer; padding: 0 .45rem; border-radius: 6px; font-weight: 700; color: var(--muted); }
.sp-menu summary::-webkit-details-marker { display: none; }
.sp-menu summary:hover { background: var(--paper); }
.sp-menu-body { position: absolute; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); min-width: 150px; padding: .3rem 0; }
.sp-menu-body form { margin: 0; }
.sp-menu-body button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .35rem .8rem; font-size: .85rem; }
.sp-menu-body button:hover { background: var(--paper); }
.sp-body { white-space: normal; margin-top: .35rem; }
.sp-clamp { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.sp-imgs { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; }
.sp-imgs-1 { grid-template-columns: 1fr; } .sp-imgs-2 { grid-template-columns: 1fr 1fr; } .sp-imgs-3 { grid-template-columns: 2fr 1fr; } .sp-imgs-3 .sp-img:first-child { grid-row: span 2; } .sp-imgs-4 { grid-template-columns: 1fr 1fr; }
.sp-img { display: block; background: var(--paper); aspect-ratio: 4 / 3; overflow: hidden; }
.sp-imgs-1 .sp-img { aspect-ratio: auto; max-height: 460px; display: flex; justify-content: center; background: var(--paper); }
.sp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-imgs-1 .sp-img img { width: auto; max-width: 100%; height: auto; max-height: 460px; min-width: 120px; object-fit: contain; }
.sp-more { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); text-decoration: none; }
.sp-poll { display: grid; gap: .35rem; }
.sp-opt { position: relative; display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; margin: 0; }
.sp-opt input { position: relative; z-index: 1; margin: 0; }
.sp-opt-bar { position: absolute; inset: 0 auto 0 0; background: #ece2f8; z-index: 0; }
.sp-opt-me { border-color: #9b51e0; }
.sp-opt-me .sp-opt-bar { background: #dfcbf5; }
.sp-opt-label { position: relative; z-index: 1; flex: 1; }
.sp-opt-n { position: relative; z-index: 1; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.sp-actions { padding: .15rem .5rem; }
.sp-actions > * { flex: 1; }
.sp-actions form { margin: 0; }
.sp-act { display: flex; width: 100%; align-items: center; justify-content: center; gap: .3rem; border: 0; background: none; padding: .45rem; font-size: .86rem; color: var(--muted); border-radius: 6px; cursor: pointer; margin: 0; }
.sp-act:hover { background: var(--paper); color: var(--text); }
.sp-act-on { color: var(--lagoon-600); font-weight: 600; }
.sp-react { position: relative; }
.sp-react-pick { position: absolute; bottom: 100%; left: 0; display: none; gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .35rem; box-shadow: 0 6px 18px rgba(0,0,0,.15); z-index: 15; }
.sp-react { display: flex; align-items: stretch; }
.sp-react > form { flex: 1; }
.sp-react-more { border: 0; background: none; color: var(--muted); padding: 0 .45rem; border-radius: 6px; font-size: .75rem; }
.sp-react-more:hover { background: var(--paper); }
.sp-react:hover .sp-react-pick, .sp-react.open .sp-react-pick { display: flex; }
.sp-react-pick form { margin: 0; }
.sp-react-pick button { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: .15rem; border-radius: 50%; transition: transform .12s; }
.sp-react-pick button:hover, .sp-react-pick button:focus-visible { transform: scale(1.3); }
.sp-comments { background: #fafcfb; }
.sp-cmt-bubble { background: var(--paper); border-radius: 12px; padding: .35rem .7rem; font-size: .88rem; min-width: 0; }
.sp-cmt-form textarea { resize: vertical; min-height: 34px; }
.sp-cmt-form { margin: 0; }

/* ===================== Trò chuyện ===================== */
.chat-dock { position: fixed; right: 18px; bottom: 18px; z-index: 1500; }
.chat-fab { position: relative; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--lagoon); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
.chat-fab .ico { width: 28px; height: 28px; }
.chat-fab:hover, .chat-fab.on { background: var(--lagoon-600); }
.chat-fab-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; border-radius: 11px; background: #e5383b; color: #fff; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid #fff; padding: 0 4px; }
.chat-panel { position: absolute; right: 0; bottom: 68px; width: 360px; height: min(560px, calc(100vh - 110px)); background: var(--surface); border-radius: 14px; box-shadow: 0 12px 36px rgba(0,0,0,.25); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); }
.chat-panel > section { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-panel > section[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: .4rem; padding: .55rem .7rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head > b { flex: 1; }
.chat-tools { display: flex; gap: .2rem; }
.chat-ib { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; color: var(--text); text-decoration: none; cursor: pointer; flex: none; margin: 0; }
.chat-ib:hover { background: var(--paper); color: var(--text); }
.chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.chat-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-more { position: relative; }
.chat-more summary { list-style: none; cursor: pointer; padding: .2rem .5rem; border-radius: 6px; font-weight: 700; }
.chat-more summary::-webkit-details-marker { display: none; }
.chat-more-body { position: absolute; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; width: 230px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.chat-search { margin: .5rem .7rem; width: auto; }
.chat-rooms, .chat-people { list-style: none; margin: 0; padding: 0 .3rem .5rem; overflow-y: auto; flex: 1; }
.chat-ri { display: flex; align-items: center; gap: .55rem; padding: .5rem .5rem; border-radius: 10px; cursor: pointer; }
.chat-ri:hover, .chat-ri:focus-visible, .chat-ri.active { background: var(--lagoon-50); outline: none; }
.chat-ri-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chat-ri-mid b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-ri-mid small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-ri.unread .chat-ri-mid b, .chat-ri.unread .chat-ri-mid small { font-weight: 700; color: var(--text); }
.chat-ri-r { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; font-size: .72rem; }
.chat-n { background: #e5383b; color: #fff; border-radius: 10px; padding: 0 .4rem; font-weight: 700; }
.chat-av-group { font-size: 1rem; }
.chat-empty { padding: 1.2rem; text-align: center; color: var(--muted); font-size: .88rem; list-style: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: .6rem .7rem; background: #f4f7f6; display: flex; flex-direction: column; gap: .2rem; }
.chat-day { align-self: center; font-size: .72rem; color: var(--muted); background: #e6ecea; border-radius: 999px; padding: .05rem .6rem; margin: .5rem 0 .3rem; }
.chat-sys { align-self: center; font-size: .75rem; color: var(--muted); font-style: italic; margin: .2rem 0; text-align: center; }
.chat-m { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; position: relative; }
.chat-m.mine { align-self: flex-end; align-items: flex-end; }
.chat-who { font-size: .72rem; color: var(--muted); margin: .3rem 0 .05rem .4rem; }
.chat-b { background: #fff; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: .35rem .65rem; font-size: .9rem; overflow-wrap: anywhere; max-width: 100%; }
.chat-m.mine .chat-b { background: #d9f1ea; border-color: #bfe3d8; border-radius: 14px 14px 4px 14px; }
.chat-b.recalled { font-style: italic; color: var(--muted); background: transparent; }
.chat-t { white-space: pre-wrap; }
.chat-at { color: var(--blue); font-weight: 600; }
.chat-time { display: block; font-size: .66rem; color: var(--muted); text-align: right; margin-top: .1rem; }
.chat-img { display: block; max-width: 220px; border-radius: 10px; overflow: hidden; margin: .1rem 0 .2rem; }
.chat-img img { width: 100%; display: block; }
.chat-file { display: block; font-size: .85rem; }
.chat-seen { font-size: .68rem; color: var(--lagoon-600); margin-top: .1rem; }
.chat-recall { display: none; border: 0; background: none; font-size: .7rem; color: var(--muted); padding: 0 .2rem; }
.chat-m.mine:hover .chat-recall, .chat-recall:focus-visible { display: block; }
.chat-compose { display: flex; align-items: flex-end; gap: .35rem; padding: .45rem .55rem; border-top: 1px solid var(--line); margin: 0; background: var(--surface); }
.chat-compose textarea { resize: none; min-height: 34px; max-height: 120px; }
.chat-attach { cursor: pointer; }
.chat-attach.on { background: var(--lagoon-50); }
.chat-app { height: calc(100vh - var(--top-h) - 110px); min-height: 460px; overflow: hidden; }
.chat-app .chat-panel { position: static; width: auto; height: 100%; box-shadow: none; border: 0; border-radius: 0; flex-direction: row; }
.chat-app .chat-list { flex: 0 0 320px; border-right: 1px solid var(--line); }
.chat-app .chat-room { flex: 1; }
.chat-app .chat-back { display: none; }
@media (max-width: 767.98px) {
  .chat-app .chat-list { flex: 1; }
  .chat-app .chat-room { display: none !important; }
  .chat-app .chat-panel.chat-in-room .chat-list { display: none; }
  .chat-app .chat-panel.chat-in-room .chat-room { display: flex !important; }
  .chat-app .chat-back { display: inline-flex; }
  .chat-dock { right: 12px; bottom: 12px; }
  .chat-panel { position: fixed; inset: auto 8px 78px 8px; width: auto; height: calc(100vh - 150px); }
}
@media print { .chat-dock { display: none !important; } }

.ws-feed-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-bottom: 0; }
.ws-feed-pills .nav-link { white-space: nowrap; font-size: .85rem; }
@media (max-width: 575.98px) {
  .ws-quick { display: flex; overflow-x: auto; scrollbar-width: none; padding-bottom: .2rem; }
  .ws-q { flex: 0 0 148px; }
}
@media (max-width: 991.98px) { .ws-left .ws-nav { display: none; } }

/* ===== v17.2: báo giá xây lắp, ma trận phê duyệt mua hàng ===== */
.boq-edit .boq-c { display: none; }
.boq-edit.boq-show-cost .boq-c { display: table-cell; }
.boq-edit td { vertical-align: top; }
.boq-edit .boq-item td:nth-child(2) { min-width: 18rem; }
.boq-edit .boq-item td:nth-child(3) { width: 5.5rem; }
.boq-edit .boq-item td:nth-child(4), .boq-edit .boq-item td:nth-child(5) { width: 8rem; }
.boq-edit .boq-item td:nth-child(6) { width: 9.5rem; }
.boq-edit .boq-c input { width: 7.5rem; }
.boq-edit .boq-part td { background: var(--green-50, #eef7f0); font-weight: 600; }
.boq-edit .boq-grp td { background: #f6f7f9; font-style: italic; }
.boq-edit .boq-stt { width: 2.6rem; text-align: center; font-weight: 600; }
.boq-tools { width: 4rem; }
.boq-opt-out td { color: #8a8f98; }
.boq-table .boq-part td { font-weight: 700; background: #eef3f8; }
.boq-table .boq-grp td { font-weight: 600; font-style: italic; }
.boq-table td.num, .boq-table th.num { white-space: nowrap; }
.pur-matrix td, .pur-matrix th { vertical-align: middle; }
.pur-matrix input { min-width: 8rem; }
@media print { .boq-table .boq-part td { background: none; } }

/* v17.3 – Tự động hóa: bảng cuộn ngang trên điện thoại thay vì bóp cột */
.auto-lead { max-width: 60rem; }
.auto-table { min-width: 720px; }
.auto-jobs td:nth-child(2) { min-width: 18rem; }

/* v19 – bảng theo dõi đơn hàng & dự án */
.pl-board { grid-auto-columns: minmax(210px, 1fr); }
.pl-board .kb-col-head span:first-child { line-height: 1.25; }
.pl-gate { font-size: .78rem; font-weight: 600; color: var(--lagoon); margin: .35rem 0 .3rem; line-height: 1.3; }
.kb-card.is-overdue .pl-gate { color: var(--red); }
.ex-note { max-width: 420px; }
/* v19.1 – hướng dẫn, gợi ý sử dụng, hỗ trợ */
.help-toc { position: sticky; top: 1rem; max-height: calc(100vh - 6rem); overflow: auto; }
.help-body ol, .help-body ul { padding-left: 1.2rem; margin-bottom: .5rem; }
.help-body li { margin-bottom: .3rem; }
.help-body dt { margin-top: .5rem; }
.help-body dd { margin-left: 0; color: var(--muted); }
.help-tip { background: var(--lagoon-50, #eaf4f2); border-radius: 8px; padding: .45rem .6rem; }
.shell-help { position: relative; color: var(--ink); line-height: 0; padding: .45rem; border-radius: 8px; }
.shell-help:hover { background: var(--lagoon-50); }
.sp-msg { border-left: 3px solid var(--line-strong); padding: .4rem .7rem; margin-bottom: .6rem; background: var(--surface); border-radius: 0 8px 8px 0; }
.sp-msg.is-staff { border-left-color: var(--lagoon); background: var(--lagoon-50, #eaf4f2); }

/* ---------- v20.2: Sơ đồ quy trình (flowmap.php) ---------- */
.fm-proc-card { --fm: #0b6e62; --fm-50: #e4f2ef; }
.fm-blue { --fm: #2d63b5; --fm-50: #e7effb; }
.fm-amber { --fm: #b06a0c; --fm-50: #fbf0de; }
.fm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fm); flex: none; }
.fm-flow { display: flex; flex-wrap: wrap; gap: 1.1rem 34px; padding: 1rem 1.1rem 1.2rem 1.1rem; }
/* dòng thứ 2 trở đi bắt đầu bằng mũi tên nối tiếp từ dòng trên */
.fm-node { position: relative; flex: 0 0 158px; display: flex; flex-direction: column; gap: .15rem; padding: .7rem .75rem .65rem; border: 1px solid var(--line);
  border-top: 3px solid var(--fm); border-radius: 10px; background: #fff; color: var(--text); text-decoration: none; scroll-snap-align: start; transition: box-shadow .15s, border-color .15s; }
.fm-node:hover { box-shadow: 0 6px 18px rgba(16, 40, 36, .1); color: var(--text); }
.fm-node + .fm-node::before { content: ""; position: absolute; left: -31px; top: 44px; width: 24px; height: 2px; background: var(--line-strong); }
.fm-node + .fm-node::after { content: ""; position: absolute; left: -11px; top: 40px; border: 5px solid transparent; border-left: 7px solid var(--line-strong); }
.fm-node.is-sel { background: var(--fm-50); border-color: var(--fm); box-shadow: 0 0 0 2px var(--fm); }
.fm-node.is-empty .fm-count { color: #b3c0bd; }
.fm-no { position: absolute; top: .55rem; right: .6rem; width: 20px; height: 20px; border-radius: 50%; background: var(--fm-50); color: var(--fm); font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.fm-label { font-weight: 600; color: var(--ink); line-height: 1.25; padding-right: 1.4rem; min-height: 2.5em; }
.fm-actor { font-size: .74rem; color: var(--muted); }
.fm-count { font-size: 1.6rem; font-weight: 700; color: var(--fm); line-height: 1.1; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.fm-count small { font-size: .72rem; font-weight: 700; color: #fff; background: #e5484d; border-radius: 99px; padding: .05rem .4rem; vertical-align: .35em; }
.fm-sum { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fm-gate { margin-top: .35rem; padding-top: .35rem; border-top: 1px dashed var(--line); font-size: .74rem; color: var(--ink-2); line-height: 1.3; }
.fm-gate::before { content: "Cổng: "; color: var(--muted); }
.fm-loop { font-size: .72rem; color: #a5530a; line-height: 1.3; }
.fm-node.is-late { border-color: #f2b8b5; }
@media (max-width: 575.98px) { .fm-flow { flex-wrap: nowrap; overflow-x: auto; gap: 28px; padding: .8rem; } .fm-node { flex-basis: 150px; } }

/* Sơ đồ tư duy (SVG) */
.fm-mind-wrap { overflow-x: auto; }
.fm-mind a, .fm-mind text { text-decoration: none; }
.fm-mind { display: block; max-width: 100%; height: auto; min-width: 760px; font-family: inherit; }
.fm-edge { fill: none; stroke-width: 2; stroke: #9fc9c1; }
.fm-edge.fm-blue { stroke: #a9c2e8; } .fm-edge.fm-amber { stroke: #e6c38f; } .fm-root-edge { stroke: #c4d0cd; stroke-width: 2.5; }
.fm-root rect { fill: #15322e; }
.fm-root-t { fill: #fff; font-size: 17px; font-weight: 700; }
.fm-root-s { fill: #b9d3cd; font-size: 11px; }
.fm-proc rect { fill: #0b6e62; } .fm-proc.fm-blue rect { fill: #2d63b5; } .fm-proc.fm-amber rect { fill: #b06a0c; }
.fm-proc:hover rect { opacity: .9; }
.fm-proc-t { fill: #fff; font-size: 15px; font-weight: 700; }
.fm-proc-s { fill: rgba(255, 255, 255, .85); font-size: 11.5px; }
.fm-leaf rect { fill: #e4f2ef; stroke: #b9dcd5; }
.fm-leaf.fm-blue rect { fill: #e7effb; stroke: #c3d5f0; } .fm-leaf.fm-amber rect { fill: #fbf0de; stroke: #efd3a6; }
.fm-leaf:hover rect { stroke-width: 2; }
.fm-leaf-t { fill: #15322e; font-size: 13px; }
.fm-leaf.is-empty .fm-leaf-t { fill: #7b8b87; }
.fm-cnt { fill: #fff; stroke: #0b6e62; stroke-width: 2; }
.fm-leaf.fm-blue .fm-cnt { stroke: #2d63b5; } .fm-leaf.fm-amber .fm-cnt { stroke: #b06a0c; }
.fm-leaf.is-empty .fm-cnt { stroke: #cbd6d4; }
.fm-leaf.is-late .fm-cnt { fill: #e5484d; stroke: #e5484d; }
.fm-cnt-t { fill: #15322e; font-size: 12px; font-weight: 700; }
.fm-leaf.is-late .fm-cnt-t { fill: #fff; }
.fm-late-t { fill: #c9372c; font-size: 11.5px; font-weight: 600; }

/* v25: ảnh KCS */
.qc-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--bs-border-color, #dee2e6); }
.qc-report-photos img { width: 100%; max-width: 360px; border-radius: 8px; margin: 0 .5rem .5rem 0; }
.qc-report { max-width: 820px; }
/* v25.2: xác thực 2 lớp */
.tfa-box { max-width: 420px; width: 100%; }
.tfa-qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }
.tfa-secret { font-family: ui-monospace, monospace; letter-spacing: .08em; word-break: break-all; }
.tfa-codes { columns: 2; font-family: ui-monospace, monospace; font-size: 1.05rem; }
/* v26: mở / sửa / chia sẻ file */
.fe-tools { display: inline-flex; gap: .15rem; margin-left: .35rem; vertical-align: middle; }
.fe-ico { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .35rem; background: transparent; color: inherit; font-size: .85rem; line-height: 1; text-decoration: none; cursor: pointer; }
.fe-ico:hover { background: rgba(13,110,253,.08); }
.fe-toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 2000; background: #212529; color: #fff; padding: .55rem 1rem; border-radius: .5rem; font-size: .9rem; max-width: 92vw; }
.fe-img { max-width: 100%; max-height: 75vh; }
.fe-note { max-width: 420px; }
.fe-body { overflow: auto; max-height: 72vh; }
.fe-grid-wrap { overflow: auto; }
.fe-grid { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
.fe-grid th { position: sticky; top: 0; background: #f1f3f5; font-weight: 600; text-align: center; padding: .15rem .4rem; border: 1px solid #dee2e6; color: #6c757d; z-index: 1; }
.fe-grid tbody th { position: sticky; left: 0; top: auto; z-index: 1; }
.fe-grid .fe-corner { left: 0; z-index: 2; }
.fe-grid td { border: 1px solid #e9ecef; padding: .15rem .35rem; min-width: 5.5rem; max-width: 22rem; white-space: pre-wrap; outline: none; }
.fe-grid td.num { text-align: right; }
.fe-grid td.fx { color: #0b5ed7; }
.fe-grid td:focus { box-shadow: inset 0 0 0 2px #0d6efd; background: #fff; }
.fe-grid td.edited, .fe-p.edited { background: #fff8db; }
.fe-doc { max-width: 820px; margin: 0 auto; padding: 1.25rem 1.5rem; background: #fff; }
.fe-p { min-height: 1.4em; padding: .1rem .25rem; margin-bottom: .35rem; border-radius: .25rem; white-space: pre-wrap; outline: none; }
.fe-p:focus { box-shadow: 0 0 0 2px #0d6efd; }
.fe-h { font-size: 1.2rem; font-weight: 600; }
.fe-doc-table { border-collapse: collapse; width: 100%; margin: .5rem 0 .75rem; }
.fe-doc-table td { border: 1px solid #ced4da; padding: .25rem .4rem; vertical-align: top; }
.fe-doc-table .fe-p { margin-bottom: 0; }
/* v27: Trợ lý kiểm tra hồ sơ */
.prq-reply { border-left: 4px solid #dc3545; }
.prq-reply.prq-soft { border-left-color: #ffc107; }
.prq-avatar { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #0d6efd; color: #fff; font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.prq-list { padding-left: 1.2rem; }
.prq-list li { margin-bottom: .45rem; }
.prq-row { padding: .15rem 0; }
.prq-mark { display: inline-block; width: 1.2rem; text-align: center; font-weight: 700; }
.prq-mark.ok { color: #198754; }
.prq-mark.bad { color: #dc3545; }
.prq-mark.warn { color: #b58105; }
