/* ==========================================================================
   签到管理面板 · 样式表
   只用一个文件、只用原生 CSS，不引任何字体或框架 —— 面板要能离线跑起来。
   颜色全部走 CSS 变量，深浅主题各一套，方便以后换配色。

   设计取向：克制。状态色（绿 / 红 / 黄）只在真正表达状态的地方出现，
   界面主体一律中性灰阶 + 一层很淡的蓝做强调；描边是发丝级的 1px，
   阴影分三层但都收得很轻 —— 靠留白和字重拉层次，不靠颜色和厚度。
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --bg-glow: #e6ebfb;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --surface-3: #e9ebf1;
  --line: #e7e9ef;          /* 发丝描边：卡片、分隔线 */
  --line-2: #d7dbe3;        /* 控件描边：比卡片略重，才立得起来 */
  --fg: #0e1117;
  --fg-2: #58616f;
  --fg-3: #8b93a1;

  --brand: #2f5bd7;
  --brand-2: #2549b5;
  --brand-soft: #edf1fe;
  --ok: #0b7a53;
  --ok-soft: #e6f5ee;
  --bad: #cc3b33;
  --bad-soft: #fdecea;
  --warn: #96690b;
  --warn-soft: #fbf3e2;

  --radius-lg: 14px;
  --radius: 11px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(15, 20, 32, .05);
  --shadow-2: 0 2px 4px rgba(15, 20, 32, .04), 0 12px 28px -12px rgba(15, 20, 32, .16);
  --shadow-3: 0 24px 64px -16px rgba(15, 20, 32, .26);

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --bg-glow: #131b2e;
    --surface: #14171c;
    --surface-2: #1a1e24;
    --surface-3: #22262d;
    --line: #24282f;
    --line-2: #343a43;
    --fg: #e8ebf0;
    --fg-2: #a1aab7;
    --fg-3: #737c8a;

    --brand: #6b93f8;
    --brand-2: #8aabff;
    --brand-soft: #16203a;
    --ok: #43c288;
    --ok-soft: #10241a;
    --bad: #f0837a;
    --bad-soft: #2a1615;
    --warn: #dcae45;
    --warn-soft: #292310;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-2: 0 2px 5px rgba(0, 0, 0, .4), 0 14px 32px -14px rgba(0, 0, 0, .72);
    --shadow-3: 0 28px 68px -18px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

/* 默认的蓝色 outline / 灰色滚动条在深浅两套主题里都显得很「系统」，
   统一换成跟界面同源的样式 */
::selection { background: color-mix(in srgb, var(--brand) 20%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
button:focus-visible, .switch input:focus-visible, summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 46%, transparent);
  outline-offset: 1px;
}

body {
  margin: 0;
  color: var(--fg);
  font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 顶部一层极淡的品牌色晕，纯背景层，不参与堆叠，不会盖住卡片 */
  background-color: var(--bg);
  background-image: radial-gradient(760px 300px at 16% -70px, var(--bg-glow), transparent 72%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -.005em; }
p { margin: 0; }
b, strong { font-weight: 620; }
.hidden { display: none !important; }
.muted { color: var(--fg-3); }
.spacer { margin-left: auto; }
/* 统计数字、账号数、版本号这类会变宽的数字统一用等宽数字，避免跳格 */
.num { font-variant-numeric: tabular-nums; }

button, input, select, textarea { font-family: inherit; font-size: 13px; color: inherit; }

/* ============================ 登录 / 首次设置 ============================ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 50% -10%, var(--bg-glow) 0%, transparent 62%),
    var(--bg);
  overflow: auto;
}
.gate-card {
  width: min(404px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-3);
  padding: 34px 30px 26px;
  text-align: center;
}
.gate-logo { color: var(--brand); display: flex; justify-content: center; margin-bottom: 18px; }
.gate-logo svg { border-radius: 10px; }
.gate-card h1 { font-size: 20px; margin-bottom: 7px; }
.gate-sub { color: var(--fg-2); font-size: 13px; margin-bottom: 24px; line-height: 1.65; }

.fld { display: block; text-align: left; margin-bottom: 13px; }
.fld > span { display: block; font-size: 12px; color: var(--fg-2); margin-bottom: 6px; }
.fld input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fld input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); background: var(--surface); }

.gate-err { min-height: 20px; color: var(--bad); font-size: 12.5px; text-align: left; margin: 2px 0 8px; }
.gate-tip { margin-top: 16px; color: var(--fg-3); font-size: 12px; line-height: 1.6; }
button.block { width: 100%; padding: 11px; font-size: 14px; border-radius: var(--radius-sm); }

/* ============================ 控件 ============================ */
button {
  display: inline-flex;
  align-items: center;
  /* 必须显式居中：inline-flex 的默认是 justify-content: flex-start，
     内容不加约束就贴左边 —— 只有 width:100% 的按钮（如登录那个 .block）
     看得出来，一直看着像「文字偏左」。 */
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  font-weight: 500;
  color: var(--fg-2);
}
button:hover:not(:disabled) { border-color: var(--fg-3); background: var(--surface-2); color: var(--fg); }
button:active:not(:disabled) { transform: translateY(.5px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button svg { flex: none; opacity: .85; }
button.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff), var(--brand));
  border-color: var(--brand-2);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 40%, transparent);
}
button.primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
button.primary svg { opacity: 1; }
button.ghost { background: transparent; border-color: transparent; color: var(--fg-3); padding: 6px 9px; }
button.ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--fg); }
button.tiny { padding: 4px 9px; font-size: 12px; border-radius: 7px; gap: 4px; }
button.tiny svg { width: 12px; height: 12px; }

