:root {
  --bg: #0b1020;
  --bg-2: #111834;
  --panel: #131c3a;
  --panel-2: #182346;
  --line: #243257;
  --text: #e8edf9;
  --text-dim: #94a3c8;
  --text-mute: #6b7ba3;
  --accent: #4f7cff;
  --accent-2: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

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

html, body { height: 100%; }

body {
  background: radial-gradient(1200px 700px at 15% -10%, #1b2a55 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

.app { display: flex; flex-direction: column; height: 100vh; }

/* hidden 属性必须能覆盖下方任何 display 声明（.modal-mask / .toast 等） */
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px;
  background: rgba(11,16,32,.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06102b; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(79,124,255,.35);
}
.brand-txt h1 { font-size: 17px; letter-spacing: .3px; }
.brand-txt span { font-size: 11px; color: var(--text-mute); }
.topbar-stats { display: flex; gap: 10px; margin-left: auto; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 14px; text-align: center; min-width: 76px;
}
.stat b { display: block; font-size: 18px; color: var(--accent-2); }
.stat span { font-size: 10px; color: var(--text-mute); }

/* ---------- 按钮 ---------- */
.btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 14px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: #1d2a52; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3b63e0);
  border-color: transparent; color: #fff; font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.icon-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------- 主布局 ---------- */
.main {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 320px 340px 1fr;
  gap: 12px; padding: 12px;
}
.panel {
  background: linear-gradient(180deg, var(--panel), rgba(19,28,58,.86));
  border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.panel-head h2 { font-size: 13px; font-weight: 600; letter-spacing: .5px; }
.panel-head select {
  margin-left: auto; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; font-size: 12px;
}
.chip {
  background: var(--accent); color: #fff; border-radius: 20px;
  padding: 1px 9px; font-size: 11px; font-weight: 700;
}
.search-row { padding: 10px 12px 6px; flex: 0 0 auto; }
.search-row input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 11px; color: var(--text); font-size: 13px;
  font-family: inherit;
}
.search-row input:focus { outline: none; border-color: var(--accent); }

/* ---------- 设备列表 ---------- */
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 10px; flex: 0 0 auto; }
.vendor-tab {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 20px; padding: 4px 11px; font-size: 11px; cursor: pointer;
}
.vendor-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.device-list { overflow-y: auto; padding: 0 8px 10px; flex: 1 1 auto; }
.device-item {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  transition: .15s; position: relative; overflow: hidden;
}
.device-item:hover { border-color: #3a4c85; transform: translateX(2px); }
.device-item.active { border-color: var(--accent); background: #17234a; }
.device-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent);
}
.dev-row { display: flex; align-items: center; gap: 8px; }
.dev-name { font-weight: 600; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  letter-spacing: .5px; color: #fff;
}
.dev-meta { font-size: 11px; color: var(--text-mute); margin-top: 5px; font-family: var(--mono); }
/* Console 串口标识 */
.serial-tag {
  display: inline-block; padding: 1px 5px; border-radius: 4px; font-size: 9px;
  letter-spacing: .5px; font-weight: 700;
  background: rgba(34, 211, 238, .16); color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, .35);
}
.serial-note {
  font-size: 11px; line-height: 1.6; color: var(--text-dim);
  background: rgba(34, 211, 238, .07); border: 1px solid rgba(34, 211, 238, .22);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 4px;
}
.serial-note b { color: var(--text); }
.dev-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); flex: 0 0 auto; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dev-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- 命令列表 ---------- */
.cmd-list { overflow-y: auto; padding: 4px 10px 8px; flex: 1 1 auto; min-height: 120px; }
.cmd-group-title {
  font-size: 11px; color: var(--text-mute); font-weight: 700;
  padding: 10px 4px 6px; letter-spacing: .8px; text-transform: uppercase;
}
.cmd-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid transparent; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 5px; cursor: pointer; transition: .12s;
}
.cmd-item:hover { background: #1b2a52; border-color: #32437a; }
.cmd-item.selected { border-color: var(--accent); background: #17234a; }
.cmd-text { font-family: var(--mono); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-run {
  opacity: 0; background: var(--accent); color: #fff; border: none;
  border-radius: 5px; font-size: 10px; padding: 3px 7px; cursor: pointer;
}
.cmd-item:hover .cmd-run { opacity: 1; }

.cmd-detail { border-top: 1px solid var(--line); padding: 14px; flex: 0 0 auto; background: rgba(11,16,32,.4); }
.cmd-detail h3 { font-size: 13px; font-family: var(--mono); color: var(--accent-2); margin-bottom: 7px; }
.cmd-detail code {
  display: block; font-family: var(--mono); font-size: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; color: var(--text); margin-bottom: 8px; word-break: break-all;
}
.cmd-detail p { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.cmd-actions { display: flex; gap: 8px; }

/* ---------- 终端 ---------- */
.term-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); }
.status-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.term-body {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 16px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  background: #070b18; color: #cfe3ff; white-space: pre-wrap; word-break: break-word;
}
.term-welcome { text-align: center; color: var(--text-mute); padding-top: 40px; font-family: inherit; }
.term-welcome-logo { font-size: 40px; color: var(--accent); margin-bottom: 10px; }
.term-welcome h3 { color: var(--text); margin-bottom: 8px; }
.term-welcome ul { list-style: none; margin-top: 14px; display: inline-block; text-align: left; }
.term-welcome li { margin: 6px 0; }
.term-welcome b { color: var(--accent-2); margin-right: 8px; }
.term-cmd { color: var(--accent-2); }
.term-err { color: #ff8080; }
.term-sys { color: #7f8fae; }
.term-prompt { color: var(--ok); }

.term-input-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--line); background: var(--panel-2); flex: 0 0 auto;
}
.term-input-row .prompt { font-family: var(--mono); color: var(--ok); font-size: 13px; white-space: nowrap; }
.term-input-row input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-family: var(--mono); font-size: 13px;
}
.term-input-row input:focus { outline: none; border-color: var(--accent); }
.term-input-row input:disabled { opacity: .45; }
.term-history { display: none; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,8,20,.72);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  backdrop-filter: blur(4px);
}
.modal {
  width: 560px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.form-grid label.full, .form-grid .full { grid-column: 1 / -1; }
.form-grid + .form-grid { margin-top: 12px; }
.form-grid input, .form-grid select, .form-grid textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px; font-family: inherit; resize: vertical;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: none; border-color: var(--accent); }
.form-grid label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form-grid label.checkbox input { width: 15px; height: 15px; }
.modal-error {
  margin-top: 12px; background: rgba(239,68,68,.12); border: 1px solid var(--err);
  color: #ffb4b4; border-radius: 8px; padding: 9px 12px; font-size: 12px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 20px; border-radius: 10px; font-size: 13px; z-index: 99;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.toast.err { border-color: var(--err); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3a68; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4c85; }

/* ---------- 标签页 ---------- */
.tab-bar {
  display: flex; gap: 2px; padding: 8px 10px 0; flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-mute); font-size: 13px; font-family: inherit;
  padding: 8px 14px; cursor: pointer; transition: .15s;
}
.tab:hover { color: var(--text-dim); }
.tab.active { color: var(--accent-2); border-bottom-color: var(--accent-2); font-weight: 600; }
.tab-pane { display: none; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.tab-pane.active { display: flex; }

/* ---------- 配置向导 ---------- */
.wizard-body { overflow-y: auto; padding: 14px; flex: 1 1 auto; }
.wizard-intro { text-align: center; padding: 18px 10px 20px; }
.wizard-intro-icon {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06102b; font-size: 24px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
}
.wizard-intro h3 { font-size: 14px; margin-bottom: 6px; }
.wizard-intro p { font-size: 12px; color: var(--text-dim); }

.wizard-scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.scene-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px; cursor: pointer; transition: .15s; text-align: left;
  font-family: inherit; color: var(--text);
}
.scene-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.scene-card.active { border-color: var(--accent); background: #17234a; }
.scene-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.scene-summary { font-size: 11px; color: var(--text-mute); margin-top: 4px; line-height: 1.5; }
.scene-tag {
  font-size: 9px; padding: 1px 5px; border-radius: 4px; margin-left: auto;
  background: rgba(79,124,255,.2); color: var(--accent-2);
}
.scene-tag.adv { background: rgba(245,158,11,.18); color: var(--warn); }

.recipe-group { margin-top: 18px; }
.recipe-group h4 { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; font-weight: 600; }
.recipe-card {
  background: linear-gradient(135deg, rgba(79,124,255,.12), rgba(34,211,238,.08));
  border: 1px solid var(--line); border-radius: 10px; padding: 11px;
  cursor: pointer; margin-bottom: 8px; transition: .15s; text-align: left;
  font-family: inherit; color: var(--text); width: 100%;
}
.recipe-card:hover { border-color: var(--accent); }
.recipe-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 4px 16px rgba(79,124,255,.18);
}
.recipe-name { font-size: 13px; font-weight: 600; }
.recipe-summary { font-size: 11px; color: var(--text-mute); margin-top: 4px; line-height: 1.5; }

