/* =====================================================================
   AOS - Feuille de style unique (page publique + back-office)
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --brand: #0f766e;
  --brand-text: #ffffff;
  --bg: #0b1220;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); line-height: 1.5; }
img { max-width: 100%; }
a { color: inherit; }

/* ---------------------------------------------------------------------
   PAGE PUBLIQUE
   --------------------------------------------------------------------- */

.page-public {
  min-height: 100vh;
  min-height: 100dvh;
  color: #e6edf7;
  background: var(--bg);
  background-image:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--brand) 55%, transparent) 0%, transparent 60%),
    radial-gradient(90% 50% at 100% 100%, color-mix(in srgb, var(--brand) 22%, transparent) 0%, transparent 70%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.hub {
  width: 100%;
  max-width: 520px;
  padding: 44px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.hub-head { text-align: center; }

.hub-logo {
  display: inline-block;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .16em;
  padding: 14px 26px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
}

.hub-logo-img { max-height: 96px; width: auto; }

.hub-sub {
  margin: 16px 0 0;
  font-size: 16px;
  color: rgba(230, 237, 247, .78);
}

.hub-links { display: flex; flex-direction: column; gap: 12px; }

.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 10px 25px rgba(2, 6, 23, .28);
  transition: transform .15s ease, box-shadow .15s ease;
  min-height: 68px;
}

.link-card:hover, .link-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(2, 6, 23, .38);
}
.link-card:active { transform: translateY(0); }

.link-badge {
  flex: 0 0 46px;
  width: 46px; height: 46px;
  border-radius: 13px;
  background: var(--card, var(--brand));
  color: var(--card-text, #fff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: .04em;
  overflow: hidden;
}
.link-badge img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }

.link-body { flex: 1 1 auto; min-width: 0; }
.link-title { display: block; font-weight: 650; font-size: 17px; }
.link-sub {
  display: block; font-size: 13.5px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-arrow { font-size: 26px; color: #cbd5e1; line-height: 1; }

.hub-empty {
  text-align: center; padding: 32px 20px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .08); border: 1px dashed rgba(255, 255, 255, .25);
}
.link-muted { color: rgba(230, 237, 247, .8); }

.hub-contact {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px;
  font-size: 14.5px;
}
.hub-contact a { color: rgba(230, 237, 247, .9); text-decoration: none; }
.hub-contact a:hover { text-decoration: underline; }

.hub-foot {
  margin-top: auto; padding-top: 12px; text-align: center;
  font-size: 13px; color: rgba(230, 237, 247, .55);
}
.hub-foot p { margin: 4px 0; }
.hub-foot-links a { color: inherit; text-decoration: none; }
.hub-foot-links a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
   BACK-OFFICE
   --------------------------------------------------------------------- */

.page-admin {
  background: #f1f5f9;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar { background: #0f172a; color: #e2e8f0; }
.topbar-in {
  max-width: 1040px; margin: 0 auto; padding: 12px 20px;
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center;
}
.topbar-brand {
  font-weight: 800; letter-spacing: .1em; text-decoration: none; font-size: 17px;
}
.topbar-brand span {
  font-size: 11px; letter-spacing: .18em; opacity: .6; text-transform: uppercase;
}
.topbar-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.topbar-nav a {
  text-decoration: none; padding: 7px 12px; border-radius: 9px;
  font-size: 14.5px; color: #cbd5e1;
}
.topbar-nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.topbar-nav a.is-active { background: rgba(255, 255, 255, .16); color: #fff; }

.wrap { max-width: 1040px; width: 100%; margin: 0 auto; padding: 24px 20px 48px; flex: 1; }

.page-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 24px; }
.muted { color: var(--ink-soft); font-size: 14px; margin: 4px 0 0; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.card.empty { text-align: center; padding: 40px 20px; }

.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); margin: 4px 0 14px; }

/* Statistiques */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.stat {
  flex: 1 1 120px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.stat-num { display: block; font-size: 24px; font-weight: 700; }
.stat-lbl { font-size: 13px; color: var(--ink-soft); }

/* Tableau */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); padding: 0 10px 10px;
}
.table td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.row-off { opacity: .55; }
.col-order, .col-clicks, .col-state { white-space: nowrap; width: 1%; }
.col-actions { white-space: nowrap; width: 1%; text-align: right; }

