/* ═══════════════════════════════════════════════════════════
   Super Hub — Styles
   Palette : indigo / bleu foncé (distinct du amber des tenants)
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --accent:      #6366f1;   /* indigo-500 */
  --accent-dark: #4f46e5;   /* indigo-600 */
  --accent-light:#e0e7ff;   /* indigo-100 */
  --sidebar-bg:  #1e1b4b;   /* indigo-950 */
  --sidebar-txt: rgba(255,255,255,.75);
  --bg:          #f1f5f9;   /* slate-100  */
  --card-bg:     #ffffff;
  --text:        #0f172a;   /* slate-900  */
  --text-muted:  #64748b;   /* slate-500  */
  --border:      #e2e8f0;   /* slate-200  */
  --green:       #22c55e;
  --red:         #ef4444;
  --amber:       #f59e0b;
  --radius:      .75rem;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Layout ──────────────────────────────────────────── */

#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────── */

#sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  padding: 0 0 1rem;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: .5rem;
}
.sidebar-logo h1 {
  font-size: 1.1rem; font-weight: 700;
  color: #fff; letter-spacing: -.01em;
}
.sidebar-logo .badge-version {
  display: inline-block; margin-top: .25rem;
  font-size: .65rem; font-weight: 600;
  background: var(--accent); color: #fff;
  padding: .1rem .45rem; border-radius: 99px;
}

.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1.2rem;
  color: var(--sidebar-txt);
  cursor: pointer; border-radius: .4rem;
  margin: .05rem .5rem;
  transition: background .15s, color .15s;
  text-decoration: none; font-size: .88rem;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }

.sidebar-sep {
  height: 1px; background: rgba(255,255,255,.06);
  margin: .6rem 1rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: .8rem 1.2rem 0;
  font-size: .72rem;
  color: rgba(255,255,255,.3);
}

/* ── Main ────────────────────────────────────────────── */

#main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────── */

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.6rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-shrink: 0;
}
#topbar h2 { font-size: 1.05rem; font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: .6rem; }

#user-info {
  font-size: .8rem; color: var(--text-muted);
  display: flex; align-items: center; gap: .4rem;
}
#user-info span { font-weight: 500; color: var(--text); }

/* ── Content ─────────────────────────────────────────── */

#content {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 1.6rem;
}

/* ── Login screen ────────────────────────────────────── */

#loginScreen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--sidebar-bg);
}
.login-card {
  background: #fff; border-radius: var(--radius);
  padding: 2.2rem 2rem;
  width: 100%; max-width: 360px;
  box-shadow: var(--shadow-md);
}
.login-card .login-logo {
  text-align: center; margin-bottom: 1.5rem;
}
.login-card .login-logo h1 {
  font-size: 1.4rem; font-weight: 800;
  color: var(--sidebar-bg);
}
.login-card .login-logo p {
  color: var(--text-muted); font-size: .82rem; margin-top: .25rem;
}
.login-card .form-group { margin-bottom: 1rem; }
.login-card label { display: block; font-size: .8rem; font-weight: 500; margin-bottom: .35rem; color: var(--text-muted); }
.login-card input {
  width: 100%; padding: .55rem .75rem;
  border: 1.5px solid var(--border); border-radius: .5rem;
  font-size: .9rem; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--accent); }
