/* =========================================================
   AKIWI — APP SHELL & COMPONENTS
   ========================================================= */

/* ---------- App layout : sidebar + subnav + content ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
}
.app--with-subnav { grid-template-columns: var(--sidebar-width) var(--subnav-width) 1fr; }
.app--collapsed   { grid-template-columns: var(--sidebar-width-collapsed) 1fr; }
.app--collapsed.app--with-subnav { grid-template-columns: var(--sidebar-width-collapsed) var(--subnav-width) 1fr; }
.app--collapsed .sidebar__brand {
  font-size: 0;
}
.app--collapsed .sidebar__brand-wordmark { display: none; }
.app--collapsed .sidebar__group-label,
.app--collapsed .nav-item > span,
.app--collapsed .nav-item__chevron,
.app--collapsed .nav-item.nav-item--external > .nav-item__icon:last-child {
  display: none;
}
.app--collapsed .nav-item {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
  gap: 0;
  min-height: 36px;
}
.app--collapsed .nav-item--active::before { left: 0; }
.app--collapsed #nav-superadmin-group > .nav-sub,
.app--collapsed #nav-agent-config-group > .nav-sub { display: none !important; }
.app--collapsed #nav-superadmin-toggle .nav-item__icon {
  display: block;
  flex-shrink: 0;
}

/* Panneau horizontal Superadmin (sidebar réduite) */
.superadmin-flyout {
  position: fixed;
  z-index: calc(var(--z-sticky) + 2);
  top: 0;
  left: var(--sidebar-width-collapsed);
  width: min(280px, calc(100vw - var(--sidebar-width-collapsed) - 8px));
  height: 100vh;
  background: var(--color-bg-subtle);
  border-right: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.superadmin-flyout.hidden { display: none !important; }
.superadmin-flyout__head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-md);
  letter-spacing: var(--tracking-tight);
}
.superadmin-flyout__body { padding: 8px 0 16px; flex: 1; }
.superadmin-flyout__section + .superadmin-flyout__section {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
}
.superadmin-flyout__section-title {
  margin: 0;
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.superadmin-flyout__link {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px;
  width: 100%;
  height: auto !important;
  padding: 8px 16px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--color-text) !important;
  font: inherit !important;
  font-weight: var(--weight-normal, 400) !important;
  text-align: left;
  cursor: pointer;
  box-shadow: none !important;
}
.superadmin-flyout__link:hover,
.superadmin-flyout__link:focus-visible {
  background: var(--color-surface-hover) !important;
  color: var(--color-text) !important;
  outline: none;
}
.superadmin-flyout__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-subtle);
}
.app--collapsed.superadmin-flyout-open .perf-badge {
  left: calc(var(--sidebar-width-collapsed) + 280px + 6px);
}
.app--collapsed .sidebar__footer {
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--color-bg-subtle);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar__brand {
  --sidebar-brand-height: 51px;
  --sidebar-brand-left: 6px;
  height: var(--header-height);
  display: block;
  position: relative;
  padding: 0;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  text-decoration: none;
  color: var(--color-text);
  transition: opacity 0.2s;
}
.sidebar__brand:hover { opacity: 0.88; text-decoration: none; }
.sidebar__brand-mark {
  display: block;
  position: absolute;
  top: 0;
  left: var(--sidebar-brand-left);
  height: var(--sidebar-brand-height);
  width: auto;
  object-fit: contain;
}
.sidebar__brand-wordmark {
  position: absolute;
  top: 50%;
  left: 55px;
  transform: translateY(-50%);
  color: #1C1917;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar__brand-wordmark > span {
  color: #78716C;
  font-weight: 400;
}
.sidebar__search {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
}
.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 8px 20px;
  scroll-padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__group-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  padding: 12px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: background var(--duration-fast);
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text); text-decoration: none; }
.nav-item--active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-sm);
}
.nav-item--active::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--color-primary-600);
}
.nav-item__icon {
  width: 16px; height: 16px; flex-shrink: 0;
  color: var(--color-text-subtle);
  pointer-events: none;
}
.nav-item__chevron,
.nav-item svg {
  pointer-events: none;
}
.nav-item--active .nav-item__icon { color: var(--color-primary-600); }
.nav-item__badge {
  margin-left: auto;
  font-size: var(--text-xs);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}
.nav-item--active .nav-item__badge { background: var(--color-primary-100); color: var(--color-primary-700); }
[data-theme="dark"] .nav-item--active .nav-item__badge { background: rgba(234, 88, 12, 0.20); color: var(--color-primary-300); }

.sidebar__footer {
  border-top: 1px solid var(--color-border);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}