input[type=text], input[type=search], input[type=password], select, textarea {
  width: 100%;
  padding: 7px 11px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); }
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.55; }

/* 原生下拉箭头又小又灰、各系统还不一样，统一换成自绘的 chevron */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3.6 5.5L7 8.9l3.4-3.4' fill='none' stroke='%238b93a1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}

/* 开关：原生复选框在深色主题里是一块系统灰，做成自绘的小滑块 */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); user-select: none; cursor: pointer; }
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 30px; height: 18px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-2);
  position: relative;
  cursor: pointer;
  transition: background .16s;
}
.switch input::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 20, 32, .25);
  transition: transform .16s;
}
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(12px); }
.switch:hover { color: var(--fg); }

.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.seg button {
  border: none; background: transparent; padding: 5px 13px; border-radius: 7px;
  color: var(--fg-3); font-size: 12.5px; gap: 5px;
}
.seg button:hover:not(.active) { background: transparent; color: var(--fg); }
.seg button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); font-weight: 600; }

.chip-btn { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: var(--surface); color: var(--fg-2); }
.chip-btn.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 34%, transparent); color: var(--brand); font-weight: 600; }

/* ============================ 顶栏 ============================ */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(190%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark { color: var(--brand); display: flex; }
.brand .mark svg { border-radius: 9px; box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--brand) 45%, transparent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text .sub { font-size: 11.5px; color: var(--fg-3); display: flex; align-items: center; gap: 5px; }
.brand-text .sep { opacity: .45; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; }
.dot.off { background: var(--bad); }
.dot.idle { background: var(--fg-3); }

/* 统计：以前是五个各自带边框的胶囊，看着像一堆徽章；收成一条，
   内部用发丝线分隔，数值等宽 —— 信息一样，噪音小很多。 */
.statbar {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  font-size: 12.5px;
  color: var(--fg-3);
  white-space: nowrap;
}
.stat + .stat { border-left: 1px solid var(--line); }
.stat i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.stat b { color: var(--fg); font-weight: 620; font-size: 13px; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.stat.ok i { background: var(--ok); }
.stat.ok b { color: var(--ok); }
.stat.bad i { background: var(--bad); }
.stat.bad b { color: var(--bad); }
.stat.warn i { background: var(--warn); }
.stat.warn b { color: var(--warn); }
.stat.muted-stat { color: var(--fg-3); font-size: 12px; }

.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================ 工具条 ============================ */
.toolbar {
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap;
  padding: 16px 22px 4px;
}
.search-wrap { position: relative; width: 290px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search-wrap input { padding-left: 33px; background: var(--surface); }
.toolbar select { width: auto; font-size: 12.5px; }
.toolbar .spacer { flex: 1 1 0; }

/* ============================ 内容区 ============================ */
main { padding: 10px 22px 22px; }

/* 卡片默认一行 4 张；窗口变窄依次降到 3 / 2 / 1，断点与下面的 .list 对齐，
   两种视图切换时不会一个挤一个松。
   align-items: start 是必须的：卡片虽然现在都是等高的，但 meta 里站点返回的文案
   长度差别很大，万一哪天真被撑开了，默认的 stretch 会把旁边几张一起拉高，
   下面留一大片空白 —— 保持顶部对齐，让差异只暴露在那一张上。
   卡片本身不再就地展开（编辑区在弹窗里），所以一排几列是固定的。 */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }

/* ---- 卡片视图 ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s, transform .18s;
  position: relative;
  cursor: pointer;
}
.card:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); transform: translateY(-1px); }
/* 左侧一道细色条标状态。以前是 3px 实色 + 整卡描边跟着染色，绿边红边铺满一排
   看着像报错列表；现在只留 2px 的条，描边保持中性。 */
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--line-2);
}
.card[data-state=valid]::before { background: color-mix(in srgb, var(--ok) 78%, transparent); }
.card[data-state=invalid]::before { background: color-mix(in srgb, var(--bad) 78%, transparent); }
.card[data-state=unknown]::before { background: color-mix(in srgb, var(--warn) 78%, transparent); }

