/* Lax CRM — same design language as Lax Invoice / Platform / Account */

:root,
html[data-theme="light"] {
  color-scheme: light;
  --font: "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --blue: #3475ba;
  --blue-hover: #2b63a0;
  --blue-soft: #eaf2fa;
  --blue-ring: rgba(52, 117, 186, 0.3);
  --blue-hint: #2a5078;

  --bg: #f2f2f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-soft: #86868b;
  --placeholder: #9aa3ad;
  --surface: #ffffff;
  --paper: #ffffff;
  --paper-soft: #e8e8ed;
  --bg-muted: #e8e8ed;
  --ink: #1d1d1f;
  --on-ink: #ffffff;
  --black: #1d1d1f;
  --white: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);
  --accent: #3475ba;
  --danger: #b42318;
  --danger-bg: #fdecee;
  --danger-border: rgba(180, 35, 24, 0.22);
  --ok-bg: #e8f8ee;
  --nav-hover-bg: rgba(10, 10, 10, 0.04);
  --btn-secondary-hover: #f4f6f8;
  --shadow-lift: 0 16px 40px rgba(15, 23, 42, 0.14);
  --overlay: rgba(15, 23, 42, 0.4);
  --selection: rgba(52, 117, 186, 0.28);

  --ws-radius: 16px;
  --ws-radius-sm: 12px;
  --ws-line: color-mix(in srgb, var(--text) 12%, transparent);
  --ws-hover: color-mix(in srgb, var(--text) 4.5%, transparent);
  --ws-active: color-mix(in srgb, var(--blue) 12%, transparent);
  --ws-shadow: 0 1px 2px rgba(15, 15, 20, 0.05), 0 0 0 1px rgba(15, 15, 20, 0.06);
  --ws-glass: color-mix(in srgb, var(--surface) 88%, transparent);
}

html.dark,
html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #6ba3d9;
  --blue-hover: #8bb8e3;
  --blue-soft: rgba(91, 155, 212, 0.16);
  --blue-ring: rgba(107, 163, 217, 0.38);
  --blue-hint: #c5dbf4;

  --bg: #000000;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --muted-soft: #86868b;
  --placeholder: #6e6e73;
  --surface: #1c1c1e;
  --paper: #1c1c1e;
  --paper-soft: #2c2c2e;
  --bg-muted: #111111;
  --ink: #f5f5f7;
  --on-ink: #000000;
  --black: #f5f5f7;
  --white: #000000;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: #6ba3d9;
  --danger: #ff8a80;
  --danger-bg: rgba(255, 59, 48, 0.16);
  --danger-border: rgba(255, 59, 48, 0.28);
  --ok-bg: rgba(52, 199, 89, 0.16);
  --nav-hover-bg: rgba(255, 255, 255, 0.08);
  --btn-secondary-hover: #2c2c2e;
  --shadow-lift: 0 16px 40px rgba(0, 0, 0, 0.45);
  --overlay: rgba(0, 0, 0, 0.62);
  --selection: rgba(107, 163, 217, 0.38);

  --ws-line: color-mix(in srgb, var(--text) 10%, transparent);
  --ws-hover: color-mix(in srgb, var(--text) 7%, transparent);
  --ws-active: color-mix(in srgb, var(--blue) 18%, transparent);
  --ws-shadow: 0 1px 0 color-mix(in srgb, var(--text) 6%, transparent);
  --ws-glass: color-mix(in srgb, var(--surface) 86%, transparent);
}

html {
  background-color: var(--bg);
  scrollbar-color: var(--border-strong) transparent;
}

body,
.ws-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--selection);
  color: var(--text);
}

::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

option {
  background-color: var(--surface);
  color: var(--text);
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 99999s ease-out;
}

/* ——— Shell (Invoice) ——— */
.ws-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.ws-backdrop { display: none; }
.ws-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.ws-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(1rem, env(safe-area-inset-top)) 0.7rem max(0.85rem, env(safe-area-inset-bottom)) max(0.7rem, env(safe-area-inset-left));
  background: var(--bg);
  border-right: 1px solid var(--ws-line);
  z-index: 30;
}
.ws-sidebar-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}
.ws-sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.55rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.ws-sidebar-brand img { border-radius: 10px; }
.ws-sidebar-brand strong,
.ws-sidebar-brand em { display: block; font-style: normal; }
.ws-sidebar-brand strong {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.ws-sidebar-brand em {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}
.ws-nav-close { display: none; }
.ws-sidebar-mobile { display: none; }
.ws-nav {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 0.4rem;
}
.ws-nav-label {
  margin: 0.85rem 0.7rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-soft);
}
.ws-nav-label:first-child { margin-top: 0.15rem; }
.ws-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.9rem;
  letter-spacing: -0.014em;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ws-nav-link i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.78;
  font-size: 0.82rem;
}
.ws-nav-link:hover {
  background: var(--ws-hover);
  color: var(--text);
}
.ws-nav-link:hover i,
.ws-nav-link.is-active i { opacity: 1; }
.ws-nav-link.is-active {
  background: var(--ws-active);
  color: var(--blue-hint);
  font-weight: 650;
}
.ws-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  padding-top: 0.7rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--ws-line);
}
.ws-sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.ws-sidebar-toggle:hover { background: var(--ws-hover); color: var(--text); }
.ws-sidebar-toggle-out { display: none; }

