/* ============================================================
   APP SHELL — design tokens, layout, sidebar, topbar, dropdown,
   date-range picker, panels, table & footer dùng chung cho MỌI trang.
   Trang riêng (vd. dashboard) chỉ cần nạp thêm CSS đặc thù của nó.
   ============================================================ */

:root {
  --navy-950: #071B33;
  --navy-900: #0A2A4D;
  --navy-800: #123A66;
  --navy-700: #1B4B82;
  --blue-700: #1D4ED8;
  --blue-600: #2563EB;
  --blue-500: #3B82F6;
  --blue-50: #EAF1FD;
  --gold-700: #96721F;
  --gold-600: #C99A2E;
  --gold-100: #FBF1DC;
  --green-700: #0F7A44;
  --green-600: #15A05A;
  --green-100: #E3F7EC;
  --red-700: #B91C1C;
  --red-600: #DC2626;
  --red-100: #FDE8E8;
  --amber-600: #D97706;
  --amber-100: #FEF3DC;
  /* Bộ token RIÊNG cho nguồn dữ liệu ngăn chặn, không mở rộng hệ màu badge trạng thái. */
  --gray-600: #5B6472;
  --gray-100: #EEF0F3;
  --purple-600: #7C3AED;
  --purple-100: #EFE7FD;
  --orange-600: #D9640A;
  --orange-100: #FDEADB;
  --bg: #F2F6FB;
  --card: #FFFFFF;
  --border: #E3E9F1;
  --divider: #EDF1F6;
  --text-900: #0B1830;
  --text-600: #48597A;
  --text-400: #8697B4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 24, 48, .04), 0 6px 18px rgba(11, 24, 48, .05);
  --shadow-md: 0 10px 28px rgba(11, 24, 48, .10);
  --shadow-lg: 0 24px 64px rgba(11, 24, 48, .16);
  --font-ui: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-num: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  /* ==== sidebar theme tokens (mặc định: tông tối navy) ==== */
  --sb-bg: var(--navy-900);
  --sb-header-bg: var(--navy-900);
  --sb-border: rgba(255, 255, 255, .10);
  --sb-ink: #B9CBE6;
  --sb-ink-strong: #FFFFFF;
  --sb-muted: #6685AC;
  --sb-hover: rgba(255, 255, 255, .07);
  --sb-active-bg: linear-gradient(90deg, var(--blue-700), var(--blue-600));
  --sb-active-ink: #FFFFFF;
  --sb-accent: var(--gold-600);
  --sb-sep: rgba(255, 255, 255, .10);
  --sb-chip-bg: rgba(255, 255, 255, .09);
  --sb-chip-border: rgba(255, 255, 255, .14);
  --sb-chip-ink: #C7D8EF;
}

/* ==== tông sáng cho sidebar (bật bằng nút chuyển tông) ==== */
.app.light-sidebar {
  --sb-bg: #FFFFFF;
  --sb-header-bg: #FFFFFF;
  --sb-border: var(--border);
  --sb-ink: var(--text-600);
  --sb-ink-strong: var(--text-900);
  --sb-muted: var(--text-400);
  --sb-hover: var(--bg);
  --sb-active-bg: var(--blue-50);
  --sb-active-ink: var(--blue-700);
  --sb-accent: var(--blue-600);
  --sb-sep: var(--divider);
  --sb-chip-bg: var(--bg);
  --sb-chip-border: var(--border);
  --sb-chip-ink: var(--text-400);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-900);
  font-size: 13.5px;
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
.font-head {
  font-family: var(--font-ui);
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.flag-ribbon {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #DC2626 0%, #DC2626 46%, var(--gold-600) 54%, var(--gold-600) 100%);
}

/* ===== Layout khung trang ===== */
.app {
  display: flex;
  min-height: calc(100vh - 3px);
  width: 100%;
  max-width: 100%;
  position: relative;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 20, 40, .45);
  z-index: 35;
  opacity: 0;
  transition: opacity .2s ease;
}

.app.mobile-open .nav-backdrop {
  display: block;
  opacity: 1;
}

/* ===== Sidebar (menu điều hướng chính) ===== */
/* .sidebar: khung nền — co giãn theo chiều cao toàn cột (bằng .main, gồm cả footer) nên nền phủ hết trang */
.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--sb-bg);
  color: var(--sb-ink);
  border-right: 1px solid var(--sb-border);
  transition: width .2s ease, opacity .16s ease, background-color .2s ease, color .2s ease, border-color .2s ease, transform .22s ease;
}

.app.collapsed .sidebar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  border-right-color: transparent;
}

/* .sidebar-inner: phần dính (sticky) theo viewport khi cuộn, chứa brand + menu */
.sidebar-inner {
  position: sticky;
  top: 3px;
  height: calc(100vh - 3px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-inner::-webkit-scrollbar {
  width: 6px;
}

.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(120, 140, 170, .35);
  border-radius: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 16px 16px;
  border-bottom: 1px solid var(--sb-border);
  position: sticky;
  top: 0;
  background: var(--sb-header-bg);
  z-index: 2;
  transition: background-color .2s ease, border-color .2s ease;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .25));
  flex-shrink: 0;
}

