/* ==================================================================
   BOTSENTRY — Panel light / SaaS
   Palette : #FF00F0 (rose) · #343546 (charbon) · #FFFFFF · #38B5FF
   Thème sombre : <html data-theme="dark">
   ================================================================== */

:root {
  color-scheme: light;

  --primary: #ff00f0;
  --primary-hover: #f000e0;
  --primary-text: #d400c9;
  --primary-soft: #ffe6fd;
  --primary-soft-2: #fff2fe;
  --primary-border: #ffd6fb;
  --primary-border-2: #ffc9f5;

  --accent: #38b5ff;
  --accent-text: #0a75b8;
  --accent-soft: #e7f4ff;
  --accent-border: #c9e8ff;

  --ink: #1e1f2a;
  --ink-soft: #343546;
  --muted: #6e7080;
  --muted-2: #9a9cab;
  --nav-text: #55576a;

  --page: #eef0f5;
  --page-bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #f1f2f6;
  --border: #e5e7ed;
  --hover-border: #d8dae3;
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --login-border: rgba(255, 255, 255, 0.9);
  --scrollbar: #d3d6e0;
  --scrollbar-hover: #b9bdcb;

  --ok: #1f9d55;
  --ok-soft: #e7f7ee;
  --ok-border: #cdeeda;

  --btn-dark-bg: #1e1f2a;
  --btn-dark-fg: #ffffff;
  --btn-dark-hover: #343546;

  --track: #d4d7e0;
  --switch-knob: #ffffff;
  --dashed: #cfd3de;

  --hero-border: rgba(255, 255, 255, 0.7);
  --hero-bg: linear-gradient(125deg, #ffd9fb 0%, #ffb3f7 38%, #d5ecff 100%);
  --hero-glow: radial-gradient(420px 220px at 88% 12%, rgba(255, 255, 255, 0.75), transparent 70%);
  --hero-chip-bg: rgba(255, 255, 255, 0.8);
  --hero-chip-border: rgba(255, 255, 255, 0.9);
  --hero-text: #3d3f52;

  --chart-grid: #eceef3;
  --chart-dot: #ffffff;
  --modal-backdrop: rgba(24, 25, 34, 0.45);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(30, 31, 42, 0.06);
  --shadow: 0 1px 2px rgba(30, 31, 42, 0.05), 0 12px 30px rgba(30, 31, 42, 0.07);
  --shadow-lg: 0 24px 70px rgba(30, 31, 42, 0.22);
  --shadow-hover: 0 6px 26px rgba(30, 31, 42, 0.12);
}

/* ---------------- Thème sombre ---------------- */

:root[data-theme='dark'] {
  color-scheme: dark;

  --primary: #ff2ef2;
  --primary-hover: #ff5cf6;
  --primary-text: #ff8ff9;
  --primary-soft: #2b1030;
  --primary-soft-2: #36143c;
  --primary-border: #4a1d4f;
  --primary-border-2: #5a235f;

  --accent: #4cc0ff;
  --accent-text: #7ed0ff;
  --accent-soft: #0d2637;
  --accent-border: #1c4763;

  --ink: #eceef5;
  --ink-soft: #cdd1e0;
  --muted: #9ba1b7;
  --muted-2: #737a90;
  --nav-text: #a9aec2;

  --page: #0b0c12;
  --page-bg: #0e0f16;
  --surface: #161722;
  --surface-2: #1d1f2c;
  --surface-3: #262938;
  --border: #2b2e3e;
  --hover-border: #3a3e52;
  --topbar-bg: rgba(22, 23, 34, 0.88);
  --login-border: rgba(255, 255, 255, 0.09);
  --scrollbar: #33374a;
  --scrollbar-hover: #454a61;

  --ok: #4ade80;
  --ok-soft: #0e2c1c;
  --ok-border: #1d5137;

  --btn-dark-bg: #2a2d3d;
  --btn-dark-fg: #e9ebf4;
  --btn-dark-hover: #353a50;

  --track: #3a3e52;
  --switch-knob: #eceef5;
  --dashed: #383c4f;

  --hero-border: rgba(255, 255, 255, 0.09);
  --hero-bg: linear-gradient(125deg, #2a1030 0%, #3a1140 38%, #10263b 100%);
  --hero-glow: radial-gradient(420px 220px at 88% 12%, rgba(255, 0, 240, 0.16), transparent 70%);
  --hero-chip-bg: rgba(255, 255, 255, 0.08);
  --hero-chip-border: rgba(255, 255, 255, 0.14);
  --hero-text: #c7cbd9;

  --chart-grid: #262938;
  --chart-dot: #161722;
  --modal-backdrop: rgba(0, 0, 0, 0.62);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.7);
  --shadow-hover: 0 6px 26px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
  background-clip: content-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: var(--page-bg);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ---------------- Boutons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--hover-border);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-dark {
  background: var(--btn-dark-bg);
  border-color: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  box-shadow: 0 2px 8px rgba(30, 31, 42, 0.22);
}

.btn-dark:hover {
  background: var(--btn-dark-hover);
  border-color: var(--btn-dark-hover);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 0, 240, 0.32);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-danger {
  background: var(--surface);
  border-color: var(--primary-border-2);
  color: var(--primary-text);
  box-shadow: none;
}

.btn-danger:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- Connexion ---------------- */

.login {
  height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--login-border);
  border-radius: 22px;
  padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-icon {
  width: 64px;
  height: auto;
  display: block;
  margin: 0 auto 14px;
}

.login-wordmark {
  width: 250px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input {
  width: 100%;
  margin-bottom: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
}

.login-card input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.form-error {
  color: var(--primary-text);
  font-size: 13px;
  min-height: 18px;
  margin-top: 10px;
}

/* ---------------- Coquille de l'application ---------------- */

.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  height: 100vh;
  background: var(--surface);
  overflow: hidden;
}

/* ---------------- Sidebar ---------------- */

/* Sidebar indépendante : elle ne bouge jamais, seul le contenu défile */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  height: 100vh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  padding: 4px 8px 18px;
}