html.ws-sidebar-collapsed .ws-shell { grid-template-columns: 72px minmax(0, 1fr); }
html.ws-sidebar-collapsed .ws-sidebar { padding-left: 0.45rem; padding-right: 0.45rem; }
html.ws-sidebar-collapsed .ws-sidebar-brand a { justify-content: center; padding-left: 0.2rem; padding-right: 0.2rem; }
html.ws-sidebar-collapsed .ws-sidebar-brand span,
html.ws-sidebar-collapsed .ws-nav-link span,
html.ws-sidebar-collapsed .ws-nav-label,
html.ws-sidebar-collapsed .ws-sidebar-toggle span { display: none; }
html.ws-sidebar-collapsed .ws-nav-link,
html.ws-sidebar-collapsed .ws-sidebar-toggle { justify-content: center; }
html.ws-sidebar-collapsed .ws-sidebar-toggle-in { display: none; }
html.ws-sidebar-collapsed .ws-sidebar-toggle-out { display: inline-flex; }

.ws-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: max(0.4rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 0.4rem max(1.25rem, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(180%) blur(20px);
}
.ws-top-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}
.ws-top-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.ws-top-title {
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.ws-nav-toggle:hover { background: var(--ws-hover); }
.ws-scope select,
.js-company-switcher {
  max-width: 13rem;
  height: 36px;
  padding: 0 1.7rem 0 0.75rem;
  border: 0;
  border-radius: 980px;
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236e6e73' stroke-width='1.8'><path d='m2.5 4.5 3.5 3.5 3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--ws-line);
}
html.dark .js-company-switcher,
html[data-theme="dark"] .js-company-switcher {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a1a1a6' stroke-width='1.8'><path d='m2.5 4.5 3.5 3.5 3.5-3.5'/></svg>");
}
.ws-tabbar { display: none; }
.ws-content:has(#chatApp) {
  max-width: none;
  padding-top: 0.65rem;
}

.ws-content,
.page-shell {
  position: relative;
  padding: 1.35rem max(1.5rem, env(safe-area-inset-right)) max(2.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  max-width: 80rem;
  width: 100%;
  margin-inline: auto;
  min-width: 0;
}

@media (max-width: 1023px) {
  .ws-shell { display: block; }
  .ws-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
  }
  body.ws-nav-open { overflow: hidden; }
  body.ws-nav-open .ws-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .ws-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(20rem, 88vw);
    transform: translateX(-105%);
    transition: transform 0.22s var(--ease);
    z-index: 50;
    border-right: 1px solid var(--ws-line);
    background: var(--bg);
    box-shadow: none;
  }
  body.ws-nav-open .ws-sidebar { transform: translateX(0); }
  html.ws-sidebar-collapsed .ws-shell { grid-template-columns: none; }
  html.ws-sidebar-collapsed .ws-sidebar-brand span,
  html.ws-sidebar-collapsed .ws-nav-link span,
  html.ws-sidebar-collapsed .ws-nav-label { display: block; }
  html.ws-sidebar-collapsed .ws-nav-link { justify-content: flex-start; }
  .ws-sidebar-toggle { display: none; }
  .ws-nav-toggle { display: inline-flex; }
  .ws-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
  }
  .ws-sidebar-mobile { display: block; padding: 0 0.15rem 0.75rem; }
  .ws-sidebar-mobile .js-company-switcher {
    width: 100%;
    max-width: none;
    height: 44px;
    font-size: 16px;
  }
  .ws-scope-top { display: none !important; }
  .ws-nav-primary { display: none; }
  .ws-tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    padding: 0.15rem 0.2rem max(0.28rem, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    border-top: 1px solid var(--ws-line);
    backdrop-filter: blur(18px) saturate(1.2);
  }
  .ws-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.12rem;
    min-height: 52px;
    padding: 0.28rem 0.1rem 0.22rem;
    border: 0;
    background: none;
    color: var(--muted);
    text-decoration: none;
    font: inherit;
    font-size: 0.62rem;
    font-weight: 650;
    cursor: pointer;
  }
  .ws-tab i { font-size: 1.05rem; }
  .ws-tab.is-on { color: var(--blue); }
  .ws-content,
  .page-shell {
    padding: 1rem max(1.05rem, env(safe-area-inset-right)) calc(5.5rem + env(safe-area-inset-bottom)) max(1.05rem, env(safe-area-inset-left));
  }
}

