/*
  ============================================================
  MYRSA – Nouveau CSS (remplacement complet)
  Remplace : style.css, style_myotis.css, css_charts.css
  ============================================================
*/

/* DM Sans */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-300.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-500.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-600.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-700.woff2') format('woff2');
}

/* DM Mono */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-500.woff2') format('woff2');
}

/* DM Sans – variantes supplémentaires (italiques et graisses extrêmes) */
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 100;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-100italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 200;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-200italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-300italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-500italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-600italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-700italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-800italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-900italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-100.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-200.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-800.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/dm-sans-v17-latin_latin-ext-900.woff2') format('woff2');
}

/* DM Mono – variantes supplémentaires (italiques et graisses extrêmes) */
@font-face {
  font-family: 'DM Mono';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-300italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Mono';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Mono';
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-500italic.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/dm-mono-v16-latin_latin-ext-300.woff2') format('woff2');
}

/* ── VARIABLES ── */
:root {
  --bg:            #f5f6f8;
  --surface:       #ffffff;
  --surface2:      #f0f2f5;
  --border:        #e2e5ea;
  --text:          #1a1d23;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;
  --accent:        #2563eb;
  --accent-light:  #eff6ff;
  --accent-mid:    #bfdbfe;
  --ok:            #16a34a;
  --ok-bg:         #f0fdf4;
  --ok-border:     #bbf7d0;
  --warn:          #d97706;
  --warn-bg:       #fffbeb;
  --warn-border:   #fde68a;
  --alarm:         #dc2626;
  --alarm-bg:      #fef2f2;
  --alarm-border:  #fecaca;
  --defaut:        #7c3aed;
  --defaut-bg:     #faf5ff;
  --gsm: 	   #fde68a;	
 
  --sidebar:       #1e2532;
  --sidebar-text:  #c9d1dc;
  --sidebar-hover: #2a3347;
  --header-h:      60px;
  --sidebar-w:     240px;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,.10);
  --surface-2:     #f0f2f5; /* alias de --surface2 */
  --bg-muted:      #f0f2f5; /* alias de --surface2 */
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

img, a img { outline: none; border: 0; }
a { text-decoration: none; outline: none; }

/* ══════════════════════════════════════════════
   LAYOUT PRINCIPAL
   Structure : .myrsa-shell > .myrsa-sidebar + .myrsa-main
══════════════════════════════════════════════ */

.myrsa-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  /* Sur mobile le shell commence sous la mobile-bar */
  background: var(--bg);
}

/* ── SIDEBAR ── */
.myrsa-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.myrsa-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.myrsa-brand-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.myrsa-brand-icon svg { width: 16px; height: 16px; stroke: white; fill: none; stroke-width: 2.2; }

.myrsa-brand-text {
  color: white;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.myrsa-brand-text span { color: #93c5fd; }

.myrsa-nav-section { padding: 18px 10px 6px; }

.myrsa-nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(201,209,220,.4);
  padding: 0 8px;
  margin-bottom: 4px;
}

.myrsa-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all .12s;
  font-size: 13.5px;
  font-weight: 400;
  text-decoration: none;
}

.myrsa-nav-item:hover { background: var(--sidebar-hover); color: white; }
.myrsa-nav-item.actif { background: var(--accent); color: white; }
.myrsa-nav-item.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.myrsa-nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0; opacity: .75;
  fill: none; stroke: currentColor; stroke-width: 2;
}

.myrsa-nav-item.actif svg { opacity: 1; }

.myrsa-nav-badge {
  margin-left: auto;
  background: var(--alarm);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
}

.myrsa-sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.myrsa-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.myrsa-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white;
  flex-shrink: 0;
  font-family: 'DM Sans', sans-serif;
}

.myrsa-user-info { flex: 1; min-width: 0; }
.myrsa-user-name { color: white; font-size: 13px; font-weight: 500; }
.myrsa-user-role { color: var(--sidebar-text); font-size: 11px; opacity: .6; }

.myrsa-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
}

.myrsa-logout:hover { background: rgba(220,38,38,.2); color: #fca5a5; }
.myrsa-logout svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ── MAIN ── */
.myrsa-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  height: 100vh;
}

/* ── TOPBAR ── */
.myrsa-topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.myrsa-topbar-site {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: all .12s;
}

.myrsa-topbar-site:hover { background: var(--border); }
.myrsa-topbar-site svg { width: 14px; height: 14px; color: var(--text-muted); fill: none; stroke: currentColor; stroke-width: 2; }

.myrsa-topbar-sep { width: 1px; height: 24px; background: var(--border); }

.myrsa-site-name { font-size: 15px; font-weight: 600; }
.myrsa-site-code { font-size: 12px; color: var(--text-muted); font-family: 'DM Mono', monospace; }

