/* CRM adaptation of Work_D2D ui-tokens.css, ui-v2.css and work.css (19/11/2026).
   Load after page styles. Keep CRM selectors and behavior; share the visual rules.
   Desktop: Inter 14px, controls 36px, spacing 4pt, radii 4/8/12px.
   Mobile: controls >=44px and inputs 16px to avoid iOS focus zoom. */
:root {
  --d2d-font: var(--hrm-font-family);
  --d2d-radius-sm: 4px; --d2d-radius: 8px; --d2d-radius-lg: 12px;
  --d2d-control: 36px; --d2d-focus: 0 0 0 3px rgba(37,45,109,.30);
  --pti-primary: #252D6D; --pti-primary-dam: #1B2253; --pti-primary-chu: #1B2253;
  --pti-primary-nen: #EEF0FA; --pti-primary-vien: #CCD1EA;
  --pti-nen: #f6f7f9; --pti-sidebar: #fff; --pti-be-mat: #fff;
  --pti-ink: #16212b; --pti-ink-2: #4a5763; --pti-phu: #5b6875;
  --pti-vien: #e3e7eb; --pti-vien-2: #f1f4f6; --pti-ctl: #c9d1d8; --pti-hover: #f1f4f6;
  --pti-ray: #1B2253; --pti-ray-chon: #252D6D; --pti-ray-chu: #DCE0F4; --pti-ray-logo: #AAB4F0;
  --pti-bong: 0 8px 24px rgba(16,24,40,.14);
  --bs-font-sans-serif: var(--d2d-font); --bs-body-font-family: var(--d2d-font); --bs-body-font-size: var(--hrm-font-body);
  --bs-body-color: var(--pti-ink); --bs-body-color-rgb: 22,33,43;
  --bs-primary: var(--pti-primary); --bs-primary-rgb: 37,45,109;
  --bs-primary-text-emphasis: var(--pti-primary-dam); --bs-primary-bg-subtle: var(--pti-primary-nen); --bs-primary-border-subtle: var(--pti-primary-vien);
  --bs-link-color: var(--pti-primary); --bs-link-color-rgb: 37,45,109; --bs-link-hover-color: var(--pti-primary-dam); --bs-link-hover-color-rgb: 27,34,83;
  --bs-border-color: var(--pti-vien); --bs-border-radius: var(--d2d-radius); --bs-border-radius-sm: var(--d2d-radius-sm); --bs-border-radius-lg: var(--d2d-radius-lg);
  --bs-focus-ring-color: rgba(37,45,109,.30);
  --ag-bg: var(--pti-be-mat); --ag-head: #fafbfc; --ag-line: var(--pti-vien); --ag-line-2: var(--pti-vien-2);
  --ag-text: var(--pti-ink); --ag-muted: var(--pti-phu); --ag-hover: #fafbfc; --ag-selected: var(--pti-primary-nen); --ag-accent: var(--pti-primary); --ag-ctl: var(--pti-ctl);
  --m-nen: var(--pti-nen); --m-the: var(--pti-be-mat); --m-chu: var(--pti-ink); --m-chu-2: var(--pti-ink-2); --m-phu: var(--pti-phu);
  --m-ke: var(--pti-vien); --m-o: var(--pti-hover); --m-xanh: var(--pti-primary); --m-xanh-dam: var(--pti-primary-dam); --m-xanh-nen: var(--pti-primary-nen);
}
html { font-size: 14px; }
html[data-text-size="large"] { font-size: 16px; }
body { font-family: var(--d2d-font); font-size: var(--hrm-font-body); line-height: 1.5; background: var(--pti-nen); color: var(--pti-ink); }
[data-dm-popup] { display: none; }
.dm-popup .modal-body > .tc-card { margin-bottom: 0; padding: 0; border: 0; }
.dm-popup .modal-body > .tc-card > h2 { display: none; }
.dm-popup .tc-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.dm-popup .tc-fields label { display: grid; gap: 5px; font-size: var(--hrm-font-small); }
.dm-popup .tc-help { color: var(--pti-phu); font-size: var(--hrm-font-xs); }
@media (max-width: 575px) { .dm-popup .tc-fields { grid-template-columns: 1fr; } }
button, input, select, textarea { font-family: inherit; }
body :focus-visible { outline: 2px solid var(--pti-primary); outline-offset: 2px; }
.tieu-de-trang { font-size: var(--hrm-font-kpi); line-height: 1.3; font-weight: 600; letter-spacing: 0; }
.tieu-de-khoi { font-size: var(--hrm-font-section); line-height: 24px; font-weight: 600; }
.chu-thich, .breadcrumb { font-size: var(--hrm-font-small); color: var(--pti-phu); }
.vung-chinh { padding: 24px; }
.thanh-tren { min-height: 60px; height: auto; padding: 10px 24px; gap: 12px; }
.thanh-tren .tim { max-width: 520px; }
.thanh-tren .tim .form-control, .thanh-tren .tim .input-group-text { background: #fafbfc; }
.the, .card { border-color: var(--pti-vien); border-radius: var(--d2d-radius); box-shadow: none; }
.the-dau, .card-header { padding: 12px 16px; background: var(--pti-be-mat); border-bottom-color: var(--pti-vien); font-size: var(--hrm-font-body); font-weight: 600; }
.the-than, .card-body { padding: 16px; }
.btn { --bs-btn-font-weight: 500; --bs-btn-font-size: var(--hrm-font-body); --bs-btn-border-radius: var(--d2d-radius); min-height: var(--d2d-control); padding: 7px 14px; line-height: 1.2; }
.btn-sm { --bs-btn-font-size: var(--hrm-font-small); min-height: 32px; padding: 5px 10px; }
.btn-lg { min-height: 44px; padding: 11px 18px; }
.btn-primary { --bs-btn-bg: var(--pti-primary); --bs-btn-border-color: var(--pti-primary); --bs-btn-hover-bg: var(--pti-primary-dam); --bs-btn-hover-border-color: var(--pti-primary-dam); --bs-btn-active-bg: var(--pti-primary-dam); --bs-btn-active-border-color: var(--pti-primary-dam); --bs-btn-focus-shadow-rgb: 37,45,109; font-weight: 600; }
.btn-outline-primary { --bs-btn-border-color: #8D98D0; --bs-btn-hover-bg: var(--pti-primary-nen); --bs-btn-hover-color: var(--pti-primary-dam); --bs-btn-hover-border-color: var(--pti-primary); --bs-btn-focus-shadow-rgb: 37,45,109; }
.form-control, .form-select, .input-group-text { min-height: var(--d2d-control); padding-top: 7px; padding-bottom: 7px; font-size: var(--hrm-font-body); line-height: 1.45; border-color: var(--pti-ctl); border-radius: var(--d2d-radius); }
.form-control-sm, .form-select-sm, .input-group-sm > .form-control, .input-group-sm > .form-select, .input-group-sm > .input-group-text { min-height: 32px; padding-top: 5px; padding-bottom: 5px; font-size: var(--hrm-font-small); }
textarea.form-control { min-height: 80px; }
.form-control:focus, .form-select:focus { border-color: var(--pti-primary); box-shadow: var(--d2d-focus); }
.form-label { margin-bottom: 4px; font-size: var(--hrm-font-small); line-height: 20px; font-weight: 500; color: var(--pti-ink); }
.row.g-3:has(> [class*="col"] > .form-label) { --bs-gutter-y: 12px; }
.mb-3:has(> .form-label) { margin-bottom: 12px !important; }
.form-check-input:focus { border-color: #8D98D0; box-shadow: var(--d2d-focus); }
.modal-content, .dropdown-menu, .offcanvas { border-color: var(--pti-vien); border-radius: var(--d2d-radius-lg); }
.modal-title, .offcanvas-title { font-size: var(--hrm-font-large); line-height: 24px; font-weight: 600; }
.modal-header, .modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; }
.table { --bs-table-hover-bg: #fafbfc; --bs-table-striped-bg: #fafbfc; font-size: var(--hrm-font-small); }
.table > :not(caption) > * > * { padding: 8px 10px; }
.table > thead > tr > th, thead.table-light th { background: var(--ag-head) !important; color: var(--pti-phu); font-weight: 600; }
.table-sm > :not(caption) > * > * { padding: 5px 10px; }
.badge { font-size: var(--hrm-font-xs); font-weight: 600; border-radius: 11px; padding: 4px 8px; }
.text-bg-primary { background: var(--pti-primary-nen) !important; color: var(--pti-primary-chu) !important; }
.text-bg-info { background: #e8f1fb !important; color: #1d5a9e !important; }
.text-bg-danger { background: #fdecea !important; color: #b42318 !important; }
.nav-tabs .nav-link { padding: 8px 12px; font-weight: 400; }
.nav-tabs .nav-link.active { font-weight: 600; }
.ray-phan-he { scrollbar-width: thin; scrollbar-color: rgba(201,230,221,.3) transparent; }
.bang-chuc-nang { scrollbar-width: thin; scrollbar-color: var(--pti-ctl) transparent; }
/* Floating menu starts below the toolbar so its title/search never sit behind
   the company picker. Keep the full-height module rail in place. */
@media (min-width: 768px) {
  /* Keep the entire sidebar above sticky tables/cards; the child panel alone
     cannot outrank siblings of its sticky parent stacking context. */
  .sidebar { z-index: 1020; }
  .thanh-tren { z-index: 1030; }
  body.menu-gon .bang-chuc-nang { top: 72px; }
}
@media (min-width: 768px) and (max-width: 1279px) {
  .bang-chuc-nang { top: 72px; }
}
.ray-phan-he .nut-phan-he { border-radius: var(--d2d-radius-lg); }
.dau-menu { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 18px 0; }
.dau-menu h2 { margin: 0; color: var(--pti-ink); font-size: var(--hrm-font-section); line-height: 24px; font-weight: 700; }
.bang-phan-he { padding: 6px 12px 16px; }
.tim-menu { padding-top: 12px; }
.menu a.muc { min-height: 36px; padding: 6px 8px; gap: 8px; font-size: var(--hrm-font-body); }
.nut-menu-may-tinh { padding: 0; }
.tim-menu input { height: 34px; border-color: var(--pti-ctl); }
/* Specialized finance/purchasing views use their own selectors. */
.tc { --tc-line: var(--pti-vien); --tc-blue: var(--pti-primary); --tc-muted: var(--pti-phu); color: var(--pti-ink); }
.tc h1 { font-size: var(--hrm-font-kpi); font-weight: 600; letter-spacing: 0; }
.tc h2 { font-size: var(--hrm-font-section); font-weight: 600; }
.tc-card, .tc-kpis > div { border-radius: var(--d2d-radius); border-color: var(--pti-vien); }
.tc-kpis > div { border-top: 1px solid var(--pti-vien); }
.tc label { color: var(--pti-ink-2); }
.trang-auth { --bs-primary-rgb: 37,45,109; --bs-link-color-rgb: 37,45,109; background: var(--pti-nen); color: var(--pti-ink); }
.trang-auth .btn-primary { box-shadow: none; }
.trang-auth .hop h1 { font-size: var(--hrm-font-display); font-weight: 600; color: var(--pti-ink); }
.trang-auth .form-label { font-size: var(--hrm-font-small); font-weight: 500; color: var(--pti-ink); margin-bottom: 4px; }
.trang-auth .form-control { border-width: 1px; border-color: var(--pti-ctl); border-radius: var(--d2d-radius); color: var(--pti-ink); }
.trang-auth .form-control:focus { border-color: var(--pti-primary); box-shadow: var(--d2d-focus); }
.trang-auth .btn { border-radius: var(--d2d-radius); font-weight: 600; }
body.m { font-family: var(--d2d-font); background: var(--pti-nen); color: var(--pti-ink); }
.m-tieu-de { font-size: var(--hrm-font-display); font-weight: 600; letter-spacing: 0; line-height: 1.3; }
.m-tieu-de-nho { font-size: var(--hrm-font-kpi); font-weight: 600; letter-spacing: 0; }
body.m .btn-primary { font-weight: 600; border-radius: var(--d2d-radius); }
body.m .form-control, body.m .form-select { border-color: var(--pti-ctl); border-width: 1px; border-radius: var(--d2d-radius); }
@media (max-width: 767px) {
  .vung-chinh { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .thanh-tren { min-height: 56px; height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 8px; }
  .btn { min-height: 44px; border-radius: var(--d2d-radius); }
  .btn-sm { min-height: 36px; }
  .form-control, .form-select, body.m .form-control, body.m .form-select { min-height: 44px; font-size: var(--hrm-font-section); }
  .form-control-sm, .form-select-sm, .input-group-sm > .form-control, .input-group-sm > .form-select { min-height: 44px; font-size: var(--hrm-font-section); }
  .menu a.muc { min-height: 44px; }
  .tieu-de-trang { font-size: var(--hrm-font-kpi); font-weight: 600; }
  .the, .card, .modal-content { border-radius: var(--d2d-radius-lg); }
  .thanh-tren .nut-menu-di-dong, .thanh-tren .nut-tim-di-dong { min-height: 40px; }
  .tim-menu input { min-height: 44px; font-size: var(--hrm-font-section); }
}

/* Typography parity with Work_D2D ui-standard.css / ui-v2.css / work.css.
   Keep icons and code fonts independent; all application text uses the source scale. */
body { -webkit-font-smoothing: auto; }
small, .small, .form-text, .text-muted.small { font-size: var(--hrm-font-small); }
.dropdown-menu, .dropdown-item, .nav-tabs, .pagination { font-size: var(--hrm-font-body); }
.form-label, .tc label, .dm-popup .tc-fields label {
  font-size: var(--hrm-font-small); font-weight: 500; line-height: 1.5;
}
.chu-thich, .breadcrumb { font-size: var(--hrm-font-xs); }
.ray-phan-he .nut-phan-he span { font-size: 10px; line-height: 1.2; }
.menu a.muc { line-height: 1.5; }
.menu a.muc > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-kpis strong { font-size: var(--hrm-font-kpi); font-weight: 600; line-height: 1.3; }
.tc-kpis span, .tc-kpis small, .tc .tc-help, .dm-popup .tc-help {
  font-size: var(--hrm-font-small); line-height: 1.5;
}
@media (max-width: 767px) {
  .form-control, .form-select, body.m .form-control, body.m .form-select,
  .form-control-sm, .form-select-sm, .input-group-sm > .form-control,
  .input-group-sm > .form-select, .tim-menu input { font-size: max(16px, var(--hrm-font-body)); }
}

.tc h2, .tieu-de-khoi { line-height: 1.4; }

/* Compact finance header: one title and the primary action. */
.tc-dau { flex-wrap: wrap; margin-bottom: 16px; gap: 12px; }
.tc-dau + .tc-filter { margin-top: 0; }
.tc-dau h1 { line-height: 1.3; }

.page-help { margin-top: 4px; color: var(--pti-phu); font-size: var(--hrm-font-small); }
.page-help > summary { cursor: pointer; width: fit-content; color: var(--pti-primary); }
.page-help > p { max-width: 760px; margin: 8px 0 0; line-height: 1.5; }
.page-help[open] { margin-bottom: 8px; }
