/* Charte graphique HELdB : Manrope, anthracite #262626, rouge UI #EA0637, fond #F1F5F9 */
:root {
  --ink: #262626;
  --ink-soft: #4F4F4F;
  --muted: #6D6D6D;
  --line: #D1D1D1;
  --line-soft: #E7E7E7;
  --bg: #F1F5F9;
  --white: #FFFFFF;
  --red: #EA0637;
  --red-700: #D20031;
  --red-50: #FFEFF1;
  --red-100: #FFE1E3;
  --blue: #403DE8;
  --blue-50: #EEF3FF;
  --green: #47C8B2;
  --green-50: #EAF8F5;
  --yellow: #F7A820;
  --yellow-50: #FFF6E6;
  --radius: 4px;
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--red-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red); }
h1, h2, h3 { font-weight: 800; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; }
h2::before { content: ""; width: 10px; height: 10px; background: var(--red); flex: none; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* En-tête */
.site-header { background: var(--white); border-bottom: 1px solid var(--line-soft); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 14px; padding-bottom: 14px; }
.site-header .logo img { display: block; height: 44px; width: auto; }
.site-header .site-title { font-weight: 800; font-size: 1rem; text-align: right; color: var(--ink-soft); }
.site-header .site-title small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }

/* Bandeau d'alerte */
.alerts { margin: 20px 0; display: grid; gap: 12px; }
.alert { border-left: 8px solid var(--red); background: var(--white); padding: 16px 20px; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(38,38,38,.06); }
.alert-critical { border-color: var(--red); background: var(--red-50); }
.alert-warning  { border-color: var(--yellow); background: var(--yellow-50); }
.alert-info     { border-color: var(--blue); background: var(--blue-50); }
.alert .tag { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; color: var(--white); background: var(--red); margin-bottom: 6px; }
.alert-warning .tag { background: var(--yellow); color: var(--ink); }
.alert-info .tag { background: var(--blue); }
.alert h2 { font-size: 1.3rem; }
.alert h2::before { display: none; }
.alert .meta { color: var(--muted); font-size: .85rem; margin: 0; }
.alert-none { border-left: 8px solid var(--green); background: var(--white); padding: 12px 20px; border-radius: var(--radius); color: var(--ink-soft); }

/* Grille de cartes */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; margin: 20px 0 32px; }
.grid > * { min-width: 0; }
.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px rgba(38,38,38,.06); }
.card.span-2 { grid-column: 1 / -1; }
.card > h2 { margin-bottom: 1rem; }
.card .updated { color: var(--muted); font-size: .8rem; margin: .75rem 0 0; }

/* Services */
.services { list-style: none; margin: 0; padding: 0; }
.services li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.services li:last-child { border-bottom: 0; }
.services .name { font-weight: 700; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.services .note { display: block; font-weight: 500; color: var(--muted); font-size: .88rem; }
.badge { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; border-radius: 2px; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-ok          { background: var(--green-50);  color: #1F7F6E; }
.badge-degraded    { background: var(--yellow-50); color: #9A5F00; }
.badge-down        { background: var(--red-50);    color: var(--red-700); }
.badge-maintenance { background: var(--blue-50);   color: var(--blue); }

/* Liens */
.links-group { margin-bottom: 1rem; }
.links-group h3 { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .4rem; }
.links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.links a { display: block; padding: 12px 14px; background: var(--bg); border-left: 4px solid var(--red); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 700; }
.links a:hover { background: var(--red-100); }
.links a small { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; }

/* Pied de page avec les 4 blocs carrés de la charte */
.site-footer { position: relative; background: var(--ink); color: var(--white); padding: 32px 0 40px; margin-top: 24px; overflow: hidden; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 24px; }
.site-footer img { height: 40px; width: auto; display: block; }
.site-footer .contact { font-size: .9rem; color: #D1D1D1; }
.site-footer .contact strong { color: var(--white); }
.site-footer a { color: var(--white); }
.squares { position: absolute; left: 0; bottom: 0; width: 36px; height: 54px; }
.squares i { position: absolute; width: 18px; height: 18px; display: block; }
.squares i:nth-child(1) { left: 18px; top: 0;   background: rgba(255,255,255,.5); }
.squares i:nth-child(2) { left: 0;    top: 18px; background: var(--white); }
.squares i:nth-child(3) { left: 18px; top: 18px; background: var(--white); }
.squares i:nth-child(4) { left: 0;    top: 36px; background: var(--red); }
.squares i:nth-child(5) { left: 18px; top: 36px; background: var(--white); }
.admin-link { font-size: .8rem; color: #B0B0B0 !important; }

/* Formulaires et admin */
.btn { display: inline-block; font: inherit; font-weight: 800; padding: 9px 16px; border: 2px solid var(--red); background: var(--red); color: var(--white); border-radius: var(--radius); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--red-700); border-color: var(--red-700); color: var(--white); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); border-color: var(--ink); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-danger { background: transparent; color: var(--red-700); border-color: transparent; }
.btn-danger:hover { background: var(--red-50); border-color: var(--red-50); color: var(--red-700); }
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; border-left: 6px solid var(--green); background: var(--white); font-weight: 600; }
.flash-error { border-color: var(--red); background: var(--red-50); }

.admin-nav { background: var(--white); border-bottom: 1px solid var(--line-soft); }
.admin-nav .wrap { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 16px; }
.admin-nav a { display: block; padding: 12px 14px; text-decoration: none; color: var(--ink-soft); font-weight: 700; border-bottom: 3px solid transparent; }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a.current { color: var(--red-700); border-color: var(--red); }
.admin-nav .right { margin-left: auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.page-head h1 { margin: 0; }

table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #F6F6F6; }
tr:last-child td { border-bottom: 0; }
td form { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; }
.inactive { opacity: .55; }
.table-wrap { overflow-x: auto; }

.login-box { max-width: 400px; margin: 48px auto; }

@media (max-width: 640px) {
  .site-header .wrap { flex-direction: column; align-items: flex-start; }
  .site-header .site-title { text-align: left; }
  .site-header .logo img { height: 36px; }
  h1 { font-size: 1.35rem; }
}

.summary { color: var(--ink-soft); margin-bottom: .5rem; }
.services .name a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.services .name a:hover { color: var(--red-700); border-color: var(--red); }

/* Sauvegarde automatique (tableau de bord) */
html.js .js-hide { display: none; }
.save-state { display: block; font-size: .78rem; font-weight: 700; min-height: 1.2em; }
.save-state.pending { color: var(--muted); }
.save-state.saving  { color: var(--blue); }
.save-state.saved   { color: #1F7F6E; }
.save-state.error   { color: var(--red-700); }
.updated-at { font-size: .9rem; }