.card-head { display: flex; align-items: center; gap: 11px; padding: 13px 15px; cursor: pointer; }
/* 一行四张时单个卡片会比以前窄不少：站点名和 KEY 用省略号收掉，标签/徽章不许被压变形，
   宁可让名字先截断，也不要出现「徽章被挤成两行」那种破相。 */
.card-head .names { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.card-head .names b { font-size: 14.5px; letter-spacing: -.006em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .names span {
  font-size: 10.5px; color: var(--fg-3); font-family: var(--mono);
  letter-spacing: .045em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-head .tag, .card-head .badge { flex: none; }

/* 卡片右侧的箭头：点它 = 打开配置弹窗。以前是展开箭头（朝下、展开时转 90°），
   现在是「进入」的意思（朝右、悬停时轻轻往右挪一下），不表示任何开合状态。 */
.card-head .chev { color: var(--fg-3); display: flex; flex: none; transition: transform .18s, color .18s; }
.card:hover .chev { color: var(--fg-2); transform: translateX(2px); }

/* meta 固定一行：长度差别很大（B 站会多出「普通会员 | 硬币 1223 | 等级 5」这种尾巴），
   任它换行会把同排卡片顶得高低不齐。超出部分省略号收掉，完整内容挂在 title 上。
   height 是写死的：17px 行高 + 13px 下间距 —— 这样卡片高度完全确定，一排齐平。 */
.card-meta {
  display: block;
  height: 30px;
  padding: 0 15px 13px;
  line-height: 17px;
  font-size: 11.5px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- LOGO ---- */
.logo {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 19px; line-height: 1;
}
.logo.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 5px; background: #fff; }
.logo .lb { display: none; }
.logo.broken img { display: none; }
.logo.broken .lb { display: block; }
.logo.broken { background: var(--surface-3); }

/* ---- 列表视图 ---- */
/* 一行两个条目；窄屏回落到单列。站名之外的列全按内容取宽，
   半屏宽也不会把右边的操作按钮顶出去；状态与账号数两列给固定宽度，
   免得「有效 / 未校验」宽度不同把后面几列推得忽左忽右。 */
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 84px 86px auto;
  align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: box-shadow .16s, border-color .16s;
}
.row-item:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); }
.row-item[data-state=valid] { border-left-color: color-mix(in srgb, var(--ok) 78%, transparent); }
.row-item[data-state=invalid] { border-left-color: color-mix(in srgb, var(--bad) 78%, transparent); }
.row-item[data-state=unknown] { border-left-color: color-mix(in srgb, var(--warn) 78%, transparent); }
.row-item .ri-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.row-item .ri-name b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .ri-name span { font-size: 10.5px; color: var(--fg-3); font-family: var(--mono); letter-spacing: .045em; }
.row-item .ri-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

/* ---- 徽章 / 标签 ---- */
/* 状态徽章带一个前置圆点：颜色之外多一层形状提示，也和统计条里的点呼应 */
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 500;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge.valid { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 24%, transparent); }
.badge.invalid { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 24%, transparent); }
.badge.unknown, .badge.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 24%, transparent); }
.badge.unverified { background: var(--surface-3); color: var(--fg-3); border-color: var(--line); }
.badge.unverified::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
/* 分类标签：不描边、不上色，只做「这是哪一类」的低调提示，别和状态徽章抢注意力 */
.tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--fg-2);
  letter-spacing: .01em;
}
.tag.acc { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---- 账号编辑 ---- */
.howto {
  font-size: 12px; color: var(--fg-2); line-height: 1.65;
  background: var(--surface); border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm); padding: 9px 11px; margin: 0 0 12px;
}
.howto b { color: var(--fg); }
.howto a { color: var(--brand); text-decoration: none; }
.howto a:hover { text-decoration: underline; }

