/* ==========================================================================
   梵欣考勤 · 设计系统
   商务简约 / 主色蓝色 / 明暗层次克制 / 移动端优先适配
   ========================================================================== */

/* ---------- 1. 变量 ---------- */
:root {
  --blue-50: #eff5ff;
  --blue-100: #dbe8ff;
  --blue-200: #bfd6fe;
  --blue-300: #93b8fd;
  --blue-400: #6091fa;
  --blue-500: #3b76f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  --ink: #0f1c33;
  --ink-2: #2c3a52;
  --muted: #66748d;
  --muted-2: #8b97ab;
  --line: #e4eaf3;
  --line-2: #eef2f8;
  --bg: #f4f7fc;
  --card: #ffffff;

  --ok: #0f9d6f;
  --ok-bg: #e6f7f0;
  --warn: #d97706;
  --warn-bg: #fef4e6;
  --bad: #dc2626;
  --bad-bg: #fdeaea;
  --info: #2563eb;
  --info-bg: #eaf1ff;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 33, 62, 0.06);
  --shadow: 0 4px 16px rgba(16, 33, 62, 0.06);
  --shadow-lg: 0 18px 48px rgba(16, 33, 62, 0.14);
  --sidebar-w: 232px;
  --font: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

/* 弹窗打开时，Toast 回到顶部，避免压住弹窗底部按钮 */
body.no-scroll #toast-root {
  top: 20px;
  bottom: auto;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

a {
  color: var(--blue-600);
  text-decoration: none;
}

button {
  font-family: inherit;
}

.ic {
  flex: none;
  display: inline-block;
  vertical-align: -0.15em;
}

/* ---------- 2. 布局骨架 ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--blue-500), var(--blue-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3);
}

.brand-text b {
  display: block;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.brand-text span {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 0.6px;
}

.nav-group-title {
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: 1px;
  padding: 12px 10px 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
  user-select: none;
}

.nav-item:hover {
  background: var(--line-2);
  color: var(--ink);
}

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

.nav-item.active .ic {
  color: var(--blue-600);
}

.nav-item .nav-dot {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.side-user:hover {
  background: var(--line-2);
}

.side-user .meta {
  min-width: 0;
}

.side-user .meta b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-user .meta span {
  font-size: 11px;
  color: var(--muted-2);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(140deg, #dbe8ff, #bfd6fe);
  color: var(--blue-700);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .brand {
  padding: 0;
}

.content {
  padding: 26px 30px 44px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ---------- 3. 页头 ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.page-head .sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

/* ---------- 4. 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.card-head h2,
.card-head h3 {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head .hint {
  font-size: 12px;
  color: var(--muted-2);
}

.card-pad {
  padding: 18px 20px;
}

/* ---------- 5. 栅格 ---------- */
.grid {
  display: grid;
  gap: 16px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.span-2 {
  grid-column: span 2;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--blue-600);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.16s, box-shadow 0.16s, transform 0.06s, border-color 0.16s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--blue-700);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--blue-600);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--line-2);
  border-color: #d5dfec;
}

.btn-soft {
  background: var(--blue-50);
  color: var(--blue-700);
}

.btn-soft:hover {
  background: var(--blue-100);
}

.btn-danger {
  background: var(--bad);
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger-ghost {
  background: #fff;
  border-color: #f3c9c9;
  color: var(--bad);
}

.btn-danger-ghost:hover {
  background: var(--bad-bg);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
  flex: none;
}

.icon-btn:hover {
  background: var(--line-2);
  color: var(--ink);
}

.icon-btn.danger:hover {
  background: var(--bad-bg);
  color: var(--bad);
}

/* ---------- 7. 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 550;
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted-2);
}

.input,
.select,
textarea.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.16s, box-shadow 0.16s;
  -webkit-appearance: none;
  appearance: none;
}

textarea.input {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366748d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.input:focus,
.select:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(59, 118, 246, 0.13);
}

.input::placeholder {
  color: #a8b3c4;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-group .unit {
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
}

.search-box {
  position: relative;
  min-width: 220px;
}

.search-box .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}

.search-box .input {
  padding-left: 34px;
}

/* ---------- 8. 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.7;
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-mute {
  background: #f1f4f9;
  color: var(--muted);
}

.badge-role {
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-100);
}

/* ---------- 9. 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.table th {
  text-align: left;
  font-weight: 550;
  color: var(--muted);
  font-size: 12px;
  padding: 11px 14px;
  background: #fafcff;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
  vertical-align: middle;
}

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

table.table tbody tr:hover td {
  background: #fafcff;
}

table.table td.num,
table.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.table .strong {
  color: var(--ink);
  font-weight: 600;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cell-user .meta b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.cell-user .meta span {
  font-size: 11.5px;
  color: var(--muted-2);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* ---------- 10. KPI ---------- */
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
}

