/* 设置（2026-11-21）：左侧导航 + 右侧内容，内容撑满整个窗口。
   2026-11-21 二次改版：去掉分组标签 / 面板标题 / 说明文字 —— 布局与选中态自己说明结构。
   账号菜单弹窗与 /settings 整页共用本样式。 */

/* 弹窗：内容区铺满，顶部只留关闭按钮 */
.settings-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.settings-modal[hidden] { display: none; }
.settings-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 30, .48); }
.settings-modal-window {
  position: relative; z-index: 1;
  /* WorkBuddy 设置窗等比缩一档：900×730 → 810×655，宽高比 1.24 */
  width: min(810px, calc(100vw - 40px)); max-height: min(655px, calc(100vh - 56px));
  height: min(655px, calc(100vh - 56px));
  display: flex; flex-direction: column;
  overflow: auto; padding: 14px;
  background: var(--color-background-surface, #fff);
  border: 1px solid var(--line, #e5e7eb); border-radius: 16px;
  box-shadow: 0 24px 80px rgba(16, 24, 40, .28);
}
.settings-modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 2;
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted, #6b7280);
}
.settings-modal-close:hover { color: var(--text, #1f2328); }

/* 布局：整页与弹窗都撑满可用高度 */
.settings-layout { display: flex; gap: 14px; align-items: stretch; flex: 1 1 auto; min-height: 0; }
.settings-nav {
  flex: 0 0 196px; display: flex; flex-direction: column; gap: 4px;
  padding: 8px; overflow-y: auto;
  border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 14px);
  background: var(--color-background-muted, #f7f8fa);
}
.settings-nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 46px; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--text, #1f2328); font: inherit; font-size: 14px; text-align: left;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.settings-nav-item:hover { background: var(--bg, #f3f4f6); }
.settings-nav-item.is-active { background: var(--brand-soft, #eaf1fd); color: var(--brand, #1a6fe8); font-weight: 600; }

.settings-body { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }
.settings-panel {
  display: none; flex: 1 1 auto; min-height: 0;
  overflow-y: auto; padding: 18px 20px;
  border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 14px);
}
.settings-panel.is-active { display: flex; flex-direction: column; animation: sp-fade .18s ease; }
@keyframes sp-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* 通用：KV 行铺满面板高度 */
.settings-panel .kv { flex: 1 1 auto; display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.settings-panel .kv li {
  flex: 1 1 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 48px; padding: 8px 4px; border-bottom: 1px solid var(--line-soft, #f0f1f3);
}
.settings-panel .kv li:last-child { border-bottom: 0; }
.settings-panel .kv span { color: var(--muted, #6b7280); font-size: 13px; }
.settings-panel .kv b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; text-align: right; }

/* 外观：三张主题卡占据整块区域 */
.theme-pick { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-content: center; }
.theme-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 180px; padding: 18px 10px; cursor: pointer;
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--panel, #fff); color: var(--text, #1f2328); font: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.theme-card svg { width: 32px; height: 32px; color: var(--muted, #6b7280); }
.theme-card b { font-size: 15px; }
.theme-card span { font-size: 12px; color: var(--muted, #6b7280); }
.theme-card:hover { border-color: var(--brand, #1a6fe8); }
.theme-card.is-on { border-color: var(--brand, #1a6fe8); background: var(--brand-soft, #eaf1fd); color: var(--brand, #1a6fe8); }
.theme-card.is-on svg, .theme-card.is-on span { color: var(--brand, #1a6fe8); }

/* 今日额度：大数字 + 进度条居中铺满 */
.quota-box { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; align-items: stretch; padding: 12px 8px; }
.quota-num { margin: 0 0 18px; font-size: 64px; font-weight: 700; letter-spacing: -2px; line-height: 1; text-align: center; }
.quota-num small { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.quota-bar { height: 12px; border-radius: 999px; background: var(--bg, #eef0f4); overflow: hidden; margin-bottom: 16px; }
.quota-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand, #1a6fe8); transition: width .35s ease; }
.quota-bar.is-warn i { background: #d97706; }
.quota-bar.is-full i { background: #dc2626; }
.quota-meta { margin: 0; text-align: center; color: var(--muted, #6b7280); font-size: 13px; }

/* 账号与安全：表单铺满 */
.settings-pwd-form { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 420px; width: 100%; margin: 0 auto; }
.settings-pwd-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted, #6b7280); }
.settings-pwd-form input { font-size: 15px; padding: 10px 12px; }

/* 帮助与反馈：两张大卡片铺满 */
.help-grid { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: center; }
.help-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 180px; padding: 18px; text-decoration: none;
  border: 1px solid var(--line, #e5e7eb); border-radius: 12px;
  background: var(--panel, #fff); color: var(--text, #1f2328);
  transition: border-color .15s ease, background .15s ease;
}
.help-card:hover { border-color: var(--brand, #1a6fe8); background: var(--brand-soft, #eaf1fd); text-decoration: none; }
.help-card b { font-size: 16px; }
.help-card span { font-size: 12px; color: var(--muted, #6b7280); }

@media (max-width: 760px) {
  .settings-layout { flex-direction: column; }
  .settings-nav { flex: 0 0 auto; flex-direction: row; overflow-x: auto; }
  .settings-nav-item { flex: 0 0 auto; min-height: 38px; }
  .settings-modal-window { padding: 12px; }
  .settings-panel { padding: 14px; }
  /* 覆盖全局手机样式 .kv li{flex-direction:column}：设置页保持「标签左 / 值右」横排 */
  .settings-panel .kv li { flex-direction: row; align-items: center; text-align: left; padding: 12px 2px; }
  .settings-panel .kv span { flex: 0 0 auto; }
  .settings-panel .kv b { text-align: right; }
  .quota-num { font-size: 46px; }
  .theme-pick { grid-template-columns: 1fr; gap: 8px; align-content: start; }
  .theme-card { min-height: 68px; flex-direction: row; justify-content: flex-start; gap: 14px; padding: 10px 16px; }
  .theme-card svg { width: 24px; height: 24px; }
  .help-grid { grid-template-columns: 1fr; gap: 8px; align-content: start; }
  .help-card { min-height: 76px; }
}

/* ---------- 系统运营：采集与入库参数（2026-11-22 从案例收集页「设置」页签搬来） ----------
   行结构与原来一致：每组一张卡、一行「名称 + 控件」，靠分组与顺序自解释。
   原来带 `.collect-page` 前缀，搬进设置后去掉前缀成为全局样式；
   案例收集页的来源开关仍用带前缀的 `.collect-page .sw`，两边互不影响。 */
.settings-nav-sep { margin: 8px 10px 6px; border-top: 1px solid var(--line, #e5e7eb); }
.settings-nav-hint {
  padding: 0 10px 4px; font-size: 11px; letter-spacing: .04em;
  color: var(--muted-2, #8b93a1);
}
.set-group { margin-bottom: 22px; }
.set-card {
  border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 8px);
  background: var(--panel, #fff); overflow: hidden;
}
.set-group h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text, #111827); }
.set-row {
  display: flex; align-items: center; gap: 14px; padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft, #f0f1f3);
}
.set-row:last-child { border-bottom: 0; }
.set-row .set-label { flex: 1 1 auto; min-width: 0; font-size: 13.5px; color: var(--text, #111827); }
.set-row .set-ctrl { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.set-row input[type=number],
.set-row input[type=time],
.set-row input[type=text] { font-size: 13.5px; }
.set-row .set-unit { font-size: 11.6px; color: var(--muted-2, #8b93a1); min-width: 26px; }
.set-row input[type=number] { width: 84px; text-align: right; }
.set-row input[type=time] { width: 102px; }
.set-row input[type=text].wide { width: 210px; }
/* 开关：与案例收集页同一个造型（那边仍用带 .collect-page 前缀的同名规则） */
.sw {
  width: 30px; height: 17px; border-radius: 999px; background: #d5d9df; position: relative;
  flex: none; border: 0; padding: 0; cursor: pointer; transition: background .16s;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; transition: left .16s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.sw.on { background: var(--brand, #2f56f0); }
.sw.on::after { left: 15px; }
.set-foot {
  display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 14px;
  border-top: 1px solid var(--line-soft, #f0f1f3); flex-wrap: wrap;
}
.set-foot .set-state { font-size: 13px; color: var(--ok, #188a4a); }
.set-foot .grow { margin-left: auto; }
.set-foot .stamp { font-size: 12px; color: var(--muted-2, #8b93a1); }
/* 全站生效的提醒：参数一改影响所有人，进面板先看见 */
.ops-note {
  display: flex; align-items: flex-start; gap: 8px; margin: 0 0 16px;
  padding: 10px 12px; border-radius: 8px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  font-size: 12.5px; line-height: 1.6;
}
#panel-ops { overflow-y: auto; }

/* 窄屏（<=760px）左栏变横向滚动条：分隔线要改成竖线，「系统 · 仅管理员」小字让位给标签，
   否则横排里只剩一像素的缝隙和一行孤零零的小字。 */
@media (max-width: 760px) {
  .settings-nav-sep {
    flex: 0 0 1px; align-self: stretch; margin: 6px 4px;
    border-top: 0; border-left: 1px solid var(--line, #e5e7eb);
  }
  .settings-nav-hint { display: none; }
}

@media (max-width: 700px) {
  .set-row { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .set-row .set-label { flex: 1 1 100%; }
  .set-row .set-ctrl { flex: 1 1 100%; }
  .set-row input[type=number] { width: 96px; }
  .set-foot .btn { flex: 1 1 auto; }
}

/* ---------------- 设置弹窗 → 系统运营：采集代理（2026-11-23） ----------------
   复用 [data-proxy-panel] 的通用样式（style.css），这里只补容器内边距；
   组里已有 h3「采集代理」，面板自己的标题和折叠箭头就不用再显示一遍。 */
.settings-panel .ops-proxy { padding: 12px 16px 14px; }
[data-proxy-panel].is-compact .proxy-head { min-height: 26px; cursor: default; }
[data-proxy-panel].is-compact .proxy-head h3,
[data-proxy-panel].is-compact .proxy-head .chev { display: none; }

/* ---------------- 账号与安全：改密码 / 改账号 两块（2026-11-28） ---------------- */
.settings-panel .settings-stack { display: flex; flex-direction: column; gap: 22px; }
.settings-block { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 18px; background: var(--panel, #fff); }
.settings-block-title { margin: 0 0 10px; font-size: 15px; }
.settings-block .settings-pwd-form { max-width: none; margin: 0; gap: 12px; }
@media (max-width: 760px) {
  .settings-block { padding: 14px; }
}
