/* ============================================================
   NewAPI 签到中心 · 平面深色设计系统（v2）
   中性面板 + 琥珀单点缀 · 无渐变无光斑 · 信息密度优先
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0d10;
  --surface: #12151a;
  --surface-2: #171b21;
  --field: #0e1114;
  --border: #22272f;
  --border-soft: #1a1f26;
  --text: #e6e9ee;
  --muted: #8a93a0;
  --faint: #565f6b;
  --acc: #f0b429;
  --acc-hover: #ffc94d;
  --acc-dim: rgba(240, 180, 41, 0.14);
  --acc-text: #f0b429;
  --acc-soft: rgba(240, 180, 41, 0.15);
  --acc-soft-hover: rgba(240, 180, 41, 0.26);
  --acc-border: rgba(240, 180, 41, 0.4);
  --on-acc: #161206;
  --ok: #43c976;
  --ok-dim: rgba(67, 201, 118, 0.12);
  --err: #f0614f;
  --err-dim: rgba(240, 97, 79, 0.12);
  --btn-hover-bg: #1c2128;
  --btn-hover-border: #333a45;
  --row-hover: rgba(255, 255, 255, 0.02);
  --dot-idle: #3a414b;
  --mask: rgba(5, 7, 9, 0.72);
  --border-strong: #2b323d;
  --toast-bg: #1a1f26;
  --mode-active: #242b35;
  --topbar-bg: rgba(11, 13, 16, 0.88);
  --scroll-thumb: #262c35;
  --grid-dot: rgba(255, 255, 255, 0.028);
  --ghost: #3a414b;
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, 0.55);
  --r-lg: 10px;
  --r-md: 8px;
  --r-sm: 6px;
  --font: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, "JetBrains Mono", monospace;
}

/* ---------- 白天主题（黄白奶油） ---------- */
:root[data-theme="light"] {
  --bg: #faf7ec;
  --surface: #fffdf7;
  --surface-2: #f3edda;
  --field: #fffefb;
  --border: #e3dbc2;
  --border-soft: #ece5cf;
  --text: #33301f;
  --muted: #7d7659;
  --faint: #a89f80;
  --acc: #eeb227;
  --acc-hover: #f6c14a;
  --acc-dim: rgba(238, 178, 39, 0.18);
  --acc-text: #9c6f07;
  --acc-soft: rgba(238, 178, 39, 0.16);
  --acc-soft-hover: rgba(238, 178, 39, 0.3);
  --acc-border: rgba(156, 111, 7, 0.35);
  --on-acc: #1d1607;
  --ok: #1f9d5a;
  --ok-dim: rgba(31, 157, 90, 0.13);
  --err: #d5453a;
  --err-dim: rgba(213, 69, 58, 0.1);
  --btn-hover-bg: #efe8d0;
  --btn-hover-border: #d5cbab;
  --row-hover: rgba(90, 78, 40, 0.04);
  --dot-idle: #cdc4a6;
  --mask: rgba(70, 60, 30, 0.18);
  --border-strong: #d8ceac;
  --toast-bg: #fffdf7;
  --mode-active: #ebe3c9;
  --topbar-bg: rgba(250, 247, 236, 0.9);
  --scroll-thumb: #d5cbab;
  --grid-dot: rgba(90, 78, 40, 0.07);
  --ghost: #b6ad8d;
  --shadow-pop: 0 18px 50px rgba(96, 84, 40, 0.22);
}

/* 切换时的全局颜色过渡（组件自带的 transition 会覆盖此处） */
body, .panel, .btn, input, .sidebar, .toast, .modal-panel, .site-row, .feed-row,
.mode-switch, .mode, .token-row code, .report, .table th, .site-card, .side-user {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
body::before {
  /* 极淡点阵，给纯色背景一点物理质感 */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 26px 26px;
}

.hidden { display: none !important; }
a { color: inherit; }
.en {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.6px;
  color: var(--faint);
  font-weight: 400;
  margin-left: 6px;
  text-transform: uppercase;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(240, 180, 41, 0.25); }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: all 0.15s ease; white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { border-color: var(--btn-hover-border); background: var(--btn-hover-bg); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn.primary {
  background: var(--acc-soft);
  border-color: var(--acc-border);
  color: var(--acc-text);
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--acc-soft-hover);
  border-color: var(--acc-text);
}
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: rgba(240, 97, 79, 0.4); background: var(--err-dim); }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn.icon-only { padding: 7px 8px; }
.btn.icon-only svg { width: 16px; height: 16px; }
.btn.icon-only svg { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.btn.icon-only:active svg { transform: rotate(180deg) scale(0.85); }
.theme-float { position: fixed; top: 16px; right: 16px; z-index: 60; }
.btn.block { width: 100%; padding: 10px; font-size: 14px; }

input, select {
  width: 100%; background: var(--field); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 12px; color: var(--text); font-size: 13.5px;
  font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease; outline: none;
}
input::placeholder { color: var(--faint); }
input:focus { border-color: rgba(240, 180, 41, 0.55); box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.1); }
input[type="time"] { color-scheme: dark; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--acc); cursor: pointer; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.form { display: flex; flex-direction: column; gap: 13px; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--acc-text); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.8; }
hr.sep { border: none; border-top: 1px solid var(--border-soft); margin: 2px 0; }

