/* ─── App shell ───────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ─── Top bar ─────────────────────────────────────────────────────────────── */

#topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 100;
  overflow: visible;
}

#topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 6px;
  margin: 0 -6px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

#topbar-logo:hover {
  background: var(--bg-card-hover);
}

#topbar-logo:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

#topbar-logo svg path { fill: var(--orange); }

#topbar-logo span {
  color: var(--orange);
}

#topbar-search-wrap {
  display: none;
}

#topbar-search {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 7px 12px 7px 36px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
#topbar-search:focus { border-color: var(--border-focus); }
#topbar-search::placeholder { color: var(--text-muted); }

#topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  display: none;
}
#search-dropdown.visible { display: block; }

.search-query-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 10px;
}
.search-query-chip {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.search-query-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.search-dropdown-label {
  padding: 6px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.search-dropdown-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 4px;
  border-top: 1px solid var(--border);
}
.search-dropdown-label-row:first-child,
.search-dropdown-label-row + .search-query-chips:first-child {
  border-top: none;
}
.search-dropdown-label-row .search-dropdown-label {
  padding: 0;
  border-top: none;
}
.search-dropdown-label-row:first-child {
  border-top: none;
}
.search-dropdown-label:first-child {
  border-top: none;
}

.search-dropdown-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
}
.search-dropdown-toolbar:first-child {
  border-top: none;
}

.search-clear-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.search-clear-btn:hover {
  color: var(--orange);
  background: var(--orange-dim);
}

.search-dropdown-hint {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--avatar-placeholder-bg);
}
.search-result-name { font-size: 13px; font-weight: 500; }
.search-result-sub { font-size: 12px; color: var(--text-secondary); }

#topbar-filters {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-session-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.topbar-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}

.topbar-control-kicker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.topbar-select,
.topbar-panel-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 7px 28px 7px 10px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.topbar-select:focus,
.topbar-panel-select:focus {
  border-color: var(--border-focus);
}

.topbar-select--order,
#queue-order-filter {
  min-width: 11.5rem;
  max-width: 13.5rem;
}

.topbar-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.topbar-filters-popover {
  position: relative;
}

.topbar-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.topbar-filters-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.topbar-filters-btn[aria-expanded="true"] {
  border-color: var(--orange);
  background: var(--orange-dim);
  color: var(--orange);
}

.topbar-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.topbar-filters-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 24px));
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 12px;
  contain: layout paint;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.topbar-filters-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.topbar-filters-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topbar-filters-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-filters-reset {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.topbar-filters-reset:hover {
  color: var(--orange);
  background: var(--orange-dim);
}

.topbar-filters-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar-filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar-filter-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.topbar-filter-field--disabled .topbar-filter-label,
.topbar-toggle--disabled {
  opacity: 0.55;
}

.topbar-filter-field--disabled .topbar-panel-select,
.topbar-toggle--disabled input {
  cursor: not-allowed;
}

.topbar-panel-select {
  width: 100%;
  max-width: none;
  font-size: 12px;
  padding: 8px 28px 8px 10px;
}

.topbar-filters-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.topbar-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.topbar-toggle input {
  accent-color: var(--orange);
}

.topbar-filters-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.topbar-filters-session {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--orange-dim);
  border: 1px solid color-mix(in srgb, var(--orange) 25%, transparent);
}

.topbar-filters-session-kicker {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--orange);
}

