/* DSH Remote · 移动优先 · 四皮肤(默认深空/深色落日/亮色易北爱乐厅/中性草原孤塔)
 * 规则样式表; 变量定义已抽取到 theme-vars.css(桌面端共享), 保持单一来源。 */

@import 'theme-vars.css';


/* ============ 基础 ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

input::placeholder, textarea::placeholder { color: var(--dsr-text-disabled); opacity: 1; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--dsr-bg);
  color: var(--dsr-text);
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(64px + var(--dsr-safe-b)); }

.hidden { display: none !important; }
.muted { color: var(--dsr-muted); font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--dsr-safe-top) + 10px) 14px 10px;
  /* 实色背景: 小米/MIUI WebView 后台恢复时 backdrop-filter 图层会丢, 顶栏整块消失 */
  background: var(--dsr-bg);
  border-bottom: 1px solid var(--dsr-line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .5px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--dsr-brand-a), var(--dsr-brand-b));
  box-shadow: 0 0 12px var(--dsr-glow);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.conn-badge {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--dsr-line); color: var(--dsr-muted);
}
.conn-badge.on { color: var(--dsr-success); border-color: var(--dsr-success-line); background: var(--dsr-success-soft); }
.conn-badge.off { color: var(--dsr-warning); border-color: var(--dsr-warning-line); background: var(--dsr-warning-soft); }

/* ---------- 按钮 ---------- */
button {
  font: inherit; color: inherit; background: none; border: none; cursor: pointer;
  touch-action: manipulation;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line);
  font-size: 17px; display: grid; place-items: center;
}
.icon-btn:active { background: var(--dsr-panel-2); }
/* 顶栏按钮统一: 反馈/刷新/连接徽章同高同基线 */
.topbar-btn {
  height: 44px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  line-height: 1; vertical-align: middle; flex-shrink: 0;
}
.topbar-right .topbar-btn.icon-btn { width: 44px; padding: 0; font-size: 19px; border-radius: 12px; }
.topbar-right .topbar-btn.conn-badge { padding: 0 14px; border-radius: 999px; font-size: 12.5px; }
.mini-btn {
  padding: 5px 11px; border-radius: 9px; font-size: 13px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-accent-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  flex-shrink: 0;
}
.mini-btn:active { background: var(--dsr-panel-2); }
a.mini-btn { text-decoration: none; display: inline-flex; align-items: center; }
.feedback-links { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; }
.feedback-card { background: var(--dsr-accent-soft); border-color: var(--dsr-accent-line); }
.feedback-btn {
  flex: 1 1 0; min-width: 92px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 12px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-accent-strong);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.feedback-btn svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.feedback-btn.primary { background: var(--dsr-accent-strong); border-color: var(--dsr-accent-strong); color: var(--dsr-on-accent); }
.feedback-btn:active { filter: brightness(.94); }
.btn {
  flex: 1; padding: 11px 14px; border-radius: 12px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--dsr-line);
}
.btn.primary { background: var(--dsr-accent); border-color: var(--dsr-accent); color: var(--dsr-on-accent); }
.btn.subtle { background: var(--dsr-panel); color: var(--dsr-muted); }
.danger-btn {
  padding: 7px 13px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--dsr-error-soft); color: var(--dsr-error);
  border: 1px solid var(--dsr-error-line);
}
.danger-btn:active { background: var(--dsr-error-line); }

/* ---------- 主体 ---------- */
.main { padding: 12px 12px 20px; max-width: 720px; margin: 0 auto; }
.view { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.stat-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px;
}
.stat {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  padding: 10px 12px;
}
.stat .v { font-size: 21px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--dsr-muted); }
.stat.running .v { color: var(--dsr-warning); }
.stat.pending .v { color: var(--dsr-accent-2); }
.stat.ctx .v { color: var(--dsr-info); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 2px 8px; font-size: 13px; font-weight: 700; color: var(--dsr-muted);
  letter-spacing: 1px;
}
.section-head.small { margin-top: 6px; }