.wizard-form {
  margin-top: 14px; padding: 14px; flex: 0 0 auto;
  border-top: 1px dashed var(--line); overflow-y: auto; max-height: 45%;
}
.wizard-form h4 { font-size: 13px; margin-bottom: 12px; }
.wf-row { margin-bottom: 11px; }
.wf-row label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.wf-row input, .wf-row textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); font-size: 13px; font-family: inherit;
}
.wf-row input:focus, .wf-row textarea:focus { outline: none; border-color: var(--accent); }
.wf-row .hint { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.wf-ports { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.port-chip {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 6px; padding: 4px 9px; font-size: 11px; cursor: pointer;
  font-family: var(--mono);
}
.port-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.vlan-row { display: flex; gap: 6px; margin-bottom: 6px; }
.vlan-row input { flex: 1; }
.vlan-row button { flex: 0 0 auto; }

.wizard-preview { margin-top: 14px; padding: 0 14px 14px; flex: 0 0 auto; max-height: 40%; overflow-y: auto; }
.preview-step {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 8px;
}
.preview-step h5 { font-size: 12px; color: var(--accent-2); margin-bottom: 3px; }
.preview-step p { font-size: 11px; color: var(--text-mute); margin-bottom: 7px; }
.preview-cmds {
  font-family: var(--mono); font-size: 11.5px; background: #070b18;
  border-radius: 6px; padding: 8px 10px; color: #cfe3ff; white-space: pre-wrap;
}

/* ---------- AI 助手 ---------- */
.ai-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 20px;
  background: rgba(34,211,238,.15); color: var(--accent-2); margin-left: auto;
}
.ai-badge.llm { background: rgba(34,197,94,.16); color: var(--ok); }
.ai-body { overflow-y: auto; padding: 14px; flex: 1 1 auto; }
.ai-intro { text-align: center; padding: 16px 10px 10px; }
.ai-intro-icon {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #06102b; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ai-intro h3 { font-size: 14px; margin-bottom: 6px; }
.ai-intro p { font-size: 12px; color: var(--text-dim); }
.ai-samples { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.ai-sample {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; font-size: 12px; color: var(--text-dim); cursor: pointer;
  text-align: left; font-family: inherit; transition: .15s;
}
.ai-sample:hover { border-color: var(--accent); color: var(--text); }

.ai-plan { margin-top: 14px; }
.ai-plan-head {
  background: linear-gradient(135deg, rgba(79,124,255,.14), rgba(34,211,238,.08));
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.ai-plan-intent { font-size: 13px; font-weight: 600; color: var(--accent-2); }
.ai-plan-explain { font-size: 12px; color: var(--text-dim); margin-top: 5px; line-height: 1.6; }
.ai-plan-src {
  font-size: 10px; padding: 2px 7px; border-radius: 4px; margin-top: 8px;
  background: rgba(148,163,184,.16); color: var(--text-mute); display: inline-block;
}
.ai-plan-src.llm { background: rgba(34,197,94,.16); color: var(--ok); }
.ai-plan-actions { display: flex; gap: 8px; margin-top: 12px; }
.ai-warn {
  background: rgba(245,158,11,.12); border: 1px solid var(--warn);
  color: #fcd9a0; border-radius: 8px; padding: 9px 12px; font-size: 12px; margin-bottom: 10px;
}
.ai-input-row {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line);
  background: var(--panel-2); flex: 0 0 auto; align-items: stretch;
}
.ai-input-row textarea {
  flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-family: inherit; font-size: 13px;
  resize: none; line-height: 1.6;
}
.ai-input-row textarea:focus { outline: none; border-color: var(--accent); }
.ai-input-row .btn { align-self: stretch; }
.ai-setting-note {
  font-size: 12px; color: var(--text-dim); line-height: 1.7;
  background: var(--bg-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px;
}
.ai-providers {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 14px; font-size: 11px; color: var(--text-mute);
}

@media (max-width: 1180px) {
  .main { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; overflow-y: auto; }
  body { overflow: auto; }
  .device-list, .cmd-list { max-height: 300px; }
}

/* ==================== 认证与身份 ==================== */

.topbar-user { display: flex; align-items: center; gap: 8px; }

.role-badge {
  font-size: 11px; padding: 4px 9px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text-dim); white-space: nowrap; cursor: default;
}
.role-badge.admin {
  color: #7ef0b0; border-color: rgba(34, 197, 94, .4);
  background: rgba(34, 197, 94, .1); cursor: pointer;
}
.role-badge.admin:hover { background: rgba(34, 197, 94, .18); }
.role-badge.guest {
  color: var(--warn); border-color: rgba(245, 158, 11, .38);
  background: rgba(245, 158, 11, .1);
}
.role-badge.none { color: var(--err); border-color: rgba(239, 68, 68, .35); }

/* 访客提示条 */
.guest-banner {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 0 16px 10px; padding: 9px 13px;
  font-size: 12px; line-height: 1.65; color: var(--text-dim);
  background: rgba(245, 158, 11, .07);
  border: 1px solid rgba(245, 158, 11, .22);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
}
.guest-banner b { color: var(--warn); }
.guest-banner-icon {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(245, 158, 11, .22); color: var(--warn);
  font-size: 11px; font-weight: 700; font-style: italic;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px; font-family: Georgia, serif;
}
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent-2); font: inherit; text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--text); }

