/* LiveKit Agent 配置控制台 —— 多主题控制台 */
:root,
html[data-theme="dark"] {
  --bg: #080d1a;
  --bg-2: #0d1426;
  --bg-glow-1: rgba(79, 140, 255, .16);
  --bg-glow-2: rgba(53, 208, 186, .10);
  --panel: #111a2e;
  --panel-2: #16213a;
  --panel-bg-2: #0d1426;
  --line: #22304d;
  --line-soft: #1a2740;
  --text: #e8eeff;
  --muted: #8ea0c2;
  --muted-2: #66789a;
  --field-label: #c8d4ee;
  --accent: #4f8cff;
  --accent-2: #35d0ba;
  --danger: #ff6b7a;
  --warn: #ffc266;
  --ok: #3ddc97;
  --topbar-bg: rgba(8, 13, 26, .86);
  --sidebar-bg: rgba(10, 16, 31, .55);
  --meta-bg: rgba(17, 26, 46, .55);
  --pill-bg: rgba(22, 33, 58, .72);
  --stat-from: rgba(22, 33, 58, .85);
  --stat-to: rgba(17, 26, 46, .65);
  --stat-line: rgba(79, 140, 255, .45);
  --card-from: rgba(17, 26, 46, .92);
  --card-to: rgba(13, 20, 38, .88);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  --input-bg: rgba(8, 13, 26, .72);
  --input-hover: #2c3d60;
  --option-bg: #111a2e;
  --select-arrow: #7c8fb2;
  --placeholder: #536583;
  --icon-bg: rgba(22, 33, 58, .7);
  --icon-hover-bg: rgba(30, 44, 74, .8);
  --icon-hover-border: #33476d;
  --switch-track: #24324e;
  --switch-border: #2e3f60;
  --switch-knob: #8ea0c2;
  --switch-on-bg: rgba(53, 208, 186, .28);
  --switch-on-border: rgba(53, 208, 186, .6);
  --switch-on-glow: rgba(53, 208, 186, .6);
  --validation-error-border: rgba(255, 107, 122, .38);
  --validation-error-bg: rgba(255, 107, 122, .07);
  --validation-error-text: #ffd3d8;
  --validation-warn-border: rgba(255, 194, 102, .38);
  --validation-warn-bg: rgba(255, 194, 102, .07);
  --validation-warn-text: #ffe3b0;
  --btn-bg: rgba(22, 33, 58, .8);
  --btn-text: #c6d3ec;
  --btn-hover-bg: rgba(32, 46, 78, .9);
  --btn-hover-border: #35496f;
  --btn-hover-text: #fff;
  --primary-border: rgba(79, 140, 255, .55);
  --primary-from: #4f8cff;
  --primary-to: #3a72db;
  --primary-hover-from: #6099ff;
  --primary-hover-to: #447ee8;
  --primary-shadow: 0 6px 18px rgba(79, 140, 255, .22);
  --primary-text: #fff;
  --danger-border: rgba(255, 107, 122, .35);
  --danger-text: #ffb3bb;
  --danger-hover-bg: rgba(255, 107, 122, .12);
  --danger-hover-border: rgba(255, 107, 122, .6);
  --danger-hover-text: #fff;
  --spinner-border: rgba(255, 255, 255, .35);
  --spinner-top: #fff;
  --console-bg: rgba(9, 14, 27, .96);
  --console-text: #b9c8e6;
  --actionbar-bg: rgba(8, 13, 26, .93);
  --toast-bg: rgba(17, 26, 46, .98);
  --toast-text: #dbe5f8;
  --scrollbar: #263553;
  --scrollbar-hover: #33476d;
  --selection: rgba(79, 140, 255, .35);
  --accent-soft: rgba(79, 140, 255, .08);
  --accent-active-from: rgba(79, 140, 255, .20);
  --accent-active-to: rgba(79, 140, 255, .06);
  --accent-border: rgba(79, 140, 255, .32);
  --accent-ring: rgba(79, 140, 255, .16);
  --accent-focus: rgba(79, 140, 255, .75);
  --logo-bg: linear-gradient(145deg, rgba(79, 140, 255, .28), rgba(53, 208, 186, .20));
  --logo-border: rgba(79, 140, 255, .45);
  --logo-highlight: rgba(255, 255, 255, .10);
  --accent-2-soft: rgba(53, 208, 186, .06);
  --accent-2-border: rgba(53, 208, 186, .55);
  --dot-off: #5b6b88;
  --dot-muted-ring: rgba(102, 120, 154, .12);
  --dot-ok-ring: rgba(61, 220, 151, .16);
  --dot-ok-glow: rgba(61, 220, 151, .45);
  --dot-warn-ring: rgba(255, 194, 102, .15);
  --dot-err-ring: rgba(255, 107, 122, .16);
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-2: #edf2f9;
  --bg-glow-1: rgba(37, 99, 235, .10);
  --bg-glow-2: rgba(13, 148, 136, .08);
  --panel: #ffffff;
  --panel-2: #f0f4fa;
  --panel-bg-2: #f9fbfe;
  --line: #d6deeb;
  --line-soft: #e6ebf3;
  --text: #172033;
  --muted: #4d5d78;
  --muted-2: #71809a;
  --field-label: #2b3a55;
  --accent: #2563eb;
  --accent-2: #0d9488;
  --danger: #dc2626;
  --warn: #b45309;
  --ok: #059669;
  --topbar-bg: rgba(255, 255, 255, .88);
  --sidebar-bg: rgba(255, 255, 255, .72);
  --meta-bg: rgba(255, 255, 255, .76);
  --pill-bg: rgba(240, 244, 250, .90);
  --stat-from: rgba(255, 255, 255, .98);
  --stat-to: rgba(244, 247, 251, .94);
  --stat-line: rgba(37, 99, 235, .32);
  --card-from: rgba(255, 255, 255, .98);
  --card-to: rgba(249, 251, 254, .98);
  --card-shadow: 0 10px 28px rgba(31, 55, 102, .08);
  --input-bg: #ffffff;
  --input-hover: #b8c5da;
  --option-bg: #ffffff;
  --select-arrow: #64748b;
  --placeholder: #9aa7bd;
  --icon-bg: #f5f8fc;
  --icon-hover-bg: #eaf1fb;
  --icon-hover-border: #9fb2cc;
  --switch-track: #dce5f1;
  --switch-border: #c7d3e4;
  --switch-knob: #8293ad;
  --switch-on-bg: rgba(13, 148, 136, .18);
  --switch-on-border: rgba(13, 148, 136, .55);
  --switch-on-glow: rgba(13, 148, 136, .35);
  --validation-error-border: rgba(220, 38, 38, .30);
  --validation-error-bg: rgba(220, 38, 38, .06);
  --validation-error-text: #9f1239;
  --validation-warn-border: rgba(180, 83, 9, .30);
  --validation-warn-bg: rgba(180, 83, 9, .07);
  --validation-warn-text: #92400e;
  --btn-bg: #ffffff;
  --btn-text: #334155;
  --btn-hover-bg: #f1f5fb;
  --btn-hover-border: #b8c5da;
  --btn-hover-text: #0f172a;
  --primary-border: #1d4ed8;
  --primary-from: #2563eb;
  --primary-to: #1d4ed8;
  --primary-hover-from: #3b82f6;
  --primary-hover-to: #2563eb;
  --primary-shadow: 0 6px 18px rgba(37, 99, 235, .20);
  --primary-text: #fff;
  --danger-border: rgba(220, 38, 38, .32);
  --danger-text: #b91c1c;
  --danger-hover-bg: rgba(220, 38, 38, .08);
  --danger-hover-border: rgba(220, 38, 38, .55);
  --danger-hover-text: #991b1b;
  --spinner-border: rgba(255, 255, 255, .45);
  --spinner-top: #fff;
  --console-bg: rgba(255, 255, 255, .97);
  --console-text: #334155;
  --actionbar-bg: rgba(255, 255, 255, .93);
  --toast-bg: rgba(255, 255, 255, .99);
  --toast-text: #1e293b;
  --scrollbar: #c4cede;
  --scrollbar-hover: #9dabc1;
  --selection: rgba(37, 99, 235, .20);
  --accent-soft: rgba(37, 99, 235, .07);
  --accent-active-from: rgba(37, 99, 235, .14);
  --accent-active-to: rgba(37, 99, 235, .04);
  --accent-border: rgba(37, 99, 235, .28);
  --accent-ring: rgba(37, 99, 235, .15);
  --accent-focus: rgba(37, 99, 235, .65);
  --logo-bg: linear-gradient(145deg, rgba(37, 99, 235, .14), rgba(13, 148, 136, .10));
  --logo-border: rgba(37, 99, 235, .32);
  --logo-highlight: rgba(255, 255, 255, .80);
  --accent-2-soft: rgba(13, 148, 136, .06);
  --accent-2-border: rgba(13, 148, 136, .50);
  --dot-off: #94a3b8;
  --dot-muted-ring: rgba(100, 116, 139, .12);
  --dot-ok-ring: rgba(5, 150, 105, .16);
  --dot-ok-glow: rgba(5, 150, 105, .25);
  --dot-warn-ring: rgba(180, 83, 9, .15);
  --dot-err-ring: rgba(220, 38, 38, .15);
  --shadow: 0 18px 50px rgba(31, 55, 102, .14);
  color-scheme: light;
}