.brand .name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--sb-ink-strong);
  line-height: 1.25;
  transition: color .2s ease;
}

.brand .sub {
  font-size: 11px;
  color: var(--sb-muted);
  margin-top: 2px;
  transition: color .2s ease;
}

.nav-scroll {
  padding: 9px 9px 22px;
}

.nav-group {
  margin-bottom: 1px;
}

.nav-parent {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--sb-ink);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-parent:hover {
  background: var(--sb-hover);
  color: var(--sb-ink-strong);
}

.nav-parent i.fa-caret {
  margin-left: auto;
  font-size: 11px;
  transition: transform .18s;
  opacity: .6;
}

.nav-parent .icon-box {
  width: 17px;
  text-align: center;
  font-size: 13px;
  opacity: .85;
  flex-shrink: 0;
}

.nav-group.open .nav-parent i.fa-caret {
  transform: rotate(90deg);
}

.nav-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height .22s ease;
  margin: 1px 0 3px 20px;
  padding-left: 9px;
  border-left: 1px solid var(--sb-border);
}

.nav-group.open .nav-children {
  max-height: 640px;
}

.nav-children a {
  display: block;
  padding: 6.5px 10px;
  margin: 0;
  border-radius: 6px;
  font-size: 12.6px;
  color: var(--sb-ink);
  opacity: .88;
  transition: background .15s, color .15s;
}

.nav-children a:hover {
  background: var(--sb-hover);
  color: var(--sb-ink-strong);
  opacity: 1;
}

.nav-children a.active {
  color: var(--sb-active-ink);
  font-weight: 600;
  opacity: 1;
}

.nav-sublabel {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--sb-muted);
  opacity: .85;
  padding: 9px 10px 4px;
}

.nav-sublabel:first-child {
  padding-top: 2px;
}

.nav-single {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  margin-bottom: 1px;
  font-size: 13.2px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--sb-ink);
  transition: background .15s, color .15s;
}

.nav-single:hover {
  background: var(--sb-hover);
  color: var(--sb-ink-strong);
}

.nav-single .icon-box {
  width: 17px;
  text-align: center;
  font-size: 13px;
  opacity: .85;
  flex-shrink: 0;
}

.nav-single .badge-count,
.nav-parent .badge-count {
  background: var(--red-600);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 99px;
  font-family: var(--font-num);
}

.nav-single .badge-count {
  margin-left: auto;
}

.nav-badge-soon {
  font-size: 5.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--amber-100);
  color: var(--amber-600);
  letter-spacing: .03em;
  margin-left: 6px;
}

.nav-single.active {
  background: var(--sb-active-bg);
  color: var(--sb-active-ink);
  box-shadow: inset 3px 0 0 var(--sb-accent);
}

.nav-single.active .icon-box {
  opacity: 1;
}

.nav-divider {
  height: 1px;
  background: var(--sb-sep);
  margin: 9px 7px;
}

.nav-label-group {
  font-size: 10px;
  color: var(--sb-muted);
  font-weight: 700;
  letter-spacing: .08em;
  padding: 12px 11px 5px;
  text-transform: uppercase;
}

/* ===== Main / Topbar ===== */
.main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 58px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 12px;
  position: sticky;
  top: 3px;
  z-index: 10;
  width: 100%;
}

.nav-toggle,
.theme-toggle {
  width: 33px;
  height: 33px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  flex-shrink: 0;
  transition: background-color .15s, color .15s, border-color .15s, transform .12s;
}

.nav-toggle:hover,
.theme-toggle:hover {
  background: var(--bg);
  color: var(--text-900);
}

.nav-toggle:active,
.theme-toggle:active {
  transform: scale(.92);
}

.theme-toggle.active {
  background: var(--navy-900);
  color: var(--gold-600);
  border-color: var(--navy-900);
}

.breadcrumb {
  font-size: 12.5px;
  color: var(--text-600);
}

.breadcrumb b {
  color: var(--text-900);
  font-weight: 600;
}

.search-box {
  flex: 1;
  max-width: 400px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7.5px 12px;
  color: var(--text-400);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--text-900);
  font-family: var(--font-ui);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-600);
  position: relative;
  background: transparent;
  font-size: 14px;
  transition: background-color .15s, color .15s, transform .12s;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text-900);
}

.icon-btn:active {
  transform: scale(.9);
}

.icon-btn.active {
  background: var(--blue-50);
  color: var(--blue-600);
}

.dot-alert {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red-600);
  border: 1.5px solid #fff;
}

.dot-alert::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--red-600);
  opacity: .6;
  animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}

@keyframes ping {
  0% {
    transform: scale(1);
    opacity: .6;
  }

  75%,
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

/* ===== Avatar (dùng chung: topbar user-chip, dòng bảng danh sách...) ===== */
.avatar {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--navy-800));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
}

.avatar-mini {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--navy-800);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-right: 8px;
  vertical-align: middle;
}

/* ===== User chip (nút tài khoản trên topbar) ===== */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4.5px 10px 4.5px 5px;
  border-radius: 99px;
  margin-left: 5px;
  background: var(--bg);
  cursor: pointer;
  transition: background-color .15s;
  border: 1px solid transparent;
}

.user-chip:hover {
  background: var(--border);
}