/* 临时设备标记 */
.temp-tag {
  font-size: 9px; padding: 1px 5px; border-radius: 4px;
  background: rgba(245, 158, 11, .16); color: var(--warn);
  border: 1px solid rgba(245, 158, 11, .35);
  flex: 0 0 auto; letter-spacing: .3px;
}

/* 表单辅助 */
.form-grid-1 { grid-template-columns: 1fr; }
.modal-narrow { max-width: 420px; }
.mock-hint { color: var(--warn); font-size: 11px; }

/* ==================== 操作审计日志 ==================== */

.modal-wide { max-width: 900px; width: calc(100vw - 80px); }
.modal-body-flush { padding: 0; max-height: 62vh; display: flex; flex-direction: column; }

.audit-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); flex: 0 0 auto;
}
.audit-toolbar select {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 5px 9px; font-size: 12px; font-family: inherit;
}
.audit-summary { font-size: 12px; color: var(--text-mute); flex: 1; }
.audit-summary b { color: var(--text); }
.audit-summary-bad { color: var(--err); }

.audit-list { overflow-y: auto; flex: 1; }

.audit-item {
  padding: 9px 16px; border-bottom: 1px solid rgba(36, 50, 87, .55);
  font-size: 12px;
}
.audit-item:hover { background: rgba(79, 124, 255, .05); }
.audit-item.fail { background: rgba(239, 68, 68, .05); }

