/* Coach AI v2 — Admin Console */

.admin-page {
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.12), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(6, 182, 212, 0.08), transparent 40%),
    var(--bg);
}

.admin-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  padding-bottom: 48px;
}

.admin-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.admin-top h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
}

.admin-top .back-link {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-top .back-link:hover { color: var(--accent-2); }

.token-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.token-pill input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  min-width: 140px;
  outline: none;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 24px;
}

.admin-tabs a {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.admin-tabs a:hover { color: var(--text); background: var(--surface-2); }

.admin-tabs a.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(6,182,212,0.15));
  border: 1px solid rgba(59,130,246,0.35);
}

.admin-panel { display: none; animation: adminFade 0.2s ease; }
.admin-panel.active { display: block; }

@keyframes adminFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.admin-card h2 { font-size: 1.05rem; margin-bottom: 4px; }

.admin-card .card-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.admin-grid { display: grid; gap: 20px; }
.admin-grid-2 { grid-template-columns: 1fr 1fr; }

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

.field-slider { margin-bottom: 20px; }

.field-slider__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.field-slider__head label { font-size: 0.88rem; font-weight: 500; }

.field-slider__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.field-slider input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  outline: none;
}

.field-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
  border: 2px solid var(--bg);
}

.field-text { margin-bottom: 16px; }

.field-text label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--muted);
}

.field-text input,
.field-text select,
.field-text textarea,
.field-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.field-text input:focus,
.field-text textarea:focus,
.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.code-area {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.field-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drivers-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
}

.driver-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.driver-card__title { font-weight: 600; font-size: 0.95rem; }

.driver-card__id {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
  margin: 2px 0 12px;
}

.driver-card__metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.metric-mini label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.metric-mini input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.weight-sum {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--success);
}

.weight-sum.warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.rag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.rag-tile {
  padding: 18px 14px;
  text-align: center;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
}

.rag-tile .num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-2);
}

.rag-tile .name { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }

.doc-panel { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }

.doc-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
}

.doc-item:hover, .doc-item.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.doc-item__title { font-weight: 600; font-size: 0.9rem; }

.doc-item__preview {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  font-family: ui-monospace, monospace;
  color: var(--muted);
}

.audit-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }

.audit-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.audit-item:last-child { border-bottom: none; }

.audit-item .tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-2);
  font-weight: 600;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.agent-picker {
  min-width: 200px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