.kpi-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--blue-50);
  color: var(--blue-600);
}

.kpi-ico.green {
  background: var(--ok-bg);
  color: var(--ok);
}

.kpi-ico.orange {
  background: var(--warn-bg);
  color: var(--warn);
}

.kpi-ico.red {
  background: var(--bad-bg);
  color: var(--bad);
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-value small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
  margin-left: 3px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted-2);
}

/* ---------- 11. 打卡卡 ---------- */
.punch-card {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 48%, #3b82f6 100%);
  border: none;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.punch-card::after {
  content: '';
  position: absolute;
  right: -80px;
  top: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.punch-card::before {
  content: '';
  position: absolute;
  right: 40px;
  bottom: -110px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.punch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.punch-hello {
  font-size: 13px;
  opacity: 0.82;
}

.punch-clock {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.punch-date {
  font-size: 12.5px;
  opacity: 0.8;
  margin-top: 2px;
}

.punch-shift {
  text-align: right;
  font-size: 12.5px;
  opacity: 0.9;
  line-height: 1.8;
}

.punch-shift b {
  font-size: 17px;
  font-weight: 600;
  display: block;
  letter-spacing: 0.5px;
}

.punch-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.btn-punch {
  background: #fff;
  color: var(--blue-700);
  height: 46px;
  padding: 0 26px;
  font-size: 15px;
  font-weight: 650;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(6, 20, 50, 0.18);
}

.btn-punch:hover {
  background: #f3f7ff;
}

.btn-punch.out {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: none;
}

.btn-punch.out:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn-punch:disabled {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.7);
  box-shadow: none;
  cursor: not-allowed;
}

.punch-timeline {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.punch-node {
  flex: 1;
  min-width: 140px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(4px);
}

.punch-node .t {
  font-size: 11.5px;
  opacity: 0.78;
}

.punch-node .v {
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.punch-node .d {
  font-size: 11px;
  opacity: 0.8;
}

/* ---------- 12. 日历 ---------- */
.calendar {
  --cell-gap: 6px;
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--cell-gap);
  margin-bottom: 6px;
}

.cal-week span {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-2);
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--cell-gap);
}

.cal-cell {
  min-height: 88px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 6px 7px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.08s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.cal-cell:hover {
  border-color: var(--blue-300);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
}

.cal-cell.empty {
  background: transparent;
  border: none;
  pointer-events: none;
}

.cal-cell.out {
  background: #fafbfe;
  color: var(--muted-2);
}

.cal-cell.today {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 2px rgba(59, 118, 246, 0.16);
}

.cal-day {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-cell.out .cal-day {
  color: var(--muted-2);
  font-weight: 500;
}

.cal-cell.today .cal-day {
  color: var(--blue-700);
}

.cal-times {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.cal-cell .badge {
  font-size: 10px;
  padding: 0 6px;
  align-self: flex-start;
  margin-top: auto;
}

.cal-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line-2);
}

.cal-legend i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
}

.dot-ok {
  background: var(--ok);
}
.dot-warn {
  background: var(--warn);
}
.dot-bad {
  background: var(--bad);
}
.dot-info {
  background: var(--blue-500);
}
.dot-mute {
  background: #c4ccda;
}

/* ---------- 13. 时间轴 / 列表 ---------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

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

.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  flex: none;
  background: var(--blue-400);
}

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

.tl-body b {
  font-size: 13px;
  font-weight: 600;
}

.tl-body p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.tl-time {
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}

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

.list-row .grow b {
  font-size: 13px;
  font-weight: 600;
}

.list-row .grow span {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
}

/* ---------- 14. 进度条 ---------- */
.progress {
  height: 7px;
  border-radius: 99px;
  background: var(--line-2);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-600));
}

