/* ============================================ */
/* NOHU OA — Refined Theme (v3)                 */
/* Tối: than chì + xanh ngọc · Sáng: giấy + đồng */
/* ============================================ */
:root {
  --bg: #0e1116; --sf: #0a0d12; --card: #13171e; --card2: #1a2029;
  --bdr: #1f2630; --bdr2: #2a323d;
  --tx: #e8eaed; --tx2: #b4bbc6; --mu: #6b7480;
  --ac: #f0883e; --acL: #f59e5e; --acG: #f0883e;
  --ok: #f0883e; --okG: #f0883e;
  --no: #e06b6b; --noG: #e06b6b;
  --wr: #e0a23b; --wrG: #e0a23b;
  --cyan: #f0883e; --pink: #d4537e; --purple: #8b85d6;
  --fo: 'Be Vietnam Pro', system-ui, sans-serif;
  --fd: 'Be Vietnam Pro', system-ui, sans-serif;
  --fm: 'Inter', system-ui, sans-serif;
  --fcode: 'Roboto Mono', monospace;
  --glass: rgba(255,255,255,0.03);
  --glow: 0 0 0 1px var(--bdr);
  --shadow: 0 8px 30px -14px rgba(0,0,0,0.5);
  --shadow-sm: 0 3px 12px -6px rgba(0,0,0,0.4);
  --radius: 13px;
  --t: cubic-bezier(.4,0,.2,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--tx); font-family: var(--fo); font-size: 14px; overflow: hidden;
  -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
body::before { content: none; }
a { color: var(--acL); text-decoration: none; transition: color .2s var(--t); }
a:hover { color: var(--ac); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bdr2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--mu); }

.app-layout { display: flex; height: 100vh; height: 100dvh; position: relative; z-index: 1; }
.sidebar {
  width: 232px; background: linear-gradient(185deg, rgba(15,19,28,0.95) 0%, rgba(8,11,18,0.98) 100%);
  border-right: 1px solid var(--bdr); display: flex; flex-direction: column; flex-shrink: 0;
  position: relative; backdrop-filter: blur(12px);
}
.sidebar::after { content: none; }
.main-content { flex: 1; overflow: auto; display: flex; flex-direction: column; background: transparent; }

.sidebar-brand { padding: 20px 18px; border-bottom: 1px solid var(--bdr); display: flex; align-items: center; gap: 11px; }
.brand-icon { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #f59e0b, #ef4444 55%, #ec4899); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; color: #fff; font-family: var(--fm); flex-shrink: 0; box-shadow: 0 6px 18px -4px rgba(245,158,11,0.5); }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--fd); }
.brand-sub { font-size: 9.5px; color: var(--mu); font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.brand-text { line-height: 1.25; }
.sidebar-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; margin-bottom: 3px;
  font-size: 13.5px; font-weight: 500; color: var(--mu); transition: all .25s var(--t); position: relative;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--glass); color: var(--tx2); transform: translateX(2px); }
.nav-item.active {
  background: rgba(240,136,62,0.12);
  color: #fff; font-weight: 600; border-color: rgba(240,136,62,0.2);
  box-shadow: none;
}
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 18%; height: 64%; width: 2px; background: var(--ac); }
/* Huy hiệu đỏ trên menu (đơn chờ duyệt) */
.nav-badge {
  margin-left: auto; background:#ef4444; color:#fff; border-radius:20px;
  min-width:19px; height:19px; display:inline-flex; align-items:center; justify-content:center;
  padding:0 6px; font-size:11px; font-weight:800; line-height:1;
  box-shadow:0 0 0 0 rgba(239,68,68,0.6); animation:navBadgePulse 1.9s infinite;
}
@keyframes navBadgePulse {
  0% { box-shadow:0 0 0 0 rgba(239,68,68,0.5); }
  70% { box-shadow:0 0 0 6px rgba(239,68,68,0); }
  100% { box-shadow:0 0 0 0 rgba(239,68,68,0); }
}
.nav-icon { font-size: 17px; filter: saturate(1.1); }
.sidebar-user { padding: 14px; border-top: 1px solid var(--bdr); display: flex; align-items: center; gap: 9px; transition: background .2s var(--t); border-radius: 12px; margin: 6px; }
.sidebar-user:hover { background: var(--glass); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-changepw, .btn-logout { display: block; margin: 0 12px 6px; padding: 9px; border-radius: 10px; border: 1px solid var(--bdr); text-align: center; font-size: 12px; font-weight: 600; transition: all .25s var(--t); background: transparent; }
.btn-changepw { color: var(--acL); }
.btn-changepw:hover { background: rgba(240,136,62,0.1); border-color: rgba(240,136,62,0.3); transform: translateY(-1px); }
.btn-logout { color: var(--no); margin-bottom: 12px; }
.btn-logout:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); transform: translateY(-1px); }

.topbar { padding: 13px 26px; border-bottom: 1px solid var(--bdr); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(90deg, rgba(12,16,25,0.7), transparent); flex-shrink: 0; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 100; }
.breadcrumb { font-size: 12px; color: var(--mu); font-weight: 500; }
.breadcrumb b { color: var(--tx); font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: 12px; color: var(--mu); font-family: var(--fm); }