.cell-link { display: flex; align-items: center; gap: 12px; }
.badge-sm {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; overflow: hidden;
}
.badge-sm img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.url-line { font-size: 12.5px; }
.url-line a { color: var(--ink-soft); word-break: break-all; }

.inline-form { display: inline-flex; gap: 4px; margin: 0; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn-primary { background: #0f766e; color: #fff; }
.btn-primary:hover { background: #115e59; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 7px 11px; font-size: 13.5px; }
.btn-block { width: 100%; margin-top: 8px; }

.btn-icon {
  width: 30px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 13px; line-height: 1; color: var(--ink);
}
.btn-icon:hover:not(:disabled) { background: #f1f5f9; }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }

.pill {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-family: inherit;
  text-decoration: none; color: var(--ink);
}
.pill-on { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.pill-off { background: #f8fafc; color: #64748b; }

/* Formulaires */
.form-card { max-width: 660px; }
label { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="email"], input[type="file"] {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px;
  font-size: 15px; font-family: inherit; font-weight: 400; background: #fff; color: var(--ink);
}
input:focus { outline: 2px solid #0f766e; outline-offset: 1px; border-color: #0f766e; }
input[type="color"] {
  width: 64px; height: 40px; padding: 2px; margin-top: 6px;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; cursor: pointer;
}
.form-row { display: flex; flex-wrap: wrap; gap: 18px; }
.form-col { flex: 1 1 200px; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 500; }
.checkbox input { width: auto; margin: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: -6px 0 16px; }
.hint a { color: #0f766e; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

.logo-preview {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc;
}
.logo-preview img { max-height: 56px; max-width: 110px; }

/* Alertes */
.alert {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
  font-size: 14.5px; border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert a { color: inherit; font-weight: 600; }

/* Connexion / installation */
.auth-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px;
}
.auth-card { width: 100%; max-width: 420px; margin: 0; }
.auth-logo {
  margin: 0; text-align: center; font-size: 30px; letter-spacing: .16em; font-weight: 800;
}
.auth-sub {
  margin: 4px 0 22px; text-align: center; color: var(--ink-soft);
  font-size: 13px; text-transform: uppercase; letter-spacing: .12em;
}

/* Page QR */
.qr-grid { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.qr-preview { flex: 1 1 340px; text-align: center; }
.qr-preview img {
  width: 320px; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.qr-side { flex: 1 1 340px; }
.qr-target { font-size: 13.5px; color: var(--ink-soft); word-break: break-all; margin: 12px 0; }
.qr-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 6px; }
.ec-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.tips { margin: 0; padding-left: 18px; font-size: 14px; color: #334155; }
.tips li { margin-bottom: 7px; }

.admin-foot {
  text-align: center; font-size: 13px; color: var(--ink-soft); padding: 0 20px 28px;
}

@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 6px 0; width: auto; white-space: normal; text-align: left; }
  .col-clicks::before { content: "Clics : "; color: var(--ink-soft); font-size: 13px; }
  .col-actions { display: flex; gap: 8px; }
  .page-head { align-items: stretch; }
}

/* Page de vérification */
.pill-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.pill-ko   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.check-table td { vertical-align: top; }
.check-state { width: 1%; white-space: nowrap; padding-right: 14px; }
.check-fix {
  margin-top: 6px; font-size: 13.5px; color: #334155;
  background: #f8fafc; border-left: 3px solid #cbd5e1;
  padding: 8px 12px; border-radius: 0 8px 8px 0;
}
/* Encadré d'aide du back-office */
.help { margin-bottom: 18px; }
.help summary {
  cursor: pointer; font-weight: 600; font-size: 14.5px;
  padding: 12px 16px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; list-style: none;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: "? "; color: #0f766e; font-weight: 800; }
.help[open] summary { border-radius: 12px 12px 0 0; border-bottom: 0; }
.help-body {
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px;
  background: #fff; padding: 4px 20px 16px;
}
.help-body ol { margin: 10px 0; padding-left: 20px; font-size: 14.5px; color: #334155; }
.help-body li { margin-bottom: 8px; }
.identifiant-box {
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px;
  padding: 16px 18px; margin: 16px 0; font-size: 15px;
}
.identifiant-box strong { font-size: 18px; }

/* Carte de connexion : espace le lien de retour du bouton */
.auth-card .btn-block + .btn-block { margin-top: 10px; }
.auth-card .hint { margin: 24px 0 0; text-align: center; }
.auth-card form { margin-bottom: 0; }
