/*
 * L’Alcôve 4.11.0 — refonte complète de la console web, correctif structurel du shell.
 * Cette couche conserve les contrats fonctionnels historiques tout en unifiant
 * la structure, la densité, les composants, les états et le responsive.
 */

:root {
  --bg: #0d0a11;
  --bg-elevated: #121017;
  --surface-1: #17131d;
  --surface-2: #1d1724;
  --surface-3: #251d2e;
  --surface-hover: #2b2234;
  --surface-soft: rgba(255, 255, 255, 0.035);
  --line: #352a3e;
  --line-soft: rgba(255, 255, 255, 0.075);
  --line-strong: #4b3a56;
  --text: #fbf7fd;
  --text-soft: #dfd5e4;
  --muted: #a99daf;
  --muted-strong: #c0b4c5;
  --primary: #d5a6e5;
  --primary-strong: #b67bca;
  --primary-soft: rgba(213, 166, 229, 0.12);
  --primary-softer: rgba(213, 166, 229, 0.065);
  --success: #7ed8b4;
  --success-soft: rgba(126, 216, 180, 0.1);
  --warning: #f1c77b;
  --warning-soft: rgba(241, 199, 123, 0.1);
  --danger: #f094a4;
  --danger-soft: rgba(240, 148, 164, 0.1);
  --info: #91bafa;
  --info-soft: rgba(145, 186, 250, 0.1);
  --neutral: #b9afbf;
  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 18px 54px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.42);
  --sidebar-width: 292px;
  --sidebar-compact-width: 84px;
  --topbar-height: 118px;
  --ease: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scrollbar-color: #4b3a56 #151019;
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 92% -8%, rgba(126, 73, 149, 0.28), transparent 34rem),
    radial-gradient(circle at 18% 110%, rgba(74, 42, 88, 0.18), transparent 38rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

* {
  scrollbar-color: #4b3a56 transparent;
  scrollbar-width: thin;
}

*::selection {
  color: #160f1a;
  background: var(--primary);
}

button,
input,
select,
textarea {
  letter-spacing: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--info) !important;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  color: #151018;
  background: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Connexion ---------- */

.login-screen {
  min-height: 100vh;
  padding: clamp(22px, 5vw, 72px);
  place-items: stretch;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(420px, 1fr);
  width: min(1180px, 100%);
  min-height: min(720px, calc(100vh - clamp(44px, 10vw, 144px)));
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(19, 15, 24, 0.9);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: auto;
  padding: clamp(34px, 6vw, 76px);
  border: 0;
  border-radius: 0;
  text-align: left;
  box-shadow: none;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.login-brand {
  align-items: flex-end;
  margin-bottom: 32px;
}

.login-brand h1 {
  margin: 3px 0 0;
  font-size: clamp(34px, 5vw, 48px);
  letter-spacing: -0.045em;
}

.login-brand .brand-mark {
  margin: 0;
}

.login-lead {
  max-width: 42ch;
  margin: 0 0 34px;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.7;
}

.login-button {
  min-height: 50px;
  margin-bottom: 22px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.security-grid span {
  padding: 9px 11px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 11px;
  text-align: center;
}

.login-aside {
  position: relative;
  display: grid;
  overflow: hidden;
  padding: clamp(32px, 6vw, 72px);
  place-items: end start;
  background:
    radial-gradient(circle at 62% 30%, rgba(213, 166, 229, 0.22), transparent 18rem),
    linear-gradient(145deg, #281b31, #17121c 62%);
}

.login-aside::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(135deg, black, transparent 78%);
}

.login-orbit {
  position: absolute;
  border: 1px solid rgba(213, 166, 229, 0.22);
  border-radius: 50%;
}

.orbit-one {
  top: 8%;
  right: -12%;
  width: 480px;
  height: 480px;
}

.orbit-two {
  top: 20%;
  right: 1%;
  width: 300px;
  height: 300px;
}

.login-preview {
  position: relative;
  z-index: 1;
  max-width: 520px;
  padding: 26px;
  background: rgba(18, 13, 22, 0.72);
  backdrop-filter: blur(20px);
}

.login-preview strong {
  display: block;
  margin: 8px 0 12px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.login-preview p:last-child {
  margin-bottom: 0;
  color: var(--muted-strong);
}

/* ---------- Structure générale ---------- */

.app-shell {
  display: block;
  min-height: 100vh;
}

.app-shell > main {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--ease);
}

body.sidebar-compact .app-shell > main {
  margin-left: var(--sidebar-compact-width);
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100dvh;
  padding: 16px 12px 14px;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  background: rgba(17, 13, 21, 0.95);
  box-shadow: 20px 0 70px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(24px);
  transition: width var(--ease), transform var(--ease);
}

body.sidebar-compact .sidebar {
  width: var(--sidebar-compact-width);
}

.sidebar::after {
  position: absolute;
  inset: 0 0 auto;
  height: 150px;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at 20% 0%, rgba(213, 166, 229, 0.13), transparent 75%);
}

.sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 5px 5px 13px;
  gap: 10px;
}

.sidebar-brand .brand-copy {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand strong {
  color: var(--text);
  font-size: 16px;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  margin-top: 0;
}

.brand-mark {
  flex: 0 0 auto;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 46%),
    linear-gradient(145deg, #d8aae8, #8d5aa1);
  box-shadow: 0 12px 40px rgba(173, 109, 194, 0.26);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.sidebar-collapse {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border-radius: 9px;
  font-size: 19px;
}

.sidebar-search-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 42px;
  margin: 3px 3px 13px;
  padding: 0 10px;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color var(--ease), background var(--ease);
}

.sidebar-search-wrap:focus-within {
  border-color: rgba(213, 166, 229, 0.52);
  background: rgba(213, 166, 229, 0.07);
}

.sidebar-search-wrap > span {
  color: var(--muted);
  font-size: 19px;
}

.sidebar-search-wrap input {
  min-width: 0;
  flex: 1;
  color: var(--text-soft);
  border: 0;
  outline: 0;
  background: transparent;
}

.sidebar-search-wrap input::placeholder {
  color: #756c7b;
}

.sidebar-search-wrap kbd {
  padding: 2px 6px;
  color: #817688;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-1);
  font-size: 10px;
}

#navigation {
  position: relative;
  z-index: 1;
  display: block;
  flex: 1;
  min-height: 0;
  padding: 0 2px 20px;
  overflow-x: hidden;
  overflow-y: auto;
}

.nav-group {
  display: block;
  margin: 0 0 7px;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 32px;
  padding: 7px 9px;
  color: #83798a;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 800;
}

.nav-group-toggle:hover {
  color: var(--muted-strong);
}

.nav-group-chevron {
  transition: transform var(--ease);
}

.nav-group.is-collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 2px;
  overflow: hidden;
}