/* Chat thread: one chrome, hide tabbar */
body.wa-thread-open { overflow: hidden; height: 100dvh; }
body.wa-thread-open .ws-tabbar { display: none !important; }
body.wa-thread-open .ws-shell {
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr);
}
body.wa-thread-open .ws-sidebar,
body.wa-thread-open .ws-backdrop { display: none !important; }
body.wa-thread-open .ws-main {
  height: 100dvh;
  min-height: 0;
}
body.wa-thread-open .ws-content,
body.wa-thread-open main.page-shell {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ——— Components ——— */
.lax-card,
.kpi-card,
.chart-card,
.settings-card {
  background: var(--surface);
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-radius);
  box-shadow: var(--ws-shadow);
}
.settings-card { padding: 1.25rem; }
.lax-kicker,
.ws-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--blue);
}
.lax-title {
  margin: 0.15rem 0 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.034em;
  color: var(--text);
  line-height: 1.15;
}
.lax-sub {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.ws-page {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.15rem 0 1.5rem;
  margin: 0;
  flex-wrap: wrap;
}
.ws-page-copy { min-width: 0; flex: 1; }
.ws-h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.15rem);
  letter-spacing: -0.055em;
  line-height: 1.12;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.ws-lead {
  margin: 0.45rem 0 0;
  color: var(--muted);
  max-width: 36em;
  font-size: 1.02rem;
  line-height: 1.47;
  font-weight: 500;
}
.ws-page-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ws-nav-badge {
  margin-left: auto;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  background: #3475ba;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}
.ws-nav-badge:not(.hidden) { display: inline-flex; }
.ws-nav-badge.is-call { background: #b42318; }
.lax-count {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  vertical-align: middle;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
  background: var(--bg-muted);
  color: var(--muted);
}
.lax-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--ws-radius);
  background: var(--surface);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}
.lax-sheet {
  overflow: hidden;
  border-radius: var(--ws-radius);
  background: var(--surface);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}
.section-label {
  margin: 0 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-soft);
}
.contact-tab {
  color: var(--muted);
  border-color: transparent;
}
.contact-tab.border-primary,
.contact-tab.text-gray-900 { color: var(--text); }

.btn,
.lax-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 40px;
  padding: 0 1.15rem;
  border: 0;
  border-radius: 980px;
  background: var(--blue);
  color: #fff !important;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover,
.lax-btn:hover { background: var(--blue-hover); color: #fff !important; filter: none; }
.lax-btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}
button.bg-primary,
a.bg-primary {
  border-radius: 980px;
}
.btn-secondary,
.lax-btn-secondary {
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border);
}
.btn-secondary:hover,
.lax-btn-secondary:hover {
  background: var(--btn-secondary-hover);
  color: var(--text) !important;
}

.date-chip {
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}
.date-chip:hover { border-color: var(--blue); color: var(--blue-hint); }
.date-chip.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.hub-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1.35rem;
  background:
    radial-gradient(1200px 280px at -10% -40%, color-mix(in srgb, var(--blue) 22%, transparent), transparent 55%),
    radial-gradient(800px 240px at 110% 0%, color-mix(in srgb, var(--blue) 12%, transparent), transparent 50%),
    var(--surface);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}
.kpi-card { position: relative; overflow: hidden; border-radius: 1.15rem; }
.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 8rem;
  height: 8rem;
  border-radius: 999px;
  opacity: 0.12;
  background: var(--kpi-glow, var(--blue));
}
.hub-select,
.hub-range {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 2.4rem 0.5rem 1rem;
  appearance: none;
  cursor: pointer;
}
.hub-select:focus,
.hub-range:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-ring);
  border-color: var(--blue);
}
#hubFilters .hub-select,
#reportFilters .hub-select,
#oppFilters select,
#groupFilters select { width: 100%; }

