.valid.modified:not([type=checkbox]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid red;
}

.validation-message {
  color: red;
}

#blazor-error-ui {
  color-scheme: light only;
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "An error has occurred."
}

/* Écran de chargement — texte pourcentage via variable Blazor */
.loading-progress-text:after {
  content: var(--blazor-load-percentage-text, "0");
}

code {
  color: #c02d76;
}

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

:root {
  --bg-main: #0b0e14dc;
  --bg-panel: #0b0e1474;
  --border-panel: rgba(255, 255, 255, 0.145);
  --text-main: #e2e8f0;
  --text-muted: #b5bac0;
  --text-accent: #ffd600cc;
  --text-blue-muted: #2301ffeb;
  --text-green: #26b050;
  --text-red: #ef4444;
  --text-alarm: #ff9800;
  --text-alternative: #ffffffcc;
  --font-main: 'Inter', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  /* Surfaces et bordures */
  --bg-surface: #1e2532;
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-card: rgba(0, 0, 0, 0.15);
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-table-header: rgba(255, 255, 255, 0.05);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 214, 0, 0.45);
  --shadow-overlay: rgba(0, 0, 0, 0.7);
  --shadow-deep: rgba(0, 0, 0, 0.6);
  --shadow-soft: rgba(0, 0, 0, 0.15);
  --gauge-track: rgba(255, 255, 255, 0.08);
  --text-contrast: white;
  --accent-rgb: 255, 214, 0;

  /* ProductionGauge */
  --gauge-blue: #0687e9;
  --gauge-coral: #02ebd5;
  --gauge-label: #9ca8b6;
  --gauge-separator: #1f2b3d;
  --gauge-grid: #3c495f;
  --gauge-pastille-bg: #1a2333;
  --gauge-pastille-border: #2a3a51;
  --gauge-pastille-text: #c7d0dd;
  --gauge-pivot-inner: #2b3a4e;
  --gauge-pivot-ring: #4b5d75;
  --gauge-pivot-center: #9fb1c5;
  --gauge-production: #61ce7a;
  --gauge-bottom-text: #a5b4c8;
}

[data-theme="light"] {
  --bg-main: #f0f2f5;
  --bg-panel: #ffffff;
  --border-panel: rgba(0, 0, 0, 0.1);
  --text-main: #1a202c;
  --text-muted: #4a5568;
  --text-accent: #b8960a;
  --text-blue-muted: #1a0ad4;
  --text-green: #1e8e3e;
  --text-red: #dc2626;
  --text-alarm: #e68a00;
  --text-alternative: rgba(0, 0, 0, 0.8);

  --bg-surface: #ffffff;
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-card: rgba(0, 0, 0, 0.03);
  --bg-subtle: rgba(0, 0, 0, 0.02);
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-table-header: rgba(0, 0, 0, 0.04);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-accent: rgba(161, 131, 0, 0.45);
  --shadow-overlay: rgba(0, 0, 0, 0.4);
  --shadow-deep: rgba(0, 0, 0, 0.2);
  --shadow-soft: rgba(0, 0, 0, 0.08);
  --gauge-track: rgba(0, 0, 0, 0.1);
  --text-contrast: #1a202c;
  --accent-rgb: 161, 131, 0;

  /* ProductionGauge */
  --gauge-blue: #2563eb;
  --gauge-coral: #02ebd5;
  --gauge-label: #64748b;
  --gauge-separator: #e2e8f0;
  --gauge-grid: #94a3b8;
  --gauge-pastille-bg: #e2e8f0;
  --gauge-pastille-border: #cbd5e1;
  --gauge-pastille-text: #334155;
  --gauge-pivot-inner: #cbd5e1;
  --gauge-pivot-ring: #94a3b8;
  --gauge-pivot-center: #475569;
  --gauge-production: #16a34a;
  --gauge-bottom-text: #475569;
}

/* Fond atmosphérique atténué en thème light */
[data-theme="light"] .dashboard-v2 {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 180, 220, 0.03) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(140, 0, 200, 0.02) 0%, transparent 60%);
}

[data-theme="light"] .dashboard-v2::before {
  background-image:
    linear-gradient(rgba(0, 140, 180, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 140, 180, 0.04) 1px, transparent 1px);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

.settings-footer-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--text-accent);
  background: rgba(var(--accent-rgb), 0.05);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-main);
  transition: all 0.2s ease-in-out;
  box-shadow: 0 4px 6px var(--shadow-soft);
}