.nav-group.is-collapsed .nav-group-items {
  display: none;
}

#navigation [data-page] {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 7px 10px 7px 8px;
  gap: 8px;
  overflow: hidden;
  color: #aaa0b0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
}

#navigation [data-page]::before {
  position: absolute;
  inset: 7px auto 7px 0;
  width: 3px;
  content: "";
  border-radius: 0 6px 6px 0;
  background: transparent;
}

#navigation [data-page]:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.045);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

#navigation [data-page].active {
  color: var(--text);
  border-color: rgba(213, 166, 229, 0.18);
  background: linear-gradient(90deg, rgba(213, 166, 229, 0.13), rgba(213, 166, 229, 0.05));
  box-shadow: none;
}

#navigation [data-page].active::before {
  background: var(--primary);
  box-shadow: 0 0 18px rgba(213, 166, 229, 0.5);
}

.nav-icon {
  display: grid;
  width: 27px !important;
  height: 27px;
  place-items: center;
  color: #95889c;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  transition: color var(--ease), background var(--ease);
}

#navigation [data-page].active .nav-icon {
  color: var(--primary);
  background: rgba(213, 166, 229, 0.09);
}

#navigation [data-page] > .nav-text {
  width: auto;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.sidebar-empty {
  margin: 12px 4px;
  padding: 16px 10px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-align: center;
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  display: grid;
  margin-top: 0;
  padding: 13px 6px 1px;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
}

.status-line {
  min-width: 0;
  color: var(--muted-strong);
  font-size: 11px;
}