.settings-nav {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
}
@media (min-width: 1024px) {
  .settings-nav {
    flex-direction: column;
    overflow: visible;
    position: sticky;
    top: 3.6rem;
    border-radius: 1rem;
    background: var(--surface);
    padding: 0.5rem;
    border: 1px solid var(--ws-line);
  }
}
.settings-nav button {
  flex-shrink: 0;
  border-radius: 0.75rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.settings-nav button:hover { background: var(--ws-hover); color: var(--text); filter: none; }
.settings-nav button.is-active { background: var(--blue-soft); color: var(--blue-hint); }
.settings-field label { color: var(--text); }
.settings-field input,
.settings-field select,
.settings-field textarea {
  color: var(--text);
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--border);
}
.settings-badge.ok { background: var(--ok-bg); color: #047857; }
html.dark .settings-badge.ok,
html[data-theme="dark"] .settings-badge.ok { color: #6ee7b7; }
.settings-badge.warn { background: color-mix(in srgb, #f59e0b 16%, var(--surface)); color: #b45309; }
html.dark .settings-badge.warn { color: #fcd34d; }
.settings-badge.muted { background: var(--bg-muted); color: var(--muted); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: 36px;
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  border: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--nav-hover-bg); filter: none; }
.theme-toggle .hidden { display: none !important; }
.theme-picker { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .theme-picker { grid-template-columns: 1fr 1fr; } }
.theme-pick,
.theme-pick-system {
  text-align: left;
  border-radius: 1rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.theme-pick:hover,
.theme-pick-system:hover { border-color: color-mix(in srgb, var(--blue) 45%, transparent); filter: none; }
.theme-pick.is-active,
.theme-pick-system.is-active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-ring);
  background: var(--blue-soft);
}
.theme-pick-preview {
  height: 4.4rem;
  border-radius: 0.65rem;
  overflow: hidden;
  margin-bottom: 0.55rem;
  border: 1px solid var(--border);
}
.theme-pick-preview.is-light { background: #f2f2f7; }
.theme-pick-preview.is-dark { background: #000; }
.theme-pick-preview .bar { height: 0.85rem; }
.theme-pick-preview.is-light .bar { background: #3475ba; }
.theme-pick-preview.is-dark .bar { background: #1c1c1e; }
.theme-pick-preview .card {
  margin: 0.45rem;
  height: 1.7rem;
  border-radius: 0.35rem;
}
.theme-pick-preview.is-light .card { background: #fff; border: 1px solid #e3e7eb; }
.theme-pick-preview.is-dark .card { background: #1c1c1e; border: 1px solid rgba(255,255,255,.12); }
.theme-pick-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 650;
}
.theme-pick-hint { margin: 0.2rem 0 0; font-size: 0.7rem; color: var(--muted); }
.theme-pick-system { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; }
.theme-pick-check {
  display: none;
  height: 1.15rem;
  width: 1.15rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}
.theme-pick.is-active .theme-pick-check,
.theme-pick-system.is-active .theme-pick-check { display: inline-flex; }

/* Tailwind gray/white → tokens (no hover filter, keep contrast) */
html.dark .bg-white,
html.dark .bg-white\/95 { background-color: var(--surface) !important; }
html.dark .bg-gray-50,
html.dark .bg-slate-50,
html.dark .bg-gray-100 { background-color: var(--bg-muted) !important; }
html.dark .bg-gray-200 { background-color: var(--paper-soft) !important; }
html.dark .text-gray-900,
html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark .text-gray-800 { color: var(--text) !important; }
html.dark .text-gray-700,
html.dark .text-slate-700,
html.dark .text-gray-600,
html.dark .text-slate-600 { color: var(--muted) !important; }
html.dark .text-gray-500,
html.dark .text-slate-500,
html.dark .text-gray-400,
html.dark .text-slate-400 { color: var(--muted-soft) !important; }
html.dark .text-amber-950 { color: #fde68a !important; }
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-slate-200,
html.dark .border-gray-300 { border-color: var(--border) !important; }
html.dark .ring-gray-200,
html.dark .ring-gray-300,
html.dark .ring-inset.ring-gray-200 { --tw-ring-color: var(--border) !important; }
html.dark .ring-slate-950\/5,
html.dark .ring-slate-900\/5 { --tw-ring-color: var(--border) !important; }
html.dark .text-amber-950 { color: #fde68a !important; }
html.dark .bg-sky-50 { background-color: var(--blue-soft) !important; }
html.dark .text-sky-600 { color: var(--blue) !important; }
html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }
html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-gray-100:hover { background-color: var(--ws-hover) !important; }
html.dark .hover\:text-gray-900:hover,
html.dark .hover\:text-gray-800:hover { color: var(--text) !important; }
html.dark .bg-blue-50 { background-color: var(--blue-soft) !important; }
html.dark .text-primary { color: var(--blue) !important; }
html.dark .bg-green-50,
html.dark .bg-emerald-50 { background-color: var(--ok-bg) !important; }
html.dark .bg-green-100 { background-color: rgba(52, 199, 89, 0.22) !important; }
html.dark .text-green-800,
html.dark .text-green-700,
html.dark .text-emerald-800,
html.dark .text-emerald-700 { color: #6ee7b7 !important; }
html.dark .bg-amber-50 { background-color: rgba(245, 158, 11, 0.16) !important; }
html.dark .text-amber-800,
html.dark .text-amber-700 { color: #fcd34d !important; }
html.dark .border-amber-200 { border-color: rgba(245, 158, 11, 0.35) !important; }
html.dark .bg-red-50,
html.dark .bg-red-100 { background-color: var(--danger-bg) !important; }
html.dark .text-red-800,
html.dark .text-red-700,
html.dark .text-red-600 { color: var(--danger) !important; }
html.dark .hover\:bg-red-50:hover { background-color: var(--danger-bg) !important; }
html.dark .bg-gray-500\/75,
html.dark .bg-gray-900\/40 { background-color: var(--overlay) !important; }
html.dark .shadow-sm,
html.dark .shadow,
html.dark .shadow-lg,
html.dark .shadow-xl { box-shadow: var(--ws-shadow) !important; }

html.dark .bg-primary { background-color: var(--blue) !important; color: #fff !important; }
html.dark .text-white { color: #fff !important; }
html.dark a.bg-primary,
html.dark button.bg-primary { color: #fff !important; }
html.dark button.bg-slate-900,
html.dark a.bg-slate-900,
html.dark button.bg-gray-900,
html.dark a.bg-gray-900,
html.dark button.hover\:bg-slate-800:hover,
html.dark a.hover\:bg-blue-600:hover,
html.dark button.hover\:bg-blue-600:hover {
  background-color: var(--blue) !important;
  color: #fff !important;
}
html.dark button.hover\:bg-slate-800:hover,
html.dark a.hover\:bg-blue-600:hover,
html.dark button.hover\:bg-blue-600:hover { background-color: var(--blue-hover) !important; }
html.dark .text-blue-600,
html.dark .text-blue-700,
html.dark .text-indigo-600,
html.dark .text-indigo-500,
html.dark .text-violet-600 { color: var(--blue) !important; }
html.dark .bg-indigo-50,
html.dark .bg-violet-50 { background-color: var(--blue-soft) !important; }
html.dark .ring-white { --tw-ring-color: var(--surface) !important; }
html.dark .border-white { border-color: var(--surface) !important; }
html.dark .from-blue-600 { --tw-gradient-from: #2b63a0 !important; }
html.dark #messagesArea .bg-white { color: var(--text) !important; }

/* Chat composer / panels */
html.dark #inboxThreadPane .chat-composer,
html.dark .wa-reply-bar,
html.dark .wa-emoji-panel,
html.dark .wa-format-hint {
  background: var(--surface) !important;
}
html.dark .wa-emoji-grid button:hover { background: var(--ws-hover); }
html.dark .wa-msg-actions button,
html.dark #waReactionPicker {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lift);
}
html.dark #messagesArea .bg-white { background-color: var(--paper-soft) !important; }
html.dark .wa-reaction-chip {
  background: var(--paper-soft);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border);
}

html.dark .theme-preserve,
html.dark .theme-preserve .bg-white { background-color: #fff !important; }
html.dark .theme-preserve .text-slate-800,
html.dark .theme-preserve .text-gray-900 { color: #0f172a !important; }

.lax-hide-role { display: none !important; }
[x-cloak] { display: none !important; }
.lax-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
  font-weight: 600;
}

/* ——— Polish: lists, modals, filters, pager (Invoice) ——— */
.ws-page-actions.hidden { display: none !important; }
.dup-banner.hidden,
.dup-stats.hidden,
.dup-progress.hidden,
.dup-status.hidden,
.dup-overlay.hidden { display: none !important; }

.ws-content .rounded-2xl.bg-white,
.ws-content .rounded-xl.bg-white,
.ws-content .rounded-lg.bg-white {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}

.bg-gray-500\/75 {
  background: var(--overlay) !important;
}
.relative.w-full.rounded-t-2xl.bg-white {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--ws-line);
}

.ws-content input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
.ws-content select {
  min-height: 40px;
  background: var(--surface);
  color: var(--text);
}
.ws-content textarea {
  background: var(--surface);
  color: var(--text);
}
#chatApp input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
#chatApp select {
  min-height: 0;
}

button.rounded-xl.border,
button.rounded-md.border {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 1.15rem;
  border-radius: 980px !important;
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  font-weight: 600;
  font-size: 0.875rem;
}
button.rounded-xl.border:hover,
button.rounded-md.border:hover {
  background: var(--btn-secondary-hover);
  filter: none;
}

button.bg-primary:not(.lax-btn),
a.bg-primary:not(.lax-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0 1.15rem;
  border-radius: 980px;
  font-weight: 600;
}
#sendBtn {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 980px;
}
#chatApp .chat-composer button.rounded-lg {
  border-radius: 980px;
  min-height: 40px;
}

.ws-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}
.ws-pager-meta {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--muted);
}
.ws-pager-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.ws-pager-btn,
.ws-pager-num {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--ws-line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}
.ws-pager-btn:hover,
.ws-pager-num:hover { border-color: var(--border-strong); filter: none; }
.ws-pager-num.is-on {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}
.ws-pager-btn:disabled,
.ws-pager-btn.is-off {
  opacity: 0.38;
  pointer-events: none;
}
.ws-pager-gap {
  min-width: 1.1rem;
  text-align: center;
  color: var(--muted);
  font-weight: 650;
}

.lax-chat-toasts {
  position: fixed;
  top: calc(0.75rem + env(safe-area-inset-top));
  right: 0.75rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(22.5rem, calc(100vw - 1.5rem));
  pointer-events: none;
}
.lax-chat-toast {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem 0.9rem 0.8rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--ws-radius-sm);
  box-shadow: var(--shadow-lift);
  animation: lax-chat-toast-in 0.28s var(--ease);
}
.lax-chat-toast.is-out {
  animation: lax-chat-toast-out 0.2s var(--ease) forwards;
}
.lax-chat-toast-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}
.lax-chat-toast-icon {
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #25d366;
  color: #fff;
  font-size: 1.05rem;
}
.lax-chat-toast-copy { min-width: 0; flex: 1; }
.lax-chat-toast-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.lax-chat-toast-name {
  margin: 0.12rem 0 0;
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.25;
}
.lax-chat-toast-preview {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lax-chat-toast-dismiss {
  flex: none;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.lax-chat-toast-dismiss:hover { color: var(--text); filter: none; }
.lax-chat-toast-go {
  height: 36px;
  width: 100%;
  font-size: 0.86rem;
}
@keyframes lax-chat-toast-in {
  from { opacity: 0; transform: translateY(-0.6rem) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes lax-chat-toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-0.4rem); }
}
@media (max-width: 767px) {
  .lax-chat-toasts {
    top: auto;
    right: 0.7rem;
    left: 0.7rem;
    width: auto;
    bottom: calc(4.6rem + env(safe-area-inset-bottom));
  }
}
body.wa-thread-open .lax-chat-toasts {
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

/* ——— Doublons ——— */
.dup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.dup-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--ws-line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}
.dup-stat strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.dup-progress {
  height: 3px;
  margin: -0.35rem 0 1rem;
  border-radius: 999px;
  background: var(--paper-soft);
  overflow: hidden;
}
.dup-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.35s var(--ease);
}
.dup-status {
  margin: -0.35rem 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
}
.dup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
@media (min-width: 900px) {
  .dup-grid { grid-template-columns: 1fr 1fr; }
}
.dup-card {
  content-visibility: auto;
  contain: content;
  padding: 0.85rem 0.9rem 0.55rem;
}
.dup-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}
.dup-phone {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.dup-card-meta {
  margin: 0.12rem 0 0;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
}
.dup-card-merge {
  height: 32px;
  padding: 0 0.85rem;
  font-size: 0.75rem;
  flex: none;
}
.dup-rows { display: flex; flex-direction: column; gap: 0.2rem; }
.dup-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.5rem;
  border-radius: 12px;
  cursor: pointer;
}
.dup-row:hover { background: var(--ws-hover); }
.dup-row.is-keep { background: var(--blue-soft); }
.dup-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}
.dup-row.is-keep .dup-radio {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 3.5px var(--blue);
}
.dup-ava {
  flex: none;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  background: var(--paper-soft);
  color: var(--muted);
}
.dup-row.is-keep .dup-ava {
  background: var(--blue);
  color: #fff;
}
.dup-row-copy { min-width: 0; flex: 1; }
.dup-row-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.dup-row-name:hover { color: var(--blue); }
.dup-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.12rem;
  font-size: 0.7rem;
  color: var(--muted);
}
.dup-chip {
  display: inline-flex;
  align-items: center;
  height: 1.15rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  background: var(--paper-soft);
  color: var(--muted);
}
.dup-chip.is-client { background: var(--blue-soft); color: var(--blue-hint); }
.dup-chip.is-wa { background: var(--ok-bg); color: #128c45; }
html.dark .dup-chip.is-wa,
html[data-theme="dark"] .dup-chip.is-wa { color: #6ee7a0; }
.dup-keep {
  display: none;
  font-weight: 750;
  color: var(--blue);
}
.dup-row.is-keep .dup-keep { display: inline; }
.dup-more {
  margin: 0.15rem 0.5rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
}
.dup-empty,
.dup-skel-wrap,
.dup-error {
  padding: 2.4rem 1.2rem;
  text-align: center;
}
.dup-empty-mark,
.dup-error-mark {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.7rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ok-bg);
  color: #128c45;
  font-size: 1.05rem;
}
.dup-error-mark { background: var(--danger-bg); color: var(--danger); }
.dup-empty h2,
.dup-error h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--text);
}
.dup-empty p,
.dup-error p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.dup-empty .lax-btn { margin-top: 1rem; }
.dup-skel {
  height: 8.5rem;
  border-radius: var(--ws-radius);
  background: linear-gradient(90deg, var(--paper-soft) 25%, var(--surface) 50%, var(--paper-soft) 75%);
  background-size: 200% 100%;
  animation: dup-shimmer 1.1s linear infinite;
}
.dup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
}
@media (min-width: 640px) {
  .dup-overlay { align-items: center; }
}
.dup-overlay-bg {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}
.dup-sheet {
  position: relative;
  width: min(26rem, 100%);
  padding: 1.15rem 1.15rem 1.05rem;
  border-radius: 1.25rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  border: 1px solid var(--border);
}
.dup-sheet-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.dup-sheet h2 {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.dup-sheet p {
  margin: 0.45rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}
.dup-sheet-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.05rem;
}
.dup-sheet-actions .lax-btn,
.dup-sheet-actions .lax-btn-secondary { height: 36px; font-size: 0.84rem; }
.dup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin-bottom: 1rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--ws-radius);
  background: var(--surface);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}