.settings-footer-btn:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
  transform: translateY(-1px);
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.panel-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-header .icon {
  margin-right: 8px;
}


/* Alarmes Panel */
.alarmes-panel {
  flex: 1;
  overflow-y: auto;
}

.alarmes-panel .panel-header .badge {
  background: rgba(38, 176, 80, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.65rem;
  color: var(--text-green);
}

.alarmes-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.alarmes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.alarmes-icon {
  font-size: 2.5rem;
  color: var(--text-green);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(38, 176, 80, 0.1);
  border: 1px solid rgba(38, 176, 80, 0.2);
}

.btn-primary {
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  color: var(--text-accent);
  background: rgba(var(--accent-rgb), 0.05);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

.btn-secondary {
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: transparent;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

.btn-secondary:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: var(--border-panel);
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--shadow-overlay);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  width: 400px;
  max-width: 90vw;
  z-index: 1000;
  box-shadow: 0 12px 48px var(--shadow-deep);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--text-main);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-panel);
  padding-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-contrast);
}

.modal-header .close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: -8px -8px -8px 0;
}

.modal-header .close-btn:hover {
  color: var(--text-red);
  background: rgba(239, 68, 68, 0.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.params-section-alarm {
  border-color: rgba(229, 57, 53, 0.25);
  background: rgba(229, 57, 53, 0.03);
}

.params-section-title-alarm {
  color: #e53935 !important;
}

.setting-item-alarm {
  border-left: 3px solid #e53935;
  padding-left: 12px;
  background: rgba(229, 57, 53, 0.04);
  border-radius: 6px;
}

.setting-item-alarm label {
  color: #ef5350;
}

.setting-item-alarm input {
  border-color: rgba(229, 57, 53, 0.3);
}

.setting-item-alarm input:focus {
  border-color: #e53935;
}

.setting-item select,
.setting-item input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-panel);
  color: var(--text-contrast);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  height: 44px;
  box-sizing: border-box;
}

.setting-item select:focus,
.setting-item input:focus {
  border-color: var(--text-accent);
}

.setting-item select option {
  background: var(--bg-surface);
  color: var(--text-contrast);
  padding: 8px 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.modal-footer .btn {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
  min-height: 44px;
  min-width: 120px;
}

/* Parameters Tab Styling */
.params-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.params-row {
  display: flex;
  gap: 12px;
}

.params-row > .params-section {
  flex: 1;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.params-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  padding: 12px 16px;
}

.params-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-accent);
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  row-gap: 20px;
}

.calibration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.calibration-card {
  background: var(--bg-card);
  border: 1px solid var(--border-panel);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.calibration-card:hover {
  border-color: var(--border-accent);
}

.calibration-card-title {
  font-size: 0.8rem;
  color: var(--text-main);
  text-align: center;
  font-weight: 600;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Settings Table Styling */
.settings-modal-wide {
  width: 1300px !important;
  max-width: 95vw !important;
}

.settings-row {
  display: flex;
  gap: 16px;
}

.settings-row .setting-item {
  flex: 1;
}

.full-width-item {
  width: 100%;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border-panel);
  margin: 4px 0;
  width: 100%;
}

.vertical-divider {
  width: 2px;
  background-color: var(--border-panel);
  margin: 0 8px;
  border-radius: 1px;
}

.calibration-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calibration-field {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.calibration-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-accent);
  white-space: nowrap;
  min-width: 40px;
}

.calibration-field input[type="number"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-panel);
  color: var(--text-contrast);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  min-height: 32px;
}

.calibration-field input[type="number"]:focus {
  border-color: var(--text-accent);
}

.calibration-field input[type="number"]::-webkit-inner-spin-button,
.calibration-field input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
  width: 32px;
  height: 32px;
}

.calibration-field input[type="number"].input-error {
  border-color: #ff4444;
}

.calibration-error {
  color: #ff4444;
  font-size: 0.75rem;
  text-align: center;
  margin-top: 4px;
}

/* ── Verrouillage PIN étalonnage ── */

.calibration-tab-content {
  padding: 4px 0;
}

