/* Noxpager — Espace client (layout fixe + modules) */

body.app-shell {
  min-height: 100dvh;
  background: var(--nox-bg);
  overflow-y: auto;
}

/* ─── Topbar ─── */

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 0 0.75rem;
  background: var(--nox-header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--nox-border);
  overflow: visible;
}

.app-topbar__left,
.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: visible;
  flex-shrink: 0;
}

.app-topbar__actions > .locale-switcher,
.app-topbar__actions > .theme-picker,
.app-topbar__actions > .app-topbar__logout {
  flex-shrink: 0;
}

/* Barre identique FR / EN — largeurs fixes */
.app-topbar__actions .locale-switcher--app .locale-switcher__select {
  width: 4.5rem;
  min-width: 4.5rem;
  box-sizing: border-box;
  text-align: left;
}

.app-topbar__actions .theme-picker--app .theme-picker__trigger {
  width: 3.85rem;
  min-width: 3.85rem;
  justify-content: space-between;
  box-sizing: border-box;
  padding: 0 0.45rem;
}

.app-topbar__actions .theme-picker--app .theme-picker__trigger-swatch {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-color: var(--nox-border);
}

.app-topbar__logout {
  height: 42px;
  min-width: 8.75rem;
  padding: 0 0.85rem !important;
  font-size: 0.82rem !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 10px;
  box-sizing: border-box;
  background: var(--nox-surface);
  border: 1px solid var(--nox-border);
  color: var(--nox-text);
}

.app-topbar__logout:hover {
  border-color: var(--nox-cyan);
  color: var(--nox-cyan);
}

.app-topbar__menu {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: var(--nox-surface);
  color: var(--nox-text);
  cursor: pointer;
}

.app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
}

.app-topbar__brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.app-topbar__welcome {
  font-size: 0.78rem;
  color: var(--nox-cyan);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--nox-cyan-dim);
  border-radius: 999px;
  background: var(--nox-welcome-bg);
}

.app-topbar__user {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.app-topbar__name {
  font-size: 0.82rem;
  font-weight: 600;
}

.app-topbar__plan {
  font-size: 0.68rem;
  color: var(--nox-muted);
}

/* ─── Layout ─── */

.app-layout {
  display: flex;
  min-height: 100dvh;
  padding-top: 60px;
}

.app-sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: var(--app-sidebar-width, 252px);
  z-index: 250;
  display: flex;
  flex-direction: column;
  background: var(--nox-sidebar-bg);
  border-right: 1px solid var(--nox-sidebar-border);
  box-shadow: var(--nox-sidebar-shadow);
  overflow: hidden;
  color: var(--nox-sidebar-text, var(--nox-text));
}

.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 60px 0 0;
  z-index: 240;
  background: rgba(3, 5, 8, 0.72);
  backdrop-filter: blur(4px);
}

/* ─── Nav déroulante (style admin) ─── */

.app-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  scrollbar-width: thin;
}

.app-nav__section {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nox-muted);
  padding: 0.45rem 0.5rem 0.2rem;
  opacity: 0.75;
}

.app-nav__item,
.app-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.48rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: none;
  color: var(--nox-sidebar-muted, var(--nox-muted));
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  position: relative;
  user-select: none;
  -webkit-text-fill-color: currentColor;
}

.app-nav__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--nox-nav-indicator);
  border-radius: 0 2px 2px 0;
  transform: scaleY(0);
  transition: transform 0.2s;
}

.app-nav__item:hover,
.app-sidebar__link:hover {
  color: var(--nox-sidebar-text, var(--nox-text));
  background: var(--nox-nav-hover-bg);
  border-color: var(--nox-nav-hover-border);
}

.app-nav__item.is-active,
.app-sidebar__link.is-active {
  color: var(--nox-nav-active-color);
  background: var(--nox-nav-active-bg);
  border-color: var(--nox-nav-active-border);
  font-weight: 600;
}

.app-nav__item.is-active::before {
  transform: scaleY(1);
}

.app-nav__emoji {
  flex-shrink: 0;
  width: 1.35rem;
  text-align: center;
  font-size: 0.95rem;
}

.app-nav__text {
  flex: 1;
  min-width: 0;
}

.app-nav__group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-nav__group > summary {
  list-style: none;
}

.app-nav__group > summary::-webkit-details-marker {
  display: none;
}

.app-nav__item--parent {
  cursor: pointer;
}

.app-nav__chev {
  width: 12px;
  height: 12px;
  margin-left: auto;
  opacity: 0.55;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.app-nav__group[open] .app-nav__chev {
  transform: rotate(180deg);
}

.app-nav__sub {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.15rem 0.65rem;
  margin-left: 0.5rem;
  border-left: 1px solid var(--nox-border);
}

.app-nav__group[open] > .app-nav__sub {
  display: flex !important;
}

.app-nav__sub-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.38rem 0.55rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--nox-sidebar-muted, var(--nox-muted));
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  -webkit-text-fill-color: currentColor;
}

.app-nav__sub-item:hover {
  color: var(--nox-sidebar-text, var(--nox-text));
  background: var(--nox-nav-hover-bg);
}

.app-nav__sub-item.is-active {
  color: var(--nox-nav-active-color);
  background: var(--nox-nav-active-bg);
  font-weight: 600;
}

.app-nav__sub-item.is-locked {
  opacity: 0.72;
}

