/* ============================================================
   TARS Department Audit Page
   ============================================================ */

.audit-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 16px;
}

.audit-page-header h1 {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
}

.audit-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.audit-controls select {
  background: var(--bg-panel);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: 'Manrope', sans-serif;
  cursor: pointer;
}

/* ─── Department Grid — symmetric squares ─────────────────── */

.departments-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-bottom: 40px;
}

@media (max-width: 900px) {
  .departments-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .departments-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Department Card ─────────────────────────────────────── */

.dept-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  height: 320px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.dept-card:hover {
  border-color: #3a3a4a;
}

/* ─── Card Header ─────────────────────────────────────────── */

.dept-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.dept-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dept-status-dot.green { background: var(--status-green); box-shadow: var(--glow-green); }
.dept-status-dot.yellow { background: var(--status-yellow); box-shadow: var(--glow-yellow); }
.dept-status-dot.red { background: var(--status-red); box-shadow: var(--glow-red); }
.dept-status-dot.gray { background: var(--status-gray); }

.dept-card-name {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}

.dept-card-error-count {
  color: var(--status-red);
  font-size: 11px;
  font-weight: 600;
}

/* ─── Stats Row ──────────────────────────────────────────── */

.dept-stats-row {
  display: flex;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.dept-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dept-stat-value {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
}

.dept-stat-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Agent Mini List ────────────────────────────────────── */

.dept-agents-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.agent-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.agent-chip-dot.green { background: var(--status-green); }
.agent-chip-dot.yellow { background: var(--status-yellow); }
.agent-chip-dot.red { background: var(--status-red); }
.agent-chip-dot.gray { background: var(--status-gray); }

/* ─── Task / Activity List ───────────────────────────────── */

.dept-section-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.dept-task-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
}

.dept-task-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--bg-surface);
}

.dept-task-icon {
  flex-shrink: 0;
  font-size: 11px;
  width: 14px;
  text-align: center;
  margin-top: 1px;
}

.dept-task-icon.done { color: var(--status-green); }
.dept-task-icon.running { color: var(--status-yellow); }
.dept-task-icon.error { color: var(--status-red); }
.dept-task-icon.pending { color: var(--text-muted); }

.dept-task-content {
  flex: 1;
  min-width: 0;
}

.dept-task-name {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-task-meta {
  display: flex;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 1px;
}

/* Show more */
.show-more-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  margin-top: 6px;
  align-self: flex-start;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.show-more-btn:hover {
  color: var(--text-secondary);
  border-color: #4a4a5a;
}

/* ─── Error Row ──────────────────────────────────────────── */

.dept-error-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(196, 80, 80, 0.06);
  border-left: 2px solid var(--status-red);
  margin-top: 3px;
}

.dept-error-type {
  color: var(--status-red);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.dept-error-msg {
  color: var(--text-secondary);
  font-size: 11px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dept-error-time {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
}

/* ─── Empty ──────────────────────────────────────────────── */

.dept-empty {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  padding: 4px 0;
}
