:root {
  --bg: #ffffff;
  --bg-2: #f5f5f5;
  --bg-3: #ededed;
  --border: #e4e4e4;
  --text: #111111;
  --muted: #8c8c8c;
  --accent: #111111;
  --green: #111111;
  --red: #111111;
  --orange: #6b6b6b;
  --mono: 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 启动 loading 壳 ── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  width: min(520px, 92vw);
  padding: 28px 30px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.loading-title { font-size: 17px; font-weight: 600; }
.loading-sub { color: var(--muted); font-size: 13px; }
.loading-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
}
.loading-logs {
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── 顶栏 ── */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.brand { font-weight: 600; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 8px; }
.top-status { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.muted { color: var(--muted); }
.sep { width: 1px; height: 14px; background: var(--border); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; transition: background-color .18s ease, box-shadow .18s ease; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px rgba(17, 17, 17, .08); }
.dot-off { background: transparent; box-shadow: inset 0 0 0 1px var(--red); }
.dot-wait { background: var(--orange); }

/* ── 标签页 ── */
#tabs {
  display: flex;
  gap: 4px;
  padding: 6px 18px 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── 布局 ── */
#layout { flex: 1; display: flex; min-height: 0; }
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }

.list-pane {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-2);
}
.list-head { padding: 10px 14px; font-size: 11px; border-bottom: 1px solid var(--border); }

.detail-pane { flex: 1; overflow-y: auto; padding: 18px 22px; }
.empty-hint { color: var(--muted); text-align: center; margin-top: 40vh; }

/* ── 会话列表 ── */
.session-item, .chat-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .18s ease;
}
.session-item:hover, .chat-item:hover { background: var(--bg-3); }
.session-item.selected, .chat-item.selected { background: var(--bg-3); border-left: 3px solid var(--accent); padding-left: 11px; }
.session-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.session-chat { font-weight: 600; font-size: 13px; }
.session-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.session-trigger { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--muted); align-items: center; }