.app-nav__sub-emoji {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.app-nav__lock {
  margin-left: auto;
  font-size: 0.72rem;
}

.app-nav__badge,
.app-sidebar__badge {
  margin-left: auto;
  display: inline-flex;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #dc2626;
  font-size: 0.62rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

.app-sidebar__link--noxbot {
  margin-bottom: 0.35rem;
  border-color: var(--nox-nav-hover-border);
}

.app-sidebar__link--noxbot.is-open {
  color: var(--nox-nav-active-color);
  background: var(--nox-nav-active-bg);
  border-color: var(--nox-nav-active-border);
}

.app-sidebar__foot {
  margin-top: auto;
  flex-shrink: 0;
  padding: 0.55rem 0.55rem 0.85rem;
  border-top: 1px solid var(--nox-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.app-sidebar__quota {
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  border: 1px solid var(--nox-border);
  background: var(--nox-surface);
}

.app-sidebar__quota-label {
  display: block;
  font-size: 0.68rem;
  color: var(--nox-muted);
  margin-bottom: 0.2rem;
}

.app-sidebar__quota strong {
  font-size: 0.85rem;
  color: var(--nox-text);
}

.app-sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.6rem;
  background: var(--nox-surface);
  border: 1px solid var(--nox-border);
}

.app-sidebar__avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--nox-avatar-gradient);
  color: var(--nox-btn-primary-text, #fff);
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-sidebar__uinfo {
  min-width: 0;
}

.app-sidebar__uname {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--nox-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar__urole {
  font-size: 0.65rem;
  color: var(--nox-role-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-sidebar__logout {
  color: #dc2626 !important;
}

.app-sidebar__logout:hover {
  background: rgba(220, 38, 38, 0.08) !important;
  border-color: rgba(220, 38, 38, 0.2) !important;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--app-sidebar-width, 252px);
}

.app-content {
  min-height: calc(100dvh - 60px);
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem;
}

.app-content--panels {
  position: relative;
}

.app-module-panel[hidden] {
  display: none !important;
}

.app-content--loading {
  opacity: 0.72;
  pointer-events: none;
}

.app-content--loading::before {
  content: '';
  position: fixed;
  top: 60px;
  left: var(--app-sidebar-width, 220px);
  right: 0;
  height: 3px;
  z-index: 40;
  background: linear-gradient(90deg, transparent, var(--nox-cyan), transparent);
  background-size: 200% 100%;
  animation: appModuleBar 1s ease-in-out infinite;
}

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

@media (max-width: 900px) {
  .app-content--loading::before {
    left: 0;
  }
}

/* ─── Loader ─── */

.app-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 320px;
  color: var(--nox-muted);
}

.app-loader__ring {
  width: 42px;
  height: 42px;
  border: 3px solid var(--nox-border);
  border-top-color: var(--nox-cyan);
  border-radius: 50%;
  animation: appSpin 0.75s linear infinite;
}

@keyframes appSpin {
  to { transform: rotate(360deg); }
}

/* ─── Module blocks ─── */

.app-module__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-module__eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nox-cyan);
  margin-bottom: 0.35rem;
}

.app-module__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-module__sub {
  margin-top: 0.35rem;
  color: var(--nox-muted);
  font-size: 0.92rem;
}

.app-pill {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--nox-border);
  border-radius: 999px;
  color: var(--nox-muted);
}

.app-pill--live {
  color: var(--nox-cyan);
  border-color: var(--nox-cyan-dim);
  background: var(--nox-pill-live-bg);
}

.app-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.app-stat-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-stat-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--nox-border);
  border-radius: 14px;
  background: var(--nox-surface);
}

.app-stat-card--accent {
  border-color: rgba(0, 229, 255, 0.25);
  background: linear-gradient(145deg, rgba(0, 229, 255, 0.08), transparent);
}

.app-stat-card__label {
  display: block;
  font-size: 0.72rem;
  color: var(--nox-muted);
  margin-bottom: 0.35rem;
}

.app-stat-card__value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

.app-stat-card__hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.app-panel {
  padding: 1.25rem;
  border: 1px solid var(--nox-border);
  border-radius: 16px;
  background: var(--nox-surface);
}

.app-panel__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.app-panel__note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--nox-muted);
}

.app-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.app-quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 14px;
  background: var(--nox-bg);
  color: var(--nox-text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.app-quick-card:hover {
  border-color: var(--nox-cyan-dim);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.app-stat-card__emoji {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.app-progress {
  margin-top: 0.5rem;
  height: 4px;
  border-radius: 99px;
  background: var(--nox-border);
  overflow: hidden;
}

.app-progress span {
  display: block;
  height: 100%;
  background: var(--nox-cyan);
  border-radius: 99px;
}

.app-quick-card__emoji {
  font-size: 1.5rem;
}

.app-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.app-info-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--nox-muted);
}

.app-panel--info {
  margin-top: 1rem;
}

/* Chat layout */
.app-chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  min-height: 420px;
}

.app-chat-sidebar,
.app-chat-main {
  border: 1px solid var(--nox-border);
  border-radius: 16px;
  background: var(--nox-surface);
  overflow: hidden;
}

.app-chat-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--nox-border);
  font-size: 0.88rem;
}

.app-chat-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--nox-muted);
  font-size: 0.88rem;
}

.app-chat-empty span {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.app-chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 2rem;
  text-align: center;
  color: var(--nox-muted);
}

.app-chat-placeholder__emoji {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.app-chat-placeholder h2 {
  color: var(--nox-text);
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.app-chat-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.app-chat-badges span {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  border: 1px solid var(--nox-border);
  border-radius: 999px;
}

.app-toolbar {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.app-input {
  flex: 1;
  min-width: 160px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: var(--nox-bg);
  color: var(--nox-text);
  font: inherit;
  font-size: 0.88rem;
}

.app-input--select {
  flex: 0 0 auto;
  min-width: 140px;
}

.btn--sm {
  padding: 0.45rem 0.75rem !important;
  font-size: 0.78rem !important;
  min-height: auto !important;
}

.app-quick-card__label {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}

.app-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--nox-muted);
}

.app-empty-state--hero {
  position: relative;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--nox-border);
  border-radius: 18px;
  overflow: hidden;
}

.app-empty-state__glow {
  position: absolute;
  inset: auto 20% -40%;
  height: 180px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.18), transparent 70%);
  pointer-events: none;
}