/* ---------- Token 统计(移动端) ---------- */
.stats-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scard { background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius); padding: 10px 11px; min-width: 0; }
.scard.span2 { grid-column: span 2; }
.scard .v { font-size: 17px; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .k { font-size: 10px; color: var(--dsr-muted); margin-top: 2px; line-height: 1.4; }
.bucket-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin-top: 6px; }
.bucket-grid .b { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 10.5px; min-width: 0; }
.bucket-grid .b .n { color: var(--dsr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bucket-grid .b .t { font-weight: 600; white-space: nowrap; }
.stats-chart { display: flex; align-items: flex-end; gap: 7px; height: 190px; padding: 12px 12px 10px; margin-top: 10px; background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius); overflow-x: auto; overflow-y: hidden; }
.stats-legend { display: flex; gap: 12px; font-size: 10px; color: var(--dsr-muted); margin-top: 6px; }
.stats-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.stats-legend .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.stats-legend .sw.peak { background: var(--dsr-accent-strong); }
.stats-legend .sw.off { background: var(--dsr-accent-2); }
.stats-bar { flex: 1; min-width: 36px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.stats-bar .bars { width: 100%; max-width: 42px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 6px 6px 0 0; overflow: hidden; background: var(--dsr-accent-soft); }
.stats-bar .seg { width: 100%; }
.stats-bar .seg.peak { background: var(--dsr-accent-strong); }
.stats-bar .seg.off { background: var(--dsr-accent-2); }
.stats-bar .lbl { font-size: 9px; color: var(--dsr-muted); white-space: nowrap; }
.stats-bar .val { font-size: 9px; color: var(--dsr-text); white-space: nowrap; }
.stats-note { font-size: 11px; color: var(--dsr-muted); line-height: 1.6; margin-top: 8px; }
.stats-empty { color: var(--dsr-muted); text-align: center; padding: 18px 0; font-size: 12px; }

/* ---------- 会话列表 ---------- */
.session-list { display: flex; flex-direction: column; gap: 8px; }
.session-card {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  padding: 12px 13px; position: relative; overflow: hidden;
}
.session-card:active { background: var(--dsr-panel-2); }
.session-card.current { border-color: var(--dsr-accent-line); box-shadow: 0 0 0 1px var(--dsr-accent-soft); }
.sc-title {
  font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; padding-right: 44px;
}
.sc-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12px; color: var(--dsr-muted); flex-wrap: wrap; }
.sc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dsr-line); display: inline-block; }
.sc-dot.running { background: var(--dsr-warning); box-shadow: 0 0 8px var(--dsr-warning-line); animation: pulse 1.6s infinite; }
.sc-dot.pending { background: var(--dsr-accent-2); box-shadow: 0 0 8px var(--dsr-accent-2-line); }
@keyframes pulse { 50% { opacity: .45; } }
.sc-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--dsr-accent-2-soft); color: var(--dsr-accent-2); border: 1px solid var(--dsr-accent-2-line);
}
.sc-badge.goal-active { background: var(--dsr-info-soft); color: var(--dsr-info); border-color: var(--dsr-info-line); }
.sc-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--dsr-muted); }
.empty { text-align: center; color: var(--dsr-muted); padding: 34px 0; }

/* ---------- 会话详情 ---------- */
body.in-session { overflow: hidden; height: 100vh; height: 100dvh; }
body.in-session .topbar { display: none; }
body.in-session .main {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 12px 76px;
}
body.in-session .view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.session-head {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  padding: calc(var(--dsr-safe-top) + 8px) 12px 8px;
  margin: -12px -12px 6px;
  background: var(--dsr-head-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--dsr-line);
}
/* 会话运行状态可视化:
   运行中 = 流动渐变; 出错/中断 = 暖色; 空闲 = 原始样式 */
