/* Police Inter (SIL OFL, voir fonts/Inter-LICENSE.txt), servie par l'application : même rendu sur tous les appareils */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #000;
  --panel: #000;
  --panel-2: #0d0d0d;
  --border: #2a2a2a;
  --field: rgba(255, 255, 255, .09); /* fond des champs, listes déroulantes et boutons discrets */
  --field-hover: rgba(255, 255, 255, .15);
  --text: #fff;
  --muted: #9a9a9a;
  --accent: #fff;
  --ok: #34d399;
  --warn: #d29922;
  --bad: #f85149;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
  display: flex;
  flex-direction: column;
}

/* Bandeau */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--panel) url("login-bg.svg") center 35% / 1200px 800px repeat; /* même motif « carte tactique » que la page de connexion */
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .02em; }

/* Couleur d'état du SDR (pastille en forme de bouton) */
.sdr { --c: #484f58; }
.sdr.ready { --c: #059669; }
.sdr.busy, .sdr.tools_missing { --c: #b7791f; }
.sdr.no_device, .sdr.error { --c: #dc2f3c; }
.sdr.simulation { --c: #6552d9; }
.sdr.degraded { --c: #b7791f; } /* réception dégradée : échantillons perdus ou traitement trop lent */

.sdr {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  background: var(--c);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: default;
  user-select: none;
  transition: background .3s;
}
.sdr-stats { padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .35); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sdr-stats[hidden] { display: none; }
@media (max-width: 1100px) { .sdr-stats { display: none; } } /* trop étroit : le détail reste dans l'info-bulle */
.sdr-icon { display: inline-flex; }
.sdr-icon svg { width: 18px; height: 18px; }

/* Icônes Lucide dans les boutons */
button svg { width: 16px; height: 16px; display: block; }

/* Disposition */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  grid-template-columns: 370px minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "freq wf map"
    "freq vu journal";
}
.panel { background: var(--panel); border-radius: 8px; min-width: 0; min-height: 0; overflow: auto; }
.sidebar { grid-area: freq; }
.waterfall { grid-area: wf; display: flex; flex-direction: column; overflow: hidden; }
.map-panel { grid-area: map; display: flex; flex-direction: column; overflow: hidden; }
.main { grid-area: vu; }
.journal { grid-area: journal; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; }
.panel-head h2 { margin: 0; font-size: 16px; line-height: 1; display: flex; align-items: center; gap: 8px; }
/* Icône à gauche du titre d'un panneau */
.panel-head h2 [data-icon], .h-title [data-icon] { display: inline-flex; align-items: center; flex: none; }
.panel-head h2 svg, .h-title svg { width: 18px; height: 18px; display: block; }
.h-title { display: inline-flex; align-items: center; gap: 8px; line-height: 1; }

/* Waterfall */
.wf-wrap { position: relative; flex: 1; min-height: 0; margin: 0 16px 16px; background: #000; border-radius: 8px; overflow: hidden; }
#wf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Mini-spectre au-dessus du waterfall : même largeur, donc les fréquences sont alignées */
.wf-spec { display: block; flex: none; width: calc(100% - 32px); height: 56px; margin: 0 16px 8px; background: #000; border-radius: 8px; }
.wf-spec[hidden] { display: none; }
/* Grille de lecture et repères de temps, par-dessus l'image */
.wf-grid { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: linear-gradient(to right, rgba(255, 255, 255, .12) 1px, transparent 1px), linear-gradient(to right, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 25% 100%, 12.5% 100%; }
.wf-grid[hidden] { display: none; }
.wf-times { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.wf-times[hidden] { display: none; }
.wf-time { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.wf-time[hidden] { display: none; }
.wf-time span { position: absolute; left: 6px; top: -14px; font-size: 10px; color: rgba(255, 255, 255, .6); text-shadow: 0 0 3px #000; font-variant-numeric: tabular-nums; }
/* Fréquences enregistrées mais non écoutées : flèche creuse cliquable ; noms sous les flèches */
.wf-mark.idle { border-top-color: rgba(255, 255, 255, .35); pointer-events: auto; cursor: pointer; }
.wf-mark.idle:hover { border-top-color: #fff; }
.wf-label { position: absolute; z-index: 2; padding: 1px 7px; font-size: 11px; line-height: 15px; color: #a8a8a8; background: rgba(0, 0, 0, .5); border-radius: 8px; white-space: nowrap; pointer-events: none; }
.wf-label.on { color: #fff; background: rgba(0, 0, 0, .7); }
.wf-frozen { position: absolute; z-index: 4; top: 30px; right: 8px; height: 26px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #000; background: var(--warn); border: 0; border-radius: 13px; }
.wf-frozen:hover { background: #fbd36a; }
.wf-frozen[hidden] { display: none; }
.wf-frozen svg { width: 13px; height: 13px; }
.wf-auto { height: 24px; padding: 0 10px; font-size: 12px; font-weight: 600; color: #fff; background: #1c1c1c; border: 0; border-radius: 6px; }
.wf-auto:hover { background: #2a2a2a; }
.wf-mark { position: absolute; z-index: 2; top: 17px; width: 0; height: 0; margin-left: -6px; pointer-events: none; transform-origin: 6px 0; transition: transform .15s;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid rgba(255, 255, 255, .85); }
/* En émission : la flèche devient verte, plus grosse et brille (rien ne masque le signal en dessous) */
.wf-mark.tx { transform: scale(1.35); border-top-color: #34d399; filter: drop-shadow(0 0 4px rgba(52, 211, 153, .8)); }
.wf-empty[hidden] { display: none; }
.wf-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 13px; background: #000; }
/* Axe des fréquences : en haut de l'image, par-dessus (les nouvelles lignes arrivent en haut et descendent) */
.wf-axis { position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 22px; padding: 0 8px; pointer-events: none; font-size: 11px; color: #cfcfcf; font-variant-numeric: tabular-nums; background: linear-gradient(rgba(0, 0, 0, .75), transparent); }
.wf-axis span { position: absolute; top: 3px; transform: translateX(-50%); white-space: nowrap; text-shadow: 0 0 4px #000; }
.wf-axis span:first-child { transform: none; }
.wf-axis span:last-child { transform: translateX(-100%); }

/* Carte */
#map { flex: 1; min-height: 0; margin: 0 16px 16px; border-radius: 8px; background: #111; }
.map-panel.placing #map { cursor: crosshair; }
#map-hint { color: var(--warn); }
.leaflet-container { font: inherit; background: #0a0a0a; }
.leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(1.05) contrast(.9); }
.leaflet-bar a, .leaflet-bar a:hover { background: #111; color: #fff; border-bottom: 0; }
.leaflet-bar a:first-child { margin-bottom: 2px; }
.leaflet-bar a:hover { background: #222; }
.leaflet-bar { border: 0; box-shadow: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #111; color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
.relay { background: none; border: 0; }
.relay-dot { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: #9a9a9a; }
.relay.active .relay-dot { background: #fff; }
.relay-ring { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #34d399; opacity: 0; pointer-events: none; }
.relay.tx .relay-dot { background: #34d399; }
.relay-name { position: absolute; left: 12px; top: -14px; display: flex; flex-direction: column; gap: 1px; padding: 4px 10px 4px 9px; white-space: nowrap; pointer-events: none;
  line-height: 1.2; color: #fff; background: rgba(0, 0, 0, .82); border-radius: 10px; }
.relay-name b { font-size: 13px; font-weight: 700; }
.relay-name i { font-size: 11px; font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.relay.tx .relay-name { background: #059669; }
.relay.tx .relay-name i { color: rgba(255, 255, 255, .8); }
.relay.tx .relay-ring { animation: relay-ping 1.5s ease-out infinite; }
.relay.tx .relay-ring.r2 { animation-delay: .75s; }
@keyframes relay-ping { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(5); opacity: 0; } }
.relay-popup button { padding: 4px 10px; font-size: 12px; }

.sidebar {
  padding: 16px;
}
.sidebar h2 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; justify-content: space-between; }
.sb-right { display: inline-flex; align-items: center; gap: 8px; }
.sidebar .icon-btn { width: 28px; height: 28px; }
form[hidden] { display: none; }
.band { font-size: 12px; font-weight: 400; color: var(--muted); }

form { display: grid; gap: 6px; margin-bottom: 16px; }
label { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--field);
  color: var(--text);
  border: 0;
  border-radius: 6px;
  font: inherit;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="datetime-local"]:focus { outline: none; background: var(--field-hover); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 4px 0; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 0;
  background: #fff;
  color: #000;
}
form button[type="submit"] { padding: 8px; font-weight: 600; }
button:hover { background: #d9d9d9; }
p.error { color: var(--bad); font-size: 13px; margin: 4px 0 0; }

/* Liste */
.freq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.freq-list li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 6px;
  transition: background-color .2s;
}
.freq-list li > div:first-of-type { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
/* Glisser-déposer */
.freq-list li[draggable="true"] { cursor: grab; }
.freq-list li.dragging { opacity: .4; }
.freq-list li.drop-before { box-shadow: 0 -2px 0 0 #fff; }
.freq-list li.drop-after { box-shadow: 0 2px 0 0 #fff; }
.loc-input { text-transform: uppercase; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.relay-loc { margin: 2px 0 6px; font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.freq-tools { display: flex; gap: 6px; margin: 0 0 8px; }
.freq-tools[hidden] { display: none; }
.freq-tools input { flex: 1; min-width: 0; }
.freq-tools .icon-btn { flex: none; width: 36px; height: 36px; }
.freq-mhz { font-variant-numeric: tabular-nums; font-weight: 600; }
.freq-label { display: block; font-size: 12px; color: var(--muted); }
label.check.mini { font-size: 12px; color: var(--muted); margin: 3px 0 0; gap: 6px; }
/* Cases à cocher : décochée = fond plus clair, cochée = blanche avec une coche noire */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 0;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, .16);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px;
  cursor: pointer;
  transition: background-color .12s;
}
input[type="checkbox"]:hover { background-color: rgba(255, 255, 255, .26); }
input[type="checkbox"]:checked {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
input[type="checkbox"]:indeterminate {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
input[type="checkbox"]:checked:hover, input[type="checkbox"]:indeterminate:hover { background-color: #d9d9d9; }
input[type="checkbox"]:focus-visible { outline: 2px solid rgba(255, 255, 255, .55); outline-offset: 2px; }
input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }

/* Journal (colonne de droite) */
.journal {
  padding: 16px;
}
.journal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.journal-head h2 { margin: 0; font-size: 16px; line-height: 1; display: flex; align-items: center; gap: 8px; }
.journal-head h2 [data-icon] { display: inline-flex; align-items: center; }
.journal-head h2 svg { width: 18px; height: 18px; display: block; }
.journal-status { flex: 1; margin: 0 4px; text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.journal-status.ok { color: #34d399; }
.journal-status.warn { color: var(--warn); }
.journal-status.rec { color: #f85149; }
.journal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.j-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 6px;
}
.j-item.live { background: #1c1010; grid-template-columns: 1fr auto; align-items: center; }
.j-item .icon-btn:not(.on) { background: #1c1c1c; border-color: transparent; }
.j-item .icon-btn:not(.on):hover { background: #2a2a2a; border-color: transparent; }
.j-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.j-label { font-size: 12px; color: var(--muted); }
.j-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.j-item.live .j-meta { color: #f85149; }
.rec-live { display: flex; align-items: center; gap: 7px; color: #f85149; font-size: 14px; font-variant-numeric: tabular-nums; padding-right: 4px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #f85149; flex: none; animation: rec-blink 1.2s ease-in-out infinite; }
.rec-time { font-weight: 600; }
@keyframes rec-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.icon-btn { width: 32px; height: 32px; padding: 0; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:not(.on) { background: var(--field); color: #fff; }
.icon-btn:not(.on):hover { background: var(--field-hover); }
.empty { color: var(--muted); font-size: 13px; }

/* Zone principale */
.main { padding: 16px; display: flex; }
.player { width: 100%; display: flex; flex-direction: column; text-align: center; min-height: 0; }
.muted { color: var(--muted); margin: 2px 0 8px; font-size: 13px; }
/* Curseurs : poignée blanche sans bordure, piste remplie en blanc (--fill posé par app.js) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--fill, 0%), #3a3a3a var(--fill, 0%));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff var(--fill, 0%), #3a3a3a var(--fill, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}
button:disabled { background: #222; border-color: #222; color: #666; cursor: not-allowed; }

@media (max-width: 700px) {
  body { height: auto; }
  .layout { display: flex; flex-direction: column; }
  .panel { overflow: visible; }
  .waterfall { height: 300px; }
  .map-panel { height: 380px; }
}

/* Réglages du waterfall */
/* Bandeau de réglages flottant : le waterfall passe dessous */
.wf-opts { position: absolute; z-index: 3; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 8px 44px 8px 12px; background: rgba(10, 10, 10, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-radius: 8px; }
.wf-opts[hidden] { display: none; }
.wf-opts label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #c4c4c4; white-space: nowrap; }
.wf-opts label span { min-width: 38px; color: var(--text); font-variant-numeric: tabular-nums; }
.wf-opts input[type="range"] { width: 84px; }
.wf-opts label.check { margin: 0; }
select { font: inherit; font-size: 12px; padding: 3px 6px; background: var(--field); color: #fff; border: 0; border-radius: 6px; }

.row-actions { display: flex; gap: 6px; }
.row-more { grid-column: 1 / -1; display: flex; gap: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .06); }
.freq-list li.editing { grid-template-columns: 1fr; gap: 8px; padding-left: 10px; }
.edit-actions { display: flex; gap: 6px; }

/* Clic sur le waterfall */
#wf-canvas { cursor: crosshair; }
.wf-cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .6); pointer-events: none; }
.wf-cursor[hidden], .wf-pop[hidden] { display: none; }
.wf-cursor span { position: absolute; top: 26px; left: 6px; padding: 2px 6px; font-size: 12px; line-height: 1.35; white-space: pre; background: rgba(0, 0, 0, .85); border-radius: 4px; }
.wf-cursor span.left { left: auto; right: 6px; }
.wf-pop { position: fixed; z-index: 1000; width: 240px; display: grid; gap: 8px; padding: 12px; background: #111; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .9); }
.wf-pop-actions { display: flex; gap: 6px; }
.wf-pop-actions button:not(.icon-btn) { flex: 1; padding: 7px 4px; font-size: 13px; font-weight: 600; }

/* Console : tranches verticales */
.console { flex: 1; min-height: 304px; display: flex; gap: 10px; margin-bottom: 12px; }
.strips { display: flex; gap: 10px; flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.strip { flex: 0 0 auto; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; background: var(--panel-2); border-radius: 8px; }
/* Volume et gain : chacun sur sa propre tranche ; une fine barre de niveau de sortie (2 px) à côté du fader de volume */
.masters { flex: none; display: flex; gap: 10px; }
.strip.master-strip { width: 68px; }
.master-strip .fader-slot { justify-content: center; gap: 8px; }
.level { position: relative; flex: none; width: 2px; border-radius: 1px; background: #2e2e2e; }
/* Partie allumée : dégradé vert, orange, rouge ancré sur toute la hauteur de la barre (on n'en montre que le bas).
   Le halo est le même dégradé, élargi et flouté : il change de couleur avec la hauteur, comme la lumière d'une rampe de LED.
   --lv : niveau (0..1) ; --th : hauteur de la barre en px (pour que le dégradé reste ancré quand la partie allumée grandit). */
.level { --lv-grad: linear-gradient(to top, #22e07a 0, #22e07a 62%, #ffb020 74%, #ffb020 84%, #ff4d4d 93%, #ff4d4d 100%); }
.level-lit { position: absolute; inset: 0; }
.level-fill { position: absolute; inset: 0; border-radius: 1px; clip-path: inset(100% 0 0 0); background: var(--lv-grad); }
.level-glow { position: absolute; bottom: 0; height: calc(var(--lv, 0) * 100%); background: var(--lv-grad); background-size: 100% var(--th, 240px); background-position: bottom; pointer-events: none; }
.level-glow.near { left: -2px; right: -2px; filter: blur(3px); opacity: .9; }
.level-glow.far { left: -6px; right: -6px; filter: blur(7px); opacity: .55; }
.strip-val { min-height: 16px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.strip-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }
.strip-body, .fader-slot { flex: 1; min-height: 110px; display: flex; gap: 10px; padding: 8px 0; align-items: stretch; }
.vmeter { position: relative; width: 16px; background-color: #000; border-radius: 3px; }
/* Graduation : de petits traits de chaque côté de la barre (tous les 12,5 %), pas à l'intérieur */
.vmeter::before, .vmeter::after { content: ""; position: absolute; top: 0; bottom: 0; width: 4px;
  background-image: repeating-linear-gradient(to top, transparent 0, transparent calc(12.5% - 1px), #6b6b6b calc(12.5% - 1px), #6b6b6b 12.5%); }
.vmeter::before { left: -6px; }
.vmeter::after { right: -6px; }
.meter-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #fff; border-radius: 0 0 3px 3px; transition: height .08s linear; }
.meter-fill.open { background: var(--ok); }
.meter-sq { position: absolute; left: 0; right: 0; height: 2px; margin-bottom: -1px; background: var(--bad); }
.meter-sq[hidden] { display: none; }
.fader { position: relative; width: 28px; cursor: pointer; touch-action: none; outline: none; }
.fader::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; border-radius: 2px;
  background: linear-gradient(to top, #fff var(--fill, 0%), #3a3a3a var(--fill, 0%)); }
.fader-cap { position: absolute; left: 0; right: 0; height: 14px; margin-bottom: -7px; background: #fff; border-radius: 3px; }
.fader:focus-visible .fader-cap { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }

.freq-list .icon-btn:not(.on) { background: #1c1c1c; border-color: transparent; }
.freq-list .icon-btn:not(.on):hover { background: #2a2a2a; border-color: transparent; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; align-items: baseline; gap: 10px; }
.brand-icon { display: inline-flex; color: #fff; }
.brand-icon svg { width: 26px; height: 26px; display: block; }
.brand h1 { line-height: 1; }
.version { font-size: 12px; font-weight: 600; line-height: 1; color: var(--muted); letter-spacing: .02em; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.sim-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; font-size: 14px; font-weight: 600; background: #1c1c1c; color: #fff; border: 0; border-radius: 8px; }
.sim-btn:hover { background: #2a2a2a; border: 0; }
.sim-btn.on { background: #fff; color: #000; }
.sim-btn.on:hover { background: #d9d9d9; }
.sim-btn svg { width: 16px; height: 16px; }
.sim-btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.audio-btn.attn { background: var(--warn); color: #000; animation: audio-attn 1.6s ease-in-out infinite; }
@keyframes audio-attn { 50% { opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .audio-btn.attn { animation: none; } }

/* Journalisation active (rouge) ; pulse pendant qu'une réception est enregistrée */
/* Journal « armé » : fond rouge sombre et icône rouge ; plein rouge qui pulse uniquement pendant un enregistrement */
.freq-list .icon-btn.icon-btn.rec { background: #3a1519; color: #f85149; border-color: transparent; }
.freq-list .icon-btn.icon-btn.rec:hover { background: #4b1b21; }
.freq-list .icon-btn.icon-btn.rec.live { background: #dc2f3c; color: #fff; animation: rec-pulse 1.4s ease-in-out infinite; }
@keyframes rec-pulse { 50% { background: #a8222d; } }

/* Carte : échelle, coordonnées et commandes arrondies, dans la police du site */
.map-hud { margin: 0 0 4px 12px !important; padding: 3px 9px; font-size: 11px; font-variant-numeric: tabular-nums; color: #d4d4d4; background: rgba(0, 0, 0, .7); border-radius: 10px; }
.leaflet-control-scale { margin-left: 12px !important; }
.leaflet-control-scale-line { padding: 1px 9px; font-size: 10px; color: #d4d4d4; background: rgba(0, 0, 0, .7); border-color: #d4d4d4; border-radius: 0 0 8px 8px; }
.leaflet-bar a { border-radius: 8px !important; }
.leaflet-popup-content-wrapper { border-radius: 10px; font-size: 13px; }

/* Fenêtre d'administration */
.dialog { width: min(920px, 94vw); height: min(540px, 92vh); padding: 0; background: #111; color: var(--text); border: 0; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .9); }
.dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog .icon-btn:not(.on) { background: #1c1c1c; border-color: transparent; }
.dialog .icon-btn:not(.on):hover { background: #2a2a2a; border-color: transparent; }
.admin-section { margin: 8px 16px 16px; padding: 14px; background: var(--panel-2); border-radius: 8px; }
.admin-section h3 { margin: 0 0 6px; font-size: 14px; }
.admin-help { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; margin: 0 0 14px; }
.admin-stats div { display: flex; flex-direction: column; gap: 1px; }
.admin-stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.admin-stats dd { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.admin-section button:not(.icon-btn) { padding: 8px 14px; font-weight: 600; }

.admin-bar { height: 6px; margin: 0 0 14px; background: #1c1c1c; border-radius: 3px; overflow: hidden; }
#tc-bar { height: 100%; width: 0; background: var(--ok); border-radius: 3px; transition: width .3s; }
#tc-bar.full { background: var(--warn); }
.admin-actions { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.admin-limit { margin: 0; }
.admin-limit label { display: block; margin-bottom: 4px; }
.admin-limit-row { display: flex; align-items: center; gap: 8px; }
.admin-limit-row input { width: 120px; }
.admin-limit-row span { font-size: 13px; color: var(--muted); }
.admin-section #tc-clear:hover, .admin-section #tc-clear:focus-visible { background: var(--bad); border-color: var(--bad); color: #fff; }
.dialog:focus { outline: none; }

.admin-credits { margin: 0 16px 16px; font-size: 11px; color: var(--muted); }
.admin-credits a { color: inherit; }

/* Onglets de l'administration */
.tabs { display: flex; gap: 4px; margin: 4px 16px 6px; }
.tab { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 6px; }
.tab:hover { background: #1c1c1c; color: #fff; border: 0; }
.tab[aria-selected="true"] { background: #1c1c1c; color: #fff; }

/* Console du serveur */
.console-bar { display: flex; align-items: center; justify-content: space-between; margin: 8px 16px; }
.console-bar label.check { margin: 0; }
.console-bar button { padding: 5px 12px; font-size: 13px; font-weight: 600; }
.console-log { flex: 1; min-height: 0; margin: 0 16px 16px; padding: 8px 10px; overflow: auto; background: #070707; border-radius: 8px; font: 400 12px/1.5 var(--mono); color: #d4d4d4; }
.console-log:focus-visible { outline: 2px solid rgba(255, 255, 255, .35); outline-offset: 1px; }
.log-line { display: flex; gap: 10px; white-space: pre-wrap; word-break: break-word; }
.log-time { flex: none; color: #6b6b6b; font-variant-numeric: tabular-nums; }
.log-line.warn { color: var(--warn); }
.log-line.error { color: var(--bad); }

/* Taille fixe : les onglets défilent à l'intérieur, la fenêtre ne bouge plus quand on change d'onglet */
.dialog[open] { display: flex; flex-direction: column; }
.dialog .dialog-head, .dialog .tabs { flex: none; }
.dialog [role="tabpanel"] { flex: 1; min-height: 0; overflow: auto; }
#panel-console:not([hidden]) { display: flex; flex-direction: column; overflow: hidden; }

/* Onglet Journal de l'administration */
.admin-limits { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; }
.admin-limits > button { margin-left: auto; }
#jr-bar { height: 100%; width: 0; background: var(--ok); border-radius: 3px; transition: width .3s; }
#jr-bar.full { background: var(--warn); }
.admin-section strong { color: var(--text); }
.admin-section button.danger:hover:not(:disabled), .admin-section button.danger:focus-visible { background: var(--bad); border-color: var(--bad); color: #fff; }
.tag-sim { padding: 1px 7px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: #6552d9; border-radius: 999px; }

/* Bouton « muet » des tranches de la console */
.strip-btns { align-self: stretch; display: flex; gap: 4px; }
.strip .icon-btn.mute { flex: 1; width: auto; min-width: 0; height: 28px; background: #1c1c1c; border-color: transparent; }
.solo-btn { flex: 1; min-width: 0; height: 28px; padding: 0; font-size: 13px; font-weight: 700; line-height: 1; color: #fff; background: #1c1c1c; border: 0; border-radius: 6px; }
.solo-btn:hover { background: #2a2a2a; }
.solo-btn.is-solo { background: #f5c518; color: #000; }
.solo-btn.is-solo:hover { background: #ffd93d; }
.strip .icon-btn.mute svg { width: 15px; height: 15px; }
.strip .icon-btn.mute:hover { background: #2a2a2a; border-color: transparent; }
.strip .icon-btn.mute.is-muted { background: var(--bad); color: #fff; }
.strip .icon-btn.mute.is-muted:hover { background: #ff6a62; }

/* Onglet Audio de l'administration */
.audio-row { margin: 0 0 16px; }
.audio-row > label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.audio-row label.check { margin: 0 0 2px; }
.audio-row .admin-help { margin: 4px 0 0; }
.audio-row select { min-width: 220px; padding: 6px 8px; font-size: 13px; }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; font-weight: 400; }
button.ghost:hover { background: #1c1c1c; color: #fff; border-color: transparent; }

.sim-btn[hidden] { display: none; }

/* Page de connexion */
/* Fond « carte tactique » (courbes de niveau et grille), généré par tools/gen-login-bg.js ; un voile sombre au centre garde le formulaire lisible */
.auth-page {
  display: block;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 55%, rgba(0, 0, 0, 0) 100%), url("login-bg.svg") center / 1200px 800px repeat, #000;
}
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(380px, 100%); display: grid; gap: 6px; margin: 0; padding: 0; } /* pas de cadre : le formulaire est posé directement sur le fond */
/* Titre centré : icône au-dessus, version en dessous */
.auth-card .brand { flex-direction: column; gap: 8px; margin-bottom: 14px; text-align: center; }
.auth-card .brand-text { flex-direction: column; align-items: center; gap: 4px; }
.auth-card .brand-icon svg { width: 68px; height: 68px; }
.auth-card .admin-help[hidden] { display: none; }
.auth-card h2 { margin: 6px 0 0; font-size: 17px; }
.auth-card .admin-help { margin: 0 0 8px; }
.auth-card input { background: #171717; } /* opaque : le motif du fond ne transparaît pas dans les champs */
.auth-card input:focus { background: #262626; } /* idem au clic (équivalent opaque du fond « survol ») */

.pw-wrap { position: relative; display: grid; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 0; border-radius: 6px; color: var(--muted); }
.pw-eye:hover { background: transparent; color: #fff; }
.pw-eye svg { width: 18px; height: 18px; display: block; }
.auth-card .auth-extra { display: grid; gap: 6px; }
.auth-card .auth-extra[hidden] { display: none; }
.auth-card button[type="submit"] { margin-top: 10px; padding: 10px; font-weight: 600; }

/* Mon compte, utilisateurs */
.dialog.compact { width: min(440px, 94vw); height: fit-content; max-height: 92vh; }
.dialog.compact .admin-section { margin-bottom: 8px; }
.dialog-foot { display: flex; justify-content: flex-end; padding: 0 16px 16px; }
.dialog-foot button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-weight: 600; }
.dialog-foot button svg { width: 16px; height: 16px; }
.dialog button.danger:hover, .dialog button.danger:focus-visible { background: var(--bad); border-color: var(--bad); color: #fff; }
.account-who { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.avatar-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.avatar-edit .account-who { margin-bottom: 10px; }
.avatar-actions { display: flex; align-items: center; gap: 8px; }
.avatar-actions button.with-icon { padding: 6px 12px; font-size: 13px; }
.avatar-actions .icon-btn[hidden] { display: none; }
#avatar-msg { margin: 0 0 12px; }
/* Image de profil : ronde, ou initiale sur une couleur propre au compte */
.avatar-slot { display: inline-flex; flex: none; }
.avatar { position: relative; display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; overflow: hidden; border-radius: 50%; background: hsl(var(--h, 220) 45% 38%); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.md { width: 36px; height: 36px; font-size: 15px; }
.avatar.lg { width: 72px; height: 72px; font-size: 30px; }
.pw-form { display: grid; gap: 6px; margin: 8px 0 0; }
.pw-form button { margin-top: 8px; padding: 8px; font-weight: 600; }
#pw-msg.ok { color: var(--ok); }
.role-pill { padding: 1px 8px; font-size: 11px; font-weight: 700; color: var(--muted); background: #1c1c1c; border-radius: 999px; }
.role-pill.admin { color: #fff; background: #6552d9; }
.user-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.user-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px 12px; padding: 8px 10px; background: #151515; border-radius: 6px; }
.user-info { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.user-meta { font-size: 12px; color: var(--muted); }
.user-actions { display: flex; align-items: center; gap: 6px; }
.user-actions select { padding: 5px 8px; }
.user-actions .icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.user-pw { grid-column: 1 / -1; display: flex; gap: 6px; }
.user-pw[hidden] { display: none; }
.user-pw input { flex: 1; }
.user-pw button { padding: 6px 14px; font-weight: 600; }
.user-form { display: grid; grid-template-columns: 1fr 1fr auto auto; align-items: end; gap: 8px 12px; }
.user-form > div { display: grid; gap: 4px; min-width: 0; }
.user-form label { font-size: 12px; }
.user-form button { padding: 8px 14px; font-weight: 600; }
@media (max-width: 760px) { .user-form { grid-template-columns: 1fr 1fr; } }

/* Onglet Sauvegarde */
.backup-checks { display: grid; gap: 2px; margin: 0 0 10px; }
.backup-checks label.check { margin: 3px 0; font-size: 13px; }
.inline-note { color: var(--muted); font-size: 12px; margin-left: 4px; }
.warn-note { color: var(--warn); margin: 0 0 10px; }
button.with-icon { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; font-weight: 600; }
button.with-icon svg { width: 16px; height: 16px; }
.file-input { width: 100%; padding: 6px; font-size: 13px; color: var(--muted); background: var(--field); border-radius: 6px; }
.file-input::file-selector-button { margin-right: 12px; padding: 6px 12px; font: inherit; font-weight: 600; color: #000; background: #fff; border: 0; border-radius: 6px; cursor: pointer; }
.file-input::file-selector-button:hover { background: #d9d9d9; }
#im-progress { margin-top: 10px; }
#im-bar { height: 100%; width: 0; background: var(--ok); border-radius: 3px; transition: width .15s; }
#im-options { margin-top: 12px; }
.im-summary { margin: 0 0 12px; font-size: 13px; }
.im-row { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.im-row > label:not(.check) { min-width: 90px; font-size: 13px; color: var(--text); }
.im-row label.check { margin: 0; font-size: 13px; }
.im-row select { padding: 6px 8px; font-size: 13px; }
.im-actions { display: flex; gap: 8px; margin-top: 14px; }
.im-actions button:not(.ghost) { padding: 8px 18px; font-weight: 600; }
.im-result { margin: 12px 0 0; padding: 10px 12px 10px 28px; font-size: 13px; color: var(--ok); background: #101a15; border-radius: 6px; }
.im-result[hidden] { display: none; }

/* Bouton pour replier / déplier le bandeau */
.wf-toggle { position: absolute; z-index: 4; right: 14px; bottom: 14px; width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: transparent; border: 0; border-radius: 6px; }
.wf-toggle:hover { background: rgba(255, 255, 255, .14); border: 0; }
.wf-toggle svg { width: 16px; height: 16px; }
.wf-toggle.floating { right: 8px; bottom: 8px; background: rgba(10, 10, 10, .72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wf-toggle.floating:hover { background: rgba(40, 40, 40, .85); }

/* Journal avancé : grande fenêtre de recherche */
.dialog.large { width: min(1040px, 96vw); height: min(720px, 92vh); }
/* Discussion */
.chat-btn { position: relative; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; font-size: 10px; font-weight: 700; line-height: 1; color: #fff; background: var(--bad); border-radius: 999px; }
.badge[hidden] { display: none; }
.dialog.chat { width: min(460px, 94vw); height: min(640px, 92vh); }
.chat-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 16px 12px; }
.chat-more { align-self: center; padding: 5px 12px; font-size: 12px; }
.chat-empty { margin: auto; text-align: center; }
.chat-day { align-self: center; padding: 2px 10px; font-size: 11px; color: var(--muted); background: #1c1c1c; border-radius: 999px; text-transform: capitalize; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-body { min-width: 0; max-width: calc(100% - 40px); padding: 6px 10px 7px; background: #1c1c1c; border-radius: 4px 12px 12px 12px; }
.chat-msg.mine { flex-direction: row-reverse; } /* ses propres messages : à droite, avatar et bulle inversés */
.chat-msg.mine .chat-body { background: #26323a; border-radius: 12px 4px 12px 12px; }
.chat-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.chat-meta time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-text { margin-top: 2px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-del { width: 20px; height: 20px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.chat-del svg { width: 13px; height: 13px; }
.chat-msg:hover .chat-del, .chat-del:focus-visible { opacity: 1; }
@media (hover: none) { .chat-del { opacity: .6; } }
.chat-err { margin: 0 16px 6px; }
.chat-form { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 0 16px 16px; }
.chat-form textarea { flex: 1; min-width: 0; resize: none; max-height: 110px; padding: 8px 10px; font: inherit; font-size: 14px; line-height: 1.35; color: var(--text); background: var(--field); border: 0; border-radius: 8px; }
.chat-form textarea:focus { outline: 2px solid rgba(255, 255, 255, .35); }
.chat-send { width: 36px; height: 36px; flex: none; }
.dialog.notes { width: min(560px, 94vw); height: min(600px, 92vh); }
.notes-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 16px 16px; }
.notes-version { margin-bottom: 18px; }
.notes-version h3 { display: flex; align-items: center; gap: 4px; margin: 0 0 6px; font-size: 15px; }
.notes-date { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.notes-version ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.5; }
.notes-version li { margin-bottom: 4px; }
.dialog-head h2 [data-icon] { display: inline-flex; vertical-align: -3px; margin-right: 8px; }
.dialog-head h2 svg { width: 18px; height: 18px; }
.js-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; align-items: end; margin: 4px 16px 10px; padding: 0; }
.js-field { display: grid; gap: 4px; min-width: 0; }
.js-field[hidden] { display: none; }
.js-field label { font-size: 12px; color: var(--muted); }
.js-field select, .js-field input { width: 100%; height: 34px; padding: 0 8px; font-size: 13px; }
.js-actions { grid-column: -2 / -1; display: flex; justify-content: flex-end; gap: 6px; }
.js-actions button { white-space: nowrap; }
.js-summary { margin: 0 16px 8px; font-size: 13px; color: var(--muted); min-height: 19px; }
.js-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 16px 16px; }
.js-scroll .j-item { background: #161616; }
.js-more { display: block; margin: 12px auto 4px; padding: 8px 18px; font-weight: 600; }
.js-more[hidden] { display: none; }
@media (max-width: 760px) { .js-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .js-actions { grid-column: 1 / -1; } }

/* Journal avancé : sélection et export */
.js-selbar { display: flex; align-items: center; gap: 10px; margin: 0 16px 8px; padding: 6px 10px; background: #161616; border-radius: 8px; }
.js-selbar label.check { margin: 0; font-size: 13px; color: var(--text); white-space: nowrap; }
.js-selinfo { font-size: 12px; color: var(--muted); }
.js-spacer { flex: 1; }
.js-selbar button.with-icon { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.link-btn { padding: 0; font-size: 12px; font-weight: 400; color: #9ec5ff; background: transparent; border: 0; text-decoration: underline; }
.link-btn:hover { background: transparent; color: #fff; border: 0; }
.link-btn[hidden] { display: none; }
.js-exportmsg { margin: 0 16px 8px; font-size: 12px; color: var(--ok); }
.js-exportmsg[hidden] { display: none; }
.j-item.selectable { grid-template-columns: auto 1fr auto auto auto; }
.j-item.selected { background: #1d2230 !important; }
.j-check { width: 16px; height: 16px; margin: 0 4px 0 0; cursor: pointer; }
@media (max-width: 760px) { .js-selbar { flex-wrap: wrap; } }
