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

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #ebf5ff;
  --sidebar-bg: #0f172a;
  --sidebar-w: 220px;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --page-bg: #f1f5f9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.sidebar-logo .sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.nav-group { padding: 8px 0; }
.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #475569;
  text-transform: uppercase;
  padding: 10px 18px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #94a3b8;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active {
  background: rgba(26,86,219,.18);
  color: #fff;
  border-left-color: var(--primary);
}
.nav-item .icon { font-size: 16px; width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-search {
  display: flex;
  align-items: center;
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  gap: 6px;
  width: 220px;
}
.topbar-search input {
  border: none; background: transparent;
  font-size: 13px; outline: none; padding: 7px 0; width: 100%;
  color: var(--text); font-family: inherit;
}
.topbar-search .search-icon { color: var(--text-muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: var(--text-muted);
  position: relative;
  transition: background .15s;
}
.icon-btn:hover { background: var(--page-bg); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}

/* ── Content ── */
.content { padding: 24px; flex: 1; }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.cyan   { background: #cffafe; }
.stat-icon.rose   { background: #ffe4e6; }
.stat-icon.yellow { background: #fef9c3; }
.stat-icon.teal   { background: #ccfbf1; }
.stat-info { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 4px; display: flex; align-items: center; gap: 3px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Section title ── */
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Module grid ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.module-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  text-decoration: none;
  color: var(--text);
}
.module-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.module-card .m-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.module-card .m-name { font-size: 14px; font-weight: 600; }
.module-card .m-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.module-card .m-count {
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Layout ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }

/* ── Panel ── */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 14px; font-weight: 600; }
.panel-head a { font-size: 12px; color: var(--primary); text-decoration: none; cursor: pointer; }
.panel-body { padding: 0; }

/* ── List rows ── */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background .12s;
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fafc; }
.list-row .row-main { flex: 1; }
.list-row .row-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ── Badges ── */
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-cyan   { background: #cffafe; color: #0e7490; }

/* ── Avatar ── */
.av {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.av-lg {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: #fff; flex-shrink: 0;
}

/* ── Progress ── */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 10px; }
.progress-pct { font-size: 11px; color: var(--text-muted); min-width: 30px; text-align: right; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: inherit;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--page-bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.btn-success:hover { background: #bbf7d0; }
.btn-danger { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* ── Quick actions (index page) ── */
.quick-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.qa-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: inherit;
  color: var(--text);
}
.qa-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.qa-btn.primary-btn { background: var(--primary); color: #fff; border-color: var(--primary); }
.qa-btn.primary-btn:hover { background: var(--primary-dark); }

/* ── Action bar ── */
.action-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.action-bar-spacer { flex: 1; }

/* ── Filter bar ── */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.filter-group label { color: var(--text-muted); white-space: nowrap; }
.filter-input, .filter-select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  color: var(--text);
  background: var(--page-bg);
  transition: border-color .15s;
}
.filter-input:focus, .filter-select:focus { border-color: var(--primary); background: #fff; }
.filter-input { min-width: 180px; }
.filter-select { min-width: 110px; }
.filter-search {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  background: var(--page-bg);
  min-width: 220px;
}
.filter-search input {
  border: none; background: transparent; outline: none;
  font-size: 13px; font-family: inherit; color: var(--text); width: 100%;
}
.filter-search:focus-within { border-color: var(--primary); background: #fff; }
.filter-spacer { flex: 1; }

/* ── Data table ── */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.table-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table-head h3 { font-size: 14px; font-weight: 600; }
.table-count { font-size: 12px; color: var(--text-muted); }
.table-overflow { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}
table.data-table thead tr {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
table.data-table th {
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: #f8fafc; }
.td-name { display: flex; align-items: center; gap: 8px; }
.td-name .name-text { font-weight: 500; }
.td-name .name-sub { font-size: 11px; color: var(--text-muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center { text-align: center; }
.total-row td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--border) !important; }
.ops-cell { display: flex; gap: 6px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.pagination .pg-info { color: var(--text-muted); }
.pg-btns { display: flex; gap: 4px; }
.pg-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px;
  transition: background .12s;
  font-family: inherit;
}
.pg-btn:hover { background: var(--page-bg); }
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Month selector ── */
.month-selector { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.month-selector button {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.month-selector button:hover { background: var(--page-bg); }

/* ── Alert ── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Leave balance cards ── */
.leave-balance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.leave-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.leave-card .lc-icon { font-size: 28px; margin-bottom: 8px; }
.leave-card .lc-type { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.leave-card .lc-days { font-size: 32px; font-weight: 700; }
.leave-card .lc-total { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Calendar ── */
.mini-cal { padding: 14px 18px; font-size: 13px; }
.cal-row { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 10px; color: var(--text-muted); font-size: 11px; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { text-align: center; padding: 5px 0; border-radius: 6px; font-size: 12px; cursor: pointer; position: relative; }
.cal-day:hover { background: var(--primary-light); }
.cal-day.today { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.has-event::after {
  content: ''; width: 4px; height: 4px;
  background: var(--danger); border-radius: 50%;
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
}
.cal-day.muted { color: #cbd5e1; }

/* ── Footer ── */
.footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .leave-balance-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
