/* =============================================================================
   Kivo — Extensions maquette (itération « organisations + Copilote »)
   Ajouts non destructifs : tag de type d'org, menu de switch, Copilote (violet),
   modale de création d'org. Couleurs explicites pour rester lisibles sur le thème.
   ============================================================================= */

/* ---- Tag de type d'organisation (Perso / Business) ---- */
.org-type-tag {
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.org-type-tag--business { color: #67e8f9; background: rgba(6,182,212,.12); border-color: rgba(6,182,212,.35); }
.org-type-tag--perso { color: #fcd34d; background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.35); }
.org-switch__logo--business { box-shadow: inset 0 0 0 2px rgba(6,182,212,.45); }
.org-switch__logo--perso { box-shadow: inset 0 0 0 2px rgba(245,158,11,.5); }
.org-switch { gap: 8px; }

/* ---- Menu déroulant de switch d'organisation ---- */
.org-pop {
  position: fixed; z-index: 2147483600; min-width: 280px;
  background: #0f172a; border: 1px solid rgba(148,163,184,.18);
  border-radius: 14px; padding: 6px; box-shadow: 0 18px 50px rgba(2,6,16,.55);
}
.org-pop__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: 10px; color: #e2e8f0; font: inherit;
}
.org-pop__item:hover { background: rgba(148,163,184,.10); }
.org-pop__item svg { width: 16px; height: 16px; }
.org-pop__meta { display: flex; align-items: center; gap: 8px; flex: 1; }
.org-pop__name { font-weight: 600; font-size: 13.5px; }
.org-pop__add { color: #67e8f9; font-weight: 600; }
.org-pop .divider { margin: 6px 4px; }

/* ---- Modale : choix du type d'organisation ---- */
.org-type-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.org-type-choice {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: 12px; cursor: pointer; font: inherit; color: #e2e8f0;
  background: #1e293b; border: 1.5px solid rgba(148,163,184,.18);
}
.org-type-choice svg { width: 20px; height: 20px; margin-top: 2px; color: #94a3b8; flex: none; }
.org-type-choice__txt { display: flex; flex-direction: column; gap: 2px; }
.org-type-choice:hover { border-color: rgba(148,163,184,.4); }
.org-type-choice.is-active { border-color: #06b6d4; background: rgba(6,182,212,.10); }
.org-type-choice.is-active svg { color: #22d3ee; }

/* ---- Bouton Copilote (topbar) — accent VIOLET pour le distinguer du produit ---- */
.copilot-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 7px 12px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 13px;
  color: #fff; border: none;
  background: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 100%);
  box-shadow: 0 4px 14px rgba(139,92,246,.35);
}
.copilot-btn:hover { filter: brightness(1.08); }
.copilot-btn svg { width: 16px; height: 16px; }
@media (max-width: 720px) { .copilot-btn__label { display: none; } .copilot-btn { padding: 7px; } }

/* ---- Panneau Copilote (dans le drawer) ---- */
.copilot { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.copilot__intro {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; border-radius: 12px;
  background: rgba(139,92,246,.10); border: 1px solid rgba(139,92,246,.30);
}
.copilot__avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6);
}
.copilot__avatar svg { width: 18px; height: 18px; }
.copilot__thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; }
.copilot-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.copilot-msg--ai { align-self: flex-start; background: #1e293b; color: #e2e8f0; border-bottom-left-radius: 4px; }
.copilot-msg--me { align-self: flex-end; background: linear-gradient(135deg, #6d28d9, #8b5cf6); color: #fff; border-bottom-right-radius: 4px; }
.copilot__input { display: flex; gap: 8px; align-items: center; padding-top: 8px; border-top: 1px solid rgba(148,163,184,.15); }

/* ---- Champs de formulaire (sécurité si non stylés par ailleurs) ---- */
.input {
  background: #1e293b; color: #e2e8f0; border: 1px solid rgba(148,163,184,.22);
  border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13.5px;
}
.input:focus { outline: none; border-color: #38bdf8; }
.field__label { font-size: 12px; color: #94a3b8; display: block; }

/* ---- Écran Profil & compte (Lot 1 refonte) ---- */
.profile-wrap { max-width: 1040px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-avatar {
  width: 52px; height: 52px; flex: none; border-radius: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px;
  background: linear-gradient(135deg, #0b1f3a, #06b6d4);
}
.profile-name { font-size: 20px; margin: 0; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.profile-card { display: flex; flex-direction: column; gap: 10px; }
.profile-card--wide { grid-column: 1 / -1; }
.profile-card__title { font-size: 15px; margin: 0; }
.profile-field { display: flex; flex-direction: column; gap: 4px; }
.profile-orgs { display: flex; flex-direction: column; gap: 8px; }
.profile-org {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 12px; background: #1e293b; border: 1px solid rgba(148,163,184,.14);
}
.profile-org__name { font-weight: 600; font-size: 13.5px; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }

/* ---- Écran Agent (Lot 2 refonte) ---- */
.agent-wrap { max-width: 1040px; }
.agent-title { font-size: 20px; margin: 0 0 2px; }
.agent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 14px; }
.agent-card { display: flex; flex-direction: column; gap: 10px; }
.agent-card--wide { grid-column: 1 / -1; }
.agent-card__title { font-size: 15px; margin: 0; }
.chan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chan-card { display: flex; flex-direction: column; }
.chan-card__head { display: flex; align-items: center; gap: 8px; }
.chan-card__icon { display: inline-flex; color: #67e8f9; }
.chan-card__icon svg { width: 18px; height: 18px; }
.chan-card__label { font-weight: 600; font-size: 14px; }
.chan-status { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.chan-status--on { color: #6ee7b7; background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.35); }
.chan-status--todo { color: #94a3b8; background: rgba(148,163,184,.10); border: 1px solid rgba(148,163,184,.25); }
.email-addr { display: flex; align-items: center; gap: 0; }
.email-addr .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.email-suffix { padding: 9px 11px; font-size: 13px; color: #94a3b8; background: #16202e; border: 1px solid rgba(148,163,184,.22); border-left: none; border-radius: 0 10px 10px 0; white-space: nowrap; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.seg { display: inline-flex; background: #16202e; border: 1px solid rgba(148,163,184,.18); border-radius: 10px; padding: 3px; gap: 3px; }
.seg__btn { background: transparent; border: none; color: #94a3b8; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.seg__btn.is-active { background: #06b6d4; color: #04222b; }
@media (max-width: 860px) { .agent-grid, .chan-grid { grid-template-columns: 1fr; } }

/* ---- Centre de contrôle / Accueil (Lot 3 ergonomie) ---- */
.ctl-wrap { max-width: 1080px; }
.ctl-title { font-size: 22px; margin: 0 0 2px; }
.ctl-mode { display: inline-block; margin-top: 10px; }
.ctl-subtitle { font-size: 14px; color: #94a3b8; margin: 22px 0 10px; }
.ctl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.ctl-tile { display: flex; flex-direction: column; gap: 10px; min-height: 124px; }
.ctl-tile__head { display: flex; align-items: center; gap: 8px; }
.ctl-tile__icon { display: inline-flex; color: #67e8f9; }
.ctl-tile__icon svg { width: 18px; height: 18px; }
.ctl-tile__label { font-weight: 600; font-size: 13.5px; }
.ctl-tile__state { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ctl-tile__state.is-ok { color: #6ee7b7; background: rgba(16,185,129,.12); }
.ctl-tile__state.is-warn { color: #fcd34d; background: rgba(245,158,11,.14); }
/* Interrupteur */
.kswitch { width: 48px; height: 27px; border-radius: 999px; border: none; cursor: pointer; position: relative; background: #334155; transition: background .15s; }
.kswitch.is-on { background: #06b6d4; }
.kswitch__dot { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .15s; }
.kswitch.is-on .kswitch__dot { transform: translateX(21px); }
.ctl-chans { display: flex; flex-wrap: wrap; gap: 6px; }
.ctl-prog { height: 7px; border-radius: 999px; background: #334155; overflow: hidden; }
.ctl-prog__fill { height: 100%; background: linear-gradient(90deg, #0891b2, #06b6d4); }
.ctl-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.ctl-quick__item {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none;
  padding: 18px 10px; border-radius: 14px; color: #e2e8f0; text-align: center; font-size: 13px; font-weight: 600;
  background: #1e293b; border: 1px solid rgba(148,163,184,.14);
}
.ctl-quick__item:hover { border-color: #06b6d4; background: rgba(6,182,212,.08); }
.ctl-quick__item svg { width: 22px; height: 22px; color: #67e8f9; }
@media (max-width: 980px) { .ctl-grid { grid-template-columns: 1fr 1fr; } .ctl-quick { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .ctl-grid, .ctl-quick { grid-template-columns: 1fr 1fr; } }

/* ---- Header de contrôle compact (en haut du Tableau de bord) ---- */
.dash-cbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 18px; margin-bottom: 16px; padding: 8px 12px;
  background: #131c2b; border: 1px solid rgba(148,163,184,.14); border-radius: 12px;
}
.dash-cbar__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.cbar-ctl { display: inline-flex; align-items: center; gap: 7px; }
.cbar-ctl__label { font-size: 11.5px; font-weight: 600; color: #94a3b8; }
.kswitch--sm { width: 38px; height: 22px; }
.kswitch--sm .kswitch__dot { width: 16px; height: 16px; }
.kswitch--sm.is-on .kswitch__dot { transform: translateX(16px); }
.seg--mini { padding: 2px; }
.seg--mini .seg__btn { padding: 4px 8px; font-size: 11.5px; }
.dash-cbar__shortcuts { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.sc-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 600; color: #cbd5e1; padding: 6px 10px; border-radius: 999px;
  background: #1e293b; border: 1px solid rgba(148,163,184,.18);
}
.sc-chip:hover { border-color: #06b6d4; color: #e2e8f0; }
.sc-chip svg { width: 13px; height: 13px; color: #67e8f9; }
.sc-chip--add { color: #67e8f9; border-style: dashed; }
.sc-manage { display: flex; flex-direction: column; gap: 6px; }
.sc-manage__row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #1e293b; }
.sc-manage__name { font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.sc-manage__name svg { width: 13px; height: 13px; }
.sc-manage__t { margin-left: auto; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pages PLEIN ÉCRAN (content--full : padding 0) — on NE TOUCHE PAS au conteneur
   (les écrans plein écran comptent dessus). On enveloppe le header dans .cbar-host
   et c'est CE wrapper qui porte l'espacement, uniquement sur ces pages. */
.content--full .cbar-host { padding: var(--sp-5) var(--sp-6) 0; }

/* Scénarios + Inbox : alignés sur l'ESPACEMENT DU TABLEAU DE BORD (marges latérales +
   largeur max + padding identiques), tout en restant des routes "full". */
.route-scenarios .content__inner,
.route-inbox .content__inner {
  max-width: var(--content-max); margin: 0 auto;
  padding: var(--sp-5) var(--sp-6) var(--sp-10);
}
/* Le conteneur fournit déjà l'espacement → le wrapper du header n'en rajoute pas. */
.route-scenarios .cbar-host,
.route-inbox .cbar-host { padding: 0; }
/* Scénarios : contenu en flux normal (hauteur auto, comme le dashboard). */
.route-scenarios .content__inner { height: auto; }
/* Inbox : DOIT remplir la hauteur → flex colonne, le contenu prend l'espace restant. */
.route-inbox .content__inner { display: flex; flex-direction: column; padding-bottom: var(--sp-6); }
.route-inbox .content__inner > :not(.cbar-host) { flex: 1 1 auto; min-height: 0; }