.brand-logo {
  width: 158px;
  height: auto;
  display: block;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  padding: 16px 10px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--nav-text);
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.8px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav-item span:first-of-type {
  flex: 1;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--primary-soft), var(--primary-soft-2));
  border-color: var(--primary-border);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item.active svg {
  color: var(--primary);
}

.nav-count {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  line-height: 17px;
}

.nav-item.active .nav-count {
  background: var(--surface);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.bot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 11px;
}

.bot-card img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-3);
  flex: none;
}

.bot-card .bot-meta {
  min-width: 0;
}

.bot-card strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card span {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.dot.off {
  background: var(--muted-2);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.logout-btn svg {
  width: 17px;
  height: 17px;
}

.logout-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------------- Topbar ---------------- */

/* Conteneur de défilement : c'est lui qui scrolle, pas la page */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--page-bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 22px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 420px;
}

.search svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}

.search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px 9px 36px;
  font-size: 13.5px;
  font-family: inherit;
}

.search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.pill.ok {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.pill.ko {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink);
  min-width: 175px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

/* ---------------- Contenu ---------------- */

.content {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 1280px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 25px;
  font-weight: 800;
}

.page-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 15.5px;
  font-weight: 700;
}

.card-head .card-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted-2);
  margin: 20px 0 10px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: 1.15fr 0.85fr;
}

.grid-even {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1120px) {
  .grid-2,
  .grid-even {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Carte héros ---------------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--hero-border);
  background: var(--hero-bg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 232px;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hero-glow);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  background: var(--hero-chip-bg);
  border: 1px solid var(--hero-chip-border);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
}

.hero h2 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  max-width: 15ch;
}

.hero p {
  margin: 0;
  color: var(--hero-text);
  font-size: 14px;
  max-width: 46ch;
}