.session-head.running {
  background: var(--dsr-head-running-bg);
  background-size: 200% 100%;
  animation: session-running-flow 2.6s ease-in-out infinite alternate;
  border-bottom-color: var(--dsr-head-running-line);
}
.session-head.interrupted {
  background: var(--dsr-head-interrupted-bg);
  background-size: 200% 100%;
  animation: session-running-flow 1.8s ease-in-out infinite alternate;
  border-bottom-color: var(--dsr-head-interrupted-line);
}
@keyframes session-running-flow {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
.session-head .session-title { flex-shrink: 1; }
.session-head-meta { flex: 1; min-width: 0; }
.session-title {
  font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-sub { font-size: 12px; color: var(--dsr-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
  flex-shrink: 0; max-height: 42vh; overflow-y: auto;
}
.card {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  padding: 11px 13px;
}
.card-title { font-size: 12px; color: var(--dsr-muted); font-weight: 700; letter-spacing: .6px; margin-bottom: 6px; }
.card-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.card-row .k { color: var(--dsr-muted); }
.card-row .v { text-align: right; word-break: break-all; }
.goal-obj { font-size: 13px; line-height: 1.55; color: var(--dsr-text); }
.goal-phase { font-size: 12px; color: var(--dsr-info); margin-top: 3px; }
.goal-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.goal-actions .mini-btn { flex: 1; text-align: center; min-width: 64px; }
.pill {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--dsr-accent-soft); color: var(--dsr-accent-strong); border: 1px solid var(--dsr-accent-line);
  margin: 1px 3px 1px 0;
}
.pill.done { background: var(--dsr-success-soft); color: var(--dsr-success); border-color: var(--dsr-success-line); }
.pill.active { background: var(--dsr-warning-soft); color: var(--dsr-warning); border-color: var(--dsr-warning-line); }

/* ---------- 历史 ---------- */
.history-wrap {
  flex: 1; min-height: 0;
  position: relative;
  display: flex;
}
.history {
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px;
  padding-right: 16px;
  scrollbar-width: none;
}
.history::-webkit-scrollbar { display: none; }
.history-more { text-align: center; margin: 4px 0; }

/* 右侧导航条: 拇指 + 用户发言节点 */
.history-rail {
  position: absolute; right: 0; top: 0; bottom: 0; width: 18px;
  z-index: 5; touch-action: none;
}
.rail-track {
  position: absolute; right: 8px; top: 4px; bottom: 4px; width: 4px;
  border-radius: 2px; background: var(--dsr-line);
}
.rail-thumb {
  position: absolute; right: 6px; width: 8px; min-height: 32px;
  border-radius: 4px; background: var(--dsr-accent); opacity: .85;
}
.rail-nodes { position: absolute; inset: 0; }
.rail-node {
  position: absolute; right: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--dsr-warning); transform: translateY(-3px);
  box-shadow: 0 0 4px var(--dsr-warning-line);
}
.rail-node.active { background: var(--dsr-text); width: 8px; height: 8px; right: 6px; }
.msg { max-width: 94%; border-radius: var(--dsr-radius); padding: 10px 12px; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--dsr-accent); color: var(--dsr-on-accent); }
.msg.assistant { align-self: flex-start; background: var(--dsr-panel); border: 1px solid var(--dsr-line); }
.msg .role { font-size: 11px; opacity: .65; margin-bottom: 3px; }
.msg pre {
  background: var(--dsr-code-bg); border-radius: 8px; padding: 8px 10px; overflow-x: auto;
  font-size: 12px; max-height: 220px; overflow-y: auto;
}
.msg img { max-width: 100%; border-radius: 8px; }
.msg p { margin: 4px 0; }
.msg p:first-child { margin-top: 0; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0; padding-left: 20px; }
.msg code { font-family: ui-monospace, monospace; font-size: .9em; background: var(--dsr-accent-soft); padding: 0 4px; border-radius: 4px; }
.msg h1, .msg h2, .msg h3 { margin: 8px 0 4px; line-height: 1.3; font-weight: 700; }
.msg h1 { font-size: 1.3em; } .msg h2 { font-size: 1.18em; } .msg h3 { font-size: 1.05em; }
.msg blockquote { margin: 6px 0; padding: 2px 10px; border-left: 3px solid var(--dsr-accent-2); color: var(--dsr-muted); }
.msg a { color: var(--dsr-accent-strong); text-decoration: underline; word-break: break-all; }
.msg.user a { color: var(--dsr-on-accent); }
.msg li { margin: 2px 0; }