.myrsa-topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.myrsa-topbar-title svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  fill: none; stroke: var(--accent); stroke-width: 2;
}

.myrsa-topbar-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 1px;
}

.myrsa-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bouton dark mode dans la topbar — masqué sur desktop, visible sur mobile */
.myrsa-topbar-dark {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.myrsa-topbar-dark:hover { background: var(--border); color: var(--text); }
body.dark .myrsa-topbar-dark { background: var(--surface2); border-color: var(--border); color: var(--sidebar-text); }

.myrsa-topbar-com {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.myrsa-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}
.myrsa-status-dot.ok    { background: var(--ok); }
.myrsa-status-dot.alarm { background: var(--alarm); animation: myrsa-pulse 1.5s infinite; }
.myrsa-status-dot.warn  { background: var(--warn); }

@keyframes myrsa-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── ONGLETS ── */
.myrsa-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
}

.myrsa-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .12s;
  white-space: nowrap;
  margin-bottom: -1px;
  text-decoration: none;
}

.myrsa-tab:hover { color: var(--text); }
.myrsa-tab.actif { color: var(--accent); border-bottom-color: var(--accent); }
.myrsa-tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.myrsa-tab-badge {
  background: var(--alarm);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
}

/* ── CONTENU ── */
.myrsa-content {
  padding: 24px;
  flex: 1;
}

/* ══════════════════════════════════════════════
   COMPOSANTS
══════════════════════════════════════════════ */

/* GRILLES */

/* CARD */
.myrsa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.myrsa-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.myrsa-card-header svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  color: var(--accent);
}

.myrsa-card-title    { font-size: 14px; font-weight: 600; }
.myrsa-card-subtitle { font-size: 12px; color: var(--text-muted); }

.myrsa-card-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.myrsa-card-body { padding: 20px; }

/* KPI */

/* BADGES (remplacent les anciens span.alarme, span.alerte, span.defaut) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-ok     { background: var(--ok-bg);    color: var(--ok);    border: 1px solid var(--ok-border); }
.badge-alarm  { background: var(--alarm-bg); color: var(--alarm); border: 1px solid var(--alarm-border); }
.badge-warn   { background: var(--warn-bg);  color: var(--warn);  border: 1px solid var(--warn-border); }
.badge-defaut { background: var(--defaut-bg);color: var(--defaut);border: 1px solid #ddd6fe; }
.badge-gsm    { background: var(--gsm-bg);color: var(--gsm);border: 1px solid #ddd6fe; }
.badge-info   { background: var(--accent-light); color: var(--accent); border: 1px solid var(--accent-mid); }
.badge-dot    { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Rétrocompatibilité : anciens noms de classes */
.alarme  { color: var(--alarm);  font-weight: 600; }
.alerte  { color: var(--warn);   font-weight: 600; }
.defaut  { color: var(--defaut); font-weight: 600; }

.normal{ color: var(--ok); font-weight: 600; }

/* TABLEAU DE DONNÉES */
.myrsa-table { width: 100%; border-collapse: collapse; }

.myrsa-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.myrsa-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.myrsa-table tr:last-child td { border-bottom: none; }
.myrsa-table tr:hover td { background: var(--bg); }

/* Ancien style .tab .titrenetwork – remplacé */
/* En-tête réseau dans la vue Dernières mesures */
.myrsa-network-header {
  padding: 8px 20px;
  background: var(--accent-light);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-mid);
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
body.dark .myrsa-network-header {
  background: rgba(37,99,235,.12);
  color: #93c5fd;
  border-bottom-color: rgba(37,99,235,.3);
  border-left-color: #3b82f6;
}

/* En-tête réseau dans la vue Dashboard (séparateur de groupe dans la grille) */
.dash-net-header {
  grid-column: 1 / -1;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent);
  padding: 6px 4px 6px 10px;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--accent-mid);
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
}
body.dark .dash-net-header {
  color: #93c5fd;
  background: rgba(37,99,235,.12);
  border-left-color: #3b82f6;
  border-bottom-color: rgba(37,99,235,.3);
}