html[data-theme="warm"] {
  --bg: #f6f1e7;
  --bg-2: #efe8da;
  --bg-glow-1: rgba(180, 83, 9, .10);
  --bg-glow-2: rgba(15, 118, 110, .07);
  --panel: #fffdf8;
  --panel-2: #f7f1e5;
  --panel-bg-2: #fbf6ec;
  --line: #ded2bd;
  --line-soft: #ebe2d2;
  --text: #302b23;
  --muted: #6f6556;
  --muted-2: #8c806d;
  --field-label: #4a3f31;
  --accent: #b45309;
  --accent-2: #0f766e;
  --danger: #b91c1c;
  --warn: #a16207;
  --ok: #15803d;
  --topbar-bg: rgba(255, 253, 248, .90);
  --sidebar-bg: rgba(255, 253, 248, .72);
  --meta-bg: rgba(255, 253, 248, .80);
  --pill-bg: rgba(247, 241, 229, .90);
  --stat-from: rgba(255, 253, 248, .98);
  --stat-to: rgba(247, 241, 229, .94);
  --stat-line: rgba(180, 83, 9, .35);
  --card-from: rgba(255, 253, 248, .98);
  --card-to: rgba(251, 246, 236, .98);
  --card-shadow: 0 10px 28px rgba(80, 60, 35, .10);
  --input-bg: #fffdf9;
  --input-hover: #c8b99f;
  --option-bg: #fffdf9;
  --select-arrow: #8c806d;
  --placeholder: #a99c87;
  --icon-bg: #fbf6ec;
  --icon-hover-bg: #f3ebdd;
  --icon-hover-border: #c8b99f;
  --switch-track: #e4d8c4;
  --switch-border: #d6c9b5;
  --switch-knob: #8c806d;
  --switch-on-bg: rgba(15, 118, 110, .18);
  --switch-on-border: rgba(15, 118, 110, .55);
  --switch-on-glow: rgba(15, 118, 110, .35);
  --validation-error-border: rgba(185, 28, 28, .30);
  --validation-error-bg: rgba(185, 28, 28, .06);
  --validation-error-text: #991b1b;
  --validation-warn-border: rgba(161, 98, 7, .32);
  --validation-warn-bg: rgba(161, 98, 7, .07);
  --validation-warn-text: #854d0e;
  --btn-bg: #fffdf9;
  --btn-text: #5c4f3d;
  --btn-hover-bg: #f7f0e4;
  --btn-hover-border: #c8b99f;
  --btn-hover-text: #302b23;
  --primary-border: #9a4a08;
  --primary-from: #b45309;
  --primary-to: #92400e;
  --primary-hover-from: #c2610d;
  --primary-hover-to: #a34b08;
  --primary-shadow: 0 6px 18px rgba(180, 83, 9, .20);
  --primary-text: #fff;
  --danger-border: rgba(185, 28, 28, .32);
  --danger-text: #b91c1c;
  --danger-hover-bg: rgba(185, 28, 28, .08);
  --danger-hover-border: rgba(185, 28, 28, .55);
  --danger-hover-text: #991b1b;
  --spinner-border: rgba(255, 255, 255, .45);
  --spinner-top: #fff;
  --console-bg: rgba(255, 253, 248, .97);
  --console-text: #4a3f31;
  --actionbar-bg: rgba(255, 253, 248, .94);
  --toast-bg: rgba(255, 253, 248, .99);
  --toast-text: #302b23;
  --scrollbar: #d6c9b5;
  --scrollbar-hover: #b9a98e;
  --selection: rgba(180, 83, 9, .20);
  --accent-soft: rgba(180, 83, 9, .07);
  --accent-active-from: rgba(180, 83, 9, .14);
  --accent-active-to: rgba(180, 83, 9, .04);
  --accent-border: rgba(180, 83, 9, .28);
  --accent-ring: rgba(180, 83, 9, .15);
  --accent-focus: rgba(180, 83, 9, .65);
  --logo-bg: linear-gradient(145deg, rgba(180, 83, 9, .14), rgba(15, 118, 110, .10));
  --logo-border: rgba(180, 83, 9, .32);
  --logo-highlight: rgba(255, 255, 255, .80);
  --accent-2-soft: rgba(15, 118, 110, .06);
  --accent-2-border: rgba(15, 118, 110, .50);
  --dot-off: #a99c87;
  --dot-muted-ring: rgba(111, 101, 86, .12);
  --dot-ok-ring: rgba(21, 128, 61, .16);
  --dot-ok-glow: rgba(21, 128, 61, .25);
  --dot-warn-ring: rgba(161, 98, 7, .15);
  --dot-err-ring: rgba(185, 28, 28, .15);
  --shadow: 0 18px 50px rgba(80, 60, 35, .16);
  color-scheme: light;
}

