:root {
  --accent: #5b5bd6;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-soft: #6b7280;
  --border: #e5e7eb;
  --hover: #f3f4f6;
  --danger: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body.admin, body.login-page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.muted { color: var(--text-soft); }
.small { font-size: 13px; }
code { background: #eef0f3; padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- Login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; }
.login-box h1 { font-size: 22px; margin-bottom: 2px; }
.login-box label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; }
.back-link { display: block; text-align: center; margin-top: 16px; color: var(--text-soft); text-decoration: none; font-size: 14px; }

/* ---------- Header admin ---------- */
.admin-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 24px; flex-wrap: wrap;
}
.ah-left { display: flex; align-items: center; gap: 10px; }
.ah-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.admin-wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 18px; text-decoration: none; color: var(--text-soft); font-weight: 600;
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h2 { font-size: 20px; }
.group-title { font-size: 15px; margin: 22px 0 10px; }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row-item {
  display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
}
.row-item .ic {
  width: 40px; height: 40px; border-radius: 9px; background: var(--hover); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 19px; overflow: hidden;
}
.row-item .ic img { width: 100%; height: 100%; object-fit: cover; }
.row-meta { flex: 1; min-width: 0; }
.row-name { font-weight: 600; }
.row-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.inline { display: inline; }

/* ---------- Formulaires ---------- */
.form-narrow { max-width: 460px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=file], select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text); font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input.color { height: 44px; padding: 4px; width: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 400; margin-top: 8px; }
.current-img { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.current-img img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- Boutons ---------- */
.btn {
  padding: 9px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--card);
  color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { opacity: .92; }
.btn.danger { color: var(--danger); border-color: #f3c4c4; }
.btn.danger:hover { background: #fef2f2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.full { width: 100%; justify-content: center; margin-top: 20px; }

/* ---------- Alertes ---------- */
.alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 14px; font-size: 14px; background: #eef0f3; }
.alert.ok { background: #dcfce7; color: #166534; }
.alert.err { background: #fee2e2; color: #991b1b; }

.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ---------- Journal d'activité ---------- */
.log-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 12px; }
.log-table th, .log-table td { text-align: left; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table th { background: var(--hover); font-weight: 600; color: var(--text-soft); }
.log-table tr:last-child td { border-bottom: none; }
.log-table .nowrap { white-space: nowrap; }
@media (max-width: 600px) {
  .log-table th:nth-child(5), .log-table td:nth-child(5) { display: none; }
}

/* ---------- Modales ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 50; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; padding: 26px; }
.modal h3 { font-size: 19px; margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .row-url { display: none; }
}
