/* Admin console — built on top of app.css design tokens. */

.admin-body { background: var(--bg, #0e1117); color: var(--fg, #e6edf3); }

.admin-topbar .admin-tag {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent, #6cb6ff);
}
.brand-link { color: inherit; text-decoration: none; }

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border, #30363d);
  background: var(--bg-surface, #161b22);
}
.adm-tab {
  background: transparent;
  color: var(--fg-dim, #9aa4b1);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 18px;
  font: inherit;
  cursor: pointer;
}
.adm-tab:hover { color: var(--fg, #e6edf3); }
.adm-tab.is-active {
  color: var(--accent, #6cb6ff);
  border-bottom-color: var(--accent, #6cb6ff);
}

.admin-main { padding: 24px; display: grid; gap: 20px; }
.adm-section { display: none; gap: 20px; flex-direction: column; }
.adm-section.is-active { display: flex; }

.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.adm-table th, .adm-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #30363d);
}
.adm-table th { font-weight: 600; color: var(--fg-dim, #9aa4b1); }
.adm-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.adm-table code { font-family: "JetBrains Mono", monospace; font-size: 0.86em; }

.adm-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.adm-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.adm-pill-ok { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.adm-pill-err { background: rgba(248, 81, 73, 0.16); color: #f85149; }
.adm-pill-unknown { background: rgba(154, 164, 177, 0.16); color: #9aa4b1; }

.adm-cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.adm-act-card {
  background: var(--bg-surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  padding: 16px;
}
.adm-act-title { margin: 0 0 12px; font-size: 1rem; }
.adm-act-grid { display: grid; gap: 6px; grid-template-columns: 1fr auto; font-size: 0.9rem; }
.adm-act-label { color: var(--fg-dim, #9aa4b1); }
.adm-act-val { font-family: "JetBrains Mono", monospace; }

/* Modal */
.adm-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.adm-modal-card {
  background: var(--bg-surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  width: min(520px, 92vw);
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.adm-modal-head, .adm-modal-foot {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #30363d);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.adm-modal-foot {
  border-top: 1px solid var(--border, #30363d);
  border-bottom: none;
}
.adm-modal-body { padding: 18px; overflow-y: auto; display: grid; gap: 12px; }
.adm-modal-close {
  background: transparent; border: none; color: var(--fg-dim);
  font-size: 1.2rem; cursor: pointer; padding: 4px 8px;
}

/* Tiny key-reveal banner shown ONCE after API key creation */
.adm-key-reveal {
  border: 1px dashed var(--accent, #6cb6ff);
  background: rgba(108, 182, 255, 0.06);
  padding: 12px;
  border-radius: 6px;
}
.adm-key-reveal code {
  display: block; padding: 8px; margin-top: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  word-break: break-all;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86rem;
}

/* Toast */
.adm-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-left-width: 4px;
  border-left-color: var(--accent, #6cb6ff);
  padding: 12px 16px; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 60;
  max-width: 360px;
}
.adm-toast.is-err { border-left-color: #f85149; }
.adm-toast.is-ok { border-left-color: #3fb950; }

/* ---- Plans de service (mapping plan ↔ EPG) ---- */
.adm-input {
  background: var(--bg-surface, #161b22);
  color: var(--fg, #c9d1d9);
  border: 1px solid var(--border, #30363d);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.92rem;
  min-width: 240px;
}

.adm-map-summary { margin-bottom: 16px; }

.adm-map-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.adm-map-stat {
  background: var(--bg-surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.adm-map-stat-val {
  font-size: 1.6rem; font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
}
.adm-map-stat-val small {
  font-size: 0.9rem; font-weight: 400;
  color: var(--fg-muted, #8b949e);
}
.adm-map-stat-lbl {
  font-size: 0.78rem;
  color: var(--fg-muted, #8b949e);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.adm-map-stat-warn { border-left: 4px solid #d29922; }

.adm-map-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; flex-wrap: wrap;
}

.adm-map-table td { vertical-align: top; }
.adm-map-select {
  background: var(--bg-surface, #161b22);
  color: var(--fg, #c9d1d9);
  border: 1px solid var(--border, #30363d);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.88rem;
  max-width: 360px;
  width: 100%;
}
