/* Console administrateur i-WATT — interface de travail, sobre et dense. */
@font-face {
  font-family: "Manrope"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2");
}
:root {
  --night: #0A1F44; --blue: #0B3D91; --blue-2: #1A55C4; --blue-soft: #EAF0FB; --volt: #FFC21A;
  --ink: #111C31; --muted: #5A687D; --line: #E1E6EE; --bg: #F4F6F9; --card: #fff;
  --ok: #0E7A52; --ok-soft: #E2F3EB; --warn: #965800; --warn-soft: #FDF0DA; --bad: #BF3426; --bad-soft: #FBE9E7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 500 14px/1.45 "Manrope", system-ui, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 800; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* Structure */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--night); color: #C9D3E6; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; padding: 2px 8px 18px; }
.side .logo img { width: 30px; height: 30px; border-radius: 8px; }
.side .grp { font-size: 11.5px; color: #7F8FAD; margin: 16px 10px 6px; font-weight: 700; }
.side button { display: flex; width: 100%; align-items: center; gap: 10px; background: none; border: 0; color: inherit; padding: 9px 10px; border-radius: 9px; cursor: pointer; text-align: left; font-weight: 600; }
.side button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side button.on { background: rgba(255, 194, 26, .14); color: var(--volt); }
.side .ic { width: 18px; height: 18px; flex: 0 0 18px; }
.side .me { margin-top: 22px; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(244,246,249,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.content { padding: 20px 24px 60px; display: grid; gap: 16px; }
.content.with-preview { grid-template-columns: minmax(0, 1fr) 410px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* Champs */
label.f { display: grid; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
label.f .hint { font-weight: 500; color: var(--muted); }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; border: 1px solid #CDD5E1; border-radius: 9px; padding: 9px 11px; background: #fff; font-size: 14px;
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(26,85,196,.15); }
.color { display: flex; gap: 8px; align-items: center; }
.color input[type=color] { width: 42px; height: 38px; border: 1px solid #CDD5E1; border-radius: 9px; padding: 3px; background: #fff; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--blue); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 38px; height: 22px; appearance: none; background: #CDD5E1; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex: 0 0 38px; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }

/* Boutons */
.btn { border: 1px solid transparent; border-radius: 9px; padding: 9px 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; background: #fff; border-color: var(--line); }
.btn:hover { border-color: #B9C3D3; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.volt { background: var(--volt); color: #261C00; border-color: var(--volt); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .ic { width: 16px; height: 16px; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.icon-btn .ic { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 150px; }
.bars .b { background: var(--blue); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; }
.bars .b.zero { background: var(--line); }
.bars-x { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 6px; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid #EEF1F5; vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F7F9FC; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; background: #EEF1F5; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }

/* Éditeur de listes (cases, annonces, aide) */
.items { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #FBFCFE; }
.item.off { opacity: .6; }
.item-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.item-head .t { font-weight: 800; flex: 1; }
.item-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.4fr .8fr; gap: 10px; }

/* Aperçu */
.preview { position: sticky; top: 76px; }
.phone { width: 390px; height: 760px; border-radius: 34px; border: 10px solid #0D1424; overflow: hidden; background: #fff; box-shadow: 0 20px 50px -24px rgba(10,31,68,.45); }
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Bandeaux, messages */
.draftbar { display: flex; align-items: center; gap: 8px; background: var(--warn-soft); color: var(--warn); border-radius: 9px; padding: 6px 10px; font-weight: 700; font-size: 12.5px; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 600; white-space: pre-wrap; }
.note { background: var(--blue-soft); color: var(--blue); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 16px; background: var(--night); color: var(--volt); padding: 10px 14px; border-radius: 10px; display: inline-block; letter-spacing: .04em; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; z-index: 50; }
.timeline { display: grid; gap: 8px; }
.timeline div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 12.5px; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--night); padding: 20px; }
.login .box { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 28px; display: grid; gap: 14px; }
.login .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.login .brand img { width: 36px; height: 36px; border-radius: 10px; }

@media (max-width: 1280px) { .content.with-preview { grid-template-columns: 1fr; } .preview { position: static; } .phone { margin: 0 auto; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  .side .grp, .side .me { display: none; }
  .side button { width: auto; }
  .kpis, .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-grid { grid-template-columns: 1fr 1fr; }
  .phone { width: 100%; max-width: 390px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Fenêtre d'explications */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal-box { background: #fff; color: var(--ink); border-radius: 16px; padding: 24px; max-width: 560px; width: 100%; font-size: 16px; line-height: 1.55; }
.modal-box ol { padding-left: 22px; display: grid; gap: 6px; }

/* Publicités */
.tabs { margin-bottom: 4px; }
.thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; display: block; border: 1px solid var(--line); }
.thumb.wide { width: 72px; height: 36px; }
.thumb.empty { background: #EEF1F5; }
.logo-prev { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; background: #F7F9FC; flex: 0 0 76px; }
.logo-prev img { width: 100%; height: 100%; object-fit: cover; }
.adform-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.adform-grid .col { display: grid; gap: 12px; }
.adprev { position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; color: #111C31; max-width: 340px; }
.adprev .adlabel { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.adprev .adimg { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; display: block; }
.adprev .adbody { display: grid; gap: 4px; padding: 34px 14px 14px; font-size: 14px; }
.adprev .adimg + .adbody { padding-top: 12px; }
.adprev .adhead { display: flex; gap: 8px; align-items: center; color: #5A687D; font-weight: 700; font-size: 12.5px; }
.adprev .adlogo { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.adprev b { font-size: 16.5px; }
.adprev .adcta { justify-self: start; margin-top: 6px; background: #0B3D91; color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 13px; }
@media (max-width: 1100px) { .adform-grid { grid-template-columns: 1fr; } }