.event {
  align-self: center; font-size: 11px; color: var(--dsr-muted);
  background: var(--dsr-panel); border: 1px dashed var(--dsr-divider);
  padding: 5px 12px; border-radius: 999px; max-width: 92%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool {
  align-self: flex-start; max-width: 96%; background: var(--dsr-panel);
  border: 1px solid var(--dsr-line); border-left: 3px solid var(--dsr-accent-2);
  border-radius: 10px; padding: 8px 11px; font-size: 13px;
}
.tool summary { cursor: pointer; color: var(--dsr-accent-2); font-weight: 600; }
.tool-meta-inline { font-size: 11px; color: var(--dsr-muted); font-weight: 400; margin-left: 6px; }
.tool pre { margin: 6px 0 0; font-size: 11.5px; background: var(--dsr-code-bg); border-radius: 8px; padding: 8px; overflow-x: auto; max-height: 180px; overflow-y: auto; }
.tool .tool-meta { font-size: 11px; color: var(--dsr-muted); margin-top: 4px; }
.tool-text {
  white-space: pre-wrap; word-break: break-word;
  font-size: 12.5px; line-height: 1.6;
  background: var(--dsr-code-bg); border-radius: 8px;
  padding: 8px 10px; margin-top: 6px;
  max-height: 320px; overflow-y: auto;
}
.tool.result { border-left-color: var(--dsr-info); }
.tool.result summary { color: var(--dsr-info); }
.tool.error { border-left-color: var(--dsr-error); }
.tool.error summary { color: var(--dsr-error); }

/* ---------- composer ---------- */
.composer-wrap {
  position: fixed; left: 0; right: 0; bottom: calc(58px + var(--dsr-safe-b)); z-index: 20;
  max-width: 720px; margin: 0 auto;
  background: var(--dsr-composer-bg); backdrop-filter: blur(10px);
  border-top: 1px solid var(--dsr-line);
}
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 12px calc(8px + var(--dsr-safe-b));
}
.composer textarea {
  flex: 1; resize: none; background: var(--dsr-panel); color: var(--dsr-text);
  border: 1px solid var(--dsr-line); border-radius: 16px;
  padding: 10px 14px; font: inherit; font-size: 15px; line-height: 1.4;
  max-height: 120px; outline: none;
}
.composer textarea:focus { border-color: var(--dsr-accent-line); }
.plus-btn {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px;
  background: var(--dsr-panel); color: var(--dsr-info); border: 1px solid var(--dsr-line);
  font-size: 22px; font-weight: 700; line-height: 1;
}
.plus-btn.active { background: var(--dsr-info-soft); border-color: var(--dsr-info-line); }
.send-btn {
  flex-shrink: 0; width: 46px; height: 42px; border-radius: 14px;
  background: var(--dsr-accent); color: var(--dsr-on-accent); font-weight: 700; font-size: 14px;
}
.send-btn:disabled { opacity: .45; }
.composer-menu {
  max-height: min(46vh, 340px); overflow-y: auto;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 12px;
  border-bottom: 1px solid var(--dsr-line);
}
.menu-title {
  font-size: 12px; color: var(--dsr-muted); font-weight: 700; letter-spacing: .5px;
  margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between;
}
.menu-chips { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.menu-chip {
  background: var(--dsr-panel); color: var(--dsr-text); border: 1px solid var(--dsr-line);
  border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.menu-chip:active { background: var(--dsr-accent-soft); border-color: var(--dsr-accent-line); }
.menu-chip.current { color: var(--dsr-info); border-color: var(--dsr-info-line); background: var(--dsr-info-soft); }
.menu-chip.danger { color: var(--dsr-warning); border-color: var(--dsr-warning-line); }
.menu-models { display: flex; flex-wrap: wrap; gap: 7px; }
.model-chip {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-text);
  border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-chip.current { color: var(--dsr-info); border-color: var(--dsr-info-line); background: var(--dsr-info-soft); }
.model-provider { font-size: 11px; color: var(--dsr-muted); margin: 7px 0 5px; }
body.in-session .main { padding-bottom: 84px; }

/* ---------- 待办 ---------- */
.pending-list, .jobs-list { display: flex; flex-direction: column; gap: 8px; }
.pending-card, .job-card {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  padding: 11px 13px;
}
.pending-card.approval { border-left: 3px solid var(--dsr-warning); }
.pending-card.question { border-left: 3px solid var(--dsr-accent-2); }
.pc-title { font-weight: 600; font-size: 14px; }
.pc-desc { font-size: 12.5px; color: var(--dsr-muted); margin-top: 3px; overflow-wrap: anywhere; }
.pc-session { font-size: 11px; color: var(--dsr-accent-strong); margin-top: 5px; }
.job-card .job-name { font-weight: 600; font-size: 14px; }
.job-state { font-size: 12px; color: var(--dsr-muted); margin-top: 3px; }

/* ---------- 文件传输 ---------- */
.fs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fs-path {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--dsr-muted);
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: 10px;
  padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fs-progress {
  display: flex; align-items: center; gap: 10px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: 10px;
  padding: 9px 11px; margin-bottom: 10px;
}
.fs-progress-track {
  flex: 1; height: 7px; border-radius: 999px; background: var(--dsr-panel-2); overflow: hidden;
}
.fs-progress-bar {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--dsr-accent), var(--dsr-info));
  transition: width .15s ease;
}
.fs-progress-text { flex-shrink: 0; min-width: 112px; text-align: right; }
.fs-progress-actions { flex-shrink: 0; display: flex; gap: 6px; }
.fs-progress-actions .mini-btn { padding: 4px 10px; font-size: 12px; }
.fs-pull {
  height: 0; overflow: hidden; text-align: center; font-size: 12px; color: var(--dsr-info);
  transition: height .12s ease; line-height: 26px;
}
.fs-list { display: flex; flex-direction: column; gap: 8px; }
.fs-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  padding: 11px 13px; min-width: 0;
}
.fs-row:active { background: var(--dsr-panel-2); }
.fs-ico { flex-shrink: 0; font-size: 22px; }
.fs-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-name {
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.fs-sub { font-size: 12px; color: var(--dsr-muted); margin-top: 1px; }
.fs-arrow { flex-shrink: 0; color: var(--dsr-muted); font-size: 18px; }

/* ---------- 设置 ---------- */
.settings-group {
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: var(--dsr-radius);
  margin-bottom: 10px; overflow: hidden;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 14px;
}
.setting-row > div:first-child { flex: 1; min-width: 0; }
.setting-row + .setting-row { border-top: 1px solid var(--dsr-line); }
.setting-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setting-desc { font-size: 12px; color: var(--dsr-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setting-desc.expanded { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.setting-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.about { text-align: center; color: var(--dsr-muted); font-size: 12px; margin-top: 16px; line-height: 1.8; }

/* 多服务器列表(分组) */
.group-bar { display: flex; align-items: center; gap: 8px; padding: 0 14px 10px; }
.group-bar-label { font-size: 12px; color: var(--dsr-muted); white-space: nowrap; }
.group-select { flex: 1; min-width: 0; position: relative; }
.group-select-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--dsr-bg-2); color: var(--dsr-text); border: 1px solid var(--dsr-line); border-radius: 10px; padding: 7px 9px; font: inherit; font-size: 13px; outline: none; cursor: pointer; }
.group-select-btn .caret { color: var(--dsr-muted); font-size: 10px; transition: transform .15s ease; }
.group-select-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 220px; overflow-y: auto; background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.28); padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.group-option { width: 100%; text-align: left; background: none; border: none; color: var(--dsr-text); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.group-option.current { background: var(--dsr-accent-soft); color: var(--dsr-accent-strong); font-weight: 600; }
.group-option:active { background: var(--dsr-panel-2); }
.server-list { padding: 0 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.server-empty { font-size: 12px; color: var(--dsr-muted); }
.srv-group { border: 1px solid var(--dsr-line); border-radius: 12px; background: var(--dsr-panel); overflow: hidden; }
.srv-group-head { display: flex; align-items: center; gap: 6px; padding: 7px 9px; }
.srv-group-name { flex: 1; min-width: 0; text-align: left; background: none; border: none; color: var(--dsr-text); font: inherit; font-size: 13px; font-weight: 600; padding: 2px 0; display: flex; align-items: center; gap: 6px; }
.srv-group-count { font-size: 10.5px; color: var(--dsr-muted); background: var(--dsr-bg-2); border-radius: 999px; padding: 0 7px; line-height: 16px; }
.srv-group-speed { flex-shrink: 0; padding: 3px 8px; font-size: 12px; }
.srv-group-del { flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px; background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-muted); font-size: 11px; }
.srv-group-del:active { color: var(--dsr-error); }
.srv-group-body { display: flex; flex-direction: column; gap: 6px; padding: 0 9px 9px; }
.switch.small { width: 36px; height: 21px; }
.switch.small .slider::before { width: 15px; height: 15px; left: 2px; top: 2px; }
.switch.small input:checked + .slider::before { transform: translateX(15px); }
.server-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--dsr-bg-2); border: 1px solid var(--dsr-line); border-radius: 10px;
  padding: 8px 10px;
}
.server-row.active { border-color: var(--dsr-info-line); background: var(--dsr-info-soft); }
.server-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.server-note { font-size: 13px; word-break: break-all; }
.server-url { flex: 1; min-width: 0; font-size: 11.5px; color: var(--dsr-muted); word-break: break-all; }
.server-badge {
  flex-shrink: 0; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--dsr-accent-soft); color: var(--dsr-accent-strong);
  border: 1px solid var(--dsr-accent-line); white-space: nowrap;
}
.server-badge.good { background: var(--dsr-success-soft); color: var(--dsr-success); border-color: var(--dsr-success-line); }
.server-badge.bad { background: var(--dsr-warning-soft); color: var(--dsr-warning); border-color: var(--dsr-warning-line); }
.server-edit, .server-del {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-muted); font-size: 12px;
}
.server-edit:active { color: var(--dsr-accent-strong); }
.server-del:active { color: var(--dsr-error); }
.server-add { display: flex; gap: 8px; padding: 0 14px 13px; }
.server-add input {
  flex: 1; min-width: 0; background: var(--dsr-bg-2); color: var(--dsr-text);
  border: 1px solid var(--dsr-line); border-radius: 10px; padding: 8px 10px;
  font: inherit; font-size: 13px; outline: none;
}
.server-add input:focus { border-color: var(--dsr-accent-line); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 999px; background: var(--dsr-panel-2);
  border: 1px solid var(--dsr-line); transition: .2s;
}
.slider::before {
  content: ''; position: absolute; width: 19px; height: 19px; border-radius: 50%;
  left: 3px; top: 3px; background: var(--dsr-muted); transition: .2s;
}
.switch input:checked + .slider { background: var(--dsr-accent-soft); border-color: var(--dsr-accent); }
.switch input:checked + .slider::before { transform: translateX(19px); background: var(--dsr-accent); }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; background: var(--dsr-nav-bg); backdrop-filter: blur(12px);
  border-top: 1px solid var(--dsr-line);
  padding-bottom: var(--dsr-safe-b);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px; color: var(--dsr-nav-muted); font-size: 11px; position: relative;
}
.nav-btn .nav-ico { font-size: 19px; line-height: 1; }
.nav-btn.active { color: var(--dsr-nav-active); }
.nav-badge {
  position: absolute; top: 4px; left: calc(50% + 10px);
  background: var(--dsr-nav-badge-bg); color: var(--dsr-nav-badge-text); border-radius: 999px;
  font-size: 10px; font-weight: 800; padding: 0 6px; line-height: 16px;
}

