/* public/styles/aeromep-v2.css — Studio AeroMEP v2 Haute Densité (Strict CSP) */
.am2-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.am2-sub {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0;
}

.am2-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.am2-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 12px;
}

.am2-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
}

.am2-field.hidden {
  display: none;
}

.am2-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding-bottom: 6px;
  cursor: pointer;
}

.am2-check-label.hidden {
  display: none;
}

.am2-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.am2-kpi-card {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.am2-kpi-card.warn {
  border-color: #f59e0b;
  background: #fffbeb;
}

.am2-kpi-card.ok {
  border-color: #10b981;
  background: #ecfdf5;
}

.am2-kpi-lbl {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.am2-kpi-val {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
}

.am2-dropzone {
  border: 1.5px dashed #0284c7;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12px;
  color: #0369a1;
  background: rgba(2, 132, 199, 0.05);
  cursor: pointer;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.am2-dropzone.dragover {
  background: rgba(2, 132, 199, 0.14);
}

.am2-dropzone.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.am2-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 6px;
}

.am2-tab {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.am2-tab.active {
  background: #0078d4;
  color: #ffffff;
}

.am2-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.am2-search {
  flex: 1;
  min-width: 210px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
}

.am2-hitl-toggle {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.am2-hitl-toggle.active {
  background: #f59e0b;
  color: #ffffff;
}

.am2-table-wrap {
  overflow-x: auto;
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.am2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.am2-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
}

.am2-table td {
  padding: 5px 7px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.am2-num-input {
  width: 64px;
  padding: 3px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 12px;
}

.am2-usage-sel {
  max-width: 165px;
  padding: 3px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 11.5px;
}

.am2-badge-ok {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.am2-badge-warn {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.am2-just-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
  color: #334155;
}

.am2-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
}

.am2-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  padding: 10px 16px;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  display: none;
}

.am2-toast.show {
  display: block;
}

.am2-toast.error {
  background: #b91c1c;
}

.am2-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #cbd5e1;
  border-top-color: #0078d4;
  border-radius: 50%;
  animation: am2spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.am2-hidden {
  display: none;
}

.am2-row-critical {
  background: rgba(239, 68, 68, 0.09);
}

.am2-row-critical td:first-child {
  border-left: 3px solid #dc2626;
  font-weight: 700;
  color: #991b1b;
}

.am2-badge-crit {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.am2-badge-info {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.am2-sync-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bae6fd;
  background: rgba(14, 165, 233, 0.06);
  margin-bottom: 12px;
}

.am2-net-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

/* Bouton Guide Métier & Tiroir Latéral d'Aide Contextuelle (Strict CSP) */
.am2-btn-guide {
  border: 1px solid #0284c7;
  background: #f0f9ff;
  color: #0369a1;
  font-weight: 700;
}

.am2-btn-guide:hover {
  background: #e0f2fe;
}

.am2-guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
}

.am2-guide-backdrop.am2-hidden {
  display: none;
}

.am2-guide-drawer {
  width: min(640px, 94vw);
  height: 100vh;
  background: #ffffff;
  color: #0f172a;
  box-shadow: -12px 0 36px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.am2-guide-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #0f172a;
  color: #ffffff;
  border-bottom: 3px solid #0284c7;
}

.am2-guide-title {
  font-size: 14.5px;
  font-weight: 700;
}

.am2-guide-close {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.am2-guide-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.am2-guide-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.am2-guide-tab {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.am2-guide-tab.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.am2-guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 24px;
  font-size: 12.8px;
  line-height: 1.55;
}

.am2-guide-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.am2-guide-card-title {
  font-weight: 700;
  color: #0369a1;
  margin-bottom: 4px;
  font-size: 13px;
}

.am2-guide-code {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #0f172a;
  font-family: Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
}

.am2-guide-foot {
  padding: 10px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@keyframes am2spin {
  to { transform: rotate(360deg); }
}
