/* Plateforme badges — charte AB6 / Abscisse Sécurité Privée
   Aucune ressource externe : polices et images servies localement (CSP stricte). */

@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-Regular.62d08c41cefb.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-Medium.44abe77a1a45.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/Montserrat-Bold.5ce2f7a911f9.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --blue: #328EB1;
  --blue-dark: #236f8c;
  --blue-light: #e8f3f8;
  --yellow: #F2D62C;
  --yellow-light: #fdf8dc;
  --red: #DB0C19;
  --red-light: #fde8e9;
  --green: #1f8a4c;
  --green-light: #e5f4ec;
  --black: #000000;
  --text: #333333;
  --muted: #666666;
  --border: #c8c7c6;
  --border-light: #e4e3e2;
  --bg: #f6f6f5;
  --white: #ffffff;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.5;
}
a { color: var(--blue-dark); }
a:hover { color: var(--blue); }
h1, h2, h3 { color: var(--black); line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; margin-top: 1.5rem; }
h3 { font-size: 1rem; font-weight: 500; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .02em; }
.hidden { display: none !important; }

/* ---------- En-tête ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--border-light); }
.site-header .inner {
  max-width: 1200px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--black);
  border-left: 4px solid var(--blue); padding-left: .75rem; }
.brand img { height: 40px; width: auto; }
.brand .title { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.brand .title small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.main-nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.main-nav a { text-decoration: none; color: var(--text); padding: .45rem .75rem; border-radius: var(--radius); font-weight: 500; font-size: .9rem; }
.main-nav a:hover { background: var(--blue-light); color: var(--blue-dark); }
.main-nav a.active { background: var(--blue); color: var(--white); }
.user-box { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.user-box .who { text-align: right; line-height: 1.2; }
.user-box .who small { display: block; color: var(--muted); }
.user-box form { margin: 0; }

/* ---------- Contenu ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.card { background: var(--white); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > h2:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.narrow { max-width: 460px; margin: 2rem auto; }
.medium { max-width: 720px; }

/* ---------- Pied de page ---------- */
.site-footer { text-align: center; padding: 1rem; font-size: .75rem; color: var(--muted); background: var(--white); border-top: 1px solid var(--border-light); }
.tricolor { display: inline-flex; gap: 6px; margin-bottom: .35rem; }
.tricolor span { display: block; width: 26px; height: 6px; }
.tricolor .y { background: var(--yellow); }
.tricolor .b { background: var(--blue); }
.tricolor .r { background: var(--red); }

/* ---------- Boutons ---------- */
.btn, button, input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 500; font-size: .9rem; line-height: 1.2;
  padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--blue);
  background: var(--blue); color: var(--white); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--blue-dark); }
