/* WPAX WiFi — feuille de style commune (portail, espace client, admin) */

:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --s2: #f6f8f7;
  --s3: #eef2f0;
  --border: #dfe5e2;
  --border2: #cdd6d2;
  --text: #13201b;
  --text2: #55645e;
  --text3: #85928c;

  --accent: #0f766e;
  --accent-ink: #ffffff;
  --adim: #e3f3f1;
  --aglow: rgba(15, 118, 110, .18);

  --green: #15803d;  --gdim: #e8f6ec;
  --red: #c2410c;    --rdim: #fdeee6;
  --yellow: #a16207; --ydim: #fdf6dc;
  --orange: #c2410c; --odim: #fdeee6;
  --blue: #1d4ed8;   --bdim: #e8eefc;
  --purple: #7e22ce; --pdim: #f3e8fd;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 14px;
  --rs: 9px;
  --sh: 0 1px 2px rgba(16, 24, 20, .05), 0 6px 20px rgba(16, 24, 20, .06);
}

.theme-admin {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --s2: #f8f9fa;
  --s3: #eef0f3;
  --border: #e3e6ea;
  --border2: #d3d8de;
  --text: #16191d;
  --text2: #5b6470;
  --text3: #8a929c;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --adim: #e4f2f0;
  --aglow: rgba(15, 118, 110, .16);
  --sh: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --r: 12px;
  --rs: 8px;
  font-size: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1, .h1 { font-size: 1.55rem; font-weight: 750; letter-spacing: -.01em; }
h2, .h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--s3); padding: 2px 6px; border-radius: 6px; }
hr, .hr, .sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; height: 0; }

/* ---------- Mise en page ---------- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap, .container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 22px 16px 48px; }
.wrap.narrow { max-width: 560px; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.row, .navrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between, .between { justify-content: space-between; }
.row2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.right { text-align: right; }
.stack > * + * { margin-top: 12px; }

/* ---------- En-tête (espace client) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topinner {
  max-width: 1040px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand img { height: 34px; width: auto; }
.brand .title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand .title b { font-size: 15px; }
.brand .title span { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  color: var(--text2); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 11px; border-radius: 8px;
}
.nav a:hover { background: var(--s3); color: var(--text); }
.nav a.active { background: var(--adim); color: var(--accent); }
.nav a.logout { color: var(--red); }
@media (max-width: 720px) {
  .topinner { flex-wrap: wrap; }
  .nav { width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-title, .sectionTitle, .section-label {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3); margin: 0 0 10px;
}
.hero { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.kpi { font-size: 1.8rem; font-weight: 750; letter-spacing: -.02em; }

/* ---------- Texte ---------- */
.muted, .sub, .subtitle { color: var(--text2); }
.small, .mini { font-size: 13px; }
.tiny { font-size: 12px; }
.mini { color: var(--text2); background: var(--s2); border: 1px solid var(--border); border-radius: var(--rs); padding: 12px 14px; }
.title { font-weight: 750; }

/* ---------- Boutons ---------- */
.btn, button.btn, .btnlink, .btn2, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: 15px; line-height: 1.2;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; -webkit-appearance: none; appearance: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn { background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary, .btn2, .btnlink { background: var(--surface); color: var(--text); border-color: var(--border2); }
.btn.secondary:hover, .btn2:hover, .btnlink:hover { background: var(--s2); }
.btn-ghost, .btn.ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--s3); color: var(--text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block, .btn.full { width: 100%; }
.btn.sm, .btnlink.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.actions { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
label, .field > label { font-size: 13px; font-weight: 650; color: var(--text2); }
.input, .select, textarea, input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=search], input:not([type]), input[type=date], input[type=url], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border2); border-radius: 10px;
  padding: 11px 13px; -webkit-appearance: none; appearance: none;
}
select, .select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text2) 50%), linear-gradient(135deg, var(--text2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px;
}
textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--aglow);
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 500; color: var(--text); font-size: 15px; }
.check input { margin-top: 2px; flex: none; }