html[data-theme="contrast"] {
  --bg: #000000;
  --bg-2: #050505;
  --bg-glow-1: rgba(0, 229, 255, .08);
  --bg-glow-2: rgba(0, 255, 157, .05);
  --panel: #0a0a0a;
  --panel-2: #111111;
  --panel-bg-2: #050505;
  --line: #4d4d4d;
  --line-soft: #333333;
  --text: #ffffff;
  --muted: #d4d4d4;
  --muted-2: #b0b0b0;
  --field-label: #ffffff;
  --accent: #00e5ff;
  --accent-2: #00ff9d;
  --danger: #ff4d6d;
  --warn: #ffd400;
  --ok: #00ff85;
  --topbar-bg: rgba(0, 0, 0, .95);
  --sidebar-bg: #050505;
  --meta-bg: #0a0a0a;
  --pill-bg: #111111;
  --stat-from: #0d0d0d;
  --stat-to: #050505;
  --stat-line: rgba(0, 229, 255, .70);
  --card-from: #0d0d0d;
  --card-to: #050505;
  --card-shadow: 0 0 0 1px rgba(255, 255, 255, .05);
  --input-bg: #000000;
  --input-hover: #777777;
  --option-bg: #000000;
  --select-arrow: #ffffff;
  --placeholder: #8a8a8a;
  --icon-bg: #0d0d0d;
  --icon-hover-bg: #1a1a1a;
  --icon-hover-border: #00e5ff;
  --switch-track: #222222;
  --switch-border: #555555;
  --switch-knob: #cccccc;
  --switch-on-bg: rgba(0, 255, 157, .25);
  --switch-on-border: #00ff9d;
  --switch-on-glow: rgba(0, 255, 157, .80);
  --validation-error-border: rgba(255, 77, 109, .65);
  --validation-error-bg: rgba(255, 77, 109, .12);
  --validation-error-text: #ffb3c1;
  --validation-warn-border: rgba(255, 212, 0, .65);
  --validation-warn-bg: rgba(255, 212, 0, .10);
  --validation-warn-text: #ffe680;
  --btn-bg: #0d0d0d;
  --btn-text: #ffffff;
  --btn-hover-bg: #1a1a1a;
  --btn-hover-border: #00e5ff;
  --btn-hover-text: #ffffff;
  --primary-border: #00e5ff;
  --primary-from: #00e5ff;
  --primary-to: #00b8cc;
  --primary-hover-from: #5cf2ff;
  --primary-hover-to: #00d5eb;
  --primary-shadow: 0 6px 18px rgba(0, 229, 255, .22);
  --primary-text: #001014;
  --danger-border: rgba(255, 77, 109, .65);
  --danger-text: #ff8fa3;
  --danger-hover-bg: rgba(255, 77, 109, .16);
  --danger-hover-border: #ff4d6d;
  --danger-hover-text: #ffffff;
  --spinner-border: rgba(255, 255, 255, .40);
  --spinner-top: #ffffff;
  --console-bg: #050505;
  --console-text: #e8e8e8;
  --actionbar-bg: rgba(0, 0, 0, .95);
  --toast-bg: #0d0d0d;
  --toast-text: #ffffff;
  --scrollbar: #444444;
  --scrollbar-hover: #666666;
  --selection: rgba(0, 229, 255, .35);
  --accent-soft: rgba(0, 229, 255, .08);
  --accent-active-from: rgba(0, 229, 255, .20);
  --accent-active-to: rgba(0, 229, 255, .05);
  --accent-border: rgba(0, 229, 255, .55);
  --accent-ring: rgba(0, 229, 255, .20);
  --accent-focus: rgba(0, 229, 255, .85);
  --logo-bg: linear-gradient(145deg, rgba(0, 229, 255, .18), rgba(0, 255, 157, .12));
  --logo-border: rgba(0, 229, 255, .65);
  --logo-highlight: rgba(255, 255, 255, .16);
  --accent-2-soft: rgba(0, 255, 157, .06);
  --accent-2-border: rgba(0, 255, 157, .60);
  --dot-off: #777777;
  --dot-muted-ring: rgba(255, 255, 255, .10);
  --dot-ok-ring: rgba(0, 255, 133, .20);
  --dot-ok-glow: rgba(0, 255, 133, .65);
  --dot-warn-ring: rgba(255, 212, 0, .20);
  --dot-err-ring: rgba(255, 77, 109, .20);
  --shadow: 0 18px 50px rgba(0, 0, 0, .65);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, var(--bg-glow-2), transparent 55%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
::selection { background: var(--selection); }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 66px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.logo {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  font-size: 19px;
  background: var(--logo-bg);
  border: 1px solid var(--logo-border);
  box-shadow: inset 0 1px 0 var(--logo-highlight);
}
.brand-title { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.brand-sub {
  margin-top: 3px;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--muted-2);
  font-family: var(--mono);
}
.statusbar { display: flex; flex: 1; flex-wrap: wrap; gap: 8px; justify-content: center; }
.topactions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.theme-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--btn-bg);
  color: var(--muted);
  cursor: pointer;
  transition: .15s ease;
}
.theme-picker:hover { border-color: var(--btn-hover-border); background: var(--btn-hover-bg); }
.theme-picker:focus-within {
  border-color: var(--accent-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.theme-glyph { color: var(--accent); font-size: 14px; line-height: 1; }
.theme-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.theme-select {
  appearance: none;
  height: 28px;
  margin: 0;
  padding: 0 18px 0 2px;
  border: 0;
  outline: none;
  background-color: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--select-arrow) 50%),
    linear-gradient(135deg, var(--select-arrow) 50%, transparent 50%);
  background-position: calc(100% - 9px) 12px, calc(100% - 4px) 12px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.theme-select option { background: var(--option-bg); color: var(--text); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.pill strong { color: var(--text); font-weight: 600; }
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px var(--dot-muted-ring);
  flex: 0 0 auto;
}
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--dot-ok-ring), 0 0 10px var(--dot-ok-glow); }
.dot.off { background: var(--dot-off); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--dot-warn-ring); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--dot-err-ring); }

