@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0b2545;
  --navy-dark: #081b33;
  --accent: #c9a227;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e1e6ed;
  --text: #1c2733;
  --text-muted: #5b6b7c;

  --crit-critique: #c62828;
  --crit-elevee: #ef6c00;
  --crit-moyenne: #f9a825;
  --crit-faible: #78828c;

  --statut-attendu: #78828c;
  --statut-encours: #0b2545;
  --statut-livre: #1e7a46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.topbar .brand img {
  flex-shrink: 0;
}

.topbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.topbar .brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.topbar .brand-sub {
  font-size: 0.72rem;
  color: #c7d2e0;
}

.topbar .logout {
  flex-shrink: 0;
  color: #e7ecf3;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 0.3rem;
  white-space: nowrap;
}

.topbar .logout:hover {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

nav.tabs {
  background: var(--navy-dark);
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 0 1rem;
}

nav.tabs a {
  color: #c7d2e0;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

nav.tabs a.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

nav.tabs a:hover { text-decoration: none; color: #fff; }

@media (max-width: 480px) {
  .topbar {
    padding: 0.65rem 1rem;
    gap: 0.5rem;
  }

  .topbar .brand img {
    width: 28px;
    height: 28px;
  }

  .topbar .brand-name {
    font-size: 0.95rem;
  }

  .topbar .brand-sub {
    font-size: 0.68rem;
  }

  .topbar .logout {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
  }

  nav.tabs {
    padding: 0 0.75rem;
  }

  nav.tabs a {
    padding: 0.6rem 0.7rem;
    font-size: 0.82rem;
  }
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 { font-size: 1.5rem; margin-top: 0; }
h2 { font-size: 1.15rem; color: var(--navy); margin-top: 2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.1rem 1.3rem;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.05);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.05);
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 0.2rem;
}

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

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  main { padding: 1rem; }
}

.progress-bar {
  height: 0.9rem;
  width: 100%;
  background: var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--navy);
}

.badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 0.3em;
  font-size: 0.8em;
  font-weight: 600;
  color: #fff;
}

.crit-critique { background: var(--crit-critique); }
.crit-elevee   { background: var(--crit-elevee); }
.crit-moyenne  { background: var(--crit-moyenne); color: #26200a; }
.crit-faible   { background: var(--crit-faible); }

.statut-attendu { background: var(--statut-attendu); }
.statut-encours { background: var(--statut-encours); }
.statut-livre   { background: var(--statut-livre); }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.8rem 0 1.5rem;
  border-radius: 0.3rem;
}

.table-responsive table.data-table {
  margin: 0;
}

@media (max-width: 760px) {
  .table-responsive table.data-table {
    min-width: 560px;
  }
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.5rem;
}

table.data-table th,
table.data-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Tables issues du Markdown (plan technique, ressources) : mêmes règles de base */
main table:not(.data-table) {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.5rem;
}

main table:not(.data-table) th,
main table:not(.data-table) td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.92rem;
}

main table:not(.data-table) th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--border);
}

@media (max-width: 760px) {
  main table:not(.data-table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.8rem;
}

.timeline .phase {
  flex: 1 1 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--statut-attendu);
  border-radius: 0.3rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
}

.timeline .phase.done { border-left-color: var(--statut-livre); }

.filtres {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filtres button {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
}

.filtres button:hover { background: var(--bg); }

.doc-list a { display: block; padding: 0.3rem 0; }

footer.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* Page de connexion */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: 0.6rem;
  padding: 2.2rem 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  text-align: center;
}

.login-card .brand-name {
  color: var(--navy);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  margin-top: 0.8rem;
}

.login-card .brand-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 1.6rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: left;
}

.login-card label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  display: block;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font-family: inherit;
  font-size: 0.95rem;
}

.login-card button {
  margin-top: 0.4rem;
  padding: 0.6rem;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.login-card button:hover { background: var(--navy-dark); }

.login-error {
  background: #fdecea;
  color: #8c2a20;
  border: 1px solid #f3c6c2;
  border-radius: 0.35rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.login-notice {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