.audit-line1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audit-time {
  font-family: var(--mono); font-size: 11px; color: var(--text-mute);
  flex: 0 0 auto;
}
.audit-badge {
  font-size: 10px; padding: 1px 7px; border-radius: 4px;
  border: 1px solid transparent; flex: 0 0 auto; white-space: nowrap;
}
.audit-badge.auth { color: #7dd3fc; background: rgba(56, 189, 248, .12); border-color: rgba(56, 189, 248, .3); }
.audit-badge.write { color: #fcd34d; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .3); }
.audit-badge.exec { color: #a5b4fc; background: rgba(99, 102, 241, .14); border-color: rgba(99, 102, 241, .32); }
.audit-badge.config { color: #6ee7b7; background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .3); }
.audit-badge.bad { color: #fca5a5; background: rgba(239, 68, 68, .13); border-color: rgba(239, 68, 68, .32); }
.audit-badge.other { color: var(--text-dim); background: var(--bg-2); border-color: var(--line); }

.audit-fail-mark {
  font-size: 10px; color: var(--err); border: 1px solid rgba(239, 68, 68, .4);
  border-radius: 4px; padding: 0 5px;
}
.audit-actor { color: var(--text); font-weight: 600; }
.audit-target { color: var(--accent-2); }
.audit-ip { color: var(--text-mute); font-family: var(--mono); font-size: 11px; margin-left: auto; }

.audit-detail {
  margin-top: 5px; font-family: var(--mono); font-size: 11px;
  color: var(--text-dim); word-break: break-all; line-height: 1.6;
  padding-left: 2px;
}
.audit-err { margin-top: 4px; font-size: 11px; color: var(--err); }

.audit-empty {
  padding: 40px 16px; text-align: center;
  color: var(--text-mute); font-size: 12px;
}
.audit-foot-note { flex: 1; font-size: 11px; color: var(--text-mute); }
