:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e6eaf2;
  --text: #1c2536;
  --text-2: #5c687f;
  --text-3: #8a95a8;
  --primary: #2f6bff;
  --primary-dark: #2455d6;
  --primary-soft: #eaf1ff;
  --green: #12a150;
  --green-soft: #e7f7ee;
  --red: #dd4b4b;
  --red-soft: #fdeeee;
  --orange: #db8a1c;
  --orange-soft: #fff3e0;
  --purple: #7857e8;
  --purple-soft: #f0ecff;
  --gray-soft: #eef1f6;
  --shadow: 0 2px 8px rgba(29, 49, 90, .045), 0 12px 30px rgba(29, 49, 90, .035);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; flex: none; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; }
kbd { font-family: inherit; font-size: 12px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 15% 0%, #dfe9ff 0%, transparent 60%),
              radial-gradient(1000px 600px at 100% 100%, #e8e2ff 0%, transparent 55%), var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border);
  border-radius: 20px; padding: 38px 34px 30px; box-shadow: 0 20px 60px rgba(35, 62, 120, .12);
}
.login-logo {
  width: 54px; height: 54px; border-radius: 15px; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.login-logo .icon { width: 30px; height: 30px; }
.login-card h1 { font-size: 21px; margin: 0 0 6px; letter-spacing: .2px; }
.login-sub { color: var(--text-2); margin: 0 0 26px; font-size: 13px; }
.login-tip { color: var(--text-3); font-size: 12px; text-align: center; margin: 18px 0 0; line-height: 1.7; }
.form-error { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 12px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1220px; margin: 0 auto; padding: 13px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-mark .icon { width: 23px; height: 23px; }
.brand-title { font-weight: 650; font-size: 16px; line-height: 1.3; }
.brand-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.live-text { font-size: 12px; color: var(--green); font-weight: 600; }
.topbar-time { font-size: 12px; color: var(--text-3); margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---------- 布局 ---------- */
.container { max-width: 1220px; margin: 0 auto; padding: 22px 24px 40px; display: flex; flex-direction: column; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { font-size: 15px; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--primary); width: 17px; height: 17px; }
.card-desc { color: var(--text-2); font-size: 12.5px; margin: 0 0 16px; line-height: 1.7; }
.card-hint { font-size: 12px; color: var(--text-3); }
.divider { height: 1px; background: var(--border); margin: 20px 0 16px; }
.footer { text-align: center; color: var(--text-3); font-size: 12px; padding: 0 20px 30px; }

/* ---------- 概览卡片 ---------- */
.stat-card { padding: 18px 20px; }
.stat-head { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.stat-icon .icon { width: 17px; height: 17px; }
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin: 6px 0 2px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 11.5px; color: var(--text-3); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 8px 15px; font-size: 13px; font-weight: 550;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(47, 107, 255, .22); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-soft); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-lg { padding: 12px 20px; font-size: 14px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px 9px; background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-icon:hover { color: var(--primary); border-color: var(--primary); }
.btn-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.inline-form { display: flex; gap: 9px; align-items: flex-end; }
.inline-form .input { flex: 1; }
.inline-form.two { gap: 12px; }
.inline-form.two > div { flex: 1; min-width: 0; }
.inline-form.two .input { width: 100%; }
.inline-result { font-size: 12.5px; color: var(--text-2); }
.inline-result.ok { color: var(--green); }
.inline-result.bad { color: var(--red); }

.field-label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 550; margin: 14px 0 6px; }
.input {
  width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; font-size: 13px;
  font-family: inherit; color: var(--text); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); }
.input::placeholder { color: #adb6c6; }
.textarea { resize: vertical; min-height: 92px; line-height: 1.6; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
input[type="time"] { max-width: 170px; }

/* ---------- 状态标签 ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 100px; background: var(--gray-soft); color: var(--text-2); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.warn { background: var(--orange-soft); color: var(--orange); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.badge.st-success { background: var(--green-soft); color: var(--green); }
.badge.st-already { background: var(--primary-soft); color: var(--primary); }
.badge.st-failed, .badge.st-expired { background: var(--red-soft); color: var(--red); }
.badge.st-warning { background: var(--orange-soft); color: var(--orange); }
.badge.st-pending, .badge.st-none { background: var(--gray-soft); color: var(--text-3); }
.badge.st-skipped { background: var(--gray-soft); color: var(--text-2); }

/* ---------- 立即签到 ---------- */
.steps { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; gap: 11px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; transition: background .2s; position: relative; }
.step:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 30px; bottom: -4px; width: 1px; background: var(--border); }
.step-dot { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--border); background: #fff; flex: none; margin-top: 3px; display: flex; align-items: center; justify-content: center; }
.step-name { font-size: 13px; font-weight: 600; line-height: 1.5; }
.step-msg { font-size: 12px; color: var(--text-3); line-height: 1.5; word-break: break-all; }
.step.running { background: var(--primary-soft); }
.step.running .step-dot { border-color: var(--primary); border-top-color: transparent; animation: spin .7s linear infinite; }
.step.success .step-dot { background: var(--green); border-color: var(--green); }
.step.success .step-dot::after { content: ""; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.step.already .step-dot { background: var(--primary); border-color: var(--primary); }
.step.failed .step-dot, .step.expired .step-dot { background: var(--red); border-color: var(--red); }
.step.warning .step-dot { background: var(--orange); border-color: var(--orange); }
@keyframes spin { to { transform: rotate(360deg); } }
.result-banner { margin-top: 14px; border-radius: 10px; padding: 11px 14px; font-size: 13px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.result-banner.success, .result-banner.already { background: var(--green-soft); color: var(--green); }
.result-banner.already { background: var(--primary-soft); color: var(--primary); }
.result-banner.failed, .result-banner.expired { background: var(--red-soft); color: var(--red); }
.result-banner.warning { background: var(--orange-soft); color: var(--orange); }
.result-banner .icon { width: 16px; height: 16px; }

/* ---------- 开关 / 代码 ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--bg); border-radius: 10px; padding: 13px 15px; margin: 4px 0 4px; }
.switch-title { font-size: 13px; font-weight: 600; }
.switch-sub { font-size: 11.5px; color: var(--text-3); }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: #cfd6e2; border-radius: 100px; cursor: pointer; transition: background .2s; }
.switch-track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.code-row { display: flex; align-items: stretch; gap: 8px; margin-top: 6px; }
.code-row code { flex: 1; background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 11.5px; color: #43506a; overflow: auto; white-space: nowrap; }
.code-row .btn { align-self: stretch; }
.help-text { font-size: 11.5px; color: var(--text-3); line-height: 1.7; margin: 10px 0 0; }
.cookie-summary { font-size: 12.5px; color: var(--text-2); background: var(--bg); border-radius: 9px; padding: 9px 13px; }

/* ---------- 折叠说明 ---------- */
.details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.details summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 550; outline: none; }
.details-body { padding: 10px 2px 0; font-size: 12.5px; color: var(--text-2); }
.details-body ol { margin: 0; padding-left: 20px; line-height: 2; }

/* ---------- 日历 / 图表 ---------- */
.calendar { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin: 14px 0 12px; }
.cal-cell { aspect-ratio: 1 / 1; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; cursor: default; transition: transform .12s; font-variant-numeric: tabular-nums; }
.cal-cell:hover { transform: scale(1.12); }
.cal-cell.success { background: #37b26b; }
.cal-cell.already { background: #7ba4ff; }
.cal-cell.failed { background: #e47777; }
.cal-cell.warning { background: #edae5c; }
.cal-cell.none { background: #edf0f5; color: #a2abbb; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--text-3); }
.legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.success { background: #37b26b; } .lg.already { background: #7ba4ff; }
.lg.failed { background: #e47777; } .lg.none { background: #edf0f5; }
.chart-wrap { min-height: 190px; margin-top: 10px; display: flex; align-items: center; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-empty { width: 100%; text-align: center; color: var(--text-3); font-size: 12.5px; padding: 50px 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 11.5px; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #f0f2f7; color: var(--text-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfe; }
.table td.time { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.table td.empty { text-align: center; color: var(--text-3); padding: 30px; }
.table .points { color: var(--green); font-weight: 650; }
.table .muted { color: var(--text-3); }
.detail-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; font-family: inherit; padding: 0; }

/* ---------- 日志 / 提示 ---------- */
.log-box { margin-top: 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; height: 190px; overflow: auto; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11.5px; line-height: 1.9; color: #55627a; white-space: pre-wrap; word-break: break-all; }
.alert-bar { display: flex; align-items: center; gap: 9px; background: var(--orange-soft); color: #9a6112; border: 1px solid #f6dcb0; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; }
.alert-bar .icon { width: 16px; height: 16px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: #25324a; color: #fff; padding: 11px 17px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 28px rgba(20, 32, 55, .28); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .22s, transform .22s; z-index: 99; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b93b3b; }
.toast.ok { background: #1b8a52; }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 30, 50, .42); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 80vh; overflow: auto; padding: 22px 24px; box-shadow: 0 24px 70px rgba(20, 32, 55, .28); }
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal pre { background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; max-height: 340px; overflow: auto; color: #43506a; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 11px 16px; }
  .container { padding: 16px 14px 32px; gap: 14px; }
  .card { padding: 16px; }
  .grid-4 { grid-template-columns: 1fr; }
  .live-text, .topbar-time { display: none; }
  .calendar { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
  .cal-cell { font-size: 9px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form.two { flex-direction: column; }
}
