/* ============================================================================
   Admin Console & Task Console styles
   ============================================================================ */

/* ---- Task Console: Orchestration Plan ---- */
.task-orch-card {
  margin-top: 14px;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.task-orch-meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}
.task-orch-plan {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.orch-step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.orch-step-no {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.orch-step-body { flex: 1; min-width: 0; }
.orch-step-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.orch-step-head .avatar { font-size: 16px; }
.orch-step-head .name { font-weight: 600; color: var(--text-primary); font-size: 13px; }
.orch-step-head .aid { font-size: 11px; color: var(--text-muted); }
.orch-step-desc { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.orch-step-reason { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.badge-seq {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.badge-llm {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(168,85,247,0.14);
  color: #a855f7;
  border: 1px solid #a855f7;
}
.orch-contract {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.orch-io {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.io-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 8px;
  margin-right: 6px;
  vertical-align: middle;
}
.io-label.io-in {
  background: rgba(59,130,246,0.16);
  color: #3b82f6;
}
.io-label.io-out {
  background: rgba(34,197,94,0.16);
  color: var(--success);
}
.orch-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
}
.task-orch-gov { padding: 0 14px 8px; }
.gov-ok, .gov-fail {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  line-height: 1.5;
}
.gov-ok { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid var(--success); }
.gov-fail { background: rgba(239,68,68,0.12); color: var(--fail); border: 1px solid var(--fail); }
.gov-warn { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.task-orch-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ---- Admin Console ---- */
.admin-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-toolbar .search-input {
  flex: 1;
  min-width: 220px;
}
.admin-toolbar select {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}

.admin-health,
.admin-audit {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.admin-health h4,
.admin-audit h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-primary);
}
.admin-audit { max-height: 360px; overflow-y: auto; }

.admin-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table .agent-cell { display: flex; align-items: center; gap: 8px; }
.admin-table .agent-cell .avatar { font-size: 18px; }
.admin-table .agent-cell .meta { display: flex; flex-direction: column; }
.admin-table .agent-cell .meta .aid { font-size: 11px; color: var(--text-muted); }

.tag-pill {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
}

/* badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-system { background: rgba(79,140,255,.15); color: var(--accent); }
.badge-user   { background: var(--bg-hover); color: var(--text-secondary); }
.badge-locked { background: rgba(220,53,69,.15); color: var(--fail); }
.badge-unlocked { background: var(--bg-hover); color: var(--text-muted); }
.badge-enabled { background: rgba(40,167,69,.15); color: var(--success); }
.badge-disabled { background: rgba(255,193,7,.18); color: #d39e00; }
.badge-danger { background: rgba(220,53,69,.15); color: var(--fail); }

.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-actions .btn { font-size: 11px; padding: 4px 8px; }
.switch {
  position: relative;
  display: inline-block;
  width: 38px; height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 999px; transition: .2s;
}
.switch .slider:before {
  content: ""; position: absolute; height: 14px; width: 14px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }

/* ---- Task Console ---- */
.task-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.task-left { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.task-input-card,
.task-rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.task-input-card h3 { margin: 0 0 12px; font-size: 15px; }
.task-input-card textarea {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.task-file-zone {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-muted); cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius);
  border: 1px dashed var(--border-light); background: var(--bg-input);
  transition: border-color .15s, color .15s; user-select: none;
  margin-top: 6px;
}
.task-file-zone:hover { border-color: var(--accent); color: var(--accent); }
.task-file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.task-file-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--accent-bg);
  border: 1px solid var(--accent-20); border-radius: var(--radius);
  font-size: 11px; color: var(--accent);
}
.task-file-badge .tf-name { font-weight: 500; }
.task-file-badge .tf-size { color: var(--text-muted); font-size: 10px; }
.task-file-badge .tf-remove {
  cursor: pointer; font-size: 13px; line-height: 1;
  color: var(--text-muted); transition: color .15s;
  padding: 0 2px;
}
.task-file-badge .tf-remove:hover { color: var(--fail); }
.task-status { font-size: 12px; color: var(--text-muted); }
.task-status.loading { color: var(--accent); }

.task-rec-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 10px;
}
.task-rec-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.task-rec-empty { color: var(--text-muted); font-size: 13px; padding: 16px 4px; text-align: center; }
.task-rec-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.task-rec-item:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.task-rec-item.selected { border-color: var(--accent); background: var(--accent-bg); }
.task-rec-head { display: flex; align-items: center; gap: 8px; }
.task-rec-head .avatar { font-size: 20px; }
.task-rec-head .name { font-weight: 600; color: var(--text-primary); }
.task-rec-head .aid { font-size: 11px; color: var(--text-muted); }
.task-rec-head .score {
  margin-left: auto; font-size: 12px; color: var(--accent);
  background: var(--accent-bg); padding: 1px 8px; border-radius: 999px;
}
.task-rec-reason { font-size: 12px; color: var(--text-secondary); margin: 8px 0; line-height: 1.6; }
.task-rec-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-rec-actions { display: flex; gap: 8px; margin-top: 10px; }
.task-rec-actions .btn { font-size: 12px; }

.task-right { min-height: 0; display: flex; }
.task-right .chat-panel { flex: 1; display: flex; flex-direction: column; }
.task-result-header {
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
}

/* task confirm modal */
.task-confirm-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.task-confirm {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; width: 420px; max-width: 92%;
}
.task-confirm h3 { margin: 0 0 10px; font-size: 16px; }
.task-confirm .warn {
  padding: 10px 12px; border-radius: var(--radius);
  background: rgba(220,53,69,.12); color: var(--fail); font-size: 13px; margin-bottom: 14px;
}
.task-confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 980px) {
  .task-layout { grid-template-columns: 1fr; }
}
