/* WeFerryBot 控制台样式。
 *
 * 与同套件 WeFerryAuth / WeFerryGW 控制台同一设计语言：1280px 居中紧凑壳、
 * 白色 masthead + 浅灰底 + 单一蓝色强调 + 细边线小阴影，全部为本站静态资源：
 * 无外部字体、图标、CDN、内联样式或内联脚本（与严格 CSP 兼容）。
 *
 * 结构约定：
 *   header.masthead > .masthead-inner > .brand + .masthead-tools(#theme-toggle + #session-box)
 *   main.shell > #page-header + #login-view / #console-view(.layout 左账号 + 右明细)
 *   footer.foot > .footer-brand
 *   模态层：.modal-layer > .dialog；规则编辑器为 .modal-layer.drawer-layer > .drawer
 * 桌面（≥961px）：壳高固定，左右两栏各自滚动；账号头/页签/保存条固定，只有中段滚动。
 * 移动（≤960px）：整页自然滚动，账号用下拉选择，对话框与抽屉全屏。
 * 主题：:root[data-theme="dark"] 为显式深色；未设置 data-theme 时跟随系统。
 */

/* ---------- 设计令牌 ---------- */

:root {
  color-scheme: light;
  --background: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-sunken: #eef1f5;
  --text: #1f2937;
  --text-strong: #344054;
  --text-muted: #475467;
  --text-secondary: #667085;
  --text-tertiary: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-contrast: #ffffff;
  --success: #16803c;
  --success-soft: #ecfdf3;
  --success-border: #bbf7d0;
  --danger: #c4322b;
  --danger-soft: #fef3f2;
  --danger-border: #f6c9c6;
  --danger-contrast: #ffffff;
  --warning: #9a6700;
  --warning-soft: #fff8db;
  --warning-surface: #fffcf2;
  --warning-border: #f0dfa8;
  --focus-ring: rgba(37, 99, 235, .16);
  --scrim: rgba(16, 24, 40, .42);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-dialog: 0 18px 48px rgba(16, 24, 40, .2);
  --shell: 1280px;
  --gutter: 20px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0b111b;
  --surface: #121b29;
  --surface-muted: #172231;
  --surface-hover: #1d2a3b;
  --surface-sunken: #0f1724;
  --text: #e7edf6;
  --text-strong: #d5deea;
  --text-muted: #b4c0d0;
  --text-secondary: #8f9db2;
  --text-tertiary: #7f8ea4;
  --border: #263449;
  --border-strong: #3a4b63;
  --primary: #75a7ff;
  --primary-hover: #91b9ff;
  --primary-soft: #172b4d;
  --primary-border: #31558e;
  --primary-contrast: #09111d;
  --success: #4ade80;
  --success-soft: #123422;
  --success-border: #25583a;
  --danger: #fb7185;
  --danger-soft: #3b1821;
  --danger-border: #72303c;
  --danger-contrast: #240b10;
  --warning: #f5c451;
  --warning-soft: #3a2d12;
  --warning-surface: #292313;
  --warning-border: #645026;
  --focus-ring: rgba(117, 167, 255, .2);
  --scrim: rgba(3, 7, 14, .66);
  --shadow: 0 1px 4px rgba(0, 0, 0, .34);
  --shadow-dialog: 0 18px 48px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: #0b111b;
    --surface: #121b29;
    --surface-muted: #172231;
    --surface-hover: #1d2a3b;
    --surface-sunken: #0f1724;
    --text: #e7edf6;
    --text-strong: #d5deea;
    --text-muted: #b4c0d0;
    --text-secondary: #8f9db2;
    --text-tertiary: #7f8ea4;
    --border: #263449;
    --border-strong: #3a4b63;
    --primary: #75a7ff;
    --primary-hover: #91b9ff;
    --primary-soft: #172b4d;
    --primary-border: #31558e;
    --primary-contrast: #09111d;
    --success: #4ade80;
    --success-soft: #123422;
    --success-border: #25583a;
    --danger: #fb7185;
    --danger-soft: #3b1821;
    --danger-border: #72303c;
    --danger-contrast: #240b10;
    --warning: #f5c451;
    --warning-soft: #3a2d12;
    --warning-surface: #292313;
    --warning-border: #645026;
    --focus-ring: rgba(117, 167, 255, .2);
    --scrim: rgba(3, 7, 14, .66);
    --shadow: 0 1px 4px rgba(0, 0, 0, .34);
    --shadow-dialog: 0 18px 48px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }

/* JS 通过 element.hidden 切换视图与模态；组件自身 display 不得覆盖它。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--background);
  color: var(--text);
}

html { overflow-x: clip; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  font: 14px/1.55 "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 模态打开时锁住背景滚动（类切换，无内联样式）。 */
body.modal-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- 顶部 masthead（品牌、主题、账号） ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.masthead-inner {
  width: min(var(--shell), calc(100% - var(--gutter) * 2));
  min-height: 56px;
  margin: 0 auto;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
}

.brand h1,
.masthead h1 {
  margin: 0;
  min-width: 0;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

/* CSS 自绘 WF 方块标（无图片、无外链图标，纯色不渐变）。 */
.mark {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  color: var(--primary-contrast);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  user-select: none;
}

.masthead-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

/* 主题切换：单按钮循环 auto → light → dark，三个 SVG 由 hidden 切换。 */
button.header-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
}

.header-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.header-icon:hover:not(:disabled),
button.header-icon[aria-pressed="true"] {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

/* 账号区：登录后显示用户名 + 退出，浅竖线分隔不额外加框。 */
.session {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.session button { min-height: 30px; }

.session-name {
  max-width: 30vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- 主内容容器（1280 居中，宽屏留白不拉满） ---------- */

.shell {
  width: min(var(--shell), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: 16px 0 24px;
  flex: 1 1 auto;
  min-width: 0;
}

/* ---------- 页面标题区（#page-header，仅登录后显示） ---------- */

.page-header {
  margin: 0 0 10px;
  padding: 0 2px;
  min-width: 0;
}

.page-header-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.page-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.page-header p {
  margin: 1px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------- 卡片与面板 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
  min-width: 0;
}

.card h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

/* ---------- 登录卡（紧凑 420 宽，输入纵向堆叠） ---------- */

.login {
  display: flex;
  justify-content: center;
  padding: 16px 0 0;
}

.login-card {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 12px;
  padding: 20px 20px 16px;
}

.login-card h2 { font-size: 17px; }

.login-card .status { margin: 0; }

/* ---------- 控制台双列：左账号 / 右明细 ---------- */

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  min-height: 0;
  min-width: 0;
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.placeholder {
  margin: 4px 2px;
  color: var(--text-secondary);
}

/* 移动端账号下拉条：桌面隐藏。 */
.mobile-bar { display: none; }

/* ---------- 左侧账号栏：头部固定，仅列表滚动 ---------- */

.accounts {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.accounts-head {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 11px 12px 10px;
  border-bottom: 1px solid var(--border);
}

.accounts-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.accounts-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-input { flex: 1 1 auto; min-width: 0; }

.accounts-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.account-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.account-item:hover:not(:disabled) {
  border-color: var(--border);
  background: var(--surface-hover);
}

.account-item[aria-current="true"] {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.account-item[aria-current="true"]:hover:not(:disabled) {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.account-item-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
}

.account-item-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-item[aria-current="true"] .account-item-name { color: var(--primary); }

.account-item-meta {
  color: var(--text-secondary);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.dot[data-state="on"] { background: var(--success); }
.dot[data-state="off"] { background: var(--text-tertiary); }

/* ---------- 右侧面板：头 + 页签固定，中段滚动，保存条固定 ---------- */

.panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.panel-head-main { display: grid; gap: 1px; min-width: 0; }

.panel-head h2 { font-size: 16px; }

.panel-head-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tab {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.tab:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: transparent;
  border-bottom-color: var(--border-strong);
  color: var(--text-strong);
}

.tab[aria-selected="true"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab[aria-selected="true"]:hover:not(:disabled) {
  background: transparent;
  border-bottom-color: var(--primary);
  color: var(--primary);
}

/* 未保存标记：即使停在「插件」页签也能看到账号设置有改动。 */
.tab[data-dirty="true"]::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--warning);
  vertical-align: middle;
}

.tabpanel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tabpanel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 16px;
}

.tabpanel-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
}

.save-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.save-bar .status,
.save-bar .hint { margin: 0; }

/* ---------- 表单 ---------- */

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
}

.field-label {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
}

.form-stack { display: grid; gap: 12px; align-content: start; }

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
  min-height: 58px;
  resize: vertical;
  line-height: 1.55;
}

/* 焦点：蓝色描边 + 2px 实心外环，鼠标与键盘一致且对比度足够。 */
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger-border);
}

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