.hero .hero-actions {
  display: flex;
  gap: 9px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* ---------------- Carte graphe ---------------- */

.kpi {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.kpi-delta {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.kpi-note {
  color: var(--muted);
  font-size: 13px;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 8px;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 11px;
  margin-top: 4px;
  padding: 0 2px;
}

/* ---------------- Couverture / barres ---------------- */

.coverage-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.coverage-value span {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.bar {
  height: 9px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s ease;
}

.bar.thin {
  height: 6px;
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.mini-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 13px;
}

.mini-stat b {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mini-stat span {
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- Checklist ---------------- */

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
}

.check-item .check-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.check-item .check-icon svg {
  width: 13px;
  height: 13px;
}

.check-item.done .check-icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.check-item.todo .check-icon {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.check-item b {
  font-weight: 600;
}

.check-item small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------- Tableau ---------------- */

.table-toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.table-toolbar input[type='search'] {
  flex: 1;
  min-width: 200px;
}

.input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted-2);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding-top: 4px;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-2);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  flex: none;
}

.user-cell strong {
  font-weight: 600;
  display: block;
}

.user-cell small {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge.ok {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.badge.ko {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.badge.neutral {
  background: var(--surface-3);
  color: var(--muted);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.empty strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 4px;
}

/* ---------------- Formulaires ---------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.field .hint {
  font-size: 12px;
  color: var(--muted-2);
}

.field.span-2 {
  grid-column: 1 / -1;
}

.field select,
.field input,
.field textarea {
  width: 100%;
}

textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

input[type='color'] {
  width: 100%;
  height: 40px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input[type='number'] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  width: 100%;
}

input[type='number']:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch .track {
  width: 40px;
  height: 23px;
  background: var(--track);
  border-radius: 999px;
  position: relative;
  flex: none;
  transition: background 0.18s;
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  background: var(--switch-knob);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s;
}

.switch input:checked + .track {
  background: var(--primary);
}

.switch input:checked + .track::after {
  transform: translateX(17px);
}

.switch .switch-text strong {
  display: block;
  font-size: 13.5px;
}

.switch .switch-text span {
  font-size: 12.5px;
  color: var(--muted);
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.form-footer .saved {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------------- Serveurs ---------------- */

.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.server-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: box-shadow 0.18s, transform 0.18s;
}

.server-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.server-card.current {
  border-color: var(--primary-border-2);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.09), var(--shadow);
}

.server-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.server-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  flex: none;
}

.server-head .server-name {
  min-width: 0;
}

.server-head strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-head span {
  font-size: 12.5px;
  color: var(--muted);
}

.server-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.server-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

.server-stat b {
  display: block;
  font-size: 17px;
  font-weight: 800;
}

.server-stat span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.server-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.chip svg {
  width: 12px;
  height: 12px;
}

.chip.done {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

.chip.todo {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.server-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.server-card.add {
  border: 1.6px dashed var(--dashed);
  background: var(--surface-2);
  box-shadow: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 210px;
  gap: 8px;
}

.server-card.add:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--primary);
}

.server-card.add .plus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--primary-text);
}

.server-card.add .plus svg {
  width: 20px;
  height: 20px;
}

.server-card.add strong {
  font-size: 14.5px;
}

.server-card.add p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 30ch;
}

/* ---------------- Journal ---------------- */

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
}

.log-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  flex: none;
}

.log-icon svg {
  width: 15px;
  height: 15px;
  color: var(--primary-text);
}

.log-item .log-body {
  flex: 1;
  min-width: 0;
}

.log-item b {
  font-weight: 600;
}

