/**
 * EngineUI — thème principal (sidebar + zone de contenu)
 */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active: rgba(59, 130, 246, 0.22);
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-dim: #2563eb;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --err: #b91c1c;
  --err-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*,
*::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.55;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent-dim);
}

a:hover {
  color: var(--accent);
}

/* ——— App shell ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0 1rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  min-height: 100vh;
}

.sidebar-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

.sidebar-brand a {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  text-decoration: none;
}

.sidebar-brand a:hover {
  color: #fff;
  opacity: 0.92;
}

.sidebar-brand-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sidebar-muted);
  margin-top: 0.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.75rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 1rem 1.25rem 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  color: var(--sidebar-muted);
}

.sidebar-user {
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sidebar-user strong {
  color: var(--sidebar-text);
  font-weight: 600;
}

.sidebar-user .role {
  display: block;
  font-size: 0.8rem;
  color: var(--sidebar-muted);
  margin-top: 0.15rem;
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-footer button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.12s ease;
}

.sidebar-footer button:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Main column */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 1.75rem clamp(1rem, 2.5vw, 2.25rem) 2.5rem;
  max-width: 1200px;
  width: 100%;
}

/* Page Routes : toute la largeur utile derrière la barre latérale */
body:has(.routes-page) .app-shell {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

body:has(.routes-page) .main-area {
  min-height: 0;
  overflow: hidden;
}

.main-content:has(.routes-page) {
  max-width: none;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* Moins de marge latérale pour que le panneau droit suive mieux le bord de la fenêtre */
  padding: 1rem 1rem 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
  color: var(--text);
  line-height: 1.25;
}

main h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
}

/* Alerts */
.ok {
  color: var(--ok);
}

.err {
  color: var(--err);
}

p.ok,
p.err {
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  font-weight: 500;
}

p.ok {
  background: var(--ok-bg);
  border: 1px solid #a7f3d0;
}

p.err {
  background: var(--err-bg);
  border: 1px solid #fecaca;
}

.muted {
  color: var(--muted);
  font-size: 0.94rem;
}