.sidebar__footer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-build-ref {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 500;
  color: var(--color-text-subtle);
  line-height: 1.2;
  padding: 0 2px;
  user-select: all;
  letter-spacing: 0.02em;
}
.app--collapsed .sidebar-build-ref { display: none !important; }
.sidebar__footer .btn { flex-shrink: 0; position: relative; z-index: 1; }
/* Réduit : colonne — toggle en dernier pour rester au même coin (bas-gauche) qu’à l’ouverture */
.app--collapsed .sidebar__footer-toolbar {
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.app--collapsed .sidebar__footer #sidebar-collapse-toggle { order: 99; }
.sidebar__footer .user-chip {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.user-chip:hover { background: var(--color-surface-hover); }
.user-chip__avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
  color: white;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: var(--weight-semibold);
}
.user-chip__name { font-size: var(--text-base); font-weight: var(--weight-medium); line-height: 1.2; }
.user-chip__role { font-size: var(--text-xs); color: var(--color-text-subtle); }
.user-chip--workspace {
  margin-left: auto;
  max-width: min(220px, 34vw);
}
.user-chip__text { line-height: 1.2; min-width: 0; }

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
}
.account-card__title { margin: 0 0 12px; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.account-card--wide { grid-column: 1 / -1; }
.account-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: none;
  width: 100%;
}
.account-page .account-grid { margin: 0; }
.account-logout-top {
  display: inline-flex;
  margin: 6px 0 8px;
  align-self: flex-start;
}
.account-accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  overflow: clip;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.account-accordion__summary {
  min-height: 72px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  transition: background var(--duration-fast), box-shadow var(--duration-fast);
}
.account-accordion__summary::-webkit-details-marker { display: none; }
.account-accordion__summary:hover { background: var(--color-bg-subtle); }
.account-accordion__summary:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: -2px;
}
.account-accordion__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.account-accordion__heading > :is(i, svg) {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: var(--color-primary-50, #fff7ed);
  color: var(--color-primary-600);
  flex-shrink: 0;
}
.account-accordion__heading strong,
.account-accordion__heading small { display: block; }
.account-accordion__heading strong { color: var(--color-text); }
.account-accordion__heading small {
  margin-top: 3px;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.account-accordion__chevron {
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  transition: transform var(--duration-fast), background var(--duration-fast), color var(--duration-fast);
  flex-shrink: 0;
}
.account-accordion[open] {
  border-color: var(--color-primary-200);
  box-shadow: var(--shadow-sm);
}
.account-accordion[open] > .account-accordion__summary {
  background: var(--color-primary-50, #fff7ed);
  border-bottom: 1px solid var(--color-primary-200);
  box-shadow: inset 4px 0 0 var(--color-primary-500);
}
.account-accordion[open] > .account-accordion__summary .account-accordion__heading strong {
  color: var(--color-primary-700);
}
.account-accordion[open] > .account-accordion__summary .account-accordion__chevron {
  transform: rotate(180deg);
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}
.account-accordion__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-subscription-summary { max-width: 560px; }
.account-card--subscription .stat-line {
  display: grid;
  grid-template-columns: minmax(130px, 180px) max-content;
  justify-content: start;
  column-gap: 24px;
}
.account-card--subscription .stat-line b { text-align: left; }
.account-quota-row__explain { margin: 8px 0 0; }
@media (max-width: 600px) {
  .account-accordion__summary { padding: 12px; }
  .account-accordion__heading > :is(i, svg) { width: 32px; height: 32px; padding: 7px; }
  .account-card--subscription .stat-line {
    grid-template-columns: minmax(0, 1fr) max-content;
    column-gap: 12px;
  }
}
.account-agents-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.account-agents-filter .input { width: min(320px, 100%); }
.account-agents-empty { margin: 0; }
.account-agents-archives {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.account-agents-archives > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: var(--weight-semibold);
}
.account-agents-archives > p { margin: 10px 0; }
.account-agents-archives__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-agents-archives__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-subtle);
}
.account-agents-archives__row strong,
.account-agents-archives__row small { display: block; }
.account-agents-archives__row small {
  margin-top: 2px;
  color: var(--color-text-muted);
}
.account-agents-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.account-agents-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.account-agents-group__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}
.account-agents-group__summary::-webkit-details-marker { display: none; }
.account-agents-group__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.account-agents-group__body {
  padding: 0 12px 12px;
}
.account-agents-group__empty {
  margin: 0;
  padding: 4px 2px 8px;
}
.account-agents-group .account-group-delete {
  flex-shrink: 0;
}
.account-agents-warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-warning-border, #f59e0b);
  background: var(--color-warning-bg, rgba(245, 158, 11, 0.08));
}
@media (max-width: 640px) {
  .account-accordion__summary { padding: 12px 14px; }
  .account-accordion__body { padding: 12px; }
  .account-agents-filter {
    align-items: stretch;
    flex-direction: column;
  }
  .account-agents-archives__row { align-items: flex-start; }
}
.account-addon-list { display: flex; flex-direction: column; gap: 10px; }
.account-addon-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.account-addon-row:last-child { border-bottom: none; padding-bottom: 0; }
.account-instances-actions { gap: 10px; }
.account-instances-promo input { margin-top: 4px; }
.account-form { display: flex; flex-direction: column; gap: 10px; }
.account-form label { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }
.account-form__inline { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); margin-bottom: 10px; }
.account-form__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-team {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-team-seats {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-subtle, #f8fafc);
}
.account-team-seats__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--text-sm);
  margin-bottom: 8px;
}
.account-team-seats__bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.account-team-seats__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary-500, #f97316);
}
.account-team-invite {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.account-team-invite__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
}
.account-team-invite label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-sm);
}
.account-team-members__title {
  margin: 0 0 10px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.account-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-team-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.account-team-member__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-team-member__main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-team-member__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.account-team-member__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.account-team-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.account-team--locked {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-subtle, #f8fafc);
}
@media (max-width: 720px) {
  .account-team-invite { align-items: stretch; }
  .account-team-invite__fields { grid-template-columns: 1fr; }
  .account-team-member {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .account-team-member__meta { align-items: flex-start; }
}
.password-field { display: flex; gap: 6px; align-items: center; }
.password-field input { flex: 1; min-width: 0; }
.account-referral-code {
  font-family: ui-monospace, monospace;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  cursor: pointer;
}

/* ---------- SUBNAV (sous-nav contextuelle) ---------- */
.subnav {
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  height: 100vh;
  position: sticky; top: 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.subnav__header {
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--color-border);
}
.subnav__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  display: flex; align-items: center; gap: 8px;
}
.subnav__sub { font-size: var(--text-xs); color: var(--color-text-subtle); margin-top: 2px; }
.subnav__body { padding: 8px; flex: 1; }
.subnav__actions { padding: 10px 12px; border-top: 1px solid var(--color-border); }

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.topbar__breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--text-base);
  color: var(--color-text-muted);
}
.topbar__breadcrumb-current { color: var(--color-text); font-weight: var(--weight-medium); }
.topbar__breadcrumb-sep { color: var(--color-text-disabled); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; pointer-events: none; }

