:root {
  --noir: #0e0e0e;
  --blanc: #f7f6f2;
  --rouge: #c8391a;
  --vert: #1a7a4a;
  --orange: #c87a1a;
  --g1: #222;
  --g2: #444;
  --g3: #777;
  --g4: #bbb;
  --g5: #e6e6e2;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'DM Mono', monospace;
  --b: 1.5px solid #0e0e0e;
  --bl: 1px solid #d8d8d4;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--mono); background: var(--blanc); color: var(--noir); font-size: 13px; line-height: 1.5; }

/* ── LOGIN ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-box {
  border: var(--b); padding: 2.5rem; width: 360px;
}
.login-title { font-family: var(--serif); font-size: 28px; font-weight: 400; margin-bottom: .35rem; }
.login-title em { font-style: italic; color: var(--rouge); }
.login-sub { font-size: 11px; color: var(--g3); margin-bottom: 2rem; }
.login-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.login-field label { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--g2); font-weight: 500; }
.login-field input {
  font-family: var(--mono); font-size: 12px; border: 1px solid var(--g4);
  padding: 8px 10px; background: var(--blanc); outline: none; border-radius: 0;
}
.login-field input:focus { border-color: var(--noir); }
.login-err { font-size: 10px; color: var(--rouge); margin-top: .25rem; display: none; }
.btn-login {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 20px; background: var(--noir); color: var(--blanc); border: none;
  cursor: pointer; width: 100%; margin-top: .5rem; transition: opacity .1s;
}
.btn-login:hover { opacity: .85; }

/* ── APP ── */
.app { display: none; }
.app.visible { display: block; }

/* ── HEADER ── */
.adm-header {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 1.5rem;
  padding: 0 1.5rem; height: 52px; border-bottom: var(--b);
  background: var(--noir); color: var(--blanc);
  position: sticky; top: 0; z-index: 100;
}
.adm-logo { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #ccc; }
.adm-logo span { color: var(--rouge); }
.adm-tabs { display: flex; gap: 0; }
.adm-tab {
  font-family: var(--mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  padding: 0 1.25rem; height: 52px; background: none; border: none; border-right: 1px solid #333;
  cursor: pointer; color: #999; transition: color .1s, background .1s;
}
.adm-tab:hover { color: var(--blanc); background: #1a1a1a; }
.adm-tab.on { color: var(--blanc); background: #1a1a1a; }
.adm-tab .badge {
  display: inline-block; background: var(--rouge); color: var(--blanc);
  font-size: 9px; padding: 1px 6px; border-radius: 10px; margin-left: 6px; vertical-align: middle;
}
.adm-user { font-size: 11px; color: #999; display: flex; align-items: center; gap: .75rem; }
.btn-logout {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: none; border: 1px solid #444; color: #999; padding: 5px 12px; cursor: pointer;
}
.btn-logout:hover { border-color: #888; color: var(--blanc); }

/* ── TOOLBAR ── */
.adm-toolbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.5rem; border-bottom: var(--bl); background: var(--blanc);
}
.search-input {
  font-family: var(--mono); font-size: 11px; border: 1px solid var(--g4);
  padding: 6px 10px; outline: none; border-radius: 0; width: 240px; background: var(--blanc);
}
.search-input:focus { border-color: var(--noir); }
.filter-sel {
  font-family: var(--mono); font-size: 11px; border: 1px solid var(--g4);
  padding: 6px 10px; outline: none; border-radius: 0; background: var(--blanc);
  -webkit-appearance: none; cursor: pointer;
}
.adm-count { font-size: 10px; color: var(--g3); margin-left: auto; }

/* ── GRILLE SOUMISSIONS ── */
.submissions-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px; background: var(--bl); border-top: none;
}
.sub-card {
  background: var(--blanc); padding: 1.1rem 1.25rem;
  border-bottom: var(--bl); cursor: pointer; transition: background .1s;
  position: relative;
}
.sub-card:hover { background: var(--g5); }
.sub-card.selected { background: #fff8f6; border-left: 3px solid var(--rouge); }

.sub-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 8px; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 10px; margin-bottom: .6rem;
}
.sub-status.pending { background: #fff3e0; color: var(--orange); }
.sub-status.published { background: #e8f5e9; color: var(--vert); }
.sub-status.rejected { background: #fce8e8; color: var(--rouge); }
.sub-status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.sub-titre { font-size: 13px; font-weight: 500; margin-bottom: 3px; line-height: 1.3; }
.sub-arch { font-size: 11px; color: var(--g2); margin-bottom: 2px; }
.sub-meta { font-size: 10px; color: var(--g3); margin-bottom: .6rem; }
.sub-etu { font-size: 10px; color: var(--g3); }
.sub-etu strong { color: var(--g1); }
.sub-date { font-size: 9px; color: var(--g4); position: absolute; top: .8rem; right: 1rem; }

.sub-planches { display: flex; gap: 3px; margin-top: .6rem; flex-wrap: wrap; }
.pl-badge {
  font-size: 8px; letter-spacing: .05em; padding: 2px 5px;
  border: 1px solid var(--g4); color: var(--g4);
}
.pl-badge.ok { border-color: var(--vert); color: var(--vert); }

/* ── PANNEAU DÉTAIL ── */
.detail-panel {
  position: fixed; top: 48px; right: 0; bottom: 0;
  width: 480px; background: var(--blanc); border-left: var(--b);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; z-index: 50; overflow: hidden;
}
.detail-panel.open { transform: translateX(0); }
.submissions-grid { transition: margin-right .3s cubic-bezier(.4,0,.2,1); }
.submissions-grid.shifted { margin-right: 480px; }

.dp-head {
  padding: .9rem 1.25rem; border-bottom: var(--b);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.dp-head-title { font-size: 11px; font-weight: 500; }
.dp-close {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  background: none; border: none; cursor: pointer; color: var(--g3);
}
.dp-close:hover { color: var(--rouge); }

.dp-actions {
  display: flex; gap: 6px; padding: .9rem 1.25rem; border-bottom: var(--b); flex-shrink: 0;
}
.dp-btn {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 14px; border: var(--b); background: none; cursor: pointer; transition: all .1s;
}
.dp-btn:hover { background: var(--g5); }
.dp-btn.publish { background: var(--vert); color: var(--blanc); border-color: var(--vert); }
.dp-btn.publish:hover { opacity: .85; }
.dp-btn.reject { color: var(--rouge); border-color: var(--rouge); }
.dp-btn.reject:hover { background: #fce8e8; }
.dp-btn.edit { border-color: var(--g4); color: var(--g2); }
.dp-btn:disabled { opacity: .35; cursor: default; }

.dp-scroll { flex: 1; overflow-y: auto; padding: 1.25rem; }

.dp-planches-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 1.25rem; }
.dp-pl {
  border: 1px solid var(--g4); padding: .5rem;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
}
.dp-pl:hover { border-color: var(--noir); }
.dp-pl img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--g5); }
.dp-pl-lbl { font-size: 8px; letter-spacing: .07em; text-transform: uppercase; color: var(--g3); text-align: center; }
.dp-pl-leg { font-size: 9px; color: var(--g2); font-style: italic; text-align: center; line-height: 1.3; margin-top: 2px; }
.dp-pl-missing { width: 100%; aspect-ratio: 1; background: var(--g5); display: flex; align-items: center; justify-content: center; }
.dp-pl-missing span { font-size: 9px; color: var(--g4); }

.dp-sec { margin-bottom: 1.1rem; }
.dp-sec-label {
  font-size: 8px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--rouge); margin-bottom: .4rem; display: block;
  border-bottom: 1px solid var(--g5); padding-bottom: .25rem; font-weight: 500;
}
.dp-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--g5); font-size: 11px; gap: 8px; }
.dp-row:last-child { border: none; }
.dp-k { color: var(--g3); flex-shrink: 0; }
.dp-v { font-weight: 500; text-align: right; }

.dp-numero-field {
  display: flex; gap: 6px; align-items: center; margin-bottom: 1rem;
  padding: .75rem; background: #fff8f6; border: 1px solid #f5c5b5;
}
.dp-numero-field label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--rouge); white-space: nowrap; }
.dp-numero-input {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  border: 1px solid var(--g4); padding: 5px 8px; flex: 1; outline: none; border-radius: 0;
}
.dp-numero-input:focus { border-color: var(--noir); }

.dp-note-field { margin-top: 1rem; }
.dp-note-field label { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--g2); display: block; margin-bottom: .35rem; font-weight: 500; }
.dp-note-textarea {
  font-family: var(--mono); font-size: 11px; border: 1px solid var(--g4);
  padding: 8px; width: 100%; min-height: 70px; resize: vertical; outline: none; border-radius: 0;
  background: var(--blanc);
}
.dp-note-textarea:focus { border-color: var(--noir); }
.dp-edit-inp { font-family: var(--mono); font-size: 11px; border: 1px solid var(--g4); padding: 3px 6px; background: var(--blanc); width: 100%; outline: none; text-align: right; }
.dp-edit-inp:focus { border-color: var(--noir); }
#dp-btn-save, #dp-btn-cancel { display: none; }
.edit-mode #dp-btn-edit { display: none; }
.edit-mode #dp-btn-save, .edit-mode #dp-btn-cancel { display: inline-flex; }

/* ── TAB : CORPUS ── */
.corpus-table { width: 100%; border-collapse: collapse; }
.corpus-tbl-wrap { overflow: auto; height: calc(100vh - 104px); }
.corpus-table th {
  font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: var(--rouge);
  padding: 9px 14px; border-bottom: var(--b); text-align: left; background: var(--blanc);
  white-space: nowrap; font-weight: 500; position: sticky; top: 0; z-index: 5;
}
.corpus-table td { border-bottom: var(--bl); padding: 9px 14px; vertical-align: middle; }
.corpus-table tbody tr { cursor: pointer; transition: background .1s; }
.corpus-table tbody tr:hover td { background: var(--g5); }
.corpus-num { font-size: 10px; color: var(--g4); font-family: var(--mono); }
.corpus-titre { font-size: 12px; font-weight: 500; }
.corpus-arch { font-size: 10px; color: var(--g3); }
.corpus-tag {
  font-size: 8px; letter-spacing: .06em; padding: 2px 5px;
  border: 1px solid var(--g4); color: var(--g3);
}
.corpus-publie { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; }
.corpus-publie.yes { color: var(--vert); }
.corpus-publie.no { color: var(--g4); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--bl); border-bottom: var(--b); }
.stat-cell { padding: 1.25rem 1.5rem; background: var(--blanc); }
.stat-n { font-size: 36px; font-weight: 300; letter-spacing: -.03em; line-height: 1; }
.stat-l { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--g3); margin-top: 4px; }

.empty-state { padding: 4rem 2rem; text-align: center; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--g3); }

::-webkit-scrollbar { width: 3px; } ::-webkit-scrollbar-thumb { background: var(--g4); }

.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
  font-family: var(--mono); font-size: 11px;
  padding: .75rem 1.25rem; background: var(--noir); color: var(--blanc);
  transform: translateY(60px); opacity: 0; transition: all .25s;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--vert); }
.toast.error { background: var(--rouge); }