.user-chip.active {
  background: var(--blue-50);
  border-color: var(--blue-50);
}

.user-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.user-chip-role {
  font-size: 10.5px;
  color: var(--text-400);
}

.user-chip .chevron {
  transition: transform .15s;
}

.user-chip.active .chevron {
  transform: rotate(180deg);
}

.content {
  padding: 22px 22px 52px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  flex: 1;
}

/* ===== Page header (tiêu đề trang + hành động) ===== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -.01em;
}

.page-head .desc {
  font-size: 12.5px;
  color: var(--text-600);
}

.page-head .desc .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-600);
  display: inline-block;
  margin-right: 6px;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .35;
  }
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.segmented-control {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}

.segmented-control button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  color: var(--text-600);
  background: transparent;
  transition: background-color .15s, color .15s;
}

.segmented-control button:hover:not(.active) {
  background: var(--bg);
  color: var(--text-900);
}

.segmented-control button.active {
  background: var(--navy-900);
  color: #fff;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8.5px 15px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: filter .15s, transform .12s;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: scale(.97);
}

.btn-primary i {
  color: var(--gold-600);
}

.btn-ghost {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8.5px 13px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-600);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .12s;
  position: relative;
}

.btn-ghost[hidden] {
  display: none;
}

.btn-primary[hidden] {
  display: none;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-900);
}

.btn-ghost:active {
  transform: scale(.97);
}

.btn-ghost.active {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--blue-50);
}

/* ===== Panel (thẻ khung nội dung dùng chung) ===== */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-1-1 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s ease;
  margin-bottom: 16px;
}

.panel:hover {
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 4px;
}

.panel-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.panel-head .sub {
  font-size: 11.3px;
  color: var(--text-400);
  margin-top: 2px;
  font-weight: 400;
}

.panel-body {
  padding: 6px 18px 18px;
}

.link-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-600);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: gap .15s, color .15s;
}

.link-more:hover {
  color: var(--blue-700);
  gap: 8px;
}

/* ===== Bảng dữ liệu (table) dùng chung ===== */
table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-400);
  text-transform: uppercase;
  letter-spacing: .045em;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--divider);
  font-size: 12.8px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg);
  cursor: pointer;
}

.doc-code {
  font-weight: 700;
  color: var(--blue-700);
  font-family: var(--font-num);
  font-size: 12.3px;
  text-decoration: none;
}

.doc-code:hover {
  text-decoration: underline;
}

.doc-sub {
  font-size: 11.3px;
  color: var(--text-400);
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.6px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge.wait {
  background: var(--amber-100);
  color: var(--amber-600);
}

.badge.sign {
  background: var(--blue-50);
  color: var(--blue-600);
}

.badge.done {
  background: var(--green-100);
  color: var(--green-700);
}

.badge.cancel {
  background: var(--red-100);
  color: var(--red-700);
}

/* ===== Source tag — nhãn NGUỒN DỮ LIỆU ngăn chặn (KHÁC .badge trạng thái, xem rule-design.md §3) ===== */
.source-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.6px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
}

.source-tag.nhap-tay {
  background: var(--gray-100);
  color: var(--gray-600);
}

.source-tag.lgsp {
  background: var(--blue-50);
  color: var(--blue-600);
}

.source-tag.ndxp {
  background: var(--purple-100);
  color: var(--purple-600);
}

.source-tag.bo-cong-an {
  background: var(--orange-100);
  color: var(--orange-600);
}

/* ===== Bảng cuộn ngang trên màn hẹp, không vỡ layout ===== */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 600px;
}

/* ===== Dropdown / Popover dùng chung (thông báo, tài khoản, lịch chọn ngày) ===== */
.dropdown {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.dropdown-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Panel thông báo */
.notify-panel {
  width: 320px;
  padding: 6px 0;
}

.notify-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-900);
}

.notify-count-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue-600);
  background: var(--blue-50);
  padding: 2px 8px;
  border-radius: 99px;
}

.notify-item {
  display: flex;
  gap: 11px;
  padding: 10px 16px;
  border-top: 1px solid var(--divider);
  transition: background-color .12s;
}

.notify-item:hover {
  background: var(--bg);
}

.notify-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.notify-title {
  font-size: 12.3px;
  font-weight: 600;
  color: var(--text-900);
  line-height: 1.4;
}

.notify-time {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 2px;
}

.notify-item.unread .notify-title {
  position: relative;
  padding-right: 12px;
}

.notify-item.unread .notify-title::after {
  content: '';
  position: absolute;
  right: 0;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-600);
}

.notify-panel-footer {
  display: block;
  text-align: center;
  padding: 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-600);
  border-top: 1px solid var(--divider);
  margin-top: 2px;
}

.notify-panel-footer:hover {
  background: var(--bg);
  color: var(--blue-700);
}

/* Panel menu tài khoản */
.account-panel {
  width: 250px;
  padding: 8px 0;
}

.account-panel-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 16px 12px;
}

.account-name {
  font-size: 13px;
  font-weight: 700;
}

.account-role {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 1px;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  font-size: 12.8px;
  color: var(--text-600);
  font-weight: 500;
  transition: background-color .12s, color .12s;
}

