/* SitePulse 后台管理样式
   配色与组件样式对齐参考风格：品牌蓝 #0091FF、选中/主按钮底 #E1F0FF、
   填充式输入框 #F1F3F5、次按钮淡紫 #EDE9FE、左侧 224px 导航栏。 */

:root, .admin-page {
  --a-bg: #ffffff;
  --a-field: #f1f3f5;
  --a-field-hover: #eceef1;
  --a-border: #ededed;
  --a-border-strong: #e0e0e0;
  --a-brand: #0091ff;
  --a-active: #e1f0ff;
  --a-active-text: #006adc;
  --a-text: #11181c;
  --a-muted: #767d83;
  --a-purple: #ede9fe;
  --a-purple-text: #6d4ac4;
  --a-green: #e6f6ec;
  --a-green-text: #1a7f4b;
  --a-red: #fdeaea;
  --a-red-text: #c0342f;
  --a-radius: 10px;
  --a-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] .admin-page {
  --a-bg: #16171b;
  --a-field: #22252c;
  --a-field-hover: #282c34;
  --a-border: #2b2e36;
  --a-border-strong: #363a44;
  --a-brand: #4aa8ff;
  --a-active: rgba(0, 145, 255, .16);
  --a-active-text: #6cb6ff;
  --a-text: #e8eaed;
  --a-muted: #9aa0a8;
  --a-purple: rgba(139, 92, 246, .18);
  --a-purple-text: #b8a6f0;
  --a-green: rgba(34, 197, 94, .16);
  --a-green-text: #5fd27f;
  --a-red: rgba(239, 68, 68, .16);
  --a-red-text: #f08585;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 兜底：作者样式里的 display 会盖掉 UA 的 [hidden]{display:none}，
   本页多处用 hidden 切换视图（登录门 / 侧栏切换），必须显式兜住。 */
[hidden] { display: none !important; }

.admin-page {
  background: var(--a-bg); color: var(--a-text);
  font-family: var(--a-font); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.admin-page svg { width: 16px; height: 16px; flex: none; }

/* ---------- 顶栏 ---------- */
.a-topbar {
  position: sticky; top: 0; z-index: 20;
  height: 46px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 16px; background: var(--a-bg);
  border-bottom: 1px solid var(--a-border);
}
.a-topbar-right { display: flex; align-items: center; gap: 8px; }
.a-user {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--a-muted);
}
.a-user b { font-weight: 500; color: var(--a-text); }
.a-icon-btn {
  width: 34px; height: 34px; border: none; cursor: pointer;
  border-radius: 9px; background: var(--a-active); color: var(--a-active-text);
  display: grid; place-items: center;
  transition: background .15s;
}
.a-icon-btn:hover { background: var(--a-field-hover); }

/* ---------- 骨架 ---------- */
.a-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); align-items: start; }

/* ---------- 侧边栏 ---------- */
.a-side {
  position: sticky; top: 46px;
  height: calc(100vh - 46px);
  overflow-y: auto;
  border-right: 1px solid var(--a-border);
  padding: 0 12px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.a-brand {
  display: flex; align-items: center; gap: 7px;
  font-size: 16px; font-weight: 500; color: var(--a-brand);
  padding: 10px 6px 14px; letter-spacing: .4px; white-space: nowrap;
}
/* Logo 直接引用 logo.svg，保持原始绿色；深色主题下不变（绿在深底上仍清晰） */
.a-brand-logo { width: 34px; height: 34px; flex: none; display: block; }
/* 文字整体作为一个 flex 项，避免「后台」「管理」之间被 gap 拆开；颜色近黑并随主题自适应 */
.a-brand-text { display: block; color: var(--a-text); font-weight: 600; }
.a-brand b { font-weight: 600; }
.a-nav { display: flex; flex-direction: column; gap: 2px; }
.a-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; text-decoration: none; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--a-text);
  background: none; border: none; border-radius: var(--a-radius);
  padding: 9px 10px; min-height: 36px;
  transition: background .12s, color .12s;
}
.a-nav-item svg { color: var(--a-muted); }
.a-nav-item:hover { background: var(--a-field); }
.a-nav-item.active { background: var(--a-active); color: var(--a-active-text); }
.a-nav-item.active svg { color: var(--a-active-text); }

