/* Be Vietnam Pro — local (không chờ Google, hết nhảy layout lúc reload) */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-400-normal.woff2') format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-500-normal.woff2') format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-600-normal.woff2') format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-700-normal.woff2') format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-800-normal.woff2') format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-800-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url('../fonts/be-vietnam-pro/be-vietnam-pro-latin-800-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --ink: #111111;
  --ink-soft: #444444;
  --paper: #ffffff;
  --card: #ffffff;
  --brand: #e30613;
  --brand-dark: #b80510;
  --brand-soft: #fff1f2;
  --line: #e5e5e5;
  --ok: #157347;
  --warn: #9a6700;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --vpdt-richtext-height: 78px; /* toolbar + vùng gõ 36px — khớp TinyMCE */
  --sidebar-width: 223px; /* -10% từ 248px — tối ưu hiển thị */
  --block-gap: 4px; /* khe giữa các khối layout (card/panel/cột) */
  --show-aside-width: calc(var(--sidebar-width) * 1.1); /* cột phải show: +10% vs hiện tại */
  /* Root scale: ~18.75% nhỏ hơn mặc định trình duyệt (16px → 13px); mọi rem co theo */
  --font-size-root: 81.25%; /* ~13px vs 16px browser default (~18.75% nhỏ hơn) */ /* ~14px vs 16px browser default (~12.5% nhỏ hơn) */
  /* Chuẩn nội dung nhập liệu / ô list ERP (đo từ list Công việc Mã/Tên) */
  --font-size-content: .86rem; /* ≈11.18px @ root 13px — = .sidebar-sublink / .table-name-link */
}

* { box-sizing: border-box; }
html {
  font-size: var(--font-size-root);
  /* Luôn chừa chỗ thanh cuộn dọc → hết co giãn nhẹ khi đổi menu ngắn/dài */
  scrollbar-gutter: stable;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { max-width: 1120px; margin: 0 auto; padding: 24px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 3px solid var(--brand);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-logo {
  height: 48px; width: auto; display: block;
  background: transparent; border-radius: 0; padding: 0;
}
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; }
.brand-text span { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.muted { color: var(--ink-soft); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.grid { display: grid; gap: var(--block-gap, 4px); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
.stat h3 { margin: 0 0 8px; font-size: .95rem; color: var(--ink-soft); font-weight: 600; }
.stat strong { font-size: 2rem; color: var(--ink); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: 0; border-radius: 8px;
  /* Đồng bộ chiều cao / cỡ chữ với .btn-std (nút Đồng ý) */
  min-width: 112px;
  height: 36px;
  padding: 0 16px;
  box-sizing: border-box;
  font-weight: 700; cursor: pointer; font-size: .9rem; line-height: 1;
  white-space: nowrap; text-decoration: none;
}
/* <a class="btn …">: variant quyết định màu chữ — không inherit đen từ cha */
a.btn { text-decoration: none; }
a.btn-ghost,
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
a.btn-ghost:hover { color: var(--ink); text-decoration: none; }

.btn-primary,
a.btn.btn-primary {
  background: var(--brand);
  color: #fff !important; /* chữ trắng đồng bộ nút đỏ SHG */
}
.btn-primary:hover,
a.btn.btn-primary:hover {
  background: var(--brand-dark);
  color: #fff !important;
  text-decoration: none;
}
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .92rem; color: var(--ink); }
.field input {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px;
  font: inherit; background: #fff; color: var(--ink);
}
.field input:focus { outline: 2px solid rgba(227,6,19,.2); border-color: var(--brand); }
.errors { color: var(--danger); margin: 0 0 12px; padding: 0; list-style: none; }
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    linear-gradient(180deg, #fff 0%, #fff 55%, var(--brand-soft) 100%);
}
.auth-card { width: min(440px, 100%); border-top: 4px solid var(--brand); }


.nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 24px; }
.nav a {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 600; font-size: .9rem;
}
.nav a.active, .nav a:hover {
  background: var(--brand); color: #fff; text-decoration: none; border-color: var(--brand);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line);
  font-size: var(--font-size-content); /* chuẩn nội dung list/input */
  color: var(--ink);
}
.badge {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark);
}
.badge-warn { background: #fff4e5; color: var(--warn); }
.badge-ok { background: #e8f8ef; color: var(--ok); }
.wf-note {
  border-left: 4px solid var(--brand); padding: 10px 14px; background: var(--brand-soft);
  border-radius: 0 10px 10px 0; margin: 12px 0 20px; color: var(--ink-soft);
}
.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--ink-soft); background: #fafafa;
}

.auth-brand { text-align: center; margin-bottom: 0; }
.auth-logo {
  height: 83px; /* 64px * 1.3 */
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.auth-tagline {
  margin: 12px 0 0;
  text-align: center;
  color: #111111;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.4;
}
.auth-card h1 { display: none; }


@media (max-width: 800px) {
  .shell .grid[style*="2fr 1fr"] { grid-template-columns: 1fr !important; }
}
select { color: #111; background: #fff; }
textarea { color: #111; background: #fff; }
/* ===== App shell / left nav (G1-A IA) ===== */
body:has(.app-frame) {
  background: #f6f6f6;
}
.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--brand);
  text-align: center;
}
.sidebar-logo {
  height: 32px;
  width: auto;
  max-width: 120px;
  display: block;
  object-fit: contain;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.sidebar-brand strong,
.sidebar-system-name {
  display: block;
  font-size: .95rem;
  color: #111;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .02em;
}
.sidebar-brand span,
.sidebar-unit-name {
  display: block;
  font-size: .72rem;
  color: var(--ink-soft);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0;
}
.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
  flex: 1;
}
.sidebar-link, .sidebar-sublink {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #111;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
}
.sidebar-link {
  font-weight: 700; /* cấp 1 đồng bộ: Trang chủ, Hệ thống, Văn phòng, Sản xuất… */
}
.sidebar-link:hover, .sidebar-sublink:hover {
  background: #eff6ff;
  text-decoration: none;
  color: #1e3a8a;
}
.sidebar-link.active, .sidebar-sublink.active {
  background: #dbeafe;
  color: #1e3a8a;
}
.sidebar-group .sidebar-sub { display: none; padding: 2px 0 8px 18px; margin-left: 8px; border-left: 2px solid #e5e7eb; }
.sidebar-group.open .sidebar-sub { display: flex; flex-direction: column; gap: 2px; }
.sidebar-sublink {
  font-size: .86rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 8px 12px 8px 14px;
}
.sidebar-sublink.active { background: #dbeafe; color: #1e3a8a; }
.sidebar-parent {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  /* weight lấy từ .sidebar-link (700) — đồng bộ Trang chủ / nhóm / module */
  color: #111;
}
.sidebar-parent:hover { background: #eff6ff; color: #1e3a8a; }
.sidebar-parent.active,
.sidebar-parent.active:not(.sidebar-sublink) {
  background: transparent;
  color: #111;
}
.sidebar-chevron {
  margin-left: auto;
  font-size: .72rem;
  color: #94a3b8;
  line-height: 1;
  transition: transform .15s ease;
  flex: 0 0 auto;
}
.sidebar-group.open > .sidebar-parent .sidebar-chevron { transform: rotate(180deg); color: #64748b; }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.sidebar-user strong { display: block; font-size: .9rem; color: #111; }
.sidebar-user span { display: block; font-size: .75rem; color: var(--ink-soft); }
.sidebar-logout { width: 100%; }
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* chặn kéo cả màn hình; Kanban tự cuộn */
}
.app-content {
  min-width: 0;
}
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header-text { flex: 1; min-width: 0; }
.app-page-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #111;
  line-height: 1.2;
}
.app-page-subtitle {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: .86rem;
  font-weight: 600;
}
.app-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sidebar-toggle { display: none; }
.app-content { padding: 4px; } /* 4 cạnh = block-gap (menu↔nội dung + mép) */
/* Module tabs — chuẩn tab nội bộ (Tổ chức, Tài khoản, …)
   Gạch chân active đỏ SHG; không dùng pill. */
.module-tabs,
.account-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 var(--block-gap, 4px);
  border-bottom: 1px solid #e8e8e8;
  min-height: 48px;
  box-sizing: border-box;
}
.module-tabs-left,
.account-tabs-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.module-tabs-actions,
.account-tabs-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 0 4px 0 8px;
  align-self: stretch;
  height: auto;
  box-sizing: border-box;
}
.module-tabs a,
.account-tabs a {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  color: #555;
  text-decoration: none;
  font-weight: 400; /* = submenu, không in đậm */
  font-size: .86rem; /* = .sidebar-sublink */
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  background: transparent;
}
.module-tabs a:hover,
.account-tabs a:hover {
  color: #111;
  background: transparent;
  text-decoration: none;
  font-weight: 400;
}
.module-tabs-left a .cnt {
  display: inline-block; min-width: 1.2rem; margin-left: 6px;
  font-size: .78rem; color: #888; font-weight: 400;
}
.module-tabs-left a.active .cnt { color: #E30613; }
.module-tabs a.active,
.account-tabs a.active {
  color: #E30613;
  border-bottom-color: #E30613;
  background: transparent;
  font-weight: 400;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 25;
}

@media (max-width: 900px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .app-frame.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .app-frame.sidebar-open .sidebar-backdrop { display: block; }
  .app-content .grid[style*="2fr 1fr"] { grid-template-columns: 1fr !important; }
}
/* ===== Form + ERP list UX ===== */
.btn-sm { padding: 7px 12px; font-size: .86rem; border-radius: 8px; }
.app-header { gap: 10px; }
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
}
.header-user-info {
  text-align: right;
  line-height: 1.25;
  max-width: 220px;
}
.header-user-info strong {
  display: block;
  font-size: .9rem;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-user-info span {
  display: block;
  font-size: .75rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Forms — ERP-like dense inputs */
.form-panel {
  background: #fff;
  border: 0;
  border-radius: 10px;
  /* visible so Tom Select dropdown (inside wrapper) is not clipped */
  overflow: visible;
  width: 100%;
  max-width: none;
  box-shadow: 0 0 0 1px #e8e8e8, 0 1px 3px rgba(15, 23, 42, 0.05);
  background-clip: padding-box;
  transform: translateZ(0);
}
.form-panel-body { padding: 16px 18px 8px; }
.form-panel-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.form-grid .field-span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; margin-bottom: 0; }
.field label {
  font-weight: 600;
  font-size: .82rem;
  color: #222;
}
.field .hint { font-size: .75rem; color: var(--ink-soft); font-weight: 500; }
.form-control,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 36px;
  font: inherit;
  font-size: var(--font-size-content);
  color: #111;
  background: #fff;
}

/* Giá trị chỉ xem trong form — cùng chuẩn --font-size-content */
.form-static,
.field > .form-static {
  font-size: var(--font-size-content);
  font-weight: 400;
  color: #111;
  line-height: 1.45;
  word-break: break-word;
}
.form-static.is-blank,
.form-static .muted { color: #888; }

.field textarea { min-height: 88px; resize: vertical; }
.form-control:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(227,6,19,.12);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  color: #111;
  font-size: var(--font-size-content);
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 12px;
  padding: 8px 0;
}

/* Tom Select align with form-control */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  border: 1px solid #cfcfcf !important;
  border-radius: 6px !important;
  min-height: 36px;
  padding: 4px 8px !important;
  box-shadow: none !important;
  font-size: var(--font-size-content);
}
.ts-wrapper.focus .ts-control {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(227,6,19,.12) !important;
}
.ts-dropdown {
  border-color: #cfcfcf !important;
  border-radius: 6px !important;
  font-size: .9rem;
}
.ts-dropdown .option.active { background: var(--brand-soft); color: var(--brand-dark); }
.ts-dropdown .option.selected { background: var(--brand); color: #fff; }

/* Select caret: tam giác đặc (đồng bộ Tom Select + native) */
.ts-wrapper.single .ts-control {
  --ts-pr-caret: 1.5rem;
}
.ts-wrapper.single .ts-control:after {
  content: " " !important;
  display: block !important;
  position: absolute !important;
  top: 50% !important;
  right: 12px !important;
  left: auto !important;
  width: 0 !important;
  height: 0 !important;
  margin-top: -2px !important;
  border-style: solid !important;
  border-width: 6px 5px 0 5px !important;
  border-color: #666 transparent transparent transparent !important;
  background: none !important;
  pointer-events: none;
}
.ts-wrapper.single.dropdown-active .ts-control:after {
  border-width: 0 5px 6px 5px !important;
  border-color: transparent transparent #666 transparent !important;
  margin-top: -4px !important;
}

/* Native <select> còn lại (chưa bọc Tom Select): cùng tam giác */
select.form-control,
select.js-search-select,
.field select,
.form-grid select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666666' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  padding-right: 32px !important;
}
select.form-control::-ms-expand,
select.js-search-select::-ms-expand,
.field select::-ms-expand {
  display: none;
}


/* ERP list panels */
.list-panel {
  background: #fff;
  /* No hard border: 1px side borders + inner horizontal rules create “__” ticks on Windows/RDP photos */
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px #e8e8e8, 0 1px 3px rgba(15, 23, 42, 0.05);
  background-clip: padding-box;
  transform: translateZ(0);
}
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f7f7;
}
.list-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 220px;
}
.list-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.list-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  max-width: 420px;
}
.list-search .form-control { min-height: 36px; }
.table-wrap { overflow: auto; }
.table-erp {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-content);
}
.table-erp thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ececec;
  color: #222;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: .75rem;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e2e2;
  white-space: nowrap;
  text-align: left;
}
.table-erp tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  color: #111;
  vertical-align: middle;
}
.table-erp tbody tr:nth-child(even) { background: #fafafa; }
.table-erp tbody tr:hover { background: #fff5f5; }
.table-erp .col-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}
.table-erp .col-check { width: 36px; text-align: center; }
.table-erp .col-code { width: 120px; font-variant-numeric: tabular-nums; }
.table-erp .col-status { width: 100px; }
.list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: #f7f7f7;
  font-size: .84rem;
  color: var(--ink-soft);
}
.list-footer nav { display: flex; gap: 4px; flex-wrap: wrap; }
.list-footer nav > * { margin: 0 !important; }
.list-footer svg { display: inline-block; width: 1rem; height: 1rem; }
.action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: .84rem;
}
.action-link + .action-link { margin-left: 10px; }
.badge-muted { background: #eee; color: #555; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-dot::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: #999;
}
.status-dot.is-on::before { background: var(--ok); }
.status-dot.is-off::before { background: var(--danger); }

@media (max-width: 800px) {
  .form-grid { grid-template-columns: 1fr; }
  .header-user-info { display: none; }
}
/* ===== Search bar + icons + avatar UX ===== */
.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: .9;
}
.sidebar-link,
.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-sublink .nav-icon { width: 16px; height: 16px; }
.btn-icon { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }

.list-title {
  color: #111;
  font-size: .95rem;
}
.list-toolbar {
  border-bottom: 0;
  background: #fff;
  padding-bottom: 4px;
}
.list-searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.search-field {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 1;
  max-width: 480px;
  min-width: 200px;
  height: 36px;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}