.account-menu-item i {
  width: 15px;
  text-align: center;
  color: var(--text-400);
}

.account-menu-item:hover {
  background: var(--bg);
  color: var(--text-900);
}

.account-menu-item.danger {
  color: var(--red-700);
}

.account-menu-item.danger i {
  color: var(--red-700);
}

.account-menu-item.danger:hover {
  background: var(--red-100);
}

.account-menu-divider {
  height: 1px;
  background: var(--divider);
  margin: 6px 0;
}

/* Panel chọn khoảng ngày (mini lịch) */
.date-range-panel {
  width: 280px;
  padding: 14px;
  right: 0;
}

.notify-panel,
.account-panel,
.date-range-panel {
  max-width: calc(100vw - 24px);
}

.date-range-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.date-range-title {
  font-size: 12.8px;
  font-weight: 700;
}

.date-range-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-600);
  font-size: 11px;
  transition: background-color .12s;
}

.date-range-nav-btn:hover {
  background: var(--bg);
}

.date-range-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--text-400);
  font-weight: 700;
  margin-bottom: 4px;
}

.date-range-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-range-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--text-900);
  cursor: pointer;
  transition: background-color .12s, color .12s;
}

.date-range-day:hover {
  background: var(--bg);
}

.date-range-day.muted {
  color: var(--text-400);
  opacity: .5;
}

.date-range-day.in-range {
  background: var(--blue-50);
  border-radius: 0;
}

.date-range-day.range-start {
  background: var(--blue-600);
  color: #fff;
  border-radius: 7px 0 0 7px;
}

.date-range-day.range-end {
  background: var(--blue-600);
  color: #fff;
  border-radius: 0 7px 7px 0;
}

.date-range-day.today {
  box-shadow: inset 0 0 0 1.5px var(--gold-600);
}

.date-range-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.date-range-summary {
  font-size: 11px;
  color: var(--text-600);
  font-weight: 600;
}

.date-range-apply-btn {
  background: var(--navy-900);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 7px;
  transition: filter .15s;
}

.date-range-apply-btn:hover {
  filter: brightness(1.1);
}

/* ===== Date picker field (input + popover lịch, dùng chung mọi trang có lọc theo ngày) ===== */
.date-picker-field {
  position: relative;
}

.date-picker-field input {
  padding-right: 34px;
}

.filter-field .date-picker-field input {
  padding-right: 34px;
}

.date-picker-trigger {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-400);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}

.date-picker-trigger:hover {
  background: var(--bg);
  color: var(--blue-600);
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  width: 260px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s, visibility .15s;
}

.date-picker-popover.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.date-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.date-picker-title {
  font-size: 12.8px;
  font-weight: 700;
  color: var(--text-900);
}

.date-picker-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-600);
  font-size: 11px;
  border: none;
  background: none;
  cursor: pointer;
  transition: background-color .12s;
}

.date-picker-nav-btn:hover {
  background: var(--bg);
}

.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  color: var(--text-400);
  font-weight: 700;
  margin-bottom: 4px;
}

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--font-num);
  color: var(--text-900);
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background-color .12s;
}

.date-picker-cell:hover {
  background: var(--bg);
}

.date-picker-cell.muted {
  color: var(--text-400);
  opacity: .5;
  cursor: default;
}

.date-picker-cell.muted:hover {
  background: none;
}

.date-picker-cell.today {
  box-shadow: inset 0 0 0 1.5px var(--gold-600);
}

.date-picker-cell.selected {
  background: var(--blue-600);
  color: #fff;
}

.date-picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.date-picker-today-btn,
.date-picker-clear-btn {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--blue-700);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
}

.date-picker-today-btn:hover,
.date-picker-clear-btn:hover {
  text-decoration: underline;
}

.date-picker-clear-btn {
  color: var(--text-400);
}

/* ===== Toast (thông báo nổi, dùng chung cho MỌI trang — hành động lưu/xoá/gửi...) ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 100;
  background: var(--navy-900);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast i {
  color: var(--gold-600);
}

/* ===== Card picker (lưới chọn loại hợp đồng / mẫu hồ sơ...) dùng chung cho
   các bước của luồng Tạo hồ sơ (chọn loại → chọn mẫu → soạn hồ sơ) ===== */
.picker-panel-head {
  flex-wrap: wrap;
  gap: 12px;
}

.picker-search {
  flex: 0 0 auto;
  width: 280px;
  max-width: 100%;
}

.picker-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 46px 20px;
  color: var(--text-400);
}

.picker-empty.show {
  display: flex;
}

.picker-empty i {
  font-size: 26px;
  margin-bottom: 12px;
  opacity: .6;
}

.picker-empty-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-600);
  margin-bottom: 5px;
}

.picker-empty-sub {
  font-size: 12px;
}

.lookup-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 112px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-400);
  text-align: center
}

.lookup-state.safe-state {
  border-color: var(--green-600);
  background: var(--green-100);
  color: var(--green-700)
}

.picker-category {
  margin-top: 20px;
}

.picker-category:first-of-type {
  margin-top: 6px;
}

.picker-category.hidden {
  display: none;
}

.category-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-400);
  padding-bottom: 9px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.picker-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 15px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .12s, background-color .15s;
}

