/* =========================================================
   Espace équipe – Publier un tract
   ========================================================= */
body.admin { background: var(--bg-soft); }
.admin .header-inner { justify-content: space-between; }
.admin-back { margin-left: auto; padding: .65em 1.2em; font-size: .88rem; }
.admin .brand-text span { display: block !important; }

.admin-main { padding: clamp(32px, 5vw, 56px) 0 80px; }
.admin-container { max-width: 880px; }
.admin-head { margin-bottom: 28px; }
.admin-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); color: var(--blue-deep); }

.panel {
  background: #fff; border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow-sm); padding: clamp(20px, 4vw, 32px); margin-bottom: 24px;
}
.panel h2 { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; color: var(--blue-deep); margin-bottom: 16px; }
.panel-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); flex: none; }
.panel-ico .i { width: 21px; height: 21px; }
.panel-ico-pink { background: var(--pink-soft); color: var(--pink-ink); }
.panel-ico-teal { background: var(--teal-soft); color: var(--teal-ink); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin-bottom: 0; }

/* Champs */
.field { margin-bottom: 18px; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 16px; }
.field label, .field .label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 6px; font-size: .95rem; }
.req { color: var(--pink-ink); }
.opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
.field input[type="text"], .field input[type="password"], .field input[type="date"], .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue-mid); box-shadow: 0 0 0 4px rgba(38, 105, 178, .15); }
.field.has-error input, .field.has-error textarea, .field.has-error .dropzone { border-color: var(--pink); }
.hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: .94rem; color: var(--text); margin-bottom: 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.login-form { max-width: 520px; }