#loginError {
  color: var(--red); font-size: .8rem;
  margin-bottom: .75rem; display: none;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: .45rem;
  font-size: .85rem; font-weight: 500;
  cursor: pointer; border: none; transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-success   { background: var(--green); color: #fff; }
.btn-sm        { padding: .3rem .7rem; font-size: .78rem; }
.btn-full      { width: 100%; justify-content: center; }

/* ── Cards / panels ──────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 1.2rem; }

/* ── KPI grid ────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.kpi-card .kpi-label {
  font-size: .75rem; font-weight: 500;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em;
  margin-bottom: .3rem;
}
.kpi-card .kpi-value {
  font-size: 1.8rem; font-weight: 700;
  color: var(--text); line-height: 1;
}
.kpi-card .kpi-sub {
  font-size: .75rem; color: var(--text-muted); margin-top: .3rem;
}

/* ── Table ───────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: .6rem .9rem;
  font-size: .75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.row-clickable { cursor: pointer; }

/* ── Badges ──────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-starter    { background: #e0e7ff; color: #4338ca; }
.badge-pro        { background: #fef3c7; color: #b45309; }
.badge-enterprise { background: #d1fae5; color: #065f46; }
.badge-actif   { background: #dcfce7; color: #15803d; }
.badge-inactif { background: #f1f5f9; color: #94a3b8; }
.badge-on  { background: #dcfce7; color: #15803d; }
.badge-off { background: #f1f5f9; color: #94a3b8; }

/* ── Detail panel ────────────────────────────────────── */

#detailPanel {
  position: fixed; top: 0; right: 0;
  width: 480px; height: 100vh;
  background: var(--card-bg);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  z-index: 200;
}
#detailPanel.open { transform: translateX(0); }

.dp-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.dp-header h3 { font-size: 1rem; font-weight: 600; }
.dp-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--text-muted); line-height: 1;
  padding: .2rem; border-radius: .3rem;
}
.dp-close:hover { background: var(--bg); }

.dp-body {
  flex: 1; overflow-y: auto; padding: 1.2rem;
  display: flex; flex-direction: column; gap: 1.2rem;
}

.dp-section h4 {
  font-size: .78rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: .65rem;
}

.info-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .9rem;
}
.info-row { display: flex; flex-direction: column; gap: .15rem; }
.info-row .label { font-size: .72rem; color: var(--text-muted); font-weight: 500; }
.info-row .value { font-size: .87rem; word-break: break-all; }

/* Module toggles */
.modules-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .45rem;
}
.module-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .65rem;
  border: 1.5px solid var(--border);
  border-radius: .5rem; cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .82rem;
}
.module-toggle:hover { border-color: var(--accent); }
.module-toggle.on { border-color: var(--accent); background: var(--accent-light); }
.module-toggle .mod-left { display: flex; align-items: center; gap: .4rem; }
.module-toggle .mod-icon { font-size: 1rem; }
.module-toggle .mod-name { font-size: .78rem; font-weight: 500; line-height: 1.2; }
.module-toggle .mod-plan { font-size: .68rem; color: var(--text-muted); }

/* Toggle switch */
.toggle-sw {
  width: 32px; height: 18px;
  background: #cbd5e1; border-radius: 99px;
  position: relative; flex-shrink: 0; transition: background .2s;
}
.toggle-sw::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.module-toggle.on .toggle-sw { background: var(--accent); }
.module-toggle.on .toggle-sw::after { left: 16px; }

/* Credits */
.credits-list { display: flex; flex-direction: column; gap: .5rem; }
.credit-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .65rem;
  border: 1px solid var(--border); border-radius: .5rem;
}
.credit-row .cr-mois { font-size: .82rem; font-weight: 500; width: 60px; flex-shrink: 0; }
.credit-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.credit-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.credit-bar.high { background: var(--red); }
.credit-row .cr-nums { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.credit-edit { background: none; border: none; cursor: pointer; font-size: .8rem; color: var(--text-muted); padding: .1rem .3rem; border-radius: .3rem; }
.credit-edit:hover { background: var(--bg); }

/* ── Modal ───────────────────────────────────────────── */

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-bg.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: var(--radius);
  width: 420px; max-width: 95vw;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.modal-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: .95rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--text-muted);
}
.modal-body { padding: 1.2rem; }
.modal-footer {
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .6rem;
}

/* ── Form fields ─────────────────────────────────────── */

.form-group { margin-bottom: .9rem; }
.form-group label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-bottom: .3rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: .5rem .75rem;
  border: 1.5px solid var(--border); border-radius: .45rem;
  font-size: .88rem; font-family: inherit; outline: none;
  transition: border-color .15s; background: #fff; color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ── Toast ───────────────────────────────────────────── */