/* ---------- 布局 ---------- */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 66px); }
.sidebar {
  position: sticky;
  top: 66px;
  flex: 0 0 272px;
  width: 272px;
  height: calc(100vh - 66px);
  padding: 18px 14px 120px;
  overflow-y: auto;
  border-right: 1px solid var(--line-soft);
  background: var(--sidebar-bg);
}
.side-block { margin-bottom: 22px; }
.side-title {
  margin: 0 0 9px 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: .16s ease;
}
.nav button:hover { background: var(--accent-soft); color: var(--text); }
.nav button:focus-visible { outline: 2px solid var(--accent-focus); outline-offset: 2px; }
.nav button.active {
  position: relative;
  background: linear-gradient(90deg, var(--accent-active-from), var(--accent-active-to));
  border-color: var(--accent-border);
  color: var(--text);
}
.nav button.active::before {
  content: '';
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav .nav-icon { width: 18px; text-align: center; }
.nav .nav-title { flex: 1; font-size: 13px; }
.nav .nav-count { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }

.presets { display: flex; flex-direction: column; gap: 6px; }
.presets button {
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12.5px;
  transition: .16s ease;
}
.presets button:hover { border-color: var(--accent-2-border); color: var(--text); background: var(--accent-2-soft); }

.meta {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--meta-bg);
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.7;
  word-break: break-all;
}
.meta b { color: var(--muted); font-weight: 600; }
.meta .meta-row { display: flex; gap: 8px; }
.meta .meta-row span:first-child { flex: 0 0 62px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 26px 0; }

/* ---------- 概览 ---------- */
.overview { margin-bottom: 20px; }
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.stat {
  position: relative;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--stat-from), var(--stat-to));
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--stat-line), transparent);
}
.stat-label { font-size: 11.5px; color: var(--muted-2); letter-spacing: .06em; }
.stat-value { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; }
.stat-value small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.stat-sub { margin-top: 6px; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

/* ---------- 服务器资源 ---------- */
.app.system-view .pipeline-presets,
.app.system-view .actionbar,
.app.system-view .console-panel,
.app.system-view #btn-save-top { display: none !important; }
.system-panel { padding: 22px 26px 56px; }
.system-panel[hidden] { display: none !important; }
.system-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.system-kicker {
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
}
.system-head h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: 0; }
.system-sub { margin: 7px 0 0; color: var(--muted-2); font-size: 12px; line-height: 1.6; }
.system-head-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.system-updated { color: var(--muted-2); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.system-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--validation-error-border);
  border-radius: 10px;
  background: var(--validation-error-bg);
  color: var(--validation-error-text);
  font-size: 12.5px;
}
.system-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.system-metric {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: linear-gradient(160deg, var(--stat-from), var(--stat-to));
}
.system-metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.system-metric-label { color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .04em; }
.system-metric-chip { color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; }
.system-metric-value { margin-top: 9px; color: var(--text); font-size: 23px; font-weight: 700; line-height: 1; }
.system-metric-value small { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }
.system-metric-detail { margin-top: 8px; min-height: 32px; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.meter { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: var(--switch-track); }
.meter-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.meter-fill.ok { background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.danger { background: var(--danger); }
.system-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 14px;
  align-items: start;
}
.system-section {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
  overflow: hidden;
}
.system-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.system-section-head h2 { margin: 0; font-size: 13.5px; }
.system-section-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.system-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.system-badge.warn { border-color: var(--validation-warn-border); background: var(--validation-warn-bg); color: var(--warn); }
.storage-table-wrap { overflow-x: auto; }
.storage-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.storage-table th {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: left;
}
.storage-table th:nth-child(1) { width: 29%; }
.storage-table th:nth-child(2) { width: 51%; }
.storage-table th:nth-child(3) { width: 20%; text-align: right; }
.storage-table td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.storage-table tr:last-child td { border-bottom: 0; }
.storage-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.storage-name strong { color: var(--text); font-size: 12px; font-weight: 650; }
.storage-name span { color: var(--muted-2); font-size: 10px; }
.storage-path {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.storage-size { text-align: right; }
.storage-size strong { color: var(--text); font-family: var(--mono); font-size: 11.5px; }
.storage-size .meter { margin-top: 6px; }
.storage-empty, .cleanup-empty { padding: 24px 16px; color: var(--muted-2); font-size: 12px; text-align: center; }
.cleanup-list { max-height: 410px; overflow-y: auto; }
.cleanup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.cleanup-item:last-child { border-bottom: 0; }
.cleanup-item strong { min-width: 0; color: var(--text); font-size: 11.5px; font-weight: 600; }
.cleanup-item code {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cleanup-item span { color: var(--warn); font-family: var(--mono); font-size: 10.5px; }
.cleanup-footer { padding: 13px 16px 15px; border-top: 1px solid var(--line-soft); }
.cleanup-note { margin-bottom: 10px; color: var(--muted-2); font-size: 10.5px; line-height: 1.55; }
.cleanup-footer .btn { width: 100%; justify-content: center; }
.system-footnote { margin-top: 13px; color: var(--muted-2); font-size: 10.5px; line-height: 1.6; }

/* ---------- 菜单管理 ---------- */
.app.menu-view .pipeline-presets,
.app.menu-view .actionbar,
.app.menu-view .console-panel,
.app.menu-view #btn-save-top,
.app.knowledge-view .pipeline-presets,
.app.knowledge-view .actionbar,
.app.knowledge-view .console-panel,
.app.knowledge-view #btn-save-top { display: none !important; }
.menu-panel { min-width: 0; padding: 22px 26px 48px; }
.menu-panel[hidden] { display: none !important; }
.menu-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.menu-head h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: 0; }
.menu-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 0 0 auto; }
.menu-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}
.menu-search, .menu-filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.menu-search { flex: 1 1 360px; }
.menu-filter { flex: 0 1 230px; }
.menu-search > span, .menu-filter > span {
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .05em;
}
.menu-search input, .menu-filter select {
  height: 36px;
  min-width: 0;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.menu-search input::placeholder { color: var(--placeholder); }
.menu-search input:focus, .menu-filter select:focus {
  border-color: var(--accent-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.menu-filter select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--select-arrow) 50%),
    linear-gradient(135deg, var(--select-arrow) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.menu-filter select option { background: var(--option-bg); color: var(--text); }
.menu-toolbar > .system-badge { margin-left: auto; margin-bottom: 9px; }
.menu-table-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 320px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
  overscroll-behavior: contain;
}
.menu-table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.menu-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--option-bg);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .06em;
  text-align: left;
}
.menu-table th:nth-child(1) { width: 18%; }
.menu-table th:nth-child(2) { width: 9%; }
.menu-table th:nth-child(3) { width: 48%; }
.menu-table th:nth-child(4) { width: 12%; }
.menu-table th:nth-child(5) { width: 13%; }
.menu-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.menu-table tbody tr:last-child td { border-bottom: 0; }
.menu-table tbody tr { transition: background .13s ease; }
.menu-table tbody tr:hover { background: var(--accent-soft); }
.menu-input {
  width: 100%;
  height: 31px;
  min-width: 0;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  transition: border-color .13s ease, background .13s ease;
}
.menu-input:hover:not(:disabled) { border-color: var(--input-hover); background: var(--input-bg); }
.menu-input:focus {
  border-color: var(--accent-focus);
  background: var(--input-bg);
  box-shadow: 0 0 0 2px var(--accent-ring);
}
.menu-input::placeholder { color: var(--placeholder); }
.menu-input:disabled { opacity: .6; cursor: wait; }
.menu-code-input { font-family: var(--mono); font-size: 11.5px; }
.menu-name-fields { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-name-fields .menu-input { height: 27px; }
.menu-name-zh { color: var(--muted); font-size: 11.5px; }
.menu-price-input { font-family: var(--mono); text-align: right; }
.menu-action-cell { text-align: right; }
.menu-delete {
  height: 29px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-2);
  font-size: 11.5px;
  transition: .14s ease;
}
.menu-delete:hover:not(:disabled) {
  border-color: var(--danger-hover-border);
  background: var(--danger-hover-bg);
  color: var(--danger);
}
.menu-delete:disabled { opacity: .45; cursor: wait; }
.menu-empty { padding: 48px 20px; color: var(--muted-2); font-size: 12.5px; text-align: center; }
.menu-empty[hidden] { display: none !important; }
.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px 0;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.55;
}
.menu-save-state { font-family: var(--mono); white-space: nowrap; }
.menu-save-state.changed { color: var(--warn); }
.menu-save-state.changed::before { content: "● "; }