.picker-card.hidden {
  display: none;
}

.picker-card:hover {
  border-color: var(--blue-500);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.picker-card:active {
  transform: translateY(0) scale(.98);
}

.picker-card.selected {
  background: var(--blue-50);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-50);
}

.pc-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  margin-bottom: 10px;
  background: var(--bg);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background-color .15s, color .15s;
}

.picker-card.selected .pc-icon {
  background: var(--blue-600);
  color: #fff;
}

.pc-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-400);
  margin-bottom: 4px;
}

.picker-card.selected .pc-tag {
  color: var(--blue-700);
}

.pc-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-900);
  line-height: 1.35;
}

.pc-name.pc-name-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Thanh hành động dính đáy (chọn xong 1 mục / lưu form nhiều bước) ===== */
.action-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 120%);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(700px, calc(100vw - 32px));
  padding: 13px 16px 13px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
}

.action-bar.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.action-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-600);
  min-width: 0;
  flex: 1;
}

.action-bar-info i {
  color: var(--green-600);
  font-size: 16px;
  flex-shrink: 0;
}

.action-bar-label {
  flex-shrink: 0;
  white-space: nowrap;
}

/* .action-bar-info b: tên có thể rất dài (vd. tên biểu mẫu pháp lý đầy đủ) — phải là flex item
   riêng (không lồng trong <span>) để min-width:0 + ellipsis thực sự cắt được, không tràn đè lên nút */
.action-bar-info b {
  color: var(--text-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  min-width: 0;
  flex: 1;
}

.action-bar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

/* ===== Nút nổi: chèn mẫu soạn thảo trực tiếp (dùng ở mọi bước của luồng tạo hồ sơ) ===== */
.fab-insert-template {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: filter .15s, transform .18s, opacity .18s, visibility .18s;
}

.fab-insert-template i {
  color: var(--gold-600);
}

.fab-insert-template:hover {
  filter: brightness(1.08);
}

.fab-insert-template:active {
  transform: scale(.96);
}

.fab-insert-template.fab-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
}

/* ===== Modal (hộp thoại) dùng chung — vd. Thêm đương sự, Thêm tài sản ===== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(7, 20, 40, .5);
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .18s ease;
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: calc(100vw - 30%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98);
  transition: transform .18s ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-head h3 {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
  transition: background-color .12s, color .12s;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text-900);
}

.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.modal-tab {
  padding: 11px 4px;
  margin-right: 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-400);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.modal-tab:hover {
  color: var(--text-600);
}

.modal-tab.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-600);
}

.modal-tab-pane {
  display: none;
}

.modal-tab-pane.active {
  display: block;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ===== Form dọc dùng trong modal ===== */
.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 12.3px;
  font-weight: 600;
  color: var(--text-900);
  margin-bottom: 6px;
}

.form-field .hint {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 5px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font-ui);
  font-size: 12.8px;
  color: var(--text-900);
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled,
.form-field input[readonly],
.form-field textarea[readonly] {
  background-color: #eeeeee !important;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-50);
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 42px;
}

.password-toggle-eye {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-400);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.password-toggle-eye:hover {
  color: var(--text-600);
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.form-field .checkbox-wrap {
  display: flex;
}

.checkbox-wrap input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s, border-color .15s;
  flex-shrink: 0;
}

.checkbox-box i {
  font-size: 9.5px;
  color: #fff;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .12s, transform .12s;
}

.checkbox-wrap input:checked+.checkbox-box {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.checkbox-wrap input:checked+.checkbox-box i {
  opacity: 1;
  transform: scale(1);
}

.checkbox-wrap span {
  font-size: 12.5px;
  color: var(--text-600);
  font-weight: 500;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.form-field .toggle-switch {
  display: inline-flex;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 40px;
  border-radius: 999px;
  background: var(--border);
  transition: background-color .15s ease;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}

.toggle-switch input:checked+.toggle-track {
  background: var(--navy-800);
}

.toggle-switch input:checked+.toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.toggle-switch input:focus-visible+.toggle-track {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

.toggle-switch input:disabled+.toggle-track {
  opacity: .5;
  cursor: not-allowed;
}

.toggle-switch input:disabled~.toggle-label-text {
  opacity: .6;
}

.toggle-label-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-700);
}

.radio-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.form-field .radio-wrap {
  display: flex;
}

.radio-wrap input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  flex: 0 0 16px;
  position: relative;
  transition: border-color .12s, background .12s;
}

.radio-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  transition: transform .12s;
}

.radio-wrap input:checked+.radio-dot {
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.radio-wrap input:checked+.radio-dot::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-wrap span {
  font-size: 12.5px;
  color: var(--text-600);
  font-weight: 500;
}

.radio-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== Upload file dùng chung ===== */
.upload-dropzone {
  border: 1px dashed var(--blue-600);
  border-radius: var(--radius);
  background: var(--blue-50);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-600);
  cursor: pointer;
  transition: border-color .15s, background .15s
}

.upload-dropzone:hover,
.upload-dropzone:focus-within,
.upload-dropzone.is-dragging {
  border-color: var(--blue-700);
  background: var(--card)
}

.upload-dropzone .upload-icon {
  display: block;
  color: var(--blue-700);
  font-size: 34px;
  margin-bottom: 10px
}