#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: .65rem 1.1rem;
  border-radius: .5rem; font-size: .85rem;
  background: #1e1b4b; color: #fff;
  box-shadow: var(--shadow-md);
  z-index: 500;
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.error { background: var(--red); }

/* ── Empty state ─────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .88rem; }

/* ── Overlay ─────────────────────────────────────────── */

#panelOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.25); z-index: 150;
}
#panelOverlay.show { display: block; }

/* ── Search bar ──────────────────────────────────────── */

.search-bar {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: .45rem; padding: .38rem .75rem;
  flex: 1; max-width: 300px;
}
.search-bar input {
  border: none; background: transparent; outline: none;
  font-size: .88rem; color: var(--text); flex: 1;
}
.search-bar .icon { color: var(--text-muted); font-size: .9rem; }

/* ── Detail panel tabs ───────────────────────────────────── */

.dp-tabs {
  display: flex; gap: 0; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 .5rem;
  overflow-x: auto;
}
.dp-tab {
  background: none; border: none; cursor: pointer;
  padding: .6rem .7rem;
  font-size: .77rem; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.dp-tab:hover { color: var(--text); }
.dp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.dp-tab-content { display: none; }
.dp-tab-content.active { display: flex; flex-direction: column; gap: 1.1rem; }

/* ── Financial cards ─────────────────────────────────────── */

.fin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .75rem;
  margin-bottom: 1.5rem;
}
.fin-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: var(--shadow);
}
.fin-card .fin-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.fin-card .fin-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1; }
.fin-card .fin-sub   { font-size: .72rem; color: var(--text-muted); margin-top: .25rem; }
.fin-card.accent .fin-value { color: var(--accent); }
.fin-card.danger .fin-value { color: var(--red); }

/* ── Invoice table ───────────────────────────────────────── */