/* ---------- 知识库管理 ---------- */
.knowledge-panel { min-width: 0; padding: 22px 26px 48px; }
.knowledge-panel[hidden] { display: none !important; }
.knowledge-table-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 360px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
  overscroll-behavior: contain;
}
.knowledge-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.knowledge-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--option-bg);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .06em;
  text-align: left;
}
.knowledge-table th:nth-child(1) { width: 12%; }
.knowledge-table th:nth-child(2) { width: 17%; }
.knowledge-table th:nth-child(3) { width: 20%; }
.knowledge-table th:nth-child(4) { width: 35%; }
.knowledge-table th:nth-child(5) { width: 9%; }
.knowledge-table th:nth-child(6) { width: 7%; }
.knowledge-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.knowledge-table tbody tr:last-child td { border-bottom: 0; }
.knowledge-table tbody tr { transition: background .13s ease; }
.knowledge-table tbody tr:hover { background: var(--accent-soft); }
.knowledge-content-input {
  height: 118px;
  min-height: 118px;
  padding: 8px;
  line-height: 1.55;
  resize: vertical;
  white-space: pre-wrap;
}
.knowledge-keyword-input { font-size: 11.5px; }
.knowledge-enabled-cell { padding-top: 14px !important; }
.knowledge-enabled { gap: 7px; white-space: nowrap; }
.knowledge-enabled .track { flex: 0 0 auto; }
.knowledge-enabled .switch-text { color: var(--muted-2); font-size: 10.5px; }
.knowledge-action-cell { text-align: right; padding-top: 10px !important; }

/* ---------- 配置卡片 ---------- */
.voice-mode-bar { margin: 0 0 16px; }
.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(156px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--panel-bg-2);
}
.mode-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: .16s ease;
}
.mode-tab:hover { background: var(--accent-soft); color: var(--text); }
.mode-tab:focus-visible { outline: 2px solid var(--accent-focus); outline-offset: 2px; }
.mode-tab.active {
  border-color: var(--accent-border);
  background: linear-gradient(90deg, var(--accent-active-from), var(--accent-active-to));
  color: var(--text);
  box-shadow: var(--card-shadow);
}
.mode-tab-label { font-size: 13px; font-weight: 700; white-space: nowrap; }
.mode-tab-desc { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.mode-tab.active .mode-tab-desc { color: var(--muted); }

#config-form { display: flex; flex-direction: column; gap: 16px; }
.group-card {
  scroll-margin-top: 84px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.group-card[hidden] { display: none !important; }
.group-head { display: flex; gap: 12px; padding: 15px 18px 13px; border-bottom: 1px solid var(--line-soft); }
.group-icon {
  display: grid; place-items: center;
  flex: 0 0 34px; width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 16px;
}
.group-title { font-size: 14.5px; font-weight: 650; }
.group-desc { margin-top: 4px; font-size: 12px; line-height: 1.65; color: var(--muted-2); max-width: 92ch; }
.group-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  padding: 18px;
}
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.field[hidden] { display: none !important; }
.field.wide { grid-column: 1 / -1; }
.field-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--field-label); }
.required-mark { color: var(--danger); font-size: 15px; font-weight: 700; line-height: 1; }
.field-key { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); font-weight: 500; }
.field-help { font-size: 11.5px; line-height: 1.55; color: var(--muted-2); }
.field-help.warn { color: var(--warn); }

.input, .select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover { border-color: var(--input-hover); }
.input:focus, .select:focus {
  border-color: var(--accent-focus);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder { color: var(--placeholder); }
.textarea {
  height: auto;
  min-height: 112px;
  padding: 10px 11px;
  line-height: 1.55;
  resize: vertical;
}
.select {
  appearance: none;
  background-color: var(--input-bg);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--select-arrow) 50%),
    linear-gradient(135deg, var(--select-arrow) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.select option { background: var(--option-bg); color: var(--text); }

.secret-wrap { position: relative; display: flex; gap: 6px; }
.secret-wrap .input { flex: 1 1 auto; min-width: 0; padding-right: 10px; font-family: var(--mono); letter-spacing: .02em; }
.icon-btn {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--icon-bg);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  transition: .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--icon-hover-border); background: var(--icon-hover-bg); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger-hover-border); }
.model-btn { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.model-btn:hover { color: var(--text); border-color: var(--accent-focus); background: var(--accent-active-from); }
.model-btn:disabled { cursor: wait; opacity: .62; }
.secret-state { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.secret-state.set { color: var(--ok); }
.secret-state.cleared { color: var(--warn); }

/* switch */
.switch-row { display: flex; align-items: center; gap: 10px; height: 38px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 40px; height: 22px;
  border-radius: 999px;
  background: var(--switch-track);
  border: 1px solid var(--switch-border);
  transition: .18s;
}
.switch .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--switch-knob);
  transition: .18s;
}
.switch input:checked + .track { background: var(--switch-on-bg); border-color: var(--switch-on-border); }
.switch input:checked + .track::after { left: 20px; background: var(--accent-2); box-shadow: 0 0 8px var(--switch-on-glow); }
.switch .switch-text { font-size: 12px; color: var(--muted); }

/* 校验结果 */
.validation {
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid var(--validation-error-border);
  border-radius: 11px;
  background: var(--validation-error-bg);
  font-size: 12.5px;
}
.validation.warn-only { border-color: var(--validation-warn-border); background: var(--validation-warn-bg); }
.validation h4 { margin: 0 0 7px; font-size: 12.5px; }
.validation ul { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--validation-error-text); }
.validation.warn-only ul { color: var(--validation-warn-text); }
.validation .v-actions { margin-top: 10px; display: flex; gap: 8px; }

