:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --border: #e2e0da;
  --text: #23221f;
  --muted: #726f68;
  --accent: #2f5d50;
  --accent-hover: #234840;
  --danger: #b3402a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
  text-decoration: none;
}

.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { color: var(--text); text-decoration: none; }
.topbar nav a:hover { color: var(--accent); }
.topbar .user { color: var(--muted); font-size: 0.9rem; }

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  text-decoration: underline;
}

.container { max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; }

.layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.filters h2 { font-size: 1rem; margin-bottom: 8px; }
.filters h3 { font-size: 0.85rem; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.clear-filters { display: inline-block; margin-bottom: 8px; font-size: 0.85rem; color: var(--accent); }

.facet-list { list-style: none; margin: 0; padding: 0; }
.facet-list li { margin-bottom: 4px; }
.facet-list a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
}
.facet-list li.active a { color: var(--accent); font-weight: 600; }
.facet-list .count { color: var(--muted); font-size: 0.8rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.thumb-wrap { position: relative; background: #eee; }

.date-pill {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.facet-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.thumb-link { display: block; }
.thumb { width: 100%; height: 150px; object-fit: cover; display: block; }
.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #ececec;
}

.archive-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.archive-badge:hover { background: rgba(0, 0, 0, 0.8); }

.favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  vertical-align: middle;
}

.card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.3;
}
.card-title:hover { color: var(--accent); }

.card-meta { display: flex; gap: 8px; font-size: 0.78rem; color: var(--muted); }
.card-meta .category { background: var(--bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.78rem;
  color: var(--accent);
  background: #eaf1ee;
  padding: 2px 8px;
  border-radius: 999px;
  text-decoration: none;
}

.empty { color: var(--muted); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 28px;
}
.search-bar input[type="search"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}
.search-bar button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
.search-bar button:hover { background: var(--accent-hover); }
.search-bar .clear-filters { font-size: 0.85rem; white-space: nowrap; }

.result-count { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
}
.pagination a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.pagination a:hover { text-decoration: underline; }
.pagination .disabled { color: var(--muted); opacity: 0.5; font-size: 0.9rem; }
.pagination .page-info { color: var(--muted); font-size: 0.85rem; }

.form-page-wide { max-width: 720px; }
.form-page textarea {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}

.import-results {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.85rem;
}
.import-results th, .import-results td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.import-results .url-cell { color: var(--muted); max-width: 260px; }
.import-results tr.status-ok td:nth-child(2) { color: var(--accent); font-weight: 600; }
.import-results tr.status-erreur td:nth-child(2),
.import-results tr.status-invalide td:nth-child(2) { color: var(--danger); font-weight: 600; }
.import-results tr.status-ignore td:nth-child(2) { color: var(--muted); font-weight: 600; }

.form-page {
  max-width: 480px;
  margin: 20px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
}
.form-page h1 { margin-top: 0; font-size: 1.3rem; }
.form-page form { display: flex; flex-direction: column; gap: 14px; }
.form-page label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.form-page input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.form-page button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.form-page button:hover { background: var(--accent-hover); }
.form-page .hint { font-size: 0.8rem; color: var(--muted); }
.form-page .error { color: var(--danger); font-size: 0.9rem; }

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.detail-header h1 { margin: 0 0 6px; font-size: 1.4rem; }
.detail-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.detail-meta a { color: var(--accent); }
.detail-description { color: var(--text); font-size: 0.95rem; max-width: 640px; }

.detail-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.button {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  background: var(--panel);
  cursor: pointer;
}
.button.danger { color: var(--danger); border-color: var(--danger); background: none; }

.snapshot-frame {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  height: 75vh;
  background: white;
}
.snapshot-frame iframe { width: 100%; height: 100%; border: none; }
