/**
 * OCP Pipeline Monitor — Hydraulic Tech design system
 * Fluides · pression · HUD SCADA · cyan/aqua industriel
 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --hydro-deep: #042f3a;
  --hydro-mid: #0e7490;
  --hydro-bright: #22d3ee;
  --hydro-flow: #06b6d4;
  --hydro-glow: rgba(34, 211, 238, 0.35);
  --hydro-glow-soft: rgba(6, 182, 212, 0.18);
  --hydro-pressure: #38bdf8;
  --ocp-green-mid: #2dd4bf;
  --ocp-green-glow: rgba(45, 212, 191, 0.3);
  --ocp-cyan-glow: rgba(34, 211, 238, 0.28);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  --glass: rgba(10, 21, 32, 0.82);
  --glass-border: rgba(34, 211, 238, 0.14);
  --hud-line: rgba(34, 211, 238, 0.45);
}

/* ─ Typographie & base ─ */
body {
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
}

.app-shell {
  animation: ocp-fade-in 0.45s ease;
  position: relative;
}

.app-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(6, 182, 212, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(14, 165, 233, 0.03) 0%, transparent 35%);
}

.app-shell > * {
  position: relative;
  z-index: 1;
}

@keyframes ocp-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes ocp-flow-line {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes ocp-pressure-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--hydro-glow); }
  50% { opacity: 0.85; box-shadow: 0 0 16px var(--hydro-glow); }
}

@keyframes ocp-data-scan {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* ─ Header — panneau de contrôle hydraulique ─ */
.header-bar {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.35);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 56px var(--hydro-glow-soft),
    inset 0 1px 0 rgba(103, 232, 249, 0.12);
  backdrop-filter: blur(14px);
}

.header-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 100% at 100% 0%, rgba(34, 211, 238, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 80% at 0% 100%, rgba(6, 182, 212, 0.1), transparent 45%),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(34, 211, 238, 0.02) 8px,
      rgba(34, 211, 238, 0.02) 9px
    );
  pointer-events: none;
}

.header-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--hydro-bright) 25%,
    var(--hydro-flow) 50%,
    var(--hydro-bright) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: ocp-flow-line 4s linear infinite;
}

.header-bar > * {
  position: relative;
  z-index: 1;
}

.header-bar h1 {
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.25);
  font-weight: 700;
}

.header-bar h1 + p,
.header-bar p {
  font-family: var(--font-mono);
  font-size: 11px !important;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.header-logo {
  height: 52px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.5));
  transition: transform var(--transition), filter var(--transition);
}

.header-logo:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.7));
}

.header-bar-controls button,
.header-bar-controls .lang-btn {
  backdrop-filter: blur(8px);
  border: 1px solid rgba(34, 211, 238, 0.2) !important;
  font-family: var(--font-mono);
  font-size: 11px !important;
  letter-spacing: 0.06em;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.header-bar-controls button:hover,
.header-bar-controls .lang-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
  border-color: rgba(34, 211, 238, 0.45) !important;
}

.header-bar .mysql-badge.ok {
  background: rgba(6, 182, 212, 0.12) !important;
  color: #67e8f9 !important;
  border: 1px solid rgba(34, 211, 238, 0.35) !important;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.header-bar .mysql-badge.off {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #fde68a !important;
  border: 1px solid rgba(253, 224, 71, 0.3) !important;
}

.header-bar .mysql-badge.err {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(248, 113, 113, 0.35) !important;
}

#stack-badge.full {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

#stack-badge.cloud {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(34, 211, 238, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: var(--font-mono);
}

/* ─ Bandeau mode LIVE/SIM ─ */
.ocp-mode-banner {
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.ocp-mode-sim {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.16), rgba(14, 165, 233, 0.08)) !important;
  border-color: rgba(34, 211, 238, 0.3) !important;
}

.ocp-mode-live {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.18), rgba(220, 38, 38, 0.08)) !important;
}

/* ─ KPI — jauges pression / débit ─ */
.header-kpi-row .kpi,
.kpi {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(10, 21, 32, 0.95) 0%, rgba(15, 30, 48, 0.9) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(103, 232, 249, 0.06);
}

.header-kpi-row .kpi::before,
.kpi::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kpi-accent, var(--hydro-bright));
  box-shadow: 0 0 14px var(--kpi-accent, var(--hydro-glow));
}

