:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-soft: #1e293b;
  --card: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --text-light: #e5e7eb;
  --primary: #10b981;
  --primary-dark: #059669;
  --accent: #f59e0b;
  --danger: #ef4444;
  --border: #e5e7eb;
  --shadow: 0 18px 50px rgba(15, 23, 42, .12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #f8fafc;
}

a {
  color: inherit;
}

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

ul {
  line-height: 1.8;
}

/* PUBLIC / AUTH */

.public-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, .22), transparent 32%),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, .18), transparent 34%),
    #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.public-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 22px;
  align-items: stretch;
}

.brand-panel,
.auth-panel {
  border-radius: 30px;
  padding: 34px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}

.brand-panel {
  background: linear-gradient(135deg, rgba(15, 23, 42, .94), rgba(30, 41, 59, .9));
  color: white;
  border: 1px solid rgba(255,255,255,.12);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-badge {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .16);
  color: #6ee7b7;
  font-weight: 900;
  letter-spacing: .08em;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.brand-panel h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  margin: 0 0 18px;
  letter-spacing: -.05em;
}

.brand-panel p {
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1.7;
  max-width: 640px;
}

.brand-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 30px;
}

.brand-mini-grid div {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 16px;
}

.brand-mini-grid strong {
  display: block;
  color: #fff;
  font-size: 20px;
}

.brand-mini-grid span {
  display: block;
  color: #cbd5e1;
  font-size: 13px;
  margin-top: 4px;
}

.auth-panel {
  background: #ffffff;
  display: flex;
  align-items: center;
}

.auth-card {
  width: 100%;
}

.auth-heading {
  margin-bottom: 24px;
}

.auth-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}

.auth-heading h1,
.auth-heading h2 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -.03em;
}

.auth-heading p,
.auth-note {
  color: var(--muted);
  line-height: 1.6;
}

/* APP */

.app-body {
  background: #f8fafc;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
}

.sidebar {
  background: #020617;
  color: var(--text-light);
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  color: #020617;
}

.logo-title {
  font-weight: 1000;
  letter-spacing: -.02em;
}