.search-field:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.search-field input[type="search"] {
  width: 100%;
  min-height: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px 0 36px;
  font: inherit;
  font-size: var(--font-size-content);
  color: #111;
  background: transparent;
  outline: none;
  box-shadow: none;
}
.search-field input[type="search"]:focus {
  outline: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.search-field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field-btn {
  position: absolute;
  left: 2px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #888;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
}
.search-field-btn:hover { background: #f3f4f6; color: #111; }
.search-field-btn .nav-icon { width: 16px; height: 16px; }
.search-clear {
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.search-clear:hover { color: var(--brand-dark); }

.avatar {
  display: inline-block;
  object-fit: cover;
  object-position: center;
  box-sizing: border-box;
  padding: 0;
  border-radius: 50%;
  background: #f3f4f6;
  border: 1px solid rgba(0,0,0,.06);
  vertical-align: middle;
  overflow: hidden;
}
/* Legacy letter fallback (nếu còn) */
.show-person-fallback,
.disc-mention-fallback {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: #374151;
  background: #e5e7eb;
  text-transform: uppercase;
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-xl { width: 88px; height: 88px; border-width: 2px; }
.avatar-uploader {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #d4d4d4;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fafafa);
}
.avatar-uploader-meta { flex: 1; min-width: 0; }
.avatar-uploader-meta label { font-weight: 700; color: #111; display: block; margin-bottom: 6px; }

.header-user .avatar { margin-right: 2px; }
/* ===== Header user dropdown ===== */
.user-menu {
  position: relative;
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
}
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}
.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  border-color: var(--line);
  background: #fafafa;
}
.user-menu-trigger .avatar {
  display: block;
}
.user-menu-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #666;
  margin-right: 2px;
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.10);
  padding: 8px;
  z-index: 50;
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-menu-head strong {
  display: block;
  font-size: .92rem;
  color: #111;
  line-height: 1.25;
}
.user-menu-head span {
  display: block;
  font-size: .75rem;
  color: var(--ink-soft);
}
.user-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #111;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.user-menu-item:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-decoration: none;
}
.user-menu-item .nav-icon { width: 18px; height: 18px; }
.user-menu-logout { color: #7a1f1a; }
.user-menu-logout:hover { background: #fff1f2; color: var(--danger); }
.profile-meta {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  font-size: .9rem;
  color: #111;
}

/* hide old header-user inline layout leftovers if any */
.header-user { display: none; }
/* ===== Tom Select: search box below control + magnifier ===== */
.ts-wrapper.single .ts-control {
  cursor: pointer;
}
.ts-wrapper.single.dropdown-active .ts-control,
.ts-wrapper.single.focus .ts-control {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(227,6,19,.12) !important;
}

/* Hide typing-in-control behavior visually for single + dropdown_input */
.ts-wrapper.plugin-dropdown_input.focus.dropdown-active .ts-control {
  box-shadow: none;
}

.ts-dropdown {
  margin-top: 4px !important;
  border: 1px solid #d0d0d0 !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

/* Dedicated search row — cùng bề ngang với control (dropdown trong .ts-wrapper) */
.ts-wrapper {
  position: relative;
}
.ts-dropdown {
  width: 100% !important;
  left: 0 !important;
  right: auto !important;
  box-sizing: border-box !important;
}
.ts-dropdown .dropdown-input-wrap,
.ts-dropdown .ts-search-field {
  position: relative;
  display: block;
  padding: 0;
  border-bottom: 1px solid #ececec;
  background: #fff;
}
.ts-dropdown .dropdown-input,
.ts-dropdown .dropdown-input-wrap input,
.ts-dropdown .ts-search-field input {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 36px;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 9px 12px 9px 40px !important;
  margin: 0 !important;
  font: inherit;
  font-size: var(--font-size-content);
  color: #111;
  background: #fafafa !important;
  box-shadow: none !important;
  outline: none !important;
  box-sizing: border-box !important;
}
.ts-dropdown .dropdown-input:focus,
.ts-dropdown .dropdown-input-wrap input:focus,
.ts-dropdown .ts-search-field input:focus {
  outline: none !important;
  background: #fff !important;
  border: 0 !important;
  box-shadow: none !important;
}
/* Magnifier — trái (chuẩn ô tùy chọn thông minh) */
.ts-dropdown .dropdown-input-wrap::after,
.ts-dropdown .ts-search-field::after {
  content: '';
  position: absolute;
  left: 12px;
  right: auto;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23444444' stroke-width='1.75'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z'/%3E%3C/svg%3E");
}

.ts-dropdown .ts-dropdown-content {
  max-height: 240px;
  padding: 4px 0;
}
.ts-dropdown .option {
  padding: 9px 12px;
}

/* ===== Select/TomSelect: same as Email — left + vertical center ===== */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  min-height: 36px;
  padding: 8px 28px 8px 10px !important; /* room for caret on right, same left padding as .form-control */
}
.ts-wrapper.single .ts-control > *,
.ts-wrapper.single .ts-control .item,
.ts-wrapper.single .ts-control input,
.ts-wrapper.single .ts-control .ts-placeholder,
.ts-control .ts-placeholder {
  text-align: left !important;
  margin: 0 !important;
}
.ts-wrapper.single .ts-control .item {
  width: auto;
  line-height: 1.25;
}
.ts-wrapper.single .ts-control input {
  flex: 1 1 auto;
  min-width: 0 !important;
}

/* Native selects: left like Email, vertically centered via padding */
select.js-search-select,
select.form-control,
.field select {
  text-align: left;
  text-align-last: left;
  padding: 8px 28px 8px 10px;
  min-height: 36px;
  line-height: 1.25;
}
select.js-search-select option,
.field select option {
  text-align: left;
}

/* Dropdown options stay left-aligned for reading */
.ts-dropdown .option {
  text-align: left;
}

/* ===== Form fields: uniform row height ===== */
.form-grid > .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  margin: 0;
}
.form-grid > .field > label {
  min-height: 1.2em;
  margin: 0;
}
.form-grid .form-control:not(.ts-wrapper),
.form-grid .ts-wrapper.single .ts-control,
.form-grid select:not(.tomselected) {
  /* Đồng bộ chiều cao với .btn-std */
  min-height: 36px !important;
  height: 36px;
  box-sizing: border-box;
}
.form-grid .ts-wrapper {
  min-height: 0;
  height: auto !important;
  overflow: visible !important;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.form-grid .ts-wrapper.single .ts-control {
  display: flex !important;
  align-items: center !important;
}
.form-grid textarea.form-control {
  height: auto;
  min-height: 88px !important;
}
/* multi select (Phân quyền) may grow — keep control min height only */
.form-grid .ts-wrapper.multi .ts-control {
  height: auto !important;
  min-height: 36px !important;
}

/* Form panels fill content width (sync with list-panel) */
.form-panel {
  max-width: none;
  width: 100%;
  /* keep 1px ring + radius inside .app-main { overflow-x:hidden } */
  transform: none;
  box-sizing: border-box;
}
.app-content > .form-panel,
.app-content .form-panel {
  max-width: none;
}
/* ===== List action icons + excel bar ===== */
.list-searchbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.list-searchbar .search-field,
.list-searchbar .vpdt-search-combo {
  flex: 1 1 280px;
  max-width: 520px;
  width: auto;
}
.list-searchbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.btn-icon-only .nav-icon {
  width: 18px;
  height: 18px;
  margin: 0;
}
.table-erp .col-actions {
  white-space: nowrap;
}
.table-erp .col-actions form {
  display: inline;
}
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #333;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  padding: 0;
}
.action-icon:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: #f0b4b8;
  text-decoration: none;
}
.action-icon.danger:hover {
  background: #fff1f2;
  color: var(--danger);
  border-color: #f3c1c1;
}
.action-icon .nav-icon {
  width: 16px;
  height: 16px;
}
.btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #111;
  font-weight: 600;
  font-size: .84rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-excel:hover {
  background: #f7f7f7;
  text-decoration: none;
  color: #111;
}
.btn-excel .nav-icon { width: 16px; height: 16px; }
.btn-excel input[type="file"] { display: none; }

/* ===== Auth / login spacing (scoped — không ảnh hưởng form-grid) ===== */
.auth-brand {
  text-align: center;
  margin-bottom: 0;
}
.auth-tagline {
  margin: 12px 0 0;
}
.auth-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.auth-card .field {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}
.auth-card .field label {
  font-weight: 600;
  font-size: .9rem;
  color: #111;
  line-height: 1.3;
  margin: 0;
}
.auth-card .form-control,
.auth-card .field input:not([type="checkbox"]):not([type="radio"]) {
  min-height: 36px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: var(--font-size-content);
}
.auth-card .check-row.auth-remember {
  margin: 0 0 20px;
  gap: 10px;
  font-size: .92rem;
  font-weight: 500;
  color: #111;
  cursor: pointer;
}
.auth-card .auth-submit {
  width: 100%;
  min-height: 36px;
  margin: 0;
  font-weight: 700;
}
.auth-card .errors {
  margin: 16px 0 0;
}

/* ===== Sidebar colorful icons ===== */
.sidebar .nav-icon {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  padding: 5px;
  border-radius: 8px;
  box-sizing: content-box;
}
.sidebar-link,
.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .nav-icon--home { color: #2563eb; background: #dbeafe; }
.sidebar .nav-icon--cog { color: #64748b; background: #f1f5f9; }
.sidebar .nav-icon--users { color: #4f46e5; background: #e0e7ff; }
.sidebar .nav-icon--building { color: #d97706; background: #fef3c7; }
.sidebar .nav-icon--shield { color: #059669; background: #d1fae5; }
.sidebar .nav-icon--sliders { color: #7c3aed; background: #ede9fe; }
.sidebar .nav-icon--briefcase { color: #c2410c; background: #ffedd5; }
.sidebar .nav-icon--user-group { color: #0d9488; background: #ccfbf1; }
.sidebar .nav-icon--clipboard { color: #0284c7; background: #e0f2fe; }
.sidebar .nav-icon--check-badge { color: #16a34a; background: #dcfce7; }
.sidebar .nav-icon--document { color: #e11d48; background: #ffe4e6; }
.sidebar .nav-icon--flow { color: #2563eb; background: #dbeafe; }
.sidebar .nav-icon--cube { color: #9333ea; background: #f3e8ff; }
.sidebar .nav-icon--chart { color: #15803d; background: #dcfce7; }
.sidebar .nav-icon--wrench { color: #ea580c; background: #ffedd5; }
.sidebar .nav-icon--queue-list { color: #4f46e5; background: #e0e7ff; }
.sidebar .nav-icon--squares-2x2 { color: #0891b2; background: #cffafe; }
.sidebar-sublink.active .nav-icon { box-shadow: 0 0 0 1px rgba(37, 99, 235, .22); }

/* Legacy: body-parented dropdown (should not be used — kept for safety) */
body > .ts-dropdown {
  z-index: 10050 !important;
  box-sizing: border-box !important;
}

/* Settings logo uploader */
.logo-uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}
.logo-uploader-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  flex-shrink: 0;
}
.logo-uploader-meta {
  flex: 1;
  min-width: 0;
}



/* Keep table rules inside panel so joins don’t poke past the left edge */
.list-panel .table-wrap {
  margin: 0;
}
.list-panel .table-erp thead th,
.list-panel .table-erp tbody td {
  border-left: 0;
  border-right: 0;
}


/* sidebar active: light blue only on current leaf */
.sidebar-link.active,
.sidebar-sublink.active {
  background: #dbeafe !important;
  color: #1e3a8a !important;
}
.sidebar-parent.active {
  background: transparent !important;
  color: #111 !important;
}
.sidebar-link:hover,
.sidebar-sublink:hover {
  background: #eff6ff;
  color: #1e3a8a;
}


/* ===== VPĐT standard action buttons (Hủy / Lưu nháp / Gửi duyệt / Tạo…) ===== */
.btn-std,
.req-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  height: 36px;
  padding: 0 16px;
  box-sizing: border-box;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: #fff !important;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1;
  white-space: nowrap;
}
.btn-std:hover,
.req-act:hover {
  filter: brightness(.95);
  color: #fff !important;
  text-decoration: none;
}
.btn-std-cancel,
.req-act-cancel { background: #4b5563; }
.btn-std-draft,
.btn-std-info,
.req-act-draft { background: #2563eb; }
.btn-std-submit,
.btn-std-success,
.req-act-submit { background: #16a34a; }
.btn-std-primary { background: #E30613; }
.btn-std:disabled,
.btn-std[disabled] {
  opacity: .45;
  cursor: not-allowed;
  filter: none !important;
  pointer-events: none;
}
.btn-std:disabled:hover,
.btn-std[disabled]:hover {
  filter: none !important;
}
.btn-std-danger { background: #b42318; }
.btn-std-reject {
  background: #fff;
  color: #b42318 !important;
  border: 1px solid #b42318;
}
.btn-std-reject:hover { background: #fff1f2; color: #b42318 !important; filter: none; }
.show-act-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.show-act-head h3 { margin: 0; color: #111; }
.show-act-icons { display: flex; gap: 6px; align-items: center; }
.show-act-icons .action-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid #e5e5e5; border-radius: 8px;
  background: #fff; color: #555; cursor: pointer; text-decoration: none; padding: 0;
}
.show-act-icons .action-icon:hover { background: #f7f7f7; color: #111; }
.show-act-icons .action-icon.danger { color: #b42318; }
.show-act-icons .action-icon.danger:hover { background: #fff1f2; border-color: #f3c1c6; color: #E30613; }
.show-act-icons .action-icon svg, .show-act-icons .action-icon .nav-icon { width: 16px; height: 16px; }
.show-meta {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eee; /* kẻ ngăn meta ↔ nội dung — đồng bộ đen mờ */
}
.show-meta-lines {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto;
}
.show-meta-line {
  margin: 0; color: #666; line-height: 1.45; font-size: .86rem;
}
.show-meta-dot { margin: 0 .35em; color: #999; }
.show-meta-template { color: #1d4ed8; font-weight: 600; }
a.show-meta-template { text-decoration: none; }
a.show-meta-template:hover { text-decoration: underline; color: #1e40af; }
.show-meta-creator { color: #111; font-weight: 700; }
.show-meta-when { color: #444; font-variant-numeric: tabular-nums; }
.show-meta-stage-due { color: #444; font-variant-numeric: tabular-nums; font-weight: 600; }
.show-meta-stage-due.is-overdue { color: #b42318; }
.show-meta-sla { color: #111; font-variant-numeric: tabular-nums; font-weight: 600; }
.show-meta-code {
  font-size: .86rem; /* cùng cỡ dòng Loại phiếu / Thời gian tạo */
  font-weight: 400; color: #111; font-variant-numeric: tabular-nums;
  white-space: nowrap; flex: 0 0 auto; padding-top: 1px; line-height: 1.45;
}
.show-act-card .field { margin: 0 0 12px; }
.show-act-card .field label { display: block; margin-bottom: 6px; font-weight: 600; color: #333; }
.show-act-card .field .form-control,
.show-act-card .field input[type="text"] {
  width: 100%; box-sizing: border-box; min-height: 36px;
  border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px;
}
.show-act-btns {
  display: flex; gap: 8px; align-items: center; margin-top: 4px;
}
.show-act-btns .btn-std { flex: 1 1 0; min-width: 0; }


/* Show layout: cột phải = --show-aside-width (+10% vs sidebar) */
.show-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--show-aside-width, calc(var(--sidebar-width, 248px) * 1.1));
  gap: var(--block-gap, 4px); /* khe cột nội dung ↔ aside */
  align-items: start;
  max-width: 100%;
  overflow-x: clip; /* modal/picker không kéo giãn khung trang */
}
.show-layout > .show-main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--block-gap, 4px);
}
.show-layout > .show-main-col > .disc-card { margin-top: 0; }
.show-layout > .show-act-card,
.show-layout > :last-child {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 900px) {
  .show-layout { grid-template-columns: 1fr; }
}

/* Show request: stacked fields + flow stepper */
.show-fields { display: flex; flex-direction: column; gap: var(--block-gap, 4px); }

/* Quy trình — dữ liệu phiếu theo giai đoạn */
.wf-show-stage {
  padding-top: 0;
  margin-top: 0;
  border-top: 0; /* bỏ kẻ đỏ ngăn giai đoạn */
}
.wf-show-stage:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.wf-show-stage-h {
  margin: 0 0 10px;
  font-size: .92rem;
  font-weight: 700;
  color: #111;
}
.wf-show-stage-card {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 12px 14px 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.wf-show-part-h {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #555;
  margin: 6px 0 10px;
}
.wf-show-part-ico { color: #888; font-weight: 700; }
.wf-show-stage-card .show-field { margin-bottom: 12px; }

.show-field-block-title {
  font-weight: 700; color: #111; font-size: 1rem; margin-top: 4px;
}
.show-field-label {
  font-weight: 700; color: #222; margin: 0 0 6px; font-size: .92rem;
}
.show-field-value { color: #333; font-size: var(--font-size-content); }
/* Giữ xuống dòng / khoảng trắng như lúc nhập (textarea ≈ văn bản Word plain) */
.show-field-value-text {
  font-size: var(--font-size-content);
  font-weight: 400;
  color: #111;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

/* Form table field — Excel-like grid */
.show-field-value .table-wrap {
  margin-top: 2px;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  overflow: auto;
  background: #fff;
}
.show-field-value .table-erp {
  border-collapse: collapse;
  width: 100%;
}
.show-field-value .table-erp thead th,
.show-field-value .table-erp tbody td,
.show-field-value .table-erp tfoot td {
  border: 1px solid #bdbdbd !important;
  padding: 8px 10px;
  vertical-align: middle;
}
.show-field-value .table-erp thead th {
  background: #ececec;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-size: .75rem;
  color: #222;
  position: sticky;
  top: 0;
  z-index: 1;
}
.show-field-value .table-erp tbody tr:nth-child(even) { background: #fafafa; }
.show-field-value .table-erp tbody tr:hover { background: #fff8f8; }
.show-field-value .table-erp tfoot td {
  background: #f7f7f7;
  font-weight: 700;
}

.flow-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 18px 16px 12px;
  overflow-x: auto;
}
.flow-step {
  position: relative;
  flex: 1 1 0;
  min-width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.flow-step-node {
  width: 34px; height: 34px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
  border: 2px solid #c4c4c4;
  background: #fff;
  color: #888;
  z-index: 1;
}
.flow-step-line {
  position: absolute;
  top: 16px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: #d4d4d4;
  z-index: 0;
}
.flow-step-label {
  margin-top: 8px;
  font-size: .8rem;
  color: #666;
  line-height: 1.3;
  max-width: 140px;
  padding: 0 4px;
}
.flow-step-done .flow-step-node {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}
.flow-step-done .flow-step-line { background: #86efac; }
.flow-step-done .flow-step-label { color: #166534; font-weight: 600; }
.flow-step-current .flow-step-node {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #5b21b6;
}
.flow-step-current .flow-step-label { color: #5b21b6; font-weight: 700; }
.flow-step-todo .flow-step-node {
  border-color: #c4c4c4;
  background: #fff;
  color: #9ca3af;
}
.flow-step-todo .flow-step-label { color: #9ca3af; }

.flow-step-rejected .flow-step-node {
  border-color: #f5a3a8;
  background: #fee2e2;
  color: #b42318;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}
.flow-step-rejected .flow-step-line { background: #e5e5e5; }
.flow-step-rejected .flow-step-label { color: #b42318; font-weight: 700; }


.show-flow-top { margin: 0 0 16px; }

/* ===== Request show aside (4 blocks) ===== */
.show-aside-sections { margin-top: 12px; border-top: 1px solid #eee; }
.show-aside-sec { border-bottom: 1px solid #f0f0f0; }
.show-aside-sec-head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0 8px;
  cursor: pointer;
  user-select: none;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #2f6b4f;
}
.show-aside-sec-head::-webkit-details-marker { display: none; }
.show-aside-chev {
  width: 8px; height: 8px;
  border-right: 2px solid #8aa897;
  border-bottom: 2px solid #8aa897;
  transform: rotate(45deg);
  transition: transform .15s ease;
  flex: 0 0 auto;
}
details[open] > .show-aside-sec-head .show-aside-chev {
  transform: rotate(-135deg);
  margin-top: 4px;
}
.show-aside-sec-body { padding: 0 0 12px; }

.show-person-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}
.show-person-avatar { flex: 0 0 auto; }
.show-person-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: #f3f4f6; color: #374151; font-weight: 700; font-size: .8rem;
}
.show-person-meta { flex: 1 1 auto; min-width: 0; }
.show-person-name { font-size: .86rem; /* = .sidebar-sublink */ font-weight: 600; color: #111; line-height: 1.25; }
.show-person-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; font-size: .82rem; color: #6b7280; }
.show-person-handle { color: #9ca3af; }
.show-person-title { color: #6b7280; }
.show-person-step { font-size: .78rem; margin-top: 2px; }
.show-person-status {
  width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; flex: 0 0 auto; margin-top: 4px;
}
.show-person-status-approved { background: #dcfce7; color: #166534; }
.show-person-status-rejected { background: #fee2e2; color: #b42318; }
.show-person-status-pending { background: #f3f4f6; color: #9ca3af; }
.show-person-status-skipped { background: #f3f4f6; color: #9ca3af; }
.show-tl-skip .show-tl-dot { background: #d1d5db; }
.show-tl-skip .show-tl-title { color: #6b7280; }

/* Followers avatar row */
.show-follow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 2px 0 4px;
  min-height: 44px;
}
.show-follow-av {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}
.show-follow-avatar-img {
  width: 36px !important;
  height: 36px !important;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e5e5e5;
  display: block;
  background: #f3f4f6;
}
.show-follow-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  min-width: 140px;
  max-width: 220px;
  padding: 8px 10px;
  background: #1f2937;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
  z-index: 30;
  text-align: left;
}
.show-follow-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
}
.show-follow-tip-name {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}
.show-follow-tip-title {
  display: block;
  margin-top: 2px;
  font-size: .78rem;
  font-weight: 400;
  color: #e5e7eb;
  line-height: 1.3;
}
.show-follow-av:hover .show-follow-tip,
.show-follow-av:focus-within .show-follow-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.show-follow-av .show-follow-rm {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 0;
  background: #fff;
  color: #b42318;
  box-shadow: 0 0 0 1px #f3c1c6;
  font-size: .85rem;
  line-height: 1;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.show-follow-av:hover .show-follow-rm { display: inline-flex; }
.show-follow-add-wrap { position: relative; margin-top: 0; flex: 0 0 auto; }
.show-follow-add-btn {
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px dashed #c4c4c4; background: #fff; color: #666;
  font-size: 1.25rem; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.show-follow-add-btn:hover { border-color: #E30613; color: #E30613; }
/* Picker neo full bề ngang khối cột phải — không tràn làm co giãn trang */
.show-aside-sec-body:has(> .show-follow-picker) {
  position: relative;
}
.show-follow-picker {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 6px;
  z-index: 40;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 8px;
}
.show-follow-picker .form-control {
  min-height: 36px;
  font-size: .82rem;
  padding: 6px 8px;
}
.show-follow-picker-list {
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 6px;
}
.show-follow-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.show-follow-opt:hover { background: #f7f7f7; }
.show-follow-opt .avatar,
.show-follow-opt .avatar-sm {
  width: 26px !important;
  height: 26px !important;
  flex: 0 0 auto;
  font-size: .72rem;
}
.show-follow-opt-text {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.show-follow-opt-text strong {
  font-size: .78rem;
  font-weight: 600;
  color: #111;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.show-follow-opt-text .muted,
.show-follow-opt-text > span {
  font-size: .72rem;
  line-height: 1.25;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-tl { display: flex; flex-direction: column; }
.show-tl-item {
  display: grid;
  grid-template-columns: 44px 18px 1fr;
  gap: 8px;
  min-height: 48px;
}
.show-tl-time { text-align: right; padding-top: 2px; }
.show-tl-date {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; color: #9ca3af; line-height: 1.1;
}
.show-tl-hm { font-size: .92rem; font-weight: 600; color: #111; line-height: 1.2; }
.show-tl-rail {
  position: relative; display: flex; justify-content: center;
}
.show-tl-rail::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: #e5e7eb;
}
.show-tl-item:last-child .show-tl-rail::before { bottom: 50%; }
.show-tl-dot {
  position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 4px;
  border-radius: 999px; border: 2px solid #d1d5db; background: #fff;
  box-sizing: border-box;
}
.show-tl-ok .show-tl-dot { background: #16a34a; border-color: #16a34a; }
.show-tl-rej .show-tl-dot { background: #e11d48; border-color: #e11d48; }
.show-tl-cur .show-tl-dot { background: #2563eb; border-color: #2563eb; }
.show-tl-add .show-tl-dot { background: #2563eb; border-color: #2563eb; }
.show-tl-todo .show-tl-dot { background: #fff; border-color: #d1d5db; }
.show-tl-title { font-size: .86rem; /* = .sidebar-sublink */ font-weight: 600; color: #111; line-height: 1.3; }
.show-tl-sub { font-size: .82rem; line-height: 1.35; margin-top: 2px; }

.show-act-card .show-aside-sections .empty { display: none; }
@media (max-width: 900px) {
  .show-tl-item { grid-template-columns: 40px 16px 1fr; }
}

/* ===== Discussion (Platform UI shell) ===== */
.disc-card { margin-top: var(--block-gap, 4px); overflow: visible; }
.disc-list { overflow: visible; }
.disc-item { position: relative; overflow: visible; }
.disc-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #eee;
}
.disc-title {
  margin: 0;
  font-size: .86rem; /* = .sidebar-sublink */
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #111;
}
.disc-count { font-size: .82rem; }
.disc-dot { margin: 0 4px; color: #c4c4c4; }

.disc-composer { margin-bottom: 6px; }
.disc-composer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px;
}
.disc-composer-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.disc-composer-meta { min-width: 0; }
.disc-composer-name { font-size: .86rem; font-weight: 600; color: #111; line-height: 1.25; } /* = .sidebar-sublink */
.disc-composer-sub { font-size: .82rem; color: #6b7280; line-height: 1.3; margin-top: 1px; }
.disc-attach-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: #6b7280; cursor: pointer; font-size: .8rem; user-select: none; white-space: nowrap;
  padding: 3px 6px; border-radius: 6px;
}
.disc-attach-btn:hover { color: #E30613; background: #fff5f5; }
.disc-attach-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  line-height: 0;
}
.disc-attach-ico svg {
  width: 14px;
  height: 14px;
  display: block;
}

.disc-input-wrap { position: relative; }
.disc-textarea {
  min-height: 36px; /* mặc định thu gọn ~1–2 dòng */
  height: 36px;
  resize: vertical;
  width: 100%;
  border-radius: 10px;
  border-color: #e5e5e5;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: var(--font-size-content);
}
.disc-textarea:focus {
  border-color: #f0b4b8; box-shadow: 0 0 0 3px rgba(227,6,19,.08);
}
.disc-file-preview {
  font-size: .82rem; margin-top: 8px; color: #555;
  padding: 8px 10px; background: #fafafa; border: 1px dashed #e5e5e5; border-radius: 8px;
}
.disc-composer-actions { margin-top: 10px; display: flex; justify-content: flex-end; }

/* Mention picker — giống kiểu Người theo dõi */
.disc-mention-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  background: #fff; border: 1px solid #e5e5e5; border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.08); overflow: hidden;
}
.disc-mention-search { padding: 8px; border-bottom: 1px solid #f0f0f0; }
.disc-mention-search .form-control { min-height: 36px; }
.disc-mention-list { max-height: 260px; overflow: auto; padding: 6px; }
.disc-mention-empty { padding: 12px; color: #9ca3af; font-size: .86rem; }
.disc-mention-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.disc-mention-opt:hover, .disc-mention-opt.is-active { background: #f7f7f7; }
.disc-mention-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: #f3f4f6; color: #374151; font-weight: 700; font-size: .8rem;
}
.disc-mention-opt-text {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0; min-width: 0;
  font-size: .9rem; color: #333; line-height: 1.35;
}
.disc-mention-tag { color: #6b7280; font-weight: 600; }
.disc-mention-name { color: #111; font-weight: 600; }
.disc-mention-title { color: #6b7280; }
.disc-mention-sep { margin: 0 6px; color: #d1d5db; }

.disc-list { display: flex; flex-direction: column; margin-top: 8px; }
.disc-item {
  border-top: 1px solid #f0f0f0; padding: 14px 8px;
  border-radius: 10px; outline: none; transition: background .12s ease;
}
.disc-item:first-child { border-top: 0; }
.disc-item:hover, .disc-item:focus-within, .disc-item.is-open { background: #fcfcfc; }
.disc-item-head { display: flex; gap: 10px; align-items: flex-start; }
.disc-item-meta { min-width: 0; }
.disc-item-name { font-size: .86rem; font-weight: 600; color: #111; line-height: 1.25; } /* = .sidebar-sublink */
.disc-item-sub { font-size: .8rem; color: #6b7280; margin-top: 2px; }
.disc-item-body { margin: 8px 0 0 42px; color: #222; line-height: 1.5; font-size: .86rem; }
.disc-tag {
  color: #b42318; background: #fff5f5; border-radius: 4px; padding: 0 3px; font-weight: 600;
}
.disc-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 42px; }
.disc-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border: 1px solid #e5e5e5; border-radius: 8px; color: #333;
  text-decoration: none; font-size: .86rem; background: #fff;
}
.disc-file:hover { border-color: #E30613; color: #E30613; }
.disc-img img {
  max-width: 168px; max-height: 120px; border-radius: 8px; border: 1px solid #eee; object-fit: cover;
  display: block;
}

/* Reactions: chỉ hiện khi hover / focus / tap */
.disc-react-bar {
  margin: 8px 0 0 42px; min-height: 28px; position: relative;
}
.disc-react-summary {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
}
.disc-react-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .8rem; color: #555; background: #f3f4f6;
  border-radius: 999px; padding: 2px 8px;
}
.disc-reacts {
  display: none;
}
/* Reaction bar: chỉ mở bằng .is-like-open (nút Thích) — xem block bên dưới */
.disc-item.is-like-open > .disc-react-summary {
  visibility: hidden;
}
.disc-react-form { margin: 0; }
.disc-react-btn {
  border: 0; background: transparent; border-radius: 999px;
  padding: 4px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: .95rem;
}
.disc-react-btn:hover { background: #f7f7f7; }
.disc-react-btn.is-mine { background: #fff5f5; }
.disc-react-count { font-size: .75rem; color: #555; font-weight: 600; }
.disc-empty { padding: 16px 4px 8px; font-size: .9rem; }

@media (max-width: 720px) {
  .disc-item-body, .disc-files, .disc-react-bar { margin-left: 0; }
  .disc-attach-btn span:last-child { display: none; }
}

/* Content history (Lịch sử nội dung phiếu) */
.show-hist { display: flex; flex-direction: column; gap: 10px; }
.show-hist-day {
  margin-top: 4px; padding-bottom: 6px; border-bottom: 1px solid #eee;
  font-size: .72rem; font-weight: 700; color: #111; text-transform: capitalize;
}
.show-hist-row { display: flex; gap: 10px; align-items: flex-start; }
.show-hist-body { min-width: 0; flex: 1; }
.show-hist-line { font-size: .78rem; line-height: 1.35; color: #333; }
.show-hist-target { margin-top: 2px; font-weight: 700; color: #111; font-size: .78rem; line-height: 1.35; }
.show-hist-meta { margin-top: 3px; font-size: .72rem; }

/* Progress approval comment */
.show-tl-comment {
  margin-top: 4px;
  color: #E30613;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.35;
}

/* History detail modal */
.show-hist-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.show-hist-detail-btn {
  border: 0; background: transparent; padding: 0;
  color: #6b7280; font-size: .72rem; cursor: pointer; text-decoration: underline;
}
.show-hist-detail-btn:hover { color: #E30613; }
body.show-act-modal-open {
  overflow: hidden;
  /* Bù scrollbar biến mất — tránh co/giãn layout khi mở modal */
  padding-right: var(--vpdt-scrollbar-comp, 0px);
}
.show-act-modal[hidden] { display: none !important; }
.show-act-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.show-act-modal-backdrop {
  position: absolute; inset: 0; background: rgba(17,17,17,.45);
}
.show-act-modal-panel {
  position: relative; z-index: 1; width: min(720px, 100%);
  max-height: min(86vh, 860px); overflow: auto;
  background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.22);
}
.show-act-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: #f3f4f6; border-bottom: 1px solid #e5e5e5;
}
.show-act-modal-head h3 {
  margin: 0; font-size: .9rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #333;
}
.show-act-modal-x {
  border: 0; background: transparent; font-size: 1.4rem; line-height: 1;
  color: #666; cursor: pointer; padding: 0 4px;
}
.show-act-modal-banner {
  padding: 12px 16px; background: #f8efe6; color: #3f2a1d; font-size: .9rem; line-height: 1.45;
}
.show-act-modal-banner strong { color: #8a5a2b; }
.show-act-modal-body { padding: 14px 16px 18px; }
.show-act-modal-f {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 12px 16px; border-top: 1px solid #eee; background: #fff;
}
.show-act-modal-panel { display: flex; flex-direction: column; overflow: hidden; }
.show-act-modal-panel > form { display: flex; flex-direction: column; min-height: 0; }
.show-act-modal-panel .show-act-modal-body { overflow: auto; flex: 1 1 auto; }
.show-act-modal-f .btn-std { width: 100%; }
.show-act-modal textarea.form-control { min-height: 96px; resize: vertical; }

/* Modal chuyển giai đoạn: cao ~2× modal ngắn; field full-width đồng bộ form-grid */
.show-act-modal.wf-transition-modal .show-act-modal-panel {
  width: min(720px, 100%);
  min-height: min(72vh, 640px);
  max-height: min(90vh, 900px);
}
.show-act-modal.wf-transition-modal .show-act-modal-body {
  min-height: 280px;
}
.show-act-modal.wf-transition-modal .form-grid {
  grid-template-columns: 1fr;
  width: 100%;
}
.show-act-modal.wf-transition-modal .form-grid > .field {
  width: 100%;
  max-width: none;
}
.show-act-modal.wf-transition-modal .form-control:not(.ts-wrapper),
.show-act-modal.wf-transition-modal .ts-wrapper,
.show-act-modal.wf-transition-modal .ts-wrapper.single .ts-control,
.show-act-modal.wf-transition-modal select:not(.tomselected) {
  width: 100% !important;
  max-width: none;
  box-sizing: border-box;
}
.show-act-modal.wf-transition-modal .form-control:not(textarea):not(.ts-wrapper),
.show-act-modal.wf-transition-modal .ts-wrapper.single .ts-control,
.show-act-modal.wf-transition-modal select:not(.tomselected) {
  min-height: 36px !important;
  height: 36px;
}
.show-act-modal.wf-transition-modal textarea.form-control {
  min-height: 88px !important;
  height: auto;
  width: 100%;
}

.hist-diff-field { margin-bottom: 16px; }
.hist-diff-label {
  color: #2f6b4f; font-weight: 800; font-size: .82rem;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px;
}
.hist-diff-cap {
  font-size: .75rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #555; margin: 0 0 6px;
}
.hist-diff-col { margin-bottom: 10px; }
.hist-diff-box {
  margin: 0; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fafafa; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; font-size: .9rem; line-height: 1.4; color: #111;
}

/* Show content more menu */
.show-content-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.show-content-title {
  margin: 0; color: #111; font-size: 1.35rem; line-height: 1.3; flex: 1 1 auto; min-width: 0;
}
.show-more { position: relative; flex: 0 0 auto; }
.show-more-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 0;
  background: transparent; color: #E30613; font-size: 1.35rem; font-weight: 700;
  line-height: 1; cursor: pointer; letter-spacing: 1px;
  box-shadow: none; appearance: none; -webkit-appearance: none;
}
.show-more-btn:hover,
.show-more-btn[aria-expanded="true"],
.show-more-btn:focus,
.show-more-btn:focus-visible {
  background: #fff5f5; border: 0; outline: none; box-shadow: none;
}
.show-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 280px; max-width: min(360px, 92vw); max-height: min(70vh, 520px);
  overflow: auto; padding: 6px;
  background: #fff; border: 1px solid #e5e5e5; border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.1);
}
.show-more-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 12px; border-radius: 8px;
  color: #222; font-size: .86rem; font-weight: 500; line-height: 1.35;
  font-family: inherit; text-decoration: none; cursor: pointer; box-sizing: border-box;
}
button.show-more-item,
a.show-more-item { font: inherit; font-size: .86rem; font-weight: 500; line-height: 1.35; }
.show-more-item:hover { background: #f7f7f7; color: #111; text-decoration: none; }
.show-more-item.danger { color: #b42318; }
.show-more-item.danger:hover { background: #fff1f2; }
.show-more-chev { color: #999; font-size: 1rem; line-height: 1; flex: 0 0 auto; }
.show-more-copy-label { font-size: inherit; font-weight: inherit; }
.show-more-form { margin: 0; }
.show-more-sep { height: 1px; background: #eee; margin: 4px 6px; }
.show-act-card { padding-top: 14px; }

/* ===== Smart select checkbox / separators (VPĐT) ===== */
.ts-dropdown .dropdown-input-wrap,
.ts-dropdown .ts-search-field {
  background: #f3f4f6;
}
.ts-dropdown .option {
  border-bottom: 1px dotted #e5e5e5;
}
.ts-dropdown .option:last-child {
  border-bottom: 0;
}
.ts-dropdown.plugin-checkbox_options .option,
.ts-dropdown .option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ts-dropdown.plugin-checkbox_options .option.selected,
.ts-dropdown.plugin-checkbox_options .option.active {
  background: #f7f7f7 !important;
  color: #111 !important;
}
.ts-dropdown.plugin-checkbox_options .option input[type="checkbox"],
.ts-wrapper.plugin-checkbox_options .option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #E30613;
}
.ts-control .item {
  border-radius: 6px;
}


/* ===== Time 24h (HH:mm) — không dùng input type=time (tránh SA/CH theo locale trình duyệt) ===== */
.input-time-24 {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  min-width: 6.5rem;
  text-align: left;
}
.input-time-24:invalid {
  border-color: #f3c1c1;
}


/* SLA on progress */
.show-tl-sla {
  margin-top: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: #374151;
}
.show-tl-sla.is-overdue {
  color: #b42318;
  font-weight: 700;
}

/* Tom Select nhân bản class form-control lên .ts-wrapper → bỏ viền ngoài, chỉ giữ 1 ô (.ts-control) */
.ts-wrapper.form-control,
.ts-wrapper.js-search-select,
.field > .ts-wrapper,
.form-panel .ts-wrapper {
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  height: auto !important;
  border-radius: 0 !important;
}
.ts-wrapper .ts-control {
  background: #fff !important;
}



/* File field — list full names + format icons (create/edit request) */
.vpdt-file-box {
  position: relative;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  box-sizing: border-box;
  min-height: 36px; /* = .form-grid .form-control = .btn-std */
}
.form-grid .vpdt-file-box { min-height: 36px; }
.vpdt-file-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-height: 36px;
  padding: 4px 0;
  box-sizing: border-box;
}
.vpdt-file-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid #8a8a8a;
  background: #f0f0f0;
  color: #111;
  border-radius: 4px;
  padding: 4px 10px;
  min-height: 26px;
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
}
.vpdt-file-pick:hover {
  color: #111;
  background: #e4e4e4;
  border-color: #6b6b6b;
}
.vpdt-file-pick:active {
  background: #dcdcdc;
}
.vpdt-file-hint {
  font-size: .86rem;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Ô file thật trong .vpdt-file-field luôn ẩn — UI dùng .vpdt-file-pick.
   Không dùng display:none (một số trình duyệt chặn input.click()). */
.vpdt-file-field input.vpdt-file-input,
.vpdt-file-field input[type="file"][hidden],
input.vpdt-file-input,
input[type="file"].vpdt-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
}

/* Native input[type=file] hiển thị (logo/avatar…) — không đụng .vpdt-file-input */
input[type="file"].form-control:not(.vpdt-file-input):not([hidden]),
.field > input[type="file"]:not(.vpdt-file-input):not([hidden]),
.logo-uploader-meta input[type="file"]:not([hidden]) {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-size: .86rem;
  line-height: 1.4;
}
input[type="file"].form-control:not(.vpdt-file-input):not([hidden])::file-selector-button,
.field > input[type="file"]:not(.vpdt-file-input):not([hidden])::file-selector-button,
.logo-uploader-meta input[type="file"]:not([hidden])::file-selector-button {
  margin-right: 10px;
  border: 1px solid #8a8a8a;
  background: #f0f0f0;
  color: #111;
  border-radius: 4px;
  padding: 4px 10px;
  min-height: 26px;
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
}
input[type="file"].form-control:not(.vpdt-file-input):not([hidden])::-webkit-file-upload-button,
.field > input[type="file"]:not(.vpdt-file-input):not([hidden])::-webkit-file-upload-button,
.logo-uploader-meta input[type="file"]:not([hidden])::-webkit-file-upload-button {
  margin-right: 10px;
  border: 1px solid #8a8a8a;
  background: #f0f0f0;
  color: #111;
  border-radius: 4px;
  padding: 4px 10px;
  min-height: 26px;
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
}
input[type="file"].form-control:not(.vpdt-file-input):not([hidden]):hover::file-selector-button,
.field > input[type="file"]:not(.vpdt-file-input):not([hidden]):hover::file-selector-button {
  background: #e4e4e4;
  border-color: #6b6b6b;
}

.vpdt-file-list {
  list-style: none; margin: 0; padding: 0 0 8px;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid #f0f0f0;
}
.vpdt-file-list:empty { display: none; margin: 0; padding: 0; border-top: 0; }
.vpdt-file-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 4px 2px; border: 0; border-radius: 0; background: transparent;
}
.vpdt-file-list:not(:empty) { margin-top: 0; padding-top: 8px; }
.vpdt-file-ico {
  width: 24px; height: 24px; border-radius: 5px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .58rem; font-weight: 800; letter-spacing: .02em; color: #fff;
}
.vpdt-file-ico.is-pdf { background: #E30613; }
.vpdt-file-ico.is-doc { background: #2563eb; }
.vpdt-file-ico.is-xls { background: #15803d; }
.vpdt-file-ico.is-ppt { background: #c2410c; }
.vpdt-file-ico.is-img { background: #7c3aed; }
.vpdt-file-ico.is-zip { background: #b45309; }
.vpdt-file-ico.is-file { background: #6b7280; }
.vpdt-file-name {
  flex: 1; min-width: 0; font-size: .86rem; color: #222; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vpdt-file-rm {
  border: 0; background: transparent; color: #999; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.vpdt-file-rm:hover { color: #E30613; background: #fff5f5; }
/* Menu ⋯ cuối dòng file — không bọc ô */
.vpdt-file-more-wrap { position: relative; flex: 0 0 auto; margin-left: auto; }
button.vpdt-file-more,
.vpdt-file-more {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  color: #6b7280; cursor: pointer;
  font-size: 1.35rem; font-weight: 700; letter-spacing: .08em;
  line-height: 1; padding: 0 2px !important;
  min-width: 0 !important; min-height: 0 !important;
  height: auto !important; width: auto !important;
  border-radius: 0 !important; margin: 0 !important;
  font-family: inherit; appearance: none; -webkit-appearance: none;
}
button.vpdt-file-more:hover, .vpdt-file-more:hover,
button.vpdt-file-more[aria-expanded="true"], .vpdt-file-more[aria-expanded="true"],
button.vpdt-file-more:focus, .vpdt-file-more:focus,
button.vpdt-file-more:focus-visible, .vpdt-file-more:focus-visible {
  color: #111; background: transparent !important; border: 0 !important;
  outline: none; box-shadow: none;
}
.vpdt-file-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60;
  min-width: 160px; padding: 4px;
  background: #fff; border: 1px solid #e5e5e5; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.vpdt-file-preview-b.is-office {
  background: #fff; align-items: stretch; justify-content: flex-start;
}
.vpdt-file-preview-html {
  padding: 16px 20px; overflow: auto; width: 100%;
  max-height: min(80vh, 820px); color: #111; font-size: .9rem; line-height: 1.45;
  box-sizing: border-box;
}
.vpdt-file-preview-html h3 { margin: 0 0 10px; font-size: .95rem; }
.vpdt-file-preview-html table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.vpdt-file-preview-html td, .vpdt-file-preview-html th {
  border: 1px solid #ccc; padding: 4px 8px; vertical-align: top;
}
.vpdt-file-preview-slide {
  border: 1px solid #e5e5e5; border-radius: 8px; padding: 12px 14px; margin: 0 0 10px; background: #fafafa;
}
.vpdt-file-preview-slide strong { display: block; margin-bottom: 6px; font-size: .82rem; color: #555; }


/* File preview (blob) — ảnh / PDF */
.vpdt-file-name.is-previewable {
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: none;
}
.vpdt-file-name.is-previewable:hover { text-decoration: underline; color: #E30613; }
.vpdt-file-ico.is-previewable { cursor: pointer; }
.vpdt-file-preview-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(17,17,17,.55);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.vpdt-file-preview-backdrop.open { display: flex; }
.vpdt-file-preview-modal {
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,.22);
  display: flex; flex-direction: column; overflow: hidden;
}
.vpdt-file-preview-h {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid #eee; background: #fafafa;
}
.vpdt-file-preview-h strong {
  font-size: .86rem; font-weight: 600; color: #111;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.vpdt-file-preview-x {
  border: 0; background: transparent; color: #888; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.vpdt-file-preview-x:hover { color: #E30613; }
.vpdt-file-preview-b {
  flex: 1; min-height: 0; background: #111; display: flex;
  align-items: center; justify-content: center; overflow: auto;
}
.vpdt-file-preview-b img {
  max-width: 100%; max-height: min(80vh, 820px); object-fit: contain;
  display: block;
}
.vpdt-file-preview-b iframe {
  width: 100%; height: min(80vh, 820px); border: 0; background: #fff;
}
.vpdt-file-preview-note {
  padding: 10px 14px; font-size: .82rem; color: #666; border-top: 1px solid #eee; background: #fff;
}


/* Table column width (weight) + sheet editor */
.form-table-wrap { overflow-x: auto; }
.form-table col.ft-col-idx,
.form-table col.ft-col-actions { width: 44px; }
.show-field-value .table-erp.form-table-weighted { table-layout: fixed; width: 100%; }
/* Platform + form-builder: Định nghĩa bảng dữ liệu */
.td-def { border:1px solid #e8e8e8; border-radius:10px; overflow:hidden; background:#fff; }
.td-def-head { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 14px; border-bottom:1px solid #eee; }
.td-def-head label { margin:0; font-weight:700; color:#222; }
.td-def-table { width:100%; border-collapse:collapse; font-size:.86rem; }
.td-def-table th {
  text-align:left; padding:8px 10px; background:#fafafa; color:#666;
  font-weight:600; border-bottom:1px solid #eee; white-space:nowrap;
  vertical-align:middle; line-height:1.3;
}
.td-def-table th .req { color:#E30613; }
.td-def-table th.td-width,
.td-def-table th.td-align,
.td-def-table th.td-check,
.td-def-table th.td-lock { padding:8px 4px; vertical-align:middle; }
.td-def-table th.td-check,
.td-def-table th.td-lock { text-align:center; }
.td-def-table td { padding:8px 10px; border-bottom:1px solid #f2f2f2; vertical-align:top; }
.td-def-table td.td-width,
.td-def-table td.td-align,
.td-def-table td.td-check,
.td-def-table td.td-lock,
.td-def-table td.td-acts { padding-left:4px; padding-right:4px; }
.td-def-table tr:last-child td { border-bottom:0; }
.td-def-table td.td-handle { width:24px; color:#bbb; cursor:grab; text-align:center; user-select:none; padding:18px 2px 8px; }
.td-def-table td.td-handle .td-grip { width:12px; height:18px; display:block; margin:0 auto; fill:currentColor; }
.td-def-table td.td-width { width:72px; vertical-align:top; }
.td-def-table td.td-width .form-control {
  width:100%; box-sizing:border-box; min-height:36px; height:36px;
  padding:8px 6px; font-size:var(--font-size-content);
}
.td-def-table td.td-width .td-width-hint { display:block; margin-top:4px; line-height:1.2; }
.td-def-table td.td-align { width:102px; vertical-align:top; }
.td-def-table td.td-align .td-align-group {
  height:36px; box-sizing:border-box; display:inline-flex; align-items:center;
  border:1px solid #cfcfcf; border-radius:6px; padding:2px; background:#fff;
}
.td-def-table td.td-align .td-align-btn {
  width:30px; height:30px; border:0; background:transparent; color:#555;
  border-radius:4px; cursor:pointer; display:inline-flex;
  align-items:center; justify-content:center; padding:0;
}
.td-def-table td.td-align .td-align-btn:hover { background:#f3f3f3; color:#111; }
.td-def-table td.td-align .td-align-btn.is-on { background:#fff5f5; color:#E30613; }
.td-def-table td.td-check { width:52px; text-align:center; vertical-align:top; padding-top:18px; }
.td-def-table td.td-acts { width:64px; text-align:right; white-space:nowrap; vertical-align:top; padding-top:10px; }
.td-def-table td.td-acts .td-ico {
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:36px; box-sizing:border-box; padding:4px 2px;
}
.td-def-table input[type=checkbox] { width:16px; height:16px; accent-color:#E30613; }
.td-width-hint { font-size:.75rem; color:#999; white-space:nowrap; }
.td-def-foot { padding:10px 12px; border-top:1px solid #eee; }
.td-def-add { border:0; background:transparent; color:#E30613; font-weight:700; cursor:pointer; padding:0; }
.td-def-add:hover { text-decoration:underline; }
.td-ico { border:0; background:transparent; color:#888; cursor:pointer; padding:4px 6px; border-radius:6px; }
.td-ico svg { width:15px; height:15px; display:block; }
.td-ico:hover { background:#f3f3f3; color:#222; }
.td-ico.danger:hover { background:#fff1f2; color:#E30613; }
.td-pair { display:grid; grid-template-columns:1fr 1fr; gap:8px; align-items:start; }
.td-extra { margin-top:8px; }
.td-extra .form-control { width:100%; }
.td-extra-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.td-extra-grid .span2 { grid-column:1 / -1; }
.td-def-tools { display: inline-flex; gap: 4px; align-items: center; }
.td-view-btn {
  border: 1px solid #e5e5e5; background: #fff; color: #666;
  width: 32px; height: 28px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1; padding: 0;
}
.td-view-btn:hover { border-color: #ccc; color: #111; }
.td-view-btn.is-on { border-color: #E30613; color: #E30613; background: #fff5f5; }
.td-view-sheet { padding: 10px 12px 12px; }
.td-sheet-hint { font-size: .78rem; color: #888; margin: 0 0 8px; }
.td-sheet-wrap { overflow: auto; border: 1px solid #e5e5e5; border-radius: 8px; background: #fff; }
.td-sheet { border-collapse: collapse; table-layout: fixed; margin: 0; background: #fff; }
.td-sheet th, .td-sheet td {
  border: 1px solid #ddd; padding: 8px 10px; vertical-align: middle;
  font-size: .86rem; background: #fff; position: relative;
}
.td-sheet thead th {
  background: #ececec; font-weight: 700; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .02em; text-align: center; user-select: none;
}
.td-sheet .td-sheet-meta { display: block; margin-top: 4px; font-size: .72rem; font-weight: 600; color: #666; text-transform: none; letter-spacing: 0; }
.td-sheet td { color: #999; font-size: .82rem; height: 40px; }
.td-col-resizer {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 2;
}
.td-col-resizer:hover, .td-col-resizer.is-drag { background: rgba(227,6,19,.25); }
.td-width-field { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.td-width-field label { margin: 0; font-size: .78rem; font-weight: 600; color: #666; white-space: nowrap; }
.td-width-field input[type=number] {
  width: 72px; min-height: 36px; padding: 4px 8px; font-size: .86rem;
}


/* Table column text align (admin config → runtime) */
.td-align-group {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid #e5e5e5; border-radius: 8px; padding: 2px; background: #fff;
}
.td-align-btn {
  width: 30px; height: 28px; border: 0; background: transparent; color: #555;
  border-radius: 6px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; padding: 0;
}
.td-align-btn:hover { background: #f3f3f3; color: #111; }
.td-align-btn.is-on { background: #fff5f5; color: #E30613; }
.td-align-btn svg { width: 16px; height: 16px; display: block; }
.td-width-field { gap: 10px; }
.form-table th.ta-left, .form-table thead th.ta-left, .form-table tbody td.ta-left, .form-table tfoot td.ta-left,
.show-field-value .table-erp th.ta-left, .show-field-value .table-erp td.ta-left { text-align: left !important; }
.form-table th.ta-center, .form-table thead th.ta-center, .form-table tbody td.ta-center, .form-table tfoot td.ta-center,
.show-field-value .table-erp th.ta-center, .show-field-value .table-erp td.ta-center { text-align: center !important; }
.form-table th.ta-right, .form-table thead th.ta-right, .form-table tbody td.ta-right, .form-table tfoot td.ta-right,
.show-field-value .table-erp th.ta-right, .show-field-value .table-erp td.ta-right { text-align: right !important; }
.form-table td.ta-left .form-control,
.form-table td.ta-left .ts-control,
.form-table td.ta-center .form-control,
.form-table td.ta-center .ts-control,
.form-table td.ta-right .form-control,
.form-table td.ta-right .ts-control { text-align: inherit; }
.form-table td.ta-center .ts-control { justify-content: center; }
.form-table td.ta-right .ts-control { justify-content: flex-end; }


/* Show request table: keep # index column fixed (not fed by data col widths) */
.show-field-value .table-erp col.ft-col-idx { width: 44px; min-width: 44px; max-width: 44px; }
.show-field-value .table-erp thead th:first-child,
.show-field-value .table-erp tbody td:first-child,
.show-field-value .table-erp tfoot td:first-child {
  width: 44px; min-width: 44px; max-width: 56px;
  text-align: center; white-space: nowrap;
}

/* Total footer / total columns: default right */
.form-table tfoot td.ft-total,
.show-field-value .table-erp tfoot td.ft-total,
.show-field-value .table-erp tfoot td.is-total {
  text-align: right !important;
}



/* Rich text field (TinyMCE) — khung khóa 78px, không overlay, không ẩn/hiện */
.vpdt-rt-box {
  position: relative;
  box-sizing: border-box;
  height: var(--vpdt-richtext-height, 78px);
  min-height: var(--vpdt-richtext-height, 78px);
  max-height: var(--vpdt-richtext-height, 78px);
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background-color: #fff;
  background-image: linear-gradient(#eee, #eee);
  background-size: 100% 1px;
  background-position: 0 38px;
  background-repeat: no-repeat;
}
.vpdt-rt-box:has(.tox-tinymce) {
  background-image: none;
}
.vpdt-rt-box .tox-tinymce {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
}
.vpdt-rt-box textarea.form-control.js-richtext {
  height: 100%;
  min-height: 100%;
  resize: none;
  box-sizing: border-box;
  border: 0 !important;
  opacity: 0;
}
.vpdt-rt-box:has(.tox-tinymce) > textarea.js-richtext {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
}
.vpdt-rt-box .tox-toolbar__primary {
  overflow-x: hidden !important; /* không thanh kéo ngang dưới icon */
}

/* Toolbar gọn hơn — không ép kích thước SVG (sẽ vỡ icon sprite TinyMCE) */
.vpdt-rt-box .tox .tox-tbtn {
  width: 28px !important;
  height: 28px !important;
  margin: 1px 0 !important;
}
.vpdt-rt-box .tox .tox-tbtn--select {
  width: auto !important;
  min-width: 5.75rem !important;
  padding: 0 6px !important;
  font-size: 12px !important;
}
.vpdt-rt-box .tox .tox-listboxfield .tox-listbox--select {
  min-height: 28px !important;
  font-size: 12px !important;
}
.vpdt-rt-box .tox .tox-tbtn .tox-icon {
  transform: scale(0.78);
  transform-origin: center center;
}
.vpdt-rt-box .tox-statusbar { display: none !important; }
/* Vùng gõ = 36px; khóa cả wrap để TinyMCE không dựng cao rồi co — hết nháy lúc reload */
.vpdt-rt-box .tox-editor-header,
.vpdt-rt-box .tox .tox-editor-header {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  overflow: hidden !important;
  box-sizing: border-box;
  border: 0 !important;
  border-bottom: 1px solid #eee !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
}
.vpdt-rt-box .tox-editor-container {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
}
.vpdt-rt-box .tox-sidebar-wrap {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  border: 0 !important;
}
.vpdt-rt-box .tox-edit-area {
  flex: 1 1 auto !important;
  position: relative !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  border: 0 !important;
}
.vpdt-rt-box .tox-edit-area__iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  border: 0 !important;
}

.vpdt-richtext-view { font-family: var(--font); font-size: var(--font-size-content); font-weight: 400; line-height: 1.45; word-break: break-word; color: #111; }
.vpdt-richtext-view p { margin: 0 0 .6em; }
.vpdt-richtext-view h1, .vpdt-richtext-view h2, .vpdt-richtext-view h3 { margin: .8em 0 .4em; line-height: 1.25; }
.vpdt-richtext-view ul, .vpdt-richtext-view ol { margin: 0 0 .6em 1.25em; padding: 0; }
.vpdt-richtext-view table { width: 100%; border-collapse: collapse; margin: .6em 0; }
.vpdt-richtext-view th, .vpdt-richtext-view td { border: 1px solid #ccc; padding: 6px 8px; vertical-align: top; }
.vpdt-richtext-view img { max-width: 100%; height: auto; }
.vpdt-richtext-view a { color: #E30613; }

/* Platform · Kiểu trường: cột Nhãn rộng gấp ~2 lần so với mặc định hẹp */
.platform-field-types-table .col-label {
  width: 24%;
  min-width: 16rem; /* ~2× cột nhãn trước (~8rem) */
  white-space: nowrap;
}
.platform-field-types-table .col-code {
  width: 7rem;
  white-space: nowrap;
}


/* ERP list: clickable primary name */
/* Tên chính trong list ERP = cỡ chữ sidebar submenu (.sidebar-sublink) */
a.table-name-link,
.list-panel .table-erp a.table-name-link,
.table-erp a.table-name-link {
  color: #111;
  font-weight: 600;
  font-size: var(--font-size-content); /* chuẩn nội dung --font-size-content */
  line-height: 1.35;
  text-decoration: none;
}
a.table-name-link:hover,
.list-panel .table-erp a.table-name-link:hover,
.table-erp a.table-name-link:hover {
  color: #E30613;
  text-decoration: underline;
}


/* Quy trình — Kanban board (phase 1 shell) */
.wf-kanban {
  display: flex;
  gap: var(--block-gap, 4px); /* khe giữa cột Kanban */
  align-items: stretch;
  overflow-x: auto;
  padding: 4px 2px var(--block-gap, 4px);
  min-height: 360px;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}
.wf-col {
  flex: 0 0 260px;
  max-width: 280px;
  background: #f4f4f5;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  overflow: visible;
}
.wf-col-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e8e8e8;
  background: #eee;
  border-radius: 10px 10px 0 0;
}
.wf-col-h strong { font-size: .86rem; color: #222; font-weight: 700; }
.wf-col-count {
  font-size: .75rem;
  font-weight: 700;
  color: #666;
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
}
.wf-col-body { padding: 10px; flex: 1; display: flex; flex-direction: column; gap: var(--block-gap, 4px); }
.wf-col-empty { font-size: .82rem; padding: 12px 4px; text-align: center; }
.wf-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .86rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.wf-board-toolbar .list-toolbar { align-items: center; }


/* Quy trình Kanban — kiểu Base (cột bước + terminal) */
.wf-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--block-gap, 4px);
}
.wf-tpl-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.wf-tpl-card:hover { border-color: #f3c1c1; background: #fffafa; }
.wf-tpl-card strong { font-size: .92rem; color: #111; }
.wf-process-tabs { margin-top: 0; }
.wf-process-tabs a.is-disabled { color: #bbb; cursor: default; pointer-events: none; }
.wf-kanban--process {
  padding-top: 8px;
  /* Cuộn ngang chỉ trong khối cột; mép trái app-main/sidebar chặn — không kéo cả trang */
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  min-width: 0;
}
.wf-col { background: #f7f7f8; }
.wf-col-h {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 10px 12px 8px;
}
.wf-col-h-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wf-col-h-meta, .wf-col-h-sla { font-size: .75rem; line-height: 1.3; }
.wf-col-progress {
  height: 3px;
  border-radius: 999px;
  background: #d4d4d8;
  overflow: hidden;
  margin: 2px 0 4px;
}
.wf-col-progress-fill {
  height: 100%;
  width: 0;
  background: #a1a1aa;
  border-radius: 999px;
  transition: width .2s ease;
}
.wf-col--success .wf-col-progress { background: #bbf7d0; }
.wf-col--success .wf-col-progress-fill { background: #16a34a; }
.wf-col--fail .wf-col-progress { background: #fecdd3; }
.wf-col--fail .wf-col-progress-fill { background: #e11d48; }
.wf-col-h-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 1.1em;
}
.wf-col-h-stats .wf-col-h-meta { flex: 1; min-width: 0; }
.wf-col-h-stats .wf-col-h-sla {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #666;
}
.wf-col-menu { color: #999; font-size: .75rem; }
.wf-col--success .wf-col-h {
  background: #dcfce7;
  border-bottom-color: #bbf7d0;
}
.wf-col--success .wf-col-h strong { color: #166534; }
.wf-col--fail .wf-col-h {
  background: #ffe4e6;
  border-bottom-color: #fecdd3;
}
.wf-col--fail .wf-col-h strong { color: #9f1239; }
.wf-col--normal .wf-col-h { background: #ececec; }

/* module-tabs actions: nút btn-std không bị style tab */
.module-tabs-actions a.btn-std,
.account-tabs-actions a.btn-std {
  color: #fff !important;
  background: #E30613;
  border-bottom: 0 !important;
  margin-bottom: 0;
  padding: 0 16px;
  height: 36px;
  min-width: 112px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9rem;
  line-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
}
.module-tabs-actions a.btn-std:hover,
.account-tabs-actions a.btn-std:hover {
  color: #fff !important;
  filter: brightness(.96);
  background: #E30613;
}
.module-tabs-actions a.btn-std-primary,
.account-tabs-actions a.btn-std-primary {
  background: #E30613;
}
.wf-card {
  display: block;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 8px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.wf-card:hover { border-color: #f3c1c1; }
.wf-card strong { display:block; font-size:.86rem; color:#111; margin-bottom:4px; }
.wf-card .muted { font-size:.75rem; }


/* Danh sách quy trình theo nhóm */
.wf-group-section { margin-bottom: 22px; }
.wf-group-section:last-child { margin-bottom: 0; }
.wf-group-title {
  margin: 0 0 10px;
  font-size: .92rem;
  font-weight: 700;
  color: #111;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}


/* Menu ▾ giai đoạn Kanban — kiểu Base */
.wf-col-h { overflow: visible; position: relative; z-index: 1; }
.wf-col-menu-wrap { position: static; flex: 0 0 auto; z-index: 2; }
.wf-col.is-menu-open { z-index: 50; }
.wf-col-menu-wrap.is-open { z-index: 50; }
.wf-col-menu-btn {
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  line-height: 1;
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.wf-col-menu-btn:hover,
.wf-col-menu-wrap.is-open .wf-col-menu-btn {
  background: rgba(0,0,0,.07);
  color: #111;
}
.wf-col-h .wf-col-dd {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% - 2px);
  z-index: 60;
  width: auto; /* bằng bề ngang header bước */
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  padding: 4px 0;
  text-align: left;
}
.wf-col-dd-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: .86rem;
  font-weight: 400;
  color: #222;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.wf-col-dd-item:hover {
  background: #f3f4f6;
}
.wf-col-dd-item.is-danger {
  color: #E30613;
}
.wf-col-dd-item.is-danger:hover {
  background: #fff1f2;
}
.wf-col-dd-item.is-muted {
  color: #b0b0b0;
  cursor: default;
}
.wf-col-dd-item.is-muted:hover {
  background: transparent;
}
.wf-col-dd-sep {
  height: 1px;
  background: #ebebeb;
  margin: 4px 0;
}
.wf-col-dd-label {
  padding: 8px 14px 2px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9ca3af;
}

/* Modal chỉnh sửa giai đoạn quy trình */
.wf-stage-modal .show-act-modal-panel { width: min(560px, 100%); }
.wf-stage-form { display: flex; flex-direction: column; gap: 0; }
.wf-stage-row {
  padding: 12px 0;
  border-bottom: 1px solid #ececec;
}
.wf-stage-row:last-child { border-bottom: 0; }
.wf-stage-row > label {
  display: block;
  margin: 0 0 8px;
  font-size: .86rem;
  font-weight: 600;
  color: #333;
}
.wf-stage-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  color: #888;
  font-size: .92rem;
}
.wf-stage-check {
  color: #9ca3af;
  font-weight: 700;
}
.wf-stage-time {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.wf-stage-hours {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}
.wf-stage-hours span {
  color: #666;
  font-weight: 600;
  font-size: .9rem;
}

.wf-stage-cond-meta {
  font-size: .86rem;
  color: #9ca3af;
  margin-bottom: 6px;
}
.wf-stage-cond-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #2563eb;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}
.wf-stage-cond-link:hover { text-decoration: underline; }
.wf-stage-cond-link span { font-size: 1rem; line-height: 1; }


/* Kanban task card — 4 rows + tones */
.wf-col-cards { display:flex; flex-direction:column; gap:var(--block-gap, 4px); min-height:24px; flex:1; }
.wf-card {
  display:flex; flex-direction:column; gap:6px;
  background:#fff; border:1px solid #e5e5e5; border-radius:8px;
  padding:10px 12px; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.04);
  text-decoration:none; color:inherit;
}
.wf-card.sortable-chosen, .wf-card.sortable-drag { cursor:grabbing; }
.wf-card:active { cursor:grabbing; }
.wf-card-ghost { opacity:.45; }
.wf-card-drag { box-shadow:0 8px 20px rgba(0,0,0,.12); }
.wf-card-title {
  display:block; font-size:.86rem; font-weight:700; color:#111;
  line-height:1.35; margin:0;
}
.wf-card-fields {
  font-size:.75rem; color:#6b7280; line-height:1.4;
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  overflow:hidden; min-height:2.6em;
}
.wf-card-fields:empty { display:none; min-height:0; }
.wf-card-foot {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  margin-top:2px;
}
.wf-card-assignee {
  display:inline-flex; align-items:center; gap:6px; min-width:0;
  font-size:.78rem; font-weight:400; color:#222;
}
.wf-card-assignee span {
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:9.5rem;
}
.wf-card-avatar {
  width:22px; height:22px; border-radius:50%; object-fit:cover;
  background:#f8d7da; flex:0 0 auto;
}
.wf-card-due { font-size:.75rem; font-weight:400; white-space:nowrap; }
.wf-card-due--ok { color:#16a34a; }
.wf-card-due--over { color:#b42318; }
.wf-card-due--muted { color:#888; font-weight:400; }
.wf-card--ok { background:#fff; }
.wf-card--done {
  background:#ecfdf3; border-color:#bbf7d0;
}
.wf-card--danger {
  background:#fff1f2; border-color:#fecdd3;
}
.wf-card--danger .wf-card-due { color:#b42318; }


/* Workflow stage progress (Tiến trình của các giai đoạn) */
.show-stg { display:flex; flex-direction:column; gap:10px; }
.show-stg-total-label { font-size:.78rem; color:#555; text-align:right; margin-bottom:6px; }
.show-stg-total-label strong { color:#111; font-weight:700; }
.show-stg-total-bar {
  height:6px; border-radius:999px; background:#e5e7eb; overflow:hidden;
}
.show-stg-total-fill {
  height:100%; background:#22c55e; border-radius:999px; min-width:0;
}
.show-stg-heading {
  margin-top:4px; padding-bottom:8px; border-bottom:1px solid #eee;
  font-size:.78rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:#111;
}
.show-stg-list { display:flex; flex-direction:column; }
.show-stg-item {
  padding:12px 0; border-bottom:1px solid #f0f0f0;
}
.show-stg-item:last-child { border-bottom:0; padding-bottom:2px; }
.show-stg-row1 {
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
}
.show-stg-left { display:flex; align-items:flex-start; gap:8px; min-width:0; }
.show-stg-num {
  width:20px; height:20px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:.7rem; font-weight:700; color:#fff; background:#9ca3af; flex:0 0 auto; margin-top:1px;
}
.show-stg-item--done .show-stg-num { background:#16a34a; }
.show-stg-item--cur .show-stg-num { background:#38bdf8; }
.show-stg-item--fail .show-stg-num { background:#e11d48; color:#fff; }
.show-stg-item--fail .show-stg-name { color:#9f1239; }
.show-stg-item--skip .show-stg-num { background:#d1d5db; color:#fff; }
.show-stg-item--todo .show-stg-num { background:#e5e7eb; color:#6b7280; }
.show-stg-name { font-size:.86rem; font-weight:700; color:#111; line-height:1.3; }
.show-stg-item--skip .show-stg-name { color:#6b7280; }
.show-stg-right { font-size:.75rem; white-space:nowrap; padding-top:2px; }
.show-stg-bar {
  margin-top:8px; height:3px; border-radius:999px; background:#e5e7eb; overflow:hidden;
}
.show-stg-bar-fill { height:100%; width:0; border-radius:999px; background:#22c55e; }
.show-stg-bar--over .show-stg-bar-fill { background:#e11d48; width:100% !important; }
.show-stg-bar--fail .show-stg-bar-fill { background:#e11d48; width:100% !important; }
.show-stg-bar--ok .show-stg-bar-fill { background:#22c55e; }
.show-stg-bar--empty .show-stg-bar-fill { background:transparent; }
.show-stg-metrics {
  display:flex; justify-content:space-between; gap:8px;
  margin-top:6px; font-size:.75rem; color:#6b7280;
}
.show-stg-metrics strong { color:#111; font-weight:700; }
.show-stg-actor {
  display:inline-flex; align-items:center; gap:6px;
  margin-top:8px; font-size:.78rem; font-weight:400; color:#222;
}
.show-stg-avatar {
  width:20px; height:20px; border-radius:50%; object-fit:cover; background:#f3f4f6; flex:0 0 auto;
}


/* Workflow task info (thay Người duyệt) */
.show-taskinfo { display:flex; flex-direction:column; gap:2px; }
.show-taskinfo-title {
  display:none; /* tiêu đề đã ở summary details */
}
.show-taskinfo-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.show-taskinfo-row {
  display:flex; align-items:flex-start; gap:8px;
  font-size:.82rem; color:#374151; line-height:1.4;
}
.show-taskinfo-ico {
  width:16px; flex:0 0 16px; color:#9ca3af;
  display:inline-flex; align-items:center; justify-content:center;
  margin-top:2px; font-size:.78rem; font-weight:600;
}
.show-taskinfo-ico svg { display:block; }
.show-taskinfo-text { min-width:0; flex:1; }
.show-taskinfo-text strong { color:#111; font-weight:700; }


/* Quy trình — khối «Mô tả nhiệm vụ» (cùng vùng Thông tin khi nhập mới) */
.wf-task-desc-block .wf-task-desc-body {
  line-height: 1.5; color: #222;
}
.wf-task-desc-block .wf-task-desc-body p { margin: 0 0 .6em; }
.wf-task-desc-block .wf-task-desc-body p:last-child { margin-bottom: 0; }
.wf-task-desc-block .wf-task-desc-files.has-desc {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}


/* Stage advanced options */
.wf-adv-checks { display: flex; flex-direction: column; gap: 10px; }
.wf-adv-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .86rem;
  font-weight: 500;
  color: #222;
  line-height: 1.35;
  cursor: pointer;
}
.wf-adv-check input {
  margin-top: 3px;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: #E30613;
}
.wf-adv-hint {
  margin: -4px 0 8px;
  font-size: .78rem;
  line-height: 1.3;
}

/* Quy trình Kanban — khung cố định theo viewport; cuộn dọc trong cột thẻ */
.app-frame:has(.wf-kanban--process) {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.app-frame:has(.wf-kanban--process) .app-main {
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}
.app-frame:has(.wf-kanban--process) .app-header {
  flex: 0 0 auto;
}
.app-frame:has(.wf-kanban--process) .app-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-frame:has(.wf-kanban--process) .app-content > .module-tabs,
.app-frame:has(.wf-kanban--process) .app-content > .account-tabs,
.app-frame:has(.wf-kanban--process) .app-content > .alert,
.app-frame:has(.wf-kanban--process) .app-content > .wf-note,
.app-frame:has(.wf-kanban--process) .app-content > .errors,
.app-frame:has(.wf-kanban--process) .app-content > .layout-tabs,
.app-frame:has(.wf-kanban--process) .app-content > [class*="layout-tabs"] {
  flex: 0 0 auto;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: 100%;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  box-sizing: border-box;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process > .wf-col {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  /* header menu ▾ vẫn absolute; chỉ vùng thẻ cuộn */
  overflow: visible;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process .wf-col-h {
  flex: 0 0 auto;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process .wf-col-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process .wf-col-cards {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.app-frame:has(.wf-kanban--process) .wf-kanban--process .wf-card:last-child {
  margin-bottom: 2px;
}

/* Menu: chỉnh sửa toàn bộ dữ liệu phiếu */
#wf-menu-custom-modal .show-act-modal-panel {
  width: min(920px, 96vw);
  max-height: min(90vh, 880px);
}
#wf-menu-custom-modal .show-act-modal-body {
  max-height: min(68vh, 640px);
}

/* Discussion actions: Bình luận + Thích */
.disc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0 42px;
  min-height: 28px;
  position: relative;
}
.disc-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #6b7280;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.2;
}
.disc-action:hover { color: #111; }
.disc-action-label { font-weight: 700; color: #4b5563; }
.disc-action-like .disc-action-label { font-weight: 500; color: #6b7280; }
.disc-action-like.is-mine .disc-action-label,
.disc-action-like.is-mine .disc-action-thumb { color: #E30613; }
.disc-action-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: #6b7280;
  background: #fff;
  box-sizing: border-box;
}
.disc-action-dot { color: #c4c4c4; font-size: .9rem; line-height: 1; }
.disc-action-thumb { display: inline-flex; color: #9ca3af; line-height: 0; }

.disc-like-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.disc-item .disc-react-summary {
  margin: 8px 0 0 42px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
/* Popup cảm xúc gần nút Thích — chỉ đúng dòng (không lan reply con) */
.disc-item > .disc-actions .disc-reacts {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  margin: 0;
  gap: 2px;
  flex-wrap: nowrap;
  align-items: center;
  padding: 4px 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  white-space: nowrap;
}
/* Chỉ hiện khi CHÍNH item đó có .is-like-open (không dùng descendant làm mở hết con) */
.disc-item.is-like-open > .disc-actions .disc-reacts {
  display: inline-flex;
}
.disc-react-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 4px 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 1.15rem;
  line-height: 1;
  transition: transform .12s ease;
}
.disc-react-btn:hover {
  background: #f3f4f6;
  transform: scale(1.18);
}
.disc-react-btn.is-mine { background: #fff5f5; }
.disc-react-count { font-size: .72rem; color: #555; font-weight: 600; }

.disc-replies {
  margin: 8px 0 0 42px;
  padding-left: 12px;
  border-left: 2px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.disc-item--reply {
  margin-left: 0;
  padding: 10px 0;
  border-top: 1px solid #f3f4f6;
}
.disc-item--reply .disc-item-body,
.disc-item--reply .disc-files,
.disc-item--reply .disc-actions,
.disc-item--reply .disc-react-summary {
  margin-left: 42px;
}
.disc-item--reply .disc-reacts {
  margin-left: 0;
}
.disc-reply-box {
  margin: 8px 0 4px 42px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
@media (max-width: 720px) {
  .disc-actions,
  .disc-item .disc-react-summary,
  .disc-replies,
  .disc-reply-box,
  .disc-item--reply .disc-item-body,
  .disc-item--reply .disc-files,
  .disc-item--reply .disc-actions,
  .disc-item--reply .disc-react-summary { margin-left: 0; }
}

/* Discussion send — hình 2 compact */
.disc-compose-shell {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.disc-compose-shell .disc-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
.disc-compose-shell .disc-textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  height: 36px;
  max-height: 120px;
  resize: none;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  line-height: 1.35;
  font-size: var(--font-size-content);
}
.disc-compose-shell .disc-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.disc-compose-shell .disc-send-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d1d5db;
  color: #fff;
  cursor: not-allowed;
  transition: background .15s ease, transform .1s ease;
  padding: 0;
}
.disc-compose-shell .disc-send-btn.is-ready {
  background: #2563eb;
  cursor: pointer;
}
.disc-compose-shell .disc-send-btn.is-ready:hover {
  background: #1d4ed8;
}
.disc-compose-shell .disc-send-btn:disabled {
  background: #d1d5db;
  color: #fff;
  cursor: not-allowed;
  opacity: 1;
}
.disc-compose-shell .disc-send-btn svg { display: block; width: 16px; height: 16px; }
.disc-reply-box .disc-compose-shell { margin-top: 2px; }

/* Process settings — Nhảy bước theo điều kiện */
.wf-jump-block {
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px;
}
.wf-jump-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.wf-jump-title {
  font-size: .86rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}
.wf-jump-sub {
  margin-top: 2px;
  font-size: .82rem;
  color: #888;
  line-height: 1.4;
}
.wf-jump-edit {
  border: 0;
  background: transparent;
  color: #2f6fed;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.wf-jump-edit:hover { text-decoration: underline; }
.wf-jump-meta { margin-top: 8px; font-size: .82rem; }

.wf-jump-setup { margin-top: 12px; }
.wf-jump-setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wf-jump-edit:disabled {
  opacity: .45;
  cursor: not-allowed;
  text-decoration: none;
}
.wf-jump-from label { margin-bottom: 6px; }

/* ===== Workflow List View (Danh sách) — Base-like row tones ===== */
.wf-list-panel { margin-top: 4px; }
.wf-list-toolbar { align-items: center; gap: 12px; flex-wrap: wrap; }
.wf-list-filters {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end;
}
.wf-list-filters a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; font-size: .78rem; font-weight: 600;
  color: #555; text-decoration: none; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .02em;
}
.wf-list-filters a span {
  font-weight: 700; color: #888; font-variant-numeric: tabular-nums;
}
.wf-list-filters a:hover { color: #111; background: #f5f5f5; }
.wf-list-filters a.is-active {
  color: #fff; background: #16a34a;
}
.wf-list-filters a.is-active span { color: #fff; }

.wf-list-scroll {
  border: 0; border-radius: 0; overflow: auto;
  max-height: calc(100vh - 220px);
}
.wf-list-table { margin: 0; }
.wf-list-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #ececec !important;
  text-transform: uppercase; font-size: .72rem; letter-spacing: .03em;
}
.wf-list-table tbody tr.wf-list-row { cursor: pointer; }
.wf-list-table tbody tr.wf-list-row:nth-child(even) { background: transparent; }
.wf-list-table tbody tr.wf-list-row:hover { background: #fff5f5; }
.wf-list-row--done { background: #ecfdf3 !important; }
.wf-list-row--done:hover { background: #dcfce7 !important; }
.wf-list-row--fail { background: #fff1f2 !important; }
.wf-list-row--fail:hover { background: #ffe4e6 !important; }
.wf-list-row--overdue { background: #fff !important; }

.wf-list-title {
  display: block; font-weight: 700; color: #111; text-decoration: none; line-height: 1.35;
}
.wf-list-title:hover { color: #E30613; text-decoration: underline; }
.wf-list-sub { font-size: .78rem; margin-top: 3px; line-height: 1.35; }

.wf-list-col-task { min-width: 240px; }
.wf-list-col-stage { width: 200px; min-width: 170px; }
.wf-list-col-status { width: 120px; }
.wf-list-col-assignee { width: 180px; }
.wf-list-col-due { width: 130px; white-space: nowrap; }
.wf-list-col-due.is-overdue {
  background: #b91c1c; color: #fff; font-weight: 700;
}

.wf-list-segs {
  display: flex; gap: 2px; height: 8px; margin-bottom: 6px;
}
.wf-list-seg {
  flex: 1 1 0; min-width: 6px; height: 100%;
  background: #e5e7eb; border-radius: 1px;
}
.wf-list-seg--done { background: #22c55e; }
.wf-list-seg--current { background: #3b82f6; }
.wf-list-seg--failed { background: #ef4444; }
.wf-list-seg--todo { background: #e5e7eb; }
.wf-list-row--fail .wf-list-seg--done { background: #86efac; }
.wf-list-row--fail .wf-list-seg--failed,
.wf-list-row--fail .wf-list-seg--current { background: #ef4444; }
.wf-list-stage-cap { font-size: .75rem; line-height: 1.3; }

.status-pill,
.wf-list-badge {
  display: inline-block; padding: 4px 8px; border-radius: 4px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap;
}
.status-pill--proc,
.wf-list-badge--proc { background: #dbeafe; color: #1d4ed8; }
.status-pill--done,
.wf-list-badge--done { background: #dcfce7; color: #15803d; }
.status-pill--fail,
.wf-list-badge--fail { background: #fee2e2; color: #b91c1c; }
.status-pill--cancel { background: #fff1f2; color: #b42318; }
.status-pill--draft { background: #f2f4f7; color: #555; }
.status-pill--late { background: #fee2e2; color: #b91c1c; }

.wf-list-person {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.wf-list-person img {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  background: #eee;
}
.wf-list-person strong {
  font-size: .86rem; font-weight: 700; color: #111;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Workflow terminal status (replaces Chuyển tiếp / Thất bại) */
.wf-terminal-banner {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 36px; padding: 8px 12px;
  border-radius: 8px; font-weight: 700; font-size: .9rem;
  color: #fff; text-align: center; box-sizing: border-box;
  margin-bottom: 10px;
}
.wf-terminal-banner--done { background: #16a34a; }
.wf-terminal-banner--fail { background: #E30613; }

/* Platform · Search combo (tìm kiếm | lọc) — dùng chung WF / Tài khoản / list */
/* Process workspace: tools trên hàng «Danh sách quy trình»; lọc icon trong ô tìm */
.wf-layout-tabs .module-tabs-actions.wf-layout-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.wf-process-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wf-process-count {
  margin-left: auto;
}
.wf-task-count {
  font-size: .86rem;
  font-weight: 600;
  color: #2563eb;
  white-space: nowrap;
}
.vpdt-search-combo,
.wf-task-search--combo {
  display: inline-flex;
  align-items: stretch;
  min-width: 220px;
  max-width: 280px;
  height: 36px;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  overflow: visible;
}
.vpdt-search-combo:focus-within,
.wf-task-search--combo:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.vpdt-search-combo__form,
.wf-task-search-form {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-width: 0;
}
.vpdt-search-combo__ico,
.wf-task-search-ico {
  position: absolute;
  left: 10px;
  color: #888;
  display: inline-flex;
  pointer-events: none;
  z-index: 1;
}
.vpdt-search-combo input[type="search"],
.wf-task-search--combo input[type="search"] {
  width: 100%;
  height: 34px;
  padding: 0 8px 0 32px;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: transparent;
  font-size: var(--font-size-content);
  color: #111;
  outline: none;
  box-shadow: none;
}
.vpdt-search-combo input[type="search"]::placeholder,
.wf-task-search--combo input[type="search"]::placeholder { color: #9ca3af; }
.vpdt-search-combo input[type="search"]:focus,
.wf-task-search--combo input[type="search"]:focus {
  outline: none;
  box-shadow: none;
}
.vpdt-search-combo__sep,
.wf-task-search-sep {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  margin: 7px 0;
  background: #d4d4d8;
}

/* Search-only (không có lọc): cùng khung combo */
.vpdt-search-combo--solo {
  min-width: 200px;
  max-width: 480px;
  width: 100%;
}
.vpdt-search-combo--solo input[type="search"] {
  border-radius: 8px;
  padding-right: 12px;
}
.wf-task-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.wf-task-filter--ico {
  width: 36px;
  min-width: 36px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: #555;
}
.wf-task-filter--ico:hover { background: #f3f4f6; color: #111; }
.wf-task-filter--ico.is-active,
.wf-task-filter--ico.is-open {
  color: #1d4ed8;
  background: #eff6ff;
}
.wf-task-filter:hover { background: #f9fafb; border-color: #c4c4c8; }
.wf-task-filter.is-active,
.wf-task-filter.is-open {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}
.wf-filter-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #E30613; display: inline-block;
}
.wf-filter-wrap { position: relative; flex: 0 0 auto; display: flex; align-items: stretch; }
.wf-filter-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: min(360px, 92vw);
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: 14px;
}
.wf-filter-section { margin-bottom: 12px; }
.wf-filter-label {
  font-size: .78rem; font-weight: 700; color: #374151;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .02em;
}
.wf-filter-section .form-control { width: 100%; min-height: 36px; }
.wf-filter-dates {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px;
  align-items: center; margin-top: 8px;
}
.wf-filter-creator { position: relative; }
.wf-filter-picker {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  max-height: 220px; overflow: auto; box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.wf-filter-pick-empty { padding: 10px 12px; color: #9ca3af; font-size: .84rem; }
.wf-filter-pick-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%;
  text-align: left; border: 0; background: #fff; padding: 8px 12px; cursor: pointer;
}
.wf-filter-pick-item:hover { background: #f5f5f5; }
.wf-filter-pick-tag { font-weight: 700; color: #2563eb; font-size: .82rem; }
.wf-filter-pick-name { font-size: .78rem; color: #555; }
.wf-filter-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}
@media (max-width: 900px) {
  .vpdt-search-combo,
.wf-task-search--combo { min-width: 160px; max-width: 220px; }
  .wf-task-count { font-size: .8rem; }
}

/* Workflow report */
.wf-report-panel { margin-top: 4px; }
.wf-report-toolbar { align-items: center; flex-wrap: wrap; gap: 10px; }
.wf-report-range {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.wf-report-range .form-control {
  width: auto; min-width: 140px; min-height: 36px; height: 36px;
}
.wf-report-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 4px;
}
.wf-report-kpi {
  background: #fafafa; border: 1px solid #eee; border-radius: 10px;
  padding: 12px 14px; text-align: center;
}
.wf-report-kpi-val {
  font-size: 1.45rem; font-weight: 800; color: #111; line-height: 1.2;
}
.wf-report-kpi-val.is-proc { color: #2563eb; }
.wf-report-kpi-val.is-done { color: #16a34a; }
.wf-report-kpi-val.is-fail { color: #E30613; }
.wf-report-kpi-val.is-over { color: #b91c1c; }
.wf-report-kpi-lab { margin-top: 4px; font-size: .78rem; color: #666; font-weight: 600; }
.wf-report-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 8px 14px 4px;
  align-items: start;
}
.wf-report-card {
  border: 1px solid #eee; border-radius: 10px; background: #fff;
  padding: 12px 14px;
}
.wf-report-card--wide { margin: 0 14px 14px; }
.wf-report-card-h {
  font-size: .86rem; font-weight: 700; color: #222; margin-bottom: 10px;
}
.wf-report-canvas-wrap {
  position: relative;
  height: 180px;
  max-width: 340px;
  margin: 0 auto;
}
.wf-report-canvas-wrap--line {
  height: 200px;
  max-width: 920px;
}
.wf-report-table { margin: 0; }
.wf-report-table td.is-overdue-cell { color: #b91c1c; font-weight: 700; }
@media (max-width: 960px) {
  .wf-report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wf-report-charts { grid-template-columns: 1fr; }
}


/* ===== Datetime 24h (dd/mm/yyyy HH:mm) — không dùng datetime-local (tránh SA/CH) ===== */
.input-datetime-24 {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  text-align: left;
}
.input-datetime-24:invalid {
  border-color: #f3c1c1;
}


/* ===== Flatpickr datetime 24h (SHG) ===== */
.input-datetime-24 {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  text-align: left;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M8 3v4M16 3v4M3 11h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px !important;
  cursor: pointer;
}
.input-datetime-24:invalid { border-color: #f3c1c1; }
.flatpickr-calendar {
  z-index: 10060 !important;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
  border: 1px solid #e8e8e8;
  font-family: inherit;
  background: #fff !important;
  opacity: 1 !important;
}
.flatpickr-calendar.open {
  display: inline-block !important;
  opacity: 1 !important;
}
.flatpickr-calendar.animate {
  animation: none !important;
}
.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-days,
.dayContainer {
  background: #fff !important;
}
.flatpickr-months,
.flatpickr-weekdays {
  background: #fff !important;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: #E30613 !important;
  border-color: #E30613 !important;
  color: #fff !important;
}
/* Flatpickr: ngày hiện tại xanh nhạt + khối giờ vàng nhạt */
.flatpickr-day.today {
  background: #dbeafe !important; /* xanh dương nhạt */
  border-color: #93c5fd !important;
  color: #1e3a8a !important;
  font-weight: 700;
}
.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
  background: #bfdbfe !important;
  border-color: #60a5fa !important;
  color: #1e3a8a !important;
}
/* Ngày đã chọn vẫn ưu tiên đỏ SHG (kể cả khi là hôm nay) */
.flatpickr-day.today.selected,
.flatpickr-day.today.startRange,
.flatpickr-day.today.endRange {
  background: #E30613 !important;
  border-color: #E30613 !important;
  color: #fff !important;
}

.flatpickr-calendar.hasTime .flatpickr-time,
.flatpickr-time {
  background: #fef9c3 !important; /* vàng nhạt */
  border-top: 1px solid #fde68a !important;
}
.flatpickr-time input,
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm {
  background: transparent !important;
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
  background: #fef08a !important;
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
  background: #fff5f5;
}
.flatpickr-months .flatpickr-month {
  height: 34px;
  overflow: hidden;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  height: 34px;
  padding: 8px;
}
.flatpickr-current-month {
  font-size: 13px !important;
  font-weight: 600;
  line-height: 1 !important;
  height: 34px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  width: auto !important;
  left: 50% !important;
  transform: translateX(-50%);
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month span.cur-month,
.flatpickr-current-month input.cur-year {
  font-size: 13px !important;
  font-weight: 600;
  line-height: 34px;
  height: 34px;
  padding: 0 !important;
  margin: 0;
  vertical-align: middle;
}
.flatpickr-current-month .numInputWrapper {
  width: 4.2ch;
  max-width: 4.2ch;
}
.flatpickr-current-month .numInputWrapper span {
  display: none; /* gọn: không cần spinner năm trong header hẹp */
}
.flatpickr-weekdays { height: 26px; }
.flatpickr-day {
  height: 32px;
  line-height: 32px;
  max-width: 34px;
}
.flatpickr-calendar.hasTime .flatpickr-time {
  height: 36px;
  max-height: 36px;
  line-height: 36px;
}
.flatpickr-time .numInputWrapper { height: 36px; }
.numInputWrapper span { border: 0; }




/* Tab row search (Công việc…) */

/* Menu Công việc / Đề xuất / Quy trình — combo tìm+lọc trên hàng tab */
.module-tabs-actions .vpdt-search-combo {
  min-width: 200px;
  max-width: 280px;
  flex: 0 1 280px;
}
.module-tabs-actions .wf-process-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.wf-layout-tabs .module-tabs-actions.wf-layout-tools .wf-process-tools {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.wf-layout-tabs .module-tabs-actions.wf-layout-tools .vpdt-search-combo {
  flex: 0 1 240px;
  min-width: 180px;
  max-width: 240px;
}
.wf-layout-tabs .module-tabs-actions.wf-layout-tools .btn-std {
  flex: 0 0 auto;
  white-space: nowrap;
}

.module-tabs-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0;
  height: 36px;
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  min-width: 180px;
  max-width: 240px;
}
.module-tabs-search::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  background: center / 14px 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  z-index: 1;
}
.module-tabs-search:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.module-tabs-search input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  box-sizing: border-box;
  border: 0;
  border-radius: 8px;
  padding: 0 12px 0 32px;
  font-size: var(--font-size-content);
  color: #111;
  background: transparent;
  outline: none;
  box-shadow: none;
}
.module-tabs-search input[type="search"]:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}
.module-tabs-search input[type="search"]::placeholder {
  color: #9ca3af;
}

/* work-project create text link */
button.work-project-create-link,
.work-project-create-link {
  display: inline;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-width: 0 !important;
  height: auto !important;
  border-radius: 0 !important;
  color: #2563eb !important;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}
button.work-project-create-link:hover,
.work-project-create-link:hover {
  color: #1d4ed8 !important;
  text-decoration: underline;
  background: transparent !important;
}

/* Work task deadline outcome pills */
.work-deadline-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.work-deadline-pill--ok { background: #dcfce7; color: #15803d; }
.work-deadline-pill--late { background: #fef9c3; color: #a16207; }
.work-deadline-pill--overdue { background: #fee2e2; color: #b42318; }
.work-deadline-pill--muted { background: #f2f4f7; color: #555; }

/* input-date — Flatpickr chỉ ngày */
.input-date {
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-right: 36px !important;
  cursor: pointer;
}

/* Currency field — chuẩn Platform / form phiếu */
.currency-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.currency-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.currency-wrap .form-control { flex: 1 1 auto; min-width: 0; }
.currency-wrap .cur-select,
.currency-wrap select.js-search-select,
.currency-wrap .ts-wrapper {
  flex: 0 0 auto;
  max-width: 220px;
  min-width: 120px;
}
.currency-wrap .cur-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background: #f7f7f7;
  font-weight: 600;
  font-size: .86rem;
  color: #333;
  white-space: nowrap;
}
.money-words,
.js-money-words {
  font-size: .86rem;
  color: #666;
  min-height: 1.2em;
  line-height: 1.35;
}

/* ===== Header chrome: Nhắc việc + chuông ===== */
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}
.hdr-chrome-remind,
.hdr-chrome-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  text-decoration: none;
  flex-shrink: 0;
}
.hdr-chrome-remind:hover,
.hdr-chrome-bell:hover {
  color: #111;
  text-decoration: none;
}
.hdr-chrome-remind {
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid #c8c8cc;
  border-radius: 999px;
  background: #fff;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.hdr-chrome-remind:hover {
  border-color: #a1a1aa;
  background: #fafafa;
}
.hdr-chrome-remind-ico {
  display: inline-flex;
  color: #4b5563;
}
.hdr-chrome-bell {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent; /* reset viền mặc định <button> (gây vòng tròn lệch) */
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.hdr-chrome-bell:hover {
  background: #f5f5f5;
  border-color: #e8e8e8;
}
.hdr-chrome-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #E30613;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-sizing: border-box;
  border: 2px solid #fff;
  pointer-events: none;
}
.hdr-chrome-remind .hdr-chrome-badge { top: -5px; right: -4px; }
@media (max-width: 640px) {
  .hdr-chrome-remind-label { display: none; }
  .hdr-chrome-remind { padding: 0; width: 36px; height: 36px; justify-content: center; }
}

/* ===== Header chrome dropdown panels ===== */
.hdr-chrome {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.hdr-chrome-wrap { position: relative; }
button.hdr-chrome-remind,
button.hdr-chrome-bell {
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}
button.hdr-chrome-remind.is-open,
button.hdr-chrome-bell.is-open {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}
.hdr-chrome-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  width: min(380px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
  overflow: hidden;
}
.hdr-chrome-panel.is-fixed {
  position: fixed;
  left: auto;
  /* top/width/right do JS — neo mép phải .app-main (+4px), đồng bộ 2 panel */
}
.app-header {
  overflow: visible;
}
.hdr-chrome-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.hdr-chrome-panel-head strong {
  font-size: .95rem;
  color: #111;
}
.hdr-chrome-panel-sub {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  margin-top: 2px;
}
.hdr-chrome-linkbtn {
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.hdr-chrome-linkbtn:hover { background: #eff6ff; }
.hdr-chrome-panel-body {
  max-height: min(420px, 60vh);
  overflow: auto;
  padding: 6px;
}
.hdr-chrome-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: .88rem;
}
.hdr-chrome-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  border-radius: 8px;
  padding: 10px 10px;
  cursor: pointer;
  font: inherit;
  color: #111;
}
.hdr-chrome-item:hover { background: #f5f5f5; }
.hdr-chrome-item.is-unread {
  background: #fff7ed;
}
.hdr-chrome-item.is-unread:hover { background: #ffedd5; }
.hdr-chrome-item-title {
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.35;
}
.hdr-chrome-item-body {
  margin-top: 3px;
  font-size: .82rem;
  line-height: 1.35;
}
.hdr-chrome-item-meta {
  margin-top: 4px;
  font-size: .75rem;
}
.hdr-chrome-item--remind {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 8px 8px;
  border-radius: 8px;
}
.hdr-chrome-item--remind:hover { background: #f5f5f5; }
.hdr-chrome-mod {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 2px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #4b5563;
  flex-shrink: 0;
}
.hdr-chrome-item-main {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 2px 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-width: 0;
}
.hdr-chrome-dismiss {
  border: 0;
  background: transparent;
  padding: 4px 2px;
  margin: 0;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}
.hdr-chrome-dismiss:hover {
  color: #E30613;
  text-decoration: underline;
  background: transparent;
}
.hdr-chrome-panel-foot {
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  text-align: center;
}
.hdr-chrome-panel-foot a {
  font-size: .82rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}
.hdr-chrome-panel-foot a:hover { text-decoration: underline; }

/* ===== Tổ chức · Tổng quan — metrics phẳng trong list-panel ===== */
.org-overview-panel .list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.org-overview-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.org-overview-metrics {
  display: grid;
  /* Mặc định 3 cột × 2 hàng — đủ chỗ cho nhãn dài; 6 cột chỉ khi màn rộng */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}
.org-overview-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  min-height: 72px;
  box-sizing: border-box;
  overflow: visible;
  transition: background .12s ease;
}
.org-overview-metric:nth-child(3n) { border-right: 0; }
.org-overview-metric:nth-child(n+4) { border-top: 1px solid var(--line); }
.org-overview-metric:hover {
  background: #fafafa;
  color: inherit;
  text-decoration: none;
}
.org-overview-metric-lab {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft, #666);
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: break-word;
  word-break: normal;
}
.org-overview-metric-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink, #111);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1400px) {
  .org-overview-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .org-overview-metric { border-right: 1px solid var(--line); border-top: 0; }
  .org-overview-metric:nth-child(3n) { border-right: 1px solid var(--line); }
  .org-overview-metric:nth-child(n+4) { border-top: 0; }
  .org-overview-metric:last-child { border-right: 0; }
}
@media (max-width: 640px) {
  .org-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-overview-metric { border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
  .org-overview-metric:nth-child(3n) { border-right: 1px solid var(--line); }
  .org-overview-metric:nth-child(2n) { border-right: 0; }
  .org-overview-metric:nth-child(n+4) { border-top: 1px solid var(--line); }
  .org-overview-metrics > .org-overview-metric:nth-child(-n+2) { border-top: 0; }
  .org-overview-actions { margin-left: 0; width: 100%; }
}

/* ===== Platform · Kho nền tảng — 3 card đều, nút cùng mép trái đáy ===== */
.platform-kho-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}
.platform-kho-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  min-height: 120px;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-sizing: border-box;
}
.platform-kho-card:last-child { border-right: 0; }
.platform-kho-lab {
  font-weight: 600;
  font-size: .82rem;
  color: #222;
}
.platform-kho-stat {
  color: var(--ink, #111);
  line-height: 1.3;
}
.platform-kho-card > .btn {
  margin-top: auto;
  align-self: flex-start;
}
@media (max-width: 900px) {
  .platform-kho-grid { grid-template-columns: 1fr; }
  .platform-kho-card {
    border-right: 0;
    border-top: 1px solid var(--line);
    min-height: 0;
  }
  .platform-kho-grid > .platform-kho-card:first-child { border-top: 0; }
}


/* File đã lưu — cùng hàng với picker: tên xem trước, ⋯ mép phải */
.vpdt-saved-file-list {
  display: flex; flex-direction: column; gap: 0;
  margin: 0 0 8px; padding: 0; list-style: none;
}
.vpdt-saved-file-list > .vpdt-file-row { width: 100%; }
.vpdt-saved-file .vpdt-file-size {
  flex: 0 0 auto; font-size: .8rem; color: #888; white-space: nowrap;
}
.wf-task-desc-files.vpdt-saved-file-list { margin: 8px 0 0; }

/* Công việc — phiếu: 3 khối accordion (tiêu đề trái, chevron phải) */
.task-part-acc { margin: 0; }
.task-part-head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: #fff;
}
.task-part-head::-webkit-details-marker { display: none; }
.task-part-head::marker { display: none; content: ''; }
.task-part-title {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  color: #111;
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}
.task-part-chev {
  width: 8px; height: 8px;
  border-right: 2px solid #9ca3af;
  border-bottom: 2px solid #9ca3af;
  transform: rotate(-45deg);
  transition: transform .15s ease;
  flex: 0 0 auto;
  margin-top: -1px;
}
.task-part-acc[open] > .task-part-head .task-part-chev {
  transform: rotate(45deg);
  margin-top: 2px;
}
.form-panel.task-part .form-panel-body { padding: 4px 16px 12px; }
.form-panel.task-part .form-panel-footer { padding: 10px 16px; }
.form-panel.task-part .show-more { margin-left: auto; }
.form-panel.task-part .show-more-btn {
  width: 28px; height: 28px; font-size: 1.15rem;
}
.form-panel.task-part .show-more-menu { z-index: 80; }
.task-part-hint { margin: 0 0 10px; font-size: .82rem; }
.task-info-dates {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.task-info-dates .form-control { min-width: 0; flex: 1; }
.task-info-dash { color: #9ca3af; flex: 0 0 auto; }
.task-st { margin-top: 12px; position: relative; }
.task-st > summary { list-style: none; }
.task-st > summary::-webkit-details-marker { display: none; }
.task-st-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-sizing: border-box;
}
.task-st-btn.is-static { cursor: default; }
.task-st-ico {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.task-st-ico svg { display: block; }
.task-st-label { flex: 1 1 auto; text-align: left; line-height: 1.2; }
.task-st-caret {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(0,0,0,.45);
  margin-left: auto;
  flex: 0 0 auto;
}
.task-st[open] > summary .task-st-caret { transform: rotate(180deg); }
.task-st-btn--doing { background: #2563eb; }
.task-st-btn--wait { background: #7c3aed; }
.task-st-btn--done { background: #22c55e; }
.task-st-btn--failed { background: #dc2626; }
.task-st-btn--late { background: #b91c1c; }
.task-st-menu {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  padding: 6px 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(17,17,17,.12);
}
.task-st-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  background: #fff;
  color: #4b5563;
  font: inherit;
  font-size: .88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}
.task-st-opt:hover { background: #f3f4f6; }
.task-st-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  flex: 0 0 14px;
}
.task-st-swatch--doing { background: #2563eb; }
.task-st-swatch--wait { background: #7c3aed; }
.task-st-swatch--done { background: #22c55e; }
.task-st-swatch--failed { background: #dc2626; }
.status-pill--wait { background: #f3e8ff; color: #6d28d9; }
.task-show-act.card.show-act-card { padding-top: 8px; }
.task-show-act .show-aside-sections { margin-top: 0; border-top: 0; }
.task-show-act .show-aside-sec:first-child > .show-aside-sec-head { padding-top: 0; }


.task-info-date-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.task-info-date-btn:hover strong { text-decoration: underline; }
.task-fp-form { position: relative; width: 0; height: 0; overflow: visible; margin: 0; }
.task-fp-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.task-group-pick { position: relative; width: 100%; }
.task-group-pick > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}
.task-group-pick > summary::-webkit-details-marker { display: none; }
.task-group-caret {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #6b7280;
  flex: 0 0 auto;
}
.task-group-pick[open] > summary .task-group-caret { transform: rotate(180deg); }
.task-group-menu {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
  padding: 4px;
  max-height: 240px;
  overflow: auto;
}
.task-group-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: .86rem;
  cursor: pointer;
  color: #222;
}
.task-group-opt:hover { background: #f7f7f7; }
.task-group-opt.is-current { font-weight: 700; background: #f3f4f6; }
.task-show-act .list-toolbar .show-more { margin-left: auto; }

/* ===== Mention / tag picker (Platform — một khuôn @username / @usergroup) ===== */
.show-follow-picker .form-control,
.disc-mention-search .form-control {
  min-height: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #E30613;
  padding: 6px 14px;
  font-size: .86rem;
  background: #fff;
  box-shadow: none;
}
.show-follow-picker .form-control:focus,
.disc-mention-search .form-control:focus {
  border-color: #E30613;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.12);
}
.disc-mention-search { border-bottom: 0; padding: 8px 8px 4px; }
.tag-suggest,
.gg-suggest {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  margin-top: 6px;
  background: #fff;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.vpdt-mention-opt,
.show-follow-opt,
.disc-mention-opt,
.tag-suggest button,
.gg-suggest button {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: #111;
}
.vpdt-mention-opt:hover,
.show-follow-opt:hover,
.disc-mention-opt:hover,
.disc-mention-opt.is-active,
.tag-suggest button:hover,
.gg-suggest button:hover {
  background: #f5f5f5;
}
.vpdt-mention-opt .avatar,
.vpdt-mention-opt .avatar-sm,
.show-follow-opt .avatar,
.show-follow-opt .avatar-sm,
.disc-mention-opt .avatar,
.disc-mention-opt .avatar-sm,
.tag-suggest button .avatar,
.gg-suggest button .avatar {
  width: 36px !important;
  height: 36px !important;
  border-radius: 999px;
  flex: 0 0 auto;
  object-fit: cover;
  background: #f3f4f6;
}
.vpdt-mention-opt-text,
.show-follow-opt-text,
.disc-mention-opt-text {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.vpdt-mention-opt-text strong,
.show-follow-opt-text strong,
.disc-mention-opt-text strong {
  font-size: .86rem;
  font-weight: 700;
  color: #111;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.vpdt-mention-opt-text .muted,
.show-follow-opt-text .muted,
.disc-mention-opt-text .muted {
  display: block;
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.25;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.vpdt-mention-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #4b5563;
  font-weight: 700;
  font-size: .8rem;
}

/* Tom Select chọn người — cùng khuôn dropdown @mention */
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input-wrap,
.ts-wrapper.ts-mention .ts-dropdown .ts-search-field {
  border-bottom: 0;
  padding: 8px 8px 4px;
  background: #fff;
}
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input-wrap::after,
.ts-wrapper.ts-mention .ts-dropdown .ts-search-field::after {
  display: none;
}
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input,
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input-wrap input,
.ts-wrapper.ts-mention .ts-dropdown .ts-search-field input {
  border: 1px solid #E30613 !important;
  border-radius: 999px !important;
  padding: 6px 14px !important;
  min-height: 36px;
  background: #fff !important;
}
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input:focus,
.ts-wrapper.ts-mention .ts-dropdown .dropdown-input-wrap input:focus,
.ts-wrapper.ts-mention .ts-dropdown .ts-search-field input:focus {
  border: 1px solid #E30613 !important;
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.12) !important;
  background: #fff !important;
}
.ts-wrapper.ts-mention .ts-dropdown .ts-dropdown-content {
  padding: 4px 6px 8px;
}
.ts-wrapper.ts-mention .ts-dropdown .option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}
.ts-wrapper.ts-mention .ts-dropdown .option.active,
.ts-wrapper.ts-mention .ts-dropdown .option:hover {
  background: #f5f5f5;
}
.ts-wrapper.ts-mention .ts-dropdown .option .avatar,
.ts-wrapper.ts-mention .ts-dropdown .option .avatar-sm {
  width: 36px !important;
  height: 36px !important;
  border-radius: 999px;
  flex: 0 0 auto;
  object-fit: cover;
}


/* Task show: Tên / Người thực hiện / Ưu tiên cùng 1 dòng */
.form-grid.task-part-desc-grid {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.25fr) minmax(0, 0.95fr);
}
.form-grid.task-part-desc-grid > .field.field-span-2 {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .form-grid.task-part-desc-grid {
    grid-template-columns: 1fr;
  }
}

/* Cong viec: nut Tao so menu (cach A) — tai dung .show-more */
.module-tabs-actions button.btn-std {
  color: #fff !important;
  background: #E30613;
  border-bottom: 0 !important;
  margin-bottom: 0;
  padding: 0 14px 0 16px;
  height: 36px;
  min-width: 112px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.module-tabs-actions button.btn-std:hover {
  color: #fff !important;
  filter: brightness(.96);
  background: #E30613;
}
.task-create-chev {
  width: 7px; height: 7px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
  margin-top: -3px;
  flex: 0 0 auto;
}
#task-create-btn[aria-expanded="true"] .task-create-chev {
  transform: rotate(-135deg);
  margin-top: 2px;
}
.module-tabs .show-more-menu a.show-more-item {
  display: flex;
  color: #222 !important;
  background: transparent;
  border-bottom: 0 !important;
  margin-bottom: 0;
  border-radius: 8px;
  font-weight: 500;
  font-size: .86rem;
  padding: 9px 12px;
}
.module-tabs .show-more-menu a.show-more-item:hover {
  background: #f7f7f7;
  color: #111 !important;
}
.show-more-item.is-disabled,
.show-more-item:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}
.show-more-item.is-disabled:hover,
.show-more-item:disabled:hover {
  background: transparent;
  color: #9ca3af;
}
.show-more-item.is-disabled .show-more-copy-label {
  color: #9ca3af;
  font-size: .8rem;
  font-weight: 500;
}

/* Cong viec: 2 o Tao — khung vuong mau; ngang bang nut + Tao cong viec */
#task-create-dd {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
#task-create-dd > #task-create-btn {
  width: 100%;
  box-sizing: border-box;
}
#task-create-menu[hidden],
#task-create-btn[aria-expanded="false"] + #task-create-menu {
  display: none !important;
}
#task-create-btn[aria-expanded="true"] + #task-create-menu {
  display: flex !important;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  left: 0;
  right: auto;
  width: 100%;
  min-width: 100%;
  max-width: none;
  box-sizing: border-box;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}
#task-create-menu .task-create-opt,
#task-create-menu .show-more-item.task-create-opt,
.module-tabs #task-create-menu .task-create-opt {
  border-radius: 6px !important;
  border: 1px solid transparent;
  padding: 10px 12px;
  box-sizing: border-box;
  width: 100%;
  justify-content: center;
  text-align: center;
}

#task-create-menu .task-create-opt--new,
.module-tabs #task-create-menu a.task-create-opt--new {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a !important;
}
#task-create-menu .task-create-opt--new:hover,
.module-tabs #task-create-menu a.task-create-opt--new:hover {
  background: #bfdbfe;
  color: #1e3a8a !important;
}
#task-create-menu .task-create-opt--kpi {
  background: #f3e8ff;
  border-color: #d8b4fe;
  color: #6b21a8;
  cursor: pointer;
}
#task-create-menu .task-create-opt--kpi:hover {
  background: #e9d5ff;
  color: #6b21a8 !important;
}
#task-create-menu .task-create-opt--kpi.is-disabled,
#task-create-menu .task-create-opt--kpi:disabled,
#task-create-menu .task-create-opt--kpi.is-disabled:hover,
#task-create-menu .task-create-opt--kpi:disabled:hover {
  background: #f3e8ff;
  border-color: #d8b4fe;
  color: #6b21a8;
  cursor: not-allowed;
}
#task-create-menu .task-create-opt--kpi .show-more-copy-label {
  color: #7c3aed;
  font-size: .8rem;
  font-weight: 500;
}

/* Cong viec: modal Tao cong viec — khuon show-act-modal */
.show-act-modal.task-create-modal .show-act-modal-panel {
  width: min(920px, 100%);
  max-height: min(90vh, 920px);
}
.show-act-modal.task-create-modal .show-act-modal-body {
  padding: 12px 16px 16px;
}
.show-act-modal.task-create-modal .form-panel.task-part {
  box-shadow: none;
}


/* Platform form-table input (shared Đề xuất + phiếu việc) */
.form-table-field { align-content:start; }
.form-table-field > label { justify-self:start; }
.form-table-wrap { overflow:auto; border:1px solid #dcdcdc; border-radius:6px; width:100%; }
.form-table { table-layout:fixed; width:100%; border-collapse:collapse; margin:0; background:#fff; }
.form-table thead th {
  position:static;
  background:#ececec !important;
  color:#222;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.02em;
  font-size:.72rem;
  text-align:center !important;
  vertical-align:middle !important;
  white-space:normal !important;
  padding:10px 8px;
  border:1px solid #d5d5d5;
}
.form-table .req-star { color:#E30613; font-weight:800; }
.form-table tbody td, .form-table tfoot td {
  padding:8px;
  border:1px solid #e5e5e5;
  vertical-align:middle;
  background:#fff;
}
.form-table tbody tr.ft-data-row:nth-child(even) td { background:#fafafa; }
.form-table tbody tr.ft-data-row:hover td { background:#fff8f8; }
.form-table td .form-control,
.form-table td .ms-dd,
.form-table td .currency-wrap {
  width:100%; min-width:0 !important; max-width:100%; box-sizing:border-box;
}
.form-table td .form-control { min-height:36px; }
.form-table .col-idx { width:44px; text-align:center; color:#666; font-variant-numeric:tabular-nums; }
.form-table .col-actions { width:44px; text-align:center; padding:4px; }
.form-table .ft-row-del {
  border:0; background:transparent; color:#999; cursor:pointer; font-size:18px; line-height:1; padding:4px 8px; border-radius:6px;
}
.form-table .ft-row-del:hover { background:#fff1f2; color:#E30613; }
.form-table .ft-add-row td { background:#fff !important; border-top:0; }
.form-table .ft-add-link {
  border:0; background:transparent; color:#2563eb; font-weight:600; cursor:pointer; padding:6px 0; font-size:.92rem;
}
.form-table .ft-add-link:hover { text-decoration:underline; }
.form-table tfoot td { background:#ececec !important; font-weight:700; text-align:center; }
.form-table tfoot .ft-total-label { text-align:center; }
.form-table tfoot .ft-total { font-variant-numeric:tabular-nums; }
.form-table .money-words { font-size:.75rem; }
.ms-dd { position:relative; width:100%; }
.ms-toggle { text-align:left; cursor:pointer; background:#fff; width:100%; }
.ms-panel { position:absolute; z-index:30; left:0; right:0; top:calc(100% + 4px); background:#fff; border:1px solid #ddd; border-radius:8px; max-height:220px; overflow:auto; box-shadow:0 8px 24px rgba(0,0,0,.08); padding:6px; }
.ms-panel label { display:flex; gap:8px; align-items:center; padding:6px 8px; border-radius:6px; cursor:pointer; font-weight:400; margin:0; }
.ms-panel label:hover { background:#f6f6f6; }
.ms-panel input { margin:0; }


/* Quyền ghi theo cột (table-def) */
.td-write-field { margin-top: 8px; }
.td-write-field .js-col-write-mode { min-width: 180px; max-width: 280px; }
.td-write-roles {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 6px; padding: 8px 10px;
  background: #fafafa; border: 1px solid #eee;
}
.td-write-role {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; font-size: .78rem; font-weight: 500; color: #444; cursor: pointer;
}
.td-write-role input { width: 14px; height: 14px; accent-color: #E30613; }
.td-write-preset-row { margin-top: 0; margin-bottom: 6px; }
.td-write-preset-row .js-col-write-preset { min-width: 180px; max-width: 320px; }
.td-write-role-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }


/* Cột Khóa + 3 đối tượng xem/ghi */
.td-def-table th.td-lock,
.td-def-table td.td-lock { width:44px; text-align:center; }
.td-def-table td.td-lock { padding-top:18px; }
.td-aud-wrap { margin-top:10px; padding:10px; background:#fafafa; border:1px solid #eee; }
.td-aud-table { width:100%; max-width:420px; border-collapse:collapse; font-size:.82rem; }
.td-aud-table th, .td-aud-table td { padding:6px 8px; border-bottom:1px solid #f0f0f0; text-align:left; }
.td-aud-table th { color:#666; font-weight:600; }
.td-aud-table .td-check { text-align:center; width:56px; }
.td-aud-hint { margin-top:8px; font-size:.75rem; color:#888; line-height:1.35; }

/* Hang tab 1: ô tìm + nút Tạo giữa hàng (bù gạch chân 2px + bỏ margin form) */
.module-tabs.task-primary-tabs {
  align-items: stretch;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  flex-wrap: nowrap;
  box-sizing: border-box;
}
.task-primary-tabs .module-tabs-left {
  align-items: stretch;
  height: 100%;
  flex-wrap: nowrap;
}
.task-primary-tabs .module-tabs-left > a {
  height: 100%;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}
.task-primary-tabs .module-tabs-actions {
  align-self: stretch;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  /* 5/7 dọc giữa hàng; 8px phải = hàng nút trạng thái bên dưới */
  padding: 5px 8px 7px 8px;
  margin: 0 0 0 auto;
}
.task-primary-tabs .module-tabs-search {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  height: 36px;
  line-height: 0;
}
.task-primary-tabs .module-tabs-search input[type="search"] {
  margin: 0;
  height: 36px;
  min-height: 36px;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  line-height: 36px;
}
.task-primary-tabs .module-tabs-actions .show-more {
  display: flex;
  align-items: center;
  margin: 0;
  height: 36px;
  line-height: 0;
}
.task-primary-tabs .module-tabs-actions .btn-std {
  margin: 0;
  height: 36px;
}

/* Hang tab 2 (Công việc lọc / Đề xuất hộp thư / Cài đặt con): 42px cố định */
.module-tabs.task-box-tabs,
.module-tabs.req-box-tabs {
  flex-wrap: nowrap;
  align-items: stretch;
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
  margin-top: -1px;
}
.task-box-tabs .module-tabs-left,
.req-box-tabs .module-tabs-left {
  align-items: stretch;
  flex-wrap: nowrap;
  height: 100%;
}
.task-box-tabs .module-tabs-left > a,
.req-box-tabs .module-tabs-left > a {
  height: 100%;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
}
.task-box-tabs .task-st-filters {
  margin-left: auto;
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 8px;
  height: 100%;
  box-sizing: border-box;
}
.module-tabs.task-box-tabs a.task-st-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  box-sizing: border-box;
}
.module-tabs.task-box-tabs a.task-st-filter:hover {
  filter: brightness(.97);
  text-decoration: none;
  font-weight: 600;
}
.module-tabs.task-box-tabs a.task-st-filter--doing {
  background: #dbeafe;
  color: #1d4ed8 !important;
  border-color: #93c5fd;
}
.module-tabs.task-box-tabs a.task-st-filter--overdue {
  background: #ffedd5;
  color: #c2410c !important;
  border-color: #fdba74;
}
.module-tabs.task-box-tabs a.task-st-filter--done {
  background: #dcfce7;
  color: #15803d !important;
  border-color: #86efac;
}
.module-tabs.task-box-tabs a.task-st-filter--failed {
  background: #fee2e2;
  color: #b91c1c !important;
  border-color: #fca5a5;
}
.module-tabs.task-box-tabs a.task-st-filter.is-on,
.module-tabs.task-box-tabs a.task-st-filter.is-on:hover {
  box-shadow: inset 0 0 0 2px currentColor;
  font-weight: 700;
}
.task-box-tabs .work-customize {
  height: 100%;
  display: inline-flex;
  align-items: stretch;
  position: relative;
}
.task-box-tabs .work-customize-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 14px;
  margin: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #555;
  font: inherit;
  font-size: .86rem;
  font-weight: 400;
  cursor: pointer;
  box-sizing: border-box;
}
.task-box-tabs .work-customize-tab:hover,
.task-box-tabs .work-customize-tab[aria-expanded="true"] {
  color: #111;
  background: transparent;
}
.work-customize-chev {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
  flex: 0 0 auto;
}
#work-customize-btn[aria-expanded="true"] .work-customize-chev {
  transform: rotate(-135deg);
  margin-top: 2px;
}
.task-box-tabs .work-customize .show-more-menu {
  left: 0;
  right: auto;
  min-width: 240px;
}
.work-group-board .work-group-acc {
  margin: 0;
  border-top: 1px solid #eee;
}
.work-group-acc-head {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  background: #f7f7f8;
  border-radius: 0;
}
.work-group-acc-head::-webkit-details-marker { display: none; }
.work-group-acc-head::marker { display: none; content: ''; }
.work-group-acc-head:hover { background: #f2f3f5; }
.work-group-acc-chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid #9ca3af;
  border-bottom: 2px solid #9ca3af;
  transform: rotate(-45deg);
  transition: transform .15s ease;
  flex: 0 0 auto;
  margin-top: -1px;
}
.work-group-acc[open] > .work-group-acc-head .work-group-acc-chev {
  transform: rotate(45deg);
  margin-top: 2px;
}
.work-group-acc-title {
  font-weight: 700;
  color: #111;
  font-size: .9rem;
}
.work-group-acc-desc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}
.work-group-acc-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  position: relative;
}
.work-group-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #555;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .08em;
  cursor: pointer;
}
.work-group-more-btn:hover,
.work-group-more-btn[aria-expanded="true"] {
  color: #111;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.work-group-more .show-more-menu {
  right: 0;
  left: auto;
  min-width: 160px;
  z-index: 40;
}
.work-group-board .table-wrap { border-radius: 0; }

/* Công việc list: cùng cỡ chữ tab menu (.module-tabs a = .86rem) */
table.work-task-list,
table.work-task-list tbody td {
  font-size: var(--font-size-content);
}
/* Specificity ≥ .list-panel .table-erp a.table-name-link (font-weight:600) */
.list-panel .table-erp.work-task-list a.table-name-link,
.list-panel table.work-task-list a.table-name-link,
table.work-task-list a.table-name-link {
  font-size: var(--font-size-content);
  font-weight: 400; /* Mã / Tên công việc: chữ thường, không đậm */
}

/* Dự án: nới Tên công việc sang trái (~30% lấy từ cột Mã) */
.work-group-board table.work-task-list {
  table-layout: fixed;
  width: 100%;
}
.work-group-board table.work-task-list .col-code {
  width: 11%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.work-group-board table.work-task-list .col-task-name {
  width: 40%;
}
.work-group-board table.work-task-list .col-assignee {
  width: 16%;
}
.work-group-board table.work-task-list .col-due {
  width: 14%;
  white-space: nowrap;
}
.work-group-board table.work-task-list .col-status {
  width: 11%;
  white-space: nowrap;
}
.work-group-board table.work-task-list .col-task-name .table-name-link {
  display: inline;
  word-break: break-word;
}

/* Hàng việc: icon sửa/xóa = 1/2, không khung */
.work-group-board table.work-task-list .action-icon.action-icon--plain {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #555;
  vertical-align: middle;
}
.work-group-board table.work-task-list .action-icon.action-icon--plain .nav-icon {
  width: 14px;
  height: 14px;
}
.work-group-board table.work-task-list .action-icon.action-icon--plain:hover {
  background: transparent;
  border: 0;
  color: var(--brand-dark);
  text-decoration: none;
}
.work-group-board table.work-task-list .action-icon.action-icon--plain.danger:hover {
  background: transparent;
  border: 0;
  color: var(--danger);
}
.work-group-board table.work-task-list .col-actions form {
  display: inline;
  margin-left: 6px;
}

/* ===== M0 Mobile / M1 PWA shell ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

@media (max-width: 720px) {
  .app-header {
    padding: 10px 4px;
    gap: 8px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .app-page-title { font-size: 1.05rem; }
  .app-page-subtitle { display: none; }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
  }
  .hdr-chrome { gap: 10px; }
  .hdr-chrome-remind,
  .hdr-chrome-bell {
    min-width: 40px;
    min-height: 40px;
  }
  .hdr-chrome-panel {
    width: min(100vw - 16px, 380px);
  }
  .module-tabs,
  .account-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0;
  }
  .module-tabs-left,
  .account-tabs-left {
    flex-wrap: nowrap;
  }
  .module-tabs a,
  .account-tabs a {
    padding: 10px 12px;
    white-space: nowrap;
  }
  .module-tabs-actions,
  .account-tabs-actions {
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    padding: 6px 4px 8px;
    border-top: 1px solid #f0f0f0;
  }
  .list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .list-toolbar-left,
  .list-toolbar-right {
    min-width: 0;
    width: 100%;
  }
  .list-search {
    max-width: none;
    width: 100%;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .show-act-btns {
    flex-direction: column;
    align-items: stretch;
  }
  .show-act-btns .btn-std {
    flex: 1 1 auto;
    width: 100%;
  }
  .show-act-modal {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    align-items: flex-end;
  }
  .show-act-modal-panel {
    width: 100%;
    max-height: min(92vh, 860px);
    border-radius: 12px 12px 0 0;
  }
  .auth-wrap {
    padding: 16px 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .auth-card { width: 100%; max-width: 420px; }
}

@media (max-width: 900px) {
  /* Giữ chrome + avatar trên 1 hàng với tiêu đề — không đẩy full-width */
  .app-header-actions {
    order: unset;
    width: auto;
    flex-shrink: 0;
  }
}

/* ===== M0.1 Mobile UX ===== */
.col-m-meta { display: none; }
.table-name-link {
  color: #111;
  font-weight: 600;
  text-decoration: none;
}
.table-name-link:hover { color: #E30613; text-decoration: underline; }

@media (max-width: 720px) {
  .col-m-hide { display: none !important; }
  .col-m-meta {
    display: block;
    margin-top: 4px;
    font-size: .78rem;
    line-height: 1.35;
    font-weight: 500;
  }
  .table-erp thead th,
  .table-erp tbody td {
    padding: 10px 8px;
    vertical-align: top;
  }
  .table-erp .col-code {
    width: 88px;
    max-width: 96px;
    font-size: .78rem;
    white-space: nowrap;
  }
  .table-erp .col-status {
    width: 1%;
    white-space: nowrap;
  }
  .table-erp .col-name,
  .table-erp td.col-name {
    min-width: 0;
    word-break: break-word;
  }
  .table-name-link {
    display: inline-block;
    max-width: 100%;
    line-height: 1.35;
  }
  /* order phiếu: chuyển sang vpdt-mobile.css */
  .module-tabs-actions .btn-std,
  .module-tabs-actions .module-tabs-search {
    flex: 1 1 100%;
  }
  .module-tabs-actions .module-tabs-search input[type="search"] {
    width: 100%;
    min-height: 40px;
  }
  .module-tabs-actions .btn-std {
    width: 100%;
    justify-content: center;
  }
  .req-box-tabs,
  .task-box-tabs,
  .module-tabs.task-primary-tabs {
    margin-bottom: 8px;
  }
  .list-panel {
    border-radius: 10px;
  }
  .list-toolbar {
    padding: 10px 12px;
  }
  .app-content {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .grid.grid-3 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .card.stat {
    padding: 14px 16px;
  }
  .card.stat strong {
    font-size: 1.6rem;
  }
  /* Chuông / nhắc: panel gần full màn */
  .hdr-chrome-panel {
    width: min(100vw - 12px, 420px);
    max-height: min(70vh, 520px);
  }
  .hdr-chrome-panel-body {
    max-height: min(52vh, 380px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Sidebar: vùng chạm lớn hơn */
  .sidebar-link,
  .sidebar-sublink {
    min-height: 44px;
  }
}

@media (min-width: 721px) {
  .col-m-meta { display: none !important; }
}


/* Web Push toggle in notify panel */
.hdr-chrome-panel-foot--push {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