.log-time {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------------- Aperçu Discord ---------------- */

.discord-panel {
  background: #2b2d31;
  border: 1px solid #1e1f22;
  border-radius: 14px;
  padding: 16px;
}

.discord-msg {
  display: flex;
  gap: 12px;
}

.discord-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #46475e;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}

.discord-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-username {
  color: #f2f3f5;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.discord-username span {
  color: #949ba4;
  font-size: 11.5px;
  font-weight: 400;
  margin-left: 6px;
}

.embed {
  background: #2b2d31;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  padding: 13px 15px;
  max-width: 460px;
  margin-top: 6px;
}

.embed h4 {
  color: #f2f3f5;
  font-size: 15.5px;
  margin-bottom: 7px;
}

.embed p {
  margin: 0;
  color: #dbdee1;
  font-size: 13.5px;
  white-space: pre-wrap;
}

.embed .embed-footer {
  margin-top: 11px;
  color: #949ba4;
  font-size: 11.5px;
}

.discord-buttons {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.fake-btn {
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: default;
}

.fake-btn.link {
  background: #23a559;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  right: 30px;
  bottom: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 13px 17px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  font-size: 13.5px;
  font-weight: 500;
  animation: slide-in 0.2s ease;
}

.toast.ok {
  border-left-color: var(--accent);
}

.toast.err {
  border-left-color: var(--primary);
}

@keyframes slide-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------------- Bascule de thème (clair / sombre) ---------------- */

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.theme-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.theme-btn:active {
  transform: translateY(1px);
}

.theme-btn svg {
  width: 17px;
  height: 17px;
}

/* En thème clair on propose la lune (passer en sombre), et inversement. */
.theme-btn .ico-sun {
  display: none;
}

:root[data-theme='dark'] .theme-btn .ico-sun {
  display: block;
}

:root[data-theme='dark'] .theme-btn .ico-moon {
  display: none;
}

/* Sur l'écran de connexion, le bouton flotte en haut à droite. */
.login-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
}

/* ---------------- Boîte de dialogue (modal) ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--modal-backdrop);
  backdrop-filter: blur(3px);
  animation: modal-fade 0.16s ease;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 24px 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: modal-pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.modal-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.modal-icon svg {
  width: 22px;
  height: 22px;
}

.modal.danger .modal-icon {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.modal.success .modal-icon {
  background: var(--ok-soft);
  color: var(--ok);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.modal-list {
  margin: 12px 0 0;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

.modal-list b {
  color: var(--ink);
}

.modal-actions {
  display: flex;
  gap: 9px;
  margin-top: 22px;
}

.modal-actions .btn {
  flex: 1;
  padding: 10px 14px;
}

.modal .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.modal .field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.modal .field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
}

.modal .field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

/* ---------------- Progression (ajout en masse) ---------------- */

.progress-modal {
  max-width: 460px;
}

.progress-bar {
  height: 9px;
  margin: 18px 0 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.45s ease;
}

.progress-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.counter b {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
}

.counter.ok {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

.counter.ok b {
  color: var(--ok);
}

.counter.ko {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.counter.ko b {
  color: var(--primary-text);
}

.btn-solid-danger {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 0, 240, 0.28);
}

.btn-solid-danger:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- Connexion / Inscription ---------------- */

.auth-card,
.onboarding-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--login-border);
  border-radius: 22px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.onboarding-card {
  max-width: 560px;
  text-align: left;
}

.auth-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  text-align: left;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-form .field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.auth-form input,
.onboarding-card input,
.onboarding-card select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
}

.auth-form input:focus,
.onboarding-card input:focus,
.onboarding-card select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 240, 0.13);
}

.auth-form .btn-block {
  margin-top: 4px;
}

/* ---------------- Onboarding (stepper) ---------------- */

.onboarding {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow-y: auto;
}

.onboarding-title {
  font-size: 22px;
  font-weight: 800;
  margin: 10px 0 2px;
}

.steps {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 22px 0 24px;
  padding: 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-2);
  min-width: 0;
}

.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.step.active {
  color: var(--ink);
}

.step.active .step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.step.done .step-dot {
  background: var(--ok-soft);
  border-color: var(--ok-border);
  color: var(--ok);
}

.step-panel h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.step-panel .hint {
  display: block;
  margin-bottom: 14px;
  line-height: 1.6;
}

.step-panel .form-footer {
  margin-top: 16px;
}

.onboarding-card .form-error {
  margin-top: 12px;
}

.onboarding-admin {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---------------- Divers ---------------- */

.loader {
  color: var(--muted);
  text-align: center;
  padding: 34px;
}

.notice {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary-text);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}

.notice.info {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

/* Les icônes inline restent toujours compactes */
.notice svg,
.hint svg,
.card-sub svg {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  flex: none;
}

.kv {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 9px 16px;
  font-size: 13.5px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  word-break: break-word;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row span {
  color: var(--muted);
}

.stat-row b {
  font-weight: 700;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    height: auto;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .topbar {
    top: 0;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }
}

/* ---------------- Bulk rejoin (vue « Rejoindre ») ---------------- */

.bulk-filters .input {
  min-width: 150px;
}

.bulk-filters select {
  max-width: 230px;
}

.bulk-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.bulk-toggle input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

.bulk-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.bulk-target {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.bulk-target input[type='text'] {
  flex: 1;
  min-width: 240px;
}

.target-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.target-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--ink-soft);
  flex: none;
}

.target-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-meta strong {
  font-size: 14px;
}

.target-meta span {
  font-size: 12px;
  color: var(--muted);
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

.bulk-bar .row-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