.lang-switch, .login-lang { display: flex; gap: 2px; background: var(--card); border-radius: 11px; padding: 3px; border: 1px solid var(--bdr); }
.lang-btn { padding: 5px 11px; border-radius: 8px; border: none; background: transparent; color: var(--mu); font-size: 13px; cursor: pointer; font-weight: 700; transition: all .25s var(--t); }
.lang-btn.active { background: var(--ac); color: #2a1404; box-shadow: none; }
.login-lang { position: absolute; top: 16px; right: 16px; }

.page-content { padding: 26px; flex: 1; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 23px; font-weight: 800; margin: 0; letter-spacing: -0.6px; font-family: var(--fd); }
.page-header p { font-size: 12.5px; }

.card {
  background: linear-gradient(160deg, var(--card), rgba(17,21,31,0.6));
  border-radius: var(--radius); padding: 20px; border: 1px solid var(--bdr);
  transition: all .3s var(--t); box-shadow: var(--shadow-sm); position: relative;
}
.card:hover { border-color: var(--bdr2); }
.card h4 { margin: 0 0 12px; font-size: 14px; font-weight: 700; font-family: var(--fd); }

.stats-grid { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stats-grid > .au-widget { flex: 1 1 150px; }
.stat-card {
  background: linear-gradient(160deg, var(--card), rgba(17,21,31,0.5));
  border-radius: var(--radius); padding: 18px 20px; border: 1px solid var(--bdr);
  flex: 1 1 140px; min-width: 130px; display: flex; justify-content: space-between; align-items: flex-start;
  transition: all .35s var(--t); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after { content: none; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--glow); border-color: var(--bdr2); }
.stat-card:hover::after { opacity: 1; }
.stat-label { font-size: 12px; color: var(--mu); margin-bottom: 7px; font-weight: 600; }
.stat-value { font-size: 27px; font-weight: 800; font-family: var(--fm); letter-spacing: -0.5px; }
.stat-sub { font-size: 11px; color: var(--mu); margin-top: 4px; }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04); }
.stat-icon:empty { display: none; }
.stats-grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 9px; }