/* ---------- 反馈底部菜单 ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: var(--dsr-overlay);
  animation: sheet-fade .18s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
  max-height: 72vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--dsr-bg-2); border-top: 1px solid var(--dsr-line); border-radius: 20px 20px 0 0;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 34px var(--dsr-shadow);
  animation: sheet-up .22s cubic-bezier(.2,.8,.3,1);
}
.sheet-handle { width: 38px; height: 4px; border-radius: 999px; background: var(--dsr-line); margin: 2px auto 10px; }
.sheet-title { font-size: 14px; font-weight: 700; padding: 0 6px 8px; }
.sheet-item {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 13px; border: none; background: transparent; color: var(--dsr-text);
  font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.sheet-item:hover, .sheet-item:focus-visible { background: var(--dsr-bg); outline: none; }
.sheet-item.primary { background: var(--dsr-accent-soft); border: 1px solid var(--dsr-accent-line); }
.sheet-item.primary:hover { background: var(--dsr-accent-soft); filter: brightness(1.03); }
.sheet-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-accent-strong);
}
.sheet-item.primary .sheet-ico { background: var(--dsr-accent-strong); border-color: var(--dsr-accent-strong); color: var(--dsr-on-accent); }
.sheet-ico svg { width: 18px; height: 18px; fill: currentColor; }
.sheet-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-item-name { font-size: 14px; font-weight: 600; }
.sheet-item-desc { font-size: 12px; color: var(--dsr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes sheet-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6 } to { transform: translateY(0); opacity: 1 } }

/* 写反馈弹层 */
.fb-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fb-chip {
  min-height: 36px; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line); color: var(--dsr-text); cursor: pointer;
}
.fb-chip.current { background: var(--dsr-accent-soft); border-color: var(--dsr-accent-line); color: var(--dsr-accent-strong); font-weight: 600; }
.fb-textarea, .fb-input {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  background: var(--dsr-panel); color: var(--dsr-text); border: 1px solid var(--dsr-line); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 14px; outline: none; resize: vertical;
}
.fb-textarea:focus, .fb-input:focus { border-color: var(--dsr-accent-line); }
.fb-input { min-height: 42px; }

