/* JMD 出勤管理系统 - 共用样式 */
:root {
  --brand: #146b4f;
  --brand-2: #2f9e6e;
  --brand-soft: #e3f1e8;
  --brand-line: #bcdccb;
  --ink: #1d2b25;
  --ink-2: #5b6b64;
  --ink-3: #8b9a93;
  --line: #dbe6e0;
  --bg: #f2f6f4;
  --card: #ffffff;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --warn: #b7791f;
  --warn-soft: #fdf4e3;
  --ok: #2f9e6e;
  --ok-soft: #e7f6ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 50, 40, .05), 0 8px 24px rgba(20, 50, 40, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); }

.hidden { display: none !important; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  font-size: 14px;
  transition: .15s;
  border: 1px solid transparent;
}
.btn:hover { background: #d6ebe0; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #0f5941; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: #f6faf8; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: #fbdcd9; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: .15s;
}
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47, 158, 110, .12); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.6; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: #1f7a55; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.mute { background: #eef2f0; color: var(--ink-3); }
.tag.blue { background: #e8f0fb; color: #2b6cb0; }

.empty {
  text-align: center;
  color: var(--ink-3);
  padding: 40px 12px;
  font-size: 14px;
}

.toast-wrap {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(24, 40, 33, .94);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  animation: toastIn .25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  max-width: 80vw;
}
.toast.err { background: rgba(170, 42, 32, .96); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ==================== 员工端 ==================== */
.emp-body {
  background: linear-gradient(180deg, #146b4f 0, #146b4f 190px, var(--bg) 190px, var(--bg) 100%);
  min-height: 100vh;
}

.phone {
  max-width: 460px;
  margin: 0 auto;
  padding: 0 14px 100px;
}

.emp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 4px 18px;
  color: #fff;
}
.emp-logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: .5px; font-size: 14px;
}
.emp-head h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: .5px; }
.emp-head p { margin: 2px 0 0; font-size: 12.5px; opacity: .82; }

.clock-card {
  text-align: center;
  padding: 26px 18px 22px;
}
.clock-time {
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  line-height: 1.1;
}
.clock-date { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; }

.emp-id-card { text-align: center; padding: 26px 20px; }
.emp-id-card h2 { margin: 0 0 6px; font-size: 17px; }
.emp-id-card p { margin: 0 0 20px; color: var(--ink-2); font-size: 13.5px; }

