/* SCAF - Gestion Emprunt Matériel Plongée
   CSS pur, sans dépendance externe (police système, pas de CDN). */

:root {
  --bleu: #0b5583;
  --bleu-fonce: #073a5c;
  --bleu-clair: #e8f1f7;
  --vert: #2e7d32;
  --rouge: #c62828;
  --orange: #ef6c00;
  --gris-bord: #d6dde3;
  --texte: #1f2a33;
  --fond: #f4f7f9;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texte);
  background: var(--fond);
  overflow-x: hidden;
}

a { color: var(--bleu); }

.topbar {
  background: var(--bleu-fonce);
  color: #fff;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  margin-left: auto;
}
.brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
}
.mainnav {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  flex: 1;
}
.mainnav a {
  color: #dce8f2;
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.92rem;
}
.mainnav a:hover { background: rgba(255,255,255,0.1); }
.mainnav a.active { background: var(--bleu); color: #fff; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: #dce8f2;
}
.topbar-user a { color: #fff; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--bleu-fonce); }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; color: var(--bleu-fonce); }

.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.flash-success { background: #e5f5e6; color: var(--vert); border: 1px solid #b8e0ba; }
.flash-error   { background: #fdecea; color: var(--rouge); border: 1px solid #f3c1bc; }
.flash-info    { background: var(--bleu-clair); color: var(--bleu-fonce); border: 1px solid #bcd8ea; }

.card {
  background: #fff;
  border: 1px solid var(--gris-bord);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.93rem;
}
table th, table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--gris-bord);
  text-align: left;
  vertical-align: top;
}
table th { background: var(--bleu-clair); color: var(--bleu-fonce); font-weight: 600; }
table tbody tr:hover { background: #fafcfd; }
.table-wrap { overflow-x: auto; border: 1px solid var(--gris-bord); border-radius: 8px; }
.table-wrap table { border: none; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-vert   { background: #e5f5e6; color: var(--vert); }
.badge-rouge  { background: #fdecea; color: var(--rouge); }
.badge-orange { background: #fdf0e2; color: var(--orange); }
.badge-gris   { background: #eceff1; color: #546069; }

.btn {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  background: var(--bleu);
  color: #fff;
  text-decoration: none;
  border: none;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { background: var(--bleu-fonce); }
.btn-secondaire { background: #fff; color: var(--bleu); border: 1px solid var(--bleu); }
.btn-secondaire:hover { background: var(--bleu-clair); }
.btn-danger { background: #fff; color: var(--rouge); border: 1px solid var(--rouge); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.82rem; }

form.inline { display: inline; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: #45535d; }
.field input, .field select, .field textarea {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--gris-bord);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}
.field textarea { resize: vertical; }
.form-actions { margin-top: 1.1rem; display: flex; gap: 0.6rem; }

.login-wrap {
  max-width: 380px;
  margin: 4rem auto;
  background: #fff;
  border: 1px solid var(--gris-bord);
  border-radius: 10px;
  padding: 2rem;
}
.login-wrap h1 { text-align: center; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: #fff;
  border: 1px solid var(--gris-bord);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.stat-tile .valeur { font-size: 1.8rem; font-weight: 700; color: var(--bleu-fonce); }
.stat-tile .libelle { font-size: 0.85rem; color: #5a6a75; margin-top: 0.2rem; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.cards-grid .card { margin-bottom: 0; display: flex; flex-direction: column; }
.cards-grid .card p { flex-grow: 1; }

.anomalies-list {
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.88rem;
}

.muted { color: #6b7a84; font-size: 0.88rem; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }

.combobox-wrap { position: relative; }
.combobox-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gris-bord);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.combobox-dropdown.open { display: block; }
.combobox-option {
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  font-size: 0.93rem;
}
.combobox-option:hover { background: var(--bleu-clair); }
.combobox-empty { padding: 0.5rem 0.55rem; color: #888; font-size: 0.9rem; font-style: italic; }

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--gris-bord);
  border-radius: 6px;
  padding: 0.6rem;
  background: #fff;
}
.checkbox-list label { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .topbar-inner { gap: 0; padding: 0.5rem 1rem; }
  .brand { flex: 1; }
  .mainnav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 0.4rem;
  }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 0.65rem 0.5rem; font-size: 0.95rem; border-radius: 4px; }
  .topbar-user {
    display: none;
    width: 100%;
    padding: 0.5rem 0.5rem 0.3rem;
    border-top: 1px solid rgba(255,255,255,0.2);
  }
  .topbar-user.open { display: flex; }
  .container { padding: 0.8rem 0.75rem 2rem; }
  h1 { font-size: 1.25rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn, .toolbar input, .toolbar select { width: 100%; text-align: center; }
}
