/* Data — le catalogue de la donnée.

   Data réutilise les primitives partagées par Market, Finance et Admin :
   en-tête (`.market-head`), filtres (`.market-controls`), panneaux
   (`.market-panel`, `.finance-panel`), listes (`.market-mini-list`), onglets
   (`.finance-tabs`), KPI, états vides, bandeaux (`.admin-banner`). Ce fichier
   ne porte que ce qui est propre à Data. */

/* --- Tableaux lisibles ------------------------------------------------------
   `.data-table` est l'ancienne grille monospace des vues brutes. Data montre
   des noms métier : il a sa propre grille, sans police technique. */
.data-grid { width: 100%; border-collapse: collapse; font-size: var(--mk-body); }
.data-grid th {
  padding: 9px 14px; color: var(--muted); background: #f7fafd; border-bottom: 1px solid var(--mk-line);
  font-size: var(--mk-micro); font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.data-grid th .text-button { padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.data-grid th .text-button svg { width: 11px; height: 11px; }
.data-grid td { max-width: 360px; padding: 10px 14px; border-bottom: 1px solid var(--mk-line); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.data-grid tbody tr:last-child td { border-bottom: 0; }
.data-grid tbody tr[tabindex], .data-grid tbody tr[data-data-open-table] { cursor: pointer; }
.data-grid tbody tr:hover { background: #f7fafd; }
.data-grid td strong { display: block; font-size: 12.5px; font-weight: 650; }
.data-grid td code, .data-grid td > small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.data-grid code { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.data-grid .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.data-grid tr.is-error td { background: #fdeeee; }
.data-grid tr.is-duplicate td { color: var(--muted); }
.data-table-list, .data-structure, .data-rows, .data-relation-table { overflow: hidden; padding: 0; }

.data-muted { color: var(--muted); font-size: var(--mk-meta); }
.data-domain-tag.is-none { color: #7a5a12; background: #fdf6e6; }
.data-role { display: inline-flex; align-items: center; gap: 5px; color: #3e536b; font-size: var(--mk-meta); font-weight: 600; }
.data-role svg { width: 13px; height: 13px; color: #6c8196; }
.data-storage { color: #3e536b; font-size: var(--mk-meta); }
.data-gap { display: inline-block; margin-left: 6px; padding: 1px 7px; color: #7a5a12; background: #fdf6e6; border-radius: 99px; font-size: 10px; font-weight: 700; }
.data-key { display: inline-flex; align-items: center; gap: 5px; color: #1f6b45; font-size: var(--mk-meta); font-weight: 650; }
.data-key svg { width: 13px; height: 13px; }
.data-warn { color: #7a5a12; font-size: var(--mk-meta); font-weight: 650; }
.data-required { color: #3e536b; font-weight: 650; }
.data-structure td .text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; font-size: var(--mk-meta); }
.data-structure td .text-button svg { width: 12px; height: 12px; }

/* Point de fraîcheur : forme + libellé en infobulle, jamais la couleur seule. */
.data-freshness { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; vertical-align: middle; background: #b6c6d6; }
.data-freshness.is-day, .data-freshness.is-week { background: #2e8b57; }
.data-freshness.is-month { background: #6c8196; }
.data-freshness.is-older { background: transparent; border: 1.5px solid #9a6b09; }
.data-freshness.is-never { background: transparent; border: 1.5px dashed #b6c6d6; }
.data-freshness-label { flex: none; padding: 3px 9px; color: #4a5f74; background: var(--soft-surface); border-radius: 99px; font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.data-freshness-label.is-day, .data-freshness-label.is-week { color: #1f6b45; background: #eaf6ef; }

/* --- Barres horizontales ------------------------------------------------------ */
.data-bars { display: grid; gap: 4px; padding: 12px 15px 14px; }
.data-bar {
  display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr) 64px; align-items: center; gap: 12px;
  width: 100%; padding: 6px 8px; background: none; border: 0; border-radius: 8px; color: inherit; text-align: left; cursor: pointer;
}
.data-bar:hover { background: #f3f7fb; }
.data-bar-label { min-width: 0; overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.data-bar-label small { margin-left: 6px; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.data-bar-track { display: block; height: 10px; overflow: hidden; background: #eef3f8; border-radius: 99px; }
.data-bar-track > span { display: block; height: 100%; border-radius: 99px 4px 4px 99px; }
.data-bar > b { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }

/* --- Domaines ---------------------------------------------------------------- */
.data-domain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 12px; }
.data-domain-card { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 16px; }
.data-domain-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.data-domain-card h3 { margin: 0; font-size: 15px; }
.data-domain-card header small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--mk-meta); }
.data-domain-card > p { margin: 0; color: #3e536b; font-size: 12px; line-height: 1.5; }
.data-domain-card dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.data-domain-card dl > div { padding: 7px 8px; background: var(--soft-surface); border-radius: 8px; }
.data-domain-card dt { color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.data-domain-card dd { margin: 2px 0 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.data-partners { display: flex; align-items: center; gap: 7px; margin: 0; color: #3e536b; font-size: var(--mk-meta); }
.data-partners.is-none { color: var(--muted); }
.data-partners svg { flex: none; width: 13px; height: 13px; }
.data-domain-card > footer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: auto; padding-top: 4px; }
.data-domain-card > footer .text-button, .data-importables .text-button { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.data-domain-card > footer .text-button svg { width: 13px; height: 13px; }
.data-outside { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.data-outside article { display: flex; align-items: center; gap: 12px; min-height: 0; padding: 14px 16px; cursor: pointer; }
.data-outside article:hover { background: #f7fafd; }
.data-outside article.is-warning { background: #fdf6e6; }
.data-outside article > span { display: grid; flex: none; width: 32px; height: 32px; place-items: center; background: var(--soft-surface); border-radius: 9px; color: #24679e; }
.data-outside article > span svg { width: 16px; height: 16px; }
.data-outside article > div { flex: 1; min-width: 0; }
.data-outside strong { display: block; font-size: 13px; }
.data-outside small { display: block; margin-top: 2px; color: var(--muted); font-size: var(--mk-meta); line-height: 1.45; }
.data-outside article > svg { flex: none; width: 16px; color: #b6c6d6; }

/* --- Listes de panneaux -------------------------------------------------------- */
/* Même correction que Finance et Admin : sans `minmax(0, 1fr)`, une ligne
   longue élargit la colonne et pousse son bouton hors du panneau. */
.data-recent, .data-exchanges, .data-importables, .data-relation-list { grid-template-columns: minmax(0, 1fr); }
.data-importables article > button { flex: none; }
.data-controls .text-button { display: inline-flex; align-items: center; gap: 5px; }
.data-controls .text-button svg { width: 13px; height: 13px; }
.data-recent article > span:first-child, .data-exchanges article > span:first-child,
.data-importables article > span:first-child, .data-relation-list article > span:first-child {
  display: grid; flex: none; width: 28px; height: 28px; place-items: center; background: #fff; border-radius: 8px; color: #24679e;
}
.data-recent svg, .data-exchanges svg, .data-importables svg, .data-relation-list svg { width: 14px; height: 14px; }
.data-recent article > div, .data-exchanges article > div, .data-importables article > div, .data-relation-list article > div { flex: 1; }
.data-exchanges article, .data-importables article, .data-relation-list article { cursor: default; }
.data-relation-list strong { white-space: normal; }
.data-relation-list strong .text-button { padding: 0; font-size: 13px; font-weight: 700; }
.data-relation-list strong small { display: inline; margin-left: 4px; font-weight: 500; }
.data-relation-list > article > div > small { white-space: normal; }

/* --- Relations ------------------------------------------------------------------- */
.data-pairs { display: grid; gap: 3px; max-height: 420px; padding: 10px 12px 14px; overflow: auto; }
.data-pair {
  display: grid; grid-template-columns: minmax(170px, 44%) minmax(0, 1fr) 118px; align-items: center; gap: 10px;
  padding: 7px 8px; background: none; border: 0; border-radius: 8px; color: inherit; text-align: left; cursor: pointer;
}
.data-pair:hover, .data-pair.is-active { background: #eef4fb; }
.data-pair > span:first-child { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.data-pair > span:first-child svg { flex: none; width: 12px; height: 12px; color: var(--muted); }
.data-pair small { color: var(--muted); font-size: 10.5px; text-align: right; }
.data-focus-search { display: flex; width: auto; margin: 12px 15px 0; padding: 0 10px; background: var(--surface); border: 1px solid var(--mk-line); border-radius: 10px; }
.data-neighborhood { max-width: 980px; margin: 10px auto 4px; padding: 0 15px; }
.data-neighborhood svg { display: block; width: 100%; height: auto; }
.data-neighborhood path { fill: none; stroke: #b9cbe0; stroke-width: 1.5; }
.data-node { cursor: pointer; }
.data-node rect { fill: #f3f7fb; stroke: #d5e1ee; stroke-width: 1; }
.data-node:hover rect, .data-node:focus rect { fill: #e3eefa; stroke: #1E88E5; }
.data-node text { fill: #1b2b3c; font-size: 12px; font-weight: 600; }
.data-node.is-center { cursor: default; }
.data-node.is-center rect { fill: #1b2b3c; stroke: #1b2b3c; }
.data-node.is-center text { fill: #fff; font-weight: 700; }
.data-node-caption, .data-node-more { fill: #6c8196; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.data-neighborhood figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.data-neighborhood figcaption .market-tag { border: 0; cursor: pointer; }
.data-neighborhood + .text-button { margin: 0 15px 12px; }

/* --- Qualité ------------------------------------------------------------------------ */
/* Une famille de constats par section. Seules les anomalies portent la couleur
   d'alerte : une dette de module ou une table locale n'est pas une erreur. */
.data-quality-group { margin-bottom: 18px; }
.data-quality-group > header { margin: 0 2px 8px; }
.data-quality-group > header h3 { margin: 0; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: #3e536b; }
.data-quality-group > header p { margin: 3px 0 0; color: var(--muted); font-size: var(--mk-meta); line-height: 1.5; }
.data-quality-none { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; background: #eaf6ef; border-radius: 12px; color: #1f6b45; font-size: var(--mk-body); font-weight: 600; }
.data-quality-none svg { width: 15px; height: 15px; }
.data-quality-item.is-debt > header > span { background: #eef3f8; color: #3e536b; }
.data-quality-item.is-review > header > span { background: #f3f0fb; color: #5b4a9a; }
.finance-attention article.is-ok > span:first-child { color: #1f6b45; }
.data-quality-item { margin-bottom: 12px; padding: 14px 16px; }
.data-quality-item > header { display: flex; align-items: flex-start; gap: 12px; }
.data-quality-item > header > span { display: grid; flex: none; width: 30px; height: 30px; place-items: center; background: var(--soft-surface); border-radius: 9px; color: #24679e; }
.data-quality-item > header svg { width: 15px; height: 15px; }
.data-quality-item.is-critical > header > span { background: #fdeeee; color: #b33d36; }
.data-quality-item.is-warning > header > span { background: #fdf6e6; color: #9a6b09; }
.data-quality-item h3 { margin: 0; font-size: 14px; }
.data-quality-item header p { margin: 3px 0 0; color: var(--muted); font-size: var(--mk-body); }
.data-quality-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; margin-top: 12px; }
.data-quality-tables.is-compact { margin: 0 15px 15px; }
.data-quality-tables button {
  min-width: 0; padding: 8px 10px; background: var(--soft-surface); border: 0; border-radius: 9px; color: inherit; text-align: left; cursor: pointer;
}
.data-quality-tables button:hover { background: #eef4fb; }
.data-quality-tables strong { display: block; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.data-quality-tables small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.data-details { margin: 0 15px 6px; color: #3e536b; font-size: var(--mk-meta); }
.data-details summary { cursor: pointer; font-weight: 650; }
.data-details p { margin: 6px 0 0; line-height: 1.7; }
.data-details .text-button { padding: 0; font-size: var(--mk-meta); }

/* --- Dialogues : fiche, import, export ------------------------------------------ */
.data-record-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; margin: 0 0 14px; }
.data-record-fields dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.data-record-fields dd { margin: 2px 0 0; font-size: 12.5px; overflow-wrap: anywhere; }
.data-record h4, .data-import h4, .data-export h4 { margin: 14px 0 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #3e536b; }
.data-record .market-mini-list { padding: 0; }
.data-mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.data-mapping label { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 7px 9px; background: var(--soft-surface); border-radius: 9px; font-size: 12px; }
.data-mapping label > span { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.data-mapping svg { width: 13px; height: 13px; color: var(--muted); }
.data-mapping select { min-width: 0; }
.data-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.data-mode .is-active { color: #185f9c; background: #eef4fb; border-color: #1E88E5; }
.data-plan { margin-top: 12px; }
.data-plan .syd-kpi-grid { margin-bottom: 10px; }
.data-plan .table-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--mk-line); border-radius: 10px; }
.data-export .data-export-columns { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: 200px; padding: 10px; }
.data-export-rule { display: grid; grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }

@media (max-width: 860px) {
  .market-head-actions :is([data-data-import], [data-data-export], [data-data-edit-catalog]).command-button { width: auto; padding: 0 14px; }
}

@media (max-width: 760px) {
  .data-bar { grid-template-columns: minmax(0, 1fr) 56px; row-gap: 4px; }
  .data-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .data-pair { grid-template-columns: minmax(0, 1fr) auto; }
  .data-pair .data-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .data-domain-card dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-domain-grid, .data-outside { grid-template-columns: 1fr; }
  .data-mapping { grid-template-columns: 1fr; }
  .data-export-rule { grid-template-columns: 1fr; }
}