input:disabled, textarea:disabled, select:disabled {
  background: var(--surface-muted);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
  margin: 0 0 14px;
}

.field-grow { flex: 1 1 220px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  color: var(--text-strong);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.check input:disabled { cursor: not-allowed; }

.wxid {
  margin: 0;
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

/* ---------- 允许的会话：紧凑行（名称 / 类型 / ID / 移除） ---------- */

.chats {
  margin: 0;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.chats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.chats-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.allowed-search {
  width: 100%;
  margin-bottom: 8px;
}

.allowed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.allowed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.allowed-text { display: grid; gap: 1px; min-width: 0; }

.allowed-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.allowed-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.allowed-title {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allowed-id {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 类型标签：好友=绿、群聊=蓝、未匹配=黄。 */
.kind-pill[data-kind="friend"] {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.kind-pill[data-kind="group"] {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.kind-pill[data-kind="unknown"] {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

/* ---------- 按钮（默认 ghost 白底细边，primary 蓝色实心） ---------- */

button {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-tertiary);
}

button:disabled { opacity: .45; cursor: not-allowed; }

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

button.primary:hover:not(:disabled) {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: var(--primary-contrast);
}

button.ghost {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-strong);
}

button.compact {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

button.block { width: 100%; }

button.linkish {
  min-height: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

button.linkish:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: var(--primary-hover);
}

/* ---------- 状态、提示与徽标 ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill:empty { display: none; }

.pill[data-state="on"] {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.pill[data-state="off"] {
  border-color: var(--border);
  background: var(--surface-sunken);
  color: var(--text-secondary);
}

.pill[data-state="pending"] {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.plugin-status { min-width: 58px; }

.plugin-dirty[data-state="pending"] {
  border-style: dashed;
  background: transparent;
}

.status {
  margin: 8px 0 0;
  min-height: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.status:empty { display: none; }

.status[data-kind="ok"] { color: var(--success); }
.status[data-kind="error"] { color: var(--danger); }
.status[data-kind="warn"] { color: var(--warning); }

.hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.hint:empty { display: none; }

/* noscript 提示：居中细条，不占整页宽度。 */
.notice {
  width: min(var(--shell), calc(100% - var(--gutter) * 2));
  margin: 12px auto 0;
  padding: 9px 12px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  background: var(--warning-surface);
  color: var(--warning);
  font-size: 12.5px;
}

/* ---------- 插件：紧凑行（状态 / 开关 / 规则数 / 配置按钮） ---------- */

.plugin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

#plugin-list[aria-busy="true"] { opacity: .65; }

.plugin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.plugin[aria-busy="true"] { border-color: var(--primary-border); }

.plugin[data-conflict="true"] {
  border-color: var(--warning-border);
  box-shadow: inset 3px 0 0 var(--warning);
}

.plugin-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.plugin-id {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 150px;
}

.plugin-id h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}

.plugin-id code {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.plugin-count {
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.plugin-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.plugin .status {
  grid-column: 1 / -1;
  margin: 0;
}

.plugin-empty {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* 开关：checkbox 自绘轨道，无外部图标。 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 30px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-sunken);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.switch input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .28);
  transition: transform .15s ease;
}

.switch input[type="checkbox"]:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.switch input[type="checkbox"]:checked::after { transform: translateX(12px); }

.switch input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 规则（抽屉内） ---------- */

.rule-list {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.rule-fields { display: grid; gap: 8px; min-width: 0; }

.rule .field { gap: 4px; }

.rule textarea {
  min-height: 52px;
  font-size: 12.5px;
}

.rule .rule-remove { align-self: start; }

/* ---------- 模态层与对话框 ---------- */

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow: hidden;
}

/* 遮罩用伪元素绘制：不引入额外节点，也不使用内联样式。 */
.modal-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(86dvh, 780px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  overflow: hidden;
  animation: dialog-in .16s ease-out;
}

.dialog-wide { width: min(720px, 100%); }
.dialog-narrow { width: min(420px, 100%); }

@keyframes dialog-in {
  from { transform: translateY(6px); opacity: .7; }
  to { transform: none; opacity: 1; }
}

.dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
}

.dialog-head-text { display: grid; gap: 2px; min-width: 0; }

.dialog-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}

.dialog-head .hint { margin: 0; }

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.dialog-body .status { margin: 0; }

.dialog-foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.dialog-foot .hint { margin: 0; }

.dialog-foot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* 选择会话：工具条与底部固定，中间列表滚动。 */
.chooser-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.chooser-toolbar .search-input { flex: 1 1 180px; }

.chooser-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 12px 10px;
}

.chooser-body .status { margin: 6px 0 0; }

.chooser-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.chooser-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
}

.chooser-row-action {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
}

.chooser-label {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.chooser-label:hover { background: var(--surface-hover); }

.chooser-label:has(input:checked) {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.chooser-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.chooser-row-text { display: grid; gap: 1px; min-width: 0; }

.chooser-row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chooser-row-title {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chooser-row-id {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 目录元数据：状态徽标 + 添加/首次发现时间，无数据时不占位。 */
.chooser-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 1px;
  color: var(--text-tertiary);
  font-size: 11px;
}

.chooser-row-meta-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.contact-state[data-state="active"] {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.contact-state[data-state="removed"] {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

.contact-state[data-state="uncertain"] {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.chooser-foot { display: grid; gap: 6px; }

.chooser-foot .dialog-foot-actions { margin-left: auto; }

.manual-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  margin: 0;
}

.manual-row .status { grid-column: 1 / -1; margin: 0; }

/* 分段筛选（全部 / 好友 / 群聊 / 已选）。 */
.segmented {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.segment {
  min-height: 26px;
  padding: 3px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.segment + .segment { border-left: 1px solid var(--border); }

.segment:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: transparent;
  border-left-color: var(--border);
  color: var(--text-strong);
}

.segment[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.segment[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--primary-soft);
  color: var(--primary);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0 2px;
}

.pager .hint { margin: 0; font-variant-numeric: tabular-nums; }

/* 同步状态行：默认灰，运行中蓝，失败红，离线黄。 */
.sync-line { flex: 1 1 100%; margin: 0; }
.sync-line[data-kind="running"] { color: var(--primary); }
.sync-line[data-kind="warn"] { color: var(--warning); }
.sync-line[data-kind="error"] { color: var(--danger); }

/* ---------- 规则抽屉（右侧，仅中段滚动） ---------- */

.drawer-layer {
  padding: 0;
  align-items: stretch;
  justify-content: flex-end;
}

.drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(540px, 100%);
  height: 100%;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  animation: drawer-in .18s ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(18px); opacity: .7; }
  to { transform: none; opacity: 1; }
}

.drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
}

.drawer-head-text { display: grid; gap: 2px; min-width: 0; }

.drawer-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
  overflow-wrap: anywhere;
}

.drawer-head code {
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.drawer-head-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.drawer-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.drawer-toolbar .search-input { flex: 1 1 160px; }

.drawer-toolbar .hint { margin: 0; font-variant-numeric: tabular-nums; }

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px;
}

.drawer-foot {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.drawer-foot .status { margin: 0; }

/* ---------- 页脚 ---------- */

.foot {
  flex: 0 0 auto;
  width: min(var(--shell), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: 0 0 14px;
  color: var(--text-tertiary);
  font-size: 12px;
  min-width: 0;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.footer-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  user-select: none;
}

.footer-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.footer-copy strong {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 650;
}

.footer-copy span {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ---------- 桌面固定壳高：左右两栏各自滚动 ---------- */

@media (min-width: 961px) {
  html { height: 100%; }

  body {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .shell {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 14px 0 10px;
  }

  /* 登录卡：壳内滚动，避免小高度裁切。 */
  #login-view {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    align-items: flex-start;
  }

  #page-header { flex: 0 0 auto; }

  #console-view { flex: 1 1 auto; min-height: 0; }

  /* 单行网格撑满剩余高度，左右两栏高度一致且各自滚动。 */
  .layout { grid-template-rows: minmax(0, 1fr); }
}

/* ---------- 自适应：360 / 768 / 1440，均不产生整页横向滚动 ---------- */

@media (min-width: 1440px) {
  :root { --gutter: 24px; }
  .layout { grid-template-columns: 320px minmax(0, 1fr); }
}

/* 平板与手机：整页自然滚动，账号改为下拉选择。 */
@media (max-width: 960px) {
  body { min-height: 100dvh; }

  .shell {
    display: block;
    padding: 12px 0 20px;
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .accounts { display: none; }

  .mobile-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: end;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .mobile-bar .field { margin: 0; }

  #accounts-status-mobile {
    grid-column: 1 / -1;
    margin: 0;
  }

  .detail { gap: 10px; }

  /* 移动端不再固定高度，页签内容随页面自然展开。 */
  .panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
  }

  .tabpanel,
  .tabpanel-scroll {
    display: block;
    overflow: visible;
    min-height: 0;
  }

  .tabpanel-scroll { padding: 12px 12px 14px; }

  .panel-head { padding: 11px 12px 10px; }
  .tabs { padding: 0 6px; }
  .save-bar { padding: 10px 12px; }
  .tabpanel-toolbar { padding: 9px 12px; }

  /* 对话框与抽屉全屏。 */
  .modal-layer {
    padding: 0;
    align-items: stretch;
    justify-content: center;
  }

  .dialog,
  .dialog-wide,
  .dialog-narrow {
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100%;
    border: 0;
    border-radius: 0;
    animation: none;
  }

  .drawer {
    width: 100%;
    border-left: 0;
    animation: none;
  }

  .dialog-head,
  .drawer-head { padding: 12px 12px 10px; }

  .dialog-body,
  .drawer-body,
  .chooser-body { padding-left: 12px; padding-right: 12px; }

  .chooser-toolbar,
  .drawer-toolbar { padding: 8px 12px; }

  .dialog-foot,
  .drawer-foot { padding: 10px 12px; }
}

@media (max-width: 768px) {
  :root { --gutter: 12px; }

  .masthead-inner {
    min-height: 52px;
    gap: 10px;
  }

  .brand h1,
  .masthead h1 { font-size: 14px; }

  button.header-icon { width: 34px; height: 34px; }

  .page-header h2 { font-size: 17px; }

  .session-name { max-width: 34vw; }
}

@media (max-width: 640px) {
  .form-row { align-items: stretch; }
  .field-grow { flex: 1 1 100%; }
  .check { min-height: 0; }

  .rule { grid-template-columns: minmax(0, 1fr); }
  .rule .rule-remove { justify-self: start; }

  .plugin {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .plugin-tools { justify-content: flex-start; }

  .dialog-foot-actions { margin-left: 0; width: 100%; }
  .dialog-foot-actions button { flex: 1 1 auto; }

  .chooser-foot .dialog-foot-actions { margin-left: 0; }
}

@media (max-width: 480px) {
  :root { --gutter: 8px; }

  .masthead-inner { min-height: 50px; }

  .brand { gap: 8px; }
  .brand h1,
  .masthead h1 { font-size: 13px; }

  .session { gap: 6px; padding-left: 6px; }
  .session-name { max-width: 26vw; }

  .card { padding: 12px; }
  .login-card { padding: 16px 14px 12px; }

  .mobile-bar { padding: 9px 10px; }

  .allowed-row { grid-template-columns: minmax(0, 1fr) max-content; }

  .footer-copy { gap: 2px 6px; }
}

@media (max-width: 360px) {
  .mark { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; }
  .brand h1,
  .masthead h1 { font-size: 12px; }

  .accounts-head { padding: 10px; }
  .segment { padding: 3px 8px; }
}

/* 尊重系统减少动效设置：只保留颜色/背景的瞬时切换。 */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 插件配置抽屉（通用表单：列表 / 随机延迟 / 映射行 / 欢迎模板） ---------- */

.plugin-policy {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.plugin-policy b { color: var(--text-strong); }

.plugin-count {
  overflow-wrap: anywhere;
}

.plugin-config .drawer { width: min(600px, 100%); }

.plugin-config-toolbar {
  justify-content: space-between;
  align-items: flex-start;
}

.plugin-config-toolbar .hint {
  flex: 1 1 240px;
  margin: 0;
}

.plugin-config-toolbar .linkish { flex: 0 0 auto; }

.plugin-config[data-conflict="true"] .drawer { border-left-color: var(--warning-border); }

.plugin-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.plugin-json { display: grid; gap: 8px; }

.plugin-config-help { margin: 12px 0 0; }

.cfg-field { gap: 6px; }

.cfg-help { margin: 0; }

.cfg-empty { margin: 0; }

.cfg-toggle { min-height: 0; }

.cfg-number-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cfg-number-row input { flex: 0 1 140px; }

.cfg-unit {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.cfg-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}

.cfg-range-cell {
  display: grid;
  gap: 4px;
  flex: 0 1 130px;
  min-width: 0;
}

.cfg-range-cell .field-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.cfg-list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cfg-count {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.cfg-secret-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cfg-secret-row input { flex: 1 1 200px; }

.cfg-secret-state { flex: 0 0 auto; }

.cfg-secret-note { margin: 0; }

.cfg-rows,
.cfg-steps,
.cfg-templates {
  display: grid;
  gap: 8px;
}

.cfg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) max-content;
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.cfg-row input,
.cfg-row textarea { width: 100%; min-width: 0; }

.cfg-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.cfg-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cfg-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.cfg-tpl-name-field { flex: 1 1 160px; }

.cfg-step {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.cfg-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cfg-step-head select { flex: 0 1 150px; }

.cfg-step .check { min-height: 0; }

@media (max-width: 720px) {
  .cfg-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cfg-range-cell { flex: 1 1 120px; }
}

@media (max-width: 640px) {
  .plugin-config-toolbar { flex-direction: column; align-items: stretch; }
  .plugin-config-toolbar .linkish { align-self: flex-start; }
  .cfg-card-head { align-items: stretch; }
  .cfg-tpl-name-field { flex: 1 1 100%; }
  .cfg-step-head select { flex: 1 1 100%; }
}

/* 后打开的模态层必须覆盖先打开的层（配置抽屉 → 会话选择器）。 */
.modal-layer.layer-top { z-index: 70; }

/* ---------- 运行状态提示与近期任务（插件页内） ---------- */

.runtime-notice {
  width: auto;
  margin: 0 0 10px;
}

.tasks-panel {
  margin: 14px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.tasks-panel[hidden] { display: none; }

.tasks-panel > summary {
  cursor: pointer;
  padding: 8px 12px;
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 600;
  list-style-position: inside;
}

.tasks-panel > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.tasks-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 10px;
  border-top: 1px solid var(--border);
}

.tasks-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
}

.tasks-tools .hint { margin: 0; }

.task-list {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.task-row {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.task-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-plugin {
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.task-meta { margin: 0; }

/* 必填项提示：脚注内独立一行，窄屏自动换行。 */
.plugin-config-foot .cfg-required {
  flex: 1 1 100%;
  order: 3;
  margin: 0;
  color: var(--warning);
}

.plugin-config-foot .status {
  flex: 1 1 100%;
  order: 4;
}