.dup-banner-copy {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.dup-banner-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.8rem;
  flex: none;
}
.dup-banner-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text);
}
.dup-banner-meta {
  margin: 0.1rem 0 0;
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--muted);
}
.dup-banner-go {
  height: 32px;
  padding: 0 0.9rem;
  font-size: 0.75rem;
}
@keyframes dup-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dup-skel, .dup-progress-bar, .ct-skel { animation: none; transition: none; }
}

/* ——— Contacts list ——— */
.ct-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}
.ct-search {
  width: 100%;
  height: 40px;
  padding: 0 0.95rem 0 2.35rem;
  border: 1px solid var(--border);
  border-radius: 980px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round'><circle cx='7' cy='7' r='5'/><path d='M11 11l3.2 3.2'/></svg>") 0.9rem 50% no-repeat;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.ct-search::placeholder { color: var(--placeholder); }
.ct-search:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}
.ct-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.ct-select {
  height: 36px;
  min-width: 0;
  flex: 1 1 9.5rem;
  max-width: 100%;
  padding: 0 1.8rem 0 0.8rem;
  border: 1px solid var(--border);
  border-radius: 980px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round'><path d='M1 1.2L6 6.2 11 1.2'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
.ct-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}
.ct-chips {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: none;
}
.ct-chips::-webkit-scrollbar { display: none; }
.ct-chips .date-chip {
  padding: 0.32rem 0.75rem;
  font-size: 0.75rem;
}
.ct-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  max-width: 22rem;
  margin-bottom: 0.85rem;
}
.ct-dates label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
}
.ct-dates input {
  width: 100%;
  height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.ct-sheet {
  overflow: hidden;
  border-radius: var(--ws-radius);
  background: var(--surface);
  border: 1px solid var(--ws-line);
  box-shadow: var(--ws-shadow);
}
.ct-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.ct-table th,
.ct-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: middle;
  font-size: 0.82rem;
}
.ct-table th {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 3.5%, var(--surface));
  border-bottom: 1px solid var(--ws-line);
}
.ct-table td {
  border-bottom: 1px solid var(--ws-line);
  color: var(--text);
}
.ct-table tbody tr:last-child td { border-bottom: 0; }
.ct-table tbody tr { cursor: pointer; }
.ct-table tbody tr:hover td { background: var(--ws-hover); }
.ct-col-name { width: 32%; }
.ct-col-phone { width: 18%; }
.ct-col-type { width: 12%; }
.ct-col-dept { width: 16%; }
.ct-col-date { width: 14%; }
.ct-col-act { width: 8%; }
.ct-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.ct-ava {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 750;
  background: var(--paper-soft);
  color: var(--muted);
}
.ct-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.ct-name:hover { color: var(--blue); }
.ct-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.08rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.ct-phone {
  color: inherit;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ct-phone:hover { color: var(--blue); }
.ct-muted { color: var(--muted); font-weight: 550; }
.ct-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.ct-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.15rem;
}
.ct-icon {
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.ct-icon:hover { background: var(--ws-hover); color: var(--text); }
.ct-icon.is-danger:hover { background: var(--danger-bg); color: var(--danger); }
.ct-empty {
  padding: 2.6rem 1.2rem;
  text-align: center;
}
.ct-empty h2 {
  margin: 0.55rem 0 0;
  font-size: 1.02rem;
  font-weight: 750;
  color: var(--text);
}
.ct-empty p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.ct-empty-mark {
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--blue);
}
.ct-skel {
  height: 3.05rem;
  margin: 0.35rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--paper-soft) 25%, var(--surface) 50%, var(--paper-soft) 75%);
  background-size: 200% 100%;
  animation: dup-shimmer 1.1s linear infinite;
}
.ct-new-short { display: none; }
.ct-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
}
@media (min-width: 640px) {
  .ct-modal { align-items: center; }
}
.ct-modal-bg {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}
.ct-modal-sheet {
  position: relative;
  width: min(28rem, 100%);
  max-height: min(92dvh, 40rem);
  overflow: auto;
  padding: 1.15rem 1.15rem 1.05rem;
  border-radius: 1.25rem 1.25rem 0.85rem 0.85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
}
@media (min-width: 640px) {
  .ct-modal-sheet { border-radius: 1.25rem; }
}
.ct-modal-sheet h2 {
  margin: 0 0 0.9rem;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.ct-field { display: flex; flex-direction: column; gap: 0.28rem; }
.ct-field span {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
}
.ct-field input,
.ct-field select {
  height: 40px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.ct-field input:focus,
.ct-field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}
.ct-form {
  display: grid;
  gap: 0.7rem;
}
.ct-form-2 {
  display: grid;
  gap: 0.7rem;
}
@media (min-width: 520px) {
  .ct-form-2 { grid-template-columns: 1fr 1fr; }
}
.ct-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.ct-form-error { margin: 0; font-size: 0.8rem; font-weight: 650; color: var(--danger); }
.ct-modal.hidden { display: none !important; }
.ct-dates.hidden { display: none !important; }

@media (max-width: 879px) {
  .ct-new-full { display: none; }
  .ct-new-short { display: inline; }
  .ct-table thead { display: none; }
  .ct-table,
  .ct-table tbody,
  .ct-table tr,
  .ct-table td { display: block; width: 100%; }
  .ct-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.5rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--ws-line);
  }
  .ct-table tbody tr:last-child { border-bottom: 0; }
  .ct-table td {
    padding: 0;
    border: 0;
    background: none !important;
  }
  .ct-col-name { grid-column: 1; grid-row: 1; }
  .ct-col-act { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .ct-col-phone,
  .ct-col-type { grid-column: 1; }
  .ct-col-phone { grid-row: 2; }
  .ct-col-type { grid-row: 3; }
  .ct-col-dept,
  .ct-col-date { display: none; }
  .ct-phone { font-size: 0.78rem; color: var(--muted); }
}

