/* ============================================================
   考勤打卡 · Apple 风格 UI
   设计语言:通透留白 + 毛玻璃卡片 + 大圆角 + 克制配色 + 细腻动效
   ============================================================ */

:root {
  --bg: #f5f5f7;            /* 苹果经典浅灰背景 */
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --text: #1d1d1f;          /* 苹果近黑 */
  --text-2: #6e6e73;        /* 次要灰 */
  --text-3: #86868b;        /* 更浅 */
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;          /* 苹果蓝 */
  --blue-press: #0062c4;
  --green: #34c759;         /* iOS 绿 */
  --orange: #ff9500;        /* iOS 橙 */
  --red: #ff3b30;           /* iOS 红 */
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-press: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
    "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  /* 苹果营销页那种柔和光晕背景 */
  background-image:
    radial-gradient(60% 50% at 15% 0%, rgba(0, 113, 227, 0.10), transparent 70%),
    radial-gradient(50% 45% at 100% 10%, rgba(175, 82, 222, 0.08), transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
  max-width: 500px;
  margin: 0 auto;
  padding-bottom: 60px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部 ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 20px 12px;
  background: rgba(245, 245, 247, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
header h1 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 12px;
}

/* 分段控制器(iOS Segmented Control) */
.tabs {
  display: flex;
  gap: 2px;
  background: rgba(120, 120, 128, 0.12);
  border-radius: 10px;
  padding: 2px;
}
.tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.1s ease;
}
.tab.active {
  background: var(--card-solid);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}
.tab:active { transform: scale(0.97); }

/* ---------- 页面与卡片 ---------- */
.page { display: none; padding: 20px; }
.page.active { display: block; animation: fadein 0.4s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

/* ---------- 表单控件 ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
select, input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;            /* 16px 防止 iOS 聚焦时自动放大 */
  font-family: inherit;
  color: var(--text);
  background: rgba(118, 118, 128, 0.08);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-top: 2px;
  transition: border-color 0.2s ease, background 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
select:focus, input:focus {
  outline: none;
  background: var(--card-solid);
  border-color: var(--blue);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2386868b' d='M6 8L0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ---------- 时钟卡 ---------- */
.clock-card { text-align: center; padding: 26px 20px; }
.current-time {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #1d1d1f, #434345);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.current-date { color: var(--text-3); font-size: 14px; margin-top: 6px; }

/* ---------- 打卡大按钮 ---------- */
.punch-buttons { display: flex; gap: 12px; margin-bottom: 16px; }
.btn {
  flex: 1;
  padding: 17px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.btn:active { transform: scale(0.96); box-shadow: var(--shadow-press); }
.btn:disabled { opacity: 0.45; transform: none; box-shadow: none; }
/* 素雅双色:上班=苹果蓝实心,下班=浅灰底深色字 */
.btn-in {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.28);
}
.btn-in:active { background: var(--blue-press); }
.btn-out {
  background: rgba(118, 118, 128, 0.12);
  color: var(--text);
  box-shadow: none;
}
.btn-out:active { background: rgba(118, 118, 128, 0.2); }

/* 小按钮(主操作=蓝色) */
.btn-small {
  flex: none;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 500;
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  box-shadow: none;
  margin-top: 10px;
}
.btn-small:active { background: var(--blue-press); transform: scale(0.97); }
.btn-danger { background: var(--red); }
.btn-danger:active { background: #d62a20; }

/* ---------- 打卡结果提示 ---------- */
.status {
  text-align: center;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  animation: fadein 0.3s ease;
}
.status:empty { display: none; }
.status.success { background: rgba(52, 199, 89, 0.14); color: #1c7a36; }
.status.error { background: rgba(255, 59, 48, 0.12); color: #c4291f; }
.status.info { background: rgba(0, 113, 227, 0.10); color: var(--blue-press); }

/* ---------- 打卡记录条目 ---------- */
.record-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.record-item:last-child { border-bottom: none; }
.badge {
  padding: 3px 10px;
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.badge-in { background: var(--green); }
.badge-out { background: var(--orange); }

/* ---------- 杂项 ---------- */
.muted { color: var(--text-3); font-size: 13px; margin-bottom: 10px; }
.hint {
  background: rgba(255, 149, 0, 0.12);
  color: #9a5b00;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.row > * { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }

/* 员工标签(胶囊) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip {
  background: rgba(0, 113, 227, 0.10);
  color: var(--blue-press);
  padding: 7px 12px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
}
.chip button {
  border: none;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s ease;
}
.chip button:active { background: var(--red); }

/* ---------- 统计表 ---------- */
.table-wrap { overflow-x: auto; margin-top: 14px; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 8px; text-align: center; border-bottom: 1px solid var(--line); }
th {
  background: rgba(118, 118, 128, 0.06);
  font-weight: 600;
  color: var(--text-2);
  font-size: 13px;
}
tr:last-child td { border-bottom: none; }
.st-late { color: var(--orange); font-weight: 600; }
.st-absent { color: var(--red); font-weight: 600; }
.st-ok { color: var(--green); font-weight: 600; }

/* 设备列 / 一机多人警告 */
.dev-ok { color: var(--text-3); font-size: 13px; }
.dev-warn { color: var(--red); font-weight: 600; font-size: 12px; white-space: nowrap; }
.warn-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255, 59, 48, 0.10);
  color: #c4291f;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}

/* 登录提示行 */
#login-msg:not(:empty) { margin-top: 10px; }

/* ---------- 底部 Logo / 页脚 ---------- */
.app-footer {
  text-align: center;
  padding: 36px 20px 16px;
  animation: fadein 0.6s ease;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.footer-icon {
  filter: drop-shadow(0 4px 10px rgba(10, 132, 255, 0.28));
  border-radius: 9px;
}
.footer-wordmark {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-sub {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
  letter-spacing: 0.02em;
}