.who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.who-left { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.who-name { font-weight: 700; font-size: 15.5px; }
.who-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

/* 打卡状态 */
.punch-panel { padding: 18px; }
.punch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.punch-slot {
  background: #f7faf8;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 13px 14px;
}
.punch-slot .lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.punch-slot .val {
  font-size: 24px; font-weight: 700; margin-top: 3px;
  font-variant-numeric: tabular-nums; color: var(--ink-3); letter-spacing: .5px;
}
.punch-slot.filled { background: var(--brand-soft); border-style: solid; border-color: var(--brand-line); }
.punch-slot.filled .val { color: var(--brand); }

.big-btn {
  width: 100%;
  padding: 19px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(180deg, #2f9e6e, #1a7d55);
  box-shadow: 0 6px 18px rgba(31, 122, 85, .3);
  transition: .15s;
}
.big-btn:active { transform: scale(.98); }
.big-btn.out { background: linear-gradient(180deg, #e08a3c, #c8722a); box-shadow: 0 6px 18px rgba(200, 114, 42, .28); }
.big-btn:disabled { background: #dfe8e3; color: var(--ink-3); box-shadow: none; transform: none; }

.hours-bar { margin-top: 16px; }
.hours-bar-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 7px; }
.hours-bar-top b { color: var(--brand); font-size: 15px; }
.bar { height: 9px; background: #eaf1ed; border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4bb98a, #146b4f); border-radius: 20px; transition: width .5s; }

.quick-row { display: flex; gap: 10px; margin-top: 14px; }
.quick-row .btn { flex: 1; padding: 11px; }

.today-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 9px 12px;
  line-height: 1.5;
}

/* 我的记录 */
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(20,50,40,.04);
}
.rec-day { width: 52px; text-align: center; flex: none; }
.rec-day b { display: block; font-size: 17px; }
.rec-day span { font-size: 11.5px; color: var(--ink-3); }
.rec-mid { flex: 1; min-width: 0; }
.rec-mid .t { font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rec-mid .s { font-size: 12px; color: var(--ink-3); }
.rec-hours { text-align: right; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.rec-hours small { display: block; font-weight: 500; color: var(--ink-3); font-size: 11px; }

.sum-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--brand); color: #fff; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
}
.sum-bar .k { font-size: 12.5px; opacity: .85; }
.sum-bar .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-bar .v small { font-size: 12px; font-weight: 500; opacity: .85; margin-left: 2px; }

/* 备案号（工信部要求首页底部展示并链接至备案官网） */
.beian {
  text-align: center; font-size: 12px; color: #98a2b3;
  padding: 6px 12px 0; line-height: 1.6;
}
.beian a { color: #98a2b3; text-decoration: none; }
.beian a:hover { text-decoration: underline; color: var(--brand); }
.admin-body .beian { padding: 10px 0 26px; }

/* 底部标签栏 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tb {
  flex: 1; text-align: center; padding: 9px 0 10px;
  color: var(--ink-3); font-size: 11.5px; font-weight: 600;
}
.tabbar .tb.active { color: var(--brand); }
.tabbar .tb i { display: block; font-size: 20px; height: 24px; }
.tabbar .tb.active i { transform: translateY(-1px); }

.section-title { font-size: 15px; font-weight: 700; margin: 18px 2px 10px; }

/* ==================== 管理端 ==================== */
.admin-body { background: #eef3f0; min-height: 100vh; }

.top-bar {
  background: linear-gradient(135deg, #146b4f, #0d5540);
  color: #fff;
  padding: 0;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(12, 60, 45, .18);
}
.top-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 58px;
}
.top-inner .logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.17);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px;
  border: 1px solid rgba(255,255,255,.28);
}
.top-inner .title { font-weight: 700; font-size: 15.5px; letter-spacing: .4px; }
.top-inner .title small { display: block; font-weight: 400; font-size: 11.5px; opacity: .72; letter-spacing: 0; margin-top: -1px; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav button {
  color: rgba(255,255,255,.72);
  padding: 7px 15px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: .15s;
}
.nav button:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav button.active { color: #146b4f; background: #fff; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.top-right .who2 { opacity: .85; }
.top-right .btn { background: rgba(255,255,255,.14); color: #fff; padding: 6px 13px; font-size: 13px; }
.top-right .btn:hover { background: rgba(255,255,255,.24); }

.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(20,50,40,.05);
  border-left: 3px solid var(--brand-line);
}
.kpi .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi .v small { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.kpi.g { border-left-color: #2f9e6e; } .kpi.g .v { color: #1f7a55; }
.kpi.o { border-left-color: #e0a33c; } .kpi.o .v { color: #b7791f; }
.kpi.r { border-left-color: #d9695c; } .kpi.r .v { color: #c0392b; }
.kpi.b { border-left-color: #5a8fd0; } .kpi.b .v { color: #2b6cb0; }

.panel {
  background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(20,50,40,.05);
  overflow: hidden; margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  background: #fbfdfc;
}
.panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.panel-head .sp { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.table-scroll { overflow-x: auto; }
table.grid {
  width: 100%; border-collapse: collapse; font-size: 13.5px;
  min-width: 720px;
}
table.grid th {
  background: var(--brand-soft);
  color: #14523d;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--brand-line);
  font-size: 13px;
  position: sticky; top: 0;
}
table.grid td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef3f0;
  vertical-align: middle;
}
table.grid tbody tr:hover { background: #f7fbf9; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tfoot td {
  background: #f4f8f6; font-weight: 700; border-top: 2px solid var(--brand-line);
}
table.grid .nm { font-weight: 600; }
table.grid .sub { color: var(--ink-3); font-size: 12px; }
.row-act { display: flex; gap: 5px; }

.day-cell { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.day-cell.bad { color: var(--danger); font-weight: 600; }

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 500px at 50% -10%, #1b7d5c 0%, #0e4f3b 45%, #0a3a2b 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 18px; padding: 30px 26px;
  box-shadow: 0 20px 60px rgba(0, 30, 20, .3);
}
.login-card .lg {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, #2f9e6e, #146b4f);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; margin-bottom: 16px;
}
.login-card h2 { margin: 0 0 4px; font-size: 20px; }
.login-card .tip { color: var(--ink-3); font-size: 13px; margin: 0 0 22px; }

.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row .input { width: auto; padding: 8px 12px; }

.seg {
  display: inline-flex; background: #eef3f0; border-radius: 9px; padding: 3px;
}
.seg button {
  padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.seg button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(20,50,40,.12); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 30, 24, .45);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  padding: 18px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 480px;
  max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(0, 30, 20, .28);
}
.modal-head {
  display: flex; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; color: var(--ink-3); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfdfc; border-radius: 0 0 16px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .top-inner { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .nav { margin-left: 0; width: 100%; overflow-x: auto; }
  .wrap { padding: 12px 12px 60px; }
  .kpi .v { font-size: 22px; }
}

/* ==================== 排行榜 / 日历 / 每日一句 ==================== */
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--line);
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eef2f0; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.rank-no.p1 { background: #fdeeb8; color: #a3720a; }
.rank-no.p2 { background: #eef0f3; color: #6b7a8c; }
.rank-no.p3 { background: #fbe3cf; color: #a05a20; }
.rank-name { font-weight: 600; font-size: 14px; }
.rank-line { font-size: 12px; color: var(--ink-3); }
.rank-val { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.rank-val b { color: var(--brand); font-size: 15px; }
.rank-val small { display: block; font-size: 11px; color: var(--ink-3); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .h {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  font-weight: 700; padding: 3px 0;
}
.cal-d {
  aspect-ratio: 1; border-radius: 8px;
  background: #f6f9f7;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.15;
}
.cal-d .dd { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cal-d .hh { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cal-d.work { background: var(--brand-soft); }
.cal-d.work .dd { color: var(--brand); }
.cal-d.work .hh { color: #1f7a55; font-weight: 700; }
.cal-d.leave { background: var(--warn-soft); }
.cal-d.off { opacity: .5; }
.cal-d.today { outline: 2px solid var(--brand-2); outline-offset: -2px; }
.cal-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.quote {
  background: linear-gradient(135deg, #146b4f, #2f9e6e);
  color: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 8px 20px rgba(20, 107, 79, .22);
}
.quote .q { font-size: 14.5px; line-height: 1.65; font-weight: 600; letter-spacing: .3px; }
.quote .s { font-size: 11.5px; opacity: .75; margin-top: 7px; }

/* 生日祝福动画 */
.birthday-wish {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 9999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.birthday-wish.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.bd-content {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: #fff;
  border-radius: 20px;
  padding: 32px 40px;
  text-align: center;
  font-size: 18px;
  line-height: 1.8;
  box-shadow: 0 20px 60px rgba(255, 107, 107, 0.4);
  animation: bounce 0.6s ease-in-out;
}
.bd-content b {
  font-size: 24px;
  display: block;
  margin: 8px 0;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 管理后台日历视图样式 */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.cal-day {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  font-size: 11px;
  position: relative;
  background: #fff;
}
.cal-day.empty {
  background: #f9fafb;
  border-color: transparent;
}
.cal-num {
  font-weight: 600;
  color: var(--ink-2);
  font-size: 13px;
  margin-bottom: 2px;
}
.cal-day.cal-normal {
  background: #d1fae5;
  border-color: #6ee7b7;
}
.cal-day.cal-partial {
  background: #fef3c7;
  border-color: #fcd34d;
}
.cal-day.cal-leave {
  background: #fed7aa;
  border-color: #fb923c;
}
.cal-day.cal-empty {
  background: #f6f9f7;
}
.cal-time {
  font-size: 11px;
  color: var(--ink-1);
  font-weight: 500;
  margin-top: 2px;
}
.cal-hours {
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 2px;
}
.cal-leave-tag {
  font-size: 9px;
  color: #c2410c;
  background: rgba(255, 255, 255, 0.7);
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  display: inline-block;
}