/* ---------- Messages ---------- */
.alert, .warn, .notice, .ok, .err, .alert-ok, .alert-warn, .msg {
  border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px;
  border: 1px solid var(--border); background: var(--s2);
}
.ok, .alert.ok, .alert-ok, .msg.ok { background: var(--gdim); border-color: color-mix(in srgb, var(--green) 35%, transparent); color: var(--green); }
.err, .alert.err, .msg.err { background: var(--rdim); border-color: color-mix(in srgb, var(--red) 35%, transparent); color: var(--red); }
.warn, .alert-warn, .alert.warn { background: var(--ydim); border-color: color-mix(in srgb, var(--yellow) 35%, transparent); color: var(--yellow); }
.notice, .alert.info { background: var(--bdim); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }

/* ---------- Pastilles ---------- */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 650; line-height: 1;
  padding: 5px 9px; border-radius: 999px;
  background: var(--s3); color: var(--text2); border: 1px solid var(--border);
  text-decoration: none; white-space: nowrap;
}
.pill.primary, .badge.primary, .badge.blue { background: var(--adim); color: var(--accent); border-color: transparent; }
.badge.green, .pill.ok { background: var(--gdim); color: var(--green); border-color: transparent; }
.pill.danger, .badge.red { background: var(--rdim); color: var(--red); border-color: transparent; }
.badge.yellow { background: var(--ydim); color: var(--yellow); border-color: transparent; }
.badge strong { color: var(--text); font-size: 13px; }

/* ---------- Tableaux / listes ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.list { display: flex; flex-direction: column; }
.list > .row, .list-row {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.list > .row:last-child { border-bottom: 0; }
.row-left { min-width: 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv > :nth-child(odd) { color: var(--text2); }

.code, .codeRow code {
  font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .08em;
  background: var(--s2); border: 1px dashed var(--border2); border-radius: 10px; padding: 8px 12px;
}
.codeRow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modale ---------- */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 16, 14, .55); padding: 18px; overflow-y: auto;
  align-items: flex-start; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 640px; margin-top: 6vh; background: var(--surface); border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-b { padding: 18px; max-height: 65vh; overflow-y: auto; color: var(--text2); }