.badge-payee     { background: #dcfce7; color: #15803d; }
.badge-envoyee   { background: #dbeafe; color: #1d4ed8; }
.badge-retard    { background: #fee2e2; color: #dc2626; }
.badge-brouillon { background: #f1f5f9; color: #64748b; }
.badge-annulee   { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }

/* ── Admin list ──────────────────────────────────────────── */

.admin-list { display: flex; flex-direction: column; gap: .4rem; }
.admin-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem .75rem; border: 1px solid var(--border);
  border-radius: .5rem; gap: .6rem;
}
.admin-row .adm-left { display: flex; flex-direction: column; gap: .1rem; }
.admin-row .adm-name  { font-size: .87rem; font-weight: 500; }
.admin-row .adm-email { font-size: .75rem; color: var(--text-muted); }
.badge-proprietaire { background: #fef3c7; color: #b45309; }
.badge-admin        { background: #e0e7ff; color: #4338ca; }
.badge-utilisateur  { background: #f1f5f9; color: #64748b; }

/* ── Deploy steps ────────────────────────────────────────── */

.deploy-steps { display: flex; flex-direction: column; gap: .6rem; }
.deploy-step {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .7rem .9rem; border-radius: .5rem;
  border: 1px solid var(--border); background: var(--bg);
}
.deploy-step .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.deploy-step.done .step-num { background: var(--green); }
.deploy-step .step-title { font-size: .84rem; font-weight: 500; }
.deploy-step .step-desc  { font-size: .77rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Subscription card ───────────────────────────────────── */

.sub-card {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1.1rem;
}
.sub-card.actif { border-color: var(--accent); background: var(--accent-light); }
.sub-card .sub-plan  { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.sub-card .sub-price { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }
.sub-card .sub-meta  { font-size: .77rem; color: var(--text-muted); margin-top: .4rem; }

/* ── Copy box ────────────────────────────────────────────── */

.copy-box {
  background: #1e1b4b; color: #a5b4fc;
  border-radius: .45rem; padding: .65rem .9rem;
  font-family: monospace; font-size: .75rem;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  cursor: pointer; position: relative;
}
.copy-box:hover { opacity: .9; }

/* ── Topbar redesign ─────────────────────────────────────── */

.topbar-left {
  display: flex; align-items: center; gap: .75rem;
}
.topbar-hamburger {
  display: none; /* visible en mobile uniquement */
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--text-muted);
  padding: .25rem .4rem; border-radius: .4rem;
  line-height: 1; flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--bg); }

/* ── User avatar dropdown ────────────────────────────────── */

.user-menu-wrap { position: relative; }

.user-avatar-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .6rem;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: .5rem; cursor: pointer;
  font-size: .82rem; font-family: inherit; color: var(--text);
  transition: border-color .15s;
}
.user-avatar-btn:hover { border-color: var(--accent); }
.user-menu-wrap.open .user-avatar-btn { border-color: var(--accent); background: var(--accent-light); }

.user-avatar-circle {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-avatar-name { font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar-chevron { font-size: .65rem; color: var(--text-muted); }

.user-menu-drop {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 210px; background: #fff;
  border: 1.5px solid var(--border); border-radius: .65rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: .35rem;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .15s, transform .15s;
  z-index: 400;
}
.user-menu-drop.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.user-menu-drop button {
  display: block; width: 100%; text-align: left;
  padding: .5rem .75rem; border-radius: .4rem;
  background: none; border: none; cursor: pointer;
  font-size: .83rem; font-family: inherit; color: var(--text);
}
.user-menu-drop button:hover { background: var(--bg); }
.drop-sep { height: 1px; background: var(--border); margin: .3rem .2rem; }
.drop-logout { color: var(--red) !important; }
.drop-logout:hover { background: #fee2e2 !important; }

/* ── Ping status dot ─────────────────────────────────────── */

.ping-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; vertical-align: middle; margin-left: .4rem;
}
.ping-ok  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.ping-err { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); }

.ping-result-ok {
  background: #f0fdf4; border: 1.5px solid #86efac;
  border-radius: .5rem; padding: .75rem 1rem;
}

/* ── Section dark header ─────────────────────────────────── */

.sh-section-head {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  padding: 1.1rem 1.6rem;
  margin: -1.5rem -1.6rem 0;
}
.sh-head-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  background: rgba(255,255,255,.12); border-radius: .6rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.sh-head-text { flex: 1; min-width: 0; }
.sh-head-title { font-size: 1.1rem; font-weight: 700; color: #fff; }
.sh-head-sub   { font-size: .75rem; color: rgba(255,255,255,.6); margin-top: 2px; }
.sh-head-actions { flex-shrink: 0; }

/* Content padding wrapper (after section head) */
.sh-content-pad { padding-top: 1.5rem; }

/* Search toolbar */
.sh-toolbar {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}

/* ── Sidebar overlay (mobile) ────────────────────────────── */

#sidebarOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 240;
}
#app.sidebar-open #sidebarOverlay { display: block; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Sidebar : overlay slide-in au lieu de mini 56px */
  #sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    width: 230px;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 250;
  }
  #app.sidebar-open #sidebar { transform: translateX(0); }

  /* Remettre tout le texte de la sidebar */
  .nav-item span,
  .sidebar-logo h1,
  .sidebar-logo .badge-version,
  .sidebar-footer { display: revert; }

  /* Hamburger visible */
  .topbar-hamburger { display: flex; }

  /* Nom utilisateur masqué sur mobile */
  .user-avatar-name { display: none; }
  .user-menu-drop { right: 0; min-width: 190px; }

  /* Section head ajustements */
  .sh-section-head { margin: -1.5rem -1.6rem 0; padding: .8rem 1rem; gap: 10px; }
  .sh-head-icon { width: 34px; height: 34px; font-size: 1.1rem; }
  .sh-head-title { font-size: .92rem; }
  .sh-head-sub { display: none; }

  /* Content padding */
  #content { padding: 1.5rem 1rem; }
  .sh-section-head { margin: -1.5rem -1rem 0; }
  .sh-content-pad { padding-top: 1.2rem; }

  #detailPanel { width: 100vw; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .fin-grid { grid-template-columns: 1fr 1fr; }
  .modules-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .ver-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   WIZARD — Création hub (4 étapes)
   ════════════════════════════════════════════════════════════ */

.modal-wizard { max-width: 560px; }

/* Barre de progression */
.wizard-progress {
  display: flex;
  align-items: center;
  padding: .75rem 1.5rem .5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  gap: 0;
}
.wizard-step-ind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  cursor: default;
  user-select: none;
}
.wizard-step-ind span {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.wizard-step-ind.active span { color: var(--primary); }
.wizard-step-ind.done   span { color: #16a34a; }

.wiz-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  transition: all .2s;
}
.wizard-step-ind.active .wiz-dot {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.wizard-step-ind.done .wiz-dot {
  background: #16a34a;
  color: #fff;
}
.wizard-step-ind.done .wiz-dot::before {
  content: '✓';
}

.wizard-step-sep {
  height: 2px;
  flex: 1;
  background: #e2e8f0;
  margin: 0 4px;
  align-self: center;
  margin-bottom: 20px;
}
.wizard-step-ind.done + .wizard-step-sep { background: #16a34a; }

/* Panels */
.wizard-body { min-height: 260px; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

/* Info box */
.wiz-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: .6rem .9rem;
  font-size: .83rem;
  color: #1e40af;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.wiz-info-box code {
  background: rgba(30,64,175,.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .82rem;
}

/* Résultat test FTP */
.wiz-result {
  margin-top: 8px;
  padding: .5rem .8rem;
  border-radius: 6px;
  font-size: .83rem;
  font-weight: 500;
}
.wiz-result-loading { background: #f1f5f9; color: #64748b; }
.wiz-result-ok      { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.wiz-result-err     { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Log déploiement */
.wiz-deploy-log {
  background: #0f172a;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  max-height: 200px;
  overflow-y: auto;
}
.wiz-deploy-step {
  padding: 2px 0;
  color: #cbd5e1;
  line-height: 1.5;
}
.wiz-deploy-ok  { color: #4ade80; }
.wiz-deploy-err { color: #f87171; }

/* URL d'installation */
.wiz-install-url {
  margin-top: 10px;
  background: #1e293b;
  border-radius: 6px;
  padding: .6rem .8rem;
}
.wiz-install-label {
  font-size: .75rem;
  color: #94a3b8;
  margin-bottom: 5px;
}
.wiz-install-link {
  display: block;
  color: #818cf8;
  font-size: .72rem;
  word-break: break-all;
  margin-bottom: 6px;
  text-decoration: underline;
}
.wiz-install-link:hover { color: #a5b4fc; }

@media (max-width: 640px) {
  .wizard-step-ind span { display: none; }
  .wizard-progress { padding: .6rem 1rem .4rem; }
}

/* ── Branding tab ─────────────────────────────────────────── */

/* Ligne color picker + hex input + swatch */
.br-color-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.br-color-row input[type="color"] {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: .4rem;
  padding: 2px;
  cursor: pointer;
  background: var(--surface);
  flex-shrink: 0;
}
.br-color-row input[type="text"] {
  width: 90px;
  font-family: monospace;
  font-size: .84rem;
  padding: .3rem .45rem;
  border: 1.5px solid var(--border);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--text);
}

/* Swatch carré */
.br-swatch {
  width: 32px;
  height: 32px;
  border-radius: .35rem;
  border: 1.5px solid rgba(0,0,0,.12);
  flex-shrink: 0;
  transition: background .15s;
}

/* Aperçu palette */
.br-palette-preview {
  display: flex;
  gap: .6rem;
  margin: .85rem 0 .3rem;
}
.br-preview-block {
  flex: 1;
  border-radius: .5rem;
  padding: .65rem .7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  transition: background .15s;
  min-width: 0;
}
.br-preview-block small {
  font-size: .68rem;
  font-weight: 400;
  opacity: .85;
}

/* Note info re-déploiement */
.br-deploy-note {
  margin-top: 1.1rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: .45rem;
  padding: .65rem .85rem;
  font-size: .78rem;
  color: #92400e;
  line-height: 1.5;
}