.btn--primary {
  background: var(--color-primary-600);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary-600);
  box-shadow: var(--shadow-xs);
}
.btn--primary:hover { background: var(--color-primary-700); border-color: var(--color-primary-700); color: white; }

.btn--secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover { background: var(--color-surface-hover); border-color: var(--color-text-subtle); color: var(--color-text); }

.btn--ghost { background: transparent; color: var(--color-text-muted); }
.btn--ghost:hover { background: var(--color-bg-subtle); color: var(--color-text); }

.btn--danger { background: var(--color-danger-solid); color: white; border-color: var(--color-danger-solid); }
.btn--danger:hover { background: var(--color-danger-fg); }

.btn--success { background: var(--color-success-solid); color: white; border-color: var(--color-success-solid); }
.btn--success:hover { filter: brightness(0.92); color: white; }

.btn--sm { height: 26px; padding: 4px 9px; font-size: var(--text-sm); }
.btn--sm svg { width: 13px; height: 13px; }
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  cursor: default;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: src-spin 0.65s linear infinite;
}
/* Save params : texte visible + spinner inline (évite le libellé transparent .is-loading) */
.btn.is-saving {
  pointer-events: none;
  cursor: default;
  gap: 8px;
}
.btn-inline-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: src-spin 0.65s linear infinite;
  flex-shrink: 0;
  vertical-align: -2px;
}
#up-save-btn.btn--success {
  background: var(--color-success-solid, #16a34a) !important;
  border-color: var(--color-success-solid, #16a34a) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}
#up-save-btn.is-saving {
  opacity: 0.95;
}
.btn--lg { height: 38px; padding: 8px 16px; font-size: var(--text-md); }
.btn--lg svg { width: 16px; height: 16px; }

.btn--icon { width: 30px; padding: 0; }
.btn--icon.btn--sm { width: 26px; }
.btn--icon.btn--lg { width: 38px; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); margin-left: 0; }
.btn-group .btn:last-child  { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }

/* ---------- INPUTS ---------- */
.input, .textarea, .select {
  width: 100%;
  height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-disabled); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--color-primary-600);
  box-shadow: var(--shadow-focus);
}
.textarea { height: auto; min-height: 72px; padding: 8px 10px; line-height: var(--leading-base); resize: vertical; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  display: flex; align-items: center; gap: 6px;
}
.field__hint { font-size: var(--text-sm); color: var(--color-text-subtle); }
.field__error { font-size: var(--text-sm); color: var(--color-danger-fg); }