.app-empty-state__icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.app-empty-state h2 {
  color: var(--nox-text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.app-empty-state p {
  max-width: 420px;
  margin: 0 auto 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.app-locked {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.app-locked__icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.75rem;
}

.app-locked h2 {
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.app-locked p {
  color: var(--nox-muted);
  margin-bottom: 1.25rem;
}

.app-coming-soon {
  max-width: 520px;
  margin: 0 auto;
  padding: 2.25rem 1.75rem;
  text-align: center;
}

.app-coming-soon__icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.85rem;
}

.app-coming-soon__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.app-coming-soon__text {
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--nox-muted);
}

.app-module__hint {
  margin-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--nox-muted, #8b9cb3);
}

.activity-cat {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(139, 156, 179, 0.12);
  color: var(--nox-muted);
}

.activity-cat--login { background: rgba(0, 229, 255, 0.12); color: var(--nox-cyan, #00e5ff); }
.activity-cat--message { background: rgba(124, 92, 255, 0.14); color: #b8a4ff; }
.activity-cat--credit { background: rgba(255, 193, 7, 0.12); color: #ffc107; }
.activity-cat--support { background: rgba(255, 107, 122, 0.12); color: #ff6b7a; }
.activity-cat--security { background: rgba(76, 175, 80, 0.12); color: #81c784; }

.activity-meta {
  font-size: 0.85rem;
  color: var(--nox-muted);
}

.help-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}

.help-shortcut {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--nox-text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.help-shortcut:hover {
  border-color: var(--nox-cyan-dim, rgba(0, 229, 255, 0.35));
  background: rgba(0, 229, 255, 0.04);
}

.help-shortcut__icon { font-size: 1.15rem; }
.help-shortcut__label { font-size: 0.85rem; line-height: 1.3; }

.help-faq { display: flex; flex-direction: column; gap: 0.5rem; }

.help-faq__item {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  overflow: hidden;
}

.help-faq__q {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  list-style: none;
}

.help-faq__q::-webkit-details-marker { display: none; }

.help-faq__chip {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0, 229, 255, 0.1);
  color: var(--nox-cyan, #00e5ff);
}

.help-faq__a {
  padding: 0 1rem 0.85rem;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--nox-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ctrl-summary-card {
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.ctrl-summary-card.glass-card {
  margin-bottom: 1rem;
}

.ctrl-nav-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.ctrl-nav-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--nox-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ctrl-nav-card:hover {
  border-color: var(--nox-cyan-dim);
  background: rgba(0, 229, 255, 0.05);
}

.ctrl-nav-card__icon { font-size: 1.1rem; }

.dash-section__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .app-module__head {
    flex-direction: column;
    align-items: stretch;
  }

  .app-module__head .ctrl-badge {
    align-self: flex-start;
  }

  .dash-section__head--row {
    flex-direction: column;
    align-items: stretch;
  }

  .dash-section__head--row .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-content {
    padding: 1rem 0.85rem 1.5rem;
  }

  .app-module__head {
    margin-bottom: 1.1rem;
  }

  .app-module__title {
    font-size: 1.35rem;
  }

  .ctrl-section,
  .dash-section {
    padding: 1rem;
  }

  .ctrl-banner {
    flex-direction: column;
    padding: 1rem;
  }

  .ctrl-section__head .btn,
  .ctrl-actions-row .btn,
  .ctrl-actions-row a.btn,
  .ctrl-nav-card {
    width: 100%;
    justify-content: center;
  }

  .ctrl-actions-row {
    flex-direction: column;
  }

  .ctrl-summary-card {
    padding: 1rem;
  }

  .help-shortcuts {
    grid-template-columns: 1fr;
  }

  .help-faq__q {
    font-size: 0.85rem;
    padding: 0.75rem 0.85rem;
  }

  .help-faq__chip {
    display: block;
    margin: 0 0 0.35rem;
    width: fit-content;
  }

  .dash-table-wrap--stack {
    overflow-x: visible;
    margin: 0 -0.15rem;
  }

  .dash-table-wrap--stack .dash-table {
    display: block;
    font-size: 0.84rem;
  }

  .dash-table-wrap--stack .dash-table thead {
    display: none;
  }

  .dash-table-wrap--stack .dash-table tbody {
    display: block;
  }

  .dash-table-wrap--stack .dash-table tr {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--nox-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
  }

  .dash-table-wrap--stack .dash-table tr:hover {
    background: rgba(0, 0, 0, 0.12);
  }

  .dash-table-wrap--stack .dash-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: none;
    text-align: right;
  }

  .dash-table-wrap--stack .dash-table td::before {
    content: attr(data-label);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--nox-muted);
    text-align: left;
    flex: 0 0 38%;
  }

  .dash-table-wrap--stack .dash-table td:not([data-label=""])::before {
    padding-top: 0.15rem;
  }

  .dash-table-wrap--stack .dash-table td[data-label=""] {
    justify-content: flex-end;
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--nox-border);
  }

  .dash-table-wrap--stack .dash-table td[data-label=""]::before {
    display: none;
  }

  .dash-table-wrap--stack .dash-table__empty {
    display: block;
    text-align: center;
  }

  .activity-cat {
    font-size: 0.65rem;
  }

  .activity-meta {
    word-break: break-word;
  }

  .ctrl-field__value--mono {
    font-size: 0.78rem;
    word-break: break-all;
  }

  .ctrl-dialog__actions {
    flex-direction: column-reverse;
  }

  .ctrl-dialog__actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app-content:not(:has(#nox-messaging-module)) {
    padding: 0.75rem 0.65rem 1.25rem;
  }

  .app-module__title {
    font-size: 1.15rem;
  }

  .ctrl-section,
  .dash-section {
    padding: 0.85rem;
  }

  .ctrl-field {
    padding: 0.7rem 0.8rem;
  }

  .ctrl-banner {
    padding: 0.85rem;
  }

  .help-shortcut {
    padding: 0.65rem 0.75rem;
  }

  .dash-kpi {
    padding: 0.85rem;
  }
}

.app-module--error,
.app-module--locked,
.app-module--coming-soon {
  animation: appFadeIn 0.25s ease;
}

@keyframes appFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.app-dl {
  display: grid;
  gap: 0.85rem;
}

.app-dl div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--nox-border);
}

.app-dl dt {
  font-size: 0.78rem;
  color: var(--nox-muted);
}

.app-dl dd {
  font-size: 0.9rem;
  word-break: break-word;
}

.app-table-wrap {
  overflow-x: auto;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.app-table th,
.app-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--nox-border);
  text-align: left;
}

.app-table th {
  color: var(--nox-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-panel--ghost {
  text-align: center;
}

.app-ghost-visual {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.app-ghost-visual span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--nox-cyan);
  opacity: 0.35;
  animation: appPulse 1.4s ease-in-out infinite;
}

.app-ghost-visual span:nth-child(2) { animation-delay: 0.2s; }
.app-ghost-visual span:nth-child(3) { animation-delay: 0.4s; }

@keyframes appPulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.app-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  text-align: left;
  max-width: 420px;
  margin-inline: auto;
}

.app-feature-list li {
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.88rem;
  color: var(--nox-muted);
}

.app-feature-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--nox-cyan);
}

/* ─── Dashboard (glassmorphism) ─── */

.glass-card {
  border: 1px solid var(--nox-card-border);
  border-radius: 18px;
  background: var(--nox-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--nox-card-shadow);
}

.transparency-card {
  max-width: 720px;
  margin: 2rem auto;
  padding: 1.5rem;
}

.transparency-card section + section {
  margin-top: 1.25rem;
}

.transparency-card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(0, 229, 255, 0.11), transparent 42%),
    radial-gradient(circle at bottom left, rgba(52, 211, 153, 0.08), transparent 36%),
    var(--nox-surface);
}

.dash-header::after {
  content: '';
  position: absolute;
  inset: auto -25% -50% -25%;
  height: 200px;
  background: radial-gradient(ellipse, rgba(0, 229, 255, 0.16) 0%, transparent 68%);
  filter: blur(20px);
  pointer-events: none;
}

.dash-header__main {
  position: relative;
  z-index: 1;
}

.dash-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.25rem;
}

.dash-header__plan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
  font-size: 0.92rem;
  color: var(--nox-muted);
}

.dash-header__plan-name {
  font-weight: 600;
  color: var(--nox-text);
}

.dash-header__plan-sep {
  opacity: 0.5;
}

.dash-plan-badge {
  display: inline-flex;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--nox-border);
}

.dash-plan-badge--active {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
}

.dash-plan-badge--warning {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}

.dash-plan-badge--expired {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.dash-header__trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.dash-trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid;
  font-size: 0.72rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dash-trust-chip:hover {
  transform: translateY(-1px);
}

.dash-trust-chip__icon {
  font-size: 1rem;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.dash-trust-chip__text {
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.dash-trust-chip--e2ee {
  border-color: rgba(74, 222, 128, 0.5);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.14) 0%, rgba(74, 222, 128, 0.08) 100%);
  color: #4ade80;
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.15);
}

.dash-trust-chip--a2f-on {
  border-color: rgba(34, 211, 238, 0.45);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12) 0%, rgba(34, 211, 238, 0.06) 100%);
  color: #22d3ee;
  box-shadow: 0 2px 8px rgba(34, 211, 238, 0.12);
}