/* Zone de dépôt */
.dropzone {
  position: relative; display: block; border: 2px dashed #c7d1e4; border-radius: var(--radius);
  background: var(--bg-soft); cursor: pointer; transition: border-color .2s ease, background-color .2s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--blue-mid); background: var(--blue-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone:focus-within { outline: 3px solid var(--yellow); outline-offset: 3px; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; text-align: center; color: var(--muted); font-size: .9rem; }
.dz-empty .i { width: 38px; height: 38px; color: var(--blue-mid); margin-bottom: 4px; }
.dz-empty strong { color: var(--ink); font-size: 1rem; }
.dz-file { display: flex; align-items: center; gap: 18px; padding: 16px; }
.dz-thumb { display: grid; place-items: center; width: 92px; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--line); flex: none; box-shadow: var(--shadow-sm); }
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.dz-thumb .i { width: 34px; height: 34px; color: var(--blue); }
.dz-thumb-video { width: 128px; aspect-ratio: 16 / 10; background: var(--blue-deep); }
.dz-thumb-video img { object-fit: contain; object-position: center; background: #000; }
.dz-thumb-video .i { color: #fff; }
#video-remove { padding: 0 0 0 4px; font-size: .82rem; }
.dz-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dz-meta strong { color: var(--ink); overflow-wrap: anywhere; }
.dz-meta > span { color: var(--muted); font-size: .86rem; }
.dz-meta .dz-change { color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-top: 6px; }

.form-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

/* Messages */
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: .95rem; line-height: 1.5; border: 1px solid; }
.notice .i { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.notice p { margin: 0; }
.notice a { font-weight: 700; }
.notice-info { background: var(--blue-soft); border-color: #c9dbf2; color: var(--blue-deep); }
.notice-success { background: var(--teal-soft); border-color: #b5e6de; color: #04564e; }
.notice-error { background: var(--pink-soft); border-color: #f6c3cf; color: #8e1d38; }

.whoami { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; font-size: .92rem; color: var(--muted); }
.whoami .i { color: var(--teal-ink); }
.whoami strong { color: var(--ink); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--blue); background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--blue-deep); }

/* Liste des tracts publiés */
.admin-list { display: grid; gap: 12px; margin-top: 12px; }
.admin-list .empty { padding: 18px; text-align: center; color: var(--muted); background: var(--bg-soft); border-radius: var(--radius-sm); }
.admin-item { display: flex; align-items: center; gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-item-thumb { display: grid; place-items: center; width: 58px; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--blue); color: var(--yellow); flex: none; }
.admin-item-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; background: #fff; }
.admin-item-thumb .i { width: 26px; height: 26px; }
.admin-item-txt { flex: 1; min-width: 0; }
.admin-item-txt strong { display: block; color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; }
.admin-item-txt span { font-size: .84rem; color: var(--muted); }
.admin-item-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.btn-danger { color: var(--pink-ink); }
.btn-danger:hover { color: #8e1d38; }

.whoami-actions { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }

.setup-tips { margin: 0 0 20px; padding-left: 20px; list-style: disc; display: grid; gap: 6px; font-size: .94rem; }

.help { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.help summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.help summary span { font-weight: 400; color: var(--muted); }
.help ol { margin: 14px 0 0; padding-left: 22px; list-style: decimal; display: grid; gap: 8px; font-size: .94rem; }
.help code { background: var(--bg-soft); padding: 1px 6px; border-radius: 6px; font-size: .88em; }

@media (max-width: 600px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .admin-back { padding: .6em .9em; font-size: .82rem; }
  .admin .brand-text span { display: none !important; }
  .form-actions .btn { width: 100%; }
  .admin-item { flex-wrap: wrap; }
  .admin-item-actions { width: 100%; justify-content: flex-end; }
}

/* =========================================================
   Onglets « Tracts » / « Statistiques du site »
   ========================================================= */
.admin-container.is-wide { max-width: 1120px; }
.tabs { display: flex; gap: 6px; margin-bottom: 22px; padding: 5px; background: #fff; border: 1px solid var(--line); border-radius: 999px; width: max-content; max-width: 100%; box-shadow: var(--shadow-sm); }
.tab { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .94rem; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.tab:hover { color: var(--blue-deep); background: var(--bg-soft); }
.tab.is-active { background: var(--blue); color: #fff; }
.tab:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.panel-intro { margin: 0 0 18px; color: var(--muted); }

/* =========================================================
   Tableau de bord des statistiques
   ========================================================= */
.stats-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.seg-btn { font: inherit; font-size: .88rem; font-weight: 600; color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 7px 14px; cursor: pointer; }
.seg-btn:hover { color: var(--blue-deep); background: var(--bg-soft); }
.seg-btn.is-active { background: var(--blue-soft); color: var(--blue-deep); box-shadow: inset 0 0 0 1px #c9dbf2; }
.seg-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.stats-updated { margin-left: auto; font-size: .84rem; color: var(--muted); }
#stats-dash.is-loading .stats-tiles, #stats-dash.is-loading .panel { opacity: .55; transition: opacity .2s ease; }

/* Chiffres clés */
.stats-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stile p { margin: 0; }
.stile-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.stile-value { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stile-sub { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.stile-hero { background: linear-gradient(150deg, var(--blue), var(--blue-deep)); border-color: transparent; }
.stile-hero .stile-label, .stile-hero .stile-sub { color: rgba(255, 255, 255, .8); }
.stile-hero .stile-value { color: #fff; font-size: 2.3rem; }

.panel .stats-h { font-size: 1.08rem; margin-bottom: 14px; }
.stats-empty { margin: 0; padding: 22px; text-align: center; color: var(--muted); background: var(--bg-soft); border-radius: var(--radius-sm); font-size: .92rem; }

/* Histogramme en colonnes */
.vc-plot { position: relative; height: 240px; margin: 12px 0 34px 36px; }
.vc-grid { position: absolute; inset: 0; pointer-events: none; }
.vc-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.vc-line:last-child { border-top-color: #c7d1e4; }
.vc-tick { position: absolute; right: calc(100% + 8px); top: -.65em; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vc-cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.vc-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 4px 4px 0 0; background: none; cursor: default; display: flex; align-items: flex-end; justify-content: center; }
.vc-col:hover { background: rgba(38, 105, 178, .06); }
.vc-col:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }
.vc-bar { display: block; width: 100%; max-width: 24px; background: var(--blue-mid); border-radius: 4px 4px 0 0; }
.vc-col:hover .vc-bar, .vc-col:focus-visible .vc-bar { background: var(--blue); }
.vc-peak { position: absolute; left: 50%; transform: translate(-50%, -4px); font-size: .74rem; font-weight: 700; color: var(--ink); white-space: nowrap; pointer-events: none; }
.vc-x { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--muted); white-space: nowrap; pointer-events: none; }
.vc-tip { position: absolute; transform: translateX(-50%); z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--ink); color: #fff; border-radius: 10px; font-size: .8rem; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow); pointer-events: none; }
.vc-tip strong { font-size: .9rem; }
.vc-tip span { color: rgba(255, 255, 255, .8); }
.vc-table summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--blue); }
.vc-table table { margin-top: 10px; border-collapse: collapse; font-size: .86rem; min-width: 280px; }
.vc-table th, .vc-table td { text-align: left; padding: 5px 14px 5px 0; border-bottom: 1px solid var(--line); }
.vc-table td:last-child, .vc-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Listes de barres */
.stats-grid { columns: 2; column-gap: 24px; }
.stats-grid > .panel { break-inside: avoid; }
.blist { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.bl-row { display: grid; grid-template-columns: minmax(0, 13.5em) minmax(48px, 1fr) auto; align-items: center; gap: 12px; padding: 5px 0; font-size: .9rem; }
.bl-label { color: var(--text); line-height: 1.3; overflow-wrap: anywhere; }
.bl-track { display: block; height: 14px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.bl-bar { display: block; height: 100%; background: var(--blue-mid); border-radius: 0 4px 4px 0; }
.bl-val { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 6px; min-width: 6.4em; font-variant-numeric: tabular-nums; }
.bl-val b { color: var(--ink); font-weight: 700; }
.bl-val small { color: var(--muted); font-size: .8rem; min-width: 3.2em; text-align: right; }
.bl-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bl-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.bl-note { font-size: .86rem; color: var(--muted); padding: 4px 0; }

.stats-foot { padding: 18px 20px; border-radius: var(--radius-sm); background: #fff; border: 1px dashed #c7d1e4; font-size: .9rem; color: var(--muted); }
.stats-foot p { margin: 0 0 12px; }
.stats-foot .check { margin-bottom: 8px; }
.stats-foot .stats-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; margin: 0; }
.stats-links a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; }

@media (max-width: 1000px) {
  .stats-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stile-hero { grid-column: 1 / -1; }
  .stats-grid { columns: 1; }
}
@media (max-width: 600px) {
  .tabs { width: 100%; }
  .tab { flex: 1 1 0; justify-content: center; padding: 9px 10px; font-size: .88rem; }
  .tab-long { display: none; }
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .stats-updated { margin-left: 0; flex: 1; }
  .stile { padding: 14px; }
  .stile-value { font-size: 1.45rem; }
  .stile-hero .stile-value { font-size: 2rem; }
  .vc-plot { height: 190px; }
  .bl-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .bl-track { grid-column: 1 / -1; grid-row: 2; height: 10px; }
}