.status-badge { font-size: 11px; padding: 1px 7px; border-radius: 9px; }
/* 灰度语义：成功=实心黑；进行中=中灰实心；错误=黑描边空心；中止=灰斜纹；未回复=浅灰底 */
.status-done { background: var(--green); color: #fff; }
.status-noreply { background: var(--bg-3); color: var(--orange); }
.status-running { background: var(--orange); color: #fff; }
.status-error { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.status-aborted { background: repeating-linear-gradient(45deg, var(--bg-3) 0 4px, var(--bg) 4px 8px); color: var(--text); }

/* ── 会话详情 ── */
.detail-header { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.detail-header h2 { font-size: 16px; margin-bottom: 6px; }
.detail-header .sub { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }

.collapsible { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; background: var(--bg-2); }
.collapsible > summary {
  cursor: pointer; padding: 9px 14px; color: var(--muted); font-size: 12px; user-select: none;
  list-style: none;
}
.collapsible > summary::before { content: '▸ '; }
.collapsible[open] > summary::before { content: '▾ '; }
.collapsible .coll-body { padding: 4px 14px 12px; white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; color: var(--text); line-height: 1.65; max-height: 300px; overflow-y: auto; }

.msg-flow { display: flex; flex-direction: column; gap: 10px; }

.bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  line-height: 1.6;
  word-break: break-word;
}
.bubble-user { align-self: flex-start; background: var(--bg-3); border: 1px solid var(--border); white-space: pre-wrap; }
.bubble-assistant { align-self: flex-end; background: var(--bg); border: 1px solid var(--text); }
.bubble-assistant .asr-label { color: var(--muted); font-size: 11px; margin-bottom: 4px; }

.tool-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  padding: 9px 13px;
  font-size: 12.5px;
}
.tool-card.tool-error { border-color: var(--red); }
.tool-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.tool-name { color: var(--orange); font-family: var(--mono); font-size: 12px; font-weight: 600; }
.tool-args { font-family: var(--mono); font-size: 11.5px; color: var(--text); white-space: pre-wrap; }
.tool-result { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 5px; white-space: pre-wrap; border-top: 1px dashed var(--border); padding-top: 5px; }
.tool-result.is-error { color: var(--red); font-weight: 600; }

.sent-badge {
  align-self: flex-end;
  background: var(--green);
  border: 1px solid var(--green);
  color: #fff;
  border-radius: 12px;
  padding: 7px 13px;
  font-size: 13px;
  line-height: 1.6;
}
.sent-badge .asr-label { color: rgba(255, 255, 255, .72); font-size: 11px; margin-bottom: 3px; }

.session-error {
  border: 1px solid var(--red); background: transparent;
  color: var(--red); border-radius: 8px; padding: 10px 14px; white-space: pre-wrap;
}

/* ── 存档 ── */
.chat-item-title { display: flex; justify-content: space-between; align-items: center; }
.unread-pill { background: var(--red); color: #fff; font-size: 11px; border-radius: 9px; padding: 0 7px; }
.chat-item-sub { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
#test-send-text {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12.5px;
  outline: none;
}
#test-send-text:focus { border-color: var(--accent); }

.archive-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.archive-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.archive-table .t { color: var(--muted); white-space: nowrap; font-family: var(--mono); font-size: 11.5px; }
.archive-table .w { white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.archive-table .w.self { color: var(--accent); }
.archive-table .unread td { background: var(--bg-2); }
.archive-table .text { word-break: break-word; white-space: pre-wrap; }

/* ── 设置 ── */
.settings-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  overflow-y: auto;
  padding: 14px 10px;
}
.settings-runstate {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.settings-runstate .rs-title { font-weight: 600; font-size: 13px; }
.settings-runstate .rs-row { display: flex; align-items: center; gap: 8px; }
.settings-runstate .rs-row .dot { width: 8px; height: 8px; }
.settings-menu { display: flex; flex-direction: column; gap: 2px; }
.settings-menu-item {
  background: none; border: none; text-align: left;
  color: var(--muted); padding: 8px 12px; border-radius: 7px;
  cursor: pointer; font-size: 13px; width: 100%;
  transition: background-color .18s ease, color .18s ease;
}
.settings-menu-item:hover { background: var(--bg-3); color: var(--text); }
.settings-menu-item.active { background: var(--bg-3); color: var(--accent); font-weight: 600; }

.settings-pane { flex: 1; max-width: 860px; margin: 0 auto; padding: 22px 26px 40px; overflow-y: auto; width: 100%; }
.settings-pane h3 { margin: 22px 0 12px; font-size: 14px; color: var(--accent); }
.settings-pane h3:first-child { margin-top: 0; }
.settings-divider { border: none; border-top: 1px dashed var(--border); margin: 22px 0; }
.persona-save-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.persona-role-text { min-height: 360px; font-size: 12.5px; line-height: 1.7; font-family: var(--mono); }
.model-rows-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.model-rows-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 400; padding: 4px 6px; }
.model-rows-table td { padding: 4px 6px; }
.model-rows-table input { width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 9px; font-size: 12.5px; outline: none; }
.model-rows-table input:focus { border-color: var(--accent); }

/* 模型选择/添加/删除 模态框 */
.model-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center;
}
.model-modal {
  width: 760px; max-width: 94vw; max-height: 82vh;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; padding: 16px; gap: 10px;
}
.model-modal.danger { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 12px 40px rgba(0, 0, 0, .12); }
.model-modal.danger .model-modal-head { color: var(--red); }
.model-modal-head { font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.model-modal-close { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; transition: color .18s ease; }
.model-modal-body { display: flex; gap: 12px; min-height: 260px; }
.model-modal-left { width: 200px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--border); padding-right: 8px; }
.model-modal-right { flex: 1; overflow-y: auto; }
.mm-prov { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--muted); }
.mm-prov:hover { background: var(--bg-3); color: var(--text); }
.mm-prov.active { background: var(--bg-3); color: var(--accent); font-weight: 600; }
.mm-model { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.mm-model:hover { background: var(--bg-3); }
.mm-model .mm-check { color: var(--accent); width: 16px; }
.mm-model .mm-del { margin-left: auto; border: 1px solid var(--red); color: var(--red); background: none; border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 11px; }
.mm-model .mm-del:hover { background: var(--bg-3); }
.model-modal-foot { display: flex; gap: 10px; justify-content: flex-end; }
.field-row { display: flex; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.field { flex: 1; min-width: 220px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select, .field textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
.field textarea { min-height: 84px; resize: vertical; font-family: inherit; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .9; color: #fff; }
.btn-small { padding: 3px 12px; font-size: 12px; }
.btn-danger { border-color: var(--red); color: var(--red); }

.save-bar { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }

/* ── 横幅（预算/连接提示） ── */
.banner {
  padding: 8px 18px;
  font-size: 13px;
  background: repeating-linear-gradient(45deg, var(--bg-3) 0 8px, var(--bg) 8px 16px);
  border-bottom: 1px solid var(--text);
  color: var(--text);
  flex-shrink: 0;
}
.banner a { color: var(--accent); }
.banner.hidden { display: none; }

/* ── 体检卡 ── */
.health-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.health-card.all-ok { border-color: var(--green); }
.health-card .h-title { font-weight: 600; margin-bottom: 10px; }
.health-card.all-ok .h-title { color: var(--green); }
.h-item { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; font-size: 13px; }
.h-item.ok { color: var(--green); font-weight: 600; }
.h-item.bad { color: var(--text); text-decoration: underline; }
.h-item.mute { color: var(--muted); }
.h-label { flex: 1; }
.health-card .btn-small { margin-left: 4px; }

/* ── 白名单选择弹窗 ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  width: 480px; max-height: 70vh;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; flex-direction: column;
  padding: 16px;
}
.modal-head { font-weight: 600; margin-bottom: 12px; }
.modal-list { overflow-y: auto; flex: 1; min-height: 120px; }
.pick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13px;
  transition: background-color .18s ease;
}
.pick-item:hover { background: var(--bg-3); }
.pick-item span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* ── SnowLuma 独立页签 ── */
.snowluma-pane { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.snowluma-page-card {
  max-width: 860px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-2); padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.snowluma-page-card h2 { font-size: 16px; }
.snowluma-state-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.snowluma-state-row .dot { width: 12px; height: 12px; }
.snowluma-logs-view {
  max-height: 420px; min-height: 260px;
  overflow-y: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  color: var(--muted); white-space: pre-wrap; word-break: break-all;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.snowluma-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── 滚动条贴边：列表/详情/设置面板都是块级容器，把滚动条放到容器最边缘而不是内容中间 */
#session-list, #chat-list, .detail-pane, .settings-pane, .snowluma-pane, .modal-list {
  scrollbar-gutter: stable;
}

/* ── 模型目录面板（替代下拉框） ── */
.model-pick { position: relative; flex: 1; }
.model-pick-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-2); color: var(--text); cursor: pointer; font-size: 13px;
  text-align: left;
}
.model-pick-btn:hover { border-color: var(--accent, #111111); }
.model-pick-btn .chev { margin-left: auto; opacity: .6; }
.model-pick-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-provider {
  font-size: 12px; opacity: .78; padding: 8px 8px 3px;
  display: flex; gap: 8px; align-items: baseline;
}
.mp-provider .mp-url { font-size: 11px; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mp-row:hover { background: var(--bg-3); }
.mp-row.current { background: var(--bg-3); }
.mp-row .mp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbadge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.vbadge.ok { color: #fff; border-color: var(--green); background: var(--green); }
.vbadge.no { color: var(--red); border-color: var(--red); background: transparent; }
.vbadge.unk { color: var(--text); opacity: .5; border-color: var(--border); }

/* ── 模型目录弹窗 ── */
.model-pick-btn {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-2); color: var(--text); cursor: pointer; font-size: 13px;
  text-align: left;
}
.model-pick-btn:hover { border-color: var(--accent, #111111); }
.model-pick-btn .chev { margin-left: auto; opacity: .6; font-size: 12px; }
.model-pick-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-provider {
  font-size: 12px; opacity: .78; padding: 8px 8px 3px;
  display: flex; gap: 8px; align-items: baseline;
}
.mp-provider .mp-url { font-size: 11px; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mp-row:hover { background: var(--bg-3); }
.mp-row.current { background: var(--bg-3); }
.mp-row .mp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbadge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.vbadge.ok { color: #fff; border-color: var(--green); background: var(--green); }
.vbadge.no { color: var(--red); border-color: var(--red); background: transparent; }
.vbadge.unk { color: var(--text); opacity: .5; border-color: var(--border); }

/* ── 两栏悬停下拉（左供应商 / 右模型） ── */
.model-dd-wrap { position: relative; flex: 1; }
.model-dd {
  position: absolute; z-index: 70; top: calc(100% + 6px); left: 0;
  width: 560px; max-width: 80vw; height: 340px;
  display: flex; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .10);
}
.model-dd-left {
  width: 220px; flex-shrink: 0; overflow-y: auto; padding: 5px;
  border-right: 1px solid var(--border);
}
.model-dd-right { flex: 1; overflow-y: auto; padding: 5px 6px; }
.mdd-prov {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mdd-prov:hover, .mdd-prov.active { background: var(--bg-3); }
.mdd-prov-name { font-weight: 500; }
.mdd-prov-meta { font-size: 11px; opacity: .6; }
.mp-provider {
  font-size: 11px; opacity: .72; padding: 7px 8px 4px;
  display: flex; gap: 8px; align-items: baseline;
}
.mp-provider .mp-url { font-size: 10px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.mp-row:hover { background: var(--bg-3); }
.mp-row.current { background: var(--bg-3); }
.mp-row .mp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbadge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.vbadge.ok { color: #fff; border-color: var(--green); background: var(--green); }
.vbadge.no { color: var(--red); border-color: var(--red); background: transparent; }
.vbadge.unk { color: var(--text); opacity: .5; border-color: var(--border); }

/* ── 全局：hidden 属性必须永远生效 ──
   作者样式里的 display（如 .model-dd { display:flex }）会压过浏览器对 [hidden] 的
   默认 display:none，导致元素"收不回去"（模型目录下拉两次踩同一个坑）。
   这条规则保证任何带 hidden 属性的元素一律不可见。 */
[hidden] { display: none !important; }

/* ── 窄屏兜底：仅 ≤860px 生效，桌面尺寸（1360×860）的布局完全不受影响 ──
   本块是文件中唯一允许改变排列方式的地方：两栏改纵向堆叠、顶栏状态项换行、
   并收掉所有可能撑出横向滚动条的固定宽度。 */
@media (max-width: 860px) {
  body { height: auto; min-height: 100vh; overflow-x: hidden; overflow-y: auto; }
  #topbar { flex-wrap: wrap; row-gap: 6px; }
  .top-status { flex-wrap: wrap; row-gap: 4px; }
  #tabs { flex-wrap: wrap; }
  .view.active { flex-direction: column; }
  .list-pane { width: 100%; max-height: 42vh; border-right-color: transparent; }
  .settings-sidebar { width: 100%; border-right-color: transparent; }
  .detail-pane { padding: 14px 14px 28px; }
  .settings-pane { padding: 16px 14px 32px; }
  .snowluma-pane { padding: 16px 14px 32px; }
  .empty-hint { margin-top: 14vh; }
  .modal { width: 94vw; }
  .model-dd { width: auto; max-width: calc(100vw - 28px); }
  .bubble { max-width: 92%; }
  .archive-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation: none !important; }
}