.status-copy {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-link,
.sidebar-footer a {
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
}

.sidebar-link:hover,
.sidebar-footer a:hover {
  color: var(--text);
}

body.sidebar-compact .brand-copy,
body.sidebar-compact .sidebar-collapse,
body.sidebar-compact .sidebar-search-wrap input,
body.sidebar-compact .sidebar-search-wrap kbd,
body.sidebar-compact .nav-group-toggle,
body.sidebar-compact .nav-text,
body.sidebar-compact .status-copy,
body.sidebar-compact .sidebar-footer-actions {
  display: none;
}

body.sidebar-compact .sidebar-brand {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-compact .sidebar-search-wrap {
  justify-content: center;
  width: 44px;
  margin-inline: auto;
  padding: 0;
}

body.sidebar-compact .sidebar-search-wrap > span {
  font-size: 20px;
}

body.sidebar-compact .nav-group {
  margin-bottom: 2px;
}

body.sidebar-compact .nav-group-items {
  display: grid !important;
}

body.sidebar-compact #navigation [data-page] {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 50px;
  margin-inline: auto;
  padding: 7px;
}

body.sidebar-compact #navigation [data-page]:hover {
  transform: none;
}

body.sidebar-compact .nav-icon {
  width: 31px !important;
  height: 31px;
}

body.sidebar-compact .sidebar-footer {
  place-items: center;
  padding-inline: 0;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- En-tête ---------- */

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  min-height: var(--topbar-height);
  height: auto;
  padding: 18px clamp(22px, 3vw, 44px);
  gap: 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 10, 17, 0.78);
  backdrop-filter: blur(24px) saturate(1.15);
}

.topbar-heading {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
  gap: 14px;
}

.page-heading-copy {
  min-width: 0;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  gap: 7px;
  color: #817688;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topbar .eyebrow {
  display: none;
}

.topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(23px, 2vw, 29px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.page-description {
  max-width: 76ch;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-nav-toggle {
  display: none;
}

.topbar-actions {
  flex: 0 1 auto;
  gap: 9px;
}

.global-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(420px, 32vw);
  gap: 7px;
}

.global-search-icon {
  position: absolute;
  z-index: 1;
  left: 13px;
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
}

.global-search .input {
  width: 100%;
  height: 42px;
  padding: 9px 86px 9px 39px;
  border-color: var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.global-search .input:focus {
  border-color: rgba(213, 166, 229, 0.48);
  background: rgba(28, 22, 34, 0.96);
}

.shortcut-button {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 7px;
  gap: 3px;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-1);
  cursor: pointer;
}

.shortcut-button kbd {
  color: inherit;
  font-family: inherit;
  font-size: 9px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted-strong);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0);
}

.profile {
  min-height: 42px;
  max-width: 230px;
  padding: 4px 11px 4px 4px;
  gap: 8px;
  overflow: hidden;
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.035);
}

.profile img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.profile span {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results {
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: min(560px, 70vh);
  overflow: auto;
  border-color: var(--line-strong);
  border-radius: 14px;
  background: rgba(23, 18, 28, 0.98);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.search-result,
.palette-action {
  border-radius: 10px;
}

.search-result:hover,
.palette-action:hover {
  background: var(--primary-soft);
}

/* ---------- Contenu et composants génériques ---------- */

.content {
  width: 100%;
  max-width: 1760px;
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
  padding: clamp(22px, 3vw, 42px) clamp(22px, 3.2vw, 48px) 80px;
}

.content > :first-child {
  margin-top: 0;
}

.grid {
  gap: 18px;
}

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

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.028), transparent 54%),
    var(--surface-1);
  box-shadow: var(--shadow-sm);
}

.card {
  padding: clamp(18px, 2vw, 24px);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.11);
}

.card h2,
.card h3,
.panel h2,
.panel h3 {
  color: var(--text);
  letter-spacing: -0.025em;
}

.card h2 {
  font-size: 18px;
}

.card h3 {
  font-size: 15px;
}

.compact-card {
  padding: 15px;
}

.stack {
  gap: 14px;
}

.section-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 44px;
  margin: 36px 0 16px;
  padding-bottom: 11px;
  gap: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.section-head::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 44px;
  height: 2px;
  content: "";
  border-radius: 2px;
  background: var(--primary);
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.section-head p {
  color: var(--muted);
  font-size: 12px;
}