.calibration-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calibration-header .params-section-title {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.calibration-lock-actions {
  flex-shrink: 0;
}

.btn-unlock {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--text-accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

.btn-unlock:hover {
  background: rgba(0, 229, 255, 0.18);
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

.btn-change-pin {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

.btn-change-pin:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: var(--border-panel);
}

.pin-input-zone {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.pin-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pin-change-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pin-change-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pin-change-field label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.pin-input {
  width: 100px;
  background: var(--bg-input);
  border: 1px solid var(--border-panel);
  color: var(--text-contrast);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 6px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.pin-input:focus {
  border-color: var(--text-accent);
}

.btn-pin-ok {
  padding: 8px 16px;
  font-size: 0.8rem;
  min-width: auto;
}

.btn-pin-cancel {
  padding: 8px 12px;
  font-size: 0.8rem;
  min-width: auto;
}

.pin-error {
  color: #ff4444;
  font-size: 0.78rem;
  margin-top: 8px;
  font-weight: 500;
}

.calibration-field input[type="number"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-subtle);
  border-style: dashed;
}

/* ── Chantier / Zones ── */

.zone-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zone-add-row input[type="text"] {
  flex: 1;
}

.btn-zone-remove {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--text-red);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: var(--font-main);
  transition: all 0.2s ease;
}

.btn-zone-remove:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

.site-history-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 12px 0;
}

.site-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.site-history-card.active {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.04);
}

.site-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.site-history-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.site-history-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.site-history-zones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.site-history-zone-tag {
  font-size: 0.75rem;
  color: var(--text-accent);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  padding: 2px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.site-history-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-history-active-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-green);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 6px 14px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-panel);
  background: var(--bg-card);
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
}

.settings-table th,
.settings-table td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-panel);
  font-size: 0.85rem;
}

.settings-table th {
  font-family: var(--font-main);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--bg-table-header);
}

.settings-table tbody tr {
  cursor: pointer;
  transition: background 0.2s;
}

.settings-table tbody tr:hover {
  background: var(--bg-hover);
}

.settings-table tbody tr.selected-row {
  background: rgba(0, 229, 255, 0.1);
}

.settings-table td.checkbox-cell {
  text-align: center;
}

/* Cellules avec boutons d'ajustement ▲/▼ */
.adjustable-cell {
  white-space: nowrap;
}

.adjustable-cell > span {
  vertical-align: middle;
}

.adjust-buttons {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  margin-left: 4px;
  gap: 0;
}

.adjust-buttons button {
  display: block;
  background: transparent;
  border: 1px solid var(--border-panel);
  color: var(--accent-cyan);
  font-size: 0.5rem;
  line-height: 1;
  padding: 0px 3px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}

.adjust-buttons button:first-child {
  border-bottom: none;
  border-radius: 2px 2px 0 0;
}

.adjust-buttons button:last-child {
  border-radius: 0 0 2px 2px;
}

.adjust-buttons button:hover {
  background: rgba(0, 229, 255, 0.15);
}

.text-center {
  text-align: center !important;
}

input[type="checkbox"] {
  accent-color: var(--text-accent);
  cursor: pointer;
  width: 24px;
  height: 24px;
}

/* Tabs Styling */
.tabs-container {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-panel);
  margin-bottom: 16px;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  min-height: 44px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-contrast);
}

.tab-btn.active {
  color: var(--text-accent);
  border-bottom: 3px solid var(--text-accent);
}

.tab-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  margin-top: -2px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.tab-btn:hover .tab-icon,
.tab-btn.active .tab-icon {
  opacity: 1;
}

.tabs-header-sub {
  margin-top: 0;
}

.tab-btn-sub {
  font-size: 0.82rem;
  padding: 8px 16px;
  min-height: 36px;
}

.tabs-content {
  min-height: 250px;
}

/* Barre d'outils sols : sous-onglets + bouton reset côte à côte */
.soil-tabs-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.soil-tabs-toolbar .tabs-header-sub {
  flex: 1;
}

/* Bouton réinitialisation sols */
.btn-reset-soils {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-main);
  letter-spacing: 0.3px;
  color: var(--text-red);
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-reset-soils:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.12);
}

/* Barre de confirmation inline */
.reset-confirm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin: 8px 0 12px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-main);
  animation: resetBarSlide 0.2s ease-out;
}

.reset-confirm-bar svg {
  color: var(--text-alarm);
  flex-shrink: 0;
}

.reset-confirm-bar span {
  flex: 1;
}