/* ---------- 模态 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: var(--dsr-overlay); backdrop-filter: blur(3px); padding: 18px;
}
.modal-card {
  width: 100%; max-width: 460px; max-height: 82vh; overflow-y: auto;
  background: var(--dsr-bg-2); border: 1px solid var(--dsr-line); border-radius: 18px;
  padding: 16px;
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal-body { font-size: 14px; }
.modal-body .q-item { background: var(--dsr-panel); border: 1px solid var(--dsr-line); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; }
.modal-body .q-text { font-weight: 600; margin-bottom: 8px; }
.modal-body .q-option {
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 6px; border-radius: 8px;
}
.modal-body input[type='radio'], .modal-body input[type='checkbox'] { accent-color: var(--dsr-accent); margin-top: 3px; }
.modal-body textarea {
  width: 100%; margin-top: 8px; background: var(--dsr-panel); color: var(--dsr-text);
  border: 1px solid var(--dsr-line); border-radius: 10px; padding: 9px 11px; font: inherit; outline: none;
}
.modal-actions { display: flex; gap: 9px; margin-top: 14px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; }
.kv .k { color: var(--dsr-muted); } .kv .v { word-break: break-all; text-align: right; }

/* ---------- 皮肤选择面板 ---------- */
.theme-swatch-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  margin-right: 5px; vertical-align: -1px; background: var(--dsr-bg);
  border: 1px solid rgba(127, 127, 127, .35); flex-shrink: 0;
}
@media (max-width: 720px) {
  #btn-theme .t-label { display: none; }
  #btn-theme .theme-swatch-dot { margin-right: 0; }
}
.theme-panel-list { display: flex; flex-direction: column; gap: 8px; }
.theme-option {
  display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%;
  padding: 11px 12px; border-radius: 12px; text-align: left;
  background: var(--dsr-panel); border: 1px solid var(--dsr-line);
  white-space: nowrap;
}
.theme-option:active { background: var(--dsr-panel-2); }
.theme-option.current { border-color: var(--dsr-accent-line); box-shadow: 0 0 0 1px var(--dsr-accent-soft); }
.theme-swatches { display: inline-flex; gap: 4px; flex-shrink: 0; }
.theme-swatches i {
  width: 14px; height: 14px; border-radius: 50%; display: block;
  border: 1px solid rgba(127, 127, 127, .35);
}
.theme-option .theme-name {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-option .theme-check { flex-shrink: 0; color: var(--dsr-accent-strong); font-size: 14px; font-weight: 700; }

/* ---------- toast ---------- */
.toast {
  position: fixed; top: calc(58px + var(--dsr-safe-top)); left: 50%; transform: translateX(-50%);
  z-index: 60; background: var(--dsr-panel-2); border: 1px solid var(--dsr-line);
  color: var(--dsr-text); padding: 9px 16px; border-radius: 999px; font-size: 13px;
  max-width: 88vw; box-shadow: 0 6px 24px var(--dsr-shadow);
}
.toast.err { border-color: var(--dsr-error-line); color: var(--dsr-error); }
.toast.ok { border-color: var(--dsr-success-line); color: var(--dsr-success); }

@media (min-width: 560px) {
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .msg { max-width: 78%; }
}