/* ===== ArchitectUI gradient stat widgets ===== */
.au-widget {
  position: relative; overflow: hidden;
  border-radius: 14px; padding: 16px 16px 14px;
  color: #fff; border: none;
  box-shadow: 0 6px 18px -8px rgba(0,0,0,0.45);
  transition: transform .25s var(--t), box-shadow .25s var(--t);
  min-height: 92px; display: flex; flex-direction: column; justify-content: space-between;
}
.au-widget:hover { transform: translateY(-3px); box-shadow: 0 12px 26px -10px rgba(0,0,0,0.5); }
.au-widget .au-label { font-size: 12px; font-weight: 600; opacity: 0.92; line-height: 1.3; letter-spacing: .2px; position: relative; z-index: 2; }
.au-widget .au-value { font-size: 28px; font-weight: 800; font-family: var(--fm); letter-spacing: -0.5px; position: relative; z-index: 2; }
.au-widget .au-sub { font-size: 10.5px; font-weight: 600; opacity: 0.82; position: relative; z-index: 2; margin-top: 1px; }
.au-widget .au-ic {
  position: absolute; right: -6px; bottom: -10px; font-size: 58px; opacity: 0.16;
  z-index: 1; transform: rotate(-8deg); pointer-events: none;
}
/* dải sáng chéo kiểu ArchitectUI */
.au-widget::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 55%);
}
/* các tông gradient */
.au-blue   { background: linear-gradient(135deg, #2b5876, #4e4376); }
.au-orange { background: linear-gradient(135deg, #f7971e, #ff3c00); }
.au-green  { background: linear-gradient(135deg, #11998e, #38ef7d); }
.au-purple { background: linear-gradient(135deg, #6a11cb, #2575fc); }
.au-pink   { background: linear-gradient(135deg, #ee0979, #ff6a00); }
.au-teal   { background: linear-gradient(135deg, #0093E9, #80D0C7); }
.au-slate  { background: linear-gradient(135deg, #434343, #000000); }
.au-red    { background: linear-gradient(135deg, #cb2d3e, #ef473a); }
.au-copper { background: linear-gradient(135deg, #b87333, #7c4a1e); }
.au-skyblue{ background: linear-gradient(135deg, #2193b0, #1565c0); }

/* badge ca trên nền gradient (nền trắng mờ, chữ trắng) */
.au-widget .au-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 8px;
  background: rgba(255,255,255,0.22); color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
  position: relative; z-index: 2; backdrop-filter: blur(2px);
}

/* ô có LÁ CỜ thật: cờ phủ KÍN ô (tràn hết, không còn khoảng đen), sáng màu, chỉ phủ tối nhẹ bên trái cho chữ */
.au-flag {
  background-color: #1c2128;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;          /* cờ lấp đầy toàn ô */
  position: relative;
  aspect-ratio: 3 / 2;             /* khớp tỉ lệ lá cờ -> không cắt mất phần nào */
  min-height: 0;                   /* bỏ chiều cao tối thiểu của au-widget */
}
.au-flag::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  /* viền tối rất nhẹ quanh mép cho lá cờ đỡ chói, KHÔNG phủ vệt đen lên cờ */
  box-shadow: inset 0 0 24px rgba(0,0,0,0.28);
}
.au-flag .au-label {
  background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 8px;
}
.au-flag .au-sub {
  display: inline-block; background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 8px;
}
.au-flag .au-value {
  background: rgba(0,0,0,0.5); padding: 1px 8px; border-radius: 8px;
}
/* hàng quốc tịch: ô nhỏ gọn lại, vẫn thấy trọn lá cờ */
.nat-grid > .au-flag { flex: 0 1 200px; padding: 11px 12px; justify-content: flex-start; }

/* thẻ có badge con: thân tối, viền trái gradient + số tổng nổi */
.au-tile { position: relative; padding: 11px 13px 11px 16px; border-radius: 12px; background: var(--sf); border: 1px solid var(--bdr); transition: all .25s var(--t); overflow: hidden; }
.au-tile::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 4px 0 0 4px; }
.au-tile:hover { border-color: var(--bdr2); transform: translateY(-2px); }
.au-tile .au-tile-val { font-size: 19px; font-weight: 800; font-family: var(--fm); }
.au-t-blue::before   { background: linear-gradient(180deg,#2b5876,#4e4376); }
.au-t-orange::before { background: linear-gradient(180deg,#f7971e,#ff3c00); }
.au-t-green::before  { background: linear-gradient(180deg,#11998e,#38ef7d); }
.au-t-purple::before { background: linear-gradient(180deg,#6a11cb,#2575fc); }
.au-t-pink::before   { background: linear-gradient(180deg,#ee0979,#ff6a00); }
.au-t-teal::before   { background: linear-gradient(180deg,#0093E9,#80D0C7); }
.au-t-red::before    { background: linear-gradient(180deg,#cb2d3e,#ef473a); }
.au-t-slate::before  { background: linear-gradient(180deg,#434343,#888); }
.mini-stat { padding: 11px 13px; border-radius: 12px; background: var(--sf); border: 1px solid var(--bdr); transition: all .25s var(--t); }
.mini-stat:hover { border-color: var(--bdr2); transform: translateY(-2px); }
.mini-stat-name { font-size: 13px; font-weight: 700; color: var(--cyan); }
.mini-stat-val { font-size: 11px; color: var(--mu); }

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

.avatar-sm, .user-avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; font-family: var(--fm); flex-shrink: 0; box-shadow: 0 2px 8px -2px rgba(0,0,0,0.4); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; border: 1px solid; letter-spacing: 0.2px; }
.badge-sm { font-size: 10px; padding: 2px 7px; }
.badge-dai { background: rgba(240,136,62,0.1); color: var(--cyan); border-color: rgba(240,136,62,0.25); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; box-shadow: 0 0 8px currentColor; }

.list-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; background: var(--sf); margin-bottom: 5px; border: 1px solid var(--bdr); transition: all .25s var(--t); }
.list-item:hover { border-color: var(--bdr2); background: var(--card2); transform: translateX(2px); }
.list-item-info { flex: 1; }
.list-item-name { font-size: 12px; font-weight: 600; }

.chip-group { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 5px 9px; border-radius: 9px; background: var(--sf); border: 1px solid var(--bdr); font-size: 11px; transition: all .25s var(--t); }
.chip:hover { border-color: var(--bdr2); background: var(--card2); }

.data-table { width: 100%; border-collapse: collapse; font-family: var(--fo); }
.data-table th { padding: 11px 9px; text-align: left; font-size: 10px; font-weight: 700; color: var(--mu); text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--bdr); letter-spacing: 0.6px; }
.data-table td { padding: 9px; border-bottom: 1px solid rgba(28,35,52,0.5); font-size: 12px; }
.data-table tbody tr { transition: background .18s var(--t); }
.data-table tbody tr:hover { background: rgba(240,136,62,0.05); }
.data-table .total-row { border-top: 2px solid var(--bdr2); background: rgba(240,136,62,0.04); }
.data-table .total-row td { padding: 13px 9px; }
.salary-table { width: 100%; }
.salary-table th { text-align: right; padding: 11px 9px !important; }
.salary-table td { text-align: right; padding: 9px !important; white-space: nowrap; font-family: var(--fm); font-size: 12px; }
.salary-table th:first-child, .salary-table td:first-child { text-align: left; min-width: 90px; white-space: normal; font-family: var(--fo); }
.salary-table th:nth-child(2), .salary-table td:nth-child(2) { text-align: center; font-family: var(--fo); }
.actions { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.btn { padding: 9px 19px; border-radius: 11px; border: none; font-size: 13px; font-weight: 700; font-family: var(--fo); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .25s var(--t); position: relative; overflow: hidden; letter-spacing: -0.01em; }
.btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.14), transparent 60%); opacity: 0; transition: opacity .25s var(--t); }
.btn:hover { transform: translateY(-2px); }
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ac); color: #2a1404; font-weight: 600; box-shadow: none; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-success { background: var(--okG); color: #fff; box-shadow: 0 4px 14px -4px rgba(16,185,129,0.5); }
.btn-success:hover { box-shadow: 0 8px 22px -6px rgba(16,185,129,0.6); }
.btn-danger { background: var(--noG); color: #fff; box-shadow: 0 4px 14px -4px rgba(239,68,68,0.5); }
.btn-danger:hover { box-shadow: 0 8px 22px -6px rgba(239,68,68,0.6); }
.btn-warn { background: var(--wrG); color: #fff; box-shadow: 0 4px 14px -4px rgba(245,158,11,0.5); }
.btn-warn:hover { box-shadow: 0 8px 22px -6px rgba(245,158,11,0.6); }
.btn-ghost { background: var(--glass); color: var(--tx2); border: 1px solid var(--bdr); }
.btn-ghost:hover { border-color: var(--bdr2); color: var(--tx); background: var(--card2); }
.btn-sm { padding: 6px 13px; font-size: 11px; border-radius: 9px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { background: var(--glass); border: 1px solid var(--bdr); border-radius: 9px; padding: 5px 9px; cursor: pointer; font-size: 12px; color: var(--mu); transition: all .25s var(--t); }
.btn-icon:hover { background: var(--card2); border-color: var(--bdr2); color: var(--tx); transform: translateY(-1px); }

.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 11px; color: var(--mu); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input, .form-group select, .form-group textarea, .filter-input, .filter-select, .form-control {
  width: 100%; padding: 11px 14px; border-radius: 11px; border: 1px solid var(--bdr);
  background: var(--bg); color: var(--tx); font-size: 13px; font-family: var(--fo); outline: none; transition: all .25s var(--t);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .form-control:focus, .filter-input:focus, .filter-select:focus {
  border-color: var(--ac); box-shadow: 0 0 0 3px rgba(240,136,62,0.14); background: var(--sf);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.input-sm { padding: 6px 11px !important; border-radius: 9px !important; font-size: 12px !important; }

.filter-bar { display: flex; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; padding: 13px 15px; border-radius: 14px; background: linear-gradient(160deg, var(--card), rgba(17,21,31,0.5)); border: 1px solid var(--bdr); box-shadow: var(--shadow-sm); }
.filter-input { flex: 1 1 140px; }
.filter-select { width: auto; cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .25s var(--t); }
.modal-box { background: var(--card); border-radius: 14px; width: 520px; max-width: 96vw; max-height: 88vh; border: 1px solid var(--bdr2); box-shadow: var(--shadow); overflow: auto; animation: modalIn .3s var(--t); }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--bdr); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--sf); z-index: 1; }
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; font-family: var(--fd); }
.modal-close { background: var(--glass); border: 1px solid var(--bdr); color: var(--mu); font-size: 16px; cursor: pointer; padding: 5px 10px; border-radius: 8px; transition: all .25s var(--t); }
.modal-close:hover { background: var(--card2); color: var(--tx); }
.modal-body { padding: 24px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 18px; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-header { font-size: 10px; color: var(--mu); font-weight: 700; padding: 4px 2px 6px; text-transform: uppercase; text-align: center; letter-spacing: .5px; }
.cal-day {
  position: relative; aspect-ratio: 1; padding: 6px 6px 5px; border-radius: 12px;
  background: rgba(255,255,255,0.025); border: 1px solid var(--bdr);
  cursor: default; transition: transform .18s var(--t), background .18s var(--t), border-color .18s var(--t);
  display: flex; flex-direction: column; align-items: flex-start; overflow: hidden;
}
.cal-empty { background: transparent; border: none; min-height: 0; }
/* Khối gộp Đăng ký nghỉ + Đổi lịch off khi nằm ở ô bên phải lịch (xếp dọc) */
.leave-side-stack { display: flex; flex-direction: column; gap: 12px; }
.leave-side-stack > .card { margin-top: 0 !important; }
/* Ô Lỗi/KPI hàng dưới cao bằng ô DS nghỉ */
.kpi-cell { display: flex; flex-direction: column; height: 100%; }
.kpi-cell > .card { flex: 1; margin-top: 0 !important; }
/* Ô phải hàng trên (Duyệt đơn + Lịch sử): các bảng cuộn, tổng không dài hơn Lịch nghỉ nhiều */
.leave-right-cell { display: flex; flex-direction: column; gap: 12px; }
.leave-right-cell > .card { margin-top: 0 !important; }
.leave-right-cell .lv-tbl-scroll { max-height: 300px; }
.leave-right-cell .lv-pending-scroll { max-height: 600px; }
.cal-num { font-size: 12px; font-weight: 600; color: var(--tx); opacity: .82; }
.cal-day.today { background: rgba(240,136,62,0.12); border-color: rgba(240,136,62,0.45); }
.cal-day.today .cal-num { font-weight: 800; color: var(--acL); opacity: 1; }
.cal-day.has-leave { cursor: pointer; }
.cal-day.has-leave:hover { transform: translateY(-2px); background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.4); }
/* Ngày đã trôi qua: làm mờ/xám đi để phân biệt với hôm nay & tương lai */
/* Ngày đã trôi qua: màu gạch/đồng (nâu đỏ) rõ ràng, không làm chìm */
.cal-day.past { background: rgba(180,83,40,0.16); border-color: rgba(180,83,40,0.4); opacity: 1; }
.cal-day.past .cal-num { color: #d98a5b; opacity: 1; }
.cal-day.past .cal-event { background: linear-gradient(135deg, #b45328, #8a3d1c); color: #fff; }
.cal-day.past.has-leave:hover { transform: translateY(-2px); background: rgba(180,83,40,0.26); border-color: rgba(180,83,40,0.6); }
/* "Sự kiện" số người nghỉ — thanh pill màu như lịch mẫu */
.cal-event {
  margin-top: auto; align-self: stretch; font-size: 9.5px; font-weight: 700; line-height: 1.2;
  color: #fff; background: linear-gradient(135deg, #ef4444, #dc2626);
  padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-day.today .cal-event { background: linear-gradient(135deg, #f59e0b, #ef8b3e); }

.month-nav { display: flex; align-items: center; border-radius: 12px; border: 1px solid var(--bdr); background: var(--card); overflow: hidden; box-shadow: var(--shadow-sm); }
.month-btn { padding: 9px 13px; background: transparent; border: none; color: var(--mu); font-size: 14px; font-weight: 700; text-decoration: none; transition: all .25s var(--t); }
.month-btn:hover { background: var(--card2); color: var(--tx); }
.month-label { padding: 9px 18px; font-size: 13px; font-weight: 700; min-width: 130px; text-align: center; font-family: var(--fd); }

.alert, .alert-error, .alert-warn, .alert-info { padding: 11px 15px; border-radius: 12px; margin-bottom: 12px; font-size: 12px; font-weight: 600; border: 1px solid; }
.alert-error { background: rgba(239,68,68,0.09); color: var(--no); border-color: rgba(239,68,68,0.2); }
.alert-warn { background: rgba(245,158,11,0.09); color: var(--wr); border-color: rgba(245,158,11,0.2); }
.alert-info { background: rgba(240,136,62,0.07); color: var(--mu); border-color: rgba(240,136,62,0.15); font-weight: 500; }
.empty-state { padding: 28px; text-align: center; color: var(--mu); font-size: 12px; }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); overflow: auto; padding: 20px; }
.login-card { width: 420px; max-width: 95vw; background: var(--card); border-radius: 16px; padding: 38px 32px; border: 1px solid var(--bdr2); box-shadow: var(--shadow); animation: modalIn .4s var(--t); }
.login-logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px; background: linear-gradient(135deg, #f59e0b, #ef4444 55%, #ec4899); display: flex; align-items: center; justify-content: center; font-size: 27px; font-weight: 900; color: #fff; font-family: var(--fm); box-shadow: 0 12px 32px -8px rgba(245,158,11,0.5); }
.login-title { text-align: center; font-size: 23px; font-weight: 800; margin: 0; letter-spacing: -0.6px; font-family: var(--fd); }
.login-sub { text-align: center; color: var(--mu); font-size: 12px; margin: 7px 0 26px; letter-spacing: 1px; text-transform: uppercase; }

.text-muted { color: var(--mu); } .text-xs { font-size: 11px; } .text-sm { font-size: 12px; }
.text-success, .text-ok { color: var(--ok); } .text-danger { color: var(--no); }
.text-accent { color: var(--acL); }
.mono { font-family: var(--fcode); } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.flex-center { display: flex; align-items: center; } .flex-gap { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; } .gap-6 { gap: 6px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(12px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.page-content { animation: fadeIn .4s var(--t); }

/* ===== TABLET & MOBILE (≤768px) ===== */
@media (max-width: 768px) {
  /* Sidebar trượt từ trái, ẩn mặc định */
  .sidebar { transform: translateX(-100%); position: fixed; top: 0; bottom: 0; left: 0; z-index: 300; transition: transform .3s var(--t); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .brand-text, .nav-item span:not(.nav-icon), .sidebar-user .user-info { display: none; }
  .sidebar.open .brand-text, .sidebar.open .nav-item span, .sidebar.open .user-info { display: block; }
  .main-content { margin-left: 0 !important; width: 100%; -webkit-overflow-scrolling: touch; }
  .page-content { padding: 12px; padding-bottom: 90px; max-width: 100vw; overflow-x: hidden; }
  .topbar { padding: 8px 12px; }
  .topbar-date { display: none; }
  .breadcrumb { font-size: 13px; }
  .page-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .page-header h2 { font-size: 18px; }
  .stats-grid { gap: 8px; }
  .stat-card { flex: 1 1 calc(50% - 4px); min-width: 0; padding: 13px; }
  .grid-2, .form-grid-2 { grid-template-columns: 1fr !important; }
  .filter-bar { flex-direction: column; gap: 6px; align-items: stretch; }
  .filter-bar .filter-input, .filter-bar .filter-select { width: 100% !important; }
  /* Bảng: cuộn ngang mượt trên mobile */
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 6px 5px; white-space: nowrap; }
  .nat-table-body, .card > div[style*="overflow-x"] { -webkit-overflow-scrolling: touch; }
  .stat-value { font-size: 24px; }
  .lang-btn { padding: 3px 7px; font-size: 12px; }
  .btn { padding: 8px 13px; font-size: 12px; }
  .card { padding: 14px; }
  #notifPanel { right: 10px !important; width: calc(100vw - 24px) !important; max-width: 360px; }
  /* Block tabs (Online/Văn phòng) xuống dòng gọn */
  .block-tab { padding: 8px 12px; font-size: 12px; }
  /* ===== Thành phần mới: widget Theo đài + ô cờ quốc tịch ===== */
  /* Theo đài: 2 ô/hàng cho dễ đọc */
  .stats-grid > .au-widget { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .au-widget .au-value { font-size: 24px; }
  .au-widget .au-badge { font-size: 10px; padding: 2px 6px; }
  /* Ô cờ quốc tịch: cho giãn đều, 2 ô/hàng */
  .nat-grid > .au-flag { flex: 1 1 calc(50% - 8px); min-width: 0; }
  /* Modal gần full màn hình */
  .modal-box { width: 96vw; max-width: 96vw; max-height: 92vh; border-radius: 16px; }
  .month-label { min-width: 100px; font-size: 12px; }
}

/* ===== ĐIỆN THOẠI NHỎ (≤480px) ===== */
@media (max-width: 480px) {
  .page-content { padding: 9px; }
  .page-header h2 { font-size: 16px; }
  .stat-card { flex: 1 1 100%; }            /* 1 thẻ/hàng cho dễ đọc */
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }
  .card { padding: 11px; border-radius: 12px; }
  .data-table { font-size: 10.5px; }
  .data-table th, .data-table td { padding: 5px 4px; }
  .btn { padding: 8px 11px; font-size: 12px; }
  .btn-sm { padding: 6px 9px; font-size: 11px; }
  /* Nút lớn hơn để dễ chạm */
  .btn, .filter-select, .filter-input { min-height: 38px; }
  .modal-box { width: 100vw; max-width: 100vw; max-height: 94vh; border-radius: 14px 14px 0 0; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; }
  /* Hàng nút trong header xuống dòng */
  .page-header > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
  .month-nav { width: 100%; justify-content: center; }
  /* Thẻ thưởng/cấu hình lương: 1 cột */
  .sal-cfg, .stats-grid-sm { grid-template-columns: 1fr !important; }
  /* Form input đủ to để không bị zoom khi focus trên iOS */
  input, select, textarea { font-size: 16px !important; }
  /* Badge nhỏ gọn */
  .badge { font-size: 10px; padding: 2px 6px; }
  /* ===== Thành phần mới trên màn rất hẹp: 1 ô/hàng ===== */
  .stats-grid > .au-widget { flex: 1 1 100%; }
  .nat-grid > .au-flag { flex: 1 1 100%; }
  .au-flag { aspect-ratio: 3 / 1.4; }   /* cờ dẹt hơn 1 chút để ô không quá cao trên điện thoại */
  /* Khung cuộn lỗi KPI thấp hơn trên điện thoại */
  .pen-list-scroll { max-height: 300px !important; }
  /* Lịch nghỉ: ô gọn lại, pill sự kiện nhỏ hơn cho vừa màn hẹp */
  .calendar-grid { gap: 3px; }
  .cal-day { padding: 4px 3px 4px; border-radius: 9px; }
  .cal-num { font-size: 11px; }
  .cal-event { font-size: 7.5px; padding: 1px 3px; }
}

.mobile-menu-btn { display: none; background: var(--glass); border: 1px solid var(--bdr); color: var(--tx); font-size: 18px; cursor: pointer; padding: 5px 10px; border-radius: 9px; }
@media (max-width: 768px) { .mobile-menu-btn { display: block; } }

/* ===== ĐIỆN THOẠI XOAY NGANG (chiều cao thấp) ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 6px 14px; }
  .sidebar-brand { padding: 10px 14px; }
  .sidebar-nav { padding: 6px 8px; }
  .nav-item { padding: 7px 11px; }
  .page-content { padding: 10px 14px; padding-bottom: 70px; }
  .page-header { margin-bottom: 8px; }
}

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); z-index: 250; }
.sidebar-overlay.show { display: block; }

/* === SALARY CONFIG — bigger font === */
.sal-cfg { gap: 8px; }
.sal-cfg > div > div { gap: 8px; }
.sal-cfg span { font-size: 11px !important; font-weight: 600; }
.sal-cfg input[type="text"] { font-size: 14px !important; padding: 5px 6px !important; min-width: 50px; }
.sal-cfg input[style*="width:85px"] { width: 100px !important; }
.sal-cfg input[style*="width:65px"] { width: 80px !important; }
.sal-cfg input[style*="width:55px"] { width: 68px !important; }
.sal-cfg input[style*="width:50px"] { width: 62px !important; }
.sal-cfg input[style*="width:45px"] { width: 58px !important; }
.sal-cfg input[style*="width:35px"] { width: 48px !important; }
.sal-cfg input[style*="width:30px"] { width: 42px !important; }
.sal-cfg .cfg-detail span { font-size: 11px !important; }
.sal-cfg .cfg-detail input[type="text"] { font-size: 14px !important; }
.sal-cfg .cfg-detail .btn { font-size: 12px !important; padding: 4px 10px !important; }
.sal-cfg .fw-700 { font-size: 14px !important; }
.sal-cfg .btn-success { font-size: 13px !important; padding: 5px 14px !important; }

/* ============================================ */
/* LIGHT MODE                                   */
/* ============================================ */
body.light {
  --bg: #f7f6f3; --sf: #ffffff; --card: #ffffff; --card2: #f1efe9;
  --bdr: #e6e3dc; --bdr2: #d4cfc4;
  --tx: #15130f; --tx2: #3a352c; --mu: #7d7568;
  --ac: #c79436; --acL: #b5832a; --acG: #c79436;
  --ok: #3f9a6a; --okG: #3f9a6a;
  --no: #c0503a; --noG: #c0503a;
  --wr: #c79436; --wrG: #c79436;
  --cyan: #3a8a7a; --pink: #b85878; --purple: #7a72b0;
  --glass: rgba(21,19,15,0.03);
  --glow: 0 0 0 1px var(--bdr);
  --shadow: 0 8px 30px -16px rgba(60,55,40,0.18);
  --shadow-sm: 0 3px 12px -8px rgba(60,55,40,0.14);
}
body.light::before { content: none; }
/* Lịch nghỉ — light mode: pill "lượt nghỉ" dùng màu xanh cho hợp nền sáng (dark mode giữ đỏ) */
body.light .cal-event { background: linear-gradient(135deg, #3b82f6, #2563eb); }
body.light .cal-day.today .cal-event { background: linear-gradient(135deg, #f59e0b, #ef8b3e); }
body.light .cal-day { background: #f3f6fb; border-color: #e2e8f0; }
body.light .cal-num { color: #1e293b; opacity: 1; }
body.light .cal-day.has-leave:hover { background: #e8eef7; border-color: #93c5fd; }
body.light .sidebar { background: #15130f; border-right: 1px solid #2a2620; box-shadow: none; }
body.light .topbar { background: linear-gradient(90deg, rgba(255,255,255,0.8), transparent); }
body.light .nav-item:hover { background: rgba(255,255,255,0.06); }
body.light .card, body.light .stat-card, body.light .filter-bar { background: #ffffff; }
body.light .data-table tbody tr:hover { background: rgba(199,148,54,0.06); }
body.light .form-group input, body.light .form-group select, body.light .form-group textarea,
body.light .filter-input, body.light .filter-select, body.light .form-control { background: #f7f9fd; }
body.light .form-group input:focus, body.light .form-control:focus { background: #ffffff; }
body.light .lang-switch, body.light .login-lang { background: #f0f2f7; }
body.light .modal-box { background: #ffffff; }
body.light .login-card { background: #ffffff; }
body.light .chip, body.light .list-item, body.light .mini-stat { background: #f7f9fd; }
body.light ::-webkit-scrollbar-thumb { background: #cdd4e3; }

/* Theme toggle button */
.theme-toggle { background: var(--glass); border: 1px solid var(--bdr); border-radius: 10px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; transition: all .25s var(--t); }
.theme-toggle:hover { background: var(--card2); border-color: var(--bdr2); transform: translateY(-1px); }

/* ===== LIGHT MODE — refinements ===== */
/* Sidebar tối (navy) để logo nổi rõ + chữ sáng */
body.light .sidebar-brand { border-bottom-color: #2a2620; }
body.light .sidebar-brand .brand-sub { opacity: 1; color: #8a93a8; font-weight: 800; }
body.light .sidebar-brand img { filter: none; }
body.light .sidebar::after { background: none; }
body.light .nav-item { color: #9aa3b5; }
body.light .nav-item:hover { color: #ffffff; }
body.light .nav-item.active { background: rgba(199,148,54,0.12); color: #ffffff; border-left: 2px solid #c79436; border-color: transparent; border-radius: 0; }
body.light .topbar { border-bottom: 1px solid #e3e7f0; }
body.light .breadcrumb { color: #707996; }
body.light .breadcrumb b { color: #15130f; }
body.light .topbar-date { color: #707996; }
body.light .card, body.light .stat-card { box-shadow: 0 2px 12px -4px rgba(60,70,120,0.1); border-color: #e8ebf3; }
body.light .card:hover, body.light .stat-card:hover { border-color: #cdd4e3; }
body.light .stat-value { color: #15130f; }
body.light .data-table th { color: #8a92a8; border-bottom-color: #e3e7f0; }
body.light .data-table td { border-bottom-color: #eef1f7; }
body.light .month-nav, body.light .month-btn:hover { background: #f7f9fd; }
body.light .month-label { color: #15130f; }
body.light .btn-ghost { background: #f0f2f7; color: #3a4258; border-color: #e3e7f0; }
body.light .btn-ghost:hover { background: #e8ebf3; color: #161b29; }
body.light .btn-icon { background: #f0f2f7; color: #707996; }
body.light .btn-icon:hover { background: #e8ebf3; color: #161b29; }
body.light .badge-dai { background: rgba(6,182,212,0.1); color: #0891b2; }
/* Sidebar user + nút (trên nền tối) */
body.light .sidebar-user { border-top-color: #2a2620; }
body.light .sidebar-user:hover { background: rgba(255,255,255,0.05); }
body.light .user-name { color: #ffffff; }
body.light .btn-changepw { border-color: #2a2620; color: #d6a44c; }
body.light .btn-changepw:hover { background: rgba(199,148,54,0.15); border-color: rgba(199,148,54,0.4); }
body.light .btn-logout { border-color: #2a2620; }
body.light .btn-logout:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); }
body.light .theme-toggle { background: #f0f2f7; border-color: #e3e7f0; }
body.light .theme-toggle:hover { background: #e8ebf3; }
body.light #notifPanel { box-shadow: 0 8px 30px -8px rgba(60,70,120,0.25); }
body.light .lang-btn { color: #707996; }
body.light .empty-state { color: #8a92a8; }
body.light .chip:hover, body.light .list-item:hover, body.light .mini-stat:hover { background: #eef1f8; }

/* ===== Block tabs (Khối nhân viên) ===== */
.block-tab { display:flex; align-items:center; gap:8px; padding:10px 18px; border-radius:10px; background:var(--card); border:1px solid var(--bdr); color:var(--mu); font-weight:700; font-size:13px; cursor:pointer; transition:all .2s var(--t); text-decoration:none; }
.block-tab:hover { border-color:var(--bdr2); color:var(--tx); }
.block-tab.active { background:rgba(240,136,62,0.12); border-color:rgba(240,136,62,0.4); color:var(--tx); }
.block-tab .block-count { background:var(--bg); border-radius:20px; padding:1px 9px; font-size:11px; font-weight:800; color:var(--acL); }
.block-tab.active .block-count { background:rgba(240,136,62,0.25); color:var(--ac); }
/* Huy hiệu đỏ báo đơn nghỉ/đổi off đang chờ duyệt */
.block-tab .block-badge {
  background:#ef4444; color:#fff; border-radius:20px; min-width:18px; height:18px;
  display:inline-flex; align-items:center; justify-content:center;
  padding:0 5px; font-size:11px; font-weight:800; line-height:1;
  box-shadow:0 0 0 0 rgba(239,68,68,0.6); animation:badgePulse 1.8s infinite;
}
@keyframes badgePulse {
  0% { box-shadow:0 0 0 0 rgba(239,68,68,0.55); }
  70% { box-shadow:0 0 0 6px rgba(239,68,68,0); }
  100% { box-shadow:0 0 0 0 rgba(239,68,68,0); }
}
body.light .block-tab { background:#fff; border-color:#e8ebf3; }
body.light .block-tab.active { background: rgba(199,148,54,0.1); border-color: rgba(199,148,54,0.3); color:#15130f; }
body.light .block-tab .block-count { background:#efeae0; color:#5a463a; }
body.light .block-tab.active .block-count { background:rgba(199,148,54,0.18); color:#8a6420; }

/* ===== LIGHT MODE — tăng độ tương phản & dễ nhìn ===== */
body.light {
  --bg: #eef1f7;            /* nền tổng tối hơn chút để card trắng nổi rõ */
  --sf: #ffffff;
  --card: #ffffff;
  --card2: #e7ebf4;
  --bdr: #d4dae8;           /* viền rõ hơn (trước #e3e7f0 quá mờ) */
  --bdr2: #b3bccf;
  --tx: #0f1420;            /* chữ chính đậm hơn */
  --tx2: #2a3247;           /* chữ phụ đậm hơn */
  --mu: #5c6478;            /* chữ mờ (nhãn) đậm hơn để đọc được */
}
/* Nhãn input, tiêu đề nhỏ: đậm & rõ hơn */
body.light .form-group label,
body.light .stat-label,
body.light .stat-sub,
body.light .mini-stat-val,
body.light .text-muted,
body.light .text-xs.text-muted { color: #5c6478 !important; }
body.light .data-table th { color: #4a5570 !important; font-weight: 800; border-bottom: 1.5px solid #c8d0e0; }
/* Card: viền rõ + bóng rõ hơn để tách khỏi nền */
body.light .card, body.light .stat-card, body.light .filter-bar {
  background: #ffffff;
  border: 1px solid #d4dae8;
  box-shadow: 0 3px 14px -6px rgba(40,52,90,0.15);
}
body.light .stat-card, body.light .mini-stat { background: #f5f7fb; }
body.light .stat-card:hover, body.light .mini-stat:hover { background: #eef1f8; }
body.light .card { background: linear-gradient(160deg, #ffffff, #f5f7fb); }
body.light .card:hover, body.light .stat-card:hover { border-color: #b3bccf; box-shadow: 0 6px 20px -8px rgba(40,52,90,0.2); }
/* Ô nhập: nền hơi xám + viền rõ để thấy ranh giới */
body.light .form-group input, body.light .form-group select, body.light .form-group textarea,
body.light .filter-input, body.light .filter-select, body.light .form-control {
  background: #f4f6fb; border: 1px solid #d0d7e6; color: #0f1420;
}
body.light .form-group input:focus, body.light .form-group select:focus, body.light .form-group textarea:focus,
body.light .filter-input:focus, body.light .filter-select:focus, body.light .form-control:focus {
  background: #ffffff; border-color: #f0883e; box-shadow: 0 0 0 3px rgba(240,136,62,0.12);
}
body.light input::placeholder, body.light textarea::placeholder { color: #9aa2b5; }
/* Bảng: dòng kẻ rõ hơn, hover rõ hơn */
body.light .data-table td { border-bottom: 1px solid #e4e8f1; color: #1a2030; }
body.light .data-table tbody tr:hover { background: rgba(199,148,54,0.07); }
body.light .data-table tfoot, body.light .data-table .total-row { background: #eef1f8; border-top: 2px solid #c8d0e0; }
/* Badge mặc định nền nhạt: thêm viền để không chìm */
body.light .badge { border: 1px solid rgba(40,52,90,0.08); }
/* Tiêu đề trang & section */
body.light h1, body.light h2, body.light h3, body.light .fw-700, body.light .fw-800 { color: #0f1420; }
/* List/chip nền rõ hơn */
body.light .chip, body.light .list-item, body.light .mini-stat { background: #f4f6fb; border-color: #d4dae8; }