/* ---------- 登录 / 注册 ---------- */
.view { min-height: 100vh; }
#view-auth {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; gap: 20px;
}
.auth-brand { text-align: center; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 2.2px; color: var(--faint); }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px;
}
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 0 2px 10px; margin-right: 22px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 14px; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--acc); font-weight: 600; }
.auth-tip { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--faint); line-height: 1.7; }
.auth-foot { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px; color: var(--ghost); }

/* ---------- 应用外壳：左侧任务栏 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0; box-sizing: border-box;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px; height: 100vh; position: sticky; top: 0;
}
.side-brand { padding: 2px 10px 16px; }
.side-brand .brand-title { font-size: 15.5px; }
.side-group { display: flex; flex-direction: column; gap: 3px; }
.side-bottom {
  margin-top: auto; display: flex; flex-direction: column; gap: 3px;
  border-top: 1px solid var(--border-soft); padding-top: 10px;
}
.snav {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border: none; background: transparent; color: var(--muted);
  border-radius: var(--r-md); cursor: pointer; font-size: 13.5px; font-family: inherit;
  text-align: left; transition: all 0.15s ease;
}
.snav svg { width: 15px; height: 15px; flex-shrink: 0; }
.snav:hover { color: var(--text); background: var(--surface-2); }
.snav.active { color: var(--acc-text); background: var(--acc-dim); font-weight: 600; }
.side-user {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; padding: 7px 10px;
  background: var(--field); border: 1px solid var(--border-soft); border-radius: var(--r-md);
}
.side-username { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-family: inherit; padding: 2px 4px; border-radius: 6px; }
.side-logout:hover { color: var(--err); }

.main-area { flex: 1; min-width: 0; }
.page-inner { padding-top: 26px; padding-bottom: 44px; }
.page-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.page-head h1 { font-size: 18px; }

/* ---------- 关于 ---------- */
.about-body { display: flex; flex-direction: column; gap: 10px; }
.about-name { font-size: 17px; font-weight: 700; }
.about-kv { display: flex; gap: 14px; font-size: 12.5px; }
.about-kv span:first-child { color: var(--faint); flex-shrink: 0; width: 52px; }
.about-kv span:last-child { color: var(--muted); }

/* ---------- 主体布局 ---------- */
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
main.wrap { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; padding-bottom: 40px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--border-soft);
}
.panel-head h2 { font-size: 14px; font-weight: 600; display: flex; align-items: baseline; }
.sec-actions { display: flex; gap: 8px; }

/* ---------- 统计条 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 16px 18px 14px; }
.stat + .stat { border-left: 1px solid var(--border-soft); }
.stat-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.6px;
  color: var(--faint); text-transform: uppercase; margin-bottom: 7px;
}
.stat-value { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value .dim { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 5px; }
.stat-value.acc { color: var(--acc-text); }

/* ---------- 站点列表 ---------- */
.site-row {
  display: grid;
  grid-template-columns: 12px minmax(150px, 1.3fr) 110px 118px minmax(140px, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 13px 18px; border-bottom: 1px solid var(--border-soft);
  transition: background 0.12s ease;
}
.site-row:last-child { border-bottom: none; }
.site-row:hover { background: var(--row-hover); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-dim); }
.dot.warn { background: var(--acc); box-shadow: 0 0 0 3px var(--acc-dim); }
.dot.idle { background: var(--dot-idle); }
.dot.off { background: transparent; border: 1.5px solid var(--dot-idle); }