.dash-trust-chip--a2f-off {
  border-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(251, 191, 36, 0.06) 100%);
  color: #fbbf24;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.1);
}

.dash-trust-chip--privacy {
  border-color: rgba(168, 85, 247, 0.4);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.11) 0%, rgba(168, 85, 247, 0.05) 100%);
  color: #a855f7;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.1);
}

.dash-header__meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.dash-header__meta-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nox-cyan);
  font-weight: 700;
}

.dash-sync {
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.dash-kpi-grid--primary {
  margin-bottom: 0.85rem;
}

.dash-secondary-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.15fr) minmax(0, 2fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
  align-items: stretch;
}

.dash-secondary-grid .dash-kpi--compact,
.dash-secondary-grid .dash-compliance-panel {
  min-height: 0;
  height: 100%;
  justify-content: flex-start;
  grid-column: auto;
}

.dash-compliance-panel {
  background:
    radial-gradient(circle at top right, rgba(74, 222, 128, 0.07), transparent 52%),
    var(--nox-surface);
}

.dash-compliance-score {
  font-size: clamp(1.55rem, 3vw, 1.85rem);
  line-height: 1.1;
}

.dash-compliance-score--ok { color: #4ade80; }
.dash-compliance-score--warn { color: #fbbf24; }
.dash-compliance-score--danger { color: #f87171; }

.dash-compliance-metrics {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.dash-compliance-metric {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  row-gap: 0.05rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--nox-border);
}

.dash-compliance-metric__icon {
  grid-row: 1 / span 2;
  font-size: 0.95rem;
  line-height: 1.3;
}

.dash-compliance-metric__label {
  font-size: 0.68rem;
  color: var(--nox-muted);
  line-height: 1.25;
}

.dash-compliance-metric__value {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--nox-text);
}

.dash-compliance-metric__value.is-ok { color: #4ade80; }
.dash-compliance-metric__value.is-warn { color: #fbbf24; }

.dash-compliance-privacy {
  margin-top: auto;
  padding-top: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.85;
}

.dash-section--inline {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.dash-activity-panel .dash-section__head {
  margin-bottom: 0.75rem;
}

.dash-activity-panel .dash-table-wrap {
  flex: 1;
}

.dash-activity-panel .dash-table__empty {
  padding: 1rem !important;
}

.dash-quick-panel {
  margin-bottom: 0;
}

.dash-kpi-grid--primary > .dash-kpi:first-child {
  grid-column: span 2;
  background:
    radial-gradient(circle at top right, rgba(0, 229, 255, 0.09), transparent 48%),
    var(--nox-surface);
}

.dash-kpi-grid--primary > .dash-kpi:first-child .dash-kpi__value {
  font-size: clamp(1.65rem, 3.5vw, 2.1rem);
}

.dash-kpi {
  padding: 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 168px;
}

.dash-kpi--muted {
  opacity: 0.88;
}

.dash-kpi__icon {
  font-size: 1.35rem;
  margin-bottom: 0.15rem;
}

.dash-kpi__label {
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.dash-kpi__value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}

.dash-kpi__hint {
  font-size: 0.72rem;
  color: var(--nox-muted);
  margin-top: 0.15rem;
}

.dash-kpi__reset {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--nox-accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.dash-kpi__cta {
  margin-top: auto;
  align-self: flex-start;
}

.dash-progress {
  margin-top: 0.55rem;
  height: 6px;
  border-radius: 99px;
  background: var(--nox-track-bg);
  overflow: hidden;
}

.dash-progress span {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease, background 0.3s;
}

.dash-progress--ok span { background: #4ade80; }
.dash-progress--warn span { background: #fbbf24; }
.dash-progress--danger span { background: #f87171; }

.dash-e2ee-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
}

.dash-e2ee-badge.is-ok {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
}

.dash-e2ee-badge.is-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.dash-section {
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.dash-section__head {
  margin-bottom: 1rem;
}

.dash-section__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.dash-section__note {
  font-size: 0.82rem;
  color: var(--nox-muted);
}

.dash-table-wrap {
  overflow-x: auto;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.dash-table th,
.dash-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--nox-border);
}

.dash-table th {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nox-muted);
}

.dash-table tbody tr:hover {
  background: var(--nox-row-hover);
}

.dash-table__empty {
  text-align: center;
  color: var(--nox-muted);
  padding: 1.5rem !important;
}

.dash-cta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.dash-cta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--nox-border);
  border-radius: 14px;
  background: var(--nox-cta-bg);
  color: var(--nox-text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.dash-cta:hover {
  transform: translateY(-2px);
  border-color: var(--nox-cyan-dim);
  box-shadow: var(--nox-cta-hover-shadow);
}

.dash-cta--primary {
  border-color: var(--nox-cyan-dim);
  background: var(--nox-cta-primary-bg);
}

.dash-cta--accent {
  border-color: color-mix(in srgb, #4ade80 25%, var(--nox-border));
  background: var(--nox-cta-accent-bg);
}

.dash-cta__icon {
  font-size: 1.5rem;
}

/* ─── Responsive ─── */

@media (max-width: 1100px) {
  .app-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-secondary-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dash-secondary-grid .dash-activity-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .dash-secondary-grid { grid-template-columns: 1fr; }
  .dash-secondary-grid .dash-activity-panel { grid-column: auto; }
}

@media (max-width: 900px) {
  .app-topbar__menu { display: flex; }
  .app-topbar__user { display: flex; }
  .app-sidebar {
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.35);
  }
  body.app-sidebar-open .app-sidebar { transform: translateX(0); }
  body.app-sidebar-open .app-sidebar-backdrop { display: block; }
  .app-main { margin-left: 0; }
}

@media (max-width: 900px) {
  .app-chat-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-stat-grid,
  .app-stat-grid--2,
  .app-quick-grid,
  .dash-kpi-grid,
  .dash-secondary-grid,
  .dash-cta-grid { grid-template-columns: 1fr; }
  .app-dl div { grid-template-columns: 1fr; }
  .app-topbar__welcome { display: none; }
  .dash-header { flex-direction: column; }
  .dash-kpi-grid--primary > .dash-kpi:first-child {
    grid-column: span 1;
  }
  .ctrl-section__head { flex-direction: column; align-items: flex-start; }
  .ctrl-support-layout { grid-template-columns: 1fr; }
}

/* ─── Contrôle total (settings / support / billing) ─── */

.ctrl-banner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--nox-cyan);
}

.ctrl-banner__icon { font-size: 1.5rem; flex-shrink: 0; }

.ctrl-banner strong {
  display: block;
  font-family: var(--font-display);
  margin-bottom: 0.35rem;
}

.ctrl-banner p {
  font-size: 0.88rem;
  color: var(--nox-muted);
  line-height: 1.55;
  margin: 0;
}

.ctrl-badge {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ctrl-badge--readonly {
  color: var(--nox-muted);
  border: 1px solid var(--nox-border);
  background: rgba(255, 255, 255, 0.03);
}

.ctrl-section {
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.ctrl-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.ctrl-section__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.ctrl-section__sub {
  font-size: 0.82rem;
  color: var(--nox-muted);
  margin: 0;
}

/* ─── Billing : recharge crédits ─── */
.billing-credits-calc {
  width: 100%;
  max-width: none;
  margin-bottom: 1rem;
  padding: 1.15rem 1.25rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--nox-border);
  background: var(--nox-bg-2, var(--nox-bg));
}

.billing-credits-calc__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 360px);
  gap: 1.25rem 1.75rem;
  align-items: start;
}

.billing-credits-calc__pick {
  min-width: 0;
}

.billing-credits-calc__checkout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

@media (max-width: 820px) {
  .billing-credits-calc__grid {
    grid-template-columns: 1fr;
  }
}

.billing-credits-calc__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--nox-muted);
  margin: 0 0 0.75rem;
}

.billing-credits-calc__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.billing-credits-calc__preset {
  flex: 1;
  min-width: 68px;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--nox-border);
  border-radius: 9px;
  background: var(--nox-surface);
  color: var(--nox-text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.billing-credits-calc__preset:hover {
  border-color: var(--nox-cyan-dim);
}

.billing-credits-calc__preset.is-active {
  border-color: var(--nox-cyan);
  color: var(--nox-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.billing-credits-calc__slider {
  width: 100%;
  height: 5px;
  margin: 0.15rem 0 0.75rem;
  appearance: none;
  border-radius: 99px;
  background: var(--nox-border);
  cursor: pointer;
}

.billing-credits-calc__slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--nox-cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
  cursor: grab;
}

.billing-credits-calc__slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--nox-cyan);
  cursor: grab;
}

.billing-credits-calc__qty-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.billing-credits-calc__qty {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--nox-cyan);
  line-height: 1;
}

.billing-credits-calc__qty-label {
  font-size: 0.82rem;
  color: var(--nox-muted);
}

.billing-credits-calc__price-box {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0;
  border-radius: 10px;
  background: var(--nox-surface);
  border: 1px solid var(--nox-border);
}

.billing-credits-calc__unit {
  font-size: 0.76rem;
  color: var(--nox-muted);
}

.billing-credits-calc__total {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  transition: opacity 0.15s ease;
}

.billing-credits-calc__total.is-updating {
  opacity: 0.5;
}

.billing-credits-calc__hint {
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.billing-credits-calc__cta {
  width: 100%;
  justify-content: center;
  margin-top: auto;
}

.billing-credits-calc__success {
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
  color: var(--nox-cyan);
}

.billing-credits-calc__error {
  margin-top: 0.65rem;
}

.ctrl-subtitle {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
}

.ctrl-readonly-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.ctrl-readonly-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ctrl-field {
  padding: 0.85rem 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.15);
}

[data-theme-scheme="light"] .ctrl-field {
  background: rgba(0, 0, 0, 0.03);
}

.ctrl-field__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nox-muted);
  margin-bottom: 0.35rem;
}

