:root {
    --bg: #f4f6f8; --card: #fff; --ink: #1c2733; --muted: #6b7a8d;
    --line: #e2e8f0; --brand: #0a7d6b; --brand-dark: #075f51;
    --danger: #c0392b; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .85em; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(180deg, var(--brand), var(--brand-dark));
    border-bottom: 1px solid var(--brand-dark); padding: 12px 24px; }
.brand { font-weight: 700; font-size: 1.05rem; color: #fff; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: rgba(255,255,255,.92); }
.topbar nav a:hover { color: #fff; }
.topbar .me { color: rgba(255,255,255,.78); font-size: .9rem; }
.topbar .me a { color: #fff; }
.btn-export { background: #fff; color: var(--brand); padding: 7px 14px; border-radius: var(--radius); }
.btn-export:hover { background: #eaf4f1; color: var(--brand-dark); text-decoration: none; }

.container { max-width: 1080px; margin: 24px auto; padding: 0 24px; }

/* Flash */
.flash { background: #fff8e1; border: 1px solid #ffe082; padding: 10px 14px;
    border-radius: var(--radius); margin-bottom: 18px; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; margin-bottom: 22px; }
label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
input, select, textarea { width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
textarea { resize: vertical; }
button { background: var(--brand); color: #fff; border: 0; padding: 10px 18px; font: inherit;
    font-weight: 600; border-radius: var(--radius); cursor: pointer; }
button:hover { background: var(--brand-dark); }
button.danger, .mini.danger { background: var(--danger); }
.mini { font-size: .82rem; padding: 5px 10px; display: inline-block; }
.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid2 .span2 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { font-weight: 700; padding: 2px 10px; color: var(--brand);
    background: #eaf4f1; border: 1px solid #cfe6df; border-radius: 20px; font-size: .85rem;
    text-transform: uppercase; letter-spacing: .03em; }
.advanced summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }

/* Login */
.login-wrap { display: flex; min-height: 80vh; align-items: center; justify-content: center; }
.login { width: 360px; }
.login h1 { font-size: 1.2rem; margin: 0 0 4px; }
.login button { width: 100%; margin-top: 6px; }

/* List */
.list-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.statut-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { background: #fff; border: 1px solid var(--line); padding: 5px 11px; border-radius: 20px;
    font-size: .82rem; color: var(--ink); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 18px 0; }
.filters input[type=search] { flex: 1; min-width: 220px; }
.filters select { width: auto; }
.filters button { padding: 9px 16px; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { background: #f8fafb; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.grid tr:last-child td { border-bottom: 0; }
.thumb { width: 52px; }
.thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.no-photo { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center;
    background: #f0f3f6; border-radius: 6px; color: var(--muted); }

/* Pills (statut) */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600;
    background: #eef2f6; color: var(--muted); }
.pill-brouillon { background: #eceff1; color: #607d8b; }
.pill-a-completer { background: #fff3e0; color: #e65100; }
.pill-a-valider { background: #e3f2fd; color: #1565c0; }
.pill-valide { background: #e8f5e9; color: #2e7d32; }

/* Photos */
.photo-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.photo-item, .photo-del { position: relative; width: 110px; text-align: center; }
.photo-grid img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo-kind { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.6); color: #fff;
    font-size: .65rem; padding: 1px 6px; border-radius: 4px; }
.photo-del button { margin-top: 4px; }

.danger-zone { border-color: #f3c6c0; }
.danger-zone hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.edit-head, .list-head h1 { display: flex; align-items: center; gap: 16px; }
.edit-head { justify-content: space-between; }

/* Catégories */
.cat-block { padding: 16px 18px; margin-bottom: 16px; }
.cat-parent { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cat-parent h2 { margin: 0; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 8px; }
.cat-subs { list-style: none; margin: 12px 0 0; padding: 0; }
.cat-subs li { display: flex; align-items: center; gap: 10px; padding: 8px 0;
    border-top: 1px solid var(--line); flex-wrap: wrap; }
.cat-sub-name { flex: 0 1 auto; }
.cat-subs li .badge { margin-left: auto; }
.cat-edit { width: 100%; margin-top: 2px; }
.cat-edit summary { cursor: pointer; color: var(--brand); font-size: .82rem; display: inline-block; }
.cat-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 8px;
    background: #f8fafb; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.cat-form label.inline { margin: 0; font-size: .8rem; font-weight: 600; }
.cat-form input[type=text] { width: auto; min-width: 210px; }
.cat-form button { padding: 8px 14px; }

@media (max-width: 640px) {
    .grid2 { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; gap: 10px; align-items: flex-start; }
    .cat-form input[type=text] { min-width: 0; width: 100%; }
}