.btn-confirm-yes {
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-main);
  color: #fff;
  background: rgba(239, 68, 68, 0.8);
  border: 1px solid rgba(239, 68, 68, 0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-confirm-yes:hover {
  background: rgba(239, 68, 68, 1);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.btn-confirm-no {
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-main);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-confirm-no:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

@keyframes resetBarSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   Dashboard Home v2
   ========================= */

.dashboard-v2 {
  display: grid;
  grid-template-rows: minmax(0, 1.18fr) minmax(0, 0.58fr) auto;
  height: 100dvh;
  padding: 6px;
  box-sizing: border-box;
  gap: 6px;
  overflow: hidden;
  position: relative;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 229, 255, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(179, 0, 255, 0.03) 0%, transparent 60%);
}

/* Grille technique de fond */
.dashboard-v2::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.82fr) minmax(420px, 1.45fr);
  gap: 6px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.left-stack {
  display: grid;
  grid-template-rows: 0.70fr 0.40fr;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.dashboard-v2 .panel {
  padding: 10px;
  overflow: hidden;
}

.dashboard-v2 .panel-header {
  margin-bottom: 8px;
  font-size: 0.68rem;
}

.production-gauge-panel .pg-container {
  height: 100%;
}

.production-gauge-panel .production-gauge {
  height: 100%;
}

.pressure-panel {
  justify-content: stretch;
}

.pressure-gauge {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pressure-gauge-header {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.pressure-gauge-icon {
  color: var(--text-muted);
}

.pressure-gauge-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pressure-gauge-svg {
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  transform: rotate(135deg);
}

.pressure-gauge-track {
  stroke: var(--gauge-track);
}

.pressure-gauge-value-stroke {
  transition: stroke 0.3s ease, filter 0.3s ease;
}

/* ── Pression : 3 paliers vert / orange / rouge ── */
.pressure-stroke-green {
  stroke: #4caf50;
  filter: drop-shadow(0 0 2px rgba(76, 175, 80, 0.5));
}

.pressure-stroke-orange {
  stroke: #ff9800;
  filter: drop-shadow(0 0 2px rgba(255, 152, 0, 0.6));
}

.pressure-stroke-red {
  stroke: #ef4444;
  filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.7));
}

/* ── Clignotements partagés ── */
.gauge-blink-slow {
  animation: gauge-blink 0.9s ease-in-out infinite;
}

.gauge-blink-fast {
  animation: gauge-blink 0.3s ease-in-out infinite;
}

@keyframes gauge-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ── Animations d'entrée staggerées du dashboard ── */
@keyframes dashboardFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dashboard-enter {
  opacity: 0;
  animation: dashboardFadeIn 0.6s ease-out forwards;
}

.dashboard-enter-1 { animation-delay: 0.1s; }
.dashboard-enter-2 { animation-delay: 0.25s; }
.dashboard-enter-3 { animation-delay: 0.4s; }
.dashboard-enter-4 { animation-delay: 0.55s; }
.dashboard-enter-5 { animation-delay: 0.7s; }

.pressure-gauge-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.pressure-gauge-value-text {
  font-size: clamp(2.2rem, 3.6vw, 3.6rem);
  font-weight: 700;
  color: var(--text-contrast);
  line-height: 1.1;
}

.pressure-gauge-unit {
  font-size: 1rem;
  color: var(--text-muted);
}

.pressure-gauge-sub {
  font-size: 0.9rem;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: var(--text-accent);
  display: inline-block;
  font-family: var(--font-mono);
}

.pressure-gauge-range-min,
.pressure-gauge-range-max {
  position: absolute;
  bottom: 6%;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.pressure-gauge-range-min {
  left: 10%;
}

.pressure-gauge-range-max {
  right: 10%;
}

.pressure-gauge-footer {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-accent);
  flex-shrink: 0;
}

.info-limit {
  color: var(--text-alarm);
}

.total-output-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  height: 100%;
}

.kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 12px var(--shadow-soft);
  transition: background 0.2s ease;
}

.kpi-card:hover {
  background: var(--bg-hover);
}

