:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1b1f24;
  --muted: #5b6672;
  --line: #d8dde3;
  --accent: #0b5d3b;
  --accent-ink: #ffffff;
  --warn: #8a5300;
  --warn-bg: #fdf3e2;
  --danger: #8c1d1d;
  --danger-bg: #fbeaea;
  --ok: #17603f;
  --ok-bg: #e7f3ec;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #1a6fd4;
  outline-offset: 2px;
}

header.app {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
}
header.app a { color: var(--accent-ink); }
header.app nav { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
header.app .brand { font-weight: 700; margin-right: auto; text-decoration: none; }

main { padding: 1rem; max-width: 1200px; margin: 0 auto; }

h1 { font-size: 1.35rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 0.98rem; margin: 0.75rem 0 0.35rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.grid { display: grid; gap: 0.85rem; }
@media (min-width: 900px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }
.table-scroll { overflow-x: auto; }

.tag {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
  font-size: 0.78rem; border: 1px solid var(--line); background: #eef1f4;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7dcc6; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: #e8cf9f; }
.tag.danger { background: var(--danger-bg); color: var(--danger); border-color: #e5b4b4; }

.muted { color: var(--muted); font-size: 0.88rem; }

button, .btn {
  font: inherit; padding: 0.45rem 0.8rem; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  cursor: pointer; text-decoration: none; display: inline-block;
}
button.secondary, .btn.secondary { background: var(--surface); color: var(--accent); }

input, select, textarea {
  font: inherit; padding: 0.4rem 0.5rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink);
  max-width: 100%;
}

form.inline { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: 0.2rem; margin-bottom: 0.6rem; }
.field label { font-size: 0.85rem; color: var(--muted); }

ul.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.messages li {
  padding: 0.5rem 0.75rem; border-radius: var(--radius); margin-bottom: 0.4rem;
  border: 1px solid var(--line); background: var(--surface);
}
ul.messages li.error { background: var(--danger-bg); border-color: #e5b4b4; color: var(--danger); }
ul.messages li.success { background: var(--ok-bg); border-color: #b7dcc6; color: var(--ok); }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0.25rem 0 0.4rem 0.75rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
details.action { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.6rem; background: var(--surface); }
details.action summary { cursor: pointer; font-weight: 600; }

@media (max-width: 640px) {
  main { padding: 0.75rem; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button, .actions .btn { width: 100%; text-align: center; }
}

/* --- tableau de bord ---------------------------------------------------- */
.kpi-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.7rem 0.85rem;
}
.kpi .value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .label { color: var(--muted); font-size: 0.85rem; }
.kpi .detail { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }

.bar { background: #e9edf1; border-radius: 999px; height: 8px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.note {
  border-left: 3px solid var(--accent); background: var(--ok-bg);
  padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.9rem;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- carte -------------------------------------------------------------- */
#ops-map {
  height: 60vh;
  min-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #e9edf1;
}
.team-pin span {
  display: block;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.map-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.85rem; }
.map-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 0.3rem; vertical-align: middle;
}
.map-legend .ot::before { background: #0b5d3b; }
.map-legend .att::before { background: #5b6672; }
.map-legend .dispo::before { background: #17603f; }
.map-legend .occ::before { background: #8a5300; }
.map-legend .mob::before { background: #1f4e79; }
