/* ===========================================================
   AI 签到助手 · 响应式样式
   手机：底部标签栏 + 单列卡片
   桌面：左侧导航 + 表格化列表
   =========================================================== */

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1b2434;
  --text-2: #55607a;
  --muted: #9099ab;
  --line: #edf0f6;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #eaf1ff;
  --green: #10b981;
  --green-soft: #e7f8f1;
  --red: #ef4444;
  --red-soft: #fdeceb;
  --amber: #f59e0b;
  --amber-soft: #fef5e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 39, 75, .04), 0 8px 24px rgba(24, 39, 75, .05);
  --tab-h: 58px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }

/* ---------- 布局骨架 ---------- */

.shell { min-height: 100vh; }

.sidebar { display: none; }

.main {
  min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.page { padding: 0 14px 24px; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 14px;
  background: rgba(244, 246, 250, .86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .2px;
}

.topbar .brand .logo {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
}

.topbar .spacer { flex: 1; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:active { background: #e9edf5; }

/* 底部标签栏（手机） */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}

.tabbar a .ic { font-size: 19px; line-height: 1; }
.tabbar a.on { color: var(--primary); }

/* 桌面：侧栏 */
@media (min-width: 900px) {
  .shell { display: flex; }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    width: 224px;
    flex: 0 0 224px;
    height: 100vh;
    padding: 18px 12px;
    background: var(--card);
    border-right: 1px solid var(--line);
  }

  .sidebar .brand {
    display: flex; align-items: center; gap: 9px;
    padding: 4px 8px 18px;
    font-size: 16px; font-weight: 650;
  }
  .sidebar .brand .logo {
    width: 28px; height: 28px; border-radius: 9px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700;
  }

  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav .group {
    padding: 14px 10px 6px;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .08em;
  }
  .nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--text-2);
    font-size: 14px;
  }
  .nav a .ic { width: 18px; text-align: center; font-size: 15px; opacity: .85; }
  .nav a:hover { background: #f6f8fc; color: var(--text); }
  .nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

  .sidebar .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

  .main { flex: 1; min-width: 0; padding-bottom: 40px; }
  .tabbar { display: none; }
  .topbar { height: 62px; padding: 0 26px; }
  .topbar .menu-btn { display: none; }
  .page { max-width: 1080px; padding: 4px 26px 40px; }
}

/* ---------- 通用组件 ---------- */

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

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-2); }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: #f7f9fc; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.lg { height: 48px; font-size: 15.5px; border-radius: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  background: #f2f4f9;
  color: var(--text-2);
  line-height: 18px;
}
.badge.ok { background: var(--green-soft); color: #0b8a63; }
.badge.wait { background: #f2f4f9; color: var(--muted); }
.badge.fail { background: var(--red-soft); color: #c22b26; }
.badge.warn { background: var(--amber-soft); color: #a46606; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.input, textarea.input, select.input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #e3e8f1;
  border-radius: 11px;
  background: #fbfcfe;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 11px 13px; line-height: 1.5; resize: vertical; }
.input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.input::placeholder { color: #b6bdcb; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* 首页统计条 */
.statbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 2px 14px;
  font-size: 13.5px;
  color: var(--text-2);
}
.statbar b { color: var(--text); font-weight: 600; }

.hero-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-bottom: 4px; }
.hero-actions .btn { height: 46px; }

/* ---------- 平台列表 ---------- */

.plist { display: flex; flex-direction: column; }
.plist-head { display: none; }

.prow {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name  cfg"
    "meta  cfg";
  align-items: center;
  gap: 6px 10px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}
.prow:last-child { border-bottom: 0; }

.pname { grid-area: name; display: flex; align-items: center; gap: 10px; min-width: 0; }
.pmeta { grid-area: meta; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pcfg { grid-area: cfg; }

.avatar {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 600;
}

.pname .t {
  min-width: 0;
  font-size: 15px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .plist { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 16px; }
  .plist-head {
    display: grid;
    grid-template-columns: 2fr .8fr .8fr .9fr .8fr .5fr;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
  }
  .plist-head span { padding-left: 2px; }
  .prow {
    grid-template-columns: 2fr .8fr .8fr .9fr .8fr .5fr;
    grid-template-areas: none;
    gap: 0;
    padding: 14px 0;
  }
  .prow > * { grid-area: auto; }
  .prow .pname .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; }
  .prow .pmeta { display: none; }
  .pcell { display: flex; align-items: center; font-size: 14px; }
  .pcfg { justify-content: flex-end; }
}

@media (max-width: 639px) {
  .pcell { display: none; }
}

/* ---------- 账号卡片 ---------- */

.acc-group { margin-bottom: 18px; }
.acc-head {
  display: flex; align-items: center; gap: 8px;
  margin: 0 2px 9px;
  font-size: 13.5px; color: var(--text-2); font-weight: 550;
}
.acc-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.acc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.acc .avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; font-size: 15px; }
.acc .body { flex: 1; min-width: 0; }
.acc .line1 { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.acc .line1 .t { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc .line2 { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.acc .line2 .nums { color: var(--text); font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.acc .line2 .nums em { font-style: normal; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.acc .ops { display: flex; gap: 8px; flex: 0 0 auto; }
.acc .ops .rbtn {
  height: 32px; padding: 0 12px;
  border: 0; border-radius: 9px;
  font-size: 13px; font-weight: 550;
  background: var(--primary-soft); color: var(--primary);
  cursor: pointer;
}
.acc .ops .rbtn.del { background: var(--red-soft); color: var(--red); }

.add-acc {
  display: flex; align-items: center; justify-content: center;
  height: 46px;
  border: 1px dashed #cfd8e6;
  border-radius: 12px;
  background: transparent;
  color: var(--primary);
  font-size: 14px; font-weight: 550;
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
}
.add-acc:hover { background: #f7faff; border-color: #b9cdf3; }

/* ---------- 日志 ---------- */

.loglist { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.logrow {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.logrow:last-child { border-bottom: 0; }
.logrow .tm { flex: 0 0 46px; color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.logrow .msg { flex: 1; min-width: 0; }
.logrow .msg .who { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.logrow .msg .txt { word-break: break-word; color: var(--text-2); }
.logrow.ok .txt { color: #0b7a58; }
.logrow.fail .txt { color: #b9302a; }

/* ---------- 空状态 ---------- */

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .55; }
.empty p { font-size: 13.5px; line-height: 1.7; }

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

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: radial-gradient(1200px 500px at 50% -10%, #e8f0ff 0%, var(--bg) 60%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(24, 39, 75, .09);
  padding: 26px 22px 22px;
}
.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 26px);
  transform: translate(-50%, 12px);
  z-index: 90;
  max-width: 88vw;
  padding: 10px 16px;
  border-radius: 11px;
  background: rgba(27, 36, 52, .94);
  color: #fff;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 30px; } }

.alert {
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 13.5px;
  margin-bottom: 14px;
  background: var(--primary-soft);
  color: #1e4bb8;
}
.alert.ok { background: var(--green-soft); color: #0b7a58; }
.alert.err { background: var(--red-soft); color: #b9302a; }
.alert.warn { background: var(--amber-soft); color: #8f5c05; }

/* ---------- 平台编辑页 ---------- */

.mode-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}
.mode-card.active {
  border-color: #b9d0fb;
  background: linear-gradient(180deg, #f7faff, #fff);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .07);
}
.mode-card .mtitle { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.mode-card .mtitle .num { color: var(--primary); }
.mode-card .mdesc { margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.mode-body { display: none; }
.mode-card.active .mode-body { display: block; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: #f1f4f9;
  gap: 2px;
}
.seg button {
  height: 32px; padding: 0 14px;
  border: 0; border-radius: 8px;
  background: transparent;
  font-size: 13px; font-weight: 550;
  color: var(--text-2);
  cursor: pointer;
}
.seg button.on { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(24,39,75,.1); }

.verify-box {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #f8fafd;
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow: auto;
}

/* 表格（后台） */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { font-variant-numeric: tabular-nums; }

.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 14px; overflow-x: auto; }

/* 统计卡片（后台） */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--card);
  border-radius: 13px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.stat .k { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.spin {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp .7s linear infinite;
  vertical-align: -2px;
}
@keyframes sp { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
