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

:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e3e8ef;
  --primary: #1d4ed8;
  --primary-600: #2563eb;
  --primary-soft: #e8efff;
  --ok: #047857;
  --ok-soft: #e6f6ef;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --bad: #b91c1c;
  --bad-soft: #fdeaea;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* ---------------- 登录页 ---------------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 600px at 50% -10%, #dbe6ff 0%, rgba(219, 230, 255, 0) 60%),
    linear-gradient(180deg, #f7f9fc 0%, #e9edf5 100%);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.28);
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: -8px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 26px 22px 22px;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 7px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary-600);
  background: #fff;
}

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.08s, opacity 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.24);
}

.btn-primary:disabled {
  background: #a9b8d8;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

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

.btn-ghost:hover {
  background: #e8ecf3;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 9px;
}

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

.login-tip {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  background: #f6f8fb;
  border-radius: 10px;
  padding: 10px 12px;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: var(--bad-soft);
  color: var(--bad);
}

.alert-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

/* ---------------- 移动端外壳 ---------------- */

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(160deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top)) 20px 20px;
  border-radius: 0 0 22px 22px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-name {
  font-size: 17px;
  font-weight: 700;
}

.topbar-meta {
  font-size: 12.5px;
  opacity: 0.85;
  margin-top: 2px;
}

.topbar-date {
  text-align: right;
  font-size: 12.5px;
  opacity: 0.9;
  line-height: 1.5;
}

.content {
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-title .sub {
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
}

/* 班次条 */
.shift-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  color: #1e3a8a;
}

.shift-bar b {
  font-weight: 700;
}

/* 打卡主卡 */
.punch-card {
  padding: 20px 16px 18px;
  text-align: center;
  background:
    radial-gradient(500px 200px at 50% 0%, #edf3ff 0%, rgba(255, 255, 255, 0) 70%),
    #fff;
}

.clock {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.clock-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.geo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  background: #f1f4f9;
  color: var(--muted);
  max-width: 100%;
}

.geo-pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.geo-pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.geo-pill.wait {
  background: var(--warn-soft);
  color: var(--warn);
}

.geo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.punch-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.punch-btn {
  width: 100%;
  border-radius: 16px;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #2f6bf0, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.punch-btn.out {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid #c7d6f5;
  box-shadow: none;
}

.punch-btn:disabled {
  background: #d4dbe8;
  color: #fff;
  border: none;
  box-shadow: none;
  cursor: not-allowed;
}

.punch-btn .ico {
  font-size: 18px;
  font-weight: 400;
  opacity: 0.9;
}

/* 方式切换 */
.seg {
  display: flex;
  background: #f1f4f9;
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
  margin-top: 16px;
}

.seg button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.seg button.on {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* 列表 */
.list {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f0f3f8;
}

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

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.row-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  flex: none;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: #f1f4f9;
  color: var(--muted);
  font-weight: 600;
  vertical-align: middle;
}

.tag.in {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag.out {
  background: var(--primary-soft);
  color: var(--primary);
}

.tag.field {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag.off {
  background: #f1f4f9;
  color: var(--muted);
}

.tag.absent {
  background: var(--bad-soft);
  color: var(--bad);
}

.tag.late {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag.leave {
  background: var(--primary-soft);
  color: var(--primary);
}

.tag.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sum-item {
  background: #f6f8fb;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}

.sum-item .n {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sum-item .l {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.req-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 22px 0;
}

/* 底部导航 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-inner {
  width: 100%;
  max-width: 520px;
  display: flex;
}

.tabbar button {
  flex: 1;
  padding: 9px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.tabbar button.on {
  color: var(--primary);
}

.tabbar .tab-ico {
  font-size: 18px;
  line-height: 1;
}

/* 我的页 */
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f3f8;
  font-size: 14px;
}

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

.kv span:first-child {
  color: var(--muted);
  flex: none;
}

.kv span:last-child {
  text-align: right;
  font-weight: 600;
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.rule-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.rule-item .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary-600);
  margin-top: 8px;
  flex: none;
}

/* 提示条 / 弹层 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  max-width: 88vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99;
  line-height: 1.6;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.err {
  background: rgba(153, 27, 27, 0.95);
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 80;
  padding: 0;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow: auto;
}

.modal h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn {
  flex: 1;
}

/* ---------------- 管理后台 ---------------- */

.admin-shell {
  min-height: 100vh;
  background: var(--bg);
}

.admin-head {
  background: #0f1e3d;
  color: #fff;
  padding: 0 20px;
}

.admin-head-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.admin-brand .mini-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  display: grid;
  place-items: center;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  opacity: 0.92;
}

.admin-tabs {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-tabs-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 0 20px;
  overflow-x: auto;
}

.admin-tabs button {
  padding: 14px 14px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}

.admin-tabs button.on {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-body {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px 60px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.stat {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat .num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat .lbl {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.stat.ok .num {
  color: var(--ok);
}

.stat.bad .num {
  color: var(--bad);
}

.table-wrap {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap .card-title {
  padding: 14px 16px 0;
  margin-bottom: 10px;
}

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

table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  padding: 9px 16px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 11px 16px;
  border-bottom: 1px solid #f2f5f9;
  vertical-align: middle;
}

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

table.data td.num {
  font-variant-numeric: tabular-nums;
}

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

.toolbar .grow {
  flex: 1;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-form .field {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

.rule-box {
  background: #f8fafd;
  border: 1px dashed #d6dfeb;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.9;
}

.rule-box code {
  background: #eef2f9;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}

@media (max-width: 720px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-body {
    padding: 14px 14px 60px;
  }
  .table-wrap {
    overflow-x: auto;
  }
  table.data {
    min-width: 640px;
  }
}

/* ---------- 两级审批（2026-10-19） ---------- */

.tag.pending {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 底部「审批」标签红点 */
.tabbar button {
  position: relative;
}
.tab-dot {
  position: absolute;
  top: 5px;
  right: 50%;
  margin-right: -20px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px #fff;
}

/* 申请卡片右侧的审批按钮组 */
.appr-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.appr-actions .btn {
  white-space: nowrap;
}

/* 员工管理：直属上级下拉 */
.select.select-mini {
  height: 30px;
  padding: 0 6px;
  font-size: 12.5px;
  min-width: 104px;
}

/* 微信内访问引导条（仅在微信中显示） */
.wx-tip {
  background: #0b63d6;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 12px;
  text-align: center;
}
.wx-tip.hidden {
  display: none;
}