/* LIGNE CAPTEUR */
.myrsa-sensor-row {
  display: grid;
  grid-template-columns: 1fr 160px 120px 100px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.myrsa-sensor-row:last-child { border-bottom: none; }
.myrsa-sensor-row:hover { background: var(--bg); }
.myrsa-sensor-name { font-size: 13px; font-weight: 500; }
.myrsa-sensor-net  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.myrsa-sensor-val  { font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 500; text-align: right; }
.myrsa-sensor-date { font-size: 11px; color: var(--text-muted); font-family: 'DM Mono', monospace; }

/* ALERTE ROW */

/* BOUTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary   { background: var(--accent);    color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: var(--surface2);  color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: var(--alarm-bg);  color: var(--alarm); border: 1px solid var(--alarm-border); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm  { padding: 6px 12px; font-size: 13px; }

/* Rétrocompatibilité anciens boutons PHP echo */
input[type="submit"].balarme,
button.balarme {
  background: var(--alarm);
  color: white;
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

input[type="submit"],
button[type="submit"] {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 7px;
  padding: 7px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
}

/* FORMULAIRES */
.myrsa-input,
input.myrsa-input,
select.myrsa-input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
}

.myrsa-input:focus,
input.myrsa-input:focus,
select.myrsa-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.myrsa-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.myrsa-filter-bar select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .12s;
   }

.myrsa-filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* PHOTO IMPLANTATION */

/* GRAPHIQUE */

/* UTILITAIRES */
.mono         { font-family: 'DM Mono', monospace; font-size: 12px; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 12px; }
.text-alarm   { color: var(--alarm); }
.text-warn    { color: var(--warn); }
.text-ok      { color: var(--ok); }

.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }
.mb-24        { margin-bottom: 24px; }
.flex         { display: flex; }

/* PAGINATION */

/* SCROLLBAR */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* INPUT CHECKBOX */
input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* MESSAGE D'ERREUR / SUCCÈS */
.myrsa-msg-error {
  background: var(--alarm-bg);
  color: var(--alarm);
  border: 1px solid var(--alarm-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.myrsa-msg-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--ok-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════════
   PAGE CONNEXION
══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   PAGE CHOIX DU SITE
══════════════════════════════════════════════ */

.myrsa-choix-header {
  background: var(--sidebar);
  padding: 20px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap; /* permet le retour à la ligne sur mobile */
}

.myrsa-choix-header-text { color: white; flex: 1; min-width: 160px; }
.myrsa-choix-header-text h1 { font-size: 20px; font-weight: 600; }
.myrsa-choix-header-text p  { font-size: 13px; color: var(--sidebar-text); opacity: .7; margin-top: 2px; }

.myrsa-choix-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;   /* les boutons passent à la ligne si besoin */
  align-items: center;
  justify-content: flex-end;
}

/* ── Mobile ≤ 600px ── */
@media (max-width: 600px) {
  .myrsa-choix-header {
    padding: 16px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .myrsa-choix-header-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .myrsa-choix-body { padding: 20px 16px; }
}

.myrsa-search-bar {
  position: relative;
  max-width: 400px;
  margin-bottom: 20px;
}

.myrsa-search-bar input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  background: white;
}

.myrsa-search-bar input:focus { border-color: var(--accent); }

.myrsa-search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Tableau des sites */
.myrsa-sites-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.myrsa-sites-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted);
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.myrsa-sites-table thead th:first-child { border-left: 1px solid var(--border); border-radius: 8px 0 0 0; }
.myrsa-sites-table thead th:last-child  { border-right: 1px solid var(--border); border-radius: 0 8px 0 0; }

.myrsa-sites-table tbody tr { cursor: pointer; transition: background .1s; }
.myrsa-sites-table tbody tr:hover td { background: var(--accent-light); }

.myrsa-sites-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  background: var(--surface);
}

.myrsa-sites-table tbody td:first-child { border-left: 1px solid var(--border); }
.myrsa-sites-table tbody td:last-child  { border-right: 1px solid var(--border); }
.myrsa-sites-table tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
.myrsa-sites-table tbody tr:last-child td:last-child  { border-radius: 0 0 8px 0; }

.site-code { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); font-weight: 500; }
.site-name { font-weight: 500; }

/* ══════════════════════════════════════════════
   CONFIGURATION (parametrage.php)
══════════════════════════════════════════════ */

