/* Flow CMS : barre noire + jaune FlowBelgium, l'aperçu de la page prend toute la place. */
:root {
  --ink: #0A0A0A; --ink-2: #1C1C1E; --line-dark: #2C2C2F; --on-ink: #F5F5F4; --muted-dark: #A1A1A6;
  --bg: #E6E7E9; --surface: #FFFFFF; --text: #131316; --muted: #5E6068; --line: #D6D7DB;
  --accent: #FACC15; --ok: #16A34A; --warn: #D97706; --bad: #DC2626;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 var(--body); color: var(--text); background: var(--bg); display: flex; flex-direction: column; }
button, select, input, textarea { font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--accent); margin: 0 1px; }

.bar { background: var(--ink); color: var(--on-ink); display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.sites { display: flex; gap: 2px; background: var(--ink-2); border-radius: 10px; padding: 3px; }
.sites button { background: none; border: 0; color: var(--muted-dark); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.sites button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }
.pagepick { display: flex; align-items: center; gap: 6px; flex: 1 1 220px; min-width: 0; }
.pagepick select { flex: 1; min-width: 0; background: var(--ink-2); color: var(--on-ink); border: 1px solid var(--line-dark); border-radius: 8px; padding: 7px 10px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ghost { background: none; border: 1px solid var(--line-dark); color: var(--on-ink); border-radius: 8px; padding: 7px 11px; cursor: pointer; text-decoration: none; }
.ghost:hover { border-color: var(--muted-dark); }
.ghost[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.ghost:disabled { opacity: .4; cursor: default; }
.btn { border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--ink); }
.btn.primary:disabled { opacity: .45; cursor: default; }
.btn.plain { background: #EDEDEF; color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
#count { display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 5px; border-radius: 99px; background: var(--ink); color: var(--accent); font-size: .8rem; text-align: center; }

.status { display: flex; align-items: center; gap: 10px; padding: 8px max(16px, env(safe-area-inset-left)); background: #FFFBEB; border-bottom: 1px solid #F5E1A4; font-weight: 600; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); animation: pulse 1.2s infinite; }
.status[data-state="live"] { background: #ECFDF3; border-color: #B7E4C7; }
.status[data-state="live"] .dot { background: var(--ok); animation: none; }
.status[data-state="error"] { background: #FEF2F2; border-color: #F5C2C2; }
.status[data-state="error"] .dot { background: var(--bad); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px max(16px, env(safe-area-inset-left)) 16px; padding-right: max(16px, env(safe-area-inset-right)); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: .88rem; }
.frame-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; }
#frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 12px 40px -24px rgba(0,0,0,.35); transition: width .25s; }
.phone #frame { width: 390px; max-width: 100%; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%); background: var(--surface); box-shadow: -20px 0 50px -30px rgba(0,0,0,.4);
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; z-index: 20; display: flex; flex-direction: column; gap: 10px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer h2, .modal h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; margin: 0; }
.drawer .ghost { color: var(--text); border-color: var(--line); }
.drawer label { font-weight: 600; display: flex; justify-content: space-between; margin-top: 6px; }
.drawer input, .drawer textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--text); }
.cnt { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.cnt.over { color: var(--bad); font-weight: 600; }
.note { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.gprev { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; font-family: Arial, sans-serif; }
.gprev span { color: #202124; font-size: .8rem; overflow-wrap: anywhere; }
.gprev b { color: #1a0dab; font-weight: 400; font-size: 1.12rem; line-height: 1.3; }
.gprev p { margin: 0; color: #4d5156; font-size: .86rem; }

.drawer.wide { width: min(760px, 100%); }
.drawer h3 { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin: 14px 0 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.stats span:first-child { color: var(--muted); font-size: .8rem; }
.stats b { font-family: var(--display); font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.up { color: var(--ok); font-weight: 600; } .down { color: var(--bad); font-weight: 600; } .flat { color: var(--muted); }
/* ── mise en page : menu à gauche + contenu ── */
body.app { flex-direction: row; }
.side { width: 236px; flex: none; background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); padding-left: max(12px, env(safe-area-inset-left)); overflow-y: auto; }
.side .brand { padding: 2px 8px 10px; }
.side-label { margin: 10px 8px 2px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-dark); }
.side .sites { flex-direction: column; background: none; padding: 0; gap: 2px; }
.side .sites button { text-align: left; padding: 8px 10px; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu button { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--on-ink); padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 600; }
.menu button:hover { background: var(--ink-2); }
.menu button[aria-current="page"] { background: var(--ink-2); box-shadow: inset 3px 0 0 var(--accent); }
.menu .ico { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--ink-2); color: var(--accent); font-size: .8rem; flex: none; }
.badge { margin-left: auto; min-width: 1.5em; padding: 0 6px; border-radius: 99px; background: var(--warn); color: #fff; font-size: .75rem; text-align: center; }
.badge.hot { background: var(--bad); }
.side-out { margin-top: auto; background: none; border: 1px solid var(--line-dark); color: var(--muted-dark); border-radius: 8px; padding: 8px; cursor: pointer; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view.page { display: block; overflow-y: auto; padding: 22px max(16px, env(safe-area-inset-right)) 40px max(16px, 2vw); }
.view.page > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.view[hidden] { display: none !important; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: 1.7rem; margin: 0; margin-right: auto; }
.view h3 { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin: 22px 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.card.warn { border-left-color: var(--warn); } .card.bad { border-left-color: var(--bad); }
.card h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.card p { margin: 0; overflow-wrap: anywhere; }
.card .cur { font-size: .88rem; color: var(--muted); }
.card .btn { justify-self: start; }
.card-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: #EDEDEF; color: var(--muted); }
.tag.bad { background: #FEE2E2; color: #991B1B; } .tag.warn { background: #FEF3C7; color: #92400E; }
.tag.good { background: #DCFCE7; color: #166534; } .tag.info { background: #E0E7FF; color: #3730A3; }
.issues, .alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issues li, .alerts li { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.alerts li { align-items: flex-start; }
.alerts li > div { flex: 1; min-width: 0; }
.alerts li .btn { flex: none; }
.card.warn, .card.bad, .issues li.warn, .issues li.bad, .issues li.good, .issues li.info,
.alerts li.warn, .alerts li.bad, .alerts li.good, .alerts li.info { color: var(--text); font-weight: 400; }
.card .warn { color: var(--warn); font-weight: 600; }
.mini { margin: 0; padding-left: 16px; font-size: .84rem; }
.mini li.bad { color: #991B1B; font-weight: 600; } .mini li.warn { color: #92400E; } .mini li.info { color: var(--muted); }
.tbl table.check td { font-size: .86rem; white-space: normal; overflow-wrap: anywhere; }
.tbl table.check td:first-child { width: 22%; } .tbl table.check td:nth-child(2) { white-space: nowrap; }
.tbl table.check td:nth-child(3) { width: 30%; }
.tbl table.check td:last-child { width: 1%; white-space: nowrap; overflow-wrap: normal; }
.okmsg { background: #ECFDF3; border: 1px solid #B7E4C7; border-radius: 10px; padding: 14px; font-weight: 600; color: #166534; }
.drawer #seo-tip { background: #FFFBEB; border: 1px solid #F5E1A4; border-radius: 8px; padding: 10px; color: var(--text); }
@media (max-width: 860px) {
  body.app { flex-direction: column; }
  .side { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px max(12px, env(safe-area-inset-left)); gap: 6px; overflow: visible; }
  .side .brand { padding: 0 6px 0 0; }
  .side-label { display: none; }
  .side .sites { flex-direction: row; }
  .menu { flex-direction: row; overflow-x: auto; width: 100%; }
  .menu button { white-space: nowrap; padding: 7px 9px; }
  .side-out { margin-top: 0; }
  .main { height: auto; flex: 1; min-height: 0; }
}
.overlay { position: fixed; inset: 0; z-index: 15; background: var(--bg); overflow-y: auto;
  padding: 18px max(16px, env(safe-area-inset-left)) calc(28px + env(safe-area-inset-bottom)); padding-right: max(16px, env(safe-area-inset-right)); }
.overlay > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.overlay-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.overlay-head h1 { font-family: var(--display); font-weight: 700; font-size: 1.7rem; margin: 0; margin-right: auto; }
.range { display: flex; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.range button { background: none; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.range button[aria-pressed="true"] { background: var(--ink); color: var(--accent); }
.sitecards { display: grid; gap: 16px; margin-top: 12px; }
.sitecard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 10px; min-width: 0; }
.sitecard header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sitecard h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; margin: 0; }
.sitecard .btn { justify-self: start; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.curve .marker { stroke: #CA8A04; stroke-width: 2; }
.curve .mtext { fill: #A16207; font-size: 10px; font-weight: 600; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.form { display: grid; gap: 6px; }
.form label { font-weight: 600; margin-top: 6px; }
.form select, .form textarea, .form input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; }
.sitecard header .tag { margin-left: 4px; }
.curves { display: grid; gap: 6px; }
.curve { margin: 0; }
.curve figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: .84rem; }
.curve figcaption span { color: var(--muted); font-variant-numeric: tabular-nums; }
.curve svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.curve .grid { stroke: #E7E8EB; stroke-width: 1; }
.curve .ytick { fill: var(--muted); font-size: 10px; text-anchor: end; font-variant-numeric: tabular-nums; }
.curve .xtick { fill: var(--muted); font-size: 10px; text-anchor: start; }
.curve .line { fill: none; stroke: #1D4ED8; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.curve .area { fill: #1D4ED8; opacity: .1; }
.curve .bar, .curve .pt { fill: #1D4ED8; }
.curve .cross { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.curve .dot { fill: #1D4ED8; stroke: #fff; stroke-width: 2; }
.curve .hit { fill: transparent; cursor: crosshair; }
.readout { margin: 0; font-size: .88rem; min-height: 1.4em; font-variant-numeric: tabular-nums; }
.tbl { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th, .tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.tbl td:nth-child(2), .tbl td:nth-child(3), .tbl td:nth-child(4) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.link { background: none; border: 0; padding: 0; color: #1d4ed8; text-decoration: underline; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
@media (max-width: 520px) { .stats { grid-template-columns: minmax(0, 1fr); } }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hist li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.hist .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .82rem; }
.hist ul { margin: 0; padding-left: 18px; font-size: .88rem; }
.pill { display: inline-block; border-radius: 99px; padding: 1px 8px; font-size: .76rem; font-weight: 600; background: #FEF3C7; color: #92400E; }
.pill.live { background: #DCFCE7; color: #166534; }
.pill.error { background: #FEE2E2; color: #991B1B; }
.pill.undone { background: #EDEDEF; color: var(--muted); }
.hist .undo { justify-self: start; margin-top: 4px; }

.modal { position: fixed; inset: 0; background: rgba(10,10,10,.5); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: 86vh; overflow-y: auto; padding: 22px; display: grid; gap: 14px; }
.modal-card ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.prob { border-left: 3px solid var(--warn); padding: 6px 10px; background: #FFFBEB; border-radius: 0 8px 8px 0; display: grid; gap: 4px; font-size: .9rem; }
.prob.bad { border-color: var(--bad); background: #FEF2F2; }
.prob label { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.imgbox { display: grid; gap: 10px; }
.imgbox img { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 8px; background: #f2f2f3; }
.warn { color: var(--warn); font-weight: 600; font-size: .9rem; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 10px; z-index: 40; max-width: calc(100% - 32px); }

body.login { display: grid; place-items: center; background: var(--ink); padding: 16px; }
.login-card { background: var(--surface); border-radius: 16px; padding: 28px; width: min(380px, 100%); display: grid; gap: 10px; }
.login-card .brand { color: var(--ink); font-size: 1.6rem; }
.login-card p { margin: 0; color: var(--muted); }
.login-card input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.login-card .err { color: var(--bad); font-weight: 600; min-height: 1.2em; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
