/* ============================================================
 * 打卡助手 - 样式（移动端优先，浅色主题）
 * ============================================================ */

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --red: #fa5151;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #8a8f99;
  --line: #eceef1;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(17, 24, 39, 0.06);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- 顶部 ---------------- */
.hero {
  background: linear-gradient(135deg, #07c160 0%, #0aa85c 100%);
  color: #fff;
  padding: calc(28px + env(safe-area-inset-top)) 24px 34px;
  border-radius: 0 0 26px 26px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(7, 193, 96, 0.24);
}

.hero-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 2px;
  opacity: 0.92;
}

.hero-time {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  margin: 8px 0 2px;
  line-height: 1.1;
}

.hero-date {
  font-size: 13px;
  opacity: 0.86;
}

/* ---------------- 内容区 ---------------- */
.content {
  flex: 1;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* ---------------- 分段控件 ---------------- */
.segmented {
  display: flex;
  background: #f2f4f6;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.seg-item {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  padding: 12px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-item span {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.65;
  margin-left: 2px;
}

.seg-item.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 6px rgba(17, 24, 39, 0.1);
}

/* ---------------- 今日打卡状态 ---------------- */
.today-status {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.today-item {
  flex: 1;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  min-width: 0;
}

.today-item .today-head {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 3px;
}

.today-item .today-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.today-item.done { background: #eefaf2; border-color: #cdeedb; }
.today-item.done .today-value { color: var(--green); }
.today-item.pending .today-value { color: #c3c9d2; font-weight: 500; }

/* ---------------- 类型提示（如下班打卡时间限制） ---------------- */
.type-hint {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff8ec;
  border: 1px solid #ffe3b8;
  color: #a8690a;
  font-size: 12px;
  line-height: 1.6;
}

.type-hint b { font-weight: 600; }

/* ---------------- 考勤时间 ---------------- */
.card-label.clickable { cursor: pointer; user-select: none; }

.chevron {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
}

.schedule {
  list-style: none;
  margin: 0;
  padding: 0;
  animation: fadeUp 0.18s ease;
}

.schedule li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.schedule li:last-child { border-bottom: none; padding-bottom: 0; }

.schedule .role { flex: 1; color: var(--text); }

.schedule .slot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.schedule .slot .tag {
  font-size: 11px;
  color: var(--text-sub);
}

.schedule .slot b { font-weight: 600; }

.schedule .arrow { color: #c3c9d2; margin: 0 2px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: 11px;
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  -webkit-appearance: none;
}

.field input:focus {
  border-color: var(--green);
  background: #fff;
}

.field input::placeholder { color: #b9bfc9; }

.input-wrap { position: relative; }

.input-wrap input { padding-right: 48px !important; }

.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 17px;
  padding: 8px 10px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

/* ---------------- 开关行 ---------------- */
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 14px;
  cursor: pointer;
}

.switch-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
  flex: none;
}

/* ---------------- 定位 ---------------- */
.mini-btn {
  border: none;
  background: #eefaf2;
  color: var(--green);
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  cursor: pointer;
}

.mini-btn:active { background: #dff5e8; }

.mini-btn:disabled { opacity: 0.55; cursor: default; }

.mini-btn.ghost {
  background: #f2f4f6;
  color: var(--text-sub);
}

.label-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.geo-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-sub);
  margin-top: 10px;
}

.geo-hint b { color: var(--green); font-weight: 600; }

.geo-hint.warn b { color: var(--red); }

.lnglat {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.lnglat-item {
  flex: 1;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
}

.lnglat-item span {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.lnglat-item b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------------- 主按钮 ---------------- */
.primary-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #07c160 0%, #0aa85c 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 1px;
  padding: 16px 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(7, 193, 96, 0.3);
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
}

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

.primary-btn:disabled {
  opacity: 0.62;
  box-shadow: none;
  cursor: default;
}

/* ---------------- 结果 ---------------- */
.result {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeUp 0.22s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.result-head {
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.result-head.info { background: #2f7fed; }
.result-head.warn { background: #ef8f00; }
.result-head.ok { background: var(--green); }
.result-head.fail { background: var(--red); }

.result-body {
  margin: 0;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.8;
  color: #4a4f57;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------------- 历史 ---------------- */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.history-item:last-child { border-bottom: none; padding-bottom: 0; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot.ok { background: var(--green); }
.dot.fail { background: var(--red); }
.dot.info { background: #2f7fed; }
.dot.warn { background: #ef8f00; }

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

.history-title { font-size: 14px; font-weight: 500; }

.history-sub {
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  font-size: 12px;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ---------------- 页脚 ---------------- */
.footer {
  text-align: center;
  font-size: 12px;
  color: #b0b6bf;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translate(-50%, 10px);
  max-width: 78vw;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 99;
  text-align: center;
}

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

/* ---------------- 深色模式 ---------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1d2025;
    --text: #f1f3f5;
    --text-sub: #9096a0;
    --line: #2a2e35;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
  .segmented { background: #24282e; }
  .seg-item.active { background: #2e333a; box-shadow: none; }
  .field input[type="text"],
  .field input[type="tel"],
  .field input[type="password"] { background: #24282e; color: var(--text); }
  .field input:focus { background: #2a2f36; }
  .lnglat-item { background: #24282e; }
  .mini-btn { background: rgba(7, 193, 96, 0.16); }
  .mini-btn.ghost { background: #24282e; color: var(--text-sub); }
  .today-item { background: #24282e; }
  .today-item.done { background: rgba(7, 193, 96, 0.12); border-color: rgba(7, 193, 96, 0.3); }
  .today-item.pending .today-value { color: #5c626b; }
  .type-hint {
    background: rgba(239, 143, 0, 0.12);
    border-color: rgba(239, 143, 0, 0.28);
    color: #e8a94a;
  }
  .result-body { color: #b9c0c9; }
}