.header-kpi-row .kpi::after,
.kpi::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--hud-line);
  border-right: 1px solid var(--hud-line);
  opacity: 0.6;
}

.header-kpi-row .kpi .l,
.kpi .l {
  font-size: 9px !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--txt2) !important;
  font-weight: 600;
}

.header-kpi-row .kpi .v,
.kpi .v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15em;
  color: #e0f7ff;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.35);
  letter-spacing: -0.02em;
}

.header-kpi-row .kpi:nth-child(1) { --kpi-accent: var(--green); border-top: none; }
.header-kpi-row .kpi:nth-child(2) { --kpi-accent: var(--blue); border-top: none; }
.header-kpi-row .kpi:nth-child(3) { --kpi-accent: var(--cyan); border-top: none; }
.header-kpi-row .kpi:nth-child(4) { --kpi-accent: var(--amber); border-top: none; }
.header-kpi-row .kpi:nth-child(5) { --kpi-accent: var(--purple); border-top: none; }
.header-kpi-row .kpi:nth-child(6) { --kpi-accent: var(--ochre); border-top: none; }
.header-kpi-row .kpi:nth-child(7) { --kpi-accent: var(--red); border-top: none; }

/* ─ Navigation — segments SCADA ─ */
.tabs {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(103, 232, 249, 0.05);
  scrollbar-color: var(--hydro-bright) var(--bg2);
}

.tab {
  border-radius: var(--radius-sm) !important;
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding: 9px 14px !important;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.03em;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.tab:hover {
  background: rgba(34, 211, 238, 0.08) !important;
  color: var(--hydro-bright) !important;
  border-bottom: none !important;
}

.tab.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(14, 165, 233, 0.12)) !important;
  color: var(--hydro-bright) !important;
  font-weight: 600 !important;
  box-shadow:
    inset 0 0 0 1px rgba(34, 211, 238, 0.3),
    0 0 16px rgba(6, 182, 212, 0.15);
  border-bottom: none !important;
}

.tab[data-t="frm"].active { color: #7dd3fc !important; }
.tab[data-t="iaa"].active { color: #5eead4 !important; }
.tab[data-t="pred"].active { color: #67e8f9 !important; }
.tab[data-t="plan"].active { color: #fcd34d !important; }
.tab[data-t="sug"].active { color: var(--amber) !important; }

/* ─ Panneaux ─ */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: ocp-panel-in 0.35s ease;
}

@keyframes ocp-panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ─ Cartes — HUD hydraulique ─ */
.card {
  position: relative;
  background:
    linear-gradient(160deg, rgba(10, 21, 32, 0.96) 0%, rgba(12, 28, 45, 0.94) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
  overflow: hidden;
}

.card::before {
  background: linear-gradient(90deg, var(--hydro-flow), var(--hydro-bright), var(--hydro-pressure)) !important;
  opacity: 0.85 !important;
  height: 2px !important;
  box-shadow: 0 0 12px var(--hydro-glow-soft);
}

.card:hover {
  border-color: rgba(34, 211, 238, 0.28);
  box-shadow: var(--shadow-md), 0 0 24px var(--hydro-glow-soft);
}

/* ─ Boutons — commandes pression ─ */
button {
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

button:active {
  transform: scale(0.98);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--txt);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg3);
  border-color: var(--hydro-bright);
  color: var(--hydro-bright);
  box-shadow: 0 0 20px var(--ocp-cyan-glow);
}

.btn-primary,
button.pmp-btn-primary {
  background: linear-gradient(135deg, #0891b2, #06b6d4) !important;
  border-color: rgba(34, 211, 238, 0.55) !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover,
button.pmp-btn-primary:hover {
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.4) !important;
}

/* ─ Sliders — vannes / consignes ─ */
input[type='range'] {
  height: 6px;
  border-radius: 3px;
  accent-color: var(--hydro-flow);
  background: linear-gradient(90deg, var(--bg3), var(--hydro-mid));
}

input[type='range']::-webkit-slider-thumb {
  cursor: pointer;
  box-shadow: 0 0 8px var(--hydro-glow);
}

input[type='text'],
input[type='number'],
input[type='email'],
select,
textarea {
  border-radius: var(--radius-sm);
  border-color: var(--glass-border);
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
  outline: none;
}

/* ─ SCN boutons monitoring ─ */
#scn-row button,
.mon-scn-btn {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  letter-spacing: 0.04em !important;
  transition: all var(--transition) !important;
  font-weight: 600 !important;
  border-color: rgba(34, 211, 238, 0.2) !important;
}

#scn-row button:hover,
.mon-scn-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.25);
  border-color: rgba(34, 211, 238, 0.4) !important;
}

#scn-row button.active,
.mon-scn-btn.active {
  background: rgba(6, 182, 212, 0.18) !important;
  border-color: var(--hydro-bright) !important;
  color: var(--hydro-bright) !important;
  box-shadow: 0 0 20px var(--hydro-glow-soft) !important;
}

/* ─ Bandeau alerte critique ─ */
.critical-alert-banner {
  border-radius: var(--radius-md);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.5), rgba(69, 10, 10, 0.4));
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
  animation: ocp-alert-pulse 2s ease-in-out infinite;
  font-family: var(--font-mono);
}