.progress.green > i {
  background: linear-gradient(90deg, #34d399, var(--ok));
}

.progress.orange > i {
  background: linear-gradient(90deg, #fbbf24, var(--warn));
}

/* ---------- 15. 分段控件 / 筛选条 ---------- */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: #f1f4f9;
  border-radius: 10px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 550;
  transition: background 0.16s, color 0.16s;
  white-space: nowrap;
}

.segmented button.active {
  background: #fff;
  color: var(--blue-700);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .input,
.toolbar .select {
  width: auto;
  min-width: 132px;
  height: 36px;
}

.toolbar .search-box .input {
  width: 100%;
}

/* ---------- 16. 薪资明细 ---------- */
.payslip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.payslip-hero {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
  padding: 24px 24px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.payslip-hero .label {
  font-size: 12.5px;
  opacity: 0.82;
}

.payslip-hero .amount {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin-top: 2px;
}

.payslip-hero .aside {
  font-size: 12.5px;
  text-align: right;
  line-height: 1.9;
  opacity: 0.94;
}

.payslip-body {
  padding: 6px 24px 20px;
  background: #fff;
}

.pline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.pline:last-child {
  border-bottom: none;
}

.pline .l {
  color: var(--ink-2);
}

.pline .l span {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
}

.pline .a {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.pline.total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 14px;
  font-size: 14px;
}

.pline .a.plus {
  color: var(--ok);
}

.pline .a.minus {
  color: var(--bad);
}

.payslip-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 24px;
  background: #fafcff;
  border-top: 1px solid var(--line-2);
}

.payslip-stats div {
  text-align: center;
}

.payslip-stats span {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
}

.payslip-stats b {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- 17. 空状态 ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted-2);
}

.empty .empty-ico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--line-2);
  color: var(--muted-2);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
}

.empty b {
  display: block;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty p {
  font-size: 12.5px;
}

/* ---------- 18. Toast ---------- */
#toast-root {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--ink-2);
  transform: translateY(-10px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.in {
  opacity: 1;
  transform: translateY(0);
}

.toast-success .ic {
  color: var(--ok);
}

.toast-error .ic {
  color: var(--bad);
}

.toast-info .ic {
  color: var(--blue-600);
}

/* ---------- 19. Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 28, 51, 0.42);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s;
}

.modal-overlay.in {
  opacity: 1;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.99);
  transition: transform 0.18s;
}

.modal-overlay.in .modal {
  transform: none;
}

.modal.sm {
  max-width: 420px;
}

.modal.lg {
  max-width: 780px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-2);
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 650;
}

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

.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line-2);
}

.confirm-text {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* ---------- 20. 登录 ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fff;
}

.auth-side {
  background: linear-gradient(150deg, #0f2a63 0%, #1d4ed8 52%, #3b82f6 100%);
  color: #fff;
  padding: 46px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-side::after {
  content: '';
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  right: -160px;
  bottom: -180px;
}

.auth-side::before {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  left: -90px;
  top: 120px;
}

.auth-side .brand {
  padding: 0;
  position: relative;
  z-index: 1;
}

.auth-side .brand-mark {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.auth-side .brand-text b {
  color: #fff;
}

.auth-side .brand-text span {
  color: rgba(255, 255, 255, 0.62);
}

.auth-hero {
  position: relative;
  z-index: 1;
  max-width: 430px;
}

.auth-hero h2 {
  font-size: 34px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-hero p {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.8);
}

.auth-feats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.auth-feat {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.auth-feat .fi {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  flex: none;
}

.auth-side .foot {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  position: relative;
  z-index: 1;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-box {
  width: 100%;
  max-width: 392px;
}

.auth-box h1 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-box .desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  margin-bottom: 22px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: #f1f4f9;
  padding: 4px;
  border-radius: 11px;
  margin-bottom: 18px;
}

.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.16s, color 0.16s;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--blue-700);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .field-label {
  font-size: 12.5px;
}

.auth-form .input {
  height: 42px;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.auth-links a {
  cursor: pointer;
}

.auth-error {
  display: none;
  align-items: flex-start;
  gap: 8px;
  background: var(--bad-bg);
  color: #a92020;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 9px;
  line-height: 1.6;
}

.auth-error.show {
  display: flex;
}

.auth-tip {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f9fd;
  border: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.9;
}

.auth-tip b {
  color: var(--ink-2);
}

.auth-tip code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--blue-700);
}

/* ---------- 21. 其它 ---------- */
.stat-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
}

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

.stat-line b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f7faff;
  border: 1px solid var(--blue-100);
  color: var(--blue-800);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 12.5px;
  line-height: 1.7;
}

.notice.warn {
  background: #fffbf3;
  border-color: #fbe3bd;
  color: #92560a;
}

.notice .ic {
  margin-top: 2px;
}

.divider {
  height: 1px;
  background: var(--line-2);
  margin: 16px 0;
}

.section-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  margin: 4px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--blue-600);
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 11.5px;
}

.nowrap {
  white-space: nowrap;
}

.hide-sm {
  display: initial;
}

/* 骨架屏 */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--blue-100);
  border-top-color: var(--blue-600);
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 22. 响应式 ---------- */
@media (max-width: 1180px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payslip-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .auth-side {
    display: none;
  }
  .content {
    padding: 20px 20px 40px;
  }
}