.section-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.eyebrow {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.metric-value {
  margin: 10px 0 5px;
  color: var(--text);
  font-size: clamp(29px, 3vw, 38px);
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.metric-sub {
  min-height: 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.muted {
  color: var(--muted) !important;
}

.small-text,
small {
  color: var(--muted);
  font-size: 11px;
}

.mono {
  color: #c8bbcD;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.break-word {
  overflow-wrap: anywhere;
}

/* ---------- Boutons et états ---------- */

.button {
  min-height: 40px;
  padding: 9px 14px;
  gap: 8px;
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}

.button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-hover);
  filter: none;
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 11px;
}

.button.primary {
  color: #1a1020;
  border-color: transparent;
  background: linear-gradient(135deg, #d9afe8, #b979cb);
  box-shadow: 0 8px 24px rgba(181, 116, 201, 0.2);
  font-weight: 800;
}

.button.primary:hover {
  color: #140b18;
  background: linear-gradient(135deg, #e3bcef, #c88bd8);
  box-shadow: 0 12px 30px rgba(181, 116, 201, 0.28);
}

.button.success {
  color: var(--success);
  border-color: rgba(126, 216, 180, 0.3);
  background: var(--success-soft);
}

.button.warning {
  color: var(--warning);
  border-color: rgba(241, 199, 123, 0.3);
  background: var(--warning-soft);
}

.button.danger {
  color: var(--danger);
  border-color: rgba(240, 148, 164, 0.3);
  background: var(--danger-soft);
}

.button:disabled {
  opacity: 0.42;
  transform: none;
}

.action-group {
  gap: 8px;
}

.badge {
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  gap: 5px;
  color: var(--neutral);
  border-color: var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.badge.ok,
.badge.success {
  color: var(--success);
  border-color: rgba(126, 216, 180, 0.28);
  background: var(--success-soft);
}

.badge.bad,
.badge.danger {
  color: var(--danger);
  border-color: rgba(240, 148, 164, 0.28);
  background: var(--danger-soft);
}

.badge.warn,
.badge.warning {
  color: var(--warning);
  border-color: rgba(241, 199, 123, 0.28);
  background: var(--warning-soft);
}

.badge.info {
  color: var(--info);
  border-color: rgba(145, 186, 250, 0.28);
  background: var(--info-soft);
}

.badge.primary {
  color: var(--primary);
  border-color: rgba(213, 166, 229, 0.28);
  background: var(--primary-soft);
}

.badge.neutral {
  color: var(--muted-strong);
}

.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(126, 216, 180, 0.08), 0 0 14px rgba(126, 216, 180, 0.5);
}

.dot.warn {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(241, 199, 123, 0.08), 0 0 14px rgba(241, 199, 123, 0.5);
}

/* ---------- Formulaires ---------- */

.toolbar,
.ajax-toolbar {
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 15px;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.field {
  align-content: start;
  min-width: 0;
  gap: 7px;
}

.field > label,
.field-label-row label {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.075em;
}

.field-help,
.field small,
.field p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.input,
.select,
textarea {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #110d15;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.018) inset;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.input::placeholder,
textarea::placeholder {
  color: #716776;
}

.input:hover,
.select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

.input:focus,
.select:focus,
textarea:focus {
  border-color: rgba(213, 166, 229, 0.62);
  background: #151019;
  box-shadow: 0 0 0 3px rgba(213, 166, 229, 0.08);
}

select {
  color-scheme: dark;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}

.textarea-large {
  min-height: 220px;
}

.color-input {
  padding: 4px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 18px;
}

.toggle-row {
  min-height: 48px;
  padding: 11px 12px;
  gap: 11px;
  border-color: var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color var(--ease), background var(--ease);
}

.toggle-row:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.toggle-row strong {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
}

.toggle-row small {
  display: block;
  margin-top: 2px;
}

.toggle-ui {
  width: 39px;
  height: 22px;
  background: #3a303f;
  border-color: #4a3c51;
}

.toggle-row input:checked + .toggle-ui {
  background: var(--primary-strong);
  border-color: var(--primary);
}

.toggle-cluster,
.check-grid,
.role-check-grid {
  gap: 10px;
}

.check-card {
  border-color: var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.inline-control {
  gap: 9px;
}

/* ---------- Tableaux et listes ---------- */

.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-sm);
}

.table-wrap:focus-visible {
  border-color: var(--info);
}

.table {
  min-width: 760px;
  font-size: 12px;
}

.table th {
  height: 45px;
  padding: 10px 14px;
  color: #978c9d;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 11, 17, 0.96);
  backdrop-filter: blur(12px);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.table td {
  padding: 13px 14px;
  color: var(--text-soft);
  border-bottom-color: var(--line-soft);
}

.table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.012);
}

.table tbody tr:hover td {
  background: rgba(213, 166, 229, 0.045);
}

.table td > .button + .button {
  margin-left: 5px;
}

.user-cell {
  gap: 11px;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line-soft);
}

.user-cell strong,
.channel-cell strong {
  color: var(--text);
  font-size: 12px;
}

.identity-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.list-editor {
  gap: 9px;
}

.list-row {
  min-height: 54px;
  padding: 10px 11px;
  gap: 10px;
  border-color: var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.023);
  transition: border-color var(--ease), background var(--ease);
}

.list-row:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.038);
}