@keyframes ocp-alert-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.12); }
  50% { box-shadow: 0 0 28px rgba(239, 68, 68, 0.28); }
}

/* ─ Live indicator — capteur pression ─ */
.live {
  background: var(--hydro-bright) !important;
  box-shadow: 0 0 10px var(--hydro-glow);
  animation: ocp-pressure-pulse 2s ease-in-out infinite;
}

/* ─ Validation panel ─ */
#val-main-card {
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.06), var(--bg1)) !important;
  border-color: rgba(34, 211, 238, 0.2) !important;
}

#val-score-ring {
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.2);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.val-metrics-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hydro-bright);
  border-bottom: 1px solid var(--border);
}

.val-metrics-table td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.val-metrics-table tbody tr:hover td {
  background: rgba(34, 211, 238, 0.06);
}

/* ─ Tutoriel flottant ─ */
#ocp-tutorial-launch-btn {
  background: linear-gradient(135deg, #0c4a6e, #0891b2) !important;
  border: 1px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 4px 24px rgba(6, 182, 212, 0.25);
  font-family: var(--font-mono);
  transition: transform var(--transition), box-shadow var(--transition);
}

#ocp-tutorial-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(34, 211, 238, 0.3);
}

/* ─ Co-Pilot chat ─ */
.ai-chat-fab {
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.4);
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: linear-gradient(135deg, #0c4a6e, #0891b2) !important;
}

.ai-chat-panel {
  border-radius: var(--radius-lg) !important;
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border) !important;
}

/* ─ Sélecteur rôle ─ */
#ocp-role-select {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-color: rgba(34, 211, 238, 0.25);
  cursor: pointer;
}

/* ─ Sections labels tech ─ */
#pn-mon [style*='letter-spacing'],
.card [style*='text-transform:uppercase'] {
  letter-spacing: 0.08em !important;
  color: var(--hydro-bright) !important;
}

/* ─ Scrollbar fluide ─ */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--hydro-flow), var(--hydro-bright));
  border-radius: 4px;
}

/* ─ PMP mobile SCADA — touch-friendly ─ */
.pmp-mobile-wrap {
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(6, 182, 212, 0.15);
  border-color: rgba(34, 211, 238, 0.2);
  background: var(--glass);
}

.pmp-mobile-title {
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--hydro-bright);
}

.pmp-mobile-kpi {
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  border-color: rgba(34, 211, 238, 0.15);
}

.pmp-mobile-kpi:nth-child(1) { border-left: 3px solid var(--green); }
.pmp-mobile-kpi:nth-child(2) { border-left: 3px solid var(--blue); }
.pmp-mobile-kpi:nth-child(3) { border-left: 3px solid var(--cyan); }
.pmp-mobile-kpi:nth-child(4) { border-left: 3px solid var(--amber); }

.pmp-mobile-kpi .val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(34, 211, 238, 0.2);
  color: #e0f7ff;
}

.pmp-mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pmp-mobile-actions .pmp-btn {
  min-height: 48px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.pmp-mobile-actions .pmp-btn-primary {
  grid-column: span 2;
  min-height: 52px;
  font-size: 14px;
  box-shadow: 0 0 20px var(--hydro-glow-soft);
}

.pmp-mobile-setpoint label {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.pmp-mobile-setpoint input[type='range'] {
  height: 8px;
  margin-top: 4px;
}

.pmp-mobile-pump {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border-color: rgba(34, 211, 238, 0.12);
}

.pmp-mobile-pump.on {
  border-color: rgba(34, 211, 238, 0.45) !important;
  background: rgba(6, 182, 212, 0.1) !important;
}

.pmp-mobile-pump .pmp-btn {
  min-height: 40px;
  min-width: 76px;
  font-weight: 600;
}

#pmp-mobile-full-btn {
  min-height: 40px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* ─ Monitoring — animated pressure waves ─ */
.mon-chart-wave-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.06) 0%, rgba(10, 21, 32, 0.4) 100%);
}

