:root {
  --blue: #075ea8;
  --blue-dark: #073f78;
  --navy: #182a3d;
  --navy-2: #22384f;
  --orange: #f97316;
  --orange-dark: #d95b07;
  --green: #0f9f6e;
  --red: #dc2626;
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Auth */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b355c, #064f98 55%, #ff6b00);
}

.auth-card {
  width: min(470px, 94vw);
  background: #fff;
  border-radius: 28px;
  padding: 38px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.logo-auth {
  display: block;
  width: 130px;
  margin: 0 auto 18px;
}

.auth-card h1 {
  margin: 0 0 8px;
  color: #064f98;
  text-align: center;
}

.auth-card p {
  margin-bottom: 24px;
  color: var(--muted);
  text-align: center;
}

.auth-card .field input,
.auth-card .field textarea,
.auth-card .field select {
  border-radius: 14px;
  background: #fbfdff;
  padding: 13px 14px;
}

.auth-card .btn {
  border-radius: 14px;
  background: #064f98;
  box-shadow: none;
}

.auth-card .btn:hover {
  background: #043c75;
  transform: none;
  box-shadow: none;
}

.auth-card a {
  color: #064f98;
  font-weight: 800;
}

body:not(.auth-body) {
  background:
    radial-gradient(circle at 84% 10%, rgba(249, 115, 22, 0.12), transparent 28%),
    radial-gradient(circle at 18% 18%, rgba(7, 94, 168, 0.12), transparent 30%),
    linear-gradient(90deg, rgba(7, 94, 168, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(7, 94, 168, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.2)),
    var(--bg);
  background-size: auto, auto, 38px 38px, 38px 38px, auto, auto;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #e5edf5;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--navy), var(--navy-2));
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.14);
  overflow-y: auto;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 8px 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.brand img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.brand h2,
.brand strong {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-weight: 850;
}

.brand span {
  color: rgba(229, 237, 245, 0.76);
  font-size: 12px;
  line-height: 1.4;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.menu a,
.menu button {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #dbe7f3;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.menu a:hover,
.menu button:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(3px);
}

.menu a.active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.menu .logout,
.menu .danger,
.menu button {
  margin-top: 26px;
  color: #ffd6d6;
}

.admin-link,
#adminLink {
  background: linear-gradient(135deg, var(--orange), #ffb020) !important;
  color: #fff !important;
  font-weight: 900 !important;
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.25);
}

.main {
  min-width: 0;
  padding: 34px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
  padding: 18px 22px;
  border: 1px solid rgba(7, 94, 168, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.welcome b,
.topbar strong {
  color: var(--blue-dark);
}

.notif-pill,
.notif {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.bubble,
.notif b {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.title {
  margin: 0 0 24px;
  color: #111827;
  font-size: 34px;
  line-height: 1.12;
  position: relative;
}

.title::after {
  content: "";
  display: block;
  width: 78px;
  height: 4px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange), var(--blue));
}

/* Components */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat,
.card,
.panel {
  border: 1px solid rgba(7, 94, 168, 0.1);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card,
.panel {
  position: relative;
  overflow: hidden;
}

.card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--orange));
}

.stat {
  padding: 22px;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat h3,
.stats .card h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.stat div,
.stats .card strong {
  color: var(--blue-dark);
  font-size: 34px;
  font-weight: 900;
}

.card,
.panel {
  margin-bottom: 24px;
  padding: 26px;
}

.card h2,
.panel h2 {
  margin-top: 0;
  color: #111827;
}

.panel p {
  color: var(--muted);
  line-height: 1.7;
}

.form-logo,
.logo-admin {
  display: block;
  width: 112px;
  margin: 0 auto 20px;
  border-radius: 8px;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #27364a;
  font-size: 13px;
  font-weight: 850;
}

.field input,
.field textarea,
.field select,
.searchbar input,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 13px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field textarea {
  min-height: 118px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.searchbar input:focus,
input[type="text"]:focus {
  border-color: rgba(7, 94, 168, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(7, 94, 168, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  padding: 12px 18px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(7, 94, 168, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 16px 30px rgba(7, 94, 168, 0.24);
}

.btn.orange {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.2);
}

.btn.blue {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}

.btn.full {
  width: 100%;
}

.searchbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #e8f2fb;
  color: var(--blue-dark);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.badge.success {
  background: #e8f8f1;
  color: #067647;
}

.badge.warning {
  background: #fff4df;
  color: #b54708;
}

.badge.danger {
  background: #feeaea;
  color: #b42318;
}

.list-item {
  margin: 12px 0;
  padding: 16px 18px;
  border: 1px solid rgba(7, 94, 168, 0.1);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(7, 94, 168, 0.05), transparent),
    var(--surface-soft);
}

.suivi-item h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.suivi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.suivi-type {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.catalogue-summary,
.catalogue-head,
.catalogue-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.catalogue-summary {
  margin-bottom: 18px;
}

.catalogue-summary h2 {
  margin: 4px 0 0;
}

.catalogue-item {
  margin: 14px 0;
  padding: 18px;
  border: 1px solid rgba(7, 94, 168, 0.1);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface-soft);
}

.catalogue-item h3 {
  margin: 4px 0 0;
  font-size: 19px;
}

.catalogue-item p {
  margin: 14px 0;
  color: #344054;
  line-height: 1.6;
}

.catalogue-meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: #344054;
  font-size: 13px;
  text-transform: uppercase;
}

/* Accueil */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 44px;
  align-items: center;
  padding: 56px;
  background: linear-gradient(135deg, #102538, #075ea8 68%, #f97316);
  color: #fff;
}

.hero img {
  width: min(360px, 80%);
  justify-self: center;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow-md);
}

.hero h1 {
  margin: 0 0 18px;
  font-size: 56px;
  line-height: 1.04;
}

.hero p {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 20px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 25px;
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 20px;
  }

  .menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu .logout,
  .menu .danger,
  .menu button {
    margin-top: 0;
  }

  .main {
    padding: 22px;
  }

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

  .grid2,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 100vh;
    padding: 34px 20px;
    text-align: center;
  }

  .hero img {
    width: min(220px, 72%);
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-actions {
    justify-content: center;
  }

  .searchbar {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .auth-card {
    padding: 26px 20px;
  }

  .menu,
  .stats {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 16px;
  }

  .title {
    font-size: 28px;
  }

  .card,
  .panel,
  .stat {
    padding: 20px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-actions,
  .hero-actions .btn {
    width: 100%;
  }
}