.ctrl-field__value {
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-word;
}

.ctrl-field__value--mono {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.85rem;
}

.ctrl-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.ctrl-status {
  display: inline-flex;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

.ctrl-status--ok {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.ctrl-security-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.ctrl-security-card {
  flex: 1;
  padding: 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}

.ctrl-a2f-status {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fbbf24;
}

.ctrl-a2f-status.is-on {
  color: #4ade80;
}

.ctrl-a2f-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--nox-muted);
  line-height: 1.45;
}

.a2f-method-picker { display: grid; gap: 0.65rem; margin: 1rem 0; }
.a2f-method-option { display: block; cursor: pointer; }
.a2f-method-option input { position: absolute; opacity: 0; pointer-events: none; }
.a2f-method-option__box {
  display: block; padding: 0.85rem 1rem; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.04);
}
.a2f-method-option input:checked + .a2f-method-option__box {
  border-color: rgba(0,229,255,0.55); box-shadow: 0 0 0 1px rgba(0,229,255,0.25);
}
.a2f-method-option__box strong { display: block; margin-bottom: 0.2rem; }
.a2f-method-option__box small { color: var(--nox-muted); font-size: 0.85rem; }
.a2f-settings { margin-top: 1rem; padding: 1rem; }

.ctrl-sla {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), transparent);
}

.ctrl-sla__icon { font-size: 1.75rem; }

.ctrl-sla__label {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--nox-cyan);
  margin-bottom: 0.2rem;
}

.ctrl-sla__hint {
  font-size: 0.82rem;
  color: var(--nox-muted);
  margin: 0;
}

.ctrl-support-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}

.ctrl-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.ctrl-form-field span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--nox-muted);
}

.ctrl-form-field input,
.ctrl-form-field select,
.ctrl-form-field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--nox-text);
  font: inherit;
  font-size: 0.9rem;
}

.ctrl-form-field textarea { resize: vertical; min-height: 120px; }

.ctrl-form-note {
  font-size: 0.78rem;
  color: var(--nox-muted);
  margin: 0 0 1rem;
}

.ctrl-form-feedback {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.ctrl-form-feedback.is-success {
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

.ctrl-form-feedback.is-error {
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.ctrl-empty {
  padding: 1.5rem 0;
  text-align: center;
  color: var(--nox-muted);
  font-size: 0.88rem;
}

.ctrl-empty .btn { margin-top: 1rem; }

.ctrl-ticket-status {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.ctrl-ticket-status--open { color: var(--nox-cyan); background: rgba(0, 229, 255, 0.1); }
.ctrl-ticket-status--in_progress { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.ctrl-ticket-status--resolved,
.ctrl-ticket-status--closed { color: #4ade80; background: rgba(74, 222, 128, 0.1); }

.ctrl-section__subtitle {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nox-muted);
}

.ctrl-empty--compact {
  padding: 0.75rem 0 1rem;
  text-align: left;
}

.ctrl-history-dropdown {
  margin-top: 0.5rem;
  position: relative;
}

.ctrl-history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.06);
  color: var(--nox-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ctrl-history-toggle:hover:not(:disabled) {
  border-color: var(--nox-cyan);
  background: rgba(0, 229, 255, 0.1);
}

.ctrl-history-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ctrl-history-toggle.is-open {
  border-color: var(--nox-cyan);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.ctrl-history-toggle__badge {
  display: inline-flex;
  min-width: 1.4rem;
  height: 1.4rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.18);
  color: var(--nox-cyan);
  font-size: 0.72rem;
  font-weight: 700;
}

.ctrl-history-toggle__chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--nox-muted);
  border-bottom: 2px solid var(--nox-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-left: auto;
}

.ctrl-history-toggle.is-open .ctrl-history-toggle__chevron {
  transform: rotate(-135deg);
  margin-top: 0.25rem;
}

.ctrl-history-panel {
  border: 1px solid var(--nox-cyan);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.ctrl-history-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--nox-border);
  font-size: 0.78rem;
}

.ctrl-history-panel__title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--nox-muted);
}

.ctrl-history-panel__count {
  color: var(--nox-cyan);
  font-size: 0.72rem;
}

.ctrl-history-panel__controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem 0;
}