.input-group {
  display: flex; align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 0 8px;
  height: 32px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.input-group:focus-within { border-color: var(--color-primary-600); box-shadow: var(--shadow-focus); }
.input-group svg { width: 14px; height: 14px; color: var(--color-text-subtle); flex-shrink: 0; }
.input-group .input { flex: 1; min-width: 0; border: none; padding: 0 6px; height: auto; background: transparent; box-shadow: none !important; }
.input-group .input:focus { box-shadow: none; }
.input-group__toggle {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; margin: 0 -2px 0 2px;
  border: none; background: transparent; color: var(--color-text-subtle);
  border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0;
}
.input-group__toggle:hover { color: var(--color-text); background: var(--color-bg-subtle); }
.input-group__toggle svg { width: 14px; height: 14px; }

.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--color-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  line-height: 1;
}

/* ---------- BADGES & TAGS ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--color-neutral-bg);
  color: var(--color-neutral-fg);
  border: 1px solid var(--color-neutral-border);
  line-height: 1.4;
  white-space: nowrap;
}
.badge--success { background: var(--color-success-bg); color: var(--color-success-fg); border-color: var(--color-success-border); }
.badge--info    { background: var(--color-info-bg);    color: var(--color-info-fg);    border-color: var(--color-info-border); }
.badge--warn    { background: var(--color-warn-bg);    color: var(--color-warn-fg);    border-color: var(--color-warn-border); }
.badge--danger  { background: var(--color-danger-bg);  color: var(--color-danger-fg);  border-color: var(--color-danger-border); }
.badge--muted   { background: var(--color-neutral-bg); color: var(--color-text-muted); border-color: var(--color-border); }
.badge--primary { background: var(--color-primary-100); color: var(--color-primary-700); border-color: var(--color-primary-200); }
[data-theme="dark"] .badge--primary { background: rgba(234, 88, 12, 0.16); color: var(--color-primary-300); border-color: rgba(234, 88, 12, 0.30); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* Prospection — indicateur chatbot détecté */
.prospect-detect-mark {
  color: var(--color-success-fg, #15803d);
  font-size: 1.1em;
  line-height: 1;
  vertical-align: middle;
}
.prospect-domain--detected { font-weight: 600; }
.prospect-row--detected { background: var(--color-success-bg, #f0fdf4); }
.prospect-detect-badge { display: inline-flex; align-items: center; gap: 4px; }
[data-theme="dark"] .prospect-row--detected { background: rgba(34, 197, 94, 0.08); }

/* Prospection — liste signatures scrollable */
.prospect-summary-link {
  cursor: pointer;
  border: 1px solid var(--color-border);
  font: inherit;
}
.prospect-summary-link:hover {
  border-color: var(--color-primary-300);
  background: var(--color-primary-50, #fff7ed);
}
.prospect-sig-table-wrap {
  max-height: min(65vh, 720px);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
}
.prospect-sig-table-wrap .data-table { margin: 0; }
.prospect-sig-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
  box-shadow: 0 1px 0 var(--color-border);
}

.prospect-list-filters { margin-bottom: 12px; padding: 12px 14px; }
.prospect-list-filters__row {
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.prospect-list-filters__field {
  margin: 0;
  min-width: 140px;
  flex: 1 1 160px;
}
.prospect-list-filters__field .input { width: 100%; margin-top: 4px; }
.prospect-list-filters__count { margin: 10px 0 0; }

/* Matrice concurrentielle */
.comp-matrix-wrap {
  overflow: auto;
  max-height: min(70vh, 800px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
}
.comp-matrix-table { margin: 0; min-width: max-content; }
.comp-matrix-table th,
.comp-matrix-table td { white-space: nowrap; vertical-align: middle; }
.comp-matrix-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-surface);
  box-shadow: 1px 0 0 var(--color-border);
  min-width: 200px;
  max-width: 280px;
  white-space: normal;
}
.comp-matrix-table thead .comp-matrix-sticky-col { z-index: 3; }
.comp-matrix-vendor-col {
  min-width: 110px;
  max-width: 140px;
  font-size: 0.85rem;
  text-align: center;
  white-space: normal;
}
.comp-matrix-cell { text-align: center; }
.comp-matrix-feature-label { font-weight: 500; font-size: 0.9rem; }
.comp-matrix-yes { color: var(--color-success-fg, #15803d); font-weight: 700; }
.comp-matrix-no { color: var(--color-text-muted); }
.comp-matrix-pricing-row td { white-space: normal; vertical-align: top; font-size: 0.85rem; }
.comp-matrix-table--transposed .comp-matrix-feature-col {
  min-width: 72px;
  max-width: 110px;
  font-size: 0.75rem;
  text-align: center;
  white-space: normal;
  vertical-align: bottom;
  line-height: 1.2;
}
.comp-matrix-vendor-label { font-weight: 600; white-space: normal; }
.comp-matrix-vendor-label__inner { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comp-matrix-row-refresh { flex-shrink: 0; padding: 2px 6px; line-height: 1; }
.comp-matrix-row-refresh--empty { color: var(--color-primary-600, #ea580c); border-color: var(--color-primary-300, #fdba74); }
.comp-matrix-row-refresh--labeled { font-size: 0.75rem; white-space: nowrap; }
.comp-matrix-actions-col { min-width: 88px; text-align: center; vertical-align: middle; }
.comp-matrix-row--loading { opacity: 0.65; pointer-events: none; }
.comp-cell-empty { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comp-matrix-text-col { min-width: 140px; max-width: 220px; font-size: 0.8rem; white-space: normal; }
.comp-matrix-text-cell { white-space: normal; vertical-align: top; max-width: 220px; }
.comp-matrix-row--achatbot { background: var(--color-primary-50, #fff7ed); }
[data-theme="dark"] .comp-matrix-row--achatbot { background: rgba(234, 88, 12, 0.08); }

/* Tags marketing concurrence */
.comp-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.comp-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; line-height: 1.3;
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); cursor: pointer; font-family: inherit;
}
.comp-tag:hover { border-color: var(--color-primary-300); background: var(--color-primary-50, #fff7ed); }
.comp-tag--active { border-color: var(--color-primary-500); background: var(--color-primary-100); font-weight: 600; }
.comp-tag--usp { border-color: #93c5fd; }
.comp-tag--positioning { border-color: #c4b5fd; }
.comp-tag--target { border-color: #86efac; }
.comp-tag-count { opacity: 0.65; font-size: 0.65rem; }
.comp-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.comp-tag--cloud { font-size: 0.75rem; }
.comp-toolbar { border: 1px solid var(--color-border); border-radius: var(--radius-md, 8px); }
.comp-active-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.comp-matrix-score-col { text-align: center; min-width: 48px; font-size: 0.8rem; font-weight: 600; }
.comp-score { color: var(--color-primary-600, #ea580c); }
.comp-cell--gap-miss { color: #dc2626 !important; }
.comp-cell--gap-extra { color: #2563eb !important; }
.comp-matrix-sim-col { text-align: center; min-width: 52px; font-size: 0.78rem; }
.comp-sim { color: var(--color-text-muted); font-weight: 500; }
.comp-sim--overall { color: var(--color-primary-600, #ea580c); font-weight: 700; }

/* Matrice — vue plein écran dédiée (portail body) */
body.comp-matrix-fullscreen-active { overflow: hidden; }
.comp-matrix-fs {
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
}
.comp-matrix-fs.hidden { display: none !important; }
.comp-matrix-fs__shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 12px 16px 16px;
  box-sizing: border-box;
}
.comp-matrix-fs__head {
  flex-shrink: 0;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}
.comp-matrix-fs__title { margin: 0; font-size: 1.15rem; }
.comp-matrix-fs__sub { margin: 4px 0 0; }
.comp-matrix-fs__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.comp-matrix-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.comp-matrix-fs .comp-matrix-workspace .comp-toolbar { flex-shrink: 0; }
.comp-matrix-fs .comp-matrix-workspace #comp-matrix-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.comp-matrix-fs .comp-matrix-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}
.comp-legend .comp-matrix-yes { margin: 0 2px; }

.comp-col-head {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  max-width: 100%;
}
.comp-col-head__label { line-height: 1.2; }
.comp-col-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  min-width: 0;
  padding: 0;
  margin: 0 0 1px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--color-text-muted);
  opacity: 0.38;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}
.comp-col-head-btn:hover {
  opacity: 0.72;
  color: var(--color-text);
  background: none;
}
.comp-col-head-btn--active {
  opacity: 1;
  color: var(--color-text);
  background: none;
}
.comp-col-head-btn--active .comp-col-head-icon { stroke-width: 2.25; }
.comp-col-head-icon {
  width: 11px;
  height: 11px;
  display: block;
}
.comp-matrix-table--transposed thead th {
  vertical-align: bottom;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 10px;
}
.card__title { font-size: var(--text-md); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); }
.card__sub { font-size: var(--text-sm); color: var(--color-text-subtle); }
.card__body { padding: 16px; }
.card__footer { padding: 12px 16px; border-top: 1px solid var(--color-border); background: var(--color-bg-subtle); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Metric / KPI card */
.metric { padding: 16px; }
.metric__label { font-size: var(--text-sm); color: var(--color-text-muted); display: flex; align-items: center; gap: 6px; }
.metric__value { font-size: var(--text-3xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric__delta { font-size: var(--text-sm); font-weight: var(--weight-medium); display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
.metric__delta--up   { color: var(--color-success-fg); }
.metric__delta--down { color: var(--color-danger-fg); }

/* ---------- TABLES ---------- */
.table-wrap { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
.table thead th {
  text-align: left;
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-bg-subtle);
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-surface-hover); }
.table tbody tr[data-selected="true"] { background: var(--color-primary-50); }
[data-theme="dark"] .table tbody tr[data-selected="true"] { background: rgba(234, 88, 12, 0.10); }
.table td.col-actions { text-align: right; }
.table td.col-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- TABS ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--color-border);
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--color-text); }
.tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-primary-600); }
.tab svg { width: 14px; height: 14px; }
.tab__count {
  font-size: var(--text-xs); padding: 1px 6px; border-radius: 999px;
  background: var(--color-bg-subtle); color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab__count { background: var(--color-primary-100); color: var(--color-primary-700); }
[data-theme="dark"] .tab[aria-selected="true"] .tab__count { background: rgba(234, 88, 12, 0.18); color: var(--color-primary-300); }

/* Pill tabs (alternative) */
.pill-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--color-bg-subtle); border-radius: var(--radius-md); }
.pill-tab { padding: 5px 11px; border-radius: var(--radius-sm); background: transparent; border: none; cursor: pointer; font-size: var(--text-base); color: var(--color-text-muted); font-weight: var(--weight-medium); display: inline-flex; align-items: center; gap: 6px; }
.pill-tab[aria-selected="true"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xs); }
.pill-tab svg { width: 13px; height: 13px; }

/* ---------- TREE (Notion-style) ---------- */
.tree { display: flex; flex-direction: column; gap: 1px; }
.tree-item {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--color-text);
  cursor: pointer;
  min-height: 26px;
}
.tree-item:hover { background: var(--color-surface-hover); }
.tree-item[aria-current="page"] { background: var(--color-primary-50); color: var(--color-primary-700); font-weight: var(--weight-medium); }
[data-theme="dark"] .tree-item[aria-current="page"] { background: rgba(234, 88, 12, 0.12); color: var(--color-primary-300); }
.tree-chevron { width: 16px; height: 16px; display: grid; place-items: center; color: var(--color-text-subtle); border-radius: 3px; flex-shrink: 0; }
.tree-chevron:hover { background: var(--color-bg-subtle); }
.tree-chevron svg { width: 12px; height: 12px; }
.tree-chevron[data-open="true"] svg { transform: rotate(90deg); }
.tree-icon { width: 14px; height: 14px; color: var(--color-text-subtle); flex-shrink: 0; }
.tree-item[aria-current="page"] .tree-icon { color: var(--color-primary-600); }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-actions { display: none; gap: 2px; }
.tree-item:hover .tree-actions { display: inline-flex; }
.tree-actions .btn { height: 20px; width: 20px; padding: 0; }
.tree-children { padding-left: 18px; border-left: 1px solid var(--color-border); margin-left: 11px; }

/* Status icons in tree */
.tree-status {
  width: 6px; height: 6px; border-radius: 999px;
  flex-shrink: 0; margin-right: 2px;
}
.tree-status--online  { background: var(--color-success-solid); }
.tree-status--offline { background: var(--color-text-disabled); }
.tree-status--draft   { background: var(--color-warn-solid); }

/* ---------- SCORE RINGS / METER ---------- */
.score-ring {
  --size: 56px;
  --thickness: 6px;
  width: var(--size); height: var(--size);
  border-radius: 999px;
  background:
    conic-gradient(var(--ring-color, var(--color-primary-600)) calc(var(--score, 0) * 1%), var(--color-bg-subtle) 0);
  display: grid; place-items: center;
  position: relative;
}
.score-ring::after {
  content: "";
  position: absolute;
  inset: var(--thickness);
  border-radius: 999px;
  background: var(--color-surface);
}
.score-ring__value {
  position: relative;
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- ALERTS / BANNERS ---------- */
.alert {
  display: flex; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-info-border);
  background: var(--color-info-bg);
  color: var(--color-info-fg);
  font-size: var(--text-base);
  align-items: flex-start;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert--warn   { background: var(--color-warn-bg);    color: var(--color-warn-fg);    border-color: var(--color-warn-border); }
.alert--danger { background: var(--color-danger-bg);  color: var(--color-danger-fg);  border-color: var(--color-danger-border); }
.alert--success{ background: var(--color-success-bg); color: var(--color-success-fg); border-color: var(--color-success-border); }
.alert__title { font-weight: var(--weight-semibold); margin-bottom: 2px; }

/* ---------- BANNIÈRE HAUT DE PAGE (erreur / succès) ---------- */
.dashboard-top-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10100;
  font-size: var(--text-md);
  line-height: 1.45;
  transform: translateY(-110%);
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.dashboard-top-banner.is-open {
  transform: translateY(0);
  animation: dashboard-banner-enter 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes dashboard-banner-enter {
  0% { transform: translateY(-110%); }
  70% { transform: translateY(4px); }
  100% { transform: translateY(0); }
}
.dashboard-top-banner--error {
  background: #ffe4e4;
  border-top: 1px solid #fca5a5;
  color: #7f1d1d;
  box-shadow: 0 2px 8px rgba(127, 29, 29, 0.08);
}
.dashboard-top-banner--error::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #f97316 0%, #ef4444 50%, #c026d3 100%);
}
.dashboard-top-banner--success {
  background: #e4f7ec;
  border-top: 1px solid #86efac;
  color: #14532d;
  box-shadow: 0 2px 8px rgba(20, 83, 45, 0.08);
}
.dashboard-top-banner--success::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #4ade80 0%, #22c55e 50%, #059669 100%);
}
.dashboard-top-banner--warn {
  background: var(--color-warn-bg, #fef3c7);
  border-top: 1px solid var(--color-warn-border, #fcd34d);
  color: var(--color-warn-fg, #78350f);
  box-shadow: 0 2px 8px rgba(120, 53, 15, 0.08);
}
.dashboard-top-banner--warn::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
}
.dashboard-top-banner__spinner {
  display: none;
  flex-shrink: 0;
  line-height: 0;
}
.dashboard-top-banner--loading .dashboard-top-banner__spinner {
  display: grid;
  place-items: center;
}
.dashboard-top-banner--loading .dashboard-top-banner__spinner .inline-spinner {
  width: 20px;
  height: 20px;
  border-width: 3px;
  border-color: rgba(120, 53, 15, 0.25);
  border-top-color: #b45309;
}
.dashboard-top-banner.hidden {
  visibility: hidden;
  pointer-events: none;
}
.dashboard-top-banner__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  max-width: 100%;
}
.dashboard-top-banner__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1.05rem;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
}
.dashboard-top-banner__close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  line-height: 0;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.dashboard-top-banner--error .dashboard-top-banner__close {
  border: 2px solid #7f1d1d;
  color: #7f1d1d;
}
.dashboard-top-banner--error .dashboard-top-banner__close:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(127, 29, 29, 0.35);
}
.dashboard-top-banner--success .dashboard-top-banner__close {
  border: 2px solid #14532d;
  color: #14532d;
  background: #fff;
}
.dashboard-top-banner--success .dashboard-top-banner__close:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(20, 83, 45, 0.35);
}
.dashboard-top-banner--warn .dashboard-top-banner__close {
  border: 2px solid #78350f;
  color: #78350f;
  background: #fff;
}
.dashboard-top-banner--warn .dashboard-top-banner__close:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(120, 53, 15, 0.35);
}
.dashboard-top-banner--loading .dashboard-top-banner__text {
  font-size: 1.15rem;
}
.dashboard-top-banner__close svg { display: block; }
body.dashboard-top-banner-visible {
  padding-top: var(--dashboard-top-banner-height, 48px);
}
[data-theme="dark"] .dashboard-top-banner--error {
  background: #3f1515;
  border-top-color: #7f1d1d;
  color: #fecaca;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .dashboard-top-banner--error .dashboard-top-banner__close {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(254, 202, 202, 0.25);
  color: #fecaca;
}
[data-theme="dark"] .dashboard-top-banner--error .dashboard-top-banner__close:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(254, 202, 202, 0.4);
}
[data-theme="dark"] .dashboard-top-banner--success {
  background: #14291a;
  border-top-color: #166534;
  color: #bbf7d0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .dashboard-top-banner--success .dashboard-top-banner__close {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(187, 247, 208, 0.25);
  color: #bbf7d0;
}
[data-theme="dark"] .dashboard-top-banner--success .dashboard-top-banner__close:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(187, 247, 208, 0.4);
}
[data-theme="dark"] .dashboard-top-banner--warn {
  background: #3a2a08;
  border-top-color: #92400e;
  color: #fde68a;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .dashboard-top-banner--warn .dashboard-top-banner__close {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(253, 230, 138, 0.25);
  color: #fde68a;
}
[data-theme="dark"] .dashboard-top-banner--warn .dashboard-top-banner__close:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(253, 230, 138, 0.4);
}
[data-theme="dark"] .dashboard-top-banner--loading .dashboard-top-banner__spinner .inline-spinner {
  border-color: rgba(253, 230, 138, 0.25);
  border-top-color: #fbbf24;
}

/* ---------- PAGE CONTAINER ---------- */
.page {
  padding: 20px var(--content-gutter, 28px);
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
}
/* Alias conservé (toutes les pages workspace/agent sont déjà pleine largeur) */
.page.page--full,
.page--full {
  max-width: none;
  width: 100%;
  margin: 0;
}
.page__header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page__title-block { flex: 1; min-width: 0; }
.page__title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); line-height: 1.2; }
.page__sub { font-size: var(--text-base); color: var(--color-text-muted); margin-top: 4px; }
.page__actions { display: flex; gap: 8px; align-items: center; }

/* ---------- AVATARS ---------- */
.avatar {
  width: 28px; height: 28px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: white;
  background: var(--color-text-muted);
  flex-shrink: 0;
}
.avatar--sm { width: 22px; height: 22px; font-size: 10px; }
.avatar--lg { width: 36px; height: 36px; font-size: var(--text-base); }
.avatar--xl { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { border: 2px solid var(--color-surface); margin-left: -8px; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ---------- CHECKBOX / RADIO / SWITCH ---------- */
.checkbox {
  width: 16px; height: 16px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox[data-checked="true"] { background: var(--color-primary-600); border-color: var(--color-primary-600); }
.checkbox[data-checked="true"]::after {
  content: ""; width: 8px; height: 5px;
  border-left: 2px solid white; border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
}
.checkbox[data-indeterminate="true"] { background: var(--color-primary-600); border-color: var(--color-primary-600); }
.checkbox[data-indeterminate="true"]::after { content: ""; width: 8px; height: 2px; background: white; }

.switch {
  position: relative;
  width: 30px; height: 18px;
  background: var(--color-border-strong);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-fast);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 999px;
  transition: transform var(--duration-fast);
  box-shadow: var(--shadow-xs);
}
.switch[data-on="true"] { background: var(--color-primary-600); }
.switch[data-on="true"]::after { transform: translateX(12px); }

/* ---------- DIVIDERS ---------- */
.divider { height: 1px; background: var(--color-border); margin: 16px 0; }
.divider--v { width: 1px; height: 100%; background: var(--color-border); }

/* ---------- UTILS ---------- */
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; }
.row.gap-1 { gap: 4px; } .row.gap-2 { gap: 8px; } .row.gap-3 { gap: 12px; } .row.gap-4 { gap: 16px; }
.col { display: flex; flex-direction: column; }
.col.gap-1 { gap: 4px; } .col.gap-2 { gap: 8px; } .col.gap-3 { gap: 12px; } .col.gap-4 { gap: 16px; }
.grow { flex: 1; }
.ml-auto { margin-left: auto; }

/* Section title between groups */
.section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-subtle);
  margin: 24px 0 10px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--color-text-muted);
}
.empty__icon {
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  color: var(--color-text-subtle);
}
.empty__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--color-text); margin-bottom: 4px; }

