/* Veille drones : interface d'administration. Palette "poste de contrôle au sol" :
   gris hangar, encre marine, sarcelle horizon pour les liens, magenta de carte aéronautique pour l'état. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #0f1b2d;
  --muted: #5b6b7c;
  --line: #d9e0e7;
  --accent: #1f7a8c;
  --accent-ink: #ffffff;
  --beacon: #b4236b;
  --ok: #2e7d4f;
  --warn: #b26a00;
  --err: #b3261e;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 8px 24px -16px rgba(15, 27, 45, .25);
  --radius: 10px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d141c; --surface: #152030; --surface-2: #1b2838; --ink: #e8eef3; --muted: #93a3b3; --line: #253546;
    --accent: #4fb3c7; --accent-ink: #061217; --beacon: #e0569a; --ok: #5cc48a; --warn: #e3a94a; --err: #ff7b6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #0d141c; --surface: #152030; --surface-2: #1b2838; --ink: #e8eef3; --muted: #93a3b3; --line: #253546;
  --accent: #4fb3c7; --accent-ink: #061217; --beacon: #e0569a; --ok: #5cc48a; --warn: #e3a94a; --err: #ff7b6e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: .01em; line-height: 1.1; margin: 0; }
h1 { font-size: 36px; font-weight: 600; }
h2 { font-size: 26px; font-weight: 600; }
h3 { font-size: 20px; font-weight: 600; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--beacon); outline-offset: 2px; }

/* Structure */
.shell { display: grid; grid-template-columns: 204px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); padding: 4px 10px 22px; }
.brand-top { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
.brand-sub { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: .18em; text-transform: uppercase; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { background: var(--surface-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.agent-light { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.agent-light .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.agent-light--running .dot { background: var(--beacon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--beacon) 25%, transparent); animation: beacon 1.1s ease-in-out infinite; }
.agent-light--error .dot { background: var(--err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 20%, transparent); }
@keyframes beacon { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .agent-light--running .dot { animation: none; } }
.main { padding: 34px 40px 60px; max-width: 1080px; width: 100%; }
.main--wide { max-width: none; }

/* En-tête de page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin: 4px 0 0; max-width: 60ch; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }

/* Bande de vol (état de l'agent) */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 26px; }
.strip > div { padding: 16px 20px 14px; border-right: 1px solid var(--line); min-width: 0; }
.strip > div:last-child { border-right: 0; }
.strip .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.strip .val { font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .val small { font-size: 15px; font-weight: 500; color: var(--muted); font-family: var(--body); margin-left: 6px; }
.strip .sub { font-size: 13px; color: var(--muted); margin: 6px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .val.ok { color: var(--ok); } .strip .val.err { color: var(--err); } .strip .val.warn { color: var(--warn); } .strip .val.live { color: var(--beacon); }

/* Cartes et grilles */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid { margin-top: 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tag { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.tag--ok { color: var(--ok); } .tag--err { color: var(--err); } .tag--warn { color: var(--warn); } .tag--live { color: var(--beacon); }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }

/* Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .when { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 9ch; }
.list .grow { flex: 1; min-width: 0; }
.list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.list a:hover { color: var(--accent); }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
td form { display: inline; }

/* Formulaires */
form.stack { display: grid; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { font-family: var(--display); font-size: 20px; font-weight: 600; padding: 0; margin-bottom: 6px; }
label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; }
label .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 6px; }

/* Boutons */
.btn { font: inherit; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 9px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; line-height: 1.2; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn-danger:hover { border-color: var(--err); color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* Messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; border: 1px solid var(--line); background: var(--surface); }
.flash--ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); color: var(--ok); }
.flash--err { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); color: var(--err); }
.flash--warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); color: var(--warn); }
.notice { padding: 12px 14px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); color: var(--ink); font-size: 14px; margin-bottom: 16px; }

/* Rapport */
.report { max-width: 760px; }
.rep-head { padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.rep-headline { font-size: 38px; font-weight: 600; margin: 4px 0 12px; }
.rep-intro { font-size: 17px; line-height: 1.55; color: var(--ink); margin: 0; }
.rep-section { padding: 18px 0 4px; }
.rep-theme { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); border-top: 2px solid var(--accent); padding-top: 10px; margin-bottom: 14px; font-weight: 500; }
.rep-item { padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.rep-item:last-child { border-bottom: 0; }
.rep-item h4 { font-family: var(--body); font-size: 16px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.rep-item h4 a { color: var(--ink); text-decoration: none; }
.rep-item h4 a:hover { color: var(--accent); }
.rep-item p { font-size: 14.5px; margin: 0 0 4px; }
.rep-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px !important; }
.rep-host { font-family: var(--mono); }
.rep-why { color: var(--beacon); }
.rep-signals ul, .rep-leftovers { padding-left: 18px; margin: 0; }
.rep-signals li, .rep-leftovers li { margin-bottom: 6px; }
.rep-leftovers a { color: var(--ink); text-decoration: none; font-weight: 500; }
.rep-leftovers a:hover { color: var(--accent); }

/* Connexion */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login { width: min(400px, 100%); }
.login .brand { padding: 0 0 18px; }
.login .card { padding: 28px; }

/* Détails d'exécution */
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
pre.json { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 360px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .brand { flex-direction: row; align-items: baseline; gap: 8px; padding: 0 8px 0 0; }
  .brand-top { font-size: 22px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link span { display: none; }
  .nav-link { padding: 8px; }
  .nav-link.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
  .rail-foot { margin-left: auto; flex-direction: row; align-items: center; }
  .agent-light span:last-child { display: none; }
  .main { padding: 22px 16px 50px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div:nth-child(2) { border-right: 0; }
  .strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  .rep-headline { font-size: 30px; }
  table { display: block; overflow-x: auto; }
}