.account { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.acc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12.5px; color: var(--fg-2); }
.acc-head b { color: var(--fg); }
.field-label { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--fg-2); margin: 9px 0 5px; flex-wrap: wrap; }
.req { color: var(--bad); font-family: var(--mono); font-size: 11px; }
.opt { color: var(--fg-3); font-family: var(--mono); font-size: 11px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.row.right { justify-content: flex-end; }

.check { font-size: 12px; color: var(--fg-2); min-height: 17px; line-height: 1.55; margin-top: 7px; }
.check.ok { color: var(--ok); }
.check.bad { color: var(--bad); }
.check.warn { color: var(--warn); }
.check ul { margin: 5px 0 0; padding-left: 18px; }

.masked textarea { color: transparent; text-shadow: 0 0 9px rgba(128, 136, 145, .9); caret-color: var(--fg); }
.masked textarea:focus { color: var(--fg); text-shadow: none; }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2); }
.chip.miss { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, transparent); }
.chip.have { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }

details.extras { margin-top: 9px; }
details.extras summary { cursor: pointer; font-size: 12px; color: var(--fg-2); user-select: none; }
details.extras summary:hover { color: var(--fg); }
/* 账号字段的网格：cookie 站点的可选参数和表单站点的必填参数共用一套排布 */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 9px; margin-top: 9px; }

.empty { text-align: center; color: var(--fg-3); padding: 64px 0; font-size: 13.5px; }
.empty b { display: block; color: var(--fg-2); font-size: 15px; margin-bottom: 6px; }

/* ============================ 抽屉 ============================ */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(780px, 96vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  transform: translateX(102%);
  transition: transform .24s cubic-bezier(.32, .72, 0, 1);
  z-index: 40;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 14px; }
.drawer-body { flex: 1; overflow: auto; padding: 13px 16px; }
pre.console {
  margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px; min-height: 200px;
}
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 22, .42); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
.overlay.open { opacity: 1; pointer-events: auto; }

