/* ============================================================
 * settings.css · 设置中心（schema 驱动）
 * 配色一律走 brand-tokens 变量 / rgba / hex；不使用 color-mix()。
 * 三主题（dark / light / red）下背景与文字都取自变量，不写死深色底。
 * ============================================================ */

/* ---------- 合成层遮挡修复 ----------
 * 根因（真机 elementFromPoint + CDP 渲染器缓冲帧 + 逐元素隐藏二分定位）：
 *   桌面顶栏 `.topbar` 的 `backdrop-filter: blur(14px)` 在本浏览器实例被提升为
 *   独立合成层，合成排序中压过了 fixed 设置抽屉；表现为抽屉骨架（头部品牌/✕）在，
 *   分区与正文整段不画。提抽屉 z-index、抽屉自身加 backdrop-filter 均无效；
 *   仅去掉顶栏背景模糊后抽屉完整上屏。顶栏底色已是 82% 不透明，去掉模糊几乎无感。
 *   手机端顶栏继承同一条规则，一并覆盖。 */
#topbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- 抽屉宽度：桌面 352px（原 224px），不遮主对话输入框 ---------- */
#settingsDrawer { width: 352px; }

/* ---------- 顶部状态行 ---------- */
.settings-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--eng-line);
  font-size: 12px;
  color: var(--eng-text-dim);
  flex: 0 0 auto;
}
.ss-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--eng-slate);
  display: inline-block;
  flex: 0 0 auto;
}
.ss-dot.sync   { background: var(--eng-ok); }
.ss-dot.saving { background: var(--eng-warn); }
.ss-dot.fail,
.ss-dot.confirm { background: var(--eng-danger); }
.ss-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 底部后台入口 ---------- */
.drawer-foot {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--eng-line);
  flex: 0 0 auto;
}
.drawer-foot .admin-entry { width: 100%; }

/* 保留给 app.js 的旧容器：未迁移前整体隐藏（节点与按钮仍在 DOM 中可被绑定） */
#settingsPreserved[hidden] { display: none !important; }

/* ---------- 分区 ---------- */
.st-section { border-bottom: 1px solid var(--eng-line); }
.st-section:last-child { border-bottom: 0; }

.st-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 2px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--eng-text);
  text-align: left;
  font-family: var(--eng-font);
}
.st-ico {
  font-size: 14px;
  color: var(--eng-text-dim);
  width: 18px;
  text-align: center;
  flex: 0 0 auto;
}
.st-head-t {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st-title { font-size: 13px; font-weight: 600; }
.st-desc {
  font-size: 11px;
  color: var(--eng-text-dim);
  line-height: 1.4;
}
.st-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.st-reset-sec {
  font-size: 11px;
  color: var(--eng-text-dim);
  cursor: pointer;
}
.st-reset-sec:hover { color: var(--eng-red); }
.st-caret {
  color: var(--eng-text-dim);
  font-size: 11px;
  transition: transform .18s ease;
}
.st-section.collapsed .st-caret { transform: rotate(-90deg); }

.st-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 2px 14px;
}
.st-section.collapsed .st-items { display: none; }

/* ---------- 条目 ---------- */
/* notice：状态陈述条。未开启时用红色竖线+红底踏出视觉重量，开启后自动退成低调态。
   只陈述事实，不带任何跳转按钮——这一轮不做登录，别给它一个点了没反应的入口。 */
.st-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0 0 16px;
  padding: 13px 14px;
  border-left: 3px solid var(--eng-red);
  background: rgba(200, 16, 46, .07);
  border-radius: 2px;
}
.st-notice-mark {
  flex: 0 0 auto;
  width: 19px; height: 19px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--eng-red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}
.st-notice-txt { min-width: 0; }
.st-notice-t {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--eng-text);
}
.st-notice-d {
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--eng-text-dim);
}
.st-notice.is-on {
  border-left-color: var(--eng-ok);
  background: transparent;
}
.st-notice.is-on .st-notice-mark { background: var(--eng-ok); }