.ctrl-history-scroll-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--nox-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--nox-text);
  font-size: 0.7rem;
  cursor: pointer;
  line-height: 1;
}

.ctrl-history-scroll-btn:hover {
  border-color: var(--nox-cyan);
  color: var(--nox-cyan);
}

.ctrl-history-panel__scroll {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.65rem 0.75rem;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.ctrl-history-panel__scroll:focus {
  outline: 2px solid rgba(0, 229, 255, 0.35);
  outline-offset: -2px;
}

.ctrl-history-panel__scroll::-webkit-scrollbar {
  width: 6px;
}

.ctrl-history-panel__scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.35);
  border-radius: 999px;
}

.ctrl-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ctrl-history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.ctrl-history-item__main {
  flex: 1 1 12rem;
  min-width: 0;
}

.ctrl-history-item__ref {
  display: block;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  color: var(--nox-cyan);
  margin-bottom: 0.2rem;
}

.ctrl-history-item__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--nox-text);
}

.ctrl-history-item__preview {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--nox-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ctrl-history-item__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ctrl-history-item__range {
  font-size: 0.78rem;
  color: var(--nox-muted, #8b9cb3);
  white-space: nowrap;
}

.support-history-download-btn {
  flex-shrink: 0;
}

.ctrl-history-item__retention {
  margin: 0.4rem 0 0;
  font-size: 0.74rem;
  color: var(--nox-muted, #8b9cb3);
  line-height: 1.35;
}

.ctrl-history-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.ctrl-history-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--nox-border);
  border-radius: 8px;
  background: transparent;
  color: var(--nox-muted, #8b9cb3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ctrl-history-delete-btn:hover {
  border-color: #e85d6a;
  color: #ff8a96;
}

.ctrl-history-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ctrl-history-item__date {
  font-size: 0.75rem;
  color: var(--nox-muted);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--nox-border);
  color: var(--nox-text);
}

.btn--ghost:hover {
  border-color: var(--nox-cyan);
  color: var(--nox-cyan);
}

.ctrl-doc-badge {
  font-size: 0.72rem;
  color: var(--nox-muted);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--nox-border);
  border-radius: 6px;
}

@media (max-width: 900px) {
  .ctrl-readonly-grid { grid-template-columns: 1fr; }
  .ctrl-readonly-grid--2 { grid-template-columns: 1fr; }
}

.ctrl-danger-zone {
  border-color: rgba(248, 113, 113, 0.35);
}

.ctrl-danger-note {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--nox-muted);
  line-height: 1.5;
}

.btn--danger {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

.btn--danger:hover {
  background: rgba(248, 113, 113, 0.28);
  border-color: rgba(248, 113, 113, 0.65);
}

.ctrl-dialog {
  width: min(480px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 14px;
  background: var(--nox-surface, #0f1419);
  color: var(--nox-text);
}

.ctrl-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.ctrl-dialog__inner {
  padding: 1.25rem 1.35rem 1.35rem;
}

.ctrl-dialog__head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.ctrl-dialog__head p {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--nox-muted);
}

.ctrl-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

/* ─── Messaging peer network ─── */

.msg-peer-unavailable {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--nox-muted);
}

.msg-peer-panel {
  margin-bottom: 1rem;
  padding: 1rem 1.15rem;
}

.msg-peer-panel__title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nox-cyan);
}

.msg-peer-panel__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.msg-peer-block {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: 12px;
  background: rgba(0, 229, 255, 0.03);
}

.msg-peer-block__label,
.msg-peer-start-form__label {
  display: block;
  font-size: 0.82rem;
  color: var(--nox-muted);
  margin-bottom: 0.35rem;
}

.msg-peer-block__hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--nox-muted);
}

.msg-peer-block__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.msg-peer-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
}

.msg-peer-id-row__label {
  font-size: 0.82rem;
  color: var(--nox-muted);
  width: 100%;
}

.msg-peer-handle {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--nox-text);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
}

.msg-peer-start-form {
  margin-bottom: 0;
}

.msg-peer-start-form__label {
  display: block;
  font-size: 0.82rem;
  color: var(--nox-muted);
  margin-bottom: 0.35rem;
}

.msg-peer-start-form__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.msg-peer-start-form__row .app-input {
  flex: 1 1 160px;
  min-width: 0;
  min-height: 0;
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
  line-height: 1.35;
  box-sizing: border-box;
}

.msg-peer-invite-btn {
  width: 100%;
  margin-top: 0;
}

@media (min-width: 900px) {
  .msg-peer-panel__grid {
    grid-template-columns: minmax(200px, 1fr) minmax(260px, 1.4fr) minmax(200px, 1fr);
    gap: 1rem;
    align-items: stretch;
  }

  .msg-peer-block--invite {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .msg-peer-block__body {
    flex-direction: column;
    align-items: stretch;
  }

  .msg-peer-block__body .msg-peer-handle {
    width: 100%;
    text-align: center;
  }
}

.msg-invite-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.msg-invite-modal[hidden] {
  display: none !important;
}

.msg-invite-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(6px);
}

.msg-invite-modal__card {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem 1.35rem 1.5rem;
  border-radius: var(--nox-radius, 14px);
}

.msg-invite-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.msg-invite-modal__head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.msg-invite-modal__close {
  border: none;
  background: transparent;
  color: var(--nox-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.msg-invite-form,
.msg-invite-accept-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.msg-invite-form__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--nox-muted);
  margin-top: 0.35rem;
}

.msg-invite-form__hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--nox-muted);
}

.msg-invite-result__expires {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--nox-muted);
}

.msg-invite-result__code-wrap {
  text-align: center;
  padding: 1.1rem 1rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.msg-invite-result__code-label,
.msg-invite-result__link-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nox-cyan, #00e5ff);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.msg-invite-result__code {
  display: block;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: var(--nox-text, #f4f8ff);
  margin: 0.25rem 0 0.75rem;
}

.msg-invite-result__link-wrap {
  margin-bottom: 1rem;
}

.msg-invite-result__email {
  font-size: 0.82rem;
  color: #4ade80;
  margin: 0 0 1rem;
}

.msg-invite-accept__sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--nox-muted);
  line-height: 1.5;
}

.msg-invite-accept-code {
  text-align: center;
  font-size: 1.75rem !important;
  letter-spacing: 0.4em;
  font-weight: 700;
}

body.msg-invite-modal-open {
  overflow: hidden;
}

.msg-chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--nox-border);
  background: rgba(0, 229, 255, 0.04);
  flex-shrink: 0;
}

.msg-chat-toolbar[hidden] {
  display: none !important;
}

.msg-chat-toolbar__main {
  flex: 1 1 200px;
  min-width: 0;
}

.msg-chat-toolbar__eyebrow {
  display: block;
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nox-cyan);
}

.msg-chat-toolbar__status {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--nox-muted);
}

.msg-chat-toolbar__status--not_opened {
  color: #64748b;
}

.msg-chat-toolbar__status--link_opened {
  color: #0369a1;
}

.msg-chat-toolbar__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.msg-chat-toolbar__close:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.65);
  color: #991b1b;
}