.hist { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
.hist .h-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.hist .h-main b { font-size: 13px; }
.hist .h-main span { font-size: 11.5px; color: var(--fg-3); }

/* ============================ 弹窗 ============================ */
dialog {
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  border-radius: var(--radius-lg); padding: 0;
  width: min(760px, 94vw); max-height: 88vh;
  box-shadow: var(--shadow-3);
}
dialog::backdrop { background: rgba(10, 14, 22, .5); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h3 { font-size: 15px; }
.dlg-body { padding: 16px 18px; overflow: auto; max-height: 72vh; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 13px 18px; border-top: 1px solid var(--line); }
.section { margin-bottom: 22px; }
.section:last-child { margin-bottom: 6px; }

.section h4 { margin: 0 0 9px; font-size: 13.5px; }
.section .tip { font-size: 12px; color: var(--fg-3); margin: 6px 0 0; line-height: 1.6; }
/* 4 个一行的字段（后台账号）在宽弹窗里刚好排满，不留一个孤零零的半行 */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; }
.kv label { display: block; font-size: 12px; color: var(--fg-2); margin-bottom: 4px; }

/* ---- 推送通知：按渠道分组的方框 ----
   以前 27 个字段平铺成一个四列网格：标签长短不一、一换行就把同一排的输入框
   顶得上下不齐，同一个渠道的字段还被拆到两行去。
   现在一个渠道一个方框，方框内再排字段。高度不给定值，靠 grid 自己撑：
   同排的方框被 align-items: stretch 拉平，而 .nbox 是纵向 flex、状态行margin-top:auto，
   多出来的高度全部落在「字段」和「状态行」之间 —— 看上去是留白，不是没对齐。
   字段多的那一组（企业微信）整行铺开（.wide），免得它一个人把同排顶高一大截。 */
.notices { display: grid; grid-template-columns: repeat(auto-fit, minmax(298px, 1fr)); gap: 10px; align-items: stretch; }
.nbox {
  display: flex; flex-direction: column; gap: 9px;
  min-width: 0;
  padding: 11px 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
/* 整行铺开：无论外层是几列都占满一行（用 1 / -1 而不是 span 2，
   窄屏只剩一列时 span 2 会凭空多出一列）。 */
.nbox.wide { grid-column: 1 / -1; }
.nbox.on { border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.nbox-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.nbox-head b { font-size: 12.5px; font-weight: 620; letter-spacing: -.005em; }
/* 参数个数贴着渠道名，不推到行尾 —— 整行铺开的那一组会把标题拉得很宽，
   推过去就离名字 600px 开外了，像是另一个字段。 */
.nbox-tag { flex: none; font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); }
.nbox-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.nbox.on .nbox-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.nbox-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 8px 9px; }
.nf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nf-top { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.nf-label { flex: none; font-size: 11.5px; color: var(--fg-2); }
/* 配置键是给「要和 config.json 对照」的人看的，窄框里放不下就省略号 + title */
.nf-key { min-width: 0; font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nf input { padding: 6px 9px; font-size: 12.5px; }
.nbox-foot { margin: auto 0 0; min-height: 14px; font-size: 11px; color: var(--fg-3); }
.nbox-count { color: var(--ok); font-weight: 600; }

/* ---- 「项目地址 + 更新状态」那一行小字 ----
   只在设置页最下方的「关于本项目」里用。首页早先也放过一处右下角常驻小牌，
   嫌挤，已经删掉 —— .app-foot / .foot-box / .foot-line 那套随之去掉，别再加回来。
   .foot-repo / .foot-up / .up-dot 就是「一行小字 + 一个状态圆点」的公共零件。 */
.foot-repo { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--fg-2); text-decoration: none; }
.foot-repo:hover { color: var(--brand); }
.foot-repo svg { flex: none; color: var(--fg-3); }
/* 仓库名可能被 PANEL_REPO 换成更长的 fork 名，窄屏就省略号 + title 兜底 */
.foot-repo b { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-up { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.foot-up.ok { color: var(--ok); }
.foot-up.warn { color: var(--warn); }
.up-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.up-dot.ok { background: var(--ok); }
.up-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* ---- 设置页底部的「关于本项目」 ---- */
.about {
  display: flex; flex-direction: column; gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
.about-line { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 12.5px; color: var(--fg-2); }

/* ---- 站点配置弹窗 ---- */
/* 整块做成「头 / 可滚内容 / 底栏」三段的 flex：cookie 框再长也只滚中间那块，
   底栏的「保存」永远在视线里，不用滚到底才能点。
   注意必须写成 [open]：无条件 display:flex 会盖掉浏览器默认的
   dialog:not([open]) { display: none }，弹窗一上来就摊在那儿。 */
#siteDlg { width: min(780px, 94vw); }
#siteDlg[open] { display: flex; flex-direction: column; max-height: 88vh; }
#siteDlg .dlg-body { max-height: none; flex: 1; }
#siteDlg .dlg-foot { justify-content: flex-start; }

.sd-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sd-title .names { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sd-title .names b { font-size: 14.5px; letter-spacing: -.006em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-title .names span { font-size: 10.5px; color: var(--fg-3); font-family: var(--mono); letter-spacing: .045em; }
.sd-title .tag, .sd-title .badge { flex: none; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 16px; }
.tabs button { border: none; background: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 11px; color: var(--fg-3); font-weight: 500; }
.tabs button:hover:not(.active) { background: transparent; color: var(--fg); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 620; }

/* ============================ 提示 ============================ */
.toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--fg); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 60; pointer-events: none;
  max-width: min(760px, 92vw);
  box-shadow: var(--shadow-3);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ============================ 响应式 ============================ */
/* 卡片 4 → 3 → 2 → 1；列表 2 → 1。断点成对出现，保证两种视图密度一致。 */
@media (max-width: 1560px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list { grid-template-columns: 1fr; }
}
@media (max-width: 1020px) {
  /* 顶栏挤不下时，统计条整条换到第二行，别被拆成两半 */
  .statbar { order: 3; width: 100%; }
  .stat { flex: 1 1 0; justify-content: center; }
}
@media (max-width: 860px) {
  .row-item { grid-template-columns: 34px minmax(0, 1fr) 84px auto; }
  .row-item .ri-group, .row-item .ri-acc { display: none; }
}
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  header { padding: 11px 14px; gap: 12px; }
  .statbar { display: none; }
  main, .toolbar { padding-left: 14px; padding-right: 14px; }
  .search-wrap { width: 100%; }
  .actions { margin-left: 0; width: 100%; }
  .drawer { width: 100vw; }
  /* 手机上弹窗铺满：编辑 cookie 时那点横向空间都要留给输入框
     （dvh 不认识的老浏览器会忽略这一行，退回 88vh，不影响可用） */
  #siteDlg { width: 100vw; max-height: 100dvh; border-radius: 0; }
  #siteDlg .dlg-body { padding: 14px; }
}