.mon-chart-wave-wrap .mon-wave-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  overflow: hidden;
}

.mon-chart-wave-wrap .mon-wave-layer svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 70%;
  animation: mon-wave-drift 10s linear infinite;
}

.mon-chart-wave-wrap > *:not(.mon-wave-layer) {
  position: relative;
  z-index: 1;
}

.mon-wave-path {
  fill: rgba(6, 182, 212, 0.12);
  stroke: rgba(34, 211, 238, 0.18);
  stroke-width: 0.5;
}

.mon-wave-a { animation: mon-wave-bob 4s ease-in-out infinite; }
.mon-wave-b { fill: rgba(14, 165, 233, 0.1); animation: mon-wave-bob 5s ease-in-out infinite reverse; }
.mon-wave-c { fill: rgba(34, 211, 238, 0.08); animation: mon-wave-bob 6s ease-in-out infinite; }

.mon-profile-card .mon-chart-wave-wrap {
  border: 1px solid rgba(34, 211, 238, 0.2);
  box-shadow: inset 0 0 40px rgba(6, 182, 212, 0.08);
}

.mon-profile-card .mon-chart-wave-wrap::after {
  content: 'PRESSURE PROFILE';
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(34, 211, 238, 0.35);
  pointer-events: none;
}

.mon-pressure-chart-block {
  position: relative;
}

.mon-pressure-chart-block::before {
  content: 'P S1 ↔ S8';
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(34, 211, 238, 0.4);
  z-index: 2;
  pointer-events: none;
}

.mon-pressure-chart-block .mon-chart-wave-wrap {
  min-height: 120px;
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: var(--radius-sm);
  padding: 4px;
}

@keyframes mon-wave-drift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes mon-wave-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (max-width: 480px) {
  .pmp-mobile-actions {
    grid-template-columns: 1fr;
  }
  .pmp-mobile-actions .pmp-btn-primary {
    grid-column: span 1;
  }
}

/* ─ Reduced motion ─ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─ Réservoirs — hydraulic tech SCADA ─ */
#pn-tnk {
  --tnk-accent: #22d3ee;
  --tnk-glow: rgba(34, 211, 238, 0.2);
}

#tank-grid {
  gap: 1rem !important;
}

.tnk-card {
  background: linear-gradient(160deg, rgba(10, 21, 32, 0.96), rgba(12, 28, 45, 0.94)) !important;
  border-color: rgba(34, 211, 238, 0.18) !important;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tnk-card:hover {
  border-color: rgba(34, 211, 238, 0.32) !important;
  box-shadow: 0 0 24px var(--tnk-glow);
}

.tnk-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.tnk-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.tnk-role-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(34, 211, 238, 0.15);
}

.tnk-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  animation: blink-warn 1s infinite;
}

.tnk-badge-crit { color: #f87171; }
.tnk-badge-warn { color: #fbbf24; animation-duration: 1.2s; }

.tnk-agit-btn {
  font-size: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(42, 26, 10, 0.6);
  color: #fbbf24;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  transition: all var(--transition);
}

.tnk-agit-btn.on {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 12px var(--tnk-glow);
}

.tnk-canvas-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.06), rgba(6, 16, 24, 0.9));
  box-shadow: inset 0 0 30px rgba(6, 182, 212, 0.06);
}

.tnk-canvas-wrap::before {
  content: 'TANK SCADA';
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  color: rgba(34, 211, 238, 0.35);
  pointer-events: none;
}

.tnk-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0.65rem;
}