/* ---------- Pages d'authentification ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--sh); overflow: hidden; }
.auth-head { padding: 26px 26px 6px; text-align: center; }
.auth-head .logo, .logo { height: 46px; width: auto; margin: 0 auto 12px; display: block; }
.auth-body { padding: 16px 26px 24px; }
.auth-foot, .footbox { padding: 14px 26px; border-top: 1px solid var(--border); background: var(--s2); font-size: 14px; color: var(--text2); text-align: center; }
.tabs { display: flex; gap: 4px; background: var(--s3); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button, .tabs a { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 7px; font: inherit; font-size: 14px; font-weight: 650; color: var(--text2); cursor: pointer; text-align: center; text-decoration: none; }
.tabs .on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Portail captif ---------- */
.portal { min-height: 100vh; background: var(--bg) center/cover no-repeat; }
.portal-shade { min-height: 100vh; padding: 18px 14px 40px; background: linear-gradient(180deg, rgba(8,20,17,.55), rgba(8,20,17,.35) 40%, rgba(8,20,17,.65)); }
.portal.plain .portal-shade { background: linear-gradient(160deg, #0f3d38 0%, #134e48 45%, #1d6b5f 100%); }
.portal-inner { max-width: 560px; margin: 0 auto; }
.portal-head { text-align: center; color: #fff; padding: 22px 6px 18px; }
.portal-head img { max-height: 76px; border-radius: 12px; margin-bottom: 10px; background: rgba(255,255,255,.9); padding: 6px; }
.portal-head h1 { font-size: 1.6rem; margin: 0 0 4px; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.portal-head p { margin: 0; opacity: .88; }
.portal .card { border: 0; }
.option { display: block; padding: 18px 20px; }
.option + .option { margin-top: 12px; }
.option h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 0 0 4px; }
.option .ico { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--adim); color: var(--accent); font-size: 17px; flex: none; }
.option form { margin: 12px 0 0; }
.plan-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.plan {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--s2);
}
.plan b { display: block; }
.plan .price { font-weight: 750; white-space: nowrap; }
.terms-box { font-size: 14px; color: var(--text2); background: var(--s2); border-radius: 10px; padding: 12px 14px; margin: 10px 0 12px; }
.portal-foot { text-align: center; color: rgba(255,255,255,.75); font-size: 12px; margin-top: 18px; }
.portal-foot a { color: #fff; }
.center-card { max-width: 440px; margin: 9vh auto 0; text-align: center; }
.big-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px; background: var(--adim); color: var(--accent); }
.big-ico.ok { background: var(--gdim); color: var(--green); border: 0; padding: 0; margin: 0 auto 14px; }
.big-ico.warn { background: var(--ydim); color: var(--yellow); border: 0; padding: 0; margin: 0 auto 14px; }
.big-ico.err { background: var(--rdim); color: var(--red); border: 0; padding: 0; margin: 0 auto 14px; }
.pair-code { font-family: var(--mono); font-size: 40px; font-weight: 800; letter-spacing: .25em; background: var(--s3); border-radius: 12px; padding: 14px; margin: 14px 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Divers ---------- */
.hide { display: none !important; }
.mt0 { margin-top: 0 !important; } .mb0 { margin-bottom: 0 !important; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.flex1 { flex: 1; }
.text-center { text-align: center; }

/* Anciennes classes encore produites par certaines pages du portail */
.info { background: var(--bdim); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.success-icon, .block-icon { font-size: 48px; line-height: 1; margin: 6px 0 12px; }

.portal .card.center, .portal-inner > .card:only-of-type { text-align: center; }
.portal .card > img:first-child { max-height: 64px; margin: 0 auto 10px; display: block; border-radius: 10px; }
.row2 > div > label { display: block; margin-bottom: 6px; }
.row2 > div { min-width: 0; }
.card > .head { text-align: center; margin-bottom: 14px; }
.card > .head .logo { margin-bottom: 8px; }
.card .body > form > div, .card form > .row { margin-bottom: 12px; }

/* ---------- Admin : menu latéral ---------- */
.adm { display: flex; min-height: 100vh; }
.adm-side {
  width: 236px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: #ffffff; border-right: 1px solid var(--border); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.adm-logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; color: var(--text); }
.adm-logo img { height: 30px; }
.adm-logo b { font-size: 15px; display: block; line-height: 1.1; }
.adm-logo span { font-size: 12px; color: var(--text3); }
.adm-group { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; padding: 14px 10px 4px; }
.adm-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text2); text-decoration: none; font-size: 14px; font-weight: 550;
}
.adm-link svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.adm-link:hover { background: var(--s3); color: var(--text); }
.adm-link.on { background: var(--adim); color: var(--accent); }
.adm-link.on svg { opacity: 1; }
.adm-user { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 10px 0; font-size: 12px; color: var(--text3); }
.adm-user b { display: block; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-user a { color: var(--text2); }
.adm-main { flex: 1; min-width: 0; }
.adm-mobile { display: none; }
.adm-main > .wrap, .adm-main > .container, .adm-main > .page { max-width: 1240px; }
@media (max-width: 900px) {
  .adm { display: block; }
  .adm-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 60; background: #fff; border-bottom: 1px solid var(--border); padding: 10px 14px;
  }
  .adm-mobile b { font-size: 15px; }
  .adm-side { position: fixed; z-index: 70; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 40px rgba(0,0,0,.15); }
  .adm.open .adm-side { transform: none; }
  .adm-veil { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 65; }
  .adm.open .adm-veil { display: block; }
}

/* ---------- Admin : composants ---------- */
.theme-admin .wrap { padding: 26px 28px 60px; max-width: 1240px; margin: 0; }
@media (max-width: 900px) { .theme-admin .wrap { padding: 18px 14px 40px; } }
.adm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.adm-head h1 { font-size: 1.45rem; margin: 0; }
.adm-head p { margin: 4px 0 0; color: var(--text2); }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px; }
.stat-card .lbl { font-size: 13px; color: var(--text2); font-weight: 600; }
.stat-card .val { font-size: 1.65rem; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-card .sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); }
.panel + .panel { margin-top: 18px; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-h h2 { font-size: 15px; margin: 0; }
.panel-b { padding: 16px 18px; }
.panel table td, .panel table th { padding: 10px 18px; }
.panel table tr:hover td { background: var(--s2); }
.cols { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cols { grid-template-columns: 3fr 2fr; } }
.cols > .panel + .panel { margin-top: 0; }
.empty { padding: 26px 18px; text-align: center; color: var(--text3); }
details.create { margin-bottom: 18px; }
details.create > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.create > summary::-webkit-details-marker { display: none; }
details.create[open] > summary { margin-bottom: 14px; }
details.adv > summary { cursor: pointer; color: var(--text2); font-weight: 600; font-size: 13px; margin: 6px 0 10px; }
.adm-mobile svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