/* Sparkline mini bars */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 32px; }
.bars__bar { width: 6px; border-radius: 2px 2px 0 0; }
.bars__bar--seo { background: var(--color-seo); }
.bars__bar--geo { background: var(--color-geo); }

/* Quick win row */
.win-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
}
.win-row:last-child { border-bottom: none; }
.win-row__score {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--color-warn-bg);
  color: var(--color-warn-fg);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.win-row__text { flex: 1; font-size: var(--text-base); }
.win-row__tag { font-size: var(--text-xs); color: var(--color-text-subtle); }

/* ---------- Mobile : menu hamburger + sidebar drawer ---------- */
.sidebar-toggle { display: none; flex-shrink: 0; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) - 1);
  background: rgba(0, 0, 0, 0.45);
}

@media (max-width: 900px) {
  :root { --content-gutter: 16px; }

  .app,
  .app--with-subnav,
  .app--collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-toggle { display: inline-flex; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: var(--z-overlay);
    width: min(var(--sidebar-width), 88vw);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }

  .app.app--sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .app.app--sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.console-sidebar-open { overflow: hidden; }

  .workspace-bar {
    padding: 0 12px;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
  }

  .ws-picker { max-width: min(200px, 34vw); }
  .ws-picker--agent { max-width: min(220px, 38vw); }
}

.activity-log-meta {
  margin: 8px 0 0;
  padding: 8px 10px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  border-radius: 6px;
}
.activity-log-row--fail td {
  background: rgba(180, 40, 40, 0.06);
}
.activity-log-embed .table-wrap {
  max-height: 420px;
  overflow: auto;
}