/* ——— Accueil / hub ——— */
.hub-section-title {
  margin: 1.15rem 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.hub-kpi-alert .hub-kpi-value { color: #b42318; }
.hub-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (min-width: 880px) {
  .hub-kpis { grid-template-columns: repeat(4, 1fr); }
}
.hub-kpi {
  display: block;
  padding: 0.95rem 1.05rem 0.9rem;
  text-decoration: none;
  color: inherit;
}
.hub-kpi-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--muted);
}
.hub-kpi-value {
  margin: 0.2rem 0 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hub-kpi-hint {
  margin: 0.28rem 0 0;
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--muted);
}
.hub-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  margin: 0.55rem 0 1.15rem;
  padding: 0.7rem 1rem;
}
.hub-strip p {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--muted);
}
.hub-strip strong {
  color: var(--text);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.hub-error {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 650;
}
.hub-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}
@media (min-width: 900px) {
  .hub-panels { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .hub-panels-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.hub-panel {
  padding: 0.95rem 1.05rem 0.85rem;
}
.hub-panel-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.hub-panel h2 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 750;
  color: var(--text);
}
.hub-panel-link {
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--blue);
  text-decoration: none;
}
.hub-panel-link:hover { text-decoration: underline; }
.hub-chart { position: relative; height: 13.25rem; }
.hub-evo { position: relative; height: 16rem; }
.hub-chart.is-empty,
.hub-evo.is-empty { height: auto; }
.hub-empty {
  margin: 0;
  padding: 2.2rem 0.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.hub-grain {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
}
.hub-list { margin: 0; padding: 0; list-style: none; }
.hub-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--ws-line);
  text-decoration: none;
  color: inherit;
}
.hub-item:last-child { border-bottom: 0; }
.hub-item:hover .hub-item-name { color: var(--blue); }
.hub-item-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}
.hub-item-meta {
  display: block;
  margin-top: 0.08rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.hub-item-copy { min-width: 0; flex: 1; }
.hub-period { margin: 0.15rem 0 0; font-size: 0.8rem; font-weight: 550; color: var(--muted); }
.kpi-card::after { display: none; }