.myrsa-config-field {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.myrsa-config-field label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */

@media (max-width: 900px) {
  .myrsa-sidebar { display: none; }
  .graph-layout { flex-direction: column; }
  .graph-sensor-panel { flex: none; width: 100%; }
  
  
  
  
  .myrsa-choix-body { padding: 20px; }
  .myrsa-sensor-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .myrsa-sensor-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .myrsa-sensor-row > :nth-child(2) { grid-column: 1; grid-row: 2; display: block; }
  .myrsa-sensor-row > :nth-child(3) { grid-column: 1; grid-row: 2; display: inline; margin-left: 8px; }
  .myrsa-sensor-row > :nth-child(4) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

  /* Topbar : compacte, masque les éléments secondaires */
  .myrsa-topbar {
    padding: 0 12px;
    gap: 8px;
    overflow: hidden;
  }
  /* Texte "Dernière COM" masqué sur mobile pour gagner de la place */
  .myrsa-topbar-com .text-muted { display: none; }
  .myrsa-topbar-com .mono { font-size: 11px; }
  /* Nom de site tronqué */
  .myrsa-site-name { 
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Bouton dark mode visible dans la topbar sur mobile */
  .myrsa-topbar-dark { display: flex; }

  /* Onglets : scrollables horizontalement sans barre visible */
  .myrsa-tabs {
    padding: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .myrsa-tabs::-webkit-scrollbar { display: none; }
  .myrsa-tab { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 600px) {
  .myrsa-topbar { padding: 0 10px; }
  .myrsa-content { padding: 12px; }
  
  /* Code projet masqué sur très petit écran */
  .myrsa-site-code { display: none; }
  /* Badge "OK" masqué sauf dans le tableau de sélection des sites */
  .badge-ok { display: none; }
  .myrsa-sites-table .badge-ok { display: inline-flex; }
}

/* ── Page choix site — mobile portrait uniquement ── */
@media (max-width: 640px) and (orientation: portrait) {
  /* Masquer la colonne Description, afficher Dernière mesure à la place */
  .col-description { display: none !important; }
  .col-lastmes     { display: table-cell !important; }
  /* Masquer l'affichage inline de la date sous le nom (devenu redondant) */
  .lastmes-inline  { display: none !important; }
}

/* Paysage smartphone : topbar qui reste dans l'écran */
@media (max-width: 900px) and (orientation: landscape) {
  .myrsa-topbar { height: auto; min-height: var(--header-h); padding: 6px 12px; flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════
   GRAPHIQUE — Layout capteurs + graphiques
══════════════════════════════════════════════ */

.graph-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.graph-sensor-panel {
  flex: 0 0 240px;
  min-width: 200px;
}
.graph-charts-panel {
  flex: 1 1 0;
  min-width: 0;
}

/* Réseau dans le panneau capteurs */

/* Outils graphiques */

/* ══════════════════════════════════════════════
   MODE SOMBRE — activé par body.dark
══════════════════════════════════════════════ */

body.dark {
  --bg:           #0f1117;
  --surface:      #1a1f2e;
  --surface2:     #222736;
  --surface-2:    #222736; /* alias */
  --bg-muted:     #222736; /* alias */
  --border:       #2e3548;
  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --text-light:   #64748b;
  --accent-light: #1e3a5f;
  --accent-mid:   #1e40af;
  --ok-bg:        #052e16;
  --ok-border:    #166534;
  --warn-bg:      #1c1408;
  --warn-border:  #92400e;
  --alarm-bg:     #1c0a0a;
  --gsm-bg	  #0f1117;
  --alarm-border: #991b1b;
  --defaut-bg:    #1e1033;
  --shadow:       0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:    0 4px 12px rgba(0,0,0,.5);
}

/* Topbar & tabs */
body.dark .myrsa-topbar { background: var(--surface); border-color: var(--border); }
body.dark .myrsa-tabs   { background: var(--surface); border-color: var(--border); }
body.dark .myrsa-tab    { color: var(--text-muted); }
body.dark .myrsa-tab:hover  { background: var(--surface2); color: var(--text); }
body.dark .myrsa-tab.actif  { color: var(--accent); border-bottom-color: var(--accent); }

/* Cards */
body.dark .myrsa-card        { background: var(--surface); border-color: var(--border); }
body.dark .myrsa-card-header { border-color: var(--border); }
body.dark .myrsa-card-body   { background: var(--surface); }

/* Tables */
body.dark .myrsa-table thead th          { background: var(--surface2); border-color: var(--border); }
body.dark .myrsa-table tbody tr:hover    { background: var(--surface2); }
body.dark .myrsa-table td,
body.dark .myrsa-table th                { border-color: var(--border); }

/* Inputs */
body.dark .myrsa-input,
body.dark select.myrsa-input {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  color-scheme: dark;
}

/* Tous les select/input sans classe (générés par fonctionsAffichage) */
body.dark select,
body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark input[type="datetime-local"],
body.dark textarea {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  color-scheme: dark;
}

/* Bouton toggle lune/soleil */
#darkToggle {
  background: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sidebar-text);
  font-size: 12px;
  font-family: inherit;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
  width: 100%;
  margin-top: 8px;
}
#darkToggle:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25); }
#darkToggle svg   { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

/* ── Colonnes masquées sur mobile ── */
@media (max-width: 640px) {
  .col-hide-mobile { display: none; }
}

/* ── Utilitaires formulaires ── */
.myrsa-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.myrsa-page-content {
  padding: 24px 32px;
}

@media (max-width: 640px) {
  .myrsa-page-content { padding: 16px; }
  .myrsa-page-content .myrsa-card div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   BOUTON ÉDITION — btn-edit (crayon SVG)
   Utilisé dans : requete_2025.php, parametrage_2025.php, incident_2025.php
══════════════════════════════════════════════════════════════ */

a.btn-edit,
button.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
a.btn-edit:hover,
button.btn-edit:hover {
  background: var(--accent-light, #eff6ff);
  color: var(--accent);
  border-color: var(--accent);
}
body.dark a.btn-edit:hover,
body.dark button.btn-edit:hover { background: rgba(99,102,241,.15); }

/* ══════════════════════════════════════════════════════════════
   BOUTON CALENDRIER
   Utilisé dans : parametrage_2025.php
══════════════════════════════════════════════════════════════ */

a[title="Calendrier"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 4px;
  transition: background .13s, color .13s, border-color .13s;
  text-decoration: none;
}
a[title="Calendrier"]:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}
body.dark a[title="Calendrier"]        { background: var(--surface2); }
body.dark a[title="Calendrier"]:hover  { background: var(--accent-light); color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   NAVIGATION SEGMENTÉE — param-nav
   Utilisé dans : parametrage_2025.php
══════════════════════════════════════════════════════════════ */

.param-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.param-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
  white-space: nowrap;
}
.param-nav-item input[type="radio"] { display: none; }
.param-nav-item:hover               { background: var(--surface2); color: var(--text); }
.param-nav-item.active              { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(59,130,246,.3); }
.param-nav-item.active svg          { stroke: #fff; }

/* ── Groupe boutons d'action paramétrage ── */
.param-action-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.param-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.param-action-btn:last-child          { border-right: none; }
.param-action-btn:hover               { background: var(--accent-light); color: var(--accent); }
.param-action-btn:hover svg           { stroke: var(--accent); }
body.dark .param-action-btn           { background: var(--surface2); }
body.dark .param-action-btn:hover     { background: var(--accent-light); }

/* ══════════════════════════════════════════════════════════════
   PILLS PÉRIODE — period-seg
   Utilisé dans : graphique_2025.php
══════════════════════════════════════════════════════════════ */

.period-seg {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.period-seg-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.period-seg-btn:hover:not(.period-seg-active) { background: var(--bg); color: var(--text); }
.period-seg-active { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* ══════════════════════════════════════════════════════════════
   GALERIE PHOTOS — photo-card, photo-thumb, photo-label
   Utilisé dans : photos_2025.php
══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   PAGES CHOIX SITE — dark mode + responsive
   Utilisé dans : choixSite_2025.php, choixSite_Al.php, choixSite_archives_2025.php
══════════════════════════════════════════════════════════════ */

body.dark .myrsa-choix-body                      { background: var(--bg); }
body.dark .myrsa-sites-table thead th            { background: var(--surface2); border-color: var(--border); }
body.dark .myrsa-sites-table tbody tr:hover td   { background: var(--surface2); }
body.dark .myrsa-sites-table td,
body.dark .myrsa-sites-table th                  { border-color: var(--border); color: var(--text); }
body.dark .myrsa-search-bar input               { background: var(--surface2); border-color: var(--border); color: var(--text); }
body.dark [style*="background:white"]            { background: var(--surface) !important; }
body.dark [style*="background: white"]           { background: var(--surface) !important; }

/* Colonne "Dernière mesure" — masquée sur mobile, affichée en inline */
.lastmes-inline { display: none; }
.col-lastmes span.mono { color: var(--text-muted) !important; }

@media (max-width: 700px) {
  .myrsa-choix-body .myrsa-sites-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .col-lastmes    { display: none; }
  .lastmes-inline { display: block; margin-top: 3px; font-size: 11px; color: var(--text-muted); }
}

/* ══════════════════════════════════════════════════════════════
   GESTION UTILISATEURS — site-picker, user-card, form-panel
   Utilisé dans : gestion_users.php
══════════════════════════════════════════════════════════════ */

.site-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.site-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 13px;
  user-select: none;
}
.site-item:hover              { border-color: var(--accent); background: rgba(59,130,246,.04); }
.site-item.selected           { border-color: var(--accent); background: rgba(59,130,246,.08); color: var(--accent); font-weight: 500; }
.site-item input              { accent-color: var(--accent); }

.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.user-card:last-child         { border-bottom: none; }
.user-card:hover              { background: var(--bg); }
.user-logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--bg);
  flex-shrink: 0;
}
.u-avatar {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--sidebar);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}
.site-tag {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(59,130,246,.08);
  color: var(--accent);
  border-radius: 20px;
  border: 1px solid rgba(59,130,246,.2);
}
.form-panel {
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.form-head {
  background: var(--accent);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════
   POPUPS / FENÊTRES INCIDENTS & FICHES
   Utilisé dans : incidentsheet.php, incidentedit.php, incidentview.php,
                  incidentanalysis.php, incidentack.php, viewsheet.php, data.php
══════════════════════════════════════════════════════════════ */

.popup-wrap          { max-width: 860px; margin: 0 auto; padding: 20px; }

.popup-header {
  background: var(--sidebar);
  color: white;
  padding: 16px 24px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.popup-header-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.popup-header h1  { font-size: 16px; font-weight: 700; margin: 0; }
.popup-header p   { font-size: 12px; margin: 2px 0 0; opacity: .75; }

/* Grille info (dt/dd) */
.info-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  font-size: 13px;
}
.info-grid dt {
  padding: 8px 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.info-grid dd {
  padding: 8px 14px;
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 0;
  word-break: break-word;
}

/* Card fiche incident */
.sheet-card {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1.5px solid var(--border);
}
.sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: white;
}
.sheet-body  { padding: 14px; background: var(--surface); font-size: 13px; }
.sheet-field { display: grid; grid-template-columns: 130px 1fr; gap: 8px; margin-bottom: 8px; }
.sheet-field dt { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; padding-top: 2px; }
.sheet-field dd { margin: 0; color: var(--text); line-height: 1.5; }

/* Textarea MYRSA */
.myrsa-textarea {
  width: 100%;
  font-size: 13px;
  font-family: inherit;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.myrsa-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
  outline: none;
}
body.dark .myrsa-textarea { background: var(--surface2); border-color: var(--border); }

/* Alerte aggravation incident */
.aggravation-alert {
  background: rgba(239,68,68,.1);
  border: 1.5px solid var(--alarm);
  border-radius: 8px;
  padding: 14px 18px;
  color: var(--alarm);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  margin: 12px 0;
}

/* Popup data.php — card compacte */
.popup-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  overflow: hidden;
  max-width: 520px;
  margin: 0 auto;
}
.popup-header-title { font-size: 15px; font-weight: 600; color: white; }
.popup-header-sub   { font-size: 12px; color: rgba(255,255,255,.5); margin-top: 2px; font-family: monospace; }
.popup-body         { padding: 20px; }
.popup-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Message résultat (ok / error) */
.popup-msg {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.popup-msg.ok    { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.popup-msg.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Grille champs data.php */
.field-grid { display: grid; grid-template-columns: 140px 1fr; }
.field-row  { display: contents; }
.field-row > .field-label,
.field-row > .field-value {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  align-items: center;
}
.field-label        { color: var(--text-muted); font-weight: 500; background: var(--bg); }
.field-value        { color: var(--text); }
.field-value.mono   { font-family: monospace; font-size: 12px; }
.field-value input,
.field-value select,
.field-value textarea {
  width: 100%;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.field-value input:focus,
.field-value select:focus,
.field-value textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

/* ── Print (viewsheet.php) ── */
@media print {
  .no-print      { display: none !important; }
  body           { background: white; }
  .myrsa-card    { box-shadow: none; border: 1px solid #ccc; }
}

/* ══════════════════════════════════════════════════════════════
   PARAMÉTRAGE — Pills UI
   Utilisé dans : parametrage_2025.php
   Réutilise les variables et le style de .opts-pill/.sensor-pill
══════════════════════════════════════════════════════════════ */

/* Conteneur horizontal (choix unique, pas de wrap) */
.pill-group {
  display: inline-flex;
  flex-wrap: nowrap;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* Conteneur multi-lignes (sélection multiple ou longue liste) */
.pill-group-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, #f0f2f5);
}
body.dark .pill-group-wrap { background: var(--surface, #1e2436); }

/* Pill de base — reprend le style de .opts-pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: background .12s, border-color .12s, color .12s;
  border-right: 0.5px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-2, #f0f2f5);
}
.pill:last-child { border-right: none; }

/* Dans .pill-group-wrap : chaque pill est une pastille indépendante */
.pill-group-wrap .pill {
  border-right: none;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface, #fff);
}
body.dark .pill-group-wrap .pill {
  background: var(--surface, #1e2436);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Cacher les vrais inputs */
.pill input[type="radio"],
.pill input[type="checkbox"] { display: none; }

/* Hover */
.pill:hover { color: var(--text); }
.pill-group-wrap .pill:hover { border-color: #93c5fd; color: var(--text); }
body.dark .pill:hover { color: #e2e8f0; }

/* ── État actif via CSS :has() — aucun JS requis ──
   Fonctionne pour radio ET checkbox, au chargement ET au clic  */

/* pill-oui  : choix neutre (sous-type, graphique, données…) → bleu quand coché */
.pill.pill-oui:has(input:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
}
body.dark .pill.pill-oui:has(input:checked) {
  background: #0C447C;
  border-color: #378ADD;
  color: #B5D4F4;
}

/* pill-oui dans pill-group (séparateurs) : même couleur active */
.pill-group .pill.pill-oui:has(input:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
}

/* pill-oui  : Oui → bleu */
.pill.pill-oui:has(input[value="1"]:checked),
.pill.pill-oui:has(input[value="OUI"]:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
}
body.dark .pill.pill-oui:has(input[value="1"]:checked) {
  background: #0C447C;
  border-color: #378ADD;
  color: #B5D4F4;
}

/* pill-non  : Non → rouge quand coché */
.pill.pill-non:has(input:checked) {
  background: var(--alarm-bg);
  border-color: var(--alarm-border);
  color: var(--alarm);
}
body.dark .pill.pill-non:has(input:checked) {
  background: rgba(220,38,38,.18);
  border-color: rgba(220,38,38,.35);
  color: #f87171;
}

/* pill-toggle : checkbox on/off → bleu quand coché */
.pill.pill-toggle:has(input:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
}
body.dark .pill.pill-toggle:has(input:checked) {
  background: #0C447C;
  border-color: #378ADD;
  color: #B5D4F4;
}

/* SVG suit la couleur du texte dans tous les cas */
.pill:has(input:checked) svg { stroke: currentColor; }

/* Fallback : garder pill-active pour compatibilité PHP existant */
.pill.pill-active {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
}
body.dark .pill.pill-active {
  background: #0C447C;
  border-color: #378ADD;
  color: #B5D4F4;
}
.pill.pill-active svg { stroke: currentColor; }

/* ══════════════════════════════════════════════════════════════
   PARAMÉTRAGE — Composants spécifiques à la page
   Utilisé dans : parametrage_2025.php
══════════════════════════════════════════════════════════════ */

/* Bouton calendrier */
a[title="Calendrier"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 4px;
  transition: background .13s, color .13s, border-color .13s;
  text-decoration: none;
}
a[title="Calendrier"]:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-mid);
}
body.dark a[title="Calendrier"] { background: var(--surface2); }
body.dark a[title="Calendrier"]:hover { background: var(--accent-light); color: var(--accent); }

/* Navigation segmentée (onglets Créer/Modifier) */
.param-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.param-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  user-select: none;
  white-space: nowrap;
}
.param-nav-item input[type="radio"] { display: none; }
.param-nav-item:hover { background: var(--surface2); color: var(--text); }
.param-nav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(59,130,246,.3);
}
.param-nav-item.active svg { stroke: #fff; }

/* Groupe boutons d'action (Config réseau, Listes alertes…) */
.param-action-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.param-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.param-action-btn:last-child { border-right: none; }
.param-action-btn:hover { background: var(--accent-light); color: var(--accent); }
.param-action-btn:hover svg { stroke: var(--accent); }
body.dark .param-action-btn { background: var(--surface2); }
body.dark .param-action-btn:hover { background: var(--accent-light); }

/* Bouton crayon édition (partagé avec requete_2025.php) */
button.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
  padding: 0;
}
button.btn-edit:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}
body.dark button.btn-edit:hover { background: rgba(99,102,241,.15); }

/* ══════════════════════════════════════════════════════════════
   GRAPHIQUE CH — Options graphiques (Pills UI)
   Utilisé dans : graphique_ch_2025.php
══════════════════════════════════════════════════════════════ */

/* ── Groupes d'options ── */
.opts-group { border:0.5px solid var(--border,#e2e8f0); border-radius:10px; padding:14px 16px; display:flex; flex-direction:column; gap:12px; background:var(--surface,#fff); }
body.dark .opts-group { background:var(--surface,#1e2436); border-color:var(--border,#2e3548); }

.opts-group-title { display:flex; align-items:center; gap:7px; font-size:0.72rem; font-weight:500; text-transform:uppercase; letter-spacing:.07em; color:var(--text-muted,#64748b); padding-bottom:8px; border-bottom:0.5px solid var(--border,#e2e8f0); margin-bottom:2px; }
body.dark .opts-group-title { border-color:var(--border,#2e3548); }
.opts-group-title svg { width:13px; height:13px; flex-shrink:0; }

.opts-field { display:flex; flex-direction:column; gap:6px; }
.opts-label { font-size:0.75rem; color:var(--text-muted,#64748b); margin:0; }

/* ── Pills génériques ── */
.opts-pills { display:flex; flex-wrap:wrap; gap:6px; }
.opts-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:5px 11px; border-radius:999px;
  border:0.5px solid var(--border,#e2e8f0);
  font-size:0.75rem; cursor:pointer;
  transition:background .12s, border-color .12s, color .12s;
  color:var(--text-muted,#64748b);
  background:var(--surface-2,#f7f9fc);
  user-select:none; line-height:1.4;
}
body.dark .opts-pill { background:var(--surface,#1e2436); border-color:var(--border,#2e3548); color:var(--text-muted,#94a3b8); }
.opts-pill:hover { border-color:#93c5fd; color:var(--text,#1e293b); }
body.dark .opts-pill:hover { color:#e2e8f0; }
.opts-pill.on { background:#E6F1FB; border-color:#378ADD; color:#0C447C; }
body.dark .opts-pill.on { background:#0C447C; border-color:#378ADD; color:#B5D4F4; }
.opts-pill .pdot { width:6px; height:6px; border-radius:50%; background:currentColor; opacity:0; transition:opacity .12s; flex-shrink:0; }
.opts-pill.on .pdot { opacity:1; }

/* ── Sous-panneaux dépliables ── */
.opts-sub { display:none; flex-direction:column; gap:8px; margin-top:2px; padding:10px 12px; border-left:2px solid #378ADD; border-radius:0 8px 8px 0; background:var(--surface-2,#f7f9fc); }
body.dark .opts-sub { background:rgba(12,68,124,.12); }
.opts-sub.show { display:flex; }

/* ── Paires de champs ── */
.opts-input-pair { display:flex; align-items:center; gap:6px; }
.opts-unit { font-size:0.75rem; color:var(--text-muted,#64748b); white-space:nowrap; min-width:28px; }
.opts-sep { border:none; border-top:0.5px solid var(--border,#e2e8f0); margin:2px 0; }
body.dark .opts-sep { border-color:var(--border,#2e3548); }

/* ── Badges seuils ── */
.opts-badge-alarm { font-size:0.7rem; font-weight:500; background:#fee2e2; color:#dc2626; border:0.5px solid #fca5a5; padding:2px 8px; border-radius:4px; }
.opts-badge-alert { font-size:0.7rem; font-weight:500; background:#fef3c7; color:#d97706; border:0.5px solid #fcd34d; padding:2px 8px; border-radius:4px; }
body.dark .opts-badge-alarm { background:rgba(220,38,38,.18); border-color:rgba(220,38,38,.35); color:#f87171; }
body.dark .opts-badge-alert { background:rgba(217,119,6,.18); border-color:rgba(217,119,6,.35); color:#fbbf24; }
.opts-seuil-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* ── Pills capteurs ── */
.net-block { display:flex; flex-direction:column; gap:6px; }
.net-header { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.net-label { font-size:0.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--accent,#2563eb); }
body.dark .net-label { color:#93c5fd; }

.net-all { font-size:0.72rem; cursor:pointer; color:var(--text-muted,#64748b); border:0.5px solid var(--border,#e2e8f0); border-radius:999px; padding:2px 8px; background:var(--surface-2,#f7f9fc); transition:background .12s,color .12s,border-color .12s; user-select:none; }
body.dark .net-all { background:var(--surface,#1e2436); border-color:var(--border,#2e3548); }
.net-all:hover { border-color:#93c5fd; color:var(--text,#1e293b); }
.net-all.on { background:#E6F1FB; border-color:#378ADD; color:#0C447C; }
body.dark .net-all.on { background:#0C447C; border-color:#378ADD; color:#B5D4F4; }

.sensor-pills { display:flex; flex-wrap:wrap; gap:5px; }
.sensor-pill {
  display:inline-flex; align-items:center; gap:4px;
  padding:4px 10px; border-radius:999px;
  border:0.5px solid var(--border,#e2e8f0);
  font-size:0.75rem; cursor:pointer;
  transition:background .12s, border-color .12s, color .12s;
  color:var(--text-muted,#64748b);
  background:var(--surface-2,#f7f9fc);
  user-select:none; line-height:1.4;
}
body.dark .sensor-pill { background:var(--surface,#1e2436); border-color:var(--border,#2e3548); color:var(--text-muted,#94a3b8); }
.sensor-pill:hover { border-color:#93c5fd; color:var(--text,#1e293b); }
body.dark .sensor-pill:hover { color:#e2e8f0; }
.sensor-pill.on { background:#E6F1FB; border-color:#378ADD; color:#0C447C; }
body.dark .sensor-pill.on { background:#0C447C; border-color:#378ADD; color:#B5D4F4; }
.sensor-pill .pdot { width:5px; height:5px; border-radius:50%; background:currentColor; opacity:0; transition:opacity .12s; flex-shrink:0; }
.sensor-pill.on .pdot { opacity:1; }

.sensor-net-sep { border:none; border-top:0.5px solid var(--border,#e2e8f0); margin:4px 0; }
body.dark .sensor-net-sep { border-color:var(--border,#2e3548); }
