/* ===== CSS VARIABLES — HS오퍼레이션 브랜드 컬러 ===== */
/* PANTONE 412C: #2C2825 (다크브라운 - 메인)     */
/* PANTONE 4271C: #8F7C69 (미디엄브라운 - 보조)  */
/* PANTONE 406C:  #E8E2DD (라이트베이지 - 배경)  */
:root {
  --primary: #2C2825;        /* PANTONE 412C 다크브라운 */
  --primary-dark: #1a1714;   /* 더 어두운 다크브라운 */
  --primary-light: #f0ece8;  /* 연한 베이지 */
  --primary-mid: #8F7C69;    /* PANTONE 4271C 미디엄브라운 */
  --secondary: #8F7C69;      /* PANTONE 4271C 브라운 */
  --success: #4a7c59;
  --success-light: #e8f5ed;
  --warning: #c07a3a;
  --warning-light: #fdf0e0;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --info: #5a7f9e;
  --info-light: #e8f0f7;
  --bg: #f5f1ee;             /* PANTONE 406C 베이지 배경 */
  --sidebar-bg: #2C2825;     /* PANTONE 412C 다크브라운 */
  --sidebar-text: #c4b5a8;   /* 밝은 브라운 */
  --sidebar-active: #8F7C69; /* PANTONE 4271C */
  --card-bg: #ffffff;
  --border: #E8E2DD;         /* PANTONE 406C */
  --text-primary: #2C2825;
  --text-secondary: #5c4f43;
  --text-muted: #a89a8e;
  --shadow: 0 1px 3px rgba(44,40,37,.08), 0 1px 2px rgba(44,40,37,.06);
  --shadow-md: 0 4px 6px rgba(44,40,37,.09), 0 2px 4px rgba(44,40,37,.06);
  --shadow-lg: 0 10px 15px rgba(44,40,37,.12), 0 4px 6px rgba(44,40,37,.06);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 240px;
  --topbar-h: 60px;
  --transition: .2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .logo { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0 .8rem; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--topbar-h);
}
.logo {
  display: flex; align-items: center; gap: .75rem;
  color: #fff; font-size: 1.2rem; font-weight: 700;
  min-width: 0;
}
/* 사이드바 HS 심볼 */
.logo-symbol {
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-img {
  width: 34px; height: auto;
  display: block;
  filter: brightness(0) invert(1);
}
.logo-text {
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .16em;
  color: rgba(255,255,255,.8);
  white-space: nowrap;
}
.sidebar-toggle { color: var(--sidebar-text); font-size: 1.1rem; transition: color var(--transition); }
.sidebar-toggle:hover { color: #fff; }

.sidebar-nav {
  padding: .75rem 0;
  overflow-y: auto;
  flex: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-group { margin-bottom: .5rem; }
.nav-label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(148,163,184,.6);
  padding: .5rem 1rem .3rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 1rem;
  color: var(--sidebar-text);
  font-size: .85rem;
  border-radius: var(--radius-sm);
  margin: .1rem .5rem;
  transition: background var(--transition), color var(--transition);
}
.nav-item i { width: 1.1rem; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-wrapper { margin-left: 64px; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: .75rem; }
.topbar-toggle { color: var(--text-secondary); font-size: 1.1rem; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.today-date { font-size: .8rem; color: var(--text-muted); }
.user-badge {
  background: #f0ece8;
  color: var(--primary);
  padding: .35rem .75rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
}

/* ===== PAGES ===== */
.page {
  display: none;
  padding: 1.25rem;
  flex: 1;
}
.page.active { display: block; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}
.card-header h3 { font-size: .92rem; font-weight: 600; }

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .875rem;
  margin-bottom: 1.25rem;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: .75rem; color: var(--text-muted); margin-bottom: .2rem; }
.kpi-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.kpi-sub { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }
.kpi-sub .up { color: var(--success); }
.kpi-sub .down { color: var(--danger); }

/* ===== CHART ROW ===== */
.chart-row {
  display: flex;
  gap: .875rem;
  margin-bottom: .875rem;
  flex-wrap: wrap;
}
.chart-row > .card { flex: 1; min-width: 240px; }
.chart-card.wide { flex: 2; }
.chart-wrap {
  padding: .75rem 1rem 1rem;
  height: 240px;
  position: relative;
}
.chart-wrap canvas { max-height: 100%; }

/* ===== TOOLBAR ===== */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}
.search-wrap i { color: var(--text-muted); }
.search-wrap input { border: none; outline: none; font-size: .875rem; width: 100%; background: transparent; }
.filter-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.filter-wrap select, .filter-wrap input[type="month"], .filter-wrap input[type="date"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .6rem;
  font-size: .8rem;
  background: var(--card-bg);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}
.filter-wrap label { font-size: .8rem; color: var(--text-secondary); }
.filter-wrap input[type="checkbox"] { cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-excel { background: #16a34a; color: #fff; border: none; }
.btn-excel:hover { background: #15803d; }
.btn-excel i { color: #fff; }
.btn-sm { font-size: .75rem; padding: .3rem .65rem; }
.btn-xs { font-size: .7rem; padding: .2rem .45rem; }

/* ===== TABLES ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.data-table th {
  background: #f8fafc;
  padding: .65rem .85rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .6rem .85rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.mini-table th {
  background: #f8fafc;
  padding: .5rem .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.mini-table td { padding: .5rem .75rem; border-bottom: 1px solid #f1f5f9; }
.mini-table tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #f1f5f9; color: var(--text-secondary); }
.badge-cyan { background: var(--info-light); color: var(--info); }

/* Grade badges */
.grade-S { background: #fef9c3; color: #854d0e; font-weight: 700; }
.grade-A { background: #dcfce7; color: #166534; font-weight: 700; }
.grade-B { background: #e8e4df; color: #2C2825; font-weight: 700; }
.grade-C { background: #fef3c7; color: #92400e; font-weight: 700; }
.grade-D { background: #fee2e2; color: #991b1b; font-weight: 700; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: .3rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
}
.pagination button {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.pagination button:hover { background: var(--bg); }
.pagination button.active { background: var(--primary); color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ===== MODALS ===== */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .15s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .2s ease;
}
.modal.modal-lg { max-width: 780px; }
.modal.modal-xl { max-width: 960px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close { font-size: 1.4rem; color: var(--text-muted); line-height: 1; transition: color var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: .875rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .5rem;
  flex-shrink: 0;
}

/* ===== TABS ===== */
.tab-nav {
  display: flex; gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: .5rem .875rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .78rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  color: var(--text-primary);
  background: var(--card-bg);
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(143,124,105,.15); }
.form-hint { font-size: .74rem; color: var(--text-muted); margin-top: .4rem; }

/* ===== PAY NET PREVIEW ===== */
.pay-net-preview {
  background: linear-gradient(135deg, #f5f1ee, #E8E2DD);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  text-align: right;
  margin-top: .75rem;
  font-size: .88rem;
  color: var(--text-secondary);
}
.pay-net-preview strong { font-size: 1.2rem; color: var(--primary); margin-left: .4rem; }

/* ===== RATE WARN ===== */
.rate-warn {
  position: absolute;
  right: 0; top: -22px;
  background: var(--danger);
  color: #fff;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 4px;
  white-space: nowrap;
  animation: blink 1.2s ease infinite;
}
.rate-warn.hidden { display: none; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:.5} }

/* ===== CAREER ROWS ===== */
.career-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.8fr 1.5fr auto;
  gap: .4rem;
  align-items: end;
  margin-bottom: .5rem;
  background: #f8fafc;
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .8rem;
}
.career-row label { display: block; font-size: .72rem; color: var(--text-muted); margin-bottom: .15rem; }
.career-row input, .career-row select {
  width: 100%;
  padding: .3rem .45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .8rem;
  background: #fff;
}
.career-relevance { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-secondary); }
.career-relevance input[type="checkbox"] { cursor: pointer; }

/* ===== DEPT LAYOUT ===== */
.dept-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: .875rem;
  align-items: start;
}
.dept-list-card { max-height: calc(100vh - 140px); overflow-y: auto; }
.org-chart-card { min-height: 500px; }
.dept-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  gap: .5rem;
}
.dept-item:hover { background: #f8fafc; }
.dept-item-name { font-size: .86rem; font-weight: 500; }
.dept-item-sub { font-size: .74rem; color: var(--text-muted); }

/* ===== ORG CHART ===== */
#orgChartContainer, #dashOrgChart {
  padding: 1rem;
  overflow-x: auto;
}
/* ===== ORG CHART ===== */
.org-table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 auto;
}
.org-td-node {
  text-align: center;
  padding: 0 8px;
  vertical-align: top;
}
.org-td-gap {
  min-width: 16px;
}
.org-td-vline {
  text-align: center;
  height: 24px;
  padding: 0 8px;
}
.org-td-children {
  text-align: center;
  vertical-align: top;
  padding: 0 8px;
}
/* 수직선 */
.org-vline {
  width: 2px;
  height: 24px;
  background: #c4b5a8;
  margin: 0 auto;
}
/* 수평 브릿지 (형제 노드 연결) */
.org-hbridge {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.org-hnode {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
}
/* 수평선 */
.org-hline {
  height: 2px;
  width: 100%;
  background: #c4b5a8;
  align-self: stretch;
}
.org-hline-right {
  width: 50%;
  margin-left: 50%;
}
.org-hline-left {
  width: 50%;
  margin-right: 50%;
}
.org-hline-both {
  width: 100%;
}

/* 노드 박스 */
.org-node-box {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .55rem .9rem;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 110px;
  text-align: center;
  white-space: nowrap;
}
.org-node-box:hover {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(143,124,105,.15);
}
.org-node-box.top-level {
  border-color: var(--primary);
  background: #f0ece8;
  min-width: 130px;
}
.org-node-dept { font-size: .82rem; font-weight: 700; color: var(--text-primary); }
.org-node-manager { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }
.org-node-count { font-size: .7rem; color: var(--primary-mid); margin-top: .1rem; font-weight: 600; }
.dash-org-chart .org-node-box { min-width: 100px; padding: .35rem .5rem; }
.dash-org-chart .org-node-dept { font-size: .74rem; }
.dash-org-chart .org-node-count { font-size: .65rem; }

/* ===== DEPT SUMMARY ===== */
.dept-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
  padding: .875rem;
}
.dept-summary-item {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: .75rem;
  border: 1px solid var(--border);
}
.dept-summary-name { font-size: .8rem; font-weight: 600; margin-bottom: .4rem; }
.dept-summary-row { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-secondary); margin-bottom: .15rem; }
.dept-summary-row span:last-child { font-weight: 600; color: var(--text-primary); }

/* ===== TOGGLE GROUP ===== */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.toggle-btn {
  padding: .25rem .6rem;
  font-size: .75rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.toggle-btn.active { background: var(--card-bg); color: var(--primary); box-shadow: var(--shadow); font-weight: 500; }

/* ===== EMPLOYEE AVATAR ===== */
.emp-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 600;
  flex-shrink: 0;
}
.emp-name-cell { display: flex; align-items: center; gap: .5rem; }
.emp-name-cell .name { font-weight: 500; }
.emp-name-cell .sub { font-size: .72rem; color: var(--text-muted); }

/* ===== DETAIL MODAL ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
.detail-item { }
.detail-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .15rem; }
.detail-value { font-size: .88rem; font-weight: 500; }
.detail-section { margin-bottom: 1.25rem; }
.detail-section h4 { font-size: .85rem; font-weight: 600; color: var(--primary); padding-bottom: .4rem; border-bottom: 1px solid var(--border); margin-bottom: .6rem; }

/* ===== CAREER ITEMS ===== */
.career-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  margin-bottom: .4rem;
  font-size: .82rem;
  border-left: 3px solid;
}
.career-item.relevant { border-color: var(--success); }
.career-item.irrelevant { border-color: var(--text-muted); }
.career-badge { font-size: .68rem; padding: .1rem .4rem; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.career-badge.rel { background: var(--success-light); color: var(--success); }
.career-badge.irrel { background: #f1f5f9; color: var(--text-muted); }

/* ===== HIGH INCREASE ROW ===== */
.row-high-increase td { background: #fff5f5 !important; }
.increase-high { color: var(--danger); font-weight: 700; }
.increase-normal { color: var(--success); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  background: #1e293b;
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s ease;
  z-index: 9999;
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; }
.empty-state p { font-size: .88rem; }

/* ===== EMPLOYEE DETAIL AVATAR ===== */
.detail-hero {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f5f1ee, #E8E2DD);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.detail-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700;
  flex-shrink: 0;
}
.detail-hero-info h3 { font-size: 1.2rem; font-weight: 700; }
.detail-hero-info p { font-size: .82rem; color: var(--text-secondary); margin-top: .1rem; }
.detail-hero-badges { display: flex; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }

/* ===== ACTION BUTTONS ===== */
.action-btns { display: flex; gap: .3rem; }
.action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  transition: all var(--transition);
}
.action-btn.view { background: var(--info-light); color: var(--info); }
.action-btn.edit { background: var(--warning-light); color: var(--warning); }
.action-btn.del { background: var(--danger-light); color: var(--danger); }
.action-btn:hover { filter: brightness(.9); }

/* ===== STATUS DOTS ===== */
.status-dot {
  display: inline-flex; align-items: center; gap: .3rem;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.active::before { background: var(--success); }
.status-dot.leave::before { background: var(--warning); }
.status-dot.resigned::before { background: var(--text-muted); }

/* ===== SALARY TABLE HIGH INCREASE ===== */
.sh-high-row { background: #fff5f5; }
.sh-high-row td:nth-child(7) { color: var(--danger); font-weight: 700; }

/* ===== NUM CELL ===== */
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
  flex-direction: column;
  gap: 1rem;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DOCUMENTS PAGE ===== */
.doc-issue-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: .875rem;
  align-items: start;
}
.doc-select-card { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.doc-preview-card { min-height: 600px; }

.doc-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.1rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  width: 100%;
}
.doc-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.doc-btn.active { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.doc-btn.active .doc-btn-title { color: var(--primary); }
.doc-btn i { font-size: 1.5rem; color: var(--primary); flex-shrink: 0; width: 32px; text-align: center; }
.doc-btn-title { font-size: .92rem; font-weight: 600; color: var(--text-primary); margin-bottom: .15rem; }
.doc-btn-sub { font-size: .75rem; color: var(--text-muted); }

.doc-hint {
  margin-top: 1.25rem;
  padding: .75rem;
  background: #fef9c3;
  border-radius: var(--radius-sm);
  border: 1px solid #fde047;
  font-size: .78rem;
  line-height: 1.7;
  color: #713f12;
}
.doc-hint i { margin-right: .3rem; }

@media (max-width: 900px) {
  .doc-issue-layout { grid-template-columns: 1fr; }
  .doc-select-card { position: static; }
}

/* ===== MOBILE ===== */
@media (max-width: 1024px) {
  .dept-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-width: 64px; }
  .sidebar .nav-label, .sidebar .nav-item span, .sidebar .logo span { display: none; }
  .sidebar .logo { justify-content: center; }
  .sidebar .nav-item { justify-content: center; padding: .55rem; }
  .chart-row { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .page { padding: .75rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 .75rem; }
}
