/* Outil Code APE 2027 (/code-ape-2027) : onglets, dépôt de fichier, résultats. Couleurs = tokens de site.css. */
.t-ape .ape-card { background: #fff; border: 1px solid var(--g200); border-radius: var(--r-lg); box-shadow: var(--sh-card); overflow: hidden; }
.t-ape .ape-tabs { display: flex; border-bottom: 1px solid var(--g200); background: var(--g25); }
.t-ape .ape-tabs button { flex: 1; min-height: 56px; border: 0; background: none; font-size: 16px; font-weight: 600; color: var(--g600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0 16px; }
.t-ape .ape-tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); background: #fff; }
.t-ape .ape-pane { padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 16px; }
.t-ape .ape-form { display: flex; gap: 12px; flex-wrap: wrap; }
.t-ape .ape-form input { flex: 1 1 260px; min-height: 52px; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.t-ape label.ape-label { font-weight: 600; font-size: 15px; }
.t-ape .ape-drop { display: block; border: 2px dashed var(--g300); border-radius: var(--r-lg); background: var(--g25); padding: 36px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.t-ape .ape-drop:hover, .t-ape .ape-drop.drag, .t-ape .ape-drop:focus-within { border-color: var(--accent); background: var(--accent-subtle); }
.t-ape .ape-drop b { display: block; font-size: 17px; margin: 8px 0 4px; }
.t-ape .ape-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.t-ape .ape-ou { display: flex; align-items: center; gap: 12px; color: var(--g500); font-size: 14px; }
.t-ape .ape-ou::before, .t-ape .ape-ou::after { content: ""; flex: 1; height: 1px; background: var(--g200); }
.t-ape textarea { min-height: 110px; font-variant-numeric: tabular-nums; resize: vertical; }
.t-ape .ape-msg { font-size: 15px; font-weight: 600; min-height: 1.2em; }
.t-ape .ape-msg-err { color: var(--danger-fg); }
.t-ape .ape-attente { color: var(--g600); font-weight: 600; }

/* Résultat unitaire */
.t-ape .ape-res { border: 1px solid var(--g200); border-radius: var(--r-md); padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #fff; }
.t-ape .ape-res-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.t-ape .ape-res-head > div { display: flex; flex-direction: column; gap: 2px; }
.t-ape .ape-nom { font-size: 19px; }
.t-ape .ape-codes { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.t-ape .ape-code { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--g200); border-radius: var(--r-md); background: var(--g25); }
.t-ape .ape-code b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.t-ape .ape-code span:last-child { font-size: 15px; color: var(--g600); }
.t-ape .ape-code-new { background: var(--accent-subtle); border-color: #BFD6FF; }
.t-ape .ape-fleche { display: flex; align-items: center; font-size: 22px; color: var(--g400); }
.t-ape .ape-explique { font-size: 16px; color: var(--g800); }
.t-ape .ape-options { background: var(--peach-soft); border: 1px solid var(--peach-line); border-radius: var(--r-md); padding: 14px 16px; }
.t-ape .ape-options-titre { font-weight: 600; margin-bottom: 8px; }
.t-ape .ape-options ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.t-ape .ape-options li { font-size: 15px; }
.t-ape .ape-retenu > b { color: var(--accent); }
.t-ape .ape-contenu { display: block; color: var(--g600); font-size: 14px; margin-top: 2px; }
.t-ape .ape-tag { display: inline-block; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-subtle); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.t-ape .ape-liens { font-size: 15px; }

/* Pastilles de statut */
.ape-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.ape-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.ape-ok { background: var(--ok-bg); color: var(--ok-fg); }
.ape-warn { background: var(--warn-bg); color: var(--warn-fg); }
.ape-danger { background: var(--danger-bg); color: var(--danger-fg); }
.ape-neutre { background: var(--g100); color: var(--g600); }

/* Résultats en masse */
.t-ape .ape-lot { display: flex; flex-direction: column; gap: 16px; }
.t-ape .ape-prog { height: 8px; border-radius: 999px; background: var(--g100); overflow: hidden; }
.t-ape .ape-prog > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.t-ape .ape-lot-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.t-ape .ape-filtres { display: flex; gap: 8px; flex-wrap: wrap; }
.t-ape .ape-filtre { min-height: 36px; padding: 0 12px; border: 1px solid var(--g200); border-radius: 999px; background: #fff; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink); }
.t-ape .ape-filtre b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.t-ape .ape-filtre.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.t-ape .ape-table-wrap { overflow-x: auto; border: 1px solid var(--g200); border-radius: var(--r-md); }
.t-ape table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 720px; }
.t-ape th { text-align: left; font-size: 14px; font-weight: 600; color: var(--g600); background: var(--g25); padding: 10px 12px; border-bottom: 1px solid var(--g200); }
.t-ape td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.t-ape td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-ape .ape-lib { display: block; font-size: 14px; color: var(--g600); }
.t-ape .ape-voir { min-height: 36px; padding: 0 12px; border: 1px solid var(--g200); border-radius: var(--r-sm); background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.t-ape .ape-voir:hover, .t-ape .ape-voir[aria-expanded=true] { border-color: var(--accent); color: var(--accent); }
.t-ape tr.ape-det > td { background: var(--g25); padding: 16px 20px; }
.t-ape tr.ape-det > td > * + * { margin-top: 12px; }
.t-ape .ape-confid { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--g600); }
.t-ape .ape-confid svg { flex: none; margin-top: 2px; }

/* Légende des statuts (section « Lire le résultat ») */
.ape-legende { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.ape-legende .card { gap: 10px; padding: 22px; }
.ape-legende .ape-badge { align-self: flex-start; }

@media (max-width: 640px) {
  .t-ape .ape-codes { grid-template-columns: 1fr; }
  .t-ape .ape-fleche { justify-content: center; transform: rotate(90deg); }
  .t-ape .ape-tabs button { font-size: 15px; padding: 0 8px; }
}

/* Alerte d'échéance et texte réservé aux lecteurs d'écran */
.t-ape .alert-reform { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-bg); border: 1px solid var(--peach-line); border-left: 4px solid var(--warn-fg); border-radius: var(--r-md); padding: 14px 18px; }
.t-ape .alert-reform p { font-size: 15px; color: var(--g800); }
.t-ape .alert-reform a { color: var(--warn-fg); font-weight: 600; text-decoration: underline; }
.t-ape .ape-btn-sec { background: #fff; border-color: var(--g200); color: var(--ink); }
.t-ape .ape-btn-sec:hover { border-color: var(--accent); color: var(--accent); }
.t-ape .btn:disabled { opacity: .45; cursor: not-allowed; }
.ape-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Attente pendant les appels au répertoire Sirene */
.t-ape .ape-spin { display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--g200); border-top-color: var(--accent); border-radius: 50%; animation: ape-tourne .8s linear infinite; }
@keyframes ape-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .t-ape .ape-spin { animation-duration: 2.4s; } }
.t-ape #apeBarreTxt { font-weight: 600; color: var(--g800); }