.tnk-kpi {
  background: rgba(10, 21, 32, 0.8);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-left: 2px solid var(--tnk-accent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.tnk-kpi-label {
  font-size: 9px;
  color: var(--txt2);
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

.tnk-kpi-val {
  color: var(--txt);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tnk-kpi-big {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.tnk-kpi-unit {
  font-size: 9px;
  color: var(--txt2);
  font-weight: 400;
}

.tnk-sed-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.06), #061018);
  box-shadow: inset 0 0 40px rgba(6, 182, 212, 0.05);
}

.tnk-sed-wrap canvas {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
}

#tnk-toolbar .btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.tnk-toolbar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hydro-bright);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.tnk-toolbar-card {
  border-color: rgba(34, 211, 238, 0.2) !important;
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.08), rgba(10, 21, 32, 0.95)) !important;
}

/* ─ Header roadmap buttons (Démo / Direction) ─ */
.hdr-roadmap-btns {
  display: flex;
  gap: 6px;
  margin-right: 8px;
  flex-wrap: wrap;
}

.hdr-roadmap-btn {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  transition: all var(--transition);
  white-space: nowrap;
}

.hdr-roadmap-demo {
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.4);
}

.hdr-roadmap-demo:hover {
  background: rgba(251, 191, 36, 0.25);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

.hdr-roadmap-dir {
  background: rgba(6, 182, 212, 0.18);
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.45);
}

.hdr-roadmap-dir:hover {
  background: rgba(34, 211, 238, 0.25);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.25);
}

/* ─ Dashboard Direction (executive modal) ─ */
.direction-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 16, 24, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ocp-fade-in 0.3s ease;
}

.direction-modal {
  background: linear-gradient(165deg, rgba(10, 21, 32, 0.98), rgba(12, 30, 48, 0.96));
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(6, 182, 212, 0.12);
}

.direction-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.direction-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hydro-bright);
  opacity: 0.7;
  margin-bottom: 4px;
}

.direction-header h2 {
  margin: 0;
  font-size: 22px;
  color: #e0f7ff;
  letter-spacing: -0.02em;
}

.direction-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted, #7eb8d4);
  font-family: var(--font-mono);
}

.direction-close {
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: #67e8f9;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background var(--transition);
}

.direction-close:hover {
  background: rgba(34, 211, 238, 0.2);
}