.topbar-filters-session-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.topbar-filters-session-detail {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.topbar-filters-session--exhausted {
  background: color-mix(in srgb, var(--red, #e74c3c) 12%, var(--bg-card));
  border-color: color-mix(in srgb, var(--red, #e74c3c) 30%, transparent);
}

.topbar-filters-session--exhausted .topbar-filters-session-kicker {
  color: var(--red, #e74c3c);
}

.topbar-session-volume {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.topbar-session-volume-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.topbar-session-volume-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-session-volume-input {
  width: 4.5rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.topbar-session-volume-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.topbar-session-volume-real {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.topbar-session-volume-hint {
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Utilisé par la modale de recherche */
.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--border-focus);
}

#topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  flex-shrink: 0;
}

.topbar-util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.topbar-util-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.user-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  max-width: 140px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* ─── Main layout ─────────────────────────────────────────────────────────── */

#main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Left panel: session list ────────────────────────────────────────────── */

#session-panel {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#session-panel-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#session-panel-header h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#journal-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.journal-counter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  text-align: center;
}
.journal-counter-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.journal-counter-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}
.journal-counter.orange .journal-counter-value { color: var(--orange); }
.journal-counter.green .journal-counter-value { color: var(--green); }
.journal-counter.teal .journal-counter-value { color: var(--teal); }

#session-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.session-list-empty {
  margin: 0;
  padding: 16px 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    padding-left 0.2s ease,
    box-shadow 0.2s ease;
  position: relative;
}

@media (hover: hover) {
  .session-item:hover,
  .session-item:focus-visible {
    background: var(--bg-card-hover);
    padding-left: 18px;
    box-shadow: inset 3px 0 0 var(--orange);
  }
  .session-item:hover .session-item-avatar,
  .session-item:focus-visible .session-item-avatar {
    box-shadow:
      0 0 0 2px var(--orange),
      0 4px 12px rgba(233, 83, 13, 0.35);
  }
  .session-item:hover .session-item-badge,
  .session-item:focus-visible .session-item-badge {
    transform: scale(1.4);
    box-shadow: 0 0 6px currentColor;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .session-item {
    transition:
      background 0.2s ease,
      padding-left 0.2s ease,
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }
  .session-item:hover,
  .session-item:focus-visible {
    transform: translateX(4px);
  }
  .session-item:hover .session-item-avatar,
  .session-item:focus-visible .session-item-avatar {
    transform: scale(1.08);
  }
}

.session-item.active { background: var(--bg-card); }
.session-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--orange);
  border-radius: 0 3px 3px 0;
}

.session-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--avatar-placeholder-bg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.session-item-info { flex: 1; min-width: 0; }
.session-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-item-sub {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.badge-interested { background: var(--green); }
.badge-no-response { background: var(--grey); }
.badge-not-interested { background: var(--red); }
.badge-email { background: var(--teal); }
.badge-pending { background: var(--yellow); }

/* ─── Center panel: contact card ──────────────────────────────────────────── */

#center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* Boot shell : évite le flash des panneaux avant le JS */
html.lb-boot-home #session-panel,
html.lb-boot-home #right-panel,
html.lb-boot-sessions #session-panel,
html.lb-boot-sessions #right-panel {
  display: none;
}

html.lb-boot-home #topbar-filters,
html.lb-boot-sessions #topbar-filters {
  display: none;
}

/* Chrome solo dès le boot (évite le flash gauche → droite de DeepiHub / thème / profil) */
html.lb-boot-home #topbar,
html.lb-boot-sessions #topbar,
html.lb-boot-contact #topbar {
  justify-content: flex-start;
}

html.lb-boot-home #topbar-right,
html.lb-boot-sessions #topbar-right,
html.lb-boot-contact #topbar-right {
  margin-left: auto;
}

html.lb-boot-home #contact-nav-wrap {
  display: none;
}

html.lb-boot-home #home-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

html.lb-boot-home #prospecting-view {
  display: none !important;
}

html.lb-boot-contact #session-panel,
html.lb-boot-contact #right-panel {
  display: none;
}

html.lb-boot-contact #topbar-search-wrap,
html.lb-boot-contact #topbar-filters {
  display: none;
}

html.lb-boot-contact #home-screen,
html.lb-boot-contact #sessions-view,
html.lb-boot-contact #emails-view,
html.lb-boot-contact #import-view {
  display: none !important;
}

html.lb-boot-contact #prospecting-view {
  display: flex !important;
  flex: 1;
}

html.lb-boot-home #center-panel {
  max-width: 100%;
}

html.lb-boot-home .home-inner {
  max-width: 840px;
  margin: 0 auto;
}

/* Hub masqué jusqu'à sync JS (évite flash KPIs / variante / session) */
html.lb-boot-home:not(.home-ready) .home-inner {
  visibility: hidden;
}

html.lb-boot-home:not(.home-ready) #app-footer {
  visibility: hidden;
}

html.lb-boot-home:not(.home-ready) .home-step--active {
  animation: none;
}

/* Variante « Ma journée » — appliquée avant le JS pour éviter le flash des raccourcis */
html[data-home-variant="day"] .home-btn-primary,
html[data-home-variant="day"] .home-user-hint,
html[data-home-variant="day"] #home-resume-btn,
html[data-home-variant="day"] #home-last-session,
html[data-home-variant="day"] #home-hub-beta-tail,
html[data-home-variant="day"] #home-hub-beta {
  display: none !important;
}

html[data-home-variant="day"] .home-actions {
  display: flex !important;
}

html[data-home-variant="day"] #home-hub-day {
  display: block !important;
}