.upload-dropzone p {
  margin: 0 0 14px;
  font-size: 13px
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg)
}

.selected-file-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 600;
  color: var(--text-900)
}

.selected-file-name i {
  color: var(--blue-700);
  font-size: 19px
}

.selected-file-name span {
  overflow-wrap: anywhere
}

.selected-file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

/* ===== Filter bar (dùng chung cho mọi trang danh sách/bảng dữ liệu) ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.filter-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-600);
  text-transform: uppercase;
  letter-spacing: .02em;
}

.filter-field select,
.filter-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-900);
  font: 500 13px var(--font-ui);
  height: 36px;
  width: 100%;
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-50);
}

.filter-field.grow {
  flex: 1 1 220px;
}

.filter-field.date-field {
  min-width: 135px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ===== Audit table dùng chung ===== */
.audit-table {
  min-width: 1180px;
  width: 100%;
  border-collapse: collapse
}

.audit-table th,
.audit-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top
}

.audit-table th {
  font-size: 11px;
  color: var(--text-600);
  text-transform: uppercase;
  letter-spacing: .025em;
  white-space: nowrap
}

.audit-table td {
  font-size: 12.5px;
  line-height: 1.5
}

.audit-table .actor {
  font-weight: 600;
  color: var(--text-900)
}

.audit-table .object-type {
  display: block;
  margin-bottom: 3px;
  color: var(--text-600);
  font-size: 11px
}

.audit-table .change-value {
  white-space: nowrap
}

.audit-table .ip-address {
  font-family: var(--font-num);
  font-size: 12px;
  white-space: nowrap
}

.list-summary {
  padding: 12px 16px;
  border-top: 1px solid var(--divider);
  font-size: 12px;
  color: var(--text-400)
}

.empty-row {
  text-align: center;
  color: var(--text-400);
  padding: 28px 12px !important
}

.activity-log-hint {
  display: block;
  margin: -8px 0 16px;
  color: var(--text-400);
  font-size: 11.5px;
  line-height: 1.55
}

.activity-log-filter .filter-field {
  flex: 1 1 170px
}

.activity-log-filter .filter-field.grow {
  flex: 2 1 250px
}

.module-tag.ho-so {
  background: var(--blue-50);
  color: var(--blue-700)
}

.module-tag.thu-chi {
  background: var(--gold-100);
  color: var(--gold-700)
}

.module-tag.ngan-chan {
  background: var(--orange-100);
  color: var(--orange-600)
}

.module-tag.he-thong {
  background: var(--gray-100);
  color: var(--navy-800)
}

.audit-table .object-code {
  font-family: var(--font-num);
  font-size: 12.3px;
  font-weight: 700;
  color: var(--text-600)
}

.audit-table .error-row {
  color: var(--red-700)
}

@media(max-width:1024px) {
  .activity-log-filter {
    align-items: stretch
  }
}

@media(max-width:640px) {
  .activity-log-filter .filter-field {
    min-width: 100%
  }

  .activity-log-filter .filter-actions {
    justify-content: flex-start;
    margin-left: 0
  }
}

/* ===== Sortable table header (dùng chung cho mọi bảng có cột sắp xếp được) ===== */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.th-sort i {
  font-size: 10px;
  color: var(--text-400);
}

.th-sort:hover i {
  color: var(--text-600);
}

.th-sort.asc i,
.th-sort.desc i {
  color: var(--blue-600);
}

/* ===== Pagination (dùng chung cho mọi bảng phân trang) ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 4px 4px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.page-info {
  color: var(--text-600);
  font-size: 12.5px;
}

.page-info .num {
  font-family: var(--font-num);
  color: var(--text-900);
  font-weight: 600;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-600);
  font: 600 12.5px var(--font-num);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--blue-600);
  color: var(--blue-700);
}

.page-btn.active {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ===== Utility dùng chung cho bảng dữ liệu ===== */
.text-center {
  text-align: center;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions>* {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.row-actions>*+* {
  margin-left: 6px;
}

.btn-xs {
  padding: 6px 10px;
  font-size: 11.5px;
}

.btn-danger-ghost {
  color: var(--red-700);
}

.btn-danger-ghost:hover {
  background: var(--red-100);
}

/* ===== Banner cảnh báo nổi bật cấp trang (dùng chung cho các trang có cảnh báo tuân thủ/pháp lý) ===== */
.notice-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--amber-100);
  border: 1px solid var(--amber-600);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.notice-banner-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .55);
  color: var(--amber-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.notice-banner-body {
  flex: 1;
}

.notice-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-900);
}

.notice-banner-desc {
  font-size: 12px;
  color: var(--text-600);
  margin-top: 3px;
  line-height: 1.5;
}

/* ===== Danh sách cảnh báo & ngăn chặn mới ===== */
.alert-item {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
  border-radius: 8px;
  transition: background-color .12s;
}

.alert-item:hover {
  background: var(--bg);
}

.alert-item:last-child {
  border-bottom: none;
}