.kpi-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-icon {
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.kpi-card:hover .kpi-icon {
  opacity: 1;
}

.kpi-values {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.kpi-current {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-color);
  font-family: var(--font-mono);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.kpi-current .unit {
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
}

.kpi-total {
  font-size: 0.95rem;
  color: var(--text-accent);
  font-family: var(--font-mono);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

.kpi-total > span:last-child {
  font-weight: 700;
}

.kpi-total .unit {
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-total-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.82fr) minmax(420px, 1.45fr);
  grid-template-rows: 1fr;
  gap: 6px;
  min-height: 0;
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
}

.bottom-left-stack {
  display: grid;
  grid-template-rows: 1fr;
  gap: 6px;
  min-height: 0;
}

.concentration-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.concentration-panel .panel-header {
  width: 100%;
}

.concentration-circle-wrapper {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.concentration-circle {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  border: 5px solid #0055a4;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ── Bleu France : zone normale ── */
.concentration-blue {
  border-color: #0055a4;
  box-shadow: 0 0 12px rgba(0, 85, 164, 0.4), inset 0 0 8px rgba(0, 85, 164, 0.1);
}

/* ── Orange : zone alerte ≥90% + clignotement lent ── */
.concentration-orange {
  border-color: #ff9800;
  box-shadow: 0 0 14px rgba(255, 152, 0, 0.5), inset 0 0 8px rgba(255, 152, 0, 0.1);
  animation: gauge-blink 0.9s ease-in-out infinite;
}

/* ── Rouge : zone alarme ≥100% ── */
.concentration-red {
  border-color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6), inset 0 0 10px rgba(239, 68, 68, 0.15);
}

.concentration-circle.concentration-alarm {
  animation: gauge-blink 0.3s ease-in-out infinite;
}

.concentration-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0.85;
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

/* Remplissage bleu france néon */
.concentration-fill-blue {
  background: #0055a4;
  box-shadow: 0 0 20px rgba(0, 85, 164, 0.35);
}

/* Remplissage orange néon */
.concentration-fill-orange {
  background: #ff9800;
  box-shadow: 0 0 20px rgba(255, 152, 0, 0.4);
}

/* Remplissage rouge néon */
.concentration-fill-red {
  background: #ef4444;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.5);
}

.concentration-value {
  position: relative;
  z-index: 1;
  font-size: clamp(1.2rem, 2.5vh, 1.8rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.concentration-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-top: 4px;
}

.concentration-cvmax {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-accent);
}

.concentration-cv-alarm {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-alarm);
}

/* ── Graphique temps réel — seuils normalisés ── */

.realtime-chart {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}


.chart-svg-container {
  flex: 1;
  min-height: 0;
  overflow: visible;
  position: relative;
  padding: 6px 0 16px 0;
}

.chart-svg-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-y-labels {
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 1;
}

.chart-y-labels span {
  position: absolute;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.7;
  transform: translateY(-50%);
  line-height: 1;
}

.chart-x-labels {
  position: absolute;
  bottom: -2px;
  left: 40px;
  right: 0;
  height: 14px;
  pointer-events: none;
  z-index: 1;
}

.chart-x-labels span {
  position: absolute;
  font-size: 0.55rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.7;
  transform: translateX(-50%);
  line-height: 1;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
  flex-shrink: 0;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Status Strip : barre d'instrumentation ── */

@keyframes statusStripScanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(var(--accent-rgb), 1); }
  50% { opacity: 0.4; box-shadow: 0 0 1px rgba(var(--accent-rgb), 1); }
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
  min-height: 0;
  position: relative;
  z-index: 2;
}

.status-strip-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--border-accent);
  border-radius: 4px 8px 8px 4px;
  padding: 6px 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}

/* Ligne de scan horizontale subtile */
.status-strip-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.03), transparent);
  animation: statusStripScanline 8s linear infinite;
  pointer-events: none;
}

/* Ligne décorative horizontale fine en haut */
.status-strip-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 2px;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.25), rgba(var(--accent-rgb), 0.04) 50%, transparent);
  pointer-events: none;
}

.status-strip-section:hover {
  background: var(--bg-hover);
  border-left-color: rgba(var(--accent-rgb), 0.7);
}

.status-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: rgba(var(--accent-rgb), 0.85);
  font-weight: 700;
  white-space: nowrap;
  margin-right: 6px;
  padding-right: 14px;
  border-right: 1px solid rgba(var(--accent-rgb), 0.12);
  position: relative;
  line-height: 1.4;
}

/* Indicateur "live" pulsant */
.status-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 1);
  margin-right: 5px;
  vertical-align: middle;
  animation: statusPulse 2s ease-in-out infinite;
}

.status-items {
  display: grid;
  grid-template-columns: repeat(4, auto);
  column-gap: 24px;
  row-gap: 2px;
  flex: 1;
}

.status-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  padding: 1px 4px;
  border-radius: 3px;
  transition: background 0.2s ease;
}

.status-item:hover {
  background: rgba(var(--accent-rgb), 0.04);
}

