/* ===== Design-System ===== */
:root {
  --bg-page: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --accent-primary: #f59e0b;
  --accent-hover: #fbbf24;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --success: #10b981;
  --error: #ef4444;
  --warning: #eab308;
  --border-radius: 12px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Login-Seite ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 2rem; }

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  text-align: center;
}

.login-logo { font-size: 3rem; margin-bottom: 1rem; }

.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }

.login-subtitle { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 2rem; }

.login-form { text-align: left; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1rem; }

.form-group label { display: block; font-size: 0.875rem; margin-bottom: 0.375rem; color: var(--text-secondary); }

.form-group input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-page);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.password-wrapper { position: relative; }

.toggle-password {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.625rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.sso-section { border-top: 1px solid var(--bg-elevated); padding-top: 1.5rem; }

.sso-label { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 0.75rem; }

.sso-buttons { display: flex; gap: 0.5rem; justify-content: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-primary);
  color: #0f172a;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.btn-outline:hover:not(:disabled) { background: rgba(245, 158, 11, 0.1); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; }

.btn-full { width: 100%; }

/* ===== App-Layout ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--accent-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand { display: flex; align-items: center; gap: 0.75rem; }

.header-logo { font-size: 1.5rem; }

.header-brand h1 { font-size: 1.25rem; font-weight: 600; }

.header-user { display: flex; align-items: center; gap: 1rem; }

.app-main { padding: 2rem; max-width: 1400px; margin: 0 auto; }

/* ===== Agenten-Grid ===== */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.agent-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.agent-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.agent-header { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 1rem; }

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-primary);
  font-size: 1.125rem;
}

.agent-title h3 { font-size: 1.125rem; font-weight: 600; }

.agent-title span { font-size: 0.8125rem; color: var(--text-secondary); }

.agent-dept {
  display: inline-block;
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-primary);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.agent-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin-bottom: 0.75rem; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.status-dot.active { background: var(--success); color: var(--success); }
.status-dot.inactive { background: var(--error); color: var(--error); }

.agent-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }

.stat { text-align: center; }

.stat-value { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 1.25rem; font-weight: 700; }

.stat-label { font-size: 0.75rem; color: var(--text-secondary); }

.agent-budget { margin-bottom: 1rem; }

.budget-bar { height: 6px; background: var(--bg-page); border-radius: 3px; overflow: hidden; }

.budget-fill { height: 100%; background: var(--accent-primary); border-radius: 3px; transition: width 0.5s ease; }

.budget-label { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.375rem; }

/* ===== Stats-Panel ===== */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.stats-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--border-radius);
  padding: 1.5rem;
}

.stats-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }

.modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.85); }

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--bg-elevated);
  border-radius: var(--border-radius);
  padding: 2rem;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body h2 { margin-bottom: 1.5rem; }

.agent-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

@media (max-width: 768px) {
  .agent-detail-grid { grid-template-columns: 1fr; }
  .agents-grid { grid-template-columns: 1fr; }
  .app-header { flex-direction: column; gap: 0.75rem; padding: 1rem; }
  .app-main { padding: 1rem; }
}

/* ===== Utility ===== */
.loading { text-align: center; padding: 3rem; color: var(--text-secondary); }

.skills-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.skill-tag {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.history-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }

.history-table th, .history-table td { text-align: left; padding: 0.625rem; font-size: 0.875rem; border-bottom: 1px solid var(--bg-elevated); }

.history-table th { color: var(--text-secondary); font-weight: 500; }

.history-status { display: inline-flex; align-items: center; gap: 0.375rem; }