/* ---------- 内容区 ---------- */
.a-main { padding: 6px 28px 48px; min-width: 0; }
.a-title {
  font-size: 15px; font-weight: 600; color: var(--a-text);
  padding: 10px 0 16px; letter-spacing: .3px;
}
.a-block {
  border-top: 1px solid var(--a-border);
  padding: 18px 0 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.a-block:first-of-type { border-top: none; padding-top: 0; }
.a-h2 {
  font-size: 13.5px; font-weight: 600; color: var(--a-text);
  display: flex; align-items: center; gap: 8px;
}
.a-count {
  font-size: 11px; font-weight: 500; font-style: normal;
  color: var(--a-muted); background: var(--a-field);
  border-radius: 999px; padding: 1px 8px;
}
.a-form { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.a-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }

/* ---------- 字段 ---------- */
.a-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.a-label { font-size: 13px; font-weight: 500; color: var(--a-text); }
.a-input {
  font: inherit; font-size: 13.5px; color: var(--a-text);
  background: var(--a-field); border: 1px solid transparent;
  border-radius: 8px; padding: 9px 12px; min-height: 38px; width: 100%;
  outline: none; transition: border-color .15s, background .15s;
}
.a-input::placeholder { color: var(--a-muted); }
.a-input:hover { background: var(--a-field-hover); }
.a-input:focus { border-color: var(--a-brand); background: var(--a-bg); }
.a-hint { font-size: 12.5px; color: var(--a-muted); line-height: 1.5; }

/* ---------- 按钮 ---------- */
.a-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.a-btn {
  font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  border: none; border-radius: var(--a-radius); padding: 9px 20px; min-height: 38px;
  color: var(--a-text); background: var(--a-field);
  transition: filter .15s, background .15s;
}
.a-btn:hover { filter: brightness(.97); }
.a-btn.primary { background: var(--a-active); color: var(--a-active-text); font-weight: 500; }
.a-btn.purple { background: var(--a-purple); color: var(--a-purple-text); font-weight: 500; }
.a-btn:disabled { opacity: .55; cursor: default; filter: none; }
.a-msg { font-size: 12.5px; line-height: 1.5; }
.a-msg.ok { color: var(--a-green-text); }
.a-msg.err { color: var(--a-red-text); }

/* ---------- 网页设置 ---------- */
.a-lead {
  font-size: 12.5px; line-height: 1.7; color: var(--a-muted);
  margin: -8px 0 6px;
}
.a-lead code, .a-hint code, .a-switch-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; background: var(--a-field);
  border-radius: 4px; padding: 1px 5px;
}
select.a-input { cursor: pointer; appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--a-muted) 50%),
                    linear-gradient(135deg, var(--a-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.a-switches { display: flex; flex-direction: column; gap: 14px; padding-top: 2px; }
.a-switch { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.a-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.a-switch-track {
  position: relative; flex: none; width: 38px; height: 22px; margin-top: 1px;
  border-radius: 999px; background: var(--a-border-strong); transition: background .15s;
}
.a-switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s;
}
.a-switch input:checked + .a-switch-track { background: var(--a-brand); }
.a-switch input:checked + .a-switch-track::after { transform: translateX(16px); }
.a-switch input:focus-visible + .a-switch-track { box-shadow: 0 0 0 3px rgba(0, 145, 255, .28); }
.a-switch-text { font-size: 13.5px; line-height: 1.5; }
.a-switch-text em {
  display: block; font-style: normal; font-size: 12.5px;
  color: var(--a-muted); margin-top: 2px;
}

/* 右下角浮动操作条（保存 / 恢复默认） */
.a-floatbar {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: var(--a-bg); border: 1px solid var(--a-border);
  border-radius: 999px; padding: 7px 8px 7px 10px;
  box-shadow: 0 8px 24px rgba(17, 24, 28, .13);
  max-width: calc(100vw - 48px);
}
.a-floatbar .a-btn { min-height: 34px; padding: 7px 16px; border-radius: 999px; }
.a-floatbar .a-btn svg { width: 15px; height: 15px; }
.a-floatbar .a-btn.primary { display: inline-flex; align-items: center; gap: 6px; }
.a-floatbar .a-msg { padding: 0 8px; max-width: 320px; }
.a-btn.ghost { background: transparent; border: 1px solid var(--a-border-strong); }
.a-btn.ghost:hover { background: var(--a-field); filter: none; }

/* ---------- 站点列表 ---------- */
.a-list { display: flex; flex-direction: column; gap: 8px; }
.a-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--a-field); border-radius: var(--a-radius);
  padding: 11px 14px; min-width: 0;
  transition: background .15s;
}
.a-row:hover { background: var(--a-field-hover); }
.a-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.a-row-name {
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.a-row-url { font-size: 12px; color: var(--a-muted); overflow-wrap: anywhere; }
.a-row-meta { font-size: 12px; color: var(--a-muted); white-space: nowrap; }
.a-chip {
  font-size: 11.5px; font-weight: 500; font-style: normal;
  border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.a-chip.up { background: var(--a-green); color: var(--a-green-text); }
.a-chip.down { background: var(--a-red); color: var(--a-red-text); }
.a-chip.idle { background: var(--a-bg); color: var(--a-muted); }
.a-del {
  font: inherit; font-size: 13px; cursor: pointer; flex: none;
  border: none; border-radius: var(--a-radius);
  background: var(--a-bg); color: var(--a-red-text);
  padding: 7px 14px; transition: filter .15s;
}
.a-del:hover { filter: brightness(.96); }
.a-del:disabled { opacity: .55; cursor: default; }
.a-empty {
  font-size: 13px; color: var(--a-muted);
  background: var(--a-field); border-radius: var(--a-radius);
  padding: 22px 16px; text-align: center;
}

/* ---------- 登录：保持改版之前的卡片样式（白卡 + 边框阴影 + logo + 实心蓝按钮） ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-card {
  width: min(380px, 100%);
  background: var(--a-bg); border: 1px solid var(--a-border); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(31, 35, 41, .04);
  padding: 32px 28px 26px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-logo { width: 54px; height: 54px; margin: 0 auto 2px; }
.login-logo img { width: 100%; height: 100%; display: block; }
.login-card h2 { font-size: 16px; font-weight: 600; color: var(--a-text); }

.login-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-field > span { font-size: 13px; font-weight: 500; color: var(--a-text); }
.login-field input {
  font: inherit; font-size: 13px; color: var(--a-text);
  background: var(--a-bg); border: 1px solid var(--a-border);
  border-radius: 9px; padding: 8px 12px; min-width: 0; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}

.login-btn {
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  width: 100%; justify-content: center; padding: 11px;
  background: #3b82f6; border: 1px solid #3b82f6; color: #fff;
  border-radius: 9px; transition: background .15s, border-color .15s;
}
.login-btn:hover { background: #2563eb; border-color: #2563eb; }
.login-btn:disabled { opacity: .55; cursor: not-allowed; background: #3b82f6; border-color: #3b82f6; }

.login-card .a-msg { text-align: center; margin-top: 0; }
.login-card .a-msg.err { color: #b91c1c; }
html[data-theme="dark"] .login-card .a-msg.err { color: #f08585; }
html[data-theme="dark"] .login-card { box-shadow: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .a-shell { grid-template-columns: minmax(0, 1fr); }
  .a-side {
    position: static; height: auto; overflow: visible;
    min-height: 0; border-right: none; border-bottom: 1px solid var(--a-border);
    padding: 0 12px 12px;
  }
  .a-brand { padding: 6px 4px 10px; }
  .a-nav { flex-direction: row; overflow-x: auto; gap: 6px; }
  .a-nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .a-main { padding: 4px 16px 36px; }
  .a-grid { grid-template-columns: minmax(0, 1fr); }
  .a-row { flex-wrap: wrap; }
  .a-row-main { flex-basis: 100%; }
  .a-user { display: none; }
}
