:root {
  --bleu: #0b3d6b;
  --bleu-clair: #1565a8;
  --accent: #e8821e;
  --gris: #f4f6f8;
  --gris-bord: #d9dee3;
  --texte: #1f2a36;
  --muted: #6b7884;
  --rouge: #c0392b;
  --vert: #1e8449;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--texte);
  background: var(--gris);
  line-height: 1.5;
}
a { color: var(--bleu-clair); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bleu); color: #fff; padding: 0 20px; height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  background: var(--accent); color: #fff; font-weight: 800; letter-spacing: 1px;
  padding: 4px 8px; border-radius: 6px; font-size: 15px;
}
.brand-mark.big { font-size: 26px; padding: 8px 14px; }
.brand-text { font-weight: 600; }
/* Logo officiel sur pastille blanche pour rester lisible sur la barre bleue */
.brand-logo { display: block; height: 40px; width: auto; background: #fff; padding: 5px 10px; border-radius: 8px; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: #cfe0f0; font-size: 14px; }
.topnav a:hover { color: #fff; }

/* Layout */
.container { max-width: 1100px; margin: 28px auto; padding: 0 20px; }
.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
h1 { font-size: 26px; margin: 0 0 6px; color: var(--bleu); }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 6px; }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--gris-bord); border-radius: var(--radius);
  padding: 20px; margin: 16px 0; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card-head { display: flex; justify-content: space-between; align-items: center; }
.center-block { text-align: center; }

/* Buttons */
.btn {
  display: inline-block; background: #fff; border: 1px solid var(--gris-bord);
  color: var(--texte); padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 14px; text-decoration: none;
}
.btn:hover { border-color: var(--bleu-clair); text-decoration: none; }
.btn.primary { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.btn.primary:hover { background: var(--bleu-clair); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.link-btn {
  background: none; border: none; color: var(--bleu-clair); cursor: pointer;
  font-size: 13px; padding: 0; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--rouge); }
.inline { display: inline; }

/* Forms */
.form label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 500; }
.form input, .form select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--gris-bord); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form label { margin-bottom: 0; flex: 0 0 auto; }
.row-form .grow { flex: 1 1 180px; }
.form.mini { display: flex; gap: 6px; margin-top: 6px; }
.form.mini input { width: auto; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.alert.error { background: #fdecea; color: var(--rouge); }
.alert.success { background: #e8f5ee; color: var(--vert); }
.alert.info { background: #e7f0f8; color: var(--bleu); }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #fff; border-radius: 14px; padding: 36px; width: 360px; max-width: 92vw;
  box-shadow: 0 10px 40px rgba(11,61,107,.18);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { max-width: 260px; width: 80%; height: auto; margin: 0 auto 6px; display: block; }
.edit-box > summary { cursor: pointer; font-weight: 600; color: var(--bleu); list-style: none; user-select: none; }
.edit-box > summary::-webkit-details-marker { display: none; }
.edit-box[open] > summary { margin-bottom: 14px; }
.login-brand h1 { margin: 14px 0 0; }
.login-brand p { margin: 2px 0 0; }

/* Tiles (chantiers client) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile {
  background: #fff; border: 1px solid var(--gris-bord); border-radius: var(--radius);
  padding: 18px; color: var(--texte); transition: box-shadow .15s, transform .15s;
}
.tile:hover { text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); }
.tile-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tile-icon { font-size: 26px; }
.tile h3 { color: var(--bleu); }
.badge { background: var(--gris); color: var(--muted); font-size: 12px; padding: 2px 8px; border-radius: 20px; }

/* File list */
.file-list { list-style: none; padding: 0; margin: 12px 0; }
.file-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--gris-bord);
}
.file-list li:last-child { border-bottom: none; }
.file-name { flex: 1; font-weight: 500; }
.file-size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.upload-form { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 16px 0; }
.stat {
  background: #fff; border: 1px solid var(--gris-bord); border-radius: var(--radius);
  padding: 20px; text-align: center; color: var(--texte); display: flex; flex-direction: column; gap: 4px;
}
.stat:hover { text-decoration: none; }
.stat-num { font-size: 32px; font-weight: 800; color: var(--bleu); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--gris-bord); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr.archived { opacity: .55; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Cols */
.cols { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.col-main { flex: 1 1 480px; min-width: 0; }
.col-side { flex: 0 0 300px; }
.acces-list { list-style: none; padding: 0; margin: 0; }
.acces-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--gris-bord); }
.acces-list li:last-child { border-bottom: none; }

/* Divers */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.error-code { font-size: 56px; color: var(--accent); margin: 0; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inline-details { display: inline-block; }
.inline-details summary { cursor: pointer; list-style: none; }

@media (max-width: 720px) {
  .col-side { flex: 1 1 100%; }
  .topnav { gap: 12px; font-size: 13px; }
  .brand-text { display: none; }
}
