/* bot 中控 - 主应用布局 */

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr 280px;
  grid-template-areas: "sidebar main" "sidebar output";
  height: calc(100vh - 56px);
  background: #f3f5f7;
}

.sidebar {
  grid-area: sidebar;
  background: #fff;
  border-right: 1px solid #e1e4e8;
  overflow-y: auto;
}
.main {
  grid-area: main;
  overflow: auto;
  padding: 20px;
}
.output {
  grid-area: output;
  background: #0f1419;
  color: #d4d4d4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #2a3340;
}

/* 侧栏 */
.sidebar-header {
  padding: 10px 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f5f7fa;
  border-bottom: 1px solid #e1e4e8;
  position: sticky;
  top: 0;
  z-index: 1;
}
.skill-block { border-bottom: 1px solid #f0f2f5; }
.skill-header {
  padding: 8px 12px;
  font-weight: 600; color: #333;
  display: flex; gap: 6px; align-items: center;
  cursor: pointer; user-select: none;
  background: #fafbfc;
}
.skill-header:hover { background: #f0f3f7; }
.skill-toggle {
  display: inline-block; width: 14px; color: #888; font-size: 10px;
  transition: transform 0.15s;
}
.skill-name { flex: 1; font-size: 13.5px; }
.host-tag {
  background: #eef; color: #557;
  padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 400;
}
.cmd-list { background: #fff; }
.cmd-item {
  padding: 6px 14px 6px 30px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  border-left: 3px solid transparent;
}
.cmd-item:hover { background: #f5f7fa; }
.cmd-item.active {
  background: #e0e9f7;
  color: #1a4d8f;
  font-weight: 600;
  border-left-color: #1a4d8f;
}
.cmd-mode {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #eee;
  color: #666;
}
.cmd-mode.grid { background: #ffe; color: #a60; }

.btn-icon {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 2px 6px;
  color: #666;
  font-size: 14px;
}
.btn-icon:hover { color: #000; background: #eee; border-radius: 3px; }

/* 主区 */
.placeholder-msg { padding: 60px; color: #999; font-size: 14px; text-align: center; }

.form-panel {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  max-width: 920px;
}
.form-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}
.form-title .muted { color: #999; font-weight: 400; }
.ui-mode-tag {
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  background: #def;
  color: #257;
}
.ui-mode-tag.grid { background: #ffe; color: #960; }

.form-table { display: table; width: 100%; }
.form-row { display: table-row; }
.form-label,
.form-input {
  display: table-cell;
  padding: 8px 12px 8px 0;
  vertical-align: top;
}
.form-label { width: 130px; font-weight: 500; padding-top: 14px; }
.form-row.has-error .form-label { color: #c00; }
.required { color: #c00; margin-left: 2px; }
.form-input input,
.form-input select,
.form-input textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d6df;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.form-input input:focus,
.form-input select:focus,
.form-input textarea:focus {
  outline: none;
  border-color: #4080ff;
  box-shadow: 0 0 0 2px rgba(64, 128, 255, 0.15);
}
.form-input input.invalid,
.form-input select.invalid,
.form-input textarea.invalid {
  border-color: #c00 !important;
  background: #fff5f5 !important;
}
.field-hint { font-size: 12px; color: #888; margin-top: 4px; }
.field-hint.error { color: #c00; font-weight: 500; }

/* B 模式：网格 */
.grid-panel { display: flex; flex-direction: column; gap: 8px; }
.grid-toolbar { display: flex; gap: 8px; align-items: center; }
.grid-toolbar .muted { margin-left: auto; font-size: 12px; }
.grid-container { border: 1px solid #d0d6df; border-radius: 4px; min-height: 200px; }
.hint { font-size: 12px; padding: 4px 0; }

/* 提交区 */
.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn {
  padding: 8px 16px;
  border: 1px solid #d0d6df;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.btn:hover { background: #f5f7fa; }
.btn.primary {
  background: #1a4d8f;
  color: #fff;
  border-color: #1a4d8f;
}
.btn.primary:hover { background: #2a5da0; }
.btn.primary:disabled { background: #99a; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 0; color: #666; }

.muted { color: #888; }
.muted.small { font-size: 12px; }

/* 任务状态条 */
.job-status {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f3f5f7;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.job-status.running { background: #f0f9ff; }
.job-status.succeeded { background: #f0fff0; }
.job-status.failed { background: #fff0f0; }
.job-status.timeout { background: #fff8e0; }
.job-badge {
  padding: 2px 10px;
  border-radius: 3px;
  background: #888;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}
.job-status.queued .job-badge { background: #888; }
.job-status.running .job-badge { background: #08f; }
.job-status.succeeded .job-badge { background: #0a0; }
.job-status.failed .job-badge { background: #c00; }
.job-status code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
}

/* 输出面板 */
.output-header {
  padding: 8px 14px;
  background: #1a2230;
  color: #ccc;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid #2a3340;
}
.output-header .muted { color: #777; }
.output-header .btn-icon { color: #888; margin-left: auto; }
.output-header .btn-icon:hover { background: #2a3340; color: #fff; }
.output-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  font-family: 'Cascadia Code', 'Consolas', 'Menlo', monospace;
  font-size: 12.5px;
  line-height: 1.5;
}
.out-line { display: flex; gap: 10px; padding: 1px 0; }
.out-seq { color: #555; min-width: 36px; text-align: right; }
.out-type { color: #888; min-width: 64px; text-transform: uppercase; font-size: 10px; padding-top: 1px; }
.out-text { flex: 1; white-space: pre-wrap; word-break: break-all; }
.out-line.stdout .out-text { color: #d4d4d4; }
.out-line.stderr .out-text { color: #ff8888; }
.out-line.error .out-text { color: #ff5555; font-weight: 600; }
.out-line.error .out-type { color: #ff5555; }
.out-line.status .out-text { color: #88ddff; }
.out-line.status .out-type { color: #88ddff; }
.out-line.progress .out-text { color: #ffdd88; }
.out-line.progress .out-type { color: #ffdd88; }
.out-line.mfa_needed .out-text { color: #ff0; font-weight: 700; }
.out-line.mfa_needed .out-type { color: #ff0; }
.out-line.info { opacity: 0.7; font-style: italic; }
.out-line.info .out-text { color: #88aaff; }

/* 铃铛 */
[x-cloak] { display: none !important; }
.bell { position: relative; }
.bell-icon {
  background: transparent; border: 0; color: #ddd;
  font-size: 18px; cursor: pointer; position: relative;
  padding: 4px 8px;
}
.bell-icon:hover { color: #fff; }
.bell-dot {
  position: absolute; top: 0; right: -2px;
  background: #c00; color: #fff;
  font-size: 10px; line-height: 1; padding: 2px 5px;
  border-radius: 8px; min-width: 16px; text-align: center;
  font-weight: 700;
}
.bell-dropdown {
  position: absolute; top: 110%; right: 0;
  width: 360px; max-height: 480px; overflow: hidden;
  background: #fff; color: #222;
  border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  z-index: 1000;
}
.bell-header {
  padding: 10px 14px;
  display: flex; gap: 8px; align-items: center;
  background: #f5f7fa; border-bottom: 1px solid #e1e4e8;
  font-weight: 600;
}
.bell-header .btn-icon { margin-left: auto; color: #666; font-size: 12px; }
.bell-list { flex: 1; overflow-y: auto; }
.bell-item {
  padding: 10px 14px; border-bottom: 1px solid #f0f2f5; cursor: pointer;
  font-size: 13px;
}
.bell-item:hover { background: #f5f7fa; }
.bell-item.unread { background: #f0f7ff; }
.bell-item.unread .bell-title::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: #4080ff; border-radius: 50%; margin-right: 6px;
  vertical-align: middle;
}
.bell-title { font-weight: 600; color: #222; margin-bottom: 4px; }
.bell-body { color: #555; font-size: 12px; white-space: pre-wrap; max-height: 60px; overflow: hidden; }
.bell-time { margin-top: 4px; }
.bell-empty { padding: 30px; text-align: center; color: #888; font-size: 13px; }

/* MFA 提示框 */
.mfa-prompt {
  margin-top: 16px;
  padding: 14px 18px;
  background: #fffbea;
  border: 2px solid #d4a017;
  border-radius: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.mfa-prompt strong { color: #8a5a00; font-size: 15px; }
.mfa-prompt input {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 18px;
  letter-spacing: 4px;
  width: 140px;
  padding: 8px 10px;
  border: 1px solid #d0d6df;
  border-radius: 4px;
  text-align: center;
}
