/* ==========================================================================
   Vietta HR — Stylesheet
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e6e9f0;
  --border-strong: #d5dae5;

  --text: #171b26;
  --text-2: #5a6478;
  --text-3: #8b95a8;

  --brand: #0369a1;
  --brand-600: #075985;
  --brand-50: #f0f9ff;
  --brand-100: #e0f2fe;

  --green: #059669;
  --green-bg: #ecfdf5;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #0369a1;
  --blue-bg: #f0f9ff;
  --violet: #0f766e;   /* teal — thay cho tím */
  --violet-bg: #f0fdfa;
  --slate: #475569;
  --slate-bg: #f1f5f9;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 12px rgba(16, 24, 40, .07);

  --sidebar-w: 248px;
  --header-h: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ============================ Layout ============================ */

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
}

.brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  display: grid; place-items: center;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(2, 132, 199, .32);
}
.brand-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.2px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: -2px; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-3);
  padding: 8px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 9.5px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .13s, color .13s;
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.nav-item:hover svg { color: var(--text-2); }
.nav-badge {
  margin-left: auto;
  background: var(--brand-100); color: var(--brand-600);
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}
.nav-item.active .nav-badge { background: var(--brand); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.header {
  height: var(--header-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}

.menu-btn { display: none; padding: 6px; border-radius: 8px; color: var(--text-2); }
.menu-btn:hover { background: var(--surface-2); }

/* ---------- Search ---------- */
.search-wrap { position: relative; flex: 1 1 auto; min-width: 0; max-width: 460px; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-box:focus-within {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .12);
}
.search-box svg { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.search-box input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 13.5px; min-width: 0;
}
.search-box input::placeholder { color: var(--text-3); }
.search-kbd {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  background: #fff; border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 5px; flex-shrink: 0;
}
.search-clear {
  color: var(--text-3); display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
}
.search-clear:hover { background: var(--border); color: var(--text); }

.search-results {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px; overflow-y: auto;
  z-index: 70;
  animation: dropIn .16s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.sr-head {
  padding: 9px 14px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  position: sticky; top: 0;
}
.sr-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; width: 100%; text-align: left;
  border-bottom: 1px solid #f2f4f8;
  transition: background .1s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.hl { background: var(--brand-50); }
.sr-info { min-width: 0; flex: 1; }
.sr-name { font-weight: 600; font-size: 13.5px; }
.sr-meta { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.sr-empty svg { width: 30px; height: 30px; margin-bottom: 7px; opacity: .5; }
mark { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- Header user ---------- */
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text-2);
  position: relative; transition: background .13s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid #fff;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px; border-radius: 30px;
  transition: background .13s;
}
.user-chip:hover { background: var(--surface-2); }
.user-name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.user-role { font-size: 11.5px; color: var(--text-3); line-height: 1.25; }


/* ============================ Dropdown header ============================ */
.hdr-wrap { position: relative; }

.dropdown {
  position: absolute; top: calc(100% + 9px); right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 80;
  animation: dropIn .15s ease;
  overflow: hidden;
}
.dd-notif { width: 380px; }
.dd-menu  { width: 246px; padding: 6px; }
.dd-user  { width: 268px; }

.dd-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.dd-title { font-weight: 650; font-size: 13.5px; }
.dd-head-action { margin-left: auto; }

.dd-body { max-height: 340px; overflow-y: auto; }

.dd-item {
  display: flex; align-items: flex-start; gap: 11px;
  width: 100%; text-align: left;
  padding: 11px 15px;
  border-bottom: 1px solid #f2f4f8;
  transition: background .12s;
}
.dd-item:last-child { border-bottom: none; }
.dd-item:hover { background: var(--surface-2); }
.dd-item.unread { background: var(--brand-50); }
.dd-item.unread:hover { background: var(--brand-100); }

.dd-ico {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0; margin-top: 1px;
}
.dd-ico svg { width: 16px; height: 16px; }
.dd-txt { min-width: 0; flex: 1; }
.dd-msg { font-size: 13px; line-height: 1.4; }
.dd-msg strong { font-weight: 650; }
.dd-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.dd-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); flex-shrink: 0; margin-top: 6px;
}

.dd-foot {
  padding: 9px 15px; border-top: 1px solid var(--border);
  background: var(--surface-2); text-align: center;
}

/* Mục menu dạng danh sách (cài đặt / user) */
.dd-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8.5px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: background .12s, color .12s;
}
.dd-row:hover { background: var(--surface-2); color: var(--text); }
.dd-row svg { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.dd-row:hover svg { color: var(--text-2); }
.dd-row.danger { color: var(--red); }
.dd-row.danger svg { color: var(--red); }
.dd-row.danger:hover { background: var(--red-bg); }
.dd-row .chk { margin-left: auto; color: var(--green); display: none; }
.dd-row.on .chk { display: block; }

.dd-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dd-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--text-3);
  padding: 8px 11px 5px;
}