.msg-chat-toolbar__close[hidden] {
  display: none !important;
}

.msg-chat-toolbar__close-icon {
  font-size: 0.72rem;
  opacity: 0.85;
}

[data-theme-scheme="light"] .msg-chat-toolbar__close {
  color: #dc2626;
  background: rgba(254, 226, 226, 0.9);
  border-color: rgba(248, 113, 113, 0.4);
}

[data-theme-scheme="light"] .msg-chat-toolbar {
  background: rgba(0, 229, 255, 0.05);
}

.invite-chat__panel {
  position: relative;
}

.invite-chat__panel .msg-closing-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
}

.msg-invite-status-bar {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.4;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.08);
  color: #3730a3;
}

.msg-invite-status-bar--link_opened {
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
}

.msg-conv-status {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.3;
}

.msg-invite-result__status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.msg-conv-badge--invite {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.msg-conv-badge--peer {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.35);
}

.msg-conv-handle {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--nox-muted);
  letter-spacing: 0.04em;
}

@media (max-width: 700px) {
  .msg-peer-start-form__row {
    flex-direction: column;
    align-items: stretch;
  }

  .msg-peer-start-form__row .app-input {
    flex: 0 0 auto;
    width: 100%;
  }
}

/* ─── Messaging support channel ─── */

.msg-conv-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
}

.app-chat-sidebar {
  display: flex;
  flex-direction: column;
}

.app-chat-sidebar .msg-conv-list {
  flex: 1;
  min-height: 160px;
}

.msg-conv-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--nox-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.msg-conv-item:hover,
.msg-conv-item.is-active {
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.22);
}

.msg-conv-item__title { font-weight: 600; font-size: 0.88rem; }

.msg-conv-preview {
  display: block;
  font-size: 0.75rem;
  color: var(--nox-muted);
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-conv-item--invite {
  border-left: 3px solid rgba(99, 102, 241, 0.55);
}

.msg-conv-item--invite.is-active,
.msg-conv-item--invite:hover {
  border-left-color: rgba(99, 102, 241, 0.9);
}

.msg-conv-item--peer-request {
  border-left: 3px solid rgba(245, 158, 11, 0.55);
}

.msg-conv-item--peer-request.is-active,
.msg-conv-item--peer-request:hover {
  border-left-color: rgba(245, 158, 11, 0.95);
}

.msg-conv-badge--peer-request {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.msg-bubble--peer-request {
  max-width: 100%;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.06);
}

.msg-peer-request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.msg-peer-request-actions .btn--danger {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.msg-peer-archive-btn {
  flex-shrink: 0;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.msg-sidebar__head--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.msg-history-toggle {
  flex-shrink: 0;
  font-size: 0.72rem;
}

.msg-history-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.msg-history-panel[hidden] {
  display: none !important;
}

.msg-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.5rem 0.75rem;
}

.msg-history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  position: relative;
}

.msg-history-item:hover,
.msg-history-item.is-active {
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.06);
}

.msg-history-item strong {
  font-size: 0.88rem;
  padding-right: 1.5rem;
}

.msg-history-item span {
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.msg-history-item__delete {
  position: absolute;
  top: 0.45rem;
  right: 0.35rem;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--nox-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.msg-history-item__delete:hover {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.12);
}

.msg-history-delete-btn {
  flex-shrink: 0;
}

.msg-conv-panel[hidden] {
  display: none !important;
}

.msg-conv-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--nox-cyan);
  padding: 0.12rem 0.45rem;
  border: 1px solid rgba(0, 229, 255, 0.3);
  border-radius: 999px;
}

.msg-conv-item.is-locked {
  cursor: not-allowed;
  opacity: 0.72;
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.06);
}

.msg-conv-badge--closing {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
}

.msg-conv-badge--closed {
  color: #ff8a80;
  border-color: rgba(255, 138, 128, 0.35);
  margin-left: 0.35rem;
}

.msg-conv-item small { font-size: 0.72rem; color: var(--nox-muted); }

.msg-thread {
  flex: 1;
  min-height: 420px;
  max-height: 520px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}

.msg-thread-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.msg-bubble {
  max-width: 88%;
  min-width: 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--nox-border);
  background: var(--nox-surface);
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-bubble--out {
  margin-left: auto;
  border-color: rgba(0, 229, 255, 0.25);
  background: rgba(0, 229, 255, 0.06);
}

.msg-bubble--pending {
  opacity: 0.92;
}

.msg-bubble--in {
  margin-right: auto;
  border-color: rgba(74, 222, 128, 0.25);
  background: rgba(74, 222, 128, 0.05);
}

[data-theme-scheme="light"] .msg-bubble {
  background: var(--nox-surface);
  color: var(--nox-text);
}

[data-theme-scheme="light"] .msg-bubble--out {
  background: rgba(0, 160, 180, 0.1);
  border-color: rgba(0, 160, 180, 0.28);
}

[data-theme-scheme="light"] .msg-bubble--in {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(34, 120, 80, 0.22);
}

[data-theme-scheme="light"] .msg-peer-handle {
  background: rgba(0, 160, 180, 0.08);
  border-color: rgba(0, 160, 180, 0.22);
  color: var(--nox-text);
}

.msg-bubble header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.msg-bubble header time {
  flex-shrink: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-bubble__ref {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--nox-cyan);
  margin-bottom: 0.35rem;
}

.msg-bubble p {
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-bubble__seq {
  font-weight: 700;
  color: var(--nox-cyan);
  margin-right: 0.35rem;
}

.msg-bubble__lock {
  font-size: 0.65rem;
  opacity: 0.75;
}

.msg-compose {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--nox-border);
  background: var(--nox-surface);
  box-sizing: border-box;
}

.msg-compose__secure {
  width: 100%;
  font-size: 0.72rem;
  color: var(--nox-muted);
}

.msg-compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  resize: vertical;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--nox-border);
  border-radius: 10px;
  background: var(--nox-bg);
  color: var(--nox-text);
  font: inherit;
  box-sizing: border-box;
}

.app-sidebar__badge {
  display: inline-flex;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--nox-cyan);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}

.app-chat-main {
  position: relative;
}

.msg-closing-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 12, 22, 0.82);
  backdrop-filter: blur(6px);
  animation: msgClosingFadeIn 0.35s ease;
}

[data-theme-scheme="light"] .msg-closing-overlay {
  background: rgba(240, 242, 245, 0.92);
}

[data-theme-scheme="light"] .msg-closing-card {
  background: linear-gradient(160deg, #fff5f5, #ffffff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.msg-closing-overlay[hidden] {
  display: none !important;
}

@keyframes msgClosingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.msg-closing-card {
  text-align: center;
  padding: 1.75rem 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: linear-gradient(160deg, rgba(30, 20, 28, 0.95), rgba(15, 23, 42, 0.98));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  max-width: 320px;
  width: 100%;
  animation: msgClosingPulse 2s ease-in-out infinite;
}

@keyframes msgClosingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.msg-closing-ring-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 1rem;
}