/* Tables */
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.94rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.data th,
table.data td {
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
  text-align: left;
  vertical-align: top;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

table.data td a {
  font-weight: 500;
}

.srv-grid th {
  font-size: 0.8rem;
}

tr.route-sub td {
  background: #f8fafc;
  font-size: 0.9rem;
  border-top: none;
  padding-top: 0.35rem;
  padding-bottom: 0.65rem;
}

section.route-group {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

section.route-group:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

section.route-group h2 {
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

section.route-group .file-path {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
}

/* Forms */
form.padded label {
  display: block;
  margin-top: 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
}

form.padded label:first-of-type,
form.padded > label:first-child {
  margin-top: 0;
}

form.padded input[type="text"],
form.padded input[type="number"],
form.padded input[type="email"],
form.padded input[type="password"],
form.padded select,
form.padded textarea {
  width: 100%;
  max-width: 32rem;
  padding: 0.5rem 0.65rem;
  margin-top: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
}

form.padded input:focus,
form.padded select:focus,
form.padded textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

form.inline {
  display: inline;
}

/* Boutons sans classe (formulaires existants) */
button:not(.btn),
input[type="submit"]:not(.btn) {
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

button:not(.btn):hover,
input[type="submit"]:not(.btn):hover {
  background: #f8fafc;
}

button[type="submit"]:not(.btn),
input[type="submit"]:not(.btn) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}

button[type="submit"]:not(.btn):hover,
input[type="submit"]:not(.btn):hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

/* Système de boutons (.btn) — liens ou <button> */
a.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease,
    box-shadow 0.12s ease;
  box-shadow: none;
}

a.btn:hover,
button.btn:hover {
  text-decoration: none;
}

.btn--sm {
  padding: 0.32rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff !important;
}

.btn--primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff !important;
}

/* Toujours lisible sur fond clair (évite le « blanc sur blanc » jusqu’au survol) */
.btn--secondary {
  background: linear-gradient(180deg, #f1f5f9 0%, #e8edf4 100%);
  border-color: #94a3b8;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn--secondary:hover {
  background: linear-gradient(180deg, #e2e8f0 0%, #d8dee9 100%);
  border-color: #64748b;
  color: #0f172a !important;
}

/* Liens retour / secondaires : même principe (pas de fond transparent) */
.btn--ghost {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.btn--ghost:hover {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a !important;
}

.btn--danger {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger) !important;
}

.btn--danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b !important;
}

a.btn:focus-visible,
button.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Barres d’actions en haut / bas de page */
.page-toolbar {
  margin: 1rem 0 1.25rem;
}

.page-toolbar--footer {
  margin-top: 1.75rem;
  margin-bottom: 0;
}

.page-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.page-back {
  margin-top: 1.75rem;
}

/* Actions dans les tableaux */
.table-actions {
  white-space: nowrap;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.action-group-form {
  display: inline;
  margin: 0;
}

/* Grille défilante (longues listes sans casser les formulaires) */
.table-scroll {
  max-height: min(70vh, 28rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-scroll .data {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.table-scroll-hint {
  margin-bottom: 0.65rem !important;
  font-size: 0.9rem;
}

/* Pagination */
.pagination {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pagination-meta {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.pagination-meta strong {
  color: var(--text);
  font-weight: 600;
}

.pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pagination-current {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.35rem;
}

/* Routes — page compacte (toolbar + zone maître/détail) */
.routes-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.65rem;
}

.routes-page__title {
  margin-bottom: 0.25rem !important;
}

.routes-page__intro {
  margin: 0 0 0.15rem !important;
  font-size: 0.88rem !important;
  line-height: 1.4 !important;
  max-width: 70ch;
}

.routes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding: 0.45rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.routes-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.routes-toolbar__search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: min(100%, 12rem);
}

.routes-search-input {
  flex: 1;
  min-width: 8rem;
  max-width: none;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
}

.routes-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.routes-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  width: 100%;
}

.routes-list-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.routes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}

.routes-list-title {
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  min-width: 0;
}

.pagination-arrows {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.pagination-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.pagination-arrow:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent-dim);
}

.pagination-arrow--disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
  background: #f1f5f9;
}

.routes-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.routes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.routes-list-item {
  display: block;
  padding: 0.32rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.1s ease;
}

.routes-list-item:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.routes-list-item--active {
  background: #eff6ff;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.65rem - 3px);
}

.routes-list-item__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.routes-list-item__name {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.routes-list-item__count {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  line-height: 1.2;
}

.routes-detail-path {
  word-break: break-all;
  font-size: 0.85rem;
}

.routes-file-table {
  font-size: 0.88rem;
  table-layout: fixed;
  width: 100%;
}

.routes-file-table th,
.routes-file-table td {
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.routes-table-wrap {
  overflow-x: visible;
  max-width: 100%;
}

.routes-file-table code {
  word-break: break-all;
}

.routes-col-servers {
  font-size: 0.82rem;
  line-height: 1.4;
}

.routes-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem 1rem;
  overflow: hidden;
}

.routes-detail-panel .pagination {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  flex-shrink: 0;
}

.routes-detail-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.92rem;
  min-height: 8rem;
}

.routes-detail-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.routes-detail-sub {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.routes-detail-panel .routes-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.routes-detail-dl {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
}

.routes-detail-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.routes-detail-dl dd {
  margin: 0;
}

.routes-detail-actions {
  margin-top: 0.5rem;
}

@media (max-width: 960px) {
  .routes-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .routes-list-panel {
    max-height: min(42vh, 18rem);
    height: auto;
  }

  .routes-detail-panel {
    min-height: 12rem;
    max-height: none;
  }

  .routes-detail-dl {
    grid-template-columns: 1fr;
  }

  .routes-detail-dl dt {
    margin-top: 0.35rem;
  }

  .routes-detail-dl dt:first-child {
    margin-top: 0;
  }
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Danger / delete links */
a.danger,
table.data a[style*="color:#a00"],
table.data a.danger {
  color: var(--danger) !important;
  font-weight: 500;
}

a.danger:hover {
  text-decoration: underline;
}

/* Code */
code {
  font-size: 0.88em;
  padding: 0.12rem 0.35rem;
  background: #f1f5f9;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Web server scan — onglets */
.ws-tabs {
  margin-top: 1rem;
}

.ws-tabs .ws-tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ws-tab-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  align-items: flex-end;
}

.ws-tab-labels label {
  display: inline-block;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  color: var(--accent-dim);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.ws-tab-labels label:hover {
  background: #f1f5f9;
  color: var(--text);
}

.ws-tab-body {
  display: none;
  padding-top: 0.25rem;
}

.ws-tabs #ws-tab-1:checked ~ .ws-tab-bodies .ws-tab-body-1,
.ws-tabs #ws-tab-2:checked ~ .ws-tab-bodies .ws-tab-body-2,
.ws-tabs #ws-tab-3:checked ~ .ws-tab-bodies .ws-tab-body-3,
.ws-tabs #ws-tab-4:checked ~ .ws-tab-bodies .ws-tab-body-4 {
  display: block;
}

.ws-tabs:has(#ws-tab-1:checked) label[for="ws-tab-1"],
.ws-tabs:has(#ws-tab-2:checked) label[for="ws-tab-2"],
.ws-tabs:has(#ws-tab-3:checked) label[for="ws-tab-3"],
.ws-tabs:has(#ws-tab-4:checked) label[for="ws-tab-4"] {
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}

/* Mobile */
@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: 0;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.85rem 1rem;
    gap: 0.5rem;
  }

  .sidebar-brand {
    flex: 1;
    min-width: 140px;
    padding: 0;
    margin: 0;
    border: none;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 100%;
    padding: 0.5rem 0 0;
    gap: 0.35rem;
  }

  .sidebar-nav a {
    padding: 0.45rem 0.65rem;
    font-size: 0.88rem;
  }

  .sidebar-footer {
    margin-top: 0;
    padding: 0.65rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
  }

  .sidebar-user {
    margin: 0;
    flex: 1;
  }

  .sidebar-footer form {
    width: auto;
  }

  .sidebar-footer button {
    width: auto;
  }
}

/* Page de connexion (sans sidebar) */
.auth-body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 45%, #172554 100%);
  font-family: var(--font);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 14px;
  padding: 2rem 2rem 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.auth-card h2 {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
}

.auth-card label {
  display: block;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
}

.auth-card label:first-of-type {
  margin-top: 0;
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.7rem;
  margin-top: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 1.35rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.auth-card button[type="submit"]:hover {
  background: var(--accent-dim);
}

.auth-card .ok,
.auth-card .err {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.auth-card .ok {
  background: var(--ok-bg);
  border: 1px solid #a7f3d0;
}

.auth-card .err {
  background: var(--err-bg);
  border: 1px solid #fecaca;
}

/* ——— Tableau de bord ——— */
.dashboard {
  max-width: 1100px;
}

.dash-hero {
  margin-bottom: 1rem;
}

.dash-hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
}

.dash-intro {
  margin: 0;
  max-width: 44rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.dash-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.dash-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.dash-badge svg {
  flex-shrink: 0;
}

.dash-badge--ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.dash-badge--err {
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid #fecaca;
}

.dashboard > h2.dash-section-title:first-of-type {
  margin-top: 0.35rem;
}

.dash-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: #334155;
  letter-spacing: -0.02em;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.dash-stat-card {
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

a.dash-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  border-color: rgba(59, 130, 246, 0.35);
}

.dash-stat-card--static {
  cursor: default;
}

.dash-stat-card--static:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.dash-stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1.1;
}

.dash-stat-label {
  font-weight: 600;
  font-size: 0.94rem;
  margin-top: 0.4rem;
  color: #334155;
}

.dash-stat-hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.35;
}

.dash-hint {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  margin: 1rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.dash-hint--warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.dash-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-bottom: 0.5rem;
}

.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.2rem 1.05rem;
  box-shadow: var(--shadow);
}

.dash-panel-icon {
  color: var(--accent);
  margin-bottom: 0.4rem;
  opacity: 0.95;
}

.dash-panel h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
}

.dash-panel .muted {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.dash-panel-cta {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
}

.dash-panel-cta a {
  font-weight: 600;
}

.dash-panel-cta--split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dash-empty {
  margin: 0 0 1.25rem;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-wrap table.data {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.dash-proxy-table code {
  font-size: 0.85em;
}

.dash-na {
  color: var(--muted);
  font-style: italic;
}