.list-empty {
  padding: 18px;
  color: var(--muted);
  border-color: var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.clean-list {
  margin: 0;
  padding-left: 18px;
}

.clean-list li + li {
  margin-top: 7px;
}

.pagination {
  margin: 18px 0 3px;
}

.pagination span {
  min-width: 100px;
  color: var(--muted-strong);
  text-align: center;
}

.bulk-bar {
  top: calc(var(--topbar-height) + 12px);
  padding: 12px 14px;
  border-color: rgba(213, 166, 229, 0.3);
  border-radius: 13px;
  background: rgba(28, 21, 34, 0.94);
  box-shadow: var(--shadow-md);
}

/* ---------- Onglets ---------- */

.tabs,
.view-tabs,
.ticket-tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0 0 20px;
  padding: 4px;
  gap: 3px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.026);
}

.tabs .button,
.view-tabs .button,
.ticket-tabs .button,
.tab {
  min-height: 36px;
  color: var(--muted);
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.tabs .button.active,
.view-tabs .button.active,
.ticket-tabs .button.active,
.tab.active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

/* ---------- Configuration ---------- */

body[data-current-page="config"] .content {
  max-width: 1680px;
}

.config-sticky {
  top: calc(var(--topbar-height) + 12px);
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(520px, 1.3fr);
  align-items: center;
  margin: 0 0 18px;
  padding: 15px 17px;
  gap: 18px;
  border-color: rgba(213, 166, 229, 0.18);
  border-radius: 16px;
  background: rgba(23, 18, 28, 0.94);
  box-shadow: var(--shadow-md);
}

.config-status {
  gap: 9px;
}

.config-status strong {
  color: var(--text);
  font-size: 15px;
}

.config-tools {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.config-tools .input.compact {
  min-width: 220px;
  flex: 1 1 260px;
}

.config-section {
  margin-bottom: 14px;
  overflow: clip;
  scroll-margin-top: calc(var(--topbar-height) + 105px);
  box-shadow: none;
}

.config-section > summary {
  min-height: 58px;
  padding: 16px 19px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 750;
  transition: color var(--ease), background var(--ease);
}

.config-section > summary:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.config-section[open] > summary {
  border-bottom-color: var(--line-soft);
  background: rgba(213, 166, 229, 0.035);
}

.summary-chevron {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.config-body {
  padding: 21px;
}

.config-body .form-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.config-body .field.full {
  grid-column: 1 / -1;
}

.field-label-row {
  align-items: flex-start;
  margin-bottom: 8px;
}

.json-details textarea {
  min-height: 520px;
  background: #0d0a10;
}

.json-editor-actions {
  margin-top: 14px;
}

/* ---------- Callouts, incidents et états vides ---------- */

.callout,
.notice {
  position: relative;
  padding: 14px 16px 14px 18px;
  overflow: hidden;
  color: var(--text-soft);
  border: 1px solid rgba(145, 186, 250, 0.16);
  border-left: 3px solid var(--info);
  border-radius: 11px;
  background: var(--info-soft);
  font-size: 12px;
  line-height: 1.65;
}

.callout::before,
.notice::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 60px;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, rgba(145, 186, 250, 0.06), transparent);
}

.callout.danger,
.danger-zone {
  border-color: rgba(240, 148, 164, 0.2);
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.callout.warning {
  border-color: rgba(241, 199, 123, 0.2);
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.empty {
  min-height: 120px;
  display: grid;
  padding: 30px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.012);
}

.empty.compact {
  min-height: 64px;
  padding: 18px;
}

.error-card {
  border-color: rgba(240, 148, 164, 0.25);
  background: linear-gradient(145deg, rgba(240, 148, 164, 0.07), var(--surface-1));
}

.error-text {
  color: var(--danger);
}

.incident-card,
.incident {
  border-color: rgba(241, 199, 123, 0.16);
}

/* ---------- Modales ---------- */

dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  overflow: hidden;
  border-color: var(--line-strong);
  border-radius: 20px;
  background: #17121c;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(5, 3, 7, 0.76);
  backdrop-filter: blur(8px);
}

dialog form {
  max-height: inherit;
  overflow: auto;
}

.modal-head {
  position: sticky;
  z-index: 4;
  top: 0;
  padding: 20px 22px 16px;
  border-bottom-color: var(--line-soft);
  background: rgba(23, 18, 28, 0.96);
  backdrop-filter: blur(18px);
}

.modal-head h2,
.modal-head h3 {
  margin: 0;
  letter-spacing: -0.025em;
}

.modal-body {
  padding: 22px;
}

.modal-foot {
  position: sticky;
  z-index: 4;
  bottom: 0;
  padding: 14px 22px;
  border-top-color: var(--line-soft);
  background: rgba(23, 18, 28, 0.96);
  backdrop-filter: blur(18px);
}

dialog.modal-wide {
  width: min(1160px, calc(100vw - 34px));
}

.command-palette {
  width: min(720px, calc(100vw - 32px));
}

/* ---------- Sélecteurs de ressources ---------- */

.picker-search {
  padding-bottom: 12px;
  background: #17121c;
}

.picker-list {
  max-height: 480px;
  gap: 8px;
}

.picker-option,
.channel-picker-option {
  min-height: 52px;
  padding: 10px 11px;
  gap: 10px;
  border-color: var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.picker-option:hover,
.channel-picker-option:hover {
  border-color: rgba(213, 166, 229, 0.34);
  background: rgba(213, 166, 229, 0.055);
  transform: translateY(-1px);
}

.channel-picker-toolbar {
  display: flex;
  align-items: flex-end;
  padding-bottom: 15px;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.channel-picker-actions {
  margin: 15px 0;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.channel-picker-groups {
  max-height: min(600px, 58vh);
  padding-right: 5px;
  overflow: auto;
}

.channel-picker-group {
  margin-bottom: 13px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.016);
}

.channel-picker-group > header {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.025);
}

.channel-picker-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
  gap: 8px;
}

.channel-picker-check {
  border-color: var(--line-strong);
}

.channel-picker-option input:checked + .channel-picker-check {
  color: #140b18;
  border-color: var(--primary);
  background: var(--primary);
}

.channel-icon {
  color: var(--muted);
  border-color: var(--line-soft);
  background: var(--surface-2);
}

.anonymous-channel-summary {
  padding: 15px;
  border-color: var(--line-soft);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.anonymous-selected-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.anonymous-selected-channel {
  padding: 10px;
  border-color: var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

/* ---------- Annonces et aperçus Discord ---------- */

.announcement-studio,
.ticket-editor-grid {
  gap: 20px;
}

.editor-pane,
.preview-pane {
  border-color: var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.discord-preview {
  padding: 18px;
  border-color: rgba(255, 255, 255, 0.07);
  border-radius: 13px;
  background: #15171c;
}

.discord-content {
  color: #dbdee1;
}

.discord-embed-preview {
  border-radius: 4px 9px 9px 4px;
  background: #1f2227;
}

.attachment-list {
  gap: 8px;
}

.attachment-chip {
  border-color: var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

/* ---------- Tickets ---------- */

.ticket-kpis {
  gap: 14px;
}

.ticket-filter-card,
.ticket-config-status,
.ticket-open-form,
.ticket-open-empty {
  border-color: var(--line-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.ticket-filter-actions,
.ticket-detail-actions {
  gap: 8px;
}

.ticket-detail-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 18px;
}

.ticket-detail-head {
  margin-bottom: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line-soft);
}

.ticket-person-row,
.ticket-transcript-row,
.ticket-question-row,
.ticket-answer {
  border-color: var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.02);
}

.ticket-question-row {
  padding: 12px;
}

.question-drag {
  color: var(--muted);
}

.ticket-answers {
  gap: 9px;
}

/* ---------- Analytics et graphiques ---------- */

.analytics-page {
  gap: 24px;
}

.analytics-header {
  padding: 24px;
  border: 1px solid rgba(213, 166, 229, 0.15);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 88% 0%, rgba(213, 166, 229, 0.11), transparent 24rem),
    var(--surface-1);
}

.analytics-kpis {
  gap: 14px;
}

.analytics-card {
  border-color: var(--line-soft);
  background: var(--surface-1);
}

.analytics-card-head {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line-soft);
}

.chart-stage {
  min-height: 340px;
  padding: 13px;
  border-color: var(--line-soft);
  background: #100c14;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.07);
}

.chart-axis,
.chart-axis-secondary,
.chart-tick {
  fill: #908496;
}

.chart-tooltip {
  border-color: var(--line-strong);
  border-radius: 11px;
  background: rgba(20, 15, 24, 0.96);
  box-shadow: var(--shadow-md);
}

.chart-legend {
  gap: 8px 14px;
}

.chart-legend-item {
  color: var(--muted-strong);
}

/* ---------- Cartes de domaines ---------- */

.export-card,
.note-card,
.preview-card {
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.022);
}

.detail-grid,
.key-value {
  gap: 10px;
}

.code-block,
.inline-json,
.discord-embed-copy {
  color: #d1c4d6;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #0e0b11;
}

.progress {
  height: 7px;
  background: #0d0a10;
}

.progress > span {
  background: linear-gradient(90deg, var(--primary-strong), var(--primary));
}

/* ---------- Chargement, notifications, flux ---------- */

.skeleton-grid {
  gap: 18px;
}

.skeleton {
  border-color: var(--line-soft);
  background: var(--surface-1);
}

.skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
}

