/* ============================================================
   Admin — Prompt template editor
   ============================================================ */

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - 160px);
}

.admin-sidebar {
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

.admin-sidebar-heading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 10px;
}

.admin-key-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  margin-bottom: 2px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.admin-key-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}
.admin-key-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}
.admin-key-version {
  float: right;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

.admin-main {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
}

.admin-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.admin-editor {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.admin-editor:focus {
  border-color: var(--accent);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 24px;
}

.admin-save-btn {
  padding: 8px 24px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.admin-save-btn:hover {
  background: #7aeacc;
  transform: translateY(-0.5px);
  box-shadow: 0 2px 12px rgba(92, 224, 184, 0.3);
}

.admin-save-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}
.admin-save-status.success {
  color: var(--accent);
}
.admin-save-status.error {
  color: var(--rose);
}

.admin-history {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.admin-history-heading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 10px;
}

.admin-history-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

.admin-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.admin-history-item:last-child { border-bottom: none; }

.admin-history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

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

.admin-restore-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.admin-restore-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 12px;
  }
  .admin-key-btn {
    width: auto;
  }
}
