/* ===== KairTalk Admin — feuille de style =====
   Palette KairOS :
   fond #16241B · surface #1F3326 · vert primaire #4C9A52
   accent menthe #8FD694 · texte clair #E8F2E9 */

:root {
  --bg: #16241b;
  --surface: #1f3326;
  --surface-2: #25402e;
  --primary: #4c9a52;
  --primary-hover: #57ad5d;
  --mint: #8fd694;
  --text: #e8f2e9;
  --muted: #8ba593;
  --border: #2e4a37;
  --danger: #d76b6b;
  --warn: #d8b25a;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

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

h1,
h2 {
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ===== Branding ===== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--mint));
  color: var(--bg);
  font-weight: 800;
  font-size: 1.3rem;
}

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

.brand-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ===== Connexion ===== */
.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-card .brand {
  margin-bottom: 14px;
}

.login-card label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
}

input,
select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  border-color: var(--primary);
}

/* ===== Boutons ===== */
.btn-primary,
.btn-ghost {
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(215, 107, 107, 0.12);
}

.error-msg {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 6px;
}

/* ===== Barre supérieure ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .brand strong {
  font-size: 1rem;
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.tab.active {
  color: var(--bg);
  background: var(--mint);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-name {
  font-size: 0.85rem;
  color: var(--mint);
}

/* ===== Contenu ===== */
.content {
  padding: 28px;
  max-width: 1100px;
  margin: 0 auto;
}

.tab-panel h2 {
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.filters {
  display: flex;
  gap: 8px;
}

/* ===== Cartes de stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--mint);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 14px;
  background: var(--surface-2);
}

.data-table td {
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  vertical-align: top;
}

.data-table tr:hover td {
  background: var(--surface-2);
}

.mono {
  font-family: 'Consolas', 'SF Mono', monospace;
  font-size: 0.8rem;
}

.meta-cell {
  font-family: 'Consolas', monospace;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 380px;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-info {
  background: rgba(143, 214, 148, 0.15);
  color: var(--mint);
}

.badge-warn {
  background: rgba(216, 178, 90, 0.16);
  color: var(--warn);
}

.badge-error {
  background: rgba(215, 107, 107, 0.16);
  color: var(--danger);
}

.badge-ok {
  background: rgba(76, 154, 82, 0.2);
  color: var(--mint);
}

.badge-revoked {
  background: rgba(215, 107, 107, 0.16);
  color: var(--danger);
}

.badge-expired {
  background: rgba(216, 178, 90, 0.16);
  color: var(--warn);
}

/* ===== Formulaire en ligne ===== */
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field.grow {
  flex: 1;
  min-width: 160px;
}

.field label {
  font-size: 0.76rem;
  color: var(--muted);
}

.feedback {
  background: var(--surface-2);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin: 10px 0;
}

.feedback .mono {
  color: var(--mint);
  font-weight: 700;
}

.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