@media (max-width: 860px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    overflow: visible;
    box-shadow: 0 -4px 18px rgba(16, 33, 62, 0.07);
  }

  /* 底部导航：品牌 / 分组标题 / 页脚用户卡均隐藏，只保留图标+文字 */
  .sidebar .brand,
  .sidebar .nav-group-title,
  .sidebar-foot {
    display: none;
  }

  .sidebar-nav {
    flex: 1;
    flex-direction: row;
    gap: 2px;
  }

  .sidebar .nav-item {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 8px 2px;
    font-size: 10.5px;
    border-radius: 10px;
    justify-content: center;
    text-align: center;
    position: relative;
  }

  .sidebar .nav-item .nav-label {
    display: block;
    font-size: 10.5px;
    line-height: 1.3;
    white-space: nowrap;
  }

  .sidebar .nav-item .nav-dot {
    position: absolute;
    top: 3px;
    right: 8px;
    margin: 0;
  }

  .topbar {
    display: flex;
  }

  .content {
    padding: 18px 14px 96px;
  }

  /* 移动端 Toast 贴底部导航上方，避免遮挡顶栏 */
  #toast-root {
    top: auto;
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .toast {
    transform: translateY(10px);
  }

  .toast.in {
    transform: translateY(0);
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 四宫格 KPI 在移动端保持 2×2，避免过度拉长页面 */
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 12px 13px;
    gap: 5px;
    border-radius: 12px;
  }

  .kpi-label {
    font-size: 11.5px;
  }

  .kpi-ico {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }

  .kpi-value {
    font-size: 21px;
  }

  .kpi-sub {
    font-size: 10.5px;
    line-height: 1.45;
  }

  /* 打卡时间轴：三列等宽，避免掉行 */
  .punch-timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 18px;
  }

  .punch-node {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .punch-node .t {
    font-size: 10.5px;
  }

  .punch-node .v {
    font-size: 16px;
  }

  .punch-node .d {
    font-size: 10px;
    line-height: 1.4;
  }

  .span-2 {
    grid-column: auto;
  }

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

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

  .punch-clock {
    font-size: 34px;
  }

  .punch-actions .btn-punch {
    flex: 1;
    padding: 0 12px;
    font-size: 14px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cal-cell {
    min-height: 56px;
    padding: 4px 5px;
    border-radius: 8px;
  }

  .cal-times {
    display: none;
  }

  .cal-cell .badge {
    font-size: 9px;
    padding: 0 4px;
    margin-top: 2px;
  }

  .cal-day {
    font-size: 11.5px;
  }

  .cal-legend {
    font-size: 11px;
    gap: 10px;
  }

  .card {
    padding: 16px;
  }

  .payslip-hero {
    padding: 20px 18px;
  }

  .payslip-hero .amount {
    font-size: 30px;
  }

  .payslip-body,
  .payslip-stats {
    padding-left: 18px;
    padding-right: 18px;
  }

  .modal {
    max-width: 100%;
    max-height: 90vh;
  }

  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    border-radius: 18px;
  }

  .toolbar {
    gap: 8px;
  }

  .toolbar .input,
  .toolbar .select {
    min-width: 0;
    flex: 1;
  }

  .toolbar .search-box {
    min-width: 100%;
  }

  /* 表格转卡片 */
  table.table.responsive thead {
    display: none;
  }

  table.table.responsive,
  table.table.responsive tbody,
  table.table.responsive tr,
  table.table.responsive td {
    display: block;
    width: 100%;
  }

  table.table.responsive tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: #fff;
  }

  table.table.responsive tbody tr:hover td {
    background: transparent;
  }

  table.table.responsive td {
    border: none;
    padding: 7px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }

  table.table.responsive td::before {
    content: attr(data-l);
    color: var(--muted-2);
    font-size: 12px;
    font-weight: 400;
    text-align: left;
    flex: none;
  }

  table.table.responsive td:empty {
    display: none;
  }

  table.table.responsive td[data-l='']::before {
    display: none;
  }

  .table-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .hide-sm {
    display: none;
  }
}

@media (max-width: 420px) {
  .punch-hello {
    font-size: 12px;
  }
  .punch-clock {
    font-size: 30px;
  }
  .kpi-value {
    font-size: 20px;
  }
  .cal-grid,
  .cal-week {
    gap: 4px;
  }
  .cal-cell {
    min-height: 48px;
  }
}

@media print {
  .sidebar,
  .topbar,
  .head-actions {
    display: none !important;
  }
  .content {
    padding: 0;
  }
  body {
    background: #fff;
  }
}