.direction-mode-banner {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.direction-mode-sim {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: #67e8f9;
}

.direction-mode-live {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.direction-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .direction-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.direction-kpi {
  background: rgba(6, 16, 24, 0.8);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border-left: 3px solid var(--hydro-bright);
}

.direction-kpi-flow { border-left-color: #22d3ee; }
.direction-kpi-plan { border-left-color: #38bdf8; }
.direction-kpi-prog { border-left-color: #fbbf24; }
.direction-kpi-alert { border-left-color: #f87171; }

.direction-kpi-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7eb8d4;
  margin-bottom: 6px;
}

.direction-kpi-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: #e0f7ff;
  font-variant-numeric: tabular-nums;
}

.direction-kpi-unit {
  font-size: 12px;
  font-weight: 400;
  color: #7eb8d4;
}

.direction-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .direction-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

.direction-detail-card {
  background: rgba(10, 21, 32, 0.6);
  border: 1px solid rgba(34, 211, 238, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.direction-detail-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7eb8d4;
  font-family: var(--font-mono);
}

.direction-detail-val {
  font-size: 15px;
  font-weight: 600;
  color: #e0f7ff;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.direction-foot {
  font-size: 11px;
  color: #7eb8d4;
  margin: 0 0 16px;
  line-height: 1.5;
}

.direction-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.direction-btn-export {
  background: linear-gradient(135deg, #0891b2, #06b6d4) !important;
  border-color: rgba(34, 211, 238, 0.5) !important;
  color: #fff !important;
}

#pn-tnk.tnk-night .tnk-card {
  background: rgba(8, 16, 28, 0.95) !important;
  border-color: rgba(34, 211, 238, 0.25) !important;
}

/* ─ Simulation simplifiée ─ */
.sim-simple-panel {
  margin-bottom: 14px;
  padding: 18px 20px !important;
  border-left: 4px solid var(--cyan, #22d3ee) !important;
}

.sim-simple-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sim-simple-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--cyan, #22d3ee);
  letter-spacing: 0.02em;
}

.sim-simple-sub {
  font-size: 12px;
  color: var(--mon-text-muted, rgba(255, 255, 255, 0.55));
  margin-top: 4px;
  max-width: 520px;
  line-height: 1.45;
}

.sim-simple-expert-btn {
  font-size: 11px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(6, 182, 212, 0.12);
  color: #67e8f9;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

.sim-simple-expert-btn:hover {
  background: rgba(6, 182, 212, 0.22);
}

.sim-simple-flow-block {
  margin-bottom: 14px;
}

.sim-simple-flow-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.sim-simple-flow-label strong {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 22px;
  color: #fff;
  font-weight: 700;
}

.sim-simple-flow-slider {
  width: 100%;
  height: 14px;
  accent-color: #22d3ee;
  cursor: pointer;
}

.sim-simple-flow-hints {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.sim-simple-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.sim-simple-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: rgba(8, 20, 32, 0.6);
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 72px;
}

.sim-simple-preset:hover {
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(6, 182, 212, 0.1);
}

.sim-simple-preset.active {
  border-color: #22d3ee;
  background: rgba(6, 182, 212, 0.2);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.sim-simple-preset-icon {
  font-size: 18px;
  line-height: 1;
}

.sim-simple-preset-label {
  font-size: 12px;
  font-weight: 700;
}

.sim-simple-preset-hint {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-mono, monospace);
}

.sim-simple-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.sim-simple-btn {
  flex: 1 1 140px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.sim-simple-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sim-simple-btn-pause.sim-simple-btn-paused {
  border-color: #f59e0b;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.15);
}

.sim-simple-btn-normal {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.sim-simple-btn-emergency {
  border-color: rgba(226, 75, 74, 0.55);
  color: #fca5a5;
  background: rgba(226, 75, 74, 0.12);
}

.sim-simple-btn-resume {
  border-color: rgba(29, 158, 117, 0.55);
  color: #6ee7b7;
  background: rgba(29, 158, 117, 0.15);
}

.sim-simple-btn-startup {
  border-color: rgba(29, 158, 117, 0.55);
  color: #6ee7b7;
  background: rgba(29, 158, 117, 0.18);
  flex: 1 1 100%;
}

.sim-simple-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  font-family: var(--font-mono, monospace);
}

body.sim-simple-active #sim-params-card {
  display: none !important;
}

body.sim-simple-active #btn-startup,
body.sim-simple-active #btn-startup-ees,
body.sim-simple-active #btn-stop-startup,
body.sim-simple-active #btn-pause {
  display: none !important;
}

body.sim-simple-active #shutdown-sim-wrap {
  display: none !important;
}

body.sim-simple-active #ocp-mode-banner-btn {
  font-size: 10px;
  padding: 4px 10px;
}

body.sim-expert-active #sim-simple-panel {
  display: none !important;
}

/* ─ Startup replay (real vs sim) ─ */
.startup-replay-panel {
  margin-bottom: 1rem;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(55, 138, 221, 0.35);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88));
}

.startup-replay-title {
  font-size: 14px;
  font-weight: 700;
  color: #7dd3fc;
}

.startup-replay-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
}

.startup-replay-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.startup-replay-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  flex: 1;
  min-width: 200px;
}

.startup-replay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 10px;
}

.startup-replay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.startup-replay-actions.replay-hidden {
  display: none;
}

.startup-replay-progress {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: #6ee7b7;
  min-height: 18px;
  margin-bottom: 8px;
}

.startup-replay-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.replay-metric {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.replay-metric span {
  color: rgba(255, 255, 255, 0.5);
}

.startup-replay-help {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.startup-replay-help summary {
  cursor: pointer;
  color: #7dd3fc;
}

#replay-chart {
  width: 100%;
  max-height: 180px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

/* ─ Predictive unified toolbar ─ */
#pred-toolbar .pred-toolbar-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

#pred-toolbar .pred-toolbar-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

#pred-toolbar .pred-toolbar-title {
  font-size: 13px;
  font-weight: 600;
  color: #22d3ee;
}

#pred-toolbar .pred-toolbar-score {
  font-size: 11px;
  font-weight: 700;
}

#pred-toolbar .pred-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

#pred-toolbar .pred-toolbar-btn {
  font-size: 10px;
}

#pred-toolbar .pred-toolbar-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

#pred-toolbar .pred-action-hint {
  font-size: 10px;
  color: var(--txt3, rgba(255, 255, 255, 0.45));
  margin-top: 8px;
}

@media (max-width: 768px) {
  .sim-simple-presets {
    grid-template-columns: repeat(2, 1fr);
  }

  .sim-simple-flow-label strong {
    font-size: 18px;
  }

  .sim-simple-btn {
    flex: 1 1 100%;
  }
}