.status-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.status-item:hover .status-label {
  opacity: 1;
}

.status-value {
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Roboto Mono', monospace;
  color: var(--text-accent, #ffd600c9);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.status-separator {
  display: none;
}

.status-symbol {
  font-style: italic;
  opacity: 0.6;
  color: rgba(var(--accent-rgb), 0.45);
}

.strip-actions {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 4px 8px 8px 4px;
  cursor: pointer;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-accent);
  border-color: rgba(var(--accent-rgb), 0.25);
}

/* Bouton Démarrer/Arrêter dans la barre d'état */
.start-stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  min-width: 155px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: var(--font-main);
  border-radius: 8px 4px 4px 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid;
}

.start-stop-btn.stopped {
  background: rgba(38, 176, 80, 0.15);
  border-color: rgba(38, 176, 80, 0.4);
  color: #26b050;
}

.start-stop-btn.stopped:hover {
  background: rgba(38, 176, 80, 0.25);
  border-color: rgba(38, 176, 80, 0.6);
}

.start-stop-btn.running {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.start-stop-btn.running:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
}

.settings-strip-btn {
  min-width: 155px;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.8rem;
  letter-spacing: 1px;
  border-radius: 4px 8px 8px 4px;
}

.settings-row-primary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

@media (max-width: 1040px) {
  .top-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .left-stack {
    grid-template-rows: minmax(260px, auto) auto;
  }
}

@media (max-width: 900px) {
  .dashboard-v2 {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .status-strip-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .status-items {
    grid-template-columns: repeat(2, auto);
    gap: 6px;
  }

  .status-separator {
    display: none;
  }

  .strip-actions {
    flex-direction: row;
    width: 100%;
  }

  .start-stop-btn,
  .settings-strip-btn,
  .spectator-label {
    flex: 1;
  }
}

@media (max-height: 820px) {
  .dashboard-v2 {
    grid-template-rows: minmax(0, 1.08fr) minmax(0, 0.52fr) auto;
    padding: 6px;
    gap: 6px;
  }

  .dashboard-v2 .panel {
    padding: 8px;
  }

  .pressure-gauge-value-text {
    font-size: clamp(2rem, 3.1vw, 2.9rem);
  }

  .total-output-value .value-main {
    font-size: clamp(2rem, 3.1vw, 2.8rem);
  }

  .total-output-value .unit {
    font-size: 1.1rem;
  }

  .status-strip-section {
    padding: 4px 10px;
  }

  .status-label {
    font-size: 0.56rem;
  }

  .status-value {
    font-size: 0.78rem;
  }

}

@media (max-width: 840px) {
  .settings-row-primary {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 560px) {
  .settings-row-primary {
    grid-template-columns: 1fr;
  }
}

/* ── Lexique (onglet aide symboles) ── */

.lexique-container {
  padding: 4px 0;
}

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

.lexique-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-panel);
  border-left: 3px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 4px 8px 8px 4px;
  transition: border-color 0.2s, background 0.2s;
}

.lexique-card:hover {
  border-left-color: rgba(var(--accent-rgb), 0.7);
  background: var(--bg-hover);
}

.lexique-symbol {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-accent);
  min-width: 56px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 6px;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.lexique-symbol sub {
  font-size: 0.7em;
  opacity: 0.75;
}

.lexique-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.lexique-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-contrast);
  line-height: 1.2;
}

.lexique-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}

.lexique-card-production {
  border-left-color: rgba(38, 176, 80, 0.4);
}

.lexique-card-production:hover {
  border-left-color: rgba(38, 176, 80, 0.75);
}

.lexique-symbol-production {
  color: var(--text-green);
  background: rgba(38, 176, 80, 0.08);
  border-color: rgba(38, 176, 80, 0.2);
}

@media (max-width: 700px) {
  .lexique-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Popup avertissement sols modifiés
   ========================= */

.soil-warning-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: var(--shadow-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1100;
  animation: soilWarningFadeIn 0.3s ease-out;
}

.soil-warning-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 460px;
  max-width: 90vw;
  z-index: 1101;
  background: var(--bg-surface);
  border: 1px solid rgba(0, 90, 110, 0.35);
  border-radius: 12px;
  box-shadow:
    0 0 30px rgba(0, 90, 110, 0.1),
    0 12px 48px var(--shadow-deep);
  overflow: hidden;
  animation: soilWarningCardIn 0.35s ease-out;
}

