.page_outils {
  width: 100%;
  background: #f4f5f7;
  min-height: 100vh;
}

/* Grille de cartes */
.ho-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 14px 16px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}

.ho-card {
  background: #fff;
  border: 1px solid #e3e5e9;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}

.ho-card-wide {
  grid-column: 1 / -1;
}

.ho-card .ho-section {
  border-bottom: none;
  margin-bottom: 0;
}

@media (max-width: 992px) {
  .ho-grid { grid-template-columns: 1fr; }
}

/* === Boutons === */
.page_outils button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 10pt;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
  background-color: #f0f2f5;
  color: #333;
}

.page_outils button:hover {
  background-color: #e0e3e8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.page_outils button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* === Header === */
.header-outils {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f8f9fb 0%, #eef0f4 100%);
  border-bottom: 2px solid #dde0e6;
}

.ho-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ho-title h1 {
  margin: 0;
  font-size: 15pt;
  font-weight: 700;
  color: #333;
}
.ho-title-icon {
  font-size: 14pt;
  color: var(--main-bg-color);
}

/* === Sections === */
.ho-section {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
}

.ho-section-title {
  font-size: 9pt;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* === Champs === */
.ho-field-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.ho-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ho-field-arrow {
  display: flex;
  align-items: center;
  padding-bottom: 6px;
  color: #999;
  font-size: 12pt;
}

.ho-label {
  font-size: 9pt;
  font-weight: 500;
  color: #777;
}

.ho-input {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 10pt;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.ho-input:focus {
  border-color: var(--main-bg-color);
}
.ho-input-small {
  width: 120px;
}

.ho-select {
  width: 250px;
  vertical-align: middle;
  display: inline-block;
}

/* === Boutons spéciaux === */
.ho-btn-primary {
  background: var(--main-bg-color) !important;
  color: white !important;
  font-weight: 600;
}
.ho-btn-primary:hover {
  filter: brightness(1.1);
}

.ho-btn-warning {
  background: #e65100 !important;
  color: white !important;
  font-weight: 600;
}
.ho-btn-warning:hover {
  filter: brightness(1.1);
}

.ho-btn-danger {
  background: #c62828 !important;
  color: white !important;
  font-weight: 600;
  padding: 10px 20px !important;
}
.ho-btn-danger:hover {
  filter: brightness(1.1);
}

.ho-spinner {
  color: var(--main-bg-color);
  font-size: 14pt;
  margin-left: 8px;
}

/* === Info remplacement === */
.ho-replace-info {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 10pt;
  color: #1565c0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Table === */
.ho-table-wrapper {
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}

.ho-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 10pt;
}

.ho-table-header th {
  background: linear-gradient(135deg, #f1f3f5 0%, #e8eaed 100%);
  padding: 8px 10px;
  font-weight: 600;
  font-size: 9pt;
  color: #555;
  text-align: left;
  border-bottom: 2px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ho-table-row td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.ho-table-row:nth-child(even) td {
  background-color: #fafbfc;
}
.ho-table-row:nth-child(odd) td {
  background-color: #fff;
}

.ho-table-row:hover td {
  background-color: #f0f7ff;
}

.ho-table-row a {
  color: var(--main-bg-color);
  text-decoration: none;
}
.ho-table-row a:hover {
  text-decoration: underline;
}

.ho-arrow-small {
  font-size: 8pt;
  color: #999;
  margin: 0 4px;
}

/* === Import EAN : aide === */
.ho-help-box {
  background: #f5f9ff;
  border: 1px solid #cfe1ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 10pt;
  color: #1a3a6b;
}
.ho-help-title {
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1565c0;
}
.ho-help-list {
  margin: 4px 0 8px 0;
  padding-left: 22px;
}
.ho-help-list li {
  margin: 2px 0;
  line-height: 1.4;
}
.ho-help-list code,
.ho-help-example code,
.ho-table-ean code {
  background: #eef2f7;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 9pt;
  color: #2c3e50;
}
.ho-help-example {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
}
.ho-help-example-title {
  font-size: 9pt;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}
.ho-help-example pre {
  margin: 0;
  font-size: 9pt;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #333;
  white-space: pre-wrap;
}

.ho-btn-link {
  background: transparent !important;
  color: var(--main-bg-color) !important;
  padding: 4px 6px !important;
  font-size: 9pt !important;
  text-decoration: underline;
  margin-top: 4px;
}
.ho-btn-link:hover {
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  filter: brightness(0.9);
}

.ho-btn-secondary {
  background: #f0f2f5 !important;
  color: #333 !important;
  font-weight: 500;
}
.ho-btn-secondary:hover {
  background: #e0e3e8 !important;
}
/* Lien presente comme un bouton : la regle « .page_outils button » ne cible
   que les <button>, il faut donc lui redonner la geometrie explicitement. */
a.ho-btn-link-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--main-bg-color);
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 9pt;
  text-decoration: none;
  background: var(--main-bg-color);
  color: #fff;
  font-weight: 600;
}
a.ho-btn-link-primary:hover { filter: brightness(1.1); }

.ho-btn-secondary:disabled,
.ho-btn-primary:disabled,
.ho-btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Import EAN : message d'erreur === */
.ho-error-box {
  background: #fdecea;
  border: 1px solid #f5b3ad;
  color: #b71c1c;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 10pt;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Import EAN : stats === */
.ho-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px 0;
  justify-content: center;
}
.ho-stat-item {
  font-size: 9.5pt;
  padding: 5px 10px;
  border-radius: 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}
.ho-stat-total {
  background: #eef2f7;
  color: #333;
  border-color: #d8dee6;
}
.ho-stat-found {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}
.ho-stat-notfound {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}
.ho-stat-warning {
  background: #fff8e1;
  color: #ef6c00;
  border-color: #ffe0b2;
}
.ho-stat-unchanged {
  background: #f5f5f5;
  color: #777;
  border-color: #e0e0e0;
}

/* === Import EAN : tableau preview === */
.ho-table-ean .ho-product-label {
  font-size: 9pt;
  color: #777;
  margin-top: 2px;
}
.ho-table-ean .ho-arrow-cell {
  text-align: center;
  color: #999;
}
.ho-table-ean .ho-muted {
  color: #999;
  font-style: italic;
  font-size: 9pt;
}
.ho-table-ean .ho-not-found {
  color: #c62828;
  font-style: italic;
}

.ho-row-warning td {
  background-color: #fff8e1 !important;
}
.ho-row-warning:hover td {
  background-color: #fff3c4 !important;
}
.ho-row-error td {
  background-color: #ffebee !important;
}
.ho-row-error:hover td {
  background-color: #ffcdd2 !important;
}
.ho-row-muted td {
  background-color: #fafafa !important;
  color: #888;
}
.ho-row-muted:hover td {
  background-color: #f0f0f0 !important;
}

/* === Import EAN : badges === */
.ho-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 9pt;
  font-weight: 500;
  white-space: nowrap;
}
.ho-badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}
.ho-badge-warning {
  background: #fff3e0;
  color: #ef6c00;
}
.ho-badge-error {
  background: #ffebee;
  color: #c62828;
}
.ho-badge-muted {
  background: #f0f0f0;
  color: #777;
}

/* === Responsive mobile === */
@media (max-width: 768px) {
  #id_exports,
  #id_tiers,
  #id_import_ean {
    width: auto;
    margin: 0 10px;
  }

  .ho-field-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ho-field-arrow {
    justify-content: center;
    padding: 0;
  }

  .ho-select {
    width: 100%;
  }
}

/* === Tiers et contacts clos (v3.39.0, préfixe tc-) === */
.tc-onglets {
  display: flex;
  gap: 6px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}
.page_outils .tc-onglet.tc-onglet-actif {
  background: var(--main-bg-color) !important;
  color: #fff !important;
  border-color: var(--main-bg-color) !important;
}
.tc-table-wrapper {
  max-height: 520px;
  overflow-x: auto;
}
.tc-col-check {
  width: 28px;
  text-align: center !important;
}
.tc-nowrap {
  white-space: nowrap;
}
.tc-coord {
  font-size: 8.5pt;
  color: #555;
}
.tc-row-erreur td {
  background: #fdecea;
}
.tc-erreur {
  color: #c62828;
  font-size: 8.5pt;
  margin-top: 2px;
}
@media (max-width: 768px) {
  #id_tiers_clos {
    width: auto;
    margin: 0 10px;
  }
  .tc-table {
    min-width: 640px;
  }
}