html.lb-boot-sessions #home-screen,
html.lb-boot-sessions #prospecting-view {
  display: none !important;
}

html.lb-boot-sessions #sessions-view,
html.lb-boot-sessions #emails-view,
html.lb-boot-sessions #help-view,
html.lb-boot-sessions #import-view {
  display: flex;
  flex: 1;
}

#main-layout.home-mode #contact-nav-wrap {
  display: none;
}

/* Accueil : pas de panneaux latéraux (session en pause, reprise via l'accueil) */
#main-layout.home-mode.home-mode-solo #session-panel,
#main-layout.home-mode.home-mode-solo #right-panel {
  display: none;
}

#main-layout.home-mode.home-mode-solo #center-panel {
  max-width: 100%;
}

#main-layout.home-mode.home-mode-solo .home-inner {
  max-width: 840px;
  margin: 0 auto;
}

/* Accueil / historique : barre du haut épurée (filtres masqués, recherche visible) */
#app.app-chrome-solo #topbar-filters {
  display: none;
}

#app.app-chrome-solo #topbar {
  justify-content: flex-start;
}

#app.app-chrome-solo #topbar-right {
  margin-left: auto;
}

/* Historique sans session : pas de panneaux latéraux */
#main-layout.sessions-mode.sessions-mode-solo #session-panel,
#main-layout.sessions-mode.sessions-mode-solo #right-panel {
  display: none;
}

/* Récap fin de session : plein écran centré */
#main-layout.recap-mode.recap-mode-solo #session-panel,
#main-layout.recap-mode.recap-mode-solo #right-panel {
  display: none;
}

#main-layout.recap-mode.recap-mode-solo #center-panel {
  max-width: 100%;
}

/* Contact consulté hors session : fiche + collègues, sans panneau session */
#main-layout.contact-solo-mode #session-panel {
  display: none !important;
}

#main-layout.contact-solo-mode #right-panel {
  display: flex !important;
}

#main-layout.contact-solo-mode #right-panel-tabs {
  display: none;
}

#main-layout.contact-solo-mode .panel-section {
  display: none !important;
}

#main-layout.contact-solo-mode #panel-colleagues {
  display: flex !important;
}

#contact-colleagues-section {
  display: none;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

@media (max-width: 1100px) {
  #main-layout.contact-solo-mode #right-panel {
    display: none !important;
  }

  #main-layout.contact-solo-mode #contact-colleagues-section:not([hidden]) {
    display: block;
  }
}

#main-layout.contact-solo-mode #center-panel {
  flex: 1;
  width: 100%;
  max-width: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, var(--orange-dim), transparent 58%),
    var(--bg-base);
}

#main-layout.contact-solo-mode #prospecting-view {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  background: transparent;
}

#main-layout.contact-solo-mode #contact-nav-wrap {
  display: none;
}

#contact-solo-toolbar {
  display: none;
  margin-bottom: 12px;
}

.contact-solo-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#main-layout.contact-solo-mode #contact-solo-toolbar:not([hidden]) {
  display: block;
}

.contact-solo-back-btn,
.contact-solo-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.contact-solo-back-btn:hover,
.contact-solo-edit-btn:hover {
  border-color: var(--orange);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.contact-solo-edit-btn {
  margin-left: auto;
}

.contact-edit-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.contact-edit-dialog[hidden] {
  display: none;
}

.contact-edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.contact-edit-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.contact-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.contact-edit-title {
  margin: 0;
  font-size: 1.1rem;
}

.contact-edit-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.contact-edit-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.contact-edit-context {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.contact-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.contact-edit-field--wide {
  grid-column: span 2;
}

.contact-edit-field--full {
  grid-column: 1 / -1;
}

.contact-edit-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font-size: 0.92rem;
}

.contact-edit-field input:focus {
  outline: none;
  border-color: var(--orange);
}

.contact-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.contact-edit-actions-right {
  display: flex;
  gap: 8px;
}

.contact-edit-btn {
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
}

.contact-edit-btn:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--text-primary);
}

.contact-edit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-edit-btn--primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.contact-edit-btn--primary:hover:not(:disabled) {
  filter: brightness(1.05);
  color: #fff;
}

.contact-edit-btn--danger {
  color: #ef4444;
  border-color: color-mix(in srgb, #ef4444 35%, var(--border));
}

.contact-edit-btn--danger:hover:not(:disabled) {
  border-color: #ef4444;
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 8%, var(--bg-card));
}