.msg-closing-ring {
  --progress: 0%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#f87171 var(--progress), rgba(255, 255, 255, 0.08) 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
}

.msg-closing-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: #fecaca;
  font-variant-numeric: tabular-nums;
}

.msg-closing-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fecaca;
}

.msg-closing-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--nox-muted);
  line-height: 1.45;
}

.msg-bubble--closing {
  margin: 0 auto;
  max-width: 92%;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  text-align: center;
}

.msg-bubble--system {
  margin: 0 auto;
  max-width: 92%;
  border-color: rgba(0, 229, 255, 0.25);
  background: rgba(0, 229, 255, 0.06);
  text-align: center;
}

#nox-messaging-module .app-chat-main {
  display: flex;
  flex-direction: column;
}

.msg-chat-focus-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--nox-border);
  background: var(--nox-bg);
  flex-shrink: 0;
  position: relative;
  z-index: 12;
}

.msg-focus-back {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--nox-border);
  border-radius: 12px;
  background: var(--nox-surface);
  color: var(--nox-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.msg-focus-back:hover {
  border-color: var(--nox-cyan-dim);
  background: rgba(0, 229, 255, 0.06);
}

.msg-focus-back__label {
  display: none;
}

.msg-chat-focus-bar[hidden] {
  display: none !important;
}

.msg-chat-focus-bar__info {
  min-width: 0;
  flex: 1;
}

.msg-chat-focus-bar__title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-focus-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
  min-width: 40px;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--nox-border);
}

.msg-focus-toggle:hover {
  border-color: var(--nox-cyan-dim);
  background: rgba(0, 229, 255, 0.06);
}

.msg-focus-toggle__icon {
  flex-shrink: 0;
}

.msg-focus-toggle__icon--exit,
.msg-focus-toggle__label--exit {
  display: none;
}

body.nox-msg-focus .msg-focus-toggle__icon--enter,
body.nox-msg-focus .msg-focus-toggle__label--enter {
  display: none;
}

body.nox-msg-focus .msg-focus-toggle__icon--exit,
body.nox-msg-focus .msg-focus-toggle__label--exit {
  display: inline;
}

body.nox-msg-focus {
  overflow: hidden;
}

body.nox-msg-focus .app-topbar,
body.nox-msg-focus .app-sidebar,
body.nox-msg-focus .app-sidebar-backdrop {
  display: none !important;
}

body.nox-msg-focus .app-layout {
  padding-top: 0;
  min-height: 100dvh;
}

body.nox-msg-focus .app-main {
  margin-left: 0;
}

body.nox-msg-focus .app-content {
  padding: 0;
  min-height: 100dvh;
}

body.nox-msg-focus #nox-messaging-module > .app-module__head,
body.nox-msg-focus #nox-messaging-module #msg-rail {
  display: none !important;
}

body.nox-msg-focus #nox-messaging-module .app-chat-layout {
  gap: 0;
  min-height: 100dvh;
  grid-template-columns: 1fr;
}

body.nox-msg-focus #nox-messaging-module .app-chat-sidebar {
  display: none !important;
}

body.nox-msg-focus #nox-messaging-module .app-chat-main {
  border: none;
  border-radius: 0;
  min-height: 100dvh;
  min-height: 100svh;
}

body.nox-msg-focus #nox-messaging-module .msg-thread {
  max-height: none;
  min-height: 0;
}

/* Mobile : conversation active = fil seul (liste masquée) */
#nox-messaging-module.nox-msg-mobile-chat > .app-module__head,
#nox-messaging-module.nox-msg-mobile-chat #msg-rail {
  display: none !important;
}

#nox-messaging-module.nox-msg-mobile-chat .app-chat-sidebar {
  display: none !important;
}

#nox-messaging-module.nox-msg-mobile-chat .app-chat-layout {
  gap: 0;
  min-height: 0;
}

#nox-messaging-module.nox-msg-mobile-chat .app-chat-main {
  min-height: calc(100dvh - 60px);
  min-height: calc(100svh - 60px);
}

body.nox-msg-focus #nox-messaging-module .app-chat-main {
  position: fixed;
  inset: 0;
  z-index: 400;
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100dvh;
  min-height: 100svh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body.nox-msg-focus #nox-messaging-module .msg-chat-focus-bar {
  padding-top: max(0.65rem, env(safe-area-inset-top, 0));
}

body.nox-msg-focus #nox-messaging-module .msg-compose {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0));
}

#nox-messaging-module .msg-thread {
  flex: 1;
}

#nox-messaging-module .msg-compose {
  flex-shrink: 0;
}

/* Mobile : évite le zoom iOS au focus (font-size < 16px) */
@media (max-width: 900px) {
  .app-input,
  .app-input--select,
  .ctrl-form-field input,
  .ctrl-form-field select,
  .ctrl-form-field textarea,
  #nox-messaging-module input,
  #nox-messaging-module textarea,
  #nox-messaging-module select,
  .msg-compose textarea {
    font-size: 16px !important;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
  }

  .ctrl-form-field input,
  .ctrl-form-field textarea,
  .msg-compose textarea {
    scroll-margin-bottom: 1.25rem;
  }
}

@media (max-width: 900px) {
  #nox-messaging-module .app-content,
  #nox-messaging-module {
    min-height: 0;
  }

  #nox-messaging-module .msg-chat-focus-bar {
    position: sticky;
    top: 0;
    padding: 0.5rem 0.75rem;
    gap: 0.4rem;
    background: var(--nox-surface);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }

  .msg-focus-back {
    display: inline-flex;
  }

  .msg-focus-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem !important;
  }

  .msg-focus-toggle__label {
    display: none !important;
  }

  body.nox-msg-focus .msg-focus-toggle__label--exit {
    display: none !important;
  }

  body.nox-keyboard-open {
    overflow: hidden;
  }

  body.nox-keyboard-open .app-content:has(#nox-messaging-module) {
    padding-bottom: max(0.5rem, var(--nox-keyboard-gap, 0));
  }

  body.nox-keyboard-open #nox-messaging-module.nox-msg-mobile-chat .app-chat-main,
  body.nox-keyboard-open #nox-messaging-module .app-chat-main {
    min-height: var(--nox-vv-height, 100svh) !important;
    max-height: var(--nox-vv-height, 100svh) !important;
  }

  body.nox-keyboard-open.nox-msg-focus #nox-messaging-module .app-chat-main {
    top: var(--nox-vv-offset-top, 0) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: var(--nox-vv-height, 100svh) !important;
    min-height: 0 !important;
    bottom: auto !important;
    inset: auto !important;
  }

  body.nox-keyboard-open #nox-messaging-module .msg-thread {
    min-height: 0 !important;
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.nox-keyboard-open #nox-messaging-module .msg-compose {
    flex-shrink: 0;
    z-index: 6;
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0));
  }

  body.nox-keyboard-open #nox-support-module .ctrl-form-field input:focus,
  body.nox-keyboard-open #nox-support-module .ctrl-form-field textarea:focus {
    scroll-margin-bottom: calc(var(--nox-keyboard-gap, 80px) + 1rem);
  }
}