.alert-ic {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.alert-title {
  font-size: 12.3px;
  font-weight: 600;
  line-height: 1.4;
}

.alert-meta {
  font-size: 11px;
  color: var(--text-400);
  margin-top: 3px;
}

/* ===== Khối trạng thái chờ phê duyệt dùng chung ===== */
.approval-limit {
  margin-top: 16px
}

.approval-limit .alert-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: default;
  padding: 12px
}

.approval-limit .alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none
}

.approval-limit.within .alert-item {
  border: 1px solid var(--green-600);
  background: var(--green-100)
}

.approval-limit.within .alert-icon {
  color: var(--green-700);
  background: var(--green-100)
}

.approval-message {
  font-weight: 600
}

/* ===== "Việc cần chú ý hôm nay" (dòng thống kê nhỏ) ===== */
.mini-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9.5px 4px;
  margin: 0 -4px;
  border-bottom: 1px solid var(--divider);
  font-size: 12.3px;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color .12s;
}

.mini-stat-row:hover {
  background: var(--bg);
}

.mini-stat-row:last-child {
  border-bottom: none;
}

.mini-stat-label {
  color: var(--text-600);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-stat-value {
  font-weight: 700;
}

/* ===== Footer ===== */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 16px 26px;
  flex-shrink: 0;
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  text-align: center;
  font-size: 12px;
  color: var(--text-400);
}

.footer-inner a {
  color: var(--blue-600);
  font-weight: 600;
}

.footer-inner a:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

/* ============================================================
   RESPONSIVE — Desktop lớn / Laptop / Tablet ngang / Tablet dọc / Mobile
   (phần khung trang; phần đặc thù từng trang nằm ở CSS riêng của trang đó)
   ============================================================ */

/* Laptop nhỏ / desktop hẹp */
@media (max-width:1300px) {

  .grid-2-1,
  .grid-1-1 {
    grid-template-columns: 1fr;
  }

  .picker-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Tablet ngang: sidebar chuyển sang overlay trượt, không chiếm layout */
@media (max-width:1024px) {
  .app {
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    height: 100vh;
    box-shadow: var(--shadow-md);
    transform: translateX(-100%);
    width: 280px;
    opacity: 1;
  }

  .sidebar-inner {
    position: static;
    height: 100%;
  }

  .app.mobile-open .sidebar {
    transform: translateX(0);
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    padding: 20px 18px 44px;
  }
}

/* Tablet dọc */
@media (max-width:820px) {
  .topbar {
    padding: 0 16px;
    gap: 9px;
  }

  .breadcrumb {
    display: none;
  }

  /* Chỉ ẩn nút chọn khoảng ngày (đã có segmented-control thay thế) — KHÔNG ẩn mọi .btn-ghost,
     vì .btn-ghost còn dùng cho hành động điều hướng quan trọng (vd. "Trở về") ở các trang khác */
  #dateBtn {
    display: none;
  }

  .page-head {
    gap: 12px;
  }

  .content {
    padding: 18px 16px 40px;
  }

  .picker-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .picker-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .picker-search {
    width: 100%;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width:640px) {
  .search-box {
    display: none;
  }

  .page-head h1 {
    font-size: 18px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .segmented-control {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .segmented-control button {
    white-space: nowrap;
  }

  .btn-primary {
    flex: 1;
    justify-content: center;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 14px 4px;
  }

  .panel-body {
    padding: 6px 14px 16px;
  }

  .grid-2-1,
  .grid-1-1 {
    gap: 12px;
    margin-bottom: 12px;
  }

  .content {
    padding: 14px 16px 34px;
  }

  .user-chip-name,
  .user-chip-role {
    display: none;
  }

  .user-chip {
    padding: 4px;
    background: transparent;
  }

  .picker-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }

  .picker-card {
    padding: 12px 12px 11px;
  }

  .pc-name {
    font-size: 12.3px;
  }

  .action-bar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: translateY(120%);
    width: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }

  .action-bar.show {
    transform: translateY(0);
  }

  .action-bar-actions {
    justify-content: stretch;
  }

  .action-bar-actions .btn-ghost,
  .action-bar-actions .btn-primary {
    flex: 1;
    justify-content: center;
  }

  .fab-insert-template {
    right: 16px;
    bottom: 16px;
    padding: 11px 16px;
    font-size: 12.5px;
  }

  .modal {
    max-width: 100%;
    max-height: calc(100vh - 24px);
  }

  .modal-backdrop {
    padding: 12px;
  }

  .filter-field {
    min-width: 0;
    flex: 1 1 100%;
  }

  .filter-field.grow {
    flex: 1 1 100%;
  }

  .filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .filter-actions .btn-primary,
  .filter-actions .btn-ghost {
    flex: 1;
  }

  .upload-dropzone {
    padding: 24px 14px
  }

  .selected-file-actions {
    width: 100%
  }

  .selected-file-actions .btn-ghost,
  .selected-file-actions .btn-primary {
    flex: 1
  }
}

/* Mobile nhỏ */
@media (max-width:400px) {
  .brand .sub {
    display: none;
  }

  .picker-grid {
    grid-template-columns: 1fr;
  }

  .fab-insert-template {
    padding: 11px 14px;
    font-size: 12px;
  }
}

/* ===== Page-level tabs (khác .modal-tabs — dùng cho tab NGOÀI modal, ở giữa trang) ===== */
.page-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}