.st-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.st-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.st-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--eng-text);
}
.st-badge {
  font-size: 10px;
  color: var(--eng-red);
  border: 1px solid var(--eng-line-red);
  border-radius: 6px;
  padding: 1px 6px;
  flex: 0 0 auto;
}
.st-reset {
  border: 0;
  background: transparent;
  color: var(--eng-text-dim);
  font-size: 11px;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 2px 4px;
  font-family: var(--eng-font);
}
.st-reset:hover { color: var(--eng-red); }
.st-ctrl { min-width: 0; }
.st-hint {
  font-size: 11px;
  color: var(--eng-text-dim);
  line-height: 1.45;
}
.st-error {
  font-size: 11.5px;
  color: var(--eng-danger);
  line-height: 1.45;
}
.st-error[hidden] { display: none; }

/* ---------- 表单控件 ---------- */
.st-select,
.st-input,
.st-textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--eng-line);
  border-radius: 10px;
  background: var(--eng-surface);
  color: var(--eng-text);
  padding: 9px 10px;
  font-size: 13px;
  font-family: var(--eng-font);
}
.st-select:focus,
.st-input:focus,
.st-textarea:focus {
  outline: none;
  border-color: var(--eng-line-red);
}
.st-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}
.st-num-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.st-num-wrap .st-input { flex: 1 1 auto; }
.st-unit {
  font-size: 11px;
  color: var(--eng-text-dim);
  flex: 0 0 auto;
}

/* 开关 */
.st-switch {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  border: 1px solid var(--eng-line);
  background: var(--eng-surface-2);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
  flex: 0 0 auto;
}
.st-switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--eng-silver);
  transition: transform .18s ease, background .18s ease;
}
.st-switch[aria-checked="true"] {
  background: rgba(200, 16, 46, .22);
  border-color: var(--eng-red);
}
.st-switch[aria-checked="true"]::after {
  transform: translateX(20px);
  background: var(--eng-red-bright);
}

/* ---------- 只读信息行 ---------- */
.st-ro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ro-row {
  display: flex;
  gap: 10px;
  font-size: 12px;
  line-height: 1.45;
  min-width: 0;
}
.ro-k {
  flex: 0 0 86px;
  color: var(--eng-text-dim);
}
.ro-v {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--eng-text);
  word-break: break-word;
}
.st-ro-empty {
  font-size: 13px;
  line-height: 1.55;
  padding: 4px 0 8px;
  color: var(--eng-text-dim);
}
.svc-slot { margin-top: 4px; }

.st-offline {
  font-size: 12.5px;
  color: var(--eng-text-dim);
  line-height: 1.6;
  padding: 8px 2px;
}

/* ---------- 危险项确认弹层 ---------- */
.st-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 9700;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.st-confirm {
  width: min(320px, 100%);
  background: var(--eng-surface);
  border: 1px solid var(--eng-line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--eng-shadow);
  box-sizing: border-box;
}
.st-confirm-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--eng-text);
  margin-bottom: 8px;
}
.st-confirm-msg {
  font-size: 12.5px;
  color: var(--eng-text-dim);
  line-height: 1.6;
  margin-bottom: 16px;
}
.st-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.st-btn {
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12.5px;
  cursor: pointer;
  border: 1px solid var(--eng-line);
  font-family: var(--eng-font);
}
.st-btn.ghost {
  background: transparent;
  color: var(--eng-text-dim);
}
.st-btn.danger {
  background: var(--eng-red);
  border-color: var(--eng-red);
  color: #fff;
}

/* ---------- 手机端：宽度/遮罩/滑出动效沿用 mobile.css 基线（min(84vw,320px)）；
   这里只收紧排版与控件热区，保证 375 宽不横向溢出、可纵向滚动。 ---------- */
html[data-m="1"] .settings-status { padding: 10px 14px; }
html[data-m="1"] .st-head { padding: 14px 2px; }
html[data-m="1"] .ro-k { flex-basis: 76px; }
html[data-m="1"] .st-items { gap: 16px; }
html[data-m="1"] .st-select,
html[data-m="1"] .st-input,
html[data-m="1"] .st-textarea { min-height: 44px; }
html[data-m="1"] .st-textarea { min-height: 84px; }
/* 手机端开关热区 ≥44px；圆点保持 22×22 不变形，垂直居中（top:50% + translateY(-50%)） */
html[data-m="1"] .st-switch { width: 50px; height: 44px; }
html[data-m="1"] .st-switch::after {
  top: 50%;
  left: 3px;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
}
html[data-m="1"] .st-switch[aria-checked="true"]::after { transform: translateX(22px) translateY(-50%); }