.soil-warning-body {
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.soil-warning-icon {
  color: #0097a7;
  filter: drop-shadow(0 0 6px rgba(0, 151, 167, 0.3));
  margin-bottom: 2px;
}

.soil-warning-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-contrast);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-main);
}

.soil-warning-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.soil-warning-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.btn-soil-validate {
  border: 1px solid rgba(0, 120, 140, 0.4);
  color: #008c9e;
  background: rgba(0, 120, 140, 0.08);
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-main);
  border-radius: 8px;
  padding: 12px 28px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.btn-soil-validate:hover {
  background: rgba(0, 120, 140, 0.18);
  border-color: rgba(0, 140, 160, 0.6);
  box-shadow: 0 0 10px rgba(0, 140, 160, 0.15);
  transform: translateY(-1px);
}

.btn-soil-settings {
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: transparent;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-main);
  border-radius: 8px;
  padding: 12px 28px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-soil-settings:hover {
  color: #7b1fa2;
  background: rgba(90, 0, 150, 0.08);
  border-color: rgba(90, 0, 150, 0.3);
  transform: translateY(-1px);
}

@keyframes soilWarningFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes soilWarningCardIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ── Label mode spectateur (inline dans strip-actions) ── */
.spectator-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px;
  min-width: 155px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: var(--font-main);
  border-radius: 8px;
  border: 1px solid rgba(179, 0, 255, 0.35);
  background: rgba(179, 0, 255, 0.1);
  color: var(--accent-secondary, #b300ff);
}

/* ══════════════════════════════════════════════════════════
   Modale caméra flottante (drag/resize)
   ══════════════════════════════════════════════════════════ */

.camera-modal {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 540px;
  height: 400px;
  z-index: 900;
  background: var(--bg-surface);
  border: 1px solid var(--border-panel);
  border-radius: 10px;
  box-shadow: 0 8px 32px var(--shadow-deep);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.camera-modal.show {
  opacity: 1;
  transform: scale(1);
}

.camera-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  cursor: grab;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.camera-modal-header:active {
  cursor: grabbing;
}

.camera-modal-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.camera-modal-controls {
  display: flex;
  gap: 4px;
}

.camera-close-btn,
.camera-size-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.camera-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.camera-size-btn:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
  color: var(--text-accent);
}

.camera-modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  min-height: 0;
}

.camera-stream-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.camera-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 20px;
}

.camera-error svg {
  color: var(--text-alarm);
}

.camera-error-retry {
  padding: 6px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-main);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.camera-error-retry:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--text-accent);
}

.camera-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, rgba(var(--accent-rgb), 0.25) 50%);
  border-radius: 0 0 10px 0;
  z-index: 2;
}

.camera-resize-handle:hover {
  background: linear-gradient(135deg, transparent 50%, rgba(var(--accent-rgb), 0.45) 50%);
}

/* ── Overlay PTZ ── */

.camera-ptz-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.ptz-btn {
  position: absolute;
  pointer-events: auto;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  touch-action: none;
  transition: background 0.15s ease, color 0.15s ease;
  backdrop-filter: blur(2px);
}

.ptz-btn:hover,
.ptz-btn:active {
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.9);
}

.ptz-btn svg {
  width: 20px;
  height: 20px;
}

.ptz-up    { top: 8px;    left: 50%;  transform: translateX(-50%); }
.ptz-down  { bottom: 8px; left: 50%;  transform: translateX(-50%); }
.ptz-left  { left: 8px;   top: 50%;   transform: translateY(-50%); }
.ptz-right { right: 8px;  top: 50%;   transform: translateY(-50%); }

.ptz-zoom-in  { bottom: 56px; right: 8px; }
.ptz-zoom-out { bottom: 8px;  right: 8px; }

/* ── Bouton caméra dans la barre d'état ── */

.camera-strip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: var(--font-main);
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.camera-strip-btn:hover {
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-accent);
  border-color: rgba(var(--accent-rgb), 0.25);
}

.camera-strip-btn.active {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  color: #00e5ff;
}

/* ── Onglet Utilisateurs ── */

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.users-table tr:last-child td {
  border-bottom: none;
}

.role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.role-operator {
  background: rgba(0, 229, 255, 0.12);
  color: #00e5ff;
}

.role-spectator {
  background: rgba(179, 0, 255, 0.12);
  color: #b300ff;
}

.btn-delete-user {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.btn-delete-user:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}