.toast-zone {
  right: 20px;
  bottom: 20px;
  gap: 9px;
}

.toast {
  min-width: min(360px, calc(100vw - 40px));
  padding: 13px 16px;
  color: var(--text-soft);
  border-color: var(--line-strong);
  border-left-color: var(--success);
  border-radius: 12px;
  background: rgba(30, 23, 36, 0.96);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.toast.error {
  border-left-color: var(--danger);
}

.event-drawer {
  right: 18px;
  bottom: 18px;
  width: min(430px, calc(100vw - 36px));
  max-height: min(620px, 68vh);
  border-color: var(--line-strong);
  border-radius: 17px;
  background: rgba(20, 15, 24, 0.97);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.event-drawer-head {
  padding: 14px 15px;
  border-bottom-color: var(--line-soft);
}

.event-drawer-head .eyebrow {
  margin-bottom: 2px;
}

.event-feed {
  max-height: min(530px, 58vh);
  padding: 7px;
}

.event-item {
  padding: 9px 10px;
  border-radius: 10px;
}

.event-item:nth-child(odd) {
  background: rgba(255, 255, 255, 0.025);
}

/* ---------- Responsive ---------- */

@media (max-width: 1480px) {
  .config-body .form-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .global-search {
    min-width: 300px;
  }

  .profile {
    max-width: 170px;
  }
}

@media (max-width: 1240px) {
  :root {
    --sidebar-width: 264px;
  }

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

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

  .topbar {
    gap: 18px;
  }

  .page-description {
    max-width: 46ch;
  }

  .profile span {
    display: none;
  }

  .profile {
    width: 42px;
    padding-right: 4px;
  }

  .config-sticky {
    grid-template-columns: 1fr;
  }

  .config-tools {
    justify-content: flex-start;
  }

  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .global-search {
    min-width: 240px;
  }

  .global-search .input {
    max-width: 280px;
  }

  .shortcut-button {
    display: none;
  }

  .global-search .input {
    padding-right: 12px;
  }

  .announcement-studio,
  .ticket-editor-grid,
  .analytics-panels {
    grid-template-columns: 1fr !important;
  }

  .channel-picker-options,
  .anonymous-selected-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  :root {
    --topbar-height: 106px;
  }

  .app-shell,
  body.sidebar-compact .app-shell {
    display: block;
  }

  .app-shell > main,
  body.sidebar-compact .app-shell > main {
    width: 100%;
    margin-left: 0;
  }

  .sidebar,
  body.sidebar-compact .sidebar {
    z-index: 100;
    width: min(320px, calc(100vw - 42px));
    transform: translateX(-104%);
    box-shadow: 30px 0 90px rgba(0, 0, 0, 0.55);
  }

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

  .sidebar-backdrop {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(5, 3, 7, 0.7);
    opacity: 0;
    backdrop-filter: blur(5px);
    transition: opacity var(--ease), visibility var(--ease);
  }

  body.sidebar-mobile-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }

  body.sidebar-compact .brand-copy,
  body.sidebar-compact .sidebar-collapse,
  body.sidebar-compact .sidebar-search-wrap input,
  body.sidebar-compact .sidebar-search-wrap kbd,
  body.sidebar-compact .nav-group-toggle,
  body.sidebar-compact .nav-text,
  body.sidebar-compact .status-copy,
  body.sidebar-compact .sidebar-footer-actions {
    display: initial;
  }

  body.sidebar-compact .sidebar-collapse {
    display: none;
  }

  body.sidebar-compact .sidebar-brand {
    justify-content: space-between;
    padding-inline: 5px;
  }

  body.sidebar-compact .sidebar-search-wrap {
    justify-content: initial;
    width: auto;
    margin-inline: 3px;
    padding: 0 10px;
  }

  body.sidebar-compact .nav-group-toggle {
    display: flex;
  }

  body.sidebar-compact #navigation [data-page] {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-items: stretch;
    width: 100%;
    padding: 7px 10px 7px 8px;
  }

  body.sidebar-compact .sidebar-footer {
    place-items: stretch;
    padding-inline: 6px;
  }

  body.sidebar-compact .sidebar-footer-actions {
    display: flex;
  }

  .mobile-nav-toggle {
    display: inline-grid;
  }

  .topbar {
    padding: 16px 20px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .global-search {
    min-width: 0;
  }

  .global-search .input {
    width: 220px;
  }

  .page-description {
    display: none;
  }

  .content {
    padding: 24px 20px 70px;
  }

  .config-sticky {
    position: relative;
    top: auto;
  }

  .bulk-bar {
    top: 12px;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: auto;
  }

  .topbar {
    position: sticky;
    align-items: flex-start;
    min-height: 82px;
    padding: 13px 14px;
    gap: 10px;
  }

  .topbar-heading {
    min-width: 0;
  }

  .page-breadcrumb {
    display: none;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 6px;
  }

  .global-search {
    display: none;
  }

  #event-toggle {
    display: none;
  }

  .icon-button,
  .mobile-nav-toggle {
    width: 39px;
    height: 39px;
  }

  .content {
    padding: 18px 13px 58px;
  }

  .cols-2,
  .cols-3,
  .cols-4,
  .form-grid,
  .config-body .form-grid,
  .analytics-kpis,
  .ticket-kpis,
  .compact-grid,
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 16px;
    border-radius: 15px;
  }

  .grid {
    gap: 12px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
    margin-top: 28px;
    gap: 11px;
  }

  .section-actions {
    justify-content: flex-start;
    margin-left: 0;
  }

  .toolbar,
  .ajax-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .toolbar > *,
  .ajax-toolbar > * {
    width: 100%;
  }

  .action-group {
    align-items: stretch;
  }

  .action-group .button {
    flex: 1 1 auto;
  }

  .tabs,
  .view-tabs,
  .ticket-tabs {
    width: 100%;
  }

  .config-sticky {
    padding: 13px;
  }

  .config-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .config-tools .input.compact {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .config-body {
    padding: 15px;
  }

  .field-label-row,
  .channel-picker-toolbar,
  .channel-picker-actions,
  .ticket-detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .field-label-row .action-group,
  .channel-picker-actions .action-group {
    width: 100%;
  }

  .list-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .list-row > .grow {
    flex-basis: calc(100% - 28px);
  }

  .table-wrap {
    margin-inline: -4px;
    border-radius: 12px;
  }

  dialog,
  dialog.modal-wide {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding-inline: 15px;
  }

  .modal-foot {
    flex-wrap: wrap;
  }

  .modal-foot .button {
    flex: 1 1 auto;
  }

  .event-drawer {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .toast-zone {
    right: 10px;
    bottom: 10px;
    left: 10px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .login-screen {
    padding: 12px;
  }

  .login-layout {
    display: block;
    min-height: calc(100vh - 24px);
    border-radius: 22px;
  }

  .login-card {
    min-height: calc(100vh - 24px);
    padding: 28px 22px;
  }

  .login-aside {
    display: none;
  }
}

@media (max-width: 460px) {
  .profile {
    display: none;
  }

  .config-tools {
    grid-template-columns: 1fr;
  }

  .config-tools .input.compact {
    grid-column: auto;
  }

  .button,
  .button.small {
    min-height: 40px;
  }

  .metric-value {
    font-size: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