/* Thẻ người dùng trong dropdown */
.dd-profile {
  display: flex; align-items: center; gap: 11px;
  padding: 15px; border-bottom: 1px solid var(--border);
}
.dd-profile-info { min-width: 0; }
.dd-profile-name { font-weight: 650; font-size: 14px; }
.dd-profile-mail { font-size: 12px; color: var(--text-3); }

.badge-count {
  background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 20px;
  display: inline-grid; place-items: center;
}

/* ---------- Page ---------- */
.page { padding: 24px; max-width: 1480px; }
.page-head { margin-bottom: 20px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
.page-desc { color: var(--text-2); font-size: 13.5px; margin: 3px 0 0; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8.5px 14px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  background: #fff; color: var(--text);
  transition: background .13s, border-color .13s, transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600;
  flex-shrink: 0;
  letter-spacing: -.2px;
  user-select: none;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12.5px; }
.avatar.xs { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; border: 3px solid #fff; box-shadow: var(--shadow); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-title { font-size: 14.5px; font-weight: 650; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin: 1px 0 0; }
.card-head-action { margin-left: auto; }
.link-btn {
  color: var(--brand); font-weight: 600; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px; border-radius: 7px; transition: background .13s;
}
.link-btn:hover { background: var(--brand-50); }
.link-btn svg { width: 14px; height: 14px; }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow .18s, transform .18s;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-value {
  font-size: 29px; font-weight: 700; letter-spacing: -1px;
  margin-top: 10px; line-height: 1.1;
}
.stat-foot {
  display: flex; align-items: center; gap: 5px;
  margin-top: 7px; font-size: 12px; color: var(--text-3);
}
.trend { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: ''; width: 5.5px; height: 5.5px;
  border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.badge.no-dot::before { display: none; }
.badge-green { background: var(--green-bg); color: var(--green); border-color: #a7f3d0; }
.badge-blue  { background: var(--blue-bg);  color: var(--blue);  border-color: #bae6fd; }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; }
.badge-red   { background: var(--red-bg);   color: var(--red);   border-color: #fecaca; }
.badge-violet{ background: var(--violet-bg);color: var(--violet);border-color: #99f6e4; }
.badge-slate { background: var(--slate-bg); color: var(--slate); border-color: #e2e8f0; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Trên desktop bảng co theo card; chỉ ép chiều rộng tối thiểu ở màn hình hẹp
   (quy tắc mobile nằm trong @media 880px bên dưới) */
.table-wrap > table { min-width: 100%; }

/* Cột dài được phép xuống dòng / cắt bớt thay vì đẩy bảng tràn ra ngoài */
/* Tên tài liệu dài phải cắt bớt, nếu không sẽ đẩy bảng rộng ra */
.cell-person .n { overflow: hidden; text-overflow: ellipsis; }
.cell-email {
  max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Màn hình trung bình: ẩn dần các cột phụ để cột thao tác luôn nhìn thấy */
@media (max-width: 1400px) { .col-contract { display: none; } }
@media (max-width: 1180px) { .col-dept { display: none; } }
@media (max-width: 1020px) { .col-join { display: none; } }
th.col-action, td.col-action {
  width: 1%; white-space: nowrap; text-align: right;
  padding-left: 8px; padding-right: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11.5px; font-weight: 650;
  letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid #f2f4f8; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--text-2); }
.cell-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; color: var(--text-2); }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person .n { font-weight: 600; line-height: 1.3; }
.cell-person .s { font-size: 12px; color: var(--text-3); line-height: 1.3; }
.nowrap { white-space: nowrap; }

.row-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--brand);
  white-space: nowrap;
  transition: background .13s;
}
.row-action svg { width: 14px; height: 14px; flex-shrink: 0; }
.row-action:hover { background: var(--brand-50); }

.empty-state { padding: 52px 20px; text-align: center; color: var(--text-3); }
.empty-state svg { width: 40px; height: 40px; opacity: .45; margin-bottom: 10px; }
.empty-state p { margin: 0 0 3px; font-weight: 600; color: var(--text-2); font-size: 14px; }
.empty-state span { font-size: 13px; }

/* Chế độ bảng gọn — bật từ menu Cài đặt */
.compact-tables tbody td { padding: 7px 16px; }
.compact-tables thead th { padding: 8px 16px; }
.compact-tables .cell-person .s { display: none; }

/* ---------- Filters ---------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  align-items: center;
}
.field { position: relative; display: flex; align-items: center; }
.field > svg {
  position: absolute; left: 11px;
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.field input {
  height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff; outline: none; min-width: 210px;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(79,70,229,.12); }
select {
  height: 38px; padding: 0 32px 0 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 15px;
  appearance: none; outline: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  transition: border-color .15s, box-shadow .15s;
}
select:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(79,70,229,.12); }
.filter-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.filter-reset {
  font-size: 12.5px; font-weight: 600; color: var(--brand);
  padding: 7px 10px; border-radius: 7px;
}
.filter-reset:hover { background: var(--brand-50); }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
/* min-width:0 cho phép .table-wrap bên trong cuộn thay vì kéo giãn cả layout */
.grid-2 > *, .grid-2-1 > * { min-width: 0; }
.mb-20 { margin-bottom: 20px; }

/* ---------- Charts ---------- */
.chart-body { padding: 20px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
/* SVG viewBox rộng 640 sẽ bị kéo cao khi card full-width — giới hạn lại */
.chart-svg.tall { max-height: 300px; margin: 0 auto; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { color: var(--text-2); }
.legend-val { margin-left: auto; font-weight: 650; }
.legend-pct { color: var(--text-3); font-size: 12px; width: 40px; text-align: right; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 128px; font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.bar-track { flex: 1; height: 26px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 7px;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 9px; color: #fff; font-size: 12px; font-weight: 700;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.bar-val { width: 34px; text-align: right; font-weight: 650; font-size: 13px; flex-shrink: 0; }

/* ---------- Profile ---------- */
.profile-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.profile-cover { height: 88px; background: linear-gradient(120deg, #0284c7, #0369a1 52%, #0f766e); }
.profile-main { padding: 0 24px 20px; display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.profile-avatar-wrap { margin-top: -42px; }
.profile-id { flex: 1; min-width: 240px; padding-bottom: 2px; }
.profile-name { font-size: 21px; font-weight: 700; letter-spacing: -.4px; margin: 0; }
.profile-role { color: var(--text-2); font-size: 14px; margin: 2px 0 8px; }
.profile-tags { display: flex; gap: 7px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 8px; padding-bottom: 4px; }

.quick-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1px solid var(--border);
}
.qf { padding: 14px 24px; border-right: 1px solid var(--border); }
.qf:last-child { border-right: none; }
.qf-label { font-size: 11.5px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.qf-label svg { width: 13px; height: 13px; }
.qf-value { font-weight: 600; margin-top: 3px; font-size: 13.5px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; overflow-x: auto; }
.tab {
  padding: 13px 15px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color .13s, border-color .13s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab svg { width: 16px; height: 16px; }
.tab-count {
  background: var(--surface-2); color: var(--text-2);
  font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; border: 1px solid var(--border);
}
.tab.active .tab-count { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }

.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px; background: var(--border);
}
.info-item { background: #fff; padding: 15px 20px; }
.info-label { font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.info-value { font-weight: 550; font-size: 13.5px; word-break: break-word; }
.info-value.link { color: var(--brand); }

.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-3);
  padding: 15px 20px 9px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

/* ---------- Document card ---------- */
.doc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px; padding: 20px;
}
.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; gap: 12px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  background: #fff;
}
.doc-card:hover { border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); }
.file-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.file-icon svg { width: 21px; height: 21px; }
.doc-info { min-width: 0; flex: 1; }
.doc-name {
  font-weight: 600; font-size: 13.5px; line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-meta { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.doc-foot { display: flex; align-items: center; gap: 8px; }
.doc-view {
  margin-left: auto;
  padding: 4px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600;
  color: var(--brand); background: var(--brand-50);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .13s;
}
.doc-view:hover { background: var(--brand-100); }
.doc-view svg { width: 14px; height: 14px; }

/* ---------- Timeline ---------- */
.timeline { padding: 20px 24px; }
.tl-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border);
}
.tl-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0; z-index: 1;
}
.tl-dot svg { width: 15px; height: 15px; }
.tl-body { padding-top: 4px; }
.tl-title { font-weight: 600; font-size: 13.5px; }
.tl-date { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.tl-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16, 24, 40, .55);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  z-index: 100; padding: 24px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 780px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: popIn .2s cubic-bezier(.34,1.4,.64,1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 650; margin: 0; line-height: 1.35; }
.modal-sub { font-size: 12.5px; color: var(--text-3); margin: 1px 0 0; }
.modal-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-3); flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close svg { width: 17px; height: 17px; }
.modal-body { overflow-y: auto; background: #eef0f5; padding: 24px; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
  background: var(--surface-2);
}
.modal-foot .spacer { flex: 1; }

/* Trang preview giả lập PDF */
.pdf-page {
  background: #fff; border-radius: 4px;
  box-shadow: 0 3px 14px rgba(16,24,40,.14);
  padding: 40px 44px;
  max-width: 620px; margin: 0 auto;
  font-size: 12.5px; color: #2b3245; line-height: 1.65;
  min-height: 500px;
}
.pdf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid #1f2937; padding-bottom: 14px; margin-bottom: 20px; }
.pdf-co { font-weight: 700; font-size: 14px; letter-spacing: -.2px; }
.pdf-co-sub { font-size: 11px; color: #6b7280; margin-top: 2px; }
.pdf-stamp {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  border: 2px solid var(--green); color: var(--green);
  padding: 5px 10px; border-radius: 5px; transform: rotate(-4deg);
  text-transform: uppercase; white-space: nowrap;
}
.pdf-stamp.expired { border-color: var(--red); color: var(--red); }
.pdf-stamp.soon { border-color: var(--amber); color: var(--amber); }
.pdf-title { text-align: center; font-size: 17px; font-weight: 700; margin: 22px 0 4px; text-transform: uppercase; letter-spacing: .3px; }
.pdf-subtitle { text-align: center; font-size: 11.5px; color: #6b7280; margin-bottom: 24px; font-style: italic; }
.pdf-section { font-weight: 700; margin: 18px 0 7px; font-size: 12.5px; }
.pdf-row { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dotted #e5e7eb; }
.pdf-row .k { width: 168px; color: #6b7280; flex-shrink: 0; }
.pdf-row .v { font-weight: 600; }
.pdf-para { margin: 9px 0; text-align: justify; }
.pdf-sign { display: flex; justify-content: space-between; margin-top: 40px; gap: 30px; text-align: center; }
.pdf-sign > div { flex: 1; }
.pdf-sign .role { font-weight: 700; font-size: 11.5px; text-transform: uppercase; }
.pdf-sign .hint { font-size: 10.5px; color: #9ca3af; font-style: italic; margin-top: 2px; }
.pdf-sign .who { margin-top: 46px; font-weight: 600; }
.pdf-foot { margin-top: 26px; padding-top: 12px; border-top: 1px solid #e5e7eb; display: flex; justify-content: space-between; font-size: 10.5px; color: #9ca3af; }
.pdf-photo {
  width: 96px; height: 128px; border: 1px solid #d1d5db; border-radius: 4px;
  display: grid; place-items: center; float: right; margin: 0 0 12px 16px;
  background: var(--surface-2); color: #9ca3af; font-size: 10.5px; text-align: center;
}
.pdf-seal {
  width: 96px; height: 96px; border-radius: 50%;
  border: 2.5px dashed rgba(220,38,38,.4); color: rgba(220,38,38,.65);
  display: grid; place-items: center; text-align: center;
  font-size: 9.5px; font-weight: 700; line-height: 1.3;
  margin: 12px auto 0; transform: rotate(-8deg);
}

/* ---------- Toast ---------- */
.toast-zone {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 9px;
  z-index: 200;
}
.toast {
  background: #171b26; color: #fff;
  padding: 11px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s cubic-bezier(.34,1.4,.64,1);
  max-width: 360px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; color: #34d399; }

/* ---------- Misc ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; }
.breadcrumb button { color: var(--text-2); font-weight: 500; }
.breadcrumb button:hover { color: var(--brand); }
.breadcrumb svg { width: 13px; height: 13px; }

.progress-mini { height: 5px; background: var(--surface-2); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.progress-mini > div { height: 100%; border-radius: 10px; transition: width .5s ease; }

.scrim { display: none; }

/* ============================ Responsive ============================ */
@media (max-width: 1100px) {
  .grid-2, .grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; place-items: center; }
  /* Chỉ hiện khi sidebar mở — trước đây display:block vô điều kiện chặn mọi click */
  .sidebar.open ~ .scrim { display: block; }
  .scrim { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 55; animation: fadeIn .16s; }
  .page { padding: 16px; }
  .header { padding: 0 14px; gap: 10px; }
  .search-kbd { display: none; }
  .user-meta { display: none; }
  /* Trên mobile neo dropdown theo viewport để không lệch ra ngoài mép */
  .hdr-wrap { position: static; }
  .header-right { position: relative; }
  .dropdown { right: 0; left: auto; }
  .dd-notif { width: calc(100vw - 28px); max-width: 380px; right: -8px; }
  .dd-user, .dd-menu { width: 236px; }
  .qf { border-right: none; border-bottom: 1px solid var(--border); }
  .modal-body { padding: 14px; }
  .pdf-page { padding: 26px 22px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .stat-value { font-size: 24px; }
  .page-title { font-size: 19px; }
  .bar-label { width: 92px; font-size: 12px; }
  .doc-grid { grid-template-columns: 1fr; padding: 14px; }
  .profile-main { padding: 0 16px 16px; }
  .filter-bar { padding: 12px 14px; }
  .table-wrap > table { min-width: 560px; }
  .cell-email { max-width: 150px; }
  .field input { min-width: 0; width: 100%; }
  .field { flex: 1 1 100%; }
  select { flex: 1 1 calc(50% - 5px); }
}