.page-tab {
  padding: 10px 16px;
  font: 600 13px var(--font-ui);
  color: var(--text-600);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .12s, border-color .12s;
}

.page-tab:hover {
  color: var(--text-900);
}

.page-tab.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-600);
}

.page-tab .count-badge {
  background: var(--bg);
  color: var(--text-400);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

.page-tab.active .count-badge {
  background: var(--blue-50);
  color: var(--blue-700);
}

.page-tab-pane {
  display: none;
}

.page-tab-pane.active {
  display: block;
}

/* ===== Ô tìm kiếm nổi bật cấp trang (dùng cho các trang tra cứu/tìm kiếm tập trung) ===== */
.lookup-search-box {
  position: relative;
  margin-bottom: 20px;
}

.lookup-search-box i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-400);
  font-size: 16px;
}

.lookup-search-box input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-900);
}

.lookup-search-box input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-50);
}

/* ===== Dòng kết quả tra cứu (dùng chung cho mọi loại đối tượng tra cứu) ===== */
.lookup-result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--card);
}

.lookup-result-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.lookup-result-body {
  flex: 1;
  min-width: 0;
}

.lookup-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-900);
}

.lookup-result-meta {
  font-size: 11.5px;
  color: var(--text-600);
  margin-top: 2px;
  line-height: 1.5;
}

.lookup-result-link {
  flex-shrink: 0;
}

/* ===== Bộ chọn vai trò demo — lọc sidebar chỉ trong lần tải trang hiện tại ===== */
.role-switch-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0 10px;
}

.role-switch-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.role-switch-trigger.role-active {
  background: var(--blue-50);
  color: var(--blue-700);
}

.role-switch-trigger.role-active .role-switch-label {
  color: var(--blue-700);
}

.role-switch-panel {
  width: 280px;
  padding: 10px;
}

.role-switch-panel-header {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-900);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 6px;
}

.role-switch-demo-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--amber-100);
  color: var(--amber-600);
  letter-spacing: .03em;
}

.role-switch-panel-hint {
  font-size: 11px;
  color: var(--text-400);
  padding: 0 4px 8px;
  line-height: 1.5;
}

.role-switch-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 12.6px;
  color: var(--text-900);
  cursor: pointer;
  transition: background-color .15s;
}

.role-switch-item:hover {
  background: var(--bg);
}

.role-switch-item.active {
  background: var(--blue-50);
  color: var(--blue-700);
  font-weight: 600;
}

.role-switch-item-note {
  display: block;
  font-size: 10.5px;
  color: var(--text-400);
  font-weight: 400;
  margin-top: 1px;
}

@media(max-width:640px) {

  .role-switch-label,
  .btn-action-label {
    display: none;
  }
}

/* ===== Trang in ấn (dùng chung: phiếu yêu cầu công chứng, phiếu thu, phiếu chi) ===== */
.print-sheet {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--divider);
  box-shadow: var(--shadow-sm);
  padding: 38px 38px 52px;
  color: #25324a;
  font-family: "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.55
}

.print-office {
  text-align: center
}

.print-office strong {
  display: block;
  font-size: 18px
}

.print-office span {
  font-size: 13px
}

.print-title {
  text-align: center;
  margin: 25px 0 3px;
  font-size: 25px;
  line-height: 1.25
}

.print-number {
  text-align: center;
  font-weight: 700;
  margin-bottom: 6px
}

.print-date {
  text-align: center;
  margin-bottom: 25px
}

.print-meta {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 5px 12px;
  margin-bottom: 24px
}

.print-meta dt {
  font-weight: 700
}

.print-meta dd {
  margin: 0
}

.print-section-title {
  font-size: 16px;
  margin: 22px 0 9px
}

.print-table {
  width: 100%;
  border-collapse: collapse
}

.print-table th,
.print-table td {
  border: 1px solid #ccd2dc;
  padding: 7px 8px;
  vertical-align: top
}

.print-table th {
  background: #f3f5f8;
  text-align: left
}

.print-table .print-stt {
  width: 42px;
  text-align: center
}

.print-commitment {
  margin-top: 22px;
  text-align: justify
}

.print-amount-words {
  font-style: italic;
  margin: 8px 0 0
}

.print-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  text-align: center;
  margin-top: 42px;
  font-weight: 700
}

.print-signatures em {
  display: block;
  font-weight: 400;
  margin-top: 2px
}

.signature-space {
  height: 78px
}

.print-not-found {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-400)
}

@media(max-width:820px) {
  .print-sheet {
    padding: 24px 20px;
    overflow-x: auto
  }

  .print-title {
    font-size: 21px
  }

  .print-signatures {
    gap: 20px
  }
}

@media print {

  .sidebar,
  .topbar,
  .app-footer,
  .head-actions,
  .toast,
  .flag-ribbon,
  .nav-backdrop {
    display: none !important
  }

  .main {
    margin: 0 !important
  }

  .content {
    padding: 0 !important
  }

  .page-head {
    display: none !important
  }

  .print-page-wrap {
    margin: 0 !important
  }

  .print-sheet {
    max-width: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
    color: #000
  }

  .print-table th {
    background: #fff !important
  }

  @page {
    size: A4 portrait;
    margin: 14mm
  }
}