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

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── 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;
  --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 */
.myrsa-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.myrsa-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.myrsa-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.myrsa-col-full { grid-column: 1 / -1; }

/* 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 */
.myrsa-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}

.myrsa-kpi-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-muted);
}

.myrsa-kpi-value {
  font-size: 26px; font-weight: 600; letter-spacing: -.5px;
  font-family: 'DM Mono', monospace;
}

.myrsa-kpi-sub { font-size: 12px; color: var(--text-muted); }

.myrsa-kpi.kpi-ok      { border-left: 3px solid var(--ok); }
.myrsa-kpi.kpi-alarm   { border-left: 3px solid var(--alarm); }
.myrsa-kpi.kpi-warn    { border-left: 3px solid var(--warn); }
.myrsa-kpi.kpi-accent  { border-left: 3px solid var(--accent); }

/* 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-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, .statnormal { 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é */
.myrsa-network-header {
  padding: 8px 20px;
  background: var(--surface2);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 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 */
.myrsa-alert-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.myrsa-alert-row:last-child { border-bottom: none; }

.myrsa-alert-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.myrsa-alert-icon.alarm  { background: var(--alarm-bg); }
.myrsa-alert-icon.warn   { background: var(--warn-bg);  }
.myrsa-alert-icon.defaut { background: var(--defaut-bg); }
.myrsa-alert-icon svg    { width: 16px; height: 16px; fill: none; stroke-width: 2; }
.myrsa-alert-icon.alarm  svg { stroke: var(--alarm); }
.myrsa-alert-icon.warn   svg { stroke: var(--warn); }
.myrsa-alert-icon.defaut svg { stroke: var(--defaut); }

.myrsa-alert-body  { flex: 1; min-width: 0; }
.myrsa-alert-title { font-size: 13px; font-weight: 500; }
.myrsa-alert-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.myrsa-alert-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* 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; }
.btn-full { width: 100%; }

/* 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 */
.myrsa-photo-placeholder {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  min-height: 200px;
  padding: 20px;
}

.myrsa-photo-placeholder svg { width: 48px; height: 48px; opacity: .3; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* GRAPHIQUE */
.myrsa-graph-placeholder {
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  min-height: 300px;
  padding: 40px 20px;
}

.myrsa-graph-placeholder svg { width: 40px; height: 40px; opacity: .4; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* 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); }
.text-accent  { color: var(--accent); }
.font-600     { font-weight: 600; }
.mb-12        { margin-bottom: 12px; }
.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }
.mb-24        { margin-bottom: 24px; }
.flex         { display: flex; }
.items-center { align-items: center; }
.gap-8        { gap: 8px; }

/* PAGINATION */
.myrsa-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.myrsa-pagination span {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* 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
══════════════════════════════════════════════ */

.myrsa-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(135deg, #1e2532 0%, #2a3558 100%);
}

.myrsa-login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}

.myrsa-login-logo-icon {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.myrsa-login-logo-icon svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 2; }
.myrsa-login-logo h1 { color: white; font-size: 22px; font-weight: 600; letter-spacing: -.3px; }
.myrsa-login-logo h1 span { color: #93c5fd; }

.myrsa-login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.myrsa-login-card h2 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.myrsa-login-card p  { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

.myrsa-form-group { margin-bottom: 18px; }

.myrsa-form-group label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px;
}

.myrsa-form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color .15s;
  outline: none;
}

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

.myrsa-login-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,.4);
}

/* ══════════════════════════════════════════════
   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; }
.site-dept { color: var(--text-muted); font-size: 12px; }

/* ══════════════════════════════════════════════
   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);
}

.myrsa-config-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

@media (max-width: 900px) {
  .myrsa-sidebar { display: none; }
  .graph-layout { flex-direction: column; }
  .graph-sensor-panel { flex: none; width: 100%; }
  .tools-grid { grid-template-columns: 1fr; }
  .myrsa-grid-4  { grid-template-columns: repeat(2, 1fr); }
  .myrsa-grid-3  { grid-template-columns: 1fr; }
  .myrsa-grid-2  { grid-template-columns: 1fr; }
  .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; }
  .myrsa-login-card { width: 90vw; padding: 28px 20px; }
  /* Code projet masqué sur très petit écran */
  .myrsa-site-code { display: none; }
  /* Badge "En ligne" masqué, garde juste les alarmes */
  .badge-ok { display: none; }
}

/* 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 */
.sensor-network-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
  border-radius: 6px 6px 0 0;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: none;
  margin-top: 10px;
}
.sensor-network-header:first-child { margin-top: 0; }

.sensor-list {
  border: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.sensor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.sensor-item:last-child { border-bottom: none; }
.sensor-item:hover { background: var(--surface2); }
.sensor-item label { cursor: pointer; margin: 0; }
.sensor-inactive { opacity: 0.55; font-style: italic; }

/* Outils graphiques */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tools-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.tools-row:last-child { border-bottom: none; }
.tools-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════
   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;
  --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
══════════════════════════════════════════════════════════════ */

.photo-card {
  cursor: pointer;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border);
  background: var(--surface2);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  border-color: var(--accent);
}
.photo-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.photo-card:hover .photo-thumb img { transform: scale(1.04); }
.photo-label {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   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-wrap.narrow   { max-width: 600px; }
.popup-wrap.wide     { max-width: 900px; }

.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; }
}
