/* 企业版微信管理系统 全局样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f5f9;
  --radius: 12px;
  --sidebar-w: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 120;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
}
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.menu-btn:hover { background: #f3f4f6; }
.brand { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text-light);
  font-size: 13px;
  white-space: nowrap;
}
.nav-user .uname { overflow: hidden; text-overflow: ellipsis; }

/* 抽屉式侧边栏（移动端默认收起） */
.sidebar {
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 0;
  z-index: 110;
  width: var(--sidebar-w);
  padding: 12px 10px;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
html.nav-open .sidebar { transform: translateX(0); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14px;
}
.side-nav a:hover { background: #f3f4f6; color: var(--text); text-decoration: none; }
.side-nav a.active { background: #eff6ff; color: var(--primary); font-weight: 600; }
.sidebar-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 105;
  background: rgba(15, 23, 42, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
html.nav-open .sidebar-mask { opacity: 1; pointer-events: auto; }

/* 桌面端：侧边栏默认展开、可收起 */
@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  html.nav-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-mask { display: none; }
  .main { padding-left: var(--sidebar-w); transition: padding-left .25s ease; }
  html.nav-collapsed .main { padding-left: 0; }
}

/* 页面容器 */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; }

/* 卡片 */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 800px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* 统计卡片 */
.stat { text-align: center; }
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat .label { color: var(--text-light); font-size: 13px; margin-top: 4px; }

/* 打卡状态 */
.punch-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.punch-row:last-child { border-bottom: none; }
.punch-time { font-size: 24px; font-weight: 700; }
.big-num { font-size: 34px; font-weight: 700; color: var(--primary); }
.muted { color: var(--text-light); }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  line-height: 1.4;
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-outline { border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 5px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 90px; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.form-check input { width: auto; }
.form-check label { margin: 0; }
/* 下载页开关（toggle） */
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 999px;
  transition: background .2s; cursor: pointer;
}
.switch .slider::before {
  content: "";
  position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form .form-row { margin-bottom: 0; flex: 1; min-width: 140px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table th { color: var(--text-light); font-weight: 500; font-size: 13px; background: #fafbfc; }
table.table tr:hover td { background: #f8fafc; }

/* 徽标 */
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.7;
}
.badge-blue { background: #eff6ff; color: var(--primary); }
.badge-green { background: #ecfdf5; color: var(--success); }
.badge-gray { background: #f3f4f6; color: var(--text-light); }
.badge-red { background: #fef2f2; color: var(--danger); }

/* 提示横幅 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* 消息列表 */
.msg-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.msg-item:last-child { border-bottom: none; }
.msg-title { font-weight: 600; color: var(--text); }
.msg-title .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 1px; }
.msg-meta { color: var(--text-light); font-size: 12.5px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.msg-content { white-space: pre-wrap; word-break: break-word; margin-top: 8px; }

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card .brand-lg { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-light); font-size: 13px; margin-bottom: 22px; }
.login-card .btn { width: 100%; }

/* 下载页 */
.dl-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.dl-item:last-child { border-bottom: none; }
.dl-info { min-width: 0; }
.dl-name { word-break: break-all; }
.dl-meta { color: var(--text-light); font-size: 12.5px; margin-top: 2px; }

/* 标签组 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-group { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.chip-group label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.chip-group input { width: auto; }

/* 月度切换 */
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav .month { font-weight: 600; min-width: 80px; text-align: center; }

.empty { text-align: center; color: var(--text-light); padding: 24px 0; }