.btn-secondary:hover { background: var(--blue-light); color: var(--blue-dark); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #a90913; border-color: #a90913; }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-success:hover { background: #166b3a; border-color: #166b3a; }
.btn-link { background: none; border: none; color: var(--blue-dark); padding: .2rem .4rem; text-decoration: underline; }
.btn-link:hover { background: none; color: var(--blue); }
.btn-small { padding: .35rem .65rem; font-size: .8rem; }
.btn-block { width: 100%; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------- Formulaires ---------- */
form .field, form > div { margin-bottom: 1rem; }
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .3rem; color: var(--black); }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); color: var(--text);
}
input[type="file"] { font: inherit; font-size: .85rem; width: 100%; padding: .5rem; border: 1px dashed var(--border); border-radius: var(--radius); background: #fbfbfb; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.helptext, form .helptext { display: block; font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.helptext ul { margin: .25rem 0 0; padding-left: 1.1rem; }
ul.errorlist { list-style: none; margin: .3rem 0 0; padding: 0; color: var(--red); font-size: .85rem; font-weight: 500; }
ul.errorlist.nonfield { background: var(--red-light); border-left: 4px solid var(--red); padding: .6rem .8rem; margin-bottom: 1rem; }
input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--blue); vertical-align: middle; }
#id_sites div, #id_managers div, .checkbox-list div { margin: 0 0 .3rem; }
#id_sites label, #id_managers label { font-weight: 400; display: inline-flex; gap: .4rem; align-items: center; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.filters > div { margin: 0; min-width: 150px; flex: 1; }
.filters > div.btns { flex: 0 0 auto; min-width: 0; display: flex; gap: .5rem; }
.filters label { font-size: .78rem; color: var(--muted); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--white); }
th, td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
th { font-weight: 700; color: var(--black); background: #fafafa; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #fafcfd; }
td.num, th.num { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; font-size: .9rem; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; color: var(--black); font-weight: 500; }

/* ---------- Statuts ---------- */
.status { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.status-PENDING { background: var(--yellow-light); color: #7a6500; border: 1px solid var(--yellow); }
.status-VALIDATED { background: var(--green-light); color: var(--green); border: 1px solid #9fd3b5; }
.status-REJECTED { background: var(--red-light); color: var(--red); border: 1px solid #f3a3a8; }
.tag { display: inline-block; padding: .15rem .5rem; border-radius: var(--radius); font-size: .72rem; font-weight: 500; background: #eee; color: var(--muted); }
.tag-ok { background: var(--blue-light); color: var(--blue-dark); }
.tag-warn { background: var(--red-light); color: var(--red); }
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border-light); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: .55rem .9rem; color: var(--muted); font-weight: 500; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--blue-dark); border-bottom-color: var(--blue); }
.tabs .count { font-size: .75rem; background: #eee; border-radius: 999px; padding: .05rem .45rem; margin-left: .25rem; }

/* ---------- Messages ---------- */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.messages li { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; border-left: 4px solid var(--blue); background: var(--blue-light); }
.messages li.success { border-color: var(--green); background: var(--green-light); }
.messages li.error { border-color: var(--red); background: var(--red-light); }
.messages li.warning { border-color: var(--yellow); background: var(--yellow-light); }
.callout { padding: .9rem 1rem; border-radius: var(--radius); border-left: 4px solid var(--blue); background: var(--blue-light); margin-bottom: 1rem; }
.callout-danger { border-color: var(--red); background: var(--red-light); }
.callout-warning { border-color: var(--yellow); background: var(--yellow-light); }

/* ---------- Pièces ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.doc { border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--white); overflow: hidden; display: flex; flex-direction: column; }
.doc header { display: flex; justify-content: space-between; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--border-light); gap: .5rem; }
.doc header strong { font-size: .9rem; }
.doc .preview { background: #f2f2f2; min-height: 260px; display: flex; align-items: center; justify-content: center; }
.doc .preview img { max-width: 100%; max-height: 420px; display: block; }
.doc .preview iframe { width: 100%; height: 420px; border: 0; background: var(--white); }
.doc footer { padding: .5rem .8rem; font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.doc.missing .preview { color: var(--red); font-weight: 500; }

/* ---------- Divers ---------- */
.timeline { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.timeline li { padding: .4rem 0 .4rem 1rem; border-left: 2px solid var(--border-light); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: .75rem; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.qr { display: inline-block; background: var(--white); padding: .5rem; border: 1px solid var(--border-light); border-radius: var(--radius); }
.qr svg { display: block; width: 200px; height: 200px; }
.secret { font-size: 1.1rem; font-weight: 700; background: #f4f4f4; padding: .6rem .8rem; border-radius: var(--radius); display: inline-block; word-break: break-all; }
.credential { font-size: 1.35rem; font-weight: 700; background: var(--yellow-light); border: 1px dashed #c9b000; padding: .75rem 1rem; border-radius: var(--radius); display: inline-block; }
.pagination { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: 1rem; font-size: .85rem; }
.login-logo { display: block; margin: 0 auto 1rem; height: 64px; }
.center { text-align: center; }
.sticky-actions { position: sticky; bottom: 0; background: var(--white); border-top: 1px solid var(--border-light); padding: .75rem 0; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

@media (max-width: 720px) {
  .user-box .who { display: none; }
  .brand .title small { display: none; }
  th, td { padding: .5rem; }
  .doc .preview iframe { height: 300px; }
}
