/* Gabarit de l'admin Kargit (refonte, design_handoff_admin) : en-tête 56 px, barre de gauche 236 px par familles repliables,
   fil d'Ariane + titre + actions en tête de page. Chargé après le <style> de admin.html : il l'emporte à spécificité égale. */

#kg { font-family: Archivo, sans-serif; font-variant-numeric: tabular-nums; --pane-gap: 14px; }
#kg *, #kg *::before, #kg *::after { font-family: inherit; }
#kg .mono, #kg pre, #kg code, #kg .ka-modal-pre { font-family: 'IBM Plex Mono', monospace; }
#kg .ka-modal-pre[style*="font-family:inherit"] { font-family: inherit; }
#kg { display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }

/* ---------- En-tête ---------- */
#kg-header.ka-head { height: 56px; justify-content: flex-start; gap: 18px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 300; }
.ka-brand { display: flex; align-items: center; gap: 9px; width: 196px; flex: 0 0 auto; text-decoration: none; color: var(--ink); }
.ka-brand-logo { height: 26px; width: auto; }
.ka-brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.ka-admin-pill { background: #221E1A; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; }
.ka-ic { width: 17px; height: 17px; flex: 0 0 auto; }

.ka-search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #F8F6F2; color: #8A8178; font-size: 13.5px; }
.ka-search:focus-within { border-color: var(--mint); background: #fff; }
.ka-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13.5px; color: var(--ink); height: 100%; -webkit-appearance: none; appearance: none; }
.ka-search input::placeholder { color: #8A8178; }
.ka-search input::-webkit-search-cancel-button { display: none; }
.ka-search kbd { font: 600 11px Archivo, sans-serif; color: #6F675E; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.ka-search-res { position: absolute; left: 0; right: 0; top: 42px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(34,30,26,.16); max-height: 420px; overflow-y: auto; padding: 6px; z-index: 400; }
.ka-search-res .grp { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: #8A8178; padding: 8px 10px 4px; text-transform: uppercase; }
.ka-search-res button { display: flex; width: 100%; align-items: baseline; gap: 8px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.ka-search-res button:hover, .ka-search-res button.sel { background: #E5F1F3; }
.ka-search-res small { color: #8A8178; font-size: 12px; margin-left: auto; white-space: nowrap; }
.ka-search-res .none { padding: 12px 10px; color: #6F675E; font-size: 13px; }

.ka-head-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.ka-bellwrap { position: relative; }
.ka-bell { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink2); padding: 0; }
.ka-bell:hover { border-color: var(--arrow); color: var(--ink); }
.ka-bell .ka-ic { width: 19px; height: 19px; }
.ka-bell b { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #E01B5D; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; box-sizing: border-box; border: 2px solid #fff; }
.ka-bell-menu { position: absolute; right: 0; top: 46px; width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 12px 32px rgba(34,30,26,.16); padding: 6px; z-index: 400; }
.ka-bell-menu .ttl { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #6F675E; padding: 8px 10px 6px; text-transform: uppercase; }
.ka-bell-menu button { display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--ink); }
.ka-bell-menu button:hover { background: #F8F6F2; }
.ka-bell-menu i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: #2E9E5B; }
.ka-bell-menu i.bad { background: #E01B5D; }
.ka-bell-menu .t { font-size: 13.5px; font-weight: 700; }
.ka-bell-menu .d { font-size: 12px; color: #6F675E; margin-top: 2px; white-space: pre-line; }
.ka-bell-menu .none { padding: 12px 10px; font-size: 13px; color: #6F675E; }
.ka-back { font-size: 13.5px; font-weight: 600; color: var(--mintt); text-decoration: none; white-space: nowrap; }
.ka-back:hover { text-decoration: underline; }
.ka-avatar { width: 34px; height: 34px; border-radius: 50%; background: #0B5C6B; color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; text-transform: uppercase; flex: 0 0 auto; }

/* ---------- Barre de gauche ---------- */
.ka-layout .kg-profile-sidebar.ka-nav { flex: 0 0 236px; width: 236px; box-sizing: border-box; padding: 14px 10px; background: #fff; border-right: 1px solid var(--line); gap: 2px; overflow-y: auto; }
.ka-nav button { font-family: Archivo, sans-serif; }
.ka-nav .ka-nav-home { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: none; font-size: 14px; font-weight: 600; color: #3A342E; cursor: pointer; text-align: left; }
.ka-nav .ka-nav-home:hover { background: #F8F6F2; }
.ka-nav .ka-nav-home.on { background: #E5F1F3; color: #0B5C6B; font-weight: 700; box-shadow: none; }
.ka-fam { display: flex; flex-direction: column; margin-top: 8px; }
.ka-fam-h { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 10px; border: 0; background: none; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: #8A8178; cursor: pointer; text-align: left; }
.ka-fam-h:hover { color: #4E4740; }
.ka-chev { width: 12px; height: 12px; transition: transform .15s; }
.ka-fam.shut .ka-chev { transform: rotate(-90deg); }
.ka-fam.shut .ka-fam-items { display: none; }
.ka-fam-items { display: flex; flex-direction: column; gap: 0; }
.ka-nav .kg-profile-tab { display: flex; align-items: center; gap: 8px; height: 29px; padding: 0 10px 0 14px; border: 0; border-radius: 8px; background: none; font-size: 13.5px; font-weight: 400; color: #3A342E; text-align: left; box-shadow: none; cursor: pointer; width: 100%; box-sizing: border-box; }
.ka-nav .kg-profile-tab:hover { background: #F8F6F2; color: #3A342E; }
.ka-nav .kg-profile-tab.on { background: #E5F1F3; color: #0B5C6B; font-weight: 700; box-shadow: none; }
.ka-nav-spacer { flex: 1; min-height: 12px; }
.ka-nav-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.ka-nav-foot .kg-profile-tab { height: 31px; font-size: 13px; padding-left: 10px; }
/* compteurs à droite des liens : framboise = alerte, orange = à vérifier ; les anciens points de couleur restent pour les volets sans compteur */
/* étoile « pays avec un site Kargit à son adresse » (admin-pays.js) : discrète, devant le nom, ne gêne ni la ligne ni le défilement */
.ka-star { font-style: normal; font-size: .78em; color: #A39A90; margin-right: .32em; vertical-align: .08em; }
.ka-count { margin-left: auto; font-size: 11.5px; font-weight: 700; border-radius: 9px; padding: 1px 7px; color: #fff; background: #E01B5D; }
.ka-count.warn { color: #8A5A07; background: #FCEBC8; }
.ka-nav .wx-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.ka-nav .wx-dot.ok { background: #2E9E5B; }
.ka-nav .wx-dot.bad { background: #E01B5D; }

/* ---------- Contenu et en-tête de page ---------- */
.ka-layout .kg-profile-content { padding: 22px 24px 40px; background: var(--bg); }
.kg-profile-pane { gap: var(--pane-gap); }
.ka-crumb { font-size: 12.5px; color: #8A8178; display: flex; align-items: center; gap: 6px; margin-bottom: -6px; }
.ka-crumb a, .ka-crumb button { border: 0; background: none; padding: 0; color: #8A8178; font: inherit; cursor: pointer; text-decoration: none; }
.ka-crumb a:hover, .ka-crumb button:hover { color: #0B5C6B; text-decoration: underline; }
.ka-pane-head { align-items: center; gap: 12px; }
.ka-pane-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.ka-pane-title .count { display: inline-block; font-size: 12.5px; font-weight: 700; color: #6F675E; background: #EAE5DD; border-radius: 10px; padding: 1px 9px; margin-left: 10px; vertical-align: middle; letter-spacing: 0; }
.ka-pane-title .count:empty { display: none; }
.ka-pane-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Sélecteur Rapides / Lentes de l'en-tête de page */
.ka-seg { display: inline-flex; padding: 3px; background: #EAE5DD; border-radius: 10px; gap: 2px; }
.ka-seg button { border: 0; background: transparent; font: 600 13px Archivo, sans-serif; padding: 5px 12px; border-radius: 8px; color: #6F675E; cursor: pointer; white-space: nowrap; }
.ka-seg button.on { background: #fff; color: #221E1A; font-weight: 700; box-shadow: 0 1px 2px rgba(34,30,26,.14); }
.ka-seg button.on[data-ka-speed="slow"] { color: #0B5C6B; }

/* Sous-onglets (pays, vues d'une page) */
.ka-subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex: 0 0 auto; flex-wrap: wrap; }
.ka-subtabs button { border: 0; background: none; padding: 9px 12px; font: 400 13.5px Archivo, sans-serif; color: #6F675E; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; }
.ka-subtabs button:hover { color: #221E1A; }
.ka-subtabs button.on { font-weight: 700; color: #221E1A; border-bottom-color: #E01B5D; }
.ka-subtabs .n { font-size: 11.5px; font-weight: 700; background: #EAE5DD; color: #6F675E; border-radius: 9px; padding: 0 7px; }

/* Barre de filtres, boutons, tableaux : valeurs de la maquette */
.ka-input, .ka-select { height: 34px; border-radius: 9px; background: #fff; font-size: 13.5px; padding: 0 12px; box-sizing: border-box; }
.ka-filters .ka-input { min-width: 230px; }
.ka-btn { height: 36px; border-radius: 10px; padding: 0 14px; background: #fff; color: #221E1A; border-color: var(--line); font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; }
.ka-btn.primary { background: #E01B5D; border-color: #E01B5D; color: #fff; }
.ka-btn.primary:hover:not(:disabled) { background: #C11550; border-color: #C11550; }
.ka-btn.save, .ka-btn.teal { background: #0B5C6B; border-color: #0B5C6B; color: #fff; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.table-wrap table { font-size: 13.5px; color: #4E4740; }
.table-wrap thead th { background: #F8F6F2; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6F675E; }
.table-wrap tbody td { border-bottom: 1px solid #F1ECE5; }
.table-wrap tbody tr { min-height: 42px; }

@media (max-width: 900px) {
  .ka-brand { width: auto; }
  .ka-search kbd { display: none; }
  .ka-back { display: none; }
}

/* ---------- Panneau de détail à droite ---------- */
.ka-panel { flex: 0 0 380px; width: 380px; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; box-sizing: border-box; }
.ka-panel.wide { flex-basis: 460px; width: 460px; }
.ka-panel[hidden] { display: none !important; }
.ka-panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid #EDE8E1; }
.ka-panel-logo img { width: 34px; height: 34px; border-radius: 50%; object-fit: contain; border: 1px solid var(--line); background: #fff; display: block; }
.ka-panel-ttl { flex: 1; min-width: 0; }
.ka-panel-ttl h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ka-panel-ttl .sub { font-size: 12.5px; color: #6F675E; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ka-panel-x { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: #6F675E; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ka-panel-x:hover { background: #F4F1EC; color: #221E1A; }
.ka-panel-x svg { width: 16px; height: 16px; }
.ka-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 13px; }
.ka-panel-foot { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid #EDE8E1; }
.ka-pf { display: flex; flex-direction: column; gap: 5px; }
.ka-pl { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: #6F675E; text-transform: uppercase; }
.ka-pf .ka-pv { font-size: 13.5px; color: #221E1A; word-break: break-word; }
.ka-pf input, .ka-pf select, .ka-pf textarea { height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; font-size: 13.5px; background: #fff; box-sizing: border-box; width: 100%; color: #221E1A; }
.ka-pf textarea { height: auto; padding: 10px 12px; resize: vertical; }
.ka-histo { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 11px; background: #F4F1EC; font-size: 12.5px; color: #4E4740; }
.ka-pbtn { height: 38px; border-radius: 10px; padding: 0 16px; font: 700 13.5px Archivo, sans-serif; cursor: pointer; border: 1px solid var(--line); background: #fff; color: #221E1A; }
.ka-pbtn.save { background: #0B5C6B; border-color: #0B5C6B; color: #fff; }
.ka-pbtn.primary { background: #E01B5D; border-color: #E01B5D; color: #fff; }
.ka-pbtn.danger { border: 0; background: none; color: #C1272D; padding: 0 8px; }
.ka-pbtn.left { margin-right: auto; }
.ka-pbtn:disabled { opacity: .5; cursor: default; }
/* ligne sélectionnée d'un tableau : fond #FDEEF3 et filet gauche framboise */
.table-wrap tbody tr.ka-sel { background: #FDEEF3; box-shadow: inset 3px 0 0 #E01B5D; }
.table-wrap tbody tr.clickable, .table-wrap tbody tr[data-open] { cursor: pointer; }
/* étiquettes d'état */
.ka-tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 8px; white-space: nowrap; background: #EAE5DD; color: #6F675E; }
.ka-tag.g { background: #E3F3E9; color: #1F8A4C; } .ka-tag.o { background: #FCEBC8; color: #8A5A07; } .ka-tag.r { background: #FBE3E6; color: #C1272D; } .ka-tag.t { background: #E5F1F3; color: #0B5C6B; }

.ka-tag.p { background: #FDE7EF; color: #B8124A; }
.ka-2l { display: flex; flex-direction: column; min-width: 0; }
.ka-2l b { font-weight: 700; color: #221E1A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ka-sub, .ka-dim { color: #8A8178; }
.ka-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ka-yes { color: #1F8A4C; font-size: 11px; }
.ka-help { font-size: 12px; color: #6F675E; margin-top: 4px; }
.ka-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ka-seg-roles { display: flex; }
.ka-seg-roles button { flex: 1; }
.ka-seg-roles button:disabled { opacity: .5; cursor: default; }
.ka-ov { position: fixed; inset: 0; background: rgba(34,30,26,.45); z-index: 1000; display: grid; place-items: center; padding: 16px; }
.ka-dlg { width: 420px; max-width: 100%; background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 24px 60px rgba(34,30,26,.3); box-sizing: border-box; }
.ka-dlg h4 { margin: 0 0 8px; font-size: 16px; font-weight: 800; color: #221E1A; }
.ka-dlg p { margin: 0 0 16px; font-size: 13.5px; color: #6F675E; line-height: 1.45; }
.ka-dlg-in { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; font-size: 13.5px; box-sizing: border-box; margin-bottom: 16px; }
.ka-dlg-foot { display: flex; justify-content: flex-end; gap: 8px; }
.ka-pbtn.dangerfill { background: #C1272D; border-color: #C1272D; color: #fff; }

/* ---------- Animations légères (29/10/2026, demande de Jérémy : « les petites animations qui vont bien ») ----------
   Courtes (120-240 ms), sans effet sur la mise en page ; coupées pour qui a demandé moins d'animations. */
@keyframes ka-slide-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes ka-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ka-pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ka-drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes ka-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ka-badge-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }

.ka-panel:not([hidden]) { animation: ka-slide-in .22s cubic-bezier(.2,.7,.2,1); }
.ka-ov { animation: ka-fade-in .16s ease-out; }
.ka-dlg { animation: ka-pop-in .2s cubic-bezier(.2,.7,.2,1); }
.ka-bell-menu:not([hidden]), .ka-search-res:not([hidden]) { animation: ka-drop-in .14s ease-out; }
.ka-bell b:not([hidden]) { animation: ka-badge-pop .32s ease-out; }

.ka-nav .kg-profile-tab, .ka-nav .ka-nav-home, .ka-fam-h, .ka-seg button, .ka-subtabs button, .ka-btn, .ka-pbtn,
.ka-bell, .ka-panel-x, .ka-back, .ka-search, .ka-hl, .ka-search-res button, .ka-bell-menu button, .ka-input, .ka-select {
  transition: background-color .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.ka-subtabs button { transition: color .14s ease, border-color .18s ease; }
.ka-btn:active:not(:disabled), .ka-pbtn:active:not(:disabled), .ka-seg button:active { transform: scale(.98); }
.table-wrap tbody tr, .ka-todo, .ka-recap-table tbody tr { transition: background-color .12s ease, box-shadow .12s ease; }
.table-wrap tbody tr[data-open]:hover, .table-wrap tbody tr.clickable:hover, .ka-recap-table tbody tr:hover { background: #F8F6F2; }
.table-wrap tbody tr.ka-sel:hover { background: #FDEEF3; }
.ka-card, .ka-box { transition: box-shadow .18s ease, border-color .18s ease; }
.ka-card:hover, .ka-box:hover { box-shadow: 0 2px 10px rgba(34,30,26,.06); }
.ka-bar i, .sv-bar > span, .ka-camp-progress > span { transition: width .5s cubic-bezier(.2,.7,.2,1); }
.ka-spark span { transform-origin: bottom; animation: ka-grow .5s ease-out both; }
@keyframes ka-grow { from { transform: scaleY(.2); opacity: 0; } to { transform: none; opacity: 1; } }
td.loading, .ka-empty.loading, .ka-pane-desc.loading { animation: ka-pulse 1.2s ease-in-out infinite; }
.kg-profile-pane.on { animation: k-profile-pane-in .22s ease; }

@media (prefers-reduced-motion: reduce) {
  .ka-panel, .ka-ov, .ka-dlg, .ka-bell-menu, .ka-search-res, .ka-bell b, .ka-spark span, td.loading, .kg-profile-pane.on { animation: none !important; }
  #kg * { transition: none !important; }
}

.ka-nav .kg-profile-tab:has(.ka-count) .wx-dot { display: none; }

/* Les boîtes de confirmation sont ajoutées à <body>, hors de #kg : la police est posée ici. */
.ka-ov, .ka-ov * { font-family: Archivo, sans-serif; }

/* ---------- Écrans étroits (<= 760 px) : la barre de gauche devient une bande horizontale défilable (30/10/2026) ----------
   Remplace l'ancienne règle d'avant la refonte (admin.html) qui coinçait le menu groupé dans une boîte de 236 px. Toutes les pages restent atteignables
   (familles à plat, titres de familles masqués), la bande fait toute la largeur. */
@media (max-width: 760px) {
  .ka-layout .kg-profile-sidebar.ka-nav { flex: 0 0 auto; width: 100%; flex-direction: row; align-items: center; gap: 2px; padding: 6px 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); }
  .ka-nav .ka-nav-home, .ka-nav .ka-fam, .ka-nav .ka-nav-foot { flex: 0 0 auto; }
  .ka-nav .ka-fam { flex-direction: row; align-items: center; margin-top: 0; }
  .ka-nav .ka-fam-h, .ka-nav .ka-nav-spacer { display: none; }
  .ka-nav .ka-fam.shut .ka-fam-items, .ka-nav .ka-fam-items { display: flex; flex-direction: row; gap: 2px; }
  .ka-nav .kg-profile-tab, .ka-nav .ka-nav-home { white-space: nowrap; flex: 0 0 auto; width: auto; }
  .ka-nav .ka-nav-foot { border-top: 0; padding-top: 0; margin-top: 0; }
}

/* En-tête étroit (≤ 560 px, 30/10/2026) : la recherche gardait la largeur de son champ (207 px) et poussait la cloche et l'avatar hors de l'écran à 375 px.
   Elle rétrécit maintenant (flex 1, min-width 0), l'en-tête resserre ses marges et le nom « Kargit » laisse la place (logo et pastille ADMIN restent). */
@media (max-width: 560px) {
  #kg-header.ka-head { gap: 10px; padding: 0 12px; }
  .ka-brand { gap: 7px; min-width: 0; }
  .ka-brand-name { display: none; }
  .ka-search { min-width: 0; flex: 1 1 0; }
  .ka-head-right { gap: 8px; flex: 0 0 auto; }
}