/* 未知变量 */
.unknown-list { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.unknown-list code { color: var(--accent-2); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 12.5px;
  white-space: nowrap;
  transition: .15s ease;
}
.btn:hover { border-color: var(--btn-hover-border); background: var(--btn-hover-bg); color: var(--btn-hover-text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  border-color: var(--primary-border);
  background: linear-gradient(180deg, var(--primary-from), var(--primary-to));
  color: var(--primary-text);
  box-shadow: var(--primary-shadow);
}
.btn.primary:hover { background: linear-gradient(180deg, var(--primary-hover-from), var(--primary-hover-to)); color: var(--primary-text); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger-border); color: var(--danger-text); }
.btn.danger:hover { background: var(--danger-hover-bg); border-color: var(--danger-hover-border); color: var(--danger-hover-text); }
.btn.tiny { height: 26px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.btn.busy::before {
  content: "";
  width: 12px; height: 12px;
  border: 2px solid var(--spinner-border);
  border-top-color: var(--spinner-top);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 控制台 ---------- */
.console-panel {
  position: sticky;
  bottom: 70px;
  z-index: 25;
  margin: 20px 26px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--console-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: max-height .2s ease;
  max-height: 46px;
}
.console-panel[data-open="true"] { max-height: 340px; }
.console-head { display: flex; align-items: center; gap: 12px; height: 45px; padding: 0 13px; border-bottom: 1px solid var(--line-soft); }
.console-head strong { font-size: 12.5px; letter-spacing: .04em; }
.console-sub { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }
.console-actions { display: flex; gap: 6px; }
.console-out {
  margin: 0;
  max-height: 294px;
  overflow: auto;
  padding: 12px 14px 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--console-text);
  white-space: pre-wrap;
  word-break: break-word;
}
.console-out .ok { color: var(--ok); }
.console-out .err { color: var(--danger); }
.console-out .warn { color: var(--warn); }
.console-out .dim { color: var(--muted-2); }
.console-out .cmd { color: var(--accent-2); }

/* ---------- 底部操作栏 ---------- */
.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--actionbar-bg);
  backdrop-filter: blur(14px);
}
.dirty { flex: 0 0 auto; font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.dirty.changed { color: var(--warn); }
.dirty.changed::before { content: "● "; }
.actions { display: flex; flex: 1; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.divider { width: 1px; height: 22px; margin: 0 3px; background: var(--line); }
.tail-space { height: 96px; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--toast-text);
  animation: toast-in .22s ease;
}
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 滚动条 ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .group-body { grid-template-columns: 1fr; }
  .statusbar { justify-content: flex-start; }
  .system-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-grid { grid-template-columns: 1fr; }
  .menu-toolbar { flex-wrap: wrap; }
  .menu-search { flex-basis: 100%; }
  .menu-filter { flex: 1 1 220px; }
  .menu-toolbar > .system-badge { margin-left: 0; }
  .knowledge-table-wrap { max-height: calc(100vh - 340px); }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand { min-width: 0; flex: 1; }
  .brand-sub { max-width: 62vw; }
  .statusbar { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .layout { flex-direction: column; }
  .main-col { width: 100%; }
  .sidebar {
    position: static;
    width: 100%;
    flex: none;
    height: auto;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .side-block { margin-bottom: 14px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav { scroll-snap-type: x proximity; }
  .nav button { width: auto; flex: 0 0 auto; scroll-snap-align: start; }
  .nav button.active::before {
    top: auto;
    right: 7px;
    bottom: 0;
    left: 7px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
  }
  .nav .nav-count { display: none; }
  .presets { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 16px 14px 0; }
  .system-panel { padding: 16px 14px 40px; }
  .system-head { align-items: flex-start; }
  .menu-panel { padding: 16px 14px 36px; }
  .knowledge-panel { padding: 16px 14px 36px; }
  .menu-head { align-items: flex-start; }
  .menu-table-wrap { max-height: calc(100vh - 340px); }
  .knowledge-table-wrap { max-height: calc(100vh - 340px); }
  .mode-switch { width: min(100%, 420px); }
  .console-panel { margin: 14px 14px 0; bottom: 74px; }
  .actionbar {
    flex-wrap: nowrap;
    min-height: 60px;
    padding: 9px 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .dirty { order: 0; flex: 0 0 auto; }
  .actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    min-width: max-content;
    justify-content: flex-start;
  }
  .tail-space { height: 84px; }
}
@media (max-width: 560px) {
  .topbar { align-items: stretch; gap: 8px; padding: 9px 12px; }
  .brand { flex: 0 0 100%; gap: 10px; }
  .brand > div { min-width: 0; }
  .brand-title { font-size: 14px; }
  .brand-sub { max-width: none; width: 100%; }
  .statusbar {
    order: 2;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .statusbar .pill { flex: 0 0 auto; }
  .statusbar .pill { height: 26px; padding: 0 9px; font-size: 11px; }
  .topactions { order: 3; flex: 0 0 100%; flex-wrap: nowrap; gap: 6px; }
  .topactions .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; white-space: nowrap; }
  .theme-picker { flex: 0 0 auto; padding: 0 7px; }
  .theme-label, .theme-glyph { display: none; }
  .dirty { display: none; }
  .mode-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .mode-tab { align-items: flex-start; flex-direction: column; gap: 2px; padding: 8px 10px; }
  .mode-tab-desc { font-size: 10px; }
  .actionbar { padding: 8px 10px; }
  .actions { gap: 6px; }
  .group-card { scroll-margin-top: 196px; }
  .system-head { flex-direction: column; gap: 12px; }
  .system-head-actions { width: 100%; justify-content: space-between; }
  .system-head h1 { font-size: 22px; }
  .system-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .system-metric { padding: 12px; }
  .system-metric-value { font-size: 20px; }
  .system-grid { grid-template-columns: 1fr; }
  .system-section-head { padding: 12px 13px 10px; }
  .menu-head { flex-direction: column; gap: 12px; }
  .menu-head h1 { font-size: 22px; }
  .menu-head-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .menu-head-actions .system-updated { width: 100%; }
  .menu-toolbar { align-items: stretch; }
  .menu-filter { flex-basis: calc(50% - 5px); }
  .menu-toolbar > .system-badge { align-self: center; margin-left: 0; }
  .menu-toolbar > .btn { flex: 1 1 auto; }
  .menu-table-wrap { min-height: 300px; max-height: 60vh; }
  .knowledge-table-wrap { min-height: 320px; max-height: 62vh; }
  .menu-foot { align-items: flex-start; flex-direction: column; gap: 4px; }
  .storage-table th:nth-child(2), .storage-table td:nth-child(2) { display: none; }
  .storage-table th:nth-child(1) { width: 65%; }
  .storage-table th:nth-child(3) { width: 35%; }
  .storage-table th, .storage-table td { padding-left: 13px; padding-right: 13px; }
  .stat { padding: 12px; }
  .group-body { padding: 14px; gap: 13px; }
  .secret-wrap { flex-wrap: wrap; }
  .secret-wrap .input { flex: 1 1 100%; }
  .icon-btn { height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 在线测试 ---------- */
.app.online-test-view .pipeline-presets,
.app.online-test-view .actionbar,
.app.online-test-view .console-panel,
.app.online-test-view #btn-save-top { display: none !important; }
.online-test-panel { min-width: 0; padding: 22px 26px 48px; }
.online-test-panel[hidden] { display: none !important; }
.online-test-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.online-test-head h1 { margin: 4px 0 5px; font-size: 27px; letter-spacing: -.03em; }
.online-test-head .system-sub { margin: 0; }
.online-test-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.online-status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(180deg, var(--stat-from), var(--stat-to));
}
.online-status-item > div { min-width: 0; display: grid; gap: 2px; }
.online-status-item span:not(.online-status-dot) { color: var(--muted-2); font-size: 10.5px; }
.online-status-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.online-status-item strong[title],
.online-chat-model span[title] { cursor: help; }
.online-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--dot-off);
  box-shadow: 0 0 0 4px var(--dot-muted-ring);
}
.online-status-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--dot-ok-ring), 0 0 12px var(--dot-ok-glow); }
.online-status-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--dot-warn-ring); }
.online-status-dot.off { background: var(--danger); box-shadow: 0 0 0 4px var(--dot-err-ring); }
.online-status-dot.checking { background: var(--muted-2); animation: online-status-pulse 1.4s ease-in-out infinite; }
.online-test-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  gap: 16px;
  align-items: stretch;
}
.online-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(560px 210px at 10% -10%, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--card-from), var(--card-to));
  box-shadow: var(--card-shadow);
}
.online-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.online-card-title { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.online-card-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--accent-border);
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 18px;
}
.online-card-title h2 { margin: 0 0 3px; font-size: 17px; letter-spacing: -.01em; }
.online-card-title p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.online-state-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.online-state-badge[data-state="ready"] { color: var(--ok); border-color: var(--dot-ok-ring); background: var(--dot-ok-ring); }
.online-state-badge[data-state="warn"] { color: var(--warn); border-color: var(--dot-warn-ring); background: var(--dot-warn-ring); }
.online-state-badge[data-state="error"] { color: var(--danger); border-color: var(--dot-err-ring); background: var(--dot-err-ring); }
.online-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.online-metrics > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--input-bg);
}
.online-metrics span { display: block; margin-bottom: 3px; color: var(--muted-2); font-size: 10px; }
.online-metrics strong { display: block; overflow: hidden; color: var(--field-label); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.online-call-stage {
  min-height: 178px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background:
    radial-gradient(300px 140px at 50% 15%, var(--accent-soft), transparent 72%),
    var(--input-bg);
  text-align: center;
  transition: border-color .2s ease, background .2s ease;
}
.online-call-stage[data-state="connected"] { border-color: var(--dot-ok-ring); }
.online-call-stage[data-state="error"] { border-color: var(--validation-error-border); }
.online-call-orb {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, var(--logo-highlight), transparent 45%), var(--accent-soft);
  box-shadow: 0 0 0 10px var(--accent-ring), 0 14px 32px rgba(0, 0, 0, .18);
}
.online-call-orb span {
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent-2);
  opacity: .72;
}
.online-call-orb span:nth-child(2), .online-call-orb span:nth-child(4) { height: 24px; }
.online-call-orb span:nth-child(3) { height: 34px; background: var(--accent); }
.online-call-stage[data-state="requesting"] .online-call-orb span,
.online-call-stage[data-state="connecting"] .online-call-orb span,
.online-call-stage[data-state="connected"] .online-call-orb span {
  animation: online-wave 1.1s ease-in-out infinite;
}
.online-call-orb span:nth-child(2) { animation-delay: -.18s; }
.online-call-orb span:nth-child(3) { animation-delay: -.36s; }
.online-call-orb span:nth-child(4) { animation-delay: -.54s; }
.online-call-orb span:nth-child(5) { animation-delay: -.72s; }
.online-call-stage.speaking .online-call-orb { box-shadow: 0 0 0 12px var(--dot-ok-ring), 0 0 30px var(--dot-ok-glow); }
.online-call-state { margin-top: 2px; color: var(--text); font-size: 14px; font-weight: 650; }
.online-call-detail { max-width: 500px; min-height: 18px; margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.online-call-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 8px; }
.online-call-actions .btn[hidden],
.online-test-panel [hidden] { display: none !important; }
.online-call-actions .online-call-button { min-width: 150px; }
.online-audio-root { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.online-transcript-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.online-transcript-head h3 { margin: 0; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.online-transcript {
  height: 178px;
  overflow: auto;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--input-bg);
  overscroll-behavior: contain;
}
.online-empty {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}
.online-transcript-line { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 5px 0; font-size: 12px; line-height: 1.55; }
.online-transcript-line + .online-transcript-line { border-top: 1px solid var(--line-soft); }
.online-transcript-speaker { color: var(--muted-2); font-size: 10.5px; font-weight: 650; }
.online-transcript-line.agent .online-transcript-speaker { color: var(--accent); }
.online-transcript-line.user .online-transcript-speaker { color: var(--accent-2); }
.online-transcript-text { color: var(--field-label); overflow-wrap: anywhere; }
.online-transcript-text.interim { color: var(--muted); }
@keyframes online-status-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes online-wave { 0%, 100% { transform: scaleY(.55); opacity: .55; } 50% { transform: scaleY(1.25); opacity: 1; } }
.online-chat-card { min-height: 574px; }
.online-chat-model {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-bottom: 10px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10.5px;
}
.online-chat-model span:first-child { color: var(--accent-2); }
.online-chat-model span + span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-chat-messages {
  flex: 1;
  min-height: 300px;
  max-height: 430px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 4px 2px 1px;
  overscroll-behavior: contain;
}
.online-chat-empty {
  flex: 1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}
.online-chat-empty strong { color: var(--field-label); font-size: 13px; }
.online-chat-message { display: flex; align-items: flex-start; flex-direction: column; gap: 3px; }
.online-chat-message.user { align-items: flex-end; }
.online-chat-role { padding: 0 3px; color: var(--muted-2); font-size: 9.5px; font-weight: 650; }
.online-chat-message.user .online-chat-role { color: var(--accent-2); }
.online-chat-bubble {
  max-width: 90%;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 4px 12px 12px 12px;
  background: var(--panel-2);
  color: var(--field-label);
  font-size: 12px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.online-chat-message.user .online-chat-bubble {
  border-color: var(--accent-2-border);
  border-radius: 12px 4px 12px 12px;
  background: var(--accent-2-soft);
}
.online-chat-message.typing .online-chat-bubble { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.online-chat-message.typing .online-chat-bubble i {
  width: 3px;
  height: 3px;
  display: inline-block;
  border-radius: 50%;
  background: var(--muted);
  animation: online-typing 1s ease-in-out infinite;
}
.online-chat-message.typing .online-chat-bubble i:nth-child(3) { animation-delay: .15s; }
.online-chat-message.typing .online-chat-bubble i:nth-child(4) { animation-delay: .3s; }
@keyframes online-typing { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.online-chat-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.online-chat-form textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.online-chat-form textarea:hover { border-color: var(--input-hover); }
.online-chat-form textarea:focus { border-color: var(--accent-focus); box-shadow: 0 0 0 3px var(--accent-ring); }
.online-chat-form textarea::placeholder { color: var(--placeholder); }
.online-chat-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.online-chat-hint { min-width: 0; flex: 1; color: var(--muted-2); font-size: 10px; }
@media (max-width: 1180px) {
  .online-test-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-test-grid { grid-template-columns: 1fr; }
  .online-chat-messages { max-height: 420px; }
}
@media (max-width: 900px) {
  .online-test-panel { padding: 16px 14px 38px; }
  .online-test-head { align-items: flex-start; }
}
@media (max-width: 560px) {
  .online-test-head { flex-direction: column; gap: 12px; }
  .online-test-head .system-head-actions { width: 100%; justify-content: space-between; }
  .online-test-head h1 { font-size: 22px; }
  .online-test-status { grid-template-columns: 1fr 1fr; gap: 7px; }
  .online-status-item { padding: 9px 10px; }
  .online-card { padding: 13px; border-radius: 13px; }
  .online-card-head { flex-direction: column; }
  .online-state-badge { align-self: flex-start; }
  .online-metrics { grid-template-columns: 1fr; }
  .online-call-stage { min-height: 164px; padding: 15px 12px; }
  .online-call-actions .btn { flex: 1 1 auto; }
  .online-chat-actions { flex-wrap: wrap; }
  .online-chat-hint { flex-basis: 100%; }
  .online-chat-messages { min-height: 250px; max-height: 58vh; }
}

/* ---------- 账号与权限 ---------- */
[hidden] { display: none !important; }
.app.accounts-view .pipeline-presets,
.app.accounts-view .actionbar,
.app.accounts-view .console-panel,
.app.accounts-view #btn-save-top { display: none !important; }
.accounts-panel { min-width: 0; padding: 22px 26px 48px; }
.accounts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  gap: 14px;
  align-items: start;
}
.accounts-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
}
.accounts-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.accounts-card-head h2 { margin: 0; font-size: 13.5px; }
.accounts-card-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 11px; line-height: 1.5; }
.accounts-table-wrap { overflow: auto; max-height: calc(100vh - 330px); }
.accounts-table { width: 100%; min-width: 660px; border-collapse: collapse; table-layout: fixed; }
.accounts-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--option-bg);
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-align: left;
}
.accounts-table th:nth-child(1) { width: 25%; }
.accounts-table th:nth-child(2) { width: 17%; }
.accounts-table th:nth-child(3) { width: 12%; }
.accounts-table th:nth-child(4) { width: 22%; }
.accounts-table th:nth-child(5) { width: 24%; }
.accounts-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.accounts-table tbody tr:last-child td { border-bottom: 0; }
.accounts-table tbody tr:hover { background: var(--accent-soft); }
.account-identity { display: grid; gap: 3px; min-width: 0; }
.account-identity strong { overflow: hidden; color: var(--text); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.account-identity span { overflow: hidden; color: var(--muted-2); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.account-role-name { color: var(--field-label); font-size: 11.5px; }
.account-system-note { margin-left: 6px; color: var(--accent-2); font-size: 9.5px; }
.account-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}
.account-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.account-status.enabled { border-color: var(--accent-border); background: var(--accent-soft); color: var(--ok); }
.account-status.disabled { color: var(--muted-2); }
.account-updated { color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.account-lock { color: var(--muted-2); font-size: 10.5px; white-space: nowrap; }
.roles-list { display: grid; gap: 9px; padding: 12px; max-height: calc(100vh - 330px); overflow: auto; }
.role-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-2);
}
.role-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-name-box { display: flex; align-items: center; gap: 7px; min-width: 0; }
.role-name-box h3 { margin: 0; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.role-builtin { padding: 2px 6px; border: 1px solid var(--accent-border); border-radius: 999px; color: var(--accent-2); font-size: 9px; }
.role-account-count { flex: 0 0 auto; color: var(--muted-2); font-size: 10px; }
.role-permissions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.permission-chip {
  padding: 3px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 9.5px;
}
.permission-none { color: var(--muted-2); font-size: 10px; }
.role-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
.role-card-foot code { overflow: hidden; color: var(--muted-2); font-family: var(--mono); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.role-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.accounts-footnote {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.6;
}
.accounts-footnote code { color: var(--accent-2); font-family: var(--mono); }
.permission-empty { padding: 22px 26px 48px; }
.permission-empty-card {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--card-from), var(--card-to));
  text-align: center;
}
.permission-empty-icon { color: var(--accent-2); font-size: 34px; }
.permission-empty-card h1 { margin: 0; font-size: 20px; }
.permission-empty-card p { margin: 0; color: var(--muted-2); font-size: 12px; }
.account-dialog {
  width: min(640px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-bg, var(--option-bg));
  color: var(--text);
  box-shadow: var(--shadow);
}
.account-dialog::backdrop { background: rgba(2, 7, 18, .72); backdrop-filter: blur(3px); }
.dialog-form { display: grid; gap: 15px; padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; font-size: 19px; }
.dialog-head p { margin: 5px 0 0; color: var(--muted-2); font-size: 11.5px; line-height: 1.5; }
.dialog-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  font-size: 21px;
  line-height: 1;
}
.dialog-close:hover { border-color: var(--line); background: var(--input-bg); color: var(--text); }
.dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-field { display: grid; gap: 6px; min-width: 0; color: var(--field-label); font-size: 11.5px; font-weight: 600; }
.dialog-field input,
.dialog-field select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
}
.dialog-field select option { background: var(--option-bg); color: var(--text); }
.dialog-field input:focus,
.dialog-field select:focus { border-color: var(--accent-focus); box-shadow: 0 0 0 3px var(--accent-ring); }
.dialog-field small { color: var(--muted-2); font-size: 10px; font-weight: 400; line-height: 1.45; }
.dialog-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--input-bg); }
.dialog-toggle > span:last-child { display: grid; gap: 3px; }
.dialog-toggle strong { color: var(--field-label); font-size: 11.5px; }
.dialog-toggle small { color: var(--muted-2); font-size: 10px; line-height: 1.45; }
.permission-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.permission-fieldset legend { margin-bottom: 8px; color: var(--field-label); font-size: 11.5px; font-weight: 600; }
.permission-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.permission-option { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--input-bg); cursor: pointer; }
.permission-option input { margin: 2px 0 0; accent-color: var(--accent); }
.permission-option-text { display: grid; gap: 2px; min-width: 0; }
.permission-option-text strong { color: var(--field-label); font-size: 11px; }
.permission-option-text small { color: var(--muted-2); font-size: 9.5px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
@media (max-width: 1180px) {
  .accounts-grid { grid-template-columns: 1fr; }
  .accounts-table-wrap, .roles-list { max-height: none; }
}
@media (max-width: 900px) {
  .accounts-panel, .permission-empty { padding: 16px 14px 38px; }
}
@media (max-width: 560px) {
  .accounts-panel { padding: 16px 14px 38px; }
  .accounts-card-head { padding: 12px 13px 10px; }
  .dialog-grid, .permission-options { grid-template-columns: 1fr; }
  .dialog-form { padding: 16px; gap: 13px; }
  .account-actions { justify-content: flex-start; }
}