.site-main { min-width: 0; }
.site-sched { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.site-sched .stagger { color: var(--acc-text); }
.site-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-host { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-decoration: none; }
.site-host:hover { color: var(--acc); }

.site-col { min-width: 0; }
.col-label { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: 1.2px; color: var(--faint); text-transform: uppercase; margin-bottom: 3px; }
.col-value { font-size: 12.8px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.col-value.mono { font-family: var(--mono); font-size: 12px; }
.col-value .ok { color: var(--ok); }
.col-value .err { color: var(--err); }
.col-value .dim { color: var(--muted); }

.site-status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.site-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .btn { margin-top: 14px; }

/* ---------- 动态流 ---------- */
.feed-row { display: flex; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border-soft); align-items: baseline; }
.feed-row:last-child { border-bottom: none; }
.feed-row .dot { width: 6px; height: 6px; align-self: center; flex-shrink: 0; }
.feed-time { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.feed-text { font-size: 13px; min-width: 0; word-break: break-all; color: var(--muted); }
.feed-text b { color: var(--text); font-weight: 600; }
.feed-text .ok { color: var(--ok); }
.feed-text .err { color: var(--err); }
.feed-empty { padding: 34px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ---------- 模态 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: var(--mask); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; width: 100%; max-width: 440px; max-height: 88vh; overflow: auto;
  padding: 22px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-pop);
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.modal-panel.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { font-size: 15px; font-weight: 600; }
.icon-btn { background: transparent; border: none; color: var(--muted); cursor: pointer; padding: 5px 8px; border-radius: var(--r-sm); display: flex; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 15px; height: 15px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

.mode-switch { display: flex; gap: 4px; background: var(--field); padding: 3px; border-radius: var(--r-md); border: 1px solid var(--border); }
.mode { flex: 1; padding: 6px; border: none; background: transparent; color: var(--muted); border-radius: var(--r-sm); cursor: pointer; font-size: 12.5px; font-family: inherit; transition: all 0.15s; }
.mode.active { background: var(--mode-active); color: var(--text); }

details.adv summary { cursor: pointer; font-size: 12.5px; color: var(--muted); user-select: none; padding: 2px 0; }
details.adv[open] summary { margin-bottom: 12px; }
details.adv summary:hover { color: var(--text); }
.field-hint { font-size: 11px; color: var(--faint); line-height: 1.6; }

/* ---------- 管理后台 ---------- */
.admin-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ov-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 13px 16px 11px;
}
.ov-chip .stat-label { margin-bottom: 5px; }
.ov-chip .stat-value { font-size: 20px; }
.atab-pane { display: flex; flex-direction: column; gap: 14px; }
.atab-pane .panel-head h2 { font-size: 14px; }
.admin-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-row .grow { flex: 1; }
.form-link { font-size: 12px; color: var(--muted); text-decoration: none; text-align: center; }
.form-link:hover { color: var(--acc-text); }
.t-dis { color: var(--err); }
.t-dim { color: var(--faint); }

.row-between { display: flex; gap: 10px; align-items: flex-end; }
.row-between .grow { flex: 1; }

.token-row { display: flex; gap: 8px; align-items: center; }
.token-row code {
  flex: 1; background: var(--field); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 8px 11px; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.report {
  font-family: var(--mono); font-size: 12.5px; line-height: 2; white-space: pre-wrap;
  background: var(--field); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; max-height: 58vh; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  position: sticky; top: 0; background: var(--surface); text-align: left; padding: 8px 18px;
  color: var(--faint); font-weight: 500; font-family: var(--mono); font-size: 10px;
  letter-spacing: 1.2px; text-transform: uppercase; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 9px 18px; border-bottom: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--row-hover); }
.table td.msg { color: var(--muted); max-width: 260px; word-break: break-all; font-size: 12px; }
.table .t-ok { color: var(--ok); } .table .t-err { color: var(--err); } .table .t-warn { color: var(--acc); }
.table .mono { font-family: var(--mono); font-size: 11.5px; }

/* ---------- Toast ---------- */
#toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 460px);
  pointer-events: none;
}
.toast {
  background: var(--toast-bg); border: 1px solid var(--border-strong); border-left: 2px solid var(--acc);
  border-radius: var(--r-md); padding: 10px 16px; font-size: 13px; color: var(--text);
  box-shadow: var(--shadow-pop); animation: toastIn 0.2s ease;
  max-width: 100%; transition: all 0.3s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--acc); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.foot { text-align: center; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px; color: var(--ghost); padding: 0 0 26px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border-soft); }
  .site-row { display: flex; flex-wrap: wrap; gap: 10px 16px; }
  .site-row .dot { align-self: center; }
  .site-main { flex: 1 1 180px; }
  .site-col { flex: 1 1 38%; }
  .site-actions { flex-basis: 100%; justify-content: flex-start; }
  /* 侧边栏在窄屏折叠为顶部横条 */
  .app-shell { flex-direction: column; }
  .sidebar {
    flex-direction: row; align-items: center; width: auto; height: auto;
    position: sticky; top: 0; z-index: 50;
    padding: 9px 12px; gap: 6px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .side-brand { padding: 0 8px 0 2px; }
  .side-brand .brand-sub { display: none; }
  .side-group { flex-direction: row; }
  .side-bottom { margin-top: 0; margin-left: auto; flex-direction: row; border-top: none; padding-top: 0; }
  .snav span { display: none; }
  .snav { padding: 8px; }
  .side-user { margin-top: 0; padding: 4px 8px; }
}