#main-layout.contact-solo-mode #btn-prev,
#main-layout.contact-solo-mode #btn-forward,
#main-layout.contact-solo-mode #nav-lead-count {
  display: none;
}

#main-layout.contact-solo-mode #contact-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 16px 28px 24px;
  overflow: hidden;
}

#contact-solo-split,
#contact-solo-profile {
  display: contents;
}

#main-layout.contact-solo-mode #contact-solo-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 28px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

#main-layout.contact-solo-mode #contact-solo-profile {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

#main-layout.contact-solo-mode #contact-activities-section:not([hidden]) {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  border-left: 1px solid var(--border);
  padding-left: 28px;
}

#main-layout.contact-solo-mode #contact-activities-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 1100px) {
  #main-layout.contact-solo-mode #contact-solo-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(240px, 1fr);
    overflow-y: auto;
  }

  #main-layout.contact-solo-mode #contact-solo-profile {
    overflow-y: visible;
    padding-right: 0;
  }

  #main-layout.contact-solo-mode #contact-activities-section:not([hidden]) {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 24px;
    margin-top: 8px;
  }
}

#main-layout.contact-solo-mode #delay-btn,
#main-layout.contact-solo-mode #action-buttons {
  display: none !important;
}

#main-layout.contact-solo-mode #prospecting-view.contact-solo-loading #contact-card > :not(#contact-loading):not(#contact-solo-toolbar) {
  visibility: hidden;
}

@keyframes contact-solo-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

#main-layout.contact-solo-mode #prospecting-view.contact-solo-ready #contact-card {
  animation: contact-solo-in 0.22s ease;
}

#main-layout.sessions-mode.sessions-mode-solo #sessions-view-content {
  max-width: 960px;
}

/* Barre centre (Précédent/Suivant) alignée sur les onglets droite (Collègues…) */
#contact-nav-wrap {
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

#contact-nav,
#right-panel-tabs {
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  flex-shrink: 0;
}

#right-panel-tabs {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

#contact-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.contact-nav-progress {
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--border);
}

.contact-nav-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

#contact-nav-progress-label {
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#contact-nav-progress-count {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 13px;
  transition: all var(--transition);
}
.nav-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--orange);
}
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

#nav-lead-count {
  font-size: 12px;
  color: var(--text-muted);
}

#contact-card {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

#contact-loading {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 0;
  min-height: 280px;
}

.contact-skeleton {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 520px;
  padding: 8px 0;
}

.skeleton-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line-lg { width: 72%; height: 18px; }
.skeleton-line-md { width: 48%; animation-delay: 0.1s; }
.skeleton-line-sm { width: 36%; animation-delay: 0.2s; }

.skeleton-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.skeleton-pill {
  height: 32px;
  width: 88px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
.skeleton-pill:nth-child(2) { animation-delay: 0.15s; width: 96px; }
.skeleton-pill:nth-child(3) { animation-delay: 0.3s; width: 80px; }

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#contact-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
}

/* ─── Right panel ─────────────────────────────────────────────────────────── */

#right-panel {
  width: var(--right-panel-width);
  min-width: var(--right-panel-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#right-panel-tabs {
  display: flex;
  align-items: stretch;
}

.panel-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  box-sizing: border-box;
  transition: all var(--transition);
}
.panel-tab:hover { color: var(--text-primary); }
.panel-tab.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}
.panel-tab-ai-icon {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  paint-order: stroke fill;
}

#right-panel-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-section {
  display: none;
  padding: 14px;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.panel-section.active { display: flex; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  #right-panel { display: none; }
}

@media (max-width: 768px) {
  #session-panel { display: none; }
  #topbar-filters { display: none; }
}

/* ─── App footer (global, vues solo) ──────────────────────────────────────── */

#app-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 12px 20px 16px;
}

.app-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.app-footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.app-footer-brand {
  font-weight: 600;
  color: var(--text-secondary);
}

.app-footer-brand strong {
  color: var(--orange);
  font-weight: 700;
}

.app-footer-dot {
  opacity: 0.45;
  user-select: none;
}

.app-footer-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-footer-link {
  padding: 0;
  border: none;
  background: none;
  font-size: inherit;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

.app-footer-link:hover {
  color: var(--orange);
}

@media (max-width: 480px) {
  #app-footer {
    padding: 8px 16px 10px;
  }

  .app-footer-dot--nav {
    display: none;
  }

  .app-footer-nav {
    flex-basis: 100%;
    justify-content: center;
  }
}