.logo-subtitle {
  color: #94a3b8;
  font-size: 12px;
  margin-top: 2px;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-item {
  text-decoration: none;
  color: #cbd5e1;
  padding: 12px 13px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.nav-item.active {
  background: #ecfdf5;
  color: #047857;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 14px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
}

.user-name {
  font-weight: 900;
  color: #fff;
  font-size: 13px;
}

.user-email {
  color: #94a3b8;
  font-size: 12px;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-link {
  text-decoration: none;
  color: #fca5a5;
  font-weight: 900;
  font-size: 13px;
}

.main-area {
  padding: 28px;
  max-width: 1280px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-kicker {
  color: var(--primary-dark);
  font-weight: 1000;
  letter-spacing: .08em;
  font-size: 12px;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: -.04em;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 13px;
  color: #334155;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(16,185,129,.12);
}

.hero-card {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-radius: 28px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.eyebrow {
  color: #6ee7b7;
  font-weight: 1000;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 10px;
}

.hero-card h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -.05em;
  line-height: 1.02;
}

.hero-card p {
  color: #cbd5e1;
  max-width: 720px;
  line-height: 1.7;
  margin: 0;
}

.hero-score {
  min-width: 150px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 20px;
  text-align: center;
}

.hero-score span {
  display: block;
  color: #fcd34d;
  font-weight: 1000;
  font-size: 28px;
}

.hero-score strong {
  display: block;
  margin-top: 8px;
  color: #fff;
}

/* COMPATIBILITÉ AVEC LES PAGES LOT 1 */

.container {
  width: 100%;
}

.card,
.form-box,
.kpi,
.stat-card,
.next-step-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(15, 23, 42, .06);
}

.card {
  padding: 22px;
  margin-bottom: 18px;
}

.form-box {
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-shadow: none;
  border: 0;
}

.grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.kpi,
.stat-card {
  padding: 18px;
}

.kpi-title,
.stat-card span {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.kpi-value,
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 1000;
  letter-spacing: -.04em;
}

label {
  display: block;
  margin-top: 14px;
}

label span {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .12);
}

button,
.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  background: var(--primary);
  color: white;
  font-weight: 900;
  border-radius: 16px;
  padding: 13px 17px;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(16, 185, 129, .24);
}

button:hover,
.btn:hover,
.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary,
.btn-light {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 11px 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: none;
}

.btn-secondary:hover,
.btn-light:hover {
  background: #f8fafc;
}

.alert,
.flash {
  width: 100%;
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 18px;
  font-weight: 800;
}

.alert-error,
.flash-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.alert-success,
.flash-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.footer {
  text-align: center;
  padding: 20px;
  color: #6b7280;
  font-size: 13px;
}

/* FUTURS MODULES */

.section-head {
  margin: 28px 0 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.section-head h2 {
  margin: 0 0 6px;
  letter-spacing: -.03em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.action-card {
  padding: 20px;
  display: grid;
  gap: 12px;
  min-height: 210px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.card-content h3 {
  margin: 0 0 7px;
  font-size: 18px;
}

.card-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.card-link {
  margin-top: auto;
  text-decoration: none;
  color: var(--primary-dark);
  font-weight: 1000;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.smart-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.smart-table th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.smart-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}

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

.empty-state {
  text-align: center;
  padding: 48px 20px;
}

.empty-state div {
  font-size: 44px;
}

.empty-state h3 {
  margin: 10px 0 6px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

/* RESPONSIVE */

@media (max-width: 980px) {
  .public-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
  }

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

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid,
  .stats-grid,
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar,
  .hero-card,
  .next-step-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .public-body {
    padding: 14px;
  }

  .brand-panel,
  .auth-panel {
    padding: 22px;
    border-radius: 22px;
  }

  .brand-mini-grid,
  .grid,
  .stats-grid,
  .cards-grid,
  .side-nav {
    grid-template-columns: 1fr;
  }

  .main-area {
    padding: 18px;
  }

  .topbar h1 {
    font-size: 28px;
  }
}

.small-muted {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.mini-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: none;
}

.mini-btn:hover {
  background: #f8fafc;
}

.mini-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff7f7;
}

.move-card {
  margin-bottom: 18px;
}

.move-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.move-progress {
  min-width: 96px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: #f8fafc;
}

.move-progress strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  font-weight: 950;
}

.move-progress span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 4px;
}

.checklist {
  display: grid;
  gap: 10px;
}

.checklist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: #ffffff;
}

.checklist-row.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.checklist-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.checklist-label strong {
  font-size: 14px;
}

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

.move-actions form {
  margin: 0;
}

.move-actions button {
  width: auto;
}

@media (max-width: 720px) {
  .move-head {
    flex-direction: column;
  }

  .move-progress {
    width: 100%;
  }

  .checklist-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .checklist-row form,
  .checklist-row .mini-btn {
    width: 100%;
  }

  .move-actions,
  .move-actions form,
  .move-actions button {
    width: 100%;
  }
}

.btn-primary-blue {
  background: #2563eb;
  color: #ffffff;
  border: 0;
}

.btn-primary-blue:hover {
  background: #1d4ed8;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border: 0;
}

.btn-danger:hover {
  background: #b91c1c;
}


/* =========================================================
   RESPONSIVE TABLES / LISTES
   Empêche les tableaux larges de forcer la largeur de l'écran
   sur smartphone. Le scroll reste dans la zone du tableau.
   ========================================================= */

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.main-area,
.container,
.card,
.table-card,
.form-box,
.section-head,
.hero-card {
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.smart-table {
  width: 100%;
  max-width: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .main-area {
    max-width: 100%;
    overflow-x: hidden;
  }

  .table-card,
  .card {
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  .table-wrap {
    margin-left: -2px;
    margin-right: -2px;
    padding-bottom: 6px;
  }

  .smart-table {
    min-width: 760px;
  }

  .smart-table th,
  .smart-table td {
    padding: 12px;
    font-size: 13px;
  }

  .table-wrap::-webkit-scrollbar {
    height: 7px;
  }

  .table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
  }

  .table-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 999px;
  }
}
