/* ========= SF Pro Display Font Family ========= */
@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-thinitalic.woff2') format('woff2');
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-ultralight.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-ultralightitalic.woff2') format('woff2');
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-lightitalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-regularitalic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-mediumitalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-semibolditalic.woff2') format('woff2');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-bolditalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-heavy.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-heavyitalic.woff2') format('woff2');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Pro Display';
  src: url('/fonts/sf-pro-display-blackitalic.woff2') format('woff2');
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

/* ========= SF Mono Font Family ========= */
@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-lightitalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-regularitalic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-mediumitalic.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-semibolditalic.woff2') format('woff2');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-bolditalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-heavy.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SF Mono';
  src: url('/fonts/sfmono-heavyitalic.woff2') format('woff2');
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

/* ========= Base ========= */
:root {
  color-scheme: light;
  --color-primary: #2563eb;
  --color-primary-strong: #1d4ed8;
  --color-primary-soft: #e0ecff;
  --color-bg: #f3f5f8;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-muted-strong: #475569;
  --bg: var(--color-bg);
  --panel: var(--color-surface);
  --card: var(--color-surface);
  --text: var(--color-text);
  --muted: var(--color-muted);
  --border: var(--color-border);
  --input: var(--color-surface-alt);
  --bubble-in: var(--color-surface);
  --bubble-out: var(--color-primary-soft);
  --ig: #E1306C;
  --ig-soft: rgba(225, 48, 108, 0.10);
  --ig-soft2: rgba(225, 48, 108, 0.06);
  --ig-border: rgba(225, 48, 108, 0.35);
  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --topbar-bg: var(--color-surface);
  --topbar-border: var(--color-border);
  --topbar-text: var(--color-text);
  --topbar-title: var(--color-muted-strong);
  --topbar-pill-bg: var(--color-surface-alt);
  --topbar-pill-text: var(--color-text);
  --topbar-pill-border: var(--color-border);
  --topbar-pill-hover: var(--color-surface);
  --topbar-pill-border-hover: var(--color-border);
  --topbar-toggle-bg: var(--color-surface-alt);
  --topbar-toggle-border: var(--color-border);
  --topbar-toggle-color: var(--color-muted-strong);
  --topbar-toggle-hover: var(--color-surface);
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-skeleton: #e2e8f0;
  --color-skeleton-shine: #f8fafc;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.14);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --font-12: 12px;
  --font-14: 14px;
  --font-16: 16px;
  --font-18: 18px;
  --font-ui: "SF Pro Display", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", emoji;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: var(--color-bg);
  --panel: var(--color-surface);
  --card: var(--color-surface);
  --text: var(--color-text);
  --muted: var(--color-muted);
  --border: var(--color-border);
  --input: var(--color-surface-alt);
  --bubble-in: var(--color-surface);
  --bubble-out: var(--color-primary-soft);
  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --topbar-bg: var(--color-surface);
  --topbar-border: var(--color-border);
  --topbar-text: var(--color-text);
  --topbar-title: var(--color-muted-strong);
  --topbar-pill-bg: var(--color-surface-alt);
  --topbar-pill-text: var(--color-text);
  --topbar-pill-border: var(--color-border);
  --topbar-pill-hover: var(--color-surface);
  --topbar-pill-border-hover: var(--color-border);
  --topbar-toggle-bg: var(--color-surface-alt);
  --topbar-toggle-border: var(--color-border);
  --topbar-toggle-color: var(--color-muted-strong);
  --topbar-toggle-hover: var(--color-surface);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #5b8cff;
  --color-primary-strong: #4c7dff;
  --color-primary-soft: #1d2b44;
  --color-bg: #0b1118;
  --color-surface: #121a24;
  --color-surface-alt: #0f1620;
  --color-border: #1f2a37;
  --color-text: #e2e8f0;
  --color-muted: #94a3b8;
  --color-muted-strong: #cbd5e1;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #f87171;
  --color-skeleton: #1f2a37;
  --color-skeleton-shine: #243244;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea,
select {
  font-family: var(--font-ui);
}

code,
pre,
kbd,
samp,
.mono {
  font-family: var(--font-mono);
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  font-size: var(--font-12);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.title {
  font-weight: 700;
}

/* ========= Layout shell ========= */
.layout-shell {
  overflow: hidden;
}

.no-scroll {
  overflow: hidden;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.sidebar-nav {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 14px;
  gap: 16px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-logo {
  height: 31px;
  border-radius: 0;
  display: block;
}

.contact.channel-webchat {
  border-left: 3px solid rgba(29, 155, 189, 0.3);
}

.contact.channel-webchat:hover {
  background: linear-gradient(90deg, rgba(29, 155, 189, 0.08) 0%, rgba(29, 155, 189, 0.02) 100%);
}

.contact.channel-webchat.active {
  background: linear-gradient(90deg, rgba(29, 155, 189, 0.14) 0%, rgba(29, 155, 189, 0.04) 100%);
  border-left-color: rgba(29, 155, 189, 0.78);
}

.contact.channel-webchat .unread-badge {
  background: linear-gradient(135deg, #0891b2 0%, #0ea5b7 100%);
}

.avatar--webchat {
  background: #7c3aed;
  color: #fff;
}

.avatar--webchat svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-webchat-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #7c3aed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-webchat-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.chat-header.channel-webchat {
  background: linear-gradient(135deg, rgba(239, 252, 255, 0.96) 0%, rgba(226, 246, 250, 0.96) 100%);
}

.message.channel-webchat .bubble {
  border-color: rgba(14, 165, 183, 0.16);
}

.message.in.channel-webchat .bubble {
  background: linear-gradient(180deg, rgba(244, 252, 254, 0.98) 0%, rgba(236, 249, 252, 0.98) 100%);
}

.message.out.channel-webchat .bubble {
  background: linear-gradient(180deg, rgba(225, 247, 251, 0.98) 0%, rgba(214, 242, 248, 0.98) 100%);
}

.send-btn-webchat {
  background: linear-gradient(135deg, #0891b2 0%, #0ea5b7 100%);
  color: #fff;
}

.send-btn-webchat:hover {
  background: linear-gradient(135deg, #0b7f9d 0%, #1098ad 100%);
}

.send-btn-webchat:active {
  transform: translateY(1px);
}

html[data-theme="dark"] .contact.channel-webchat:hover {
  background: linear-gradient(90deg, rgba(25, 122, 146, 0.18) 0%, rgba(25, 122, 146, 0.06) 100%);
}

html[data-theme="dark"] .contact.channel-webchat.active {
  background: linear-gradient(90deg, rgba(25, 122, 146, 0.28) 0%, rgba(25, 122, 146, 0.08) 100%);
}

html[data-theme="dark"] .avatar--webchat {
  background: #8b5cf6;
  color: #fff;
}

html[data-theme="dark"] .channel-badge.channel-webchat-icon {
  background: transparent;
  color: #8b5cf6;
  border-color: transparent;
}

html[data-theme="dark"] .chat-header.channel-webchat {
  background: linear-gradient(135deg, rgba(13, 42, 50, 0.96) 0%, rgba(10, 34, 41, 0.96) 100%);
}

html[data-theme="dark"] .message.in.channel-webchat .bubble {
  background: linear-gradient(180deg, rgba(18, 46, 55, 0.94) 0%, rgba(14, 38, 46, 0.94) 100%);
  border-color: rgba(103, 232, 249, 0.14);
}

html[data-theme="dark"] .message.out.channel-webchat .bubble {
  background: linear-gradient(180deg, rgba(9, 79, 97, 0.88) 0%, rgba(8, 110, 126, 0.88) 100%);
  border-color: rgba(103, 232, 249, 0.2);
}

html[data-theme="dark"] .send-btn-webchat {
  background: linear-gradient(135deg, #0b7f9d 0%, #1098ad 100%);
}

html[data-theme="dark"] .send-btn-webchat:hover {
  background: linear-gradient(135deg, #0d91b0 0%, #14b4ca 100%);
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-item {
  color: var(--sidebar-text);
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .12s ease, color .12s ease;
}

.nav-group-header > .nav-item {
  flex: 1 1 auto;
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.nav-item-icon-filled {
  display: none !important;
}

.nav-item[data-route="chat"] {
  gap: 12px;
}

.nav-item[data-route="dashboard"] {
  gap: 12px;
}

.nav-item[data-route="team"] {
  gap: 12px;
}

.nav-item[data-route="users"] {
  gap: 12px;
}

.nav-item[data-route="settings"] {
  gap: 12px;
}

.nav-item[data-route="ai"] {
  gap: 12px;
}

.nav-group-toggle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}

.nav-group-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.nav-group-toggle:hover {
  background: var(--sidebar-hover);
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
}

.nav-subitem {
  font-size: 14px;
  min-height: 40px;
}

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

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

.nav-item.is-parent-active {
  background: rgba(37, 99, 235, 0.16);
  color: #dbeafe;
}

.nav-item.active .nav-item-icon-outline {
  display: none !important;
}

.nav-item.active .nav-item-icon-filled {
  display: block !important;
}

.nav-item:hover {
  background: var(--sidebar-hover);
}

.nav-item.active {
  background: #2563eb;
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
}

.sidebar-theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.theme-toggle-option {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  min-height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.theme-toggle-option:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle-option:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

.theme-toggle-option.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(3, 7, 18, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.theme-toggle-option svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.topbar {
  min-height: 60px;
  background: var(--topbar-bg);
  /* Dark slate - only topbar */
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: var(--topbar-text);
}

.topbar-left {
  display: flex;
  align-items: center;
}

.topbar-left .title {
  font-size: 15px;
  font-weight: 500;
  color: var(--topbar-title);
  letter-spacing: 0.3px;
}

#page-title {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.build-stamp {
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: none;
}

.build-stamp.is-visible {
  display: flex;
  align-items: center;
}

.profile-menu-wrap {
  position: relative;
  z-index: 120;
  isolation: isolate;
}

.support-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  margin: 12px 18px 0;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.03));
}

.support-mode-banner.hidden {
  display: none;
}

.support-mode-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.support-mode-banner-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
}

.support-mode-banner-text {
  color: var(--color-text);
  font-size: 14px;
}

.platform-body {
  --platform-bg: #f4f7fb;
  --platform-surface: #ffffff;
  --platform-surface-soft: #f8fafc;
  --platform-border: #dbe4f0;
  --platform-text: #0f172a;
  --platform-muted: #64748b;
  --platform-primary: #2563eb;
  --platform-primary-soft: #e8f0ff;
  --platform-dark: #0f172a;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 22%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, var(--platform-bg) 42%, #eef4fb 100%);
  color: var(--platform-text);
}

.platform-body * {
  box-sizing: border-box;
}

.platform-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
}

.platform-sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  border-right: 1px solid var(--platform-border);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(16px);
  padding: 28px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.platform-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 14px;
}

.platform-brand-logo {
  width: 122px;
  height: auto;
}

.platform-brand-eyebrow,
.platform-main .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7b8aa3;
  font-weight: 700;
}

.platform-brand-title {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--platform-dark);
}

.platform-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #475569;
  padding: 13px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background .18s ease,
    border-color .18s ease,
    color .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
}

.platform-nav-item:hover {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(37, 99, 235, 0.14);
  color: var(--platform-dark);
  transform: translateY(-1px);
}

.platform-nav-item.is-active {
  background: linear-gradient(180deg, #eff5ff 0%, #e6efff 100%);
  border-color: rgba(37, 99, 235, 0.20);
  color: var(--platform-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.platform-nav-item:focus-visible,
.platform-mini-item:focus-visible,
.platform-actions-cell .btn:focus-visible,
.platform-sidebar-footer .btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.platform-sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.platform-sidebar-footer .btn {
  width: 100%;
  justify-content: center;
  border-color: var(--platform-border);
  background: var(--platform-surface);
  color: var(--platform-dark);
}

.platform-sidebar-footer .btn:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: var(--platform-primary-soft);
  color: var(--platform-primary);
}

.platform-main {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.platform-header,
.platform-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.platform-header-copy {
  max-width: 760px;
  padding-bottom: 4px;
}

.platform-title {
  margin: 8px 0 0;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--platform-dark);
}

.platform-subtitle,
.platform-user-email,
.platform-card-copy,
.platform-mini-meta,
.platform-workspace-status,
.platform-invite-status-text {
  color: var(--platform-muted);
}

.platform-user-email,
.platform-card-copy,
.platform-mini-meta,
.platform-workspace-status,
.platform-invite-status-text {
  color: #55657f;
}

.platform-subtitle {
  margin: 0;
  max-width: 620px;
  font-size: 15px;
  line-height: 1.65;
}

.platform-section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.platform-header-user {
  min-width: 280px;
  padding: 16px 18px;
  border: 1px solid var(--platform-border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.platform-user-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.platform-user-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.platform-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.platform-user-name {
  color: var(--platform-dark);
  font-size: 16px;
  font-weight: 800;
}

.platform-user-email {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.platform-pill-primary {
  background: var(--platform-primary-soft);
  border-color: rgba(37, 99, 235, 0.14);
  color: var(--platform-primary);
}

.platform-pill-success {
  background: #eafaf0;
  border-color: #bde9ca;
  color: #15803d;
}

.platform-pill-danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.platform-pill-warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.platform-pill-neutral {
  background: #f1f5f9;
  border-color: #dbe4f0;
  color: #475569;
}

.platform-pill-support {
  background: #ecfeff;
  border-color: #bae6fd;
  color: #0369a1;
}

.platform-metrics,
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.platform-card,
.platform-metric-card {
  border: 1px solid var(--platform-border);
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 18px 42px rgba(15, 23, 42, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.platform-card:hover,
.platform-metric-card:hover,
.platform-mini-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
}

.platform-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.platform-card .title,
.platform-section-head .title {
  color: var(--platform-dark);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

.platform-card .eyebrow,
.platform-section-head .eyebrow {
  color: #94a3b8;
}

.platform-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.platform-metric-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--platform-muted);
}

.platform-metric-icon {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--platform-primary-soft);
  color: var(--platform-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.platform-metric-value {
  font-size: clamp(34px, 4vw, 40px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--platform-dark);
}

.platform-metric-label {
  margin-top: 10px;
  color: var(--platform-muted);
  font-size: 14px;
  font-weight: 600;
}

.platform-context-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.platform-context-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(219, 228, 240, 0.85);
}

.platform-context-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.platform-context-label {
  color: #4f5f78;
  font-size: 13px;
  font-weight: 600;
}

.platform-context-value {
  color: var(--platform-dark);
  text-align: right;
}

.platform-list-mini {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.platform-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--platform-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  color: var(--platform-text);
  padding: 14px 16px;
  font: inherit;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.platform-mini-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.platform-mini-title {
  color: var(--platform-dark);
  font-size: 15px;
  font-weight: 800;
}

.platform-mini-meta {
  font-size: 13px;
  color: #53657f;
}

.platform-mini-action {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--platform-primary-soft);
  color: var(--platform-primary);
  font-size: 12px;
  font-weight: 700;
}

.platform-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.platform-table thead th {
  background: #f8fbff;
  color: var(--platform-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--platform-border);
}

.platform-table th,
.platform-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.platform-table tbody tr {
  background: rgba(255, 255, 255, 0.7);
}

.platform-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.85);
}

.platform-table tbody td {
  border-bottom: 1px solid rgba(219, 228, 240, 0.75);
  color: #1e293b;
}

.platform-table tbody td:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.platform-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platform-sidebar-footer,
.platform-actions-inline,
.platform-filters,
.platform-form-grid {
  display: flex;
  gap: 12px;
}

.platform-actions-inline {
  flex-wrap: wrap;
}

.platform-filters {
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.platform-filters .input {
  min-width: 220px;
  border-color: var(--platform-border);
  background: rgba(255, 255, 255, 0.92);
}

.platform-filters .input:focus {
  border-color: rgba(37, 99, 235, 0.35);
}

.platform-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.platform-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--platform-dark);
}

.platform-form-span {
  grid-column: 1 / -1;
}

.platform-modal-card {
  max-width: 760px;
  border: 1px solid var(--platform-border);
  border-radius: 24px;
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.18);
}

.platform-workspace-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #1e293b;
}

.platform-detail-users {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-detail-user {
  padding: 10px 12px;
  border: 1px solid var(--platform-border);
  border-radius: 14px;
  background: var(--platform-surface-soft);
}

@media (max-width: 1100px) {
  .platform-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .platform-header {
    flex-direction: column;
    align-items: stretch;
  }

  .platform-header-user {
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .platform-shell {
    grid-template-columns: 1fr;
  }

  .platform-sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--platform-border);
  }

  .platform-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .platform-nav-item {
    width: auto;
    flex: 1 1 220px;
  }
}

@media (max-width: 720px) {
  .support-mode-banner,
  .platform-header,
  .platform-section-head,
  .platform-context-row {
    flex-direction: column;
    align-items: stretch;
  }

  .platform-main {
    padding: 18px;
  }

  .platform-sidebar {
    padding: 20px 16px;
  }

  .platform-card,
  .platform-metric-card,
  .platform-header-user {
    border-radius: 18px;
  }

  .platform-metrics,
  .platform-grid {
    grid-template-columns: 1fr;
  }

  .platform-mini-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

.profile-trigger {
  min-width: auto;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.profile-trigger:hover {
  background: transparent;
  border-color: transparent;
}

.profile-trigger[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f2dfc3;
  color: #5b4636;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.profile-trigger-icon {
  color: var(--color-muted-strong);
  flex: 0 0 auto;
}

.profile-menu {
  position: fixed;
  top: calc(100% + 10px);
  right: 0;
  min-width: 272px;
  width: 272px;
  max-width: calc(100vw - 24px);
  padding: 0;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  box-sizing: border-box;
  z-index: 1200;
  overflow: hidden;
  opacity: 1 !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  isolation: isolate;
}

.profile-menu.hidden {
  display: none;
}

.profile-menu-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: inherit;
  opacity: 1 !important;
}

.profile-menu-section-label {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--color-muted-strong);
  padding: 2px 10px 0;
}

.profile-menu-account {
  border-radius: 16px;
  padding: 14px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.profile-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f2dfc3 0%, #ead1b4 100%);
  color: #5b4636;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.profile-menu-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.profile-menu-name {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-text);
}

.profile-menu-email {
  font-size: 13px;
  line-height: 1.35;
  color: var(--color-muted-strong);
  word-break: break-word;
}

.profile-menu-role-line {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 500;
  color: var(--color-muted-strong);
  text-transform: capitalize;
}

.profile-menu-check {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}

.profile-menu-divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
}

.profile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-menu-action {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.profile-menu-action:hover {
  background: rgba(148, 163, 184, 0.1);
}

.profile-menu-action-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted-strong);
}

.profile-menu-action-label {
  flex: 1 1 auto;
  text-align: left;
}

.profile-menu-action-toggle {
  justify-content: flex-start;
}

.profile-menu-switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.26);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.16s ease;
}

.profile-menu-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s ease;
}

.profile-menu-action-toggle.is-active .profile-menu-switch {
  background: #2563eb;
}

.profile-menu-action-toggle.is-active .profile-menu-switch-thumb {
  transform: translateX(16px);
}

.profile-menu-action-danger {
  color: #dc2626;
}

/* Generic badge (used in multiple places) */
.badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--color-surface-alt);
  font-size: var(--font-12);
  color: var(--color-text);
}

.main-area main {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 1px;
  background: var(--bg);
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 5;
}

.drawer-backdrop.show {
  display: block;
}

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

.mobile-only {
  display: none;
}

.profile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1190;
}

.profile-backdrop.show {
  display: block;
}

@media (max-width: 1023px) {
  .profile-backdrop {
    background: rgba(15, 23, 42, 0.18);
  }
}

/* ========= Banner + Auth ========= */
.banner {
  width: 100%;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  background: var(--color-primary);
}

.banner.warn {
  background: var(--color-warning);
}

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

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #0f172a;
}

.logo-small {
  height: 28px;
}

.auth-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 520px;
}

.auth-inputs input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: #f8fafc;
}

.auth-inputs button {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* ========= Buttons ========= */
.btn {
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--font-14);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}

.btn.primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.18);
}

.btn.primary:hover {
  transform: translateY(-1px);
  background: var(--color-primary-strong);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.22);
}

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

.btn.ghost.active {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn.warning {
  border-color: var(--color-warning);
  color: var(--color-warning);
  background: transparent;
}

.btn.warning:hover {
  background: rgba(217, 119, 6, 0.12);
}

.btn.ghost:hover {
  background: var(--color-surface);
}

.btn.small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  font-size: var(--font-14);
  color: var(--text);
}

.icon-btn {
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--color-muted-strong);
  transition: background .12s, color .12s, transform .12s;
}

.icon-btn.ghost {
  background: var(--color-surface-alt);
}

.icon-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
  transform: translateY(-1px);
}

#attach-btn {
  color: #475569;
}

#attach-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

#attach-btn:hover {
  color: #0f172a;
}

#emoji-btn {
  color: #4b5563;
}

#emoji-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

#emoji-btn:hover {
  color: #111827;
}

/* ========= Layout ========= */
.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========= Sidebar ========= */
.sidebar-top {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-logo {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sidebar-logo img {
  height: 40px;
  border-radius: 12px;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-alt);
  color: var(--color-muted);
}

.contact-filters {
  margin-top: 6px;
}

.contact-filters .input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
}

.sidebar-search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--font-14);
  color: var(--color-text);
  flex: 1;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

.contact-list::-webkit-scrollbar {
  width: 8px;
}

.contact-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 8px;
}

.contact {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  border-left: 3px solid transparent;
}

.contact:hover {
  background: var(--color-surface-alt);
}

.contact.active {
  background: var(--color-surface-alt);
  border-left-color: var(--color-primary);
}

.contact.channel-whatsapp.active {
  border-left-color: #22c55e;
}

.contact.is-archived {
  opacity: 0.75;
}

.contact.channel-instagram {
  position: relative;
  background: transparent;
  border-left-color: transparent;
}



.contact.channel-instagram:hover {
  background: transparent;
}

.contact.channel-instagram.active {
  background: var(--ig-soft);
  box-shadow: inset 0 0 0 1px var(--ig-border);
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-muted-strong);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  font-weight: 700;
  font-size: 14px;
}

.contact-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* Avatar with initials - WhatsApp soft green style */
.contact-avatar.no-image {
  background: transparent;
  color: inherit;
  border: 0;
}

/* Dark mode support for initials avatar */
html[data-theme="dark"] .contact-avatar.no-image,
.dark .contact-avatar.no-image {
  background: transparent;
  color: inherit;
  border-color: transparent;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-private-label {
  width: 8px;
  min-width: 8px;
  height: 28px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.contact-private-label--blue {
  background: #2563eb;
}

.contact-private-label--red {
  background: #dc2626;
}

.contact-private-label--yellow {
  background: #eab308;
}

.contact-private-label--green {
  background: #16a34a;
}

.contact-avatar.no-image img {
  display: none;
}

.contact-avatar:not(.no-image) .avatar-initial {
  display: none;
}

.avatar-initial {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 9999px;
  width: 100%;
  height: 100%;
}

.contact-avatar.no-image .avatar-initial {
  background: #22c55e;
  color: #fff;
  border-radius: 9999px;
}

.contact-avatar.no-image[data-channel="ms"] .avatar-initial {
  background: #38bdf8;
  color: #fff;
}

.avatar-circle .avatar-fallback {
  background: #22c55e;
  color: #fff;
}

.avatar-circle[data-channel="ms"] .avatar-fallback {
  background: #38bdf8;
  color: #fff;
}

.avatar--messenger {
  background: #38bdf8;
  color: #fff;
}

.avatar--messenger svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.avatar--tiktok {
  background: #0f172a;
  color: #fff;
}

.avatar--tiktok svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.avatar--external {
  background: #64748b;
  color: #fff;
}

.avatar--external svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.avatar--instagram {
  background: var(--ig);
  color: #fff;
}

.avatar--instagram svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.avatar--whatsapp {
  background: #22c55e;
  color: #fff;
}

.avatar--whatsapp svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.contact-avatar[data-channel="ms"] .avatar-fallback,
.avatar-circle[data-channel="ms"] .avatar-fallback {
  background: #38bdf8;
  color: #fff;
}

.contact-avatar[data-channel="tiktok"] .avatar-fallback,
.avatar-circle[data-channel="tiktok"] .avatar-fallback,
.contact-card-avatar[data-channel="tiktok"] .contact-card-avatar-initials {
  background: #0f172a;
  color: #fff;
}

.contact-avatar[data-channel="external"] .avatar-fallback,
.avatar-circle[data-channel="external"] .avatar-fallback,
.contact-card-avatar[data-channel="external"] .contact-card-avatar-initials {
  background: #64748b;
  color: #fff;
}

.contact-avatar[data-channel="ig"] .avatar-fallback,
.avatar-circle[data-channel="ig"] .avatar-fallback {
  background: var(--ig);
  color: #fff;
}

.contact-avatar[data-channel="wa"] .avatar-fallback,
.avatar-circle[data-channel="wa"] .avatar-fallback {
  background: #22c55e;
  color: #fff;
}

.contact-avatar.no-image[data-channel="webchat"] .avatar-initial,
.contact-avatar[data-channel="webchat"] .avatar-fallback,
.avatar-circle[data-channel="webchat"] .avatar-fallback,
.contact-card-avatar[data-channel="webchat"] .contact-card-avatar-initials {
  background: #7c3aed;
  color: #fff;
}

html[data-theme="dark"] .contact-avatar.no-image[data-channel="webchat"] .avatar-initial,
html[data-theme="dark"] .contact-avatar[data-channel="webchat"] .avatar-fallback,
html[data-theme="dark"] .avatar-circle[data-channel="webchat"] .avatar-fallback,
html[data-theme="dark"] .contact-card-avatar[data-channel="webchat"] .contact-card-avatar-initials {
  background: #8b5cf6;
  color: #fff;
}

.contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.contact-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.contact-name-wrap .status-badge {
  flex: 0 0 auto;
}

.contact-name {
  font-weight: 600;
  color: var(--color-text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.contact-meta-flags {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
  flex: 0 0 auto;
}

.contact-flag {
  font-size: 11px;
  line-height: 1;
  opacity: 0.95;
}

.contact.is-blocked {
  opacity: 0.78;
}

.contact-channel-mark {
  width: 16px;
  height: 16px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  line-height: 1;
  border: 0;
  background: transparent;
}

.contact-channel-mark.channel-wa {
  --wa-icon-color: #22c55e;
  position: relative;
  color: var(--wa-icon-color);
  font-size: 0;
  overflow: hidden;
}

.contact-channel-mark svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.contact-channel-mark.channel-wa svg {
  display: block;
}

.contact-row .contact-channel-mark {
  display: none !important;
}

.contact-time {
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 500;
}

.contact-last-msg {
  color: var(--color-muted-strong);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-badge,
.assigned-badge,
.channel-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--color-surface-alt);
  color: var(--color-text);
  white-space: nowrap;
}

.status-new {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.status-in_conversation {
  background: #cffafe;
  color: #0f766e;
  border-color: #67e8f9;
}

.status-quoted {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.status-won {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.status-lost {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.assigned-badge {
  background: #e2e8f0;
  color: var(--color-text);
}

.assigned-badge.assigned-user {
  background: #e0f2fe;
  color: #0f172a;
  border-color: #bae6fd;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-badges .status-badge + .assigned-badge.assigned-user {
  margin-left: 8px;
}

.assigned-none {
  background: var(--color-surface-alt);
  color: var(--color-muted);
}

.channel-badge {
  background: #dcfce7;
  color: #166534;
}

.channel-badge.channel-wa-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #22c55e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-wa-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-ms-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #38bdf8;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-ms-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-tt-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-tt-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-ext-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #64748b;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-ext-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.contact-ai-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.contact-ai-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-ig-icon {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ec4899;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.channel-badge.channel-ig-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.channel-badge.channel-ig {
  background: var(--ig);
  color: #fff;
  border: 1px solid var(--ig-border);
}

.channel-badge.channel-ms {
  background: #dbeafe;
  color: #1e40af;
}

.channel-badge.channel-fb {
  background: #e0e7ff;
  color: #3730a3;
}

/* "Nuevo" badge for contacts that haven't been opened yet */
.is-new-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse-badge 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-badge {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

.contact.skeleton {
  pointer-events: none;
  cursor: default;
}

.contact.skeleton:hover {
  background: transparent;
}

.contact.skeleton .sk-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--color-skeleton), var(--color-skeleton-shine), var(--color-skeleton));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.contact.skeleton .sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact.skeleton .sk-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-skeleton), var(--color-skeleton-shine), var(--color-skeleton));
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.contact.skeleton .sk-line.wide {
  width: 70%;
}

.contact.skeleton .sk-line.mid {
  width: 55%;
}

.contact.skeleton .sk-line.short {
  width: 35%;
}

/* ========= New Contact List Design ========= */
.btn.outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn.outline:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-muted);
}

.btn.full-width {
  width: 100%;
}

/* Filter Tags Container */
.filter-tags-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
}

.filter-label {
  font-size: 13px;
  color: var(--color-muted);
  white-space: nowrap;
}

.filter-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tag {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.filter-tag:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-muted);
}

.filter-tag.active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-tag .remove-filter {
  margin-left: 6px;
  opacity: 0.6;
}

.filter-tag .remove-filter:hover {
  opacity: 1;
}

.filter-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}

.filter-add-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* Filter Dropdown */
.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 100;
  padding: 8px 0;
}

.filter-dropdown-section {
  padding: 4px 0;
}

.filter-dropdown-section:not(:last-child) {
  border-bottom: 1px solid var(--color-border);
}

.filter-dropdown-title {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
  transition: background .1s ease;
}

.filter-dropdown-item:hover {
  background: var(--color-surface-alt);
}

/* Larger Contact Avatar */
.contact-avatar {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.contact-avatar .avatar-initial {
  font-size: 16px;
  font-weight: 600;
}

/* Contact Phone Display */
.contact-phone {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 2px;
}

/* Unread Badge - WhatsApp style */
.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 50%;
  background: #25D366;
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.unread-badge.large {
  border-radius: 10px;
}

.contact.channel-ig .unread-badge,
.contact.channel-instagram .unread-badge {
  background: var(--ig);
  color: #fff;
  border: 1px solid var(--ig-border);
}

/* ========= Chat ========= */
@media (min-width: 1200px) {
  .page-shell[data-page="chat"] {
    zoom: 0.9;
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .page-shell[data-page="chat"] .app-shell {
    width: min(100% - 24px, 1780px);
    grid-template-columns: 360px minmax(0, 1fr);
    margin: 0 auto;
  }
}

@media (min-width: 1700px) {
  .page-shell[data-page="chat"] .app-shell {
    width: min(100% - 28px, 1840px);
    grid-template-columns: 380px minmax(0, 1fr);
  }
}

.page-shell[data-page="chat"] .panel.sidebar,
.page-shell[data-page="chat"] .chat-area,
.page-shell[data-page="chat"] #info-panel {
  height: 100%;
  border-radius: 0;
  min-height: 0;
}

.chat-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  background-color: #efeae2;
  background-image: url('/assets/chat-bg-whatsapp-light.png');
  background-repeat: repeat;
  background-size: 420px auto;
}

.page-shell[data-page="chat"] .chat-body {
  min-height: 0;
}

.page-shell[data-page="chat"] .chat-header,
.page-shell[data-page="chat"] .chat-input {
  flex-shrink: 0;
}

.chat-mobile-tabs {
  display: none;
  padding: 8px 10px;
  gap: 8px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.chat-header {
  /* WhatsApp-like chat header - compact pill design */
  padding: 10px 16px;
  margin: 0;
  background: var(--color-surface);
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.chat-header.ai-active {
  border-bottom-color: #38bdf8;
  box-shadow: none;
}

.chat-header.channel-instagram {
  border-color: rgba(0, 0, 0, 0.06);
  border-bottom: 2px solid var(--ig);
  box-shadow: 0 1px 3px rgba(225, 48, 108, 0.08);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ai-active-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 4px;
  white-space: nowrap;
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex-wrap: wrap;
}

.contact-title-row .contact-title {
  flex: 1;
  min-width: 0;
}

.chat-header-status-select {
  flex: 0 0 auto;
  min-width: 198px;
  max-width: 238px;
  min-height: 40px;
  padding: 8px 38px 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  font-family: var(--app-font-sans, var(--font-ui));
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238fa2bb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.chat-header-status-select:hover:not(:disabled) {
  border-color: rgba(96, 165, 250, 0.24);
}

.chat-header-status-select:focus,
.chat-header-status-select:focus-visible {
  outline: none;
  border-color: rgba(96, 165, 250, 0.34);
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.2),
    0 0 0 4px rgba(96, 165, 250, 0.08),
    0 10px 18px rgba(15, 23, 42, 0.1);
}

.chat-header-status-select option,
.chat-header-status-select optgroup {
  font-family: var(--app-font-sans, var(--font-ui));
  font-weight: 600;
}

.chat-header-status-select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.contact-title-row .chat-header-status-select {
  flex: 0 0 auto;
  margin-left: 14px;
}

html[data-theme="dark"] .chat-header-status-select {
  border-color: rgba(148, 163, 184, 0.16);
  background-color: rgba(21, 32, 49, 0.92);
  color: #e7edf5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .chat-header-status-select option,
html[data-theme="dark"] .chat-header-status-select optgroup {
  background: #111b2a;
  color: #e7edf5;
}

html[data-theme="light"] .chat-header-status-select {
  border-color: rgba(148, 163, 184, 0.18);
  background-color: rgba(255, 255, 255, 0.94);
  color: #1e293b;
}

html[data-theme="light"] .chat-header-status-select option,
html[data-theme="light"] .chat-header-status-select optgroup {
  background: #ffffff;
  color: #1e293b;
}

.contact-assigned-pill {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-subtitle {
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-audio-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-muted);
  line-height: 1;
  max-width: 100%;
}

.contact-audio-preview svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: #10b981;
}

.contact-audio-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-preview-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  vertical-align: top;
}

.contact-preview-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-preview-checks,
.contact-preview-checks .checks {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  line-height: 1;
}

.contact-preview-checks .checks svg {
  width: 16px;
  height: 12px;
  display: block;
  color: #9aa3ac;
}

.contact-preview-checks .checks[data-status="read"] svg {
  color: #53bdeb;
}

.contact-preview-checks .checks[data-status="failed"] svg {
  color: #ef4444;
}

.contact-preview-checks .checks[data-status="sending"] svg {
  width: 14px;
  height: 14px;
}

.contact-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.chat-score-stars {
  --lead-score-active: #16a34a;
  --lead-score-empty: rgba(148, 163, 184, 0.72);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.chat-score-stars[data-tone="0"] {
  --lead-score-active: #cbd5e1;
}

.chat-score-stars[data-tone="1"] {
  --lead-score-active: #ef4444;
}

.chat-score-stars[data-tone="2"] {
  --lead-score-active: #f59e0b;
}

.chat-score-stars[data-tone="3"] {
  --lead-score-active: #38bdf8;
}

.chat-score-stars[data-tone="4"] {
  --lead-score-active: #16a34a;
}

.chat-score-star {
  width: 21px;
  height: 21px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lead-score-empty);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.chat-score-star svg {
  width: 21px;
  height: 21px;
  display: block;
}

.chat-score-star.is-filled {
  color: var(--lead-score-active);
}

.chat-score-star:hover {
  transform: translateY(-1px);
}

.chat-score-stars.is-disabled {
  opacity: 0.64;
}

.chat-score-stars.is-disabled .chat-score-star {
  cursor: default;
}

.chat-score-star:disabled {
  pointer-events: none;
}

.ai-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ai-select {
  min-width: 180px;
  max-width: 220px;
}

.search-panel {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 20;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
}

.search-panel input {
  width: 240px;
  border: 0;
  outline: none;
  font-size: var(--font-14);
  background: transparent;
  color: var(--color-text);
}

.dropdown {
  position: absolute;
  right: 0;
  top: 48px;
  min-width: 190px;
  z-index: 20;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 6px 0;
}

.dropdown-item {
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: var(--font-14);
  color: var(--color-text);
}

.dropdown-item:hover {
  background: var(--color-surface-alt);
}

.dropdown-item.danger {
  color: var(--color-danger);
}

.contact-context-menu {
  position: fixed;
  min-width: 240px;
  max-width: min(92vw, 280px);
  z-index: 1400;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
  padding: 8px 0;
}

.contact-context-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-align: left;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  cursor: pointer;
}

.contact-context-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

.contact-context-item.is-active {
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
}

.contact-context-item.danger {
  color: #b91c1c;
}

.contact-context-item .ctx-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
}

.contact-context-item .ctx-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.contact-context-item .ctx-icon svg path {
  fill: currentColor;
}

.ctx-color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 14px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.ctx-color-swatch--blue {
  background: #2563eb;
}

.ctx-color-swatch--red {
  background: #dc2626;
}

.ctx-color-swatch--yellow {
  background: #eab308;
}

.ctx-color-swatch--green {
  background: #16a34a;
}

.ctx-color-swatch--clear {
  background:
    linear-gradient(135deg, transparent 0 44%, #94a3b8 44%, #94a3b8 56%, transparent 56% 100%),
    #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: none;
}

.contact-context-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.12);
  margin: 6px 0;
}

.message-context-menu {
  position: fixed;
  min-width: 220px;
  max-width: min(92vw, 280px);
  z-index: 1450;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
  padding: 8px 0;
}

.message-context-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-align: left;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  cursor: pointer;
}

.message-context-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

.message-context-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.message-context-item.danger {
  color: #b91c1c;
}

.message-context-item .ctx-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  font-size: 16px;
  line-height: 1;
}

.message-context-item .ctx-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.message-context-item .ctx-icon svg path {
  fill: currentColor;
}

.message-context-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.12);
  margin: 6px 0;
}

.wa-action-dialog {
  position: fixed;
  inset: 0;
  z-index: 1600;
  background: rgba(11, 20, 26, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

.wa-action-dialog-center {
  align-items: center;
}

.wa-action-dialog.hidden {
  display: none !important;
}

.wa-action-card {
  width: min(96vw, 620px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #111b21;
  color: #e9edef;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.52);
}

.wa-delete-card {
  padding: 22px 22px 18px;
}

.wa-delete-title {
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 600;
  color: #f5f7f8;
}

.wa-delete-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.wa-delete-btn {
  min-width: 176px;
  border: 1px solid rgba(42, 47, 51, 0.9);
  background: transparent;
  color: #22c55e;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.wa-delete-btn:hover {
  background: rgba(34, 197, 94, 0.08);
}

.wa-delete-btn-cancel {
  color: #aebac1;
}

.wa-delete-btn-cancel:hover {
  background: rgba(174, 186, 193, 0.08);
}

.wa-edit-card {
  padding: 14px 16px 16px;
  background-image: linear-gradient(180deg, rgba(17, 27, 33, 0.96) 0%, rgba(17, 27, 33, 1) 54%), url('/assets/chat-bg-whatsapp-dark.png');
  background-size: cover;
  background-position: center;
}

.wa-edit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.wa-edit-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: #d1d7db;
  font-size: 30px;
  cursor: pointer;
}

.wa-edit-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.wa-edit-title {
  font-size: 18px;
  font-weight: 600;
  color: #f5f7f8;
}

.wa-edit-preview-wrap {
  min-height: 106px;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.wa-edit-preview-bubble {
  max-width: min(74%, 360px);
  background: #005c4b;
  color: #ecfff7;
  border-radius: 10px;
  padding: 10px 12px 8px;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
}

.wa-edit-preview-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.35;
}

.wa-edit-preview-time {
  align-self: flex-end;
  font-size: 11px;
  color: rgba(236, 255, 247, 0.82);
}

.wa-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wa-edit-input {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  border: 0;
  border-bottom: 2px solid #00a884;
  background: transparent;
  color: #f5f7f8;
  padding: 8px 0;
  font-size: 17px;
  line-height: 1.35;
  outline: none;
}

.wa-edit-input::placeholder {
  color: rgba(209, 215, 219, 0.7);
}

.wa-edit-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.wa-edit-cancel {
  border: 0;
  background: transparent;
  color: #aebac1;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
}

.wa-edit-submit {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 0;
  background: #21c063;
  color: #0f2f1f;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wa-edit-submit svg {
  width: 24px;
  height: 24px;
  display: block;
}

.wa-pin-card {
  width: min(96vw, 520px);
  padding: 24px 24px 20px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #0f172a;
}

.wa-pin-title {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.wa-pin-subtitle {
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.3;
  color: #334155;
}

.wa-pin-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wa-pin-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 16px;
  line-height: 1.2;
  color: #111827;
  cursor: pointer;
}

.wa-pin-option input {
  width: 22px;
  height: 22px;
  accent-color: #22c55e;
}

.wa-pin-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.wa-pin-cancel {
  border: 0;
  background: transparent;
  color: #047857;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
}

.wa-pin-submit {
  min-width: 130px;
  border: 0;
  border-radius: 999px;
  background: #22c55e;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 20px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .wa-action-dialog {
    padding: 12px;
  }

  .wa-delete-title,
  .wa-edit-title {
    font-size: 17px;
  }

  .wa-delete-btn,
  .wa-edit-cancel {
    font-size: 14px;
  }

  .wa-edit-preview-text,
  .wa-edit-input {
    font-size: 15px;
  }

  .wa-edit-preview-time {
    font-size: 13px;
  }

  .wa-pin-card {
    width: min(96vw, 520px);
    padding: 18px 16px 16px;
  }

  .wa-pin-title {
    font-size: 17px;
  }

  .wa-pin-subtitle {
    font-size: 13px;
  }

  .wa-pin-option {
    font-size: 15px;
    min-height: 38px;
  }

  .wa-pin-cancel,
  .wa-pin-submit {
    font-size: 14px;
  }
}

.chat-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  padding: var(--space-4);
  overflow: hidden;
}

.chat-pinned-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 10px 14px;
  border-radius: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.45);
  border-bottom: 1px solid rgba(148, 163, 184, 0.45);
  border-left: 0;
  border-right: 0;
  background: rgba(255, 255, 255, 0.86);
  cursor: pointer;
}

.chat-pinned-banner:hover {
  border-top-color: rgba(16, 185, 129, 0.55);
  border-bottom-color: rgba(16, 185, 129, 0.55);
}

.chat-pinned-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f766e;
}

.chat-pinned-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.chat-pinned-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-pinned-label {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chat-pinned-text {
  font-size: 14px;
  line-height: 1.25;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 6px;
  min-height: 0;
}

.chat-messages::-webkit-scrollbar {
  width: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 10px;
}

.day-separator {
  align-self: center;
  background: var(--color-surface);
  color: var(--color-muted-strong);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-border);
}

.message {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeInUp .12s ease;
  background: transparent;
}

.message.in {
  align-items: flex-start;
}

.message.out {
  align-items: flex-end;
}

.message.channel-ms,
.message[data-channel="ms"],
.message[data-channel="MESSENGER"] {
  background: transparent !important;
}

.bubble {
  position: relative;
  max-width: min(74%, 760px);
  padding: 7px 10px 18px;
  border-radius: 7.5px;
  border: 1px solid #e7eaee;
  background: #ffffff;
  box-shadow: none;
  font-size: var(--font-14);
  line-height: 1.36;
  color: var(--text);
  display: inline-block;
}

.message-layout {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.message.out .message-layout {
  flex-direction: row-reverse;
}

.message-action-controls {
  position: absolute;
  top: 4px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

.message .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)) .message-action-controls {
  top: 4px;
  right: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 4;
}

.message:hover .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)) .message-action-controls,
.message:focus-within .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)) .message-action-controls,
.message .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)):has(.message-action-trigger:hover) .message-action-controls,
.message .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)):has(.message-action-trigger:focus-visible) .message-action-controls {
  opacity: 1;
  pointer-events: auto;
}

.message-action-trigger {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(15, 23, 42, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  appearance: none;
}

.message-action-trigger:hover {
  background: transparent;
  color: rgba(15, 23, 42, 0.95);
}

.message-action-trigger svg {
  width: 14px;
  height: 14px;
  display: block;
}

.message:not(.sticker) .bubble.has-image-content .message-action-controls,
.message:not(.sticker) .bubble:has(.message-media) .message-action-controls,
.message:not(.sticker) .bubble:has(> img) .message-action-controls,
.message:not(.sticker) .bubble:has(.message-image) .message-action-controls,
.message:not(.sticker) .bubble:has(.attached-img) .message-action-controls {
  top: 8px;
  right: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 4;
}

.message:not(.sticker) .bubble.has-image-content:hover .message-action-controls,
.message:not(.sticker) .bubble.has-image-content:focus-within .message-action-controls,
.message:not(.sticker) .bubble:has(.message-media:hover) .message-action-controls,
.message:not(.sticker) .bubble:has(> img:hover) .message-action-controls,
.message:not(.sticker) .bubble:has(.message-image:hover) .message-action-controls,
.message:not(.sticker) .bubble:has(.attached-img:hover) .message-action-controls,
.message:not(.sticker) .bubble:has(.message-action-trigger:hover) .message-action-controls,
.message:not(.sticker) .bubble:has(.message-action-trigger:focus-visible) .message-action-controls {
  opacity: 1;
  pointer-events: auto;
}

.message:not(.sticker) .bubble.has-image-content .message-action-trigger,
.message:not(.sticker) .bubble:has(.message-media) .message-action-trigger,
.message:not(.sticker) .bubble:has(> img) .message-action-trigger,
.message:not(.sticker) .bubble:has(.message-image) .message-action-trigger,
.message:not(.sticker) .bubble:has(.attached-img) .message-action-trigger {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(17, 27, 33, 0.56);
  color: rgba(255, 255, 255, 0.98);
}

.message:not(.sticker) .bubble.has-image-content .message-action-trigger:hover,
.message:not(.sticker) .bubble:has(.message-media) .message-action-trigger:hover,
.message:not(.sticker) .bubble:has(> img) .message-action-trigger:hover,
.message:not(.sticker) .bubble:has(.message-image) .message-action-trigger:hover,
.message:not(.sticker) .bubble:has(.attached-img) .message-action-trigger:hover {
  background: rgba(17, 27, 33, 0.72);
  color: #ffffff;
}

.message.in .bubble.has-image-content .message-action-controls {
  top: 8px;
  right: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 4;
}

.message.in .bubble.has-image-content:hover .message-action-controls,
.message.in .bubble.has-image-content:focus-within .message-action-controls {
  opacity: 1;
  pointer-events: auto;
}

.message.in .bubble.has-image-content .message-action-trigger {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(17, 27, 33, 0.56);
  color: rgba(255, 255, 255, 0.98);
}

html[data-theme="dark"] .message-action-trigger {
  background: transparent;
  color: rgba(226, 232, 240, 0.86);
}

html[data-theme="dark"] .message-action-trigger:hover {
  background: transparent;
  color: rgba(226, 232, 240, 1);
}

@media (hover: none), (pointer: coarse) {

  .message:not(.sticker) .bubble:has(.message-media) .message-action-controls,
  .message:not(.sticker) .bubble:has(> img) .message-action-controls,
  .message:not(.sticker) .bubble:has(.message-image) .message-action-controls,
  .message .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)) .message-action-controls,
  .message:not(.sticker) .bubble:has(.attached-img) .message-action-controls {
    opacity: 1;
    pointer-events: auto;
  }
}

.message-reaction-trigger.message-reaction-trigger-outside {
  margin-top: 2px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.96);
  color: rgba(30, 41, 59, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  appearance: none;
}

.message-layout:hover .message-reaction-trigger.message-reaction-trigger-outside,
.message-layout:focus-within .message-reaction-trigger.message-reaction-trigger-outside,
.message-reaction-trigger.message-reaction-trigger-outside:hover,
.message-reaction-trigger.message-reaction-trigger-outside:focus-visible {
  display: inline-flex;
}

.message-reaction-trigger.message-reaction-trigger-outside svg {
  width: 18px;
  height: 18px;
  display: block;
}

.message-reaction-trigger.message-reaction-trigger-outside:hover {
  background: rgba(226, 232, 240, 0.98);
  color: rgba(15, 23, 42, 1);
  border-color: rgba(100, 116, 139, 0.62);
}

html[data-theme="dark"] .message-reaction-trigger.message-reaction-trigger-outside {
  background: rgba(30, 41, 59, 0.95);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.45);
}

html[data-theme="dark"] .message-reaction-trigger.message-reaction-trigger-outside:hover {
  background: rgba(51, 65, 85, 0.98);
  color: rgba(248, 250, 252, 1);
}

@media (hover: none), (pointer: coarse) {
  .message-reaction-trigger.message-reaction-trigger-outside {
    display: inline-flex;
  }
}

.message.out .bubble {
  background: #d9fdd3;
  border-color: transparent;
}

.message.in .bubble[data-channel="wa"] {
  background: #ffffff;
  border-color: #e7eaee;
}

.message.out .bubble[data-channel="wa"] {
  background: #d9fdd3;
  border-color: transparent;
}

.message.in .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio) {
  border-radius: 7.5px;
  overflow: visible;
}

.message.out .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio) {
  border-radius: 7.5px;
  overflow: visible;
}

.message.out .bubble[data-channel="ms"] {
  background: #e8f1ff;
  border-color: #c7ddff;
}

.message.in .bubble[data-channel="ms"] {
  background: #ffffff;
  border-color: #d6e3ff;
}

.message.out .bubble[data-channel="ig"] {
  background: #fff;
  border-color: rgba(225, 48, 108, 0.55);
  box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.08);
}

.message.in .bubble[data-channel="ig"] {
  background: #fff;
  border-color: var(--ig-border);
  box-shadow: 0 6px 14px rgba(225, 48, 108, 0.08);
}

.message.in .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio)::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  width: 8px;
  height: 13px;
  background-repeat: no-repeat;
  background-size: 8px 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='13' viewBox='0 0 8 13'%3E%3Cpath opacity='0.13' fill='%23000000' d='M1.533%2C3.568L8%2C13V0H0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3Cpath fill='%23ffffff' d='M1.533%2C3.568L8%2C13V0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3C/svg%3E");
}

.message.out .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio)::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 0;
  width: 8px;
  height: 13px;
  transform: scaleX(-1);
  transform-origin: center;
  background-repeat: no-repeat;
  background-size: 8px 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='13' viewBox='0 0 8 13'%3E%3Cpath opacity='0.13' fill='%23000000' d='M1.533%2C3.568L8%2C13V0H0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3Cpath fill='%23d9fdd3' d='M1.533%2C3.568L8%2C13V0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .message.in .bubble[data-channel="ms"] {
  background: #111827;
  border-color: rgba(59, 130, 246, 0.35);
}

.message.out.error .bubble {
  background: #ffe4e6;
  border-color: #fecdd3;
}

.message.is-pinned .bubble {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16), var(--shadow-sm);
}

.message-focus-pulse .bubble {
  animation: messageFocusPulse .95s ease;
}

@keyframes messageFocusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55), var(--shadow-sm);
  }

  100% {
    box-shadow: var(--shadow-sm);
  }
}

.message.is-starred .bubble {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2), var(--shadow-sm);
}

.message.is-reported .bubble {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18), var(--shadow-sm);
}

.bubble-text {
  margin-right: 60px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.message.out .bubble:not(:has(.message-media)):not(:has(> img)):not(:has(.message-image)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio) .bubble-text {
  margin-right: 18px;
}

.bubble-text .message-link {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.message-reply-context {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 8px;
  padding: 6px 8px 6px 10px;
  border-left: 3px solid #22c55e;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.bubble:has(.message-reply-context) .bubble-text {
  width: 100%;
  margin-right: 0;
}

.message-reply-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

.message-reply-context.out {
  background: rgba(5, 150, 105, 0.14);
  border-left-color: #16a34a;
}

.message-reply-context:hover,
.message-reply-context:focus-visible {
  background: rgba(15, 23, 42, 0.1);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  outline: none;
}

.message-reply-context.out:hover,
.message-reply-context.out:focus-visible {
  background: rgba(5, 150, 105, 0.18);
}

.message-reply-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  align-self: center;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.message-reply-thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-reply-thumb-img.is-loading {
  opacity: 0.45;
}

.message-reply-author {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  color: #0f766e;
}

.message-reply-preview {
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-reply-preview-media {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.message-reply-preview-icon {
  font-size: 12px;
  line-height: 1;
}

.message-reply-preview {
  font-size: 12px;
  line-height: 1.35;
  color: var(--color-muted-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message.out .message-reply-preview {
  color: rgba(15, 23, 42, 0.76);
}

.message-flags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 6px;
  font-size: 12px;
  line-height: 1;
}

.message-flag {
  opacity: 0.9;
}

.message-reaction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 22px;
  margin: 0 6px;
  padding: 0 8px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: var(--color-surface);
  font-size: 14px;
  line-height: 1;
  font-family: var(--font-emoji);
}

.message-reaction-popover {
  position: fixed;
  z-index: 10020;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.message-reaction-popover.hidden {
  display: none;
}

.message-reaction-option {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  padding: 0;
  font-family: var(--font-emoji);
  transition: background-color .14s ease;
}

.message-reaction-option:hover {
  background: rgba(15, 23, 42, 0.08);
}

.message-reaction-option.active {
  background: rgba(37, 211, 102, 0.22);
}

.message-reaction-option-plus {
  font-size: 26px;
  font-family: var(--font-ui);
  color: #334155;
}

html[data-theme="dark"] .message-reaction-popover {
  border-color: rgba(148, 163, 184, 0.32);
  background: #111827;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.55);
}

html[data-theme="dark"] .message-reaction-option:hover {
  background: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .message-reaction-option.active {
  background: rgba(37, 211, 102, 0.3);
}

html[data-theme="dark"] .message-reaction-option-plus {
  color: #e2e8f0;
}

.meta {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-size: 12px;
  line-height: 1;
  color: #667781;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.message:not(.sticker):not(.emoji-only).in .bubble:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio) {
  min-width: 96px;
}

.message:not(.sticker):not(.emoji-only).out .bubble:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio) {
  min-width: 116px;
}

.meta .edited-mark {
  opacity: 0.88;
  font-style: italic;
}

.meta .checks svg {
  width: 16px;
  height: 12px;
  display: block;
  color: #9aa3ac;
  transition: color 0.2s ease;
}

/* Status-based check colors */
.meta .checks[data-status="sent"] svg {
  color: #9aa3ac;
}

.meta .checks[data-status="delivered"] svg {
  color: #9aa3ac;
}

.meta .checks[data-status="read"] svg {
  color: #53bdeb;
}

.meta .checks[data-status="sending"] svg {
  color: #9aa3ac;
  width: 14px;
  height: 14px;
}

.meta .checks[data-status="failed"] svg {
  color: #ef4444;
}

/* Message bubble with image - constrained size */
.bubble.has-image,
.bubble.has-image-content,
.bubble:has(> img),
.bubble:has(.message-image),
.bubble:has(.attached-img),
.bubble:has(.message-file-card) {
  padding: 3px;
  max-width: 320px;
  width: fit-content;
  display: inline-block;
  overflow: hidden;
}

.message.in .bubble:has(.message-media),
.message.in .bubble.has-image-content,
.message.in .bubble:has(> img),
.message.in .bubble:has(.message-image),
.message.in .bubble:has(.attached-img),
.message.out .bubble:has(.message-media),
.message.out .bubble.has-image-content,
.message.out .bubble:has(> img),
.message.out .bubble:has(.message-image),
.message.out .bubble:has(.attached-img) {
  padding-top: 3px;
}

.bubble.has-image .bubble-text,
.bubble.has-image-content .bubble-text,
.bubble:has(.message-media) .bubble-text,
.bubble:has(> img) .bubble-text,
.bubble:has(.message-image) .bubble-text,
.bubble:has(.attached-img) .bubble-text,
.bubble.has-file-card .bubble-text,
.bubble:has(.message-file-card) .bubble-text {
  margin-right: 0;
}

.bubble.has-image-content .bubble-text,
.bubble:has(.message-media) .bubble-text,
.bubble:has(> img) .bubble-text,
.bubble:has(.message-image) .bubble-text,
.bubble:has(.attached-img) .bubble-text {
  font-size: 0;
  line-height: 0;
}

.bubble.bubble-audio {
  padding: 10px 12px 18px;
  max-width: min(75%, 420px);
}

.bubble.bubble-audio .bubble-text {
  margin-right: 40px;
  min-width: 220px;
  max-width: 340px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.bubble img,
.bubble .message-image,
.bubble .attached-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
}

.bubble.has-file-card .meta,
.bubble:has(.message-file-card) .meta {
  position: relative;
  right: auto;
  bottom: auto;
  margin-top: 4px;
  display: flex;
  width: 100%;
  justify-content: flex-end;
  text-align: right;
}

.meta.meta-file {
  position: relative;
  right: auto;
  bottom: auto;
  margin-top: 4px;
  margin-left: auto;
  display: flex;
  width: 100%;
  justify-content: flex-end;
  text-align: right;
}

.message:not(.sticker) .bubble.has-image-content .meta,
.message:not(.sticker) .bubble:has(.message-media) .meta,
.message:not(.sticker) .bubble:has(> img) .meta,
.message:not(.sticker) .bubble:has(.message-image) .meta,
.message:not(.sticker) .bubble:has(.attached-img) .meta {
  position: absolute;
  right: 6px;
  bottom: 6px;
  margin: 0;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(17, 27, 33, 0.72);
  color: #ffffff;
  line-height: 1;
  z-index: 3;
  pointer-events: none;
}

/* Mobile: smaller image bubbles */
@media (max-width: 768px) {

  .bubble.has-image,
  .bubble.has-image-content,
  .bubble:has(> img),
  .bubble:has(.message-image),
  .bubble:has(.attached-img),
  .bubble:has(.message-file-card) {
    max-width: 240px;
  }

  .bubble img,
  .bubble .message-image,
  .bubble .attached-img {
    max-height: 240px;
  }
}

.chat-input {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 2;
  flex-shrink: 0;
}

.page-shell[data-page="chat"] #audio-btn {
  display: none !important;
}

.input-field {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input);
}

.input-field:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-field input,
.input-field textarea {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--font-14);
  color: var(--text);
  font-family: inherit;
}

.scroll-bottom {
  position: absolute;
  right: 20px;
  bottom: 88px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted-strong);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}

.scroll-bottom:hover {
  transform: translateY(-2px);
  color: var(--color-text);
}

.chat-area.chat-area-esc .chat-header,
.chat-area.chat-area-esc .chat-input {
  opacity: 0.42;
  filter: saturate(0.75);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.chat-area.chat-area-esc .chat-input .input-field {
  box-shadow: none;
}

.chat-esc-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 680px at 72% 88%, rgba(16, 185, 129, 0.1), transparent 65%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.7), rgba(226, 232, 240, 0.78));
}

.chat-esc-shell {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.chat-esc-card {
  width: min(360px, 100%);
  background: linear-gradient(150deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 24px;
  padding: 24px 22px 20px;
  text-align: center;
  color: #0f172a;
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.18);
}

.chat-esc-ill {
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

.chat-esc-ill svg {
  width: 92px;
  height: 92px;
  display: block;
}

.chat-esc-card h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: #0f172a;
}

.chat-esc-card p {
  margin: 10px 0 16px;
  color: #475569;
  font-size: 14px;
  line-height: 1.45;
}

.chat-esc-card .btn {
  min-width: 148px;
}

.chat-esc-actions {
  width: min(320px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chat-esc-action {
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.96));
  color: #0f172a;
  min-height: 88px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.chat-esc-action:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(150deg, rgba(240, 249, 255, 0.98), rgba(238, 242, 255, 0.98));
}

.chat-esc-action-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.14);
}

.chat-esc-action-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

html[data-theme="dark"] .chat-esc-screen {
  background:
    radial-gradient(1200px 680px at 72% 88%, rgba(16, 185, 129, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.22), rgba(2, 6, 23, 0.35));
}

html[data-theme="dark"] .chat-esc-card {
  background: linear-gradient(150deg, #1f2937 0%, #111827 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  box-shadow: 0 24px 54px rgba(2, 6, 23, 0.42);
}

html[data-theme="dark"] .chat-esc-card h2 {
  color: #f8fafc;
}

html[data-theme="dark"] .chat-esc-card p {
  color: #cbd5e1;
}

html[data-theme="dark"] .chat-esc-action {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(150deg, rgba(31, 41, 55, 0.95), rgba(15, 23, 42, 0.95));
  color: #dbe4ee;
}

html[data-theme="dark"] .chat-esc-action:hover {
  border-color: rgba(74, 222, 128, 0.52);
  background: linear-gradient(150deg, rgba(22, 35, 53, 0.98), rgba(10, 18, 33, 0.98));
}

html[data-theme="dark"] .chat-esc-action-icon {
  color: #86efac;
  background: rgba(22, 163, 74, 0.18);
}

@media (max-width: 768px) {
  .chat-esc-screen {
    padding: 14px;
  }

  .chat-esc-card {
    border-radius: 20px;
    padding: 20px 16px 16px;
  }

  .chat-esc-card h2 {
    font-size: 24px;
  }

  .chat-esc-actions {
    width: 100%;
    gap: 10px;
  }
}

.theme-toggle .icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Old emoji-picker styles removed — see Full Emoji Picker section below */
.emoji-picker span {
  cursor: pointer;
}

.attach-menu {
  position: absolute;
  bottom: 72px;
  left: 16px;
  width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 8px 0;
  z-index: 220;
}

.attach-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: var(--font-14);
  color: var(--color-text);
}

.attach-item-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  color: var(--attach-icon-color, var(--color-muted-strong));
}

.attach-item-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.attach-item[data-action="document"] {
  --attach-icon-color: #8b5cf6;
}

.attach-item[data-action="media"] {
  --attach-icon-color: #0ea5e9;
}

.attach-item[data-action="camera"] {
  --attach-icon-color: #3b82f6;
}

.attach-item[data-action="audio-file"] {
  --attach-icon-color: #7c3aed;
}

.attach-item[data-action="contact"] {
  --attach-icon-color: #a855f7;
}

.attach-item:hover {
  background: var(--color-surface-alt);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--color-muted-strong);
  margin: auto;
  max-width: 360px;
}

.empty-icon {
  font-size: 40px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.loader {
  padding: 12px;
  text-align: center;
  font-weight: 600;
  color: var(--color-muted-strong);
}

/* ========= Info panel ========= */
.info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.info-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.info-panel {
  min-width: 0;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  max-width: 92vw;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: 0;
  transform: translateX(100%);
  transition: transform .2s ease;
}

.info-panel.show {
  transform: translateX(0);
}

.info-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.info-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-alt);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-muted-strong);
}

.tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.info-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.info-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
}

.info-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-identity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.info-avatar-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--color-surface);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.info-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-name {
  font-size: var(--font-18);
  font-weight: 700;
  color: var(--color-text);
}

.info-phone {
  font-size: var(--font-14);
  color: var(--color-muted);
}

.info-about {
  font-size: 13px;
  color: var(--color-muted-strong);
}

.info-section {
  margin-top: 18px;
}

.info-section-title {
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-section.card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.media-grid img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
}

.toggle-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.toggle-row input {
  pointer-events: none;
}

.info-note {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 6px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.placeholder-card {
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  padding: 14px;
  background: var(--color-surface-alt);
  color: var(--color-muted-strong);
}

/* ========= Modal ========= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, .82);
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  max-width: 92%;
  max-height: 92%;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 0, 0, .5);
}

.modal .close {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

.modal .panel {
  max-height: 90vh;
  overflow: auto;
}

/* ========= Pipeline ========= */
.pipeline-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

.pipeline-page .panel.pipeline-pro-shell {
  width: min(100% - 28px, 1680px);
  margin: 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(211, 220, 237, 0.92);
  border-radius: 28px;
  background:
    radial-gradient(circle at top center, rgba(106, 170, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.96));
  box-shadow: 0 28px 80px rgba(132, 144, 176, 0.22);
}

.pipeline-pro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px 10px;
}

.pipeline-pro-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pipeline-pro-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #19233c;
}

.pipeline-pro-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.pipeline-pro-search {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d6dcef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 10px 28px rgba(147, 160, 196, 0.12);
  color: #35415f;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pipeline-pro-search:focus-within {
  border-color: #90b7ff;
  box-shadow: 0 0 0 4px rgba(77, 132, 255, 0.12);
}

.pipeline-pro-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #24304f;
  font-size: 14px;
}

.pipeline-pro-search input::placeholder {
  color: #8592b2;
}

.pipeline-pro-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #4c90ff 0%, #2d68ef 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 18px 34px rgba(40, 101, 238, 0.28);
}

.pipeline-pro-primary-icon {
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}

.pipeline-pro-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px 16px;
  border-top: 1px solid rgba(224, 230, 245, 0.78);
}

.pipeline-pro-summary {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 1 1 740px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(214, 221, 239, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 30px rgba(163, 173, 198, 0.16);
  overflow-x: auto;
}

.pipeline-pro-summary::-webkit-scrollbar {
  display: none;
}

.pipeline-summary-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  white-space: nowrap;
  color: #46526f;
  font-size: 14px;
  font-weight: 500;
}

.pipeline-summary-pill.is-current {
  color: #16213a;
  font-weight: 700;
}

.pipeline-summary-pill.is-current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #77b1ff 0%, #5f8fff 100%);
}

.pipeline-summary-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipeline-summary-dot-new {
  background: #4e83f4;
}

.pipeline-summary-dot-conversation {
  background: #9db7f0;
}

.pipeline-summary-dot-quoted {
  background: #f5c76b;
}

.pipeline-summary-dot-won {
  background: #6ec997;
}

.pipeline-summary-dot-lost {
  background: #e99595;
}

.pipeline-summary-value {
  font-size: 15px;
  color: #4f5e82;
}

.pipeline-pro-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #bde8cb;
  background: #e8f9ef;
  color: #18885c;
  font-size: 12px;
  font-weight: 600;
}

.pipeline-pro-status:empty {
  display: none;
}

.pipeline-pro-status.error {
  border-color: #ffc9d3;
  background: #fff1f4;
  color: #c13b62;
}

.pipeline-board.pipeline-pro-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(255px, 1fr));
  gap: 14px;
  padding: 0 22px 22px;
  overflow-x: auto;
  align-items: start;
}

.pipeline-column {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: 12px;
  border: 1px solid #dde3f3;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.94), rgba(240, 243, 252, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.pipeline-col-header {
  padding: 2px 2px 10px;
}

.pipeline-col-title {
  color: #1a2540;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.pipeline-count {
  color: #364567;
}

.pipeline-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 620px;
  padding: 2px;
  overflow-y: auto;
  transition: background 0.15s ease, border-color 0.15s ease;
  scrollbar-width: thin;
}

.pipeline-col-body.drag-over {
  border-radius: 18px;
  background: rgba(111, 155, 255, 0.14);
}

.pipeline-empty-state {
  display: grid;
  place-items: center;
  min-height: 90px;
  padding: 14px;
  border: 1px dashed #c9d3eb;
  border-radius: 18px;
  color: #8390ad;
  font-size: 12px;
  text-align: center;
}

.pipeline-column-footer {
  padding-top: 8px;
}

.pipeline-more-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgba(246, 248, 255, 0.9);
  color: #5d6988;
  font-size: 13px;
  border: 1px solid #e3e8f5;
}

.pipeline-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe2f2;
  border-radius: 15px;
  padding: 12px 12px 11px;
  box-shadow: 0 14px 26px rgba(164, 175, 199, 0.16);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.pipeline-card.pipeline-channel-wa {
  background: linear-gradient(180deg, rgba(241, 255, 247, 0.98), rgba(247, 252, 249, 0.94));
  border-color: #cfead9;
}

.pipeline-card.pipeline-channel-ms {
  background: linear-gradient(180deg, rgba(243, 248, 255, 0.98), rgba(247, 250, 255, 0.95));
  border-color: #d7e3ff;
}

.pipeline-card.pipeline-channel-ig {
  background: linear-gradient(180deg, rgba(255, 244, 249, 0.98), rgba(255, 248, 251, 0.95));
  border-color: #efd7e5;
}

.pipeline-card.dragging {
  opacity: 0.65;
  transform: rotate(1deg);
}

.pipeline-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(145, 156, 187, 0.24);
}

.pipeline-card.pipeline-channel-wa:hover {
  border-color: #aed9bf;
}

.pipeline-card.pipeline-channel-ms:hover {
  border-color: #bfd3ff;
}

.pipeline-card.pipeline-channel-ig:hover {
  border-color: #e6bfd4;
}

.pipeline-card.disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.pipeline-card-title {
  color: #18213a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  word-break: break-word;
}

.pipeline-card-sub {
  margin-top: 6px;
  color: #62708f;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.pipeline-card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pipeline-channel-pill,
.pipeline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 600;
}

.pipeline-channel-pill-wa {
  color: #25764b;
  background: #e5f7ed;
  border-color: #bfe7cf;
}

.pipeline-channel-pill-ms {
  color: #3259b3;
  background: #e9f1ff;
  border-color: #bfd1ff;
}

.pipeline-channel-pill-ig {
  color: #aa3d73;
  background: #fbeaf2;
  border-color: #f1c8dc;
}

.pipeline-badge.status-new {
  background: #eef3ff;
  color: #4965b5;
  border-color: #c6d4ff;
}

.pipeline-badge.status-in_conversation {
  background: #ebf1ff;
  color: #4960b0;
  border-color: #bccdf7;
}

.pipeline-badge.status-quoted {
  background: #fff4da;
  color: #b07013;
  border-color: #f4d082;
}

.pipeline-badge.status-won {
  background: #e8f8ef;
  color: #277b51;
  border-color: #bfe6d0;
}

.pipeline-badge.status-lost {
  background: #fff0f0;
  color: #c45a5a;
  border-color: #f1b7b7;
}

@media (max-width: 1180px) {
  .pipeline-pro-header,
  .pipeline-pro-summary-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pipeline-pro-toolbar {
    justify-content: stretch;
  }

  .pipeline-pro-search,
  .pipeline-pro-primary-btn {
    width: 100%;
  }
}

@media (min-width: 1700px) {
  .pipeline-page .panel.pipeline-pro-shell {
    width: min(100% - 32px, 1720px);
  }

  .pipeline-pro-header {
    padding: 20px 24px 12px;
  }

  .pipeline-pro-summary-row {
    padding: 0 24px 18px;
  }

  .pipeline-board.pipeline-pro-board {
    grid-template-columns: repeat(5, minmax(280px, 1fr));
    padding: 0 24px 24px;
  }

  .pipeline-column {
    min-height: 560px;
  }

  .pipeline-col-body {
    max-height: 660px;
  }
}

@media (max-width: 900px) {
  .pipeline-page .panel.pipeline-pro-shell {
    width: auto;
    margin: 12px;
  }

  .pipeline-pro-header {
    padding: 16px 16px 10px;
  }

  .pipeline-pro-summary-row {
    padding: 0 16px 14px;
  }

  .pipeline-board.pipeline-pro-board {
    padding: 0 16px 16px;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
  }
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  font-size: 30px;
  color: #111;
  background: rgba(255, 255, 255, .9);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.modal-nav.prev {
  left: 24px;
}

.modal-nav.next {
  right: 24px;
}

/* ========= Toasts ========= */
.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: var(--font-14);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

/* ========= Onboarding ========= */
.onboarding-shell {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
  background:
    radial-gradient(140% 140% at 12% 10%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(120% 120% at 88% 0%, rgba(20, 184, 166, 0.12), transparent 60%);
  border-radius: var(--radius-lg);
}

.onboarding-card {
  width: min(920px, 96vw);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.onboarding-header h1 {
  margin: 6px 0 8px;
  font-size: 26px;
}

.onboarding-header p {
  margin: 0;
  color: var(--color-muted-strong);
  font-size: var(--font-14);
}

.onboarding-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.step-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.step-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.step-toggle:hover {
  background: var(--color-surface-alt);
}

.step-mark {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  display: grid;
  place-items: center;
  color: var(--color-muted-strong);
  background: var(--color-surface);
}

.step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text);
}

.step-desc {
  font-size: 13px;
  color: var(--color-muted);
}

.step-chevron {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--color-muted);
  transition: transform .15s ease;
}

.step-item.open .step-chevron {
  transform: rotate(180deg);
}

.step-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .2s ease;
}

.step-item.open .step-body {
  max-height: 220px;
}

.step-body-inner {
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: var(--color-muted-strong);
  font-size: var(--font-14);
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.step-item.done {
  border-color: rgba(22, 163, 74, 0.4);
  background: var(--color-surface-alt);
}

.step-item.done .step-number {
  background: rgba(22, 163, 74, 0.16);
  color: var(--color-success);
}

.step-item.done .step-icon {
  color: var(--color-success);
  border-color: rgba(22, 163, 74, 0.35);
}

.step-item.done .step-complete {
  border-color: rgba(22, 163, 74, 0.4);
  color: var(--color-success);
}

@media (max-width:720px) {
  .onboarding-shell {
    padding: var(--space-4);
  }

  .onboarding-card {
    padding: var(--space-4);
  }

  .step-toggle {
    align-items: flex-start;
  }

  .step-mark {
    flex-direction: column;
    align-items: flex-start;
  }

  .step-chevron {
    margin-top: 4px;
  }
}

/* ========= App Views ========= */
.app-view-panel {
  min-height: 100%;
}

.app-view-panel[data-view="integrations"] {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
}

#app-view {
  min-height: 100%;
}

.page-shell {
  min-height: 100%;
  padding-bottom: 24px;
}

/* ---- Chat page: constrain to viewport (no scroll on body) ---- */
.page-shell[data-page="chat"] {
  height: 100%;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}

body.page-chat {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

body.page-chat .layout,
body.page-chat .main-area {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.page-chat .topbar {
  flex-shrink: 0;
}

body.page-chat .main-area main,
body.page-chat #app-view {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.page-chat .app-view-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.page-shell[data-page="chat"] .app-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.view-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
}

.stat-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 6px;
}

/* ========= Dashboard Pro ========= */
.dashboard-pro-shell {
  width: 100%;
  max-width: none;
  padding: 28px 18px 36px;
}

.app-view-panel[data-view="leads"] {
  padding: 16px 18px 24px;
}

.leads-page {
  width: 100%;
}

.leads-panel {
  padding: 0;
  border-radius: 8px;
  border: 1px solid #dce3ee;
  background:
    radial-gradient(circle at top center, rgba(37, 99, 235, 0.1), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: none;
  overflow: hidden;
}

.leads-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px 14px;
  border-bottom: 1px solid rgba(220, 227, 238, 0.72);
}

.leads-head-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leads-head-copy .title {
  font-size: 28px;
  letter-spacing: -0.04em;
  color: #111827;
}

.leads-subtitle {
  margin: 0;
  max-width: 760px;
  font-size: 14px;
  line-height: 1.5;
  color: #5d6886;
}

.leads-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.leads-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr);
  gap: 12px;
  padding: 18px 28px 12px;
}

.leads-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #d9e1ee;
  background: rgba(248, 250, 255, 0.92);
  box-shadow: none;
}

.leads-search:focus-within {
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.leads-search svg {
  color: #66738f;
  flex: 0 0 auto;
}

.leads-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font-size: 14px;
}

.leads-search input::placeholder {
  color: #8390ad;
}

.leads-toolbar .input {
  min-height: 46px;
  border-radius: 8px;
}

.leads-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 28px 12px;
}

.leads-summary-card {
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid rgba(220, 227, 238, 0.88);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.leads-summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8498;
}

.leads-summary-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #111827;
}

.leads-summary-meta {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}

.leads-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 28px 14px;
  font-size: 13px;
  color: #64748b;
}

.leads-feedback strong {
  color: #0f172a;
}

.leads-content {
  padding: 0 18px 18px;
}

.leads-table-shell {
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
  overflow: hidden;
}

.leads-table-wrap {
  overflow: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  background: rgba(248, 250, 252, 0.98);
  border-bottom: 1px solid #e4e9f1;
}

.leads-table tbody td {
  padding: 16px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.leads-table tbody tr:last-child td {
  border-bottom: 0;
}

.leads-row {
  cursor: pointer;
  transition: background 0.16s ease;
}

.leads-row:hover td,
.leads-row:focus-within td {
  background: rgba(37, 99, 235, 0.03);
}

.leads-row-cell {
  min-width: 0;
}

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

.leads-avatar,
.leads-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  flex: 0 0 40px;
}

.leads-avatar {
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}

.leads-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.16));
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
}

.leads-avatar-fallback svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.leads-avatar-fallback--wa {
  background: #22c55e;
  color: #ffffff;
}

.leads-avatar-fallback--ms {
  background: #3b82f6;
  color: #ffffff;
}

.leads-avatar-fallback--ig {
  background: linear-gradient(135deg, #f58529 0%, #dd2a7b 52%, #8134af 100%);
  color: #ffffff;
}

.leads-avatar-fallback--tiktok {
  background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
  color: #ffffff;
}

.leads-avatar-fallback--external {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
}

.leads-avatar-fallback--webchat {
  background: #7c3aed;
  color: #ffffff;
}

.leads-contact-copy {
  min-width: 0;
}

.leads-contact-button {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.leads-contact-button:hover .leads-contact-name {
  color: #1d4ed8;
}

.leads-contact-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-contact-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leads-status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
}

.leads-last {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.leads-last-main {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.leads-last-sub {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.leads-score {
  display: flex;
  align-items: center;
  min-width: 0;
}

.leads-score-stars {
  --lead-score-active: #16a34a;
  --lead-score-empty: rgba(148, 163, 184, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.leads-score-stars[data-tone="0"] {
  --lead-score-active: #cbd5e1;
}

.leads-score-stars[data-tone="1"] {
  --lead-score-active: #ef4444;
}

.leads-score-stars[data-tone="2"] {
  --lead-score-active: #f59e0b;
}

.leads-score-stars[data-tone="3"] {
  --lead-score-active: #38bdf8;
}

.leads-score-stars[data-tone="4"] {
  --lead-score-active: #16a34a;
}

.leads-score-star {
  width: 16px;
  height: 16px;
  color: var(--lead-score-empty);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leads-score-star svg {
  width: 16px;
  height: 16px;
  display: block;
}

.leads-score-star.is-filled {
  color: var(--lead-score-active);
}

.leads-assignee {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leads-source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #22c55e;
}

.leads-source-badge svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.leads-source-badge--ms {
  color: #0084ff;
}

.leads-source-badge--ig {
  color: #e1306c;
}

.leads-source-badge--tiktok {
  color: #111827;
}

.leads-source-badge--external {
  color: #64748b;
}

.leads-source-badge--webchat {
  color: #0ea5e9;
}

.leads-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.leads-tag {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-tag-more {
  color: #64748b;
}

.leads-empty,
.leads-error,
.leads-skeleton {
  padding: 18px;
}

.leads-empty-card,
.leads-error-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 220px;
  padding: 24px;
  border: 1px dashed rgba(148, 163, 184, 0.34);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.78);
  justify-content: center;
}

.leads-empty-card .title,
.leads-error-card .title {
  font-size: 20px;
}

.leads-skeleton-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leads-skeleton-row {
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--color-skeleton) 25%, var(--color-skeleton-shine) 50%, var(--color-skeleton) 75%);
  background-size: 240% 100%;
  animation: shimmer 1.35s infinite;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-panel {
  background:
    radial-gradient(circle at top center, rgba(59, 130, 246, 0.16), transparent 40%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 28, 0.98));
  border-color: rgba(100, 116, 139, 0.34);
  box-shadow: none;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-head,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-summary-card,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-table-shell,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-search,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-empty-card,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-error-card {
  border-color: rgba(71, 85, 105, 0.55);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-summary-card,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-table-shell,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-search,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-empty-card,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-error-card {
  background: rgba(15, 23, 42, 0.84);
  box-shadow: none;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-head-copy .title,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-summary-value,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-contact-name,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-last-main {
  color: #f8fafc;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-subtitle,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-summary-meta,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-feedback,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-contact-sub,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-last-sub,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-tag-more {
  color: #94a3b8;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-table thead th {
  background: rgba(30, 41, 59, 0.92);
  color: #cbd5e1;
  border-bottom-color: rgba(71, 85, 105, 0.55);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-table tbody td {
  border-bottom-color: rgba(51, 65, 85, 0.82);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-row:hover td,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-row:focus-within td {
  background: rgba(59, 130, 246, 0.08);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-search input {
  color: #f8fafc;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-search input::placeholder {
  color: #94a3b8;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.2));
  color: #bfdbfe;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--wa,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--ms,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--ig,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--tiktok,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--external,
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--webchat {
  color: #ffffff;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--wa {
  background: #22c55e;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--ms {
  background: #3b82f6;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--ig {
  background: linear-gradient(135deg, #fb923c 0%, #ec4899 52%, #8b5cf6 100%);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--tiktok {
  background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--external {
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-avatar-fallback--webchat {
  background: #8b5cf6;
}

html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-score-stars {
  --lead-score-empty: rgba(100, 116, 139, 0.82);
}

@media (max-width: 1200px) {
  .leads-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .leads-head,
  .leads-toolbar,
  .leads-feedback {
    padding-left: 18px;
    padding-right: 18px;
  }

  .leads-head,
  .leads-feedback {
    flex-direction: column;
    align-items: stretch;
  }

  .leads-toolbar {
    grid-template-columns: 1fr;
  }

  .leads-summary {
    grid-template-columns: 1fr;
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 768px) {
  .app-view-panel[data-view="leads"] {
    padding: 12px;
  }

  .leads-content {
    padding: 0 12px 12px;
  }

  .leads-table-wrap {
    overflow: visible;
  }

  .leads-table,
  .leads-table thead,
  .leads-table tbody,
  .leads-table tr,
  .leads-table td {
    display: block;
    width: 100%;
  }

  .leads-table thead {
    display: none;
  }

  .leads-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid #edf2f7;
  }

  .leads-row:last-child {
    border-bottom: 0;
  }

  .leads-table tbody td {
    padding: 0;
    border: 0;
    background: transparent !important;
  }

  .leads-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7b8498;
  }

  .leads-row-cell[data-label="Lead"] {
    grid-column: 1 / -1;
  }

  .leads-score {
    min-width: 0;
  }

  html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-row {
    border-bottom-color: rgba(51, 65, 85, 0.82);
  }

  html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-table tbody td::before {
    color: #94a3b8;
  }
}

.dashboard-pro-panel {
  padding: 0;
  border-radius: 10px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: none;
  overflow: hidden;
}

.dashboard-pro-crumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px 10px;
  border-bottom: 1px solid rgba(220, 227, 238, 0.72);
}

.dashboard-pro-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5d6886;
  font-size: 14px;
}

.dashboard-pro-breadcrumb-item {
  letter-spacing: 0.04em;
}

.dashboard-pro-breadcrumb-sep {
  font-size: 0;
  color: #95a0b8;
}

.dashboard-pro-breadcrumb-sep::before {
  content: "\203A";
  font-size: 18px;
}

.dashboard-pro-breadcrumb-current {
  color: #42506f;
}

.dashboard-pro-range-control {
  min-width: 212px;
}

.dashboard-pro-range-select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  color: #1d2844;
}

.dashboard-pro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 26px 28px 18px;
}

.dashboard-pro-header .title {
  font-size: clamp(34px, 3vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  margin: 0;
  color: #1a2440;
}

.dashboard-pro-subtitle {
  margin: 12px 0 0;
  color: #68738f;
  font-size: 18px;
  line-height: 1.45;
}

.dashboard-pro-live-badge {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border-color: #9dd8af;
  background: #d7f0df;
  color: #17855b;
  box-shadow: none;
}

.dashboard-pro-live-badge::before {
  content: "\21BB";
  display: inline-block;
  margin-right: 10px;
  font-size: 16px;
}

.dashboard-pro-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 0 28px;
}

.dashboard-pro-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 18px 20px 16px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: none;
}

.dashboard-pro-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-pro-card-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

.dashboard-pro-card-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.dashboard-pro-card-icon.conversations {
  background: #dfeafc;
  color: #4c89f6;
}

.dashboard-pro-card-icon.active {
  background: #d9f6f7;
  color: #1fb7c0;
}

.dashboard-pro-card-icon.sold {
  background: #dff4ea;
  color: #3fa67d;
}

.dashboard-pro-card-icon.unassigned {
  background: #dff4ea;
  color: #3fa67d;
}

.dashboard-pro-card-label {
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: #33415f;
  font-weight: 500;
}

.dashboard-pro-card-value {
  font-size: 38px;
  font-weight: 700;
  color: #111827;
  line-height: 1.05;
}

.dashboard-pro-card-value.small {
  font-size: 28px;
}

.dashboard-pro-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 22px 28px 28px;
}

.dashboard-pro-module {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #dfe5ef;
  border-radius: 8px;
  padding: 18px 22px 20px;
  min-height: 360px;
  box-shadow: none;
}

.dashboard-pro-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
}

.dashboard-pro-module-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.dashboard-pro-module-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: #6b7280;
}

.dashboard-pro-channel-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dashboard-pro-module-channels .dashboard-pro-channel-list {
  margin-top: 20px;
}

.dashboard-pro-channel-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard-pro-channel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
  color: #111827;
}

.dashboard-pro-channel-meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #41506f;
}

.dashboard-pro-channel-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  background: #f5f7fb;
  border: 1px solid #e0e5ef;
}

.dashboard-pro-channel-count-muted {
  color: #8190ab;
}

.dashboard-pro-channel-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e9edf4;
  overflow: hidden;
}

.dashboard-pro-channel-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.dashboard-pro-channel-bar.whatsapp {
  background: #22c55e;
}

.dashboard-pro-channel-bar.messenger {
  background: #3b82f6;
}

.dashboard-pro-channel-bar.instagram {
  background: #ec4899;
}

.dashboard-pro-channel-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e4e9f1;
}

.dashboard-pro-channel-summary-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #1d2844;
}

.dashboard-pro-channel-summary-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}

.dashboard-pro-channel-summary-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-pro-channel-summary-item.whatsapp .dashboard-pro-channel-summary-icon {
  background: #4fc37d;
}

.dashboard-pro-channel-summary-item.messenger .dashboard-pro-channel-summary-icon {
  background: #4c89f6;
}

.dashboard-pro-channel-summary-item.instagram .dashboard-pro-channel-summary-icon {
  background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af);
}

.dashboard-pro-channel-summary-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0;
  color: #445272;
}

.dashboard-pro-channel-summary-bottom span {
  font-size: 15px;
}

.dashboard-pro-channel-summary-bottom span:first-child::after {
  content: "\00B7";
  margin-left: 6px;
}

.dashboard-pro-table-wrap {
  max-height: 280px;
  overflow: auto;
}

.dashboard-pro-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
}

.dashboard-pro-table thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5d6886;
  padding: 12px 4px;
  border-bottom: 1px solid #e4e9f1;
}

.dashboard-pro-table tbody td {
  padding: 14px 4px;
  font-size: 16px;
  color: #111827;
  border-bottom: 1px solid #e4e9f1;
}

.dashboard-pro-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-pro-empty-cell {
  color: #7b8498;
  font-style: italic;
}

.dashboard-pro-agent-summary {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid #e4e9f1;
}

.dashboard-pro-agent-summary-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.dashboard-pro-agent-summary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.dashboard-pro-agent-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;
  color: #1d2844;
}

.dashboard-pro-agent-summary-row strong {
  font-size: 18px;
  color: #111827;
}

.dashboard-pro-agent-summary-empty {
    color: #7b8498;
    font-style: italic;
  }

.dashboard-pro-weekday-grid {
  padding: 0 28px 28px;
}

.dashboard-pro-module-weekday {
  min-height: 0;
}

.dashboard-pro-weekday-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-pro-weekday-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 14px;
}

.dashboard-pro-weekday-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-pro-weekday-label {
  font-size: 14px;
  font-weight: 700;
  color: #1d2844;
}

.dashboard-pro-weekday-label-full {
  font-size: 12px;
  color: #7b8498;
}

.dashboard-pro-weekday-track {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eef7;
}

.dashboard-pro-weekday-bar {
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
  transition: width 0.35s ease;
}

.dashboard-pro-weekday-count {
  justify-self: end;
  font-size: 14px;
  font-weight: 700;
  color: #1d2844;
}

.dashboard-pro-weekday-empty {
  color: #7b8498;
  font-style: italic;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-panel {
  background:
    radial-gradient(circle at top center, rgba(59, 130, 246, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 28, 0.98));
  border-color: rgba(100, 116, 139, 0.34);
  box-shadow: 0 30px 60px rgba(2, 6, 23, 0.38);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-breadcrumb-item,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-breadcrumb-current,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-module-title,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-agent-summary-title,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-meta strong,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table tbody td,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-agent-summary-row strong {
  color: #f8fafc;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-subtitle,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-module-subtitle,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-count-muted,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-agent-summary-row,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-empty-cell,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-agent-summary-empty,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table thead th,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-breadcrumb-sep,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-label-full {
  color: #94a3b8;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-range-select,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-live-badge {
  background: rgba(30, 41, 59, 0.86);
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-range-chip,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-range-date-select {
  background: rgba(30, 41, 59, 0.86);
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-range-chip.is-active {
  background: linear-gradient(180deg, rgba(82, 94, 116, 0.96) 0%, rgba(54, 65, 84, 0.96) 100%);
  color: #f8fbff;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-module {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.78));
  border-color: rgba(100, 116, 139, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-label,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-meta span,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-summary-name,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-label,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-count {
  color: #cbd5e1;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-value {
  color: #f8fafc;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-track {
  background: rgba(51, 65, 85, 0.9);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-track {
  background: rgba(51, 65, 85, 0.9);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-bar {
  background: linear-gradient(90deg, #38bdf8 0%, #2563eb 100%);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-count-pill {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(148, 163, 184, 0.24);
  color: #dbeafe;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table-wrap {
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-radius: 16px;
  background: rgba(10, 15, 28, 0.45);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table thead th {
  background: rgba(30, 41, 59, 0.72);
  position: sticky;
  top: 0;
  z-index: 1;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table thead th,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table tbody td {
  border-bottom-color: rgba(71, 85, 105, 0.55);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table tbody tr:hover td {
  background: rgba(30, 41, 59, 0.46);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-agent-summary {
  border-top-color: rgba(71, 85, 105, 0.55);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-summary-item.whatsapp .dashboard-pro-channel-summary-icon {
  box-shadow: 0 8px 22px rgba(34, 197, 94, 0.28);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-summary-item.messenger .dashboard-pro-channel-summary-icon {
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.28);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-channel-summary-item.instagram .dashboard-pro-channel-summary-icon {
  box-shadow: 0 8px 22px rgba(236, 72, 153, 0.24);
}

.dashboard-pro-error {
  border: 1px solid rgba(220, 38, 38, 0.45);
  border-radius: 16px;
  padding: 18px;
  background: rgba(220, 38, 38, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 28px 28px;
}

.dashboard-pro-error-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
}

.dashboard-pro-skeleton .dashboard-pro-card,
.dashboard-pro-skeleton .dashboard-pro-module {
  position: relative;
  overflow: hidden;
}

.dashboard-pro-skeleton .dashboard-pro-card::after,
.dashboard-pro-skeleton .dashboard-pro-module::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: dashboardSkMove 1.2s ease-in-out infinite;
}

.dashboard-pro-sk-line {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-skeleton), var(--color-skeleton-shine), var(--color-skeleton));
}

.dashboard-pro-sk-line.tall {
  height: 30px;
}

.dashboard-pro-sk-line.w40 {
  width: 40%;
}

.dashboard-pro-sk-line.w45 {
  width: 45%;
}

.dashboard-pro-sk-line.w65 {
  width: 65%;
}

.dashboard-pro-sk-line.w85 {
  width: 85%;
}

.dashboard-pro-sk-line.w100 {
  width: 100%;
}

@keyframes dashboardSkMove {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 1280px) {
  .dashboard-pro-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-pro-bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-pro-channel-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .dashboard-pro-panel {
    border-radius: 22px;
  }

  .dashboard-pro-crumb-row,
  .dashboard-pro-header,
  .dashboard-pro-metrics-grid,
  .dashboard-pro-bottom-grid,
  .dashboard-pro-weekday-grid {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dashboard-pro-crumb-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-pro-header .title {
    font-size: 30px;
  }

  .dashboard-pro-metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-pro-card-value {
    font-size: 34px;
  }

  .dashboard-pro-live-badge {
    width: 100%;
    justify-content: center;
  }

  .dashboard-pro-module {
    min-height: 0;
  }

  .dashboard-pro-channel-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-pro-channel-meta-right {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-pro-weekday-row {
    grid-template-columns: 72px minmax(0, 1fr) 40px;
    gap: 10px;
  }

  .dashboard-pro-weekday-label-full {
    display: none;
  }
}

/* ===== Dashboard Pro refresh ===== */
.dashboard-pro-range-control {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  position: relative;
}

.dashboard-pro-range-control .dashboard-pro-range-toolbar {
  display: none;
}

.dashboard-pro-date-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 220px;
  min-height: 44px;
  padding: 0 14px 0 16px;
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #16233d;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-pro-date-button:hover {
  border-color: #bfd0e6;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.dashboard-pro-date-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
  opacity: 0.72;
}

.dashboard-calendar-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 50;
  display: flex;
  width: min(720px, calc(100vw - 28px));
  max-height: none;
  overflow: visible;
  border: 1px solid #d8e0ec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.dashboard-calendar-popover.hidden {
  display: none;
}

.dashboard-calendar-presets {
  width: 226px;
  flex: 0 0 226px;
  padding: 8px 0;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dashboard-calendar-preset {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #303846;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.dashboard-calendar-preset:hover,
.dashboard-calendar-preset.is-active {
  background: #eaf2ff;
  color: #1d4ed8;
}

.dashboard-calendar-main {
  min-width: 0;
  flex: 1 1 auto;
  padding: 16px;
}

.dashboard-calendar-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.dashboard-calendar-inputs label {
  display: grid;
  gap: 4px;
}

.dashboard-calendar-inputs span {
  font-size: 12px;
  color: #64748b;
}

.dashboard-calendar-inputs input {
  min-height: 38px;
  border-radius: 5px;
  font-size: 13px;
}

.dashboard-calendar-separator {
  padding-bottom: 10px;
  color: #1f2937;
}

.dashboard-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-calendar-month-title {
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-calendar-icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 30px;
  line-height: 1;
}

.dashboard-calendar-icon-btn:hover {
  background: #f1f5f9;
  color: #1f2937;
}

.dashboard-calendar-weekdays,
.dashboard-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.dashboard-calendar-weekdays {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.dashboard-calendar-months {
  display: grid;
  gap: 12px;
}

.dashboard-calendar-month {
  min-width: 0;
}

.dashboard-calendar-month h3 {
  margin: 0 0 6px;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-calendar-day {
  display: inline-flex;
  min-width: 0;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-top: 1px dashed #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
}

.dashboard-calendar-day:hover {
  background: #eef6ff;
  color: #1d4ed8;
}

.dashboard-calendar-day.is-muted {
  color: #b8c0cc;
}

.dashboard-calendar-day.is-in-range {
  background: #dbeafe;
}

.dashboard-calendar-day.is-selected {
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
}

.dashboard-calendar-day.is-today:not(.is-selected) {
  outline: 1px solid #94a3b8;
  outline-offset: -4px;
  border-radius: 999px;
}

.dashboard-calendar-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px -16px -16px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.dashboard-pro-range-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #71809f;
}

.dashboard-pro-range-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-pro-range-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fe 100%);
  color: #495675;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dashboard-pro-range-chip:hover {
  border-color: #bfd0e6;
  color: #1c2945;
  transform: translateY(-1px);
}

.dashboard-pro-range-chip.is-active {
  border-color: #d8dee8;
  background: linear-gradient(180deg, #edf2f8 0%, #dfe6ef 100%);
  color: #1b243b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dashboard-pro-range-date-select {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 38px 0 16px;
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #4a5674;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  -webkit-appearance: none;
  appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M7 2v3M17 2v3M3.5 9.5h17M5 5.5h14a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 19 19.5H5A1.5 1.5 0 0 1 3.5 18V7A1.5 1.5 0 0 1 5 5.5Z' stroke='%234a5674' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23859ab6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: left 14px center, right 14px center;
  background-size: 14px 14px, 12px 12px;
  padding-left: 38px;
}

.dashboard-pro-range-date-select:hover {
  border-color: #bfd0e6;
}

.dashboard-pro-range-date-select:focus {
  outline: none;
  border-color: #7aa7ff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14), 0 16px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-pro-range-control > .dashboard-pro-range-toolbar {
  display: none;
}

.dashboard-pro-range-select {
  min-width: 220px;
  min-height: 46px;
  padding: 0 44px 0 16px;
  border-radius: 15px;
  border: 1px solid #d9e2ef;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%),
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 55%);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  color: #16233d;
  font-weight: 600;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.dashboard-pro-range-select:hover {
  border-color: #bfd0e6;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-pro-range-select:focus {
  border-color: #7aa7ff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14), 0 16px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-pro-live-badge {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  border-color: #cdd8e8;
  background: #f7faff;
  color: #31415e;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.dashboard-pro-live-badge::before {
  content: "\21BB";
  display: inline-block;
  margin-right: 10px;
  font-size: 16px;
}

.dashboard-pro-metrics-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-pro-kpi-card {
  min-height: 180px;
  padding: 20px 20px 18px;
  justify-content: flex-start;
  gap: 12px;
}

.dashboard-pro-card-icon.agents {
  background: #ede9fe;
  color: #7c3aed;
}

.dashboard-pro-card-icon.conversion {
  background: #fde68a;
  color: #a16207;
}

.dashboard-pro-card-label {
  font-size: 15px;
  font-weight: 700;
  color: #33415f;
}

.dashboard-pro-card-value {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.dashboard-pro-card-period {
  font-size: 13px;
  color: #7b88a2;
}

.dashboard-pro-card-delta {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  width: max-content;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #54637e;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-pro-card-delta[data-tone="up"] {
  background: #dcfce7;
  color: #166534;
}

.dashboard-pro-card-delta[data-tone="down"] {
  background: #fee2e2;
  color: #991b1b;
}

.dashboard-pro-card-delta[data-tone="neutral"] {
  background: #eef2f7;
  color: #54637e;
}

.dashboard-pro-bottom-grid,
.dashboard-pro-bottom-grid-secondary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-pro-bottom-grid-secondary {
  grid-template-columns: minmax(380px, 1.05fr) minmax(520px, 1.55fr);
}

.dashboard-pro-bottom-grid-secondary {
  padding-top: 0;
}

.dashboard-pro-module {
  min-height: 0;
  padding: 20px 22px 22px;
}

.dashboard-pro-bottom-grid-secondary .dashboard-pro-module {
  height: 100%;
}

.dashboard-pro-bottom-grid-secondary .dashboard-pro-table-wrap {
  min-height: 0;
}

.dashboard-pro-module-insight {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: #f7faff;
  border: 1px solid #e1e9f5;
  color: #31415e;
  font-size: 14px;
  line-height: 1.5;
}

.dashboard-pro-channel-list {
  gap: 16px;
}

.dashboard-pro-channel-row.is-zero {
  opacity: 0.58;
}

.dashboard-pro-channel-meta {
  font-size: 15px;
  font-weight: 600;
}

.dashboard-pro-channel-count-pill {
  min-width: 40px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
}

.dashboard-pro-channel-bar.is-zero {
  width: 0 !important;
}

.dashboard-pro-insight-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-pro-insight-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid #e3e9f4;
}

.dashboard-pro-insight-item p {
  margin: 0;
  color: #24314d;
  font-size: 14px;
  line-height: 1.5;
}

.dashboard-pro-insight-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: linear-gradient(135deg, #3b82f6 0%, #22c55e 100%);
}

.dashboard-pro-insight-empty {
  padding: 18px 16px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #d8e0ea;
  color: #7b88a2;
  font-size: 14px;
}

.dashboard-pro-table-wrap {
  max-height: 360px;
  min-height: 160px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #fcfdff;
  overflow: hidden;
}

.dashboard-pro-table {
  width: 100%;
  min-width: 460px;
}

.dashboard-pro-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(250, 252, 255, 0.96);
}

.dashboard-pro-module-agents {
  padding-bottom: 18px;
  overflow: hidden;
}

.dashboard-pro-module-agents .dashboard-pro-module-head {
  margin-bottom: 14px;
}

.dashboard-pro-module-agents .dashboard-pro-module-subtitle {
  max-width: 480px;
}

.dashboard-pro-module-agents .dashboard-pro-table thead th {
  padding: 14px 22px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.dashboard-pro-module-agents .dashboard-pro-table tbody td {
  padding: 18px 22px;
  vertical-align: middle;
}

.dashboard-pro-agent-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-pro-agent-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(180deg, #ede9fe 0%, #ddd6fe 100%);
  color: #7c3aed;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.dashboard-pro-agent-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dashboard-pro-agent-copy strong {
  font-size: 16px;
  color: #16233d;
  line-height: 1.1;
}

.dashboard-pro-agent-copy span {
  font-size: 12px;
  color: #7b88a2;
}

.dashboard-pro-table-value {
  font-size: 17px;
  font-weight: 700;
  color: #16233d;
}

.dashboard-pro-conversion-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  font-size: 14px;
  font-weight: 800;
}

.dashboard-pro-weekday-chart {
  min-height: 320px;
}

.dashboard-pro-weekday-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 280px;
}

.dashboard-pro-weekday-bar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 280px;
}

.dashboard-pro-weekday-value {
  font-size: 13px;
  font-weight: 700;
  color: #31415e;
}

.dashboard-pro-weekday-column {
  width: 100%;
  max-width: 64px;
  min-height: 180px;
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff4fb 0%, #e7eef8 100%);
  border: 1px solid #dde6f2;
}

.dashboard-pro-weekday-column-fill {
  width: 100%;
  border-radius: 8px;
  min-height: 0;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  box-shadow: none;
}

.dashboard-pro-weekday-bar-card.is-peak .dashboard-pro-weekday-column {
  background: linear-gradient(180deg, #e3f0ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}

.dashboard-pro-weekday-bar-card.is-peak .dashboard-pro-weekday-column-fill {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  box-shadow: none;
}

.dashboard-pro-weekday-day {
  font-size: 13px;
  font-weight: 800;
  color: #1f2a44;
}

.dashboard-pro-weekday-day-full {
  font-size: 12px;
  color: #7b88a2;
  text-align: center;
}

.dashboard-pro-weekday-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  border-radius: 8px;
  border: 1px dashed #d8e0ea;
  background: #f8fafc;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-range-label,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-period,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-insight-empty,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-day-full {
  color: #94a3b8;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-delta[data-tone="neutral"] {
  background: rgba(51, 65, 85, 0.9);
  color: #cbd5e1;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-delta[data-tone="up"] {
  background: rgba(21, 128, 61, 0.24);
  color: #86efac;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-card-delta[data-tone="down"] {
  background: rgba(153, 27, 27, 0.24);
  color: #fca5a5;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-module-insight,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-insight-item,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-column {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(71, 85, 105, 0.45);
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-insight-item p,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-module-insight,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-value,
html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-day {
  color: #e2e8f0;
}

html[data-theme="dark"] .app-view-panel[data-view="dashboard"] .dashboard-pro-table-wrap {
  background: rgba(10, 15, 28, 0.45);
}

.app-view-panel[data-view="dashboard"] .dashboard-pro-panel,
.app-view-panel[data-view="dashboard"] .dashboard-pro-card,
.app-view-panel[data-view="dashboard"] .dashboard-pro-module,
.app-view-panel[data-view="dashboard"] .dashboard-pro-module-insight,
.app-view-panel[data-view="dashboard"] .dashboard-pro-insight-item,
.app-view-panel[data-view="dashboard"] .dashboard-pro-insight-empty,
.app-view-panel[data-view="dashboard"] .dashboard-pro-table-wrap,
.app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-column,
.app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-empty {
  border-radius: 8px;
  box-shadow: none;
}

.app-view-panel[data-view="dashboard"] .dashboard-pro-card-icon,
.app-view-panel[data-view="dashboard"] .dashboard-pro-agent-avatar,
.app-view-panel[data-view="dashboard"] .dashboard-pro-channel-count-pill,
.app-view-panel[data-view="dashboard"] .dashboard-pro-conversion-pill,
.app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-column-fill {
  border-radius: 8px;
  box-shadow: none;
}

.app-view-panel[data-view="dashboard"] .dashboard-pro-weekday-bar-card.is-peak .dashboard-pro-weekday-column-fill {
  box-shadow: none;
}

@media (max-width: 1360px) {
  .dashboard-pro-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-pro-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-pro-bottom-grid,
  .dashboard-pro-bottom-grid-secondary {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .dashboard-pro-range-control {
    align-items: stretch;
    width: 100%;
  }

  .dashboard-pro-range-toolbar {
    justify-content: flex-start;
  }

  .dashboard-pro-range-select {
    width: 100%;
    min-width: 0;
  }

  .dashboard-pro-date-button {
    width: 100%;
    min-width: 0;
  }

  .dashboard-calendar-popover {
    left: 0;
    right: auto;
    flex-direction: column;
    width: min(100%, calc(100vw - 28px));
    max-height: min(680px, calc(100vh - 120px));
    overflow: auto;
  }

  .dashboard-calendar-presets {
    width: 100%;
    flex-basis: auto;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .dashboard-calendar-inputs {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-calendar-separator {
    display: none;
  }

  .dashboard-pro-metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-pro-kpi-card {
    min-height: 0;
  }

  .dashboard-pro-card-value {
    font-size: 36px;
  }

  .dashboard-pro-weekday-bars {
    gap: 8px;
    min-height: 240px;
  }

  .dashboard-pro-weekday-bar-card {
    min-height: 240px;
  }

  .dashboard-pro-weekday-column {
    max-width: 100%;
    min-height: 140px;
    height: 140px;
  }

  .dashboard-pro-weekday-day-full {
    display: none;
  }
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.team-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
}

.team-panel {
  padding: 22px;
  gap: 18px;
}

.team-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.team-subtitle {
  margin-top: 6px;
  max-width: 780px;
}

.team-status {
  font-size: 13px;
}

.team-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.team-summary-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 248, 253, 0.96));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-summary-card strong {
  font-size: 24px;
  color: var(--color-text);
}

.team-summary-label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.team-config-card {
  display: block;
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 252, 0.98));
  box-shadow: none;
}

.team-config-card.is-saving {
  opacity: 0.72;
}

.team-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.team-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.team-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.team-card-body {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.team-card-body[hidden] {
  display: none;
}

.team-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--color-surface);
  color: var(--color-muted-strong);
  border: 1px solid var(--color-border);
}

.team-info {
  flex: 1;
  min-width: 0;
}

.team-name {
  font-weight: 700;
  color: var(--color-text);
}

.team-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.team-gear-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #ffffff;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.team-gear-btn:hover {
  background: var(--color-surface);
}

.team-config-card.is-open .team-gear-btn {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.team-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-toggle-copy strong {
  color: var(--color-text);
}

.team-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.team-toggle-switch {
  width: 60px;
  height: 34px;
  border-radius: 999px;
  background: #d7dee8;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.team-toggle-switch::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease;
}

.team-toggle-input:checked + .team-toggle-switch {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.team-toggle-input:checked + .team-toggle-switch::before {
  transform: translateX(26px);
}

.team-channel-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-channel-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

.team-channel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.team-channel-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #ffffff;
  color: var(--color-text);
  cursor: pointer;
}

.team-channel-option input {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.team-card-footer {
  font-size: 13px;
  line-height: 1.5;
}

.team-supervisor-alerts {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.team-supervisor-copy,
.team-supervisor-field {
  font-size: 13px;
}

.team-supervisor-field {
  display: grid;
  gap: 6px;
}

@media (max-width: 900px) {
  .team-summary {
    grid-template-columns: 1fr;
  }

  .team-header,
  .team-card-head {
    flex-direction: column;
  }

  .team-card-meta {
    justify-content: flex-start;
  }

  .team-toggle-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill.online {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.status-pill.busy {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.status-pill.offline {
  background: var(--color-surface);
  color: var(--color-muted);
  border-color: var(--color-border);
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.integration-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: none;
  align-self: start;
}

.integration-card[data-provider="woocommerce"] {
  width: 100%;
  max-width: 420px;
}

.integration-card-toolbar {
  display: flex;
  justify-content: flex-start;
}

.integration-expandable {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-card.is-collapsed .integration-expandable {
  display: none;
}

.integration-popup {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.integration-popup.hidden {
  display: none;
}

.integration-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.integration-popup-dialog {
  position: relative;
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 56px);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.integration-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
}

.integration-popup-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-text);
}

.integration-popup-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.integration-popup-body {
  padding: 18px;
  overflow: auto;
}

.integration-popup-body .integration-expandable {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integration-popup-actions {
  display: flex;
  justify-content: flex-end;
}

.integration-card[data-collapsible="true"] .integration-collapse-btn {
  min-width: 132px;
}

.integration-card.loading {
  opacity: .6;
  pointer-events: none;
}

.integration-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.integration-icon {
  width: 48px;
  height: 48px;
  border-radius: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--color-text);
  overflow: visible;
  padding: 0;
}

.integration-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.integration-icon.fb {
  background: transparent;
}

.integration-icon.ig {
  background: transparent;
}

.integration-icon.wa {
  background: transparent;
}

.integration-icon.uchat {
  background: transparent;
}

.integration-icon.woo {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
  font-weight: 800;
  font-size: 12px;
}

.integration-card-wide {
  grid-column: 1 / -1;
}

.woocommerce-warning {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.woocommerce-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 14px;
}

.woocommerce-panel {
  border: 1px solid rgba(148, 163, 184, .26);
  border-radius: 14px;
  background: rgba(255, 255, 255, .82);
  padding: 14px;
  box-shadow: 0 14px 28px -30px rgba(15, 23, 42, .7);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.woocommerce-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.woocommerce-panel-title {
  color: var(--color-text);
  font-weight: 800;
  font-size: 14px;
}

.woocommerce-form-grid,
.woocommerce-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.woocommerce-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-muted-strong);
}

.woocommerce-field .input-field,
.woocommerce-secret-row .input-field,
.woocommerce-variable-row .input-field {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: 8px 10px;
}

.woocommerce-secret-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.woocommerce-secret-row .input-field {
  min-width: 0;
  flex: 1;
}

.woocommerce-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.woocommerce-result {
  min-height: 18px;
  font-size: 12px;
}

.woocommerce-result.error,
#woo-templates-status.error {
  color: #991b1b;
}

.woocommerce-webhook-steps,
.woocommerce-note,
.woocommerce-empty,
.woocommerce-template-summary {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.45;
}

.woocommerce-rules-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.woocommerce-rule {
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.woocommerce-rule-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.woocommerce-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-weight: 800;
}

.woocommerce-status-code {
  font-size: 11px;
  font-weight: 800;
  color: #5b21b6;
  background: #ede9fe;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  padding: 4px 8px;
}

.woocommerce-variable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.woocommerce-variable-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--color-muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.woocommerce-integrations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.woocommerce-integration-row {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.woocommerce-integration-row.is-selected {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.woocommerce-integration-row small {
  color: var(--color-muted);
}

@media (max-width: 900px) {
  .woocommerce-layout,
  .woocommerce-form-grid,
  .woocommerce-rule-grid,
  .woocommerce-rules-list,
  .woocommerce-integration-row {
    grid-template-columns: 1fr;
  }
}

.integration-title {
  font-weight: 700;
  color: var(--color-text);
}

.integration-sub {
  font-size: 12px;
}

.integration-body {
  color: var(--color-muted-strong);
  font-size: 13px;
  line-height: 1.4;
}

.whatsapp-templates-panel {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.92) 100%),
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.12), transparent 52%);
  box-shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.whatsapp-templates-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.whatsapp-templates-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

.whatsapp-templates-subtitle {
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.whatsapp-templates-status {
  min-height: 18px;
  font-size: 12px;
}

.whatsapp-templates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.whatsapp-template-item {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 24px -28px rgba(15, 23, 42, 0.7);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whatsapp-template-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.whatsapp-template-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
}

.whatsapp-template-meta {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 3px;
}

.whatsapp-template-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.whatsapp-template-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.whatsapp-template-badge.status-approved {
  color: #166534;
  background: #dcfce7;
  border-color: #bbf7d0;
}

.whatsapp-template-badge.status-paused {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.whatsapp-template-badge.status-rejected {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.whatsapp-template-badge.status-default {
  color: #334155;
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.whatsapp-template-badge.quality {
  color: #155e75;
  background: #cffafe;
  border-color: #a5f3fc;
}

.whatsapp-template-extra {
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.whatsapp-template-reason {
  font-size: 12px;
  color: #991b1b;
  background: rgba(254, 226, 226, 0.85);
  border: 1px solid rgba(252, 165, 165, 0.45);
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .whatsapp-templates-header,
  .whatsapp-template-main {
    flex-direction: column;
  }

  .whatsapp-template-badges {
    justify-content: flex-start;
  }
}

.integration-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.integration-actions {
  display: flex;
  gap: 8px;
}

.integration-card .btn,
.integration-card .btn.small {
  border-radius: 8px;
}

.integration-state {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted-strong);
}

.integration-state.connected {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.integration-state.error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.integration-state.idle {
  background: var(--color-surface);
  color: var(--color-muted-strong);
  border-color: var(--color-border);
}

/* ========= Utils ========= */
.highlight {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 4px;
}

.loader.hidden,
.empty-state.hidden {
  display: none !important;
}

/* ========= Animations ========= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  100% {
    background-position: 200% 50%;
  }
}

/* ========= Responsive ========= */
@media (max-width:1080px) {
  .app-shell {
    grid-template-columns: 348px minmax(0, 1fr);
    grid-template-areas: "sidebar chat";
    height: calc(100vh - 72px);
  }

  .info-panel {
    display: flex;
  }
}

@media (max-width:900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 12px;
  }

  .sidebar {
    order: 1;
    height: 320px;
  }

  .chat-area {
    order: 2;
    height: calc(100vh - 420px);
  }
}

@media (max-width:640px) {
  .auth-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-inputs {
    width: 100%;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-actions {
    align-self: flex-end;
  }

  .chat-input {
    flex-wrap: wrap;
  }

  .chat-input .btn.primary {
    width: 100%;
  }

  .scroll-bottom {
    right: 12px;
    bottom: 100px;
  }
}

@media (max-width:1024px) {
  .layout {
    grid-template-columns: 0 1fr;
  }

  .sidebar-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 6;
    height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .mobile-only {
    display: inline-flex;
  }
}

@media (max-width:768px) {
  body {
    overflow: hidden;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .main-area main {
    padding: 10px;
  }

  .chat-container,
  .app-shell {
    height: calc(100vh - 60px);
    padding: 0;
  }

  .panel.sidebar {
    display: none;
  }

  .chat-area {
    height: 100%;
  }

  .info-panel {
    display: flex;
  }

  .chat-mobile-tabs {
    display: flex;
  }

  .ai-controls {
    width: 100%;
    gap: 6px;
  }

  .ai-controls select {
    flex: 1;
  }

  .ai-controls .btn {
    padding: 8px 10px;
  }

  .bubble {
    max-width: 85%;
  }

  .bubble.bubble-audio {
    max-width: 92%;
  }
}

/* ===== Base rule: back button hidden by default (desktop) ===== */
.mobile-back-btn {
  display: none;
}

/* ========= Phone optimizations (<= 480px) ========= */
@media (max-width:480px) {

  /* --- 1) Back button: show, replace mobile tabs --- */
  .mobile-back-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text, #1e293b);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 4px;
  }

  .mobile-back-btn:active {
    background: var(--color-surface-alt, rgba(0, 0, 0, 0.06));
  }

  .chat-mobile-tabs {
    display: none !important;
  }

  /* --- 2) Topbar: compact for phone --- */
  .topbar {
    padding: 6px 10px;
    min-height: 44px;
  }

  .topbar-right .user-email,
  .topbar-right .user-role,
  .topbar-right .build-stamp,
  #user-email,
  #user-role,
  #build-stamp {
    display: none !important;
  }

  .topbar-right {
    gap: 6px;
  }

  #logout-btn {
    font-size: 11px;
    padding: 6px 10px;
    min-height: 36px;
  }

  .topbar-theme-toggle {
    width: 36px;
    height: 36px;
    margin-right: 4px;
  }

  .topbar-left .title {
    font-size: 15px;
  }

  /* --- 3) Chat header: single row, no column layout --- */
  .chat-header {
    flex-direction: row !important;
    align-items: center;
    min-height: 48px;
    padding: 6px 8px;
    gap: 6px;
  }

  .chat-title {
    flex: 1;
    min-width: 0;
    gap: 6px;
  }

  .chat-actions {
    gap: 4px;
    align-self: center !important;
    flex-shrink: 0;
  }

  .chat-header .icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  /* AI controls: hide on phone (accessible via menu) */
  .ai-controls {
    display: none;
  }

  .contact-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .contact-subtitle,
  .contact-subtitle-row {
    font-size: 11px;
  }

  .avatar-circle {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .avatar-circle img {
    width: 36px;
    height: 36px;
  }

  /* --- 4) Chat input: fixed bottom, bigger buttons --- */
  .chat-input {
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    gap: 4px;
    flex-wrap: nowrap !important;
  }

  .chat-input.has-reply-draft {
    flex-wrap: wrap !important;
  }

  .chat-input .btn.primary {
    width: auto !important;
  }

  #send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
  }

  #attach-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 20px;
  }

  #audio-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 20px;
  }

  .input-field {
    flex: 1;
    min-width: 0;
  }

#message-input {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  min-height: 44px;
  line-height: 1.45;
  resize: none;
  overflow-y: auto;
  max-height: 140px;
}

  #emoji-btn {
    width: 32px;
    height: 32px;
  }

  /* --- 5) Bubbles: wider on phone --- */
  .bubble {
    max-width: 92%;
  }

  .bubble .text {
    font-size: 14px;
    line-height: 1.45;
  }

  .meta {
    font-size: 10px;
  }

  /* --- 6) Scroll: momentum + safe area --- */
  .chat-messages,
  .chat-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .chat-body {
    padding: 8px 4px;
  }

  .scroll-bottom {
    right: 10px;
    bottom: 80px;
    width: 40px;
    height: 40px;
  }

  /* --- 7) Fix height chain: body → layout → main-area → main → app-shell → chat-area --- */
  body.page-chat {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }

  body.page-chat .layout {
    height: 100%;
    overflow: hidden;
  }

  body.page-chat .main-area {
    height: 100%;
    overflow: hidden;
  }

  body.page-chat .topbar {
    flex-shrink: 0;
  }

  body.page-chat .main-area main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    height: auto;
  }

  body.page-chat .app-view-panel {
    height: 100%;
    overflow: hidden;
  }

  .page-shell[data-page="chat"] {
    height: 100%;
    overflow: hidden;
  }

  .page-shell[data-page="chat"] .app-shell {
    height: 100% !important;
    overflow: hidden;
  }

  .page-shell[data-page="chat"] .chat-area {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-header {
    flex-shrink: 0;
  }

  .chat-input {
    flex-shrink: 0;
  }

  .ai-suggestion-box {
    flex-shrink: 0;
  }

  .page-shell[data-page="chat"] .chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* --- Contact list: larger tap targets --- */
  .contact.conv-item {
    padding: 14px 12px;
    min-height: 64px;
  }

  .contact-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .contact-name {
    font-size: 15px;
  }

  .contact-last-msg {
    font-size: 13px;
  }

  .contact-time {
    font-size: 11px;
  }

  .contact-phone {
    font-size: 11px;
  }

  /* --- Sidebar: compact for phone --- */
  .sidebar-top {
    padding: 10px 10px 6px;
  }

  .sidebar-top .btn {
    min-height: 40px;
    font-size: 13px;
  }

  .sidebar-search {
    padding: 6px 10px;
  }

  .sidebar-search input {
    font-size: 16px;
    min-height: 36px;
  }

  .filter-tag {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .filter-add-btn {
    min-width: 32px;
    min-height: 32px;
  }

  /* --- Attach menu: full width at bottom --- */
  .attach-menu {
    bottom: 100%;
    left: 0;
    right: auto;
    width: 100vw;
    max-width: 100vw;
    border-radius: 12px 12px 0 0;
  }

  .attach-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* --- Emoji picker: full width --- */
  .emoji-picker {
    width: 100%;
    left: 0;
    right: 0;
    bottom: 100%;
    border-radius: 12px 12px 0 0;
  }

  /* --- Modals: full width on phone --- */
  .modal .panel {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 12px 12px 0 0;
  }

  /* --- Dropdown menu: wider --- */
  .dropdown {
    min-width: 200px;
    right: 0;
  }

  .dropdown-item {
    padding: 12px 16px;
    min-height: 44px;
  }

  /* --- AI suggestion box: compact --- */
  .ai-suggestion-box {
    margin: 4px 8px;
    padding: 10px;
  }

  /* --- Info panel: full screen on phone --- */
  .info-panel {
    width: 100vw;
    position: fixed;
    inset: 0;
    z-index: 10;
    border-radius: 0;
  }

  .info-header {
    min-height: 48px;
    padding: 8px 12px;
  }

  .info-icon-btn {
    width: 44px;
    height: 44px;
  }
}


@media (max-width:1100px) {
  .info-panel {
    width: min(420px, 92vw);
    max-width: 92vw;
  }
}

@media (max-width:700px) {
  .table-responsive {
    overflow-x: auto;
  }

  .table {
    display: block;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .table tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
  }

  .table td {
    padding: 0 !important;
  }
}

/* ========= AI Suggestion Box ========= */
.ai-suggestion-box {
  margin: 0 var(--space-4);
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: linear-gradient(135deg, var(--color-primary-soft) 0%, var(--color-surface) 100%);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.2s ease;
}

.ai-suggestion-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.ai-suggestion-icon {
  font-size: 18px;
}

.ai-suggestion-title {
  font-weight: 700;
  font-size: var(--font-14);
  color: var(--color-primary);
  flex: 1;
}

.ai-suggestion-text {
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-14);
  line-height: 1.5;
  color: var(--color-text);
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.ai-suggestion-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  justify-content: flex-end;
}

.ai-global-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.ai-page-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.ai-page-shell > .ai-profiles-shell {
  width: min(100% - 28px, 1680px);
  margin: 14px auto !important;
}

.ai-profiles-shell {
  padding: 28px 30px 34px !important;
  border-radius: 34px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
}

.ai-profiles-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.ai-profiles-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ai-profiles-eyebrow {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  color: #111827;
}

.ai-profiles-title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: #5d6886;
}

.ai-profiles-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ai-profiles-actions .btn.small {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.ai-profiles-actions .btn.ghost.small {
  background: #f6f8fc;
  border-color: #d4dceb;
  color: #1d2844;
}

.ai-profiles-actions .btn.primary.small {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  border-color: transparent;
}

.ai-profiles-board {
  margin-top: 18px;
  max-width: 1280px;
  padding: 18px 14px 16px;
  border: 1px solid #dfe5ef;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9fd 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.ai-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 12px;
  margin-top: 0;
}

.ai-profile-card {
  min-height: 264px;
  padding: 22px 28px 20px;
  border: 1px solid #dfe5ef;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.ai-profile-card:hover {
  box-shadow: 0 22px 36px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.ai-profile-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.ai-profile-card-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-profile-card-brand {
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  color: #111827;
  letter-spacing: 0.01em;
}

.ai-profile-card-name {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: #111827;
}

.ai-profile-card-logo {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  display: inline-block;
  background-color: #2bb88b;
  -webkit-mask-image: url('/media/Logo-gpt.svg');
  mask-image: url('/media/Logo-gpt.svg');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.ai-profile-card-logo.is-offline {
  background-color: #7d879e;
}

.ai-profile-card-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
}

.ai-profile-card-model-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-profile-card-label {
  font-size: 15px;
  font-weight: 500;
  color: #7b8498;
}

.ai-profile-card-model {
  font-size: 20px;
  line-height: 1.15;
  font-weight: 600;
  color: #111827;
}

.ai-profile-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.ai-profile-card-actions .btn.primary.small {
  min-width: 108px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 14px;
  border-color: transparent;
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  box-shadow: 0 10px 18px rgba(44, 107, 246, 0.22);
  font-size: 15px;
}

.ai-profile-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-profile-card-status {
  min-width: 140px;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

.ai-profile-card-secondary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ai-profile-card-secondary-actions .btn {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 14px;
  background: #f6f8fc;
  border-color: #d4dceb;
  color: #111827;
  box-shadow: none;
}

.ai-profile-empty {
  padding: 32px 24px;
  border: 1px dashed #d4dceb;
  border-radius: 18px;
  color: #6b7280;
  text-align: center;
  background: #f8fafc;
}

@media (max-width: 900px) {
  .ai-page-shell > .ai-profiles-shell {
    width: auto;
    margin: 12px auto !important;
  }

  .ai-profiles-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ai-profiles-board {
    max-width: none;
  }

  .ai-profile-grid {
    grid-template-columns: 1fr;
  }
}

.ai-global-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-global-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  font-size: 14px;
  cursor: pointer;
}

.ai-global-toggle input {
  transform: scale(1.1);
}

.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.day-chips.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.day-chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.day-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.ai-global-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ai-global-card {
  margin-top: 24px;
  padding: 42px 52px 34px;
  border-radius: 34px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
}

.ai-global-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.ai-global-card-title {
  font-size: clamp(38px, 3.4vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: #1a2440;
}

.ai-global-card-copy .muted,
.ai-global-card-subtitle {
  margin-top: 12px;
  font-size: 18px !important;
  line-height: 1.45;
  color: #68738f;
}

.ai-global-status,
#ai-global-active.status-pill.ai-global-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: #f3f5f9;
  box-shadow: none;
  font-size: 18px;
  font-weight: 600;
  color: #6f7994;
}

.ai-global-status.online,
#ai-global-active.status-pill.ai-global-status.online {
  border-color: #9dd8af;
  background: #d7f0df;
  color: #17855b;
}

.ai-global-status.offline,
#ai-global-active.status-pill.ai-global-status.offline {
  border-color: #d7dee8;
  background: #f3f5f9;
  color: #6f7994;
}

.ai-global-divider {
  height: 1px;
  margin: 26px 0 30px;
  background: linear-gradient(90deg, rgba(212, 220, 232, 0.72), rgba(212, 220, 232, 0.28));
}

.ai-global-layout {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(300px, 0.88fr);
  gap: 26px 32px;
  align-items: start;
}

.ai-global-profile-field {
  grid-column: 1 / span 2;
  max-width: 380px;
}

.ai-global-days-field {
  grid-column: 1 / span 2;
}

.ai-global-days-field>label.muted {
  display: none;
}

.ai-global-sidecard {
  grid-column: 3;
  grid-row: 1 / span 3;
  padding: 26px 28px 28px;
  border: 1px solid #dfe5ef;
  border-radius: 28px;
  background: linear-gradient(180deg, #fafbfe 0%, #f4f6fb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.ai-global-sidecard-divider {
  height: 1px;
  margin: 18px 0 20px;
  background: #e2e7f0;
}

.ai-global-label {
  font-size: 16px;
  font-weight: 500;
  color: #66708b;
}

.ai-global-input {
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  color: #202a44;
  font-size: 16px;
}

.ai-global-input:focus {
  border-color: #6f78ff;
  box-shadow: 0 0 0 4px rgba(111, 120, 255, 0.14);
}

.ai-global-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0 18px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1.45;
  color: #1d2844;
}

.ai-global-toggle+.ai-global-toggle {
  padding-top: 18px;
  border-top: 1px solid #e2e7f0;
}

.ai-global-toggle input {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  min-width: 70px;
  height: 38px;
  margin: 0;
  transform: none;
  border: 1px solid #d4dbea;
  border-radius: 999px;
  background: #e7ebf2;
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ai-global-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
  transition: transform 0.18s ease;
}

.ai-global-toggle input:checked {
  border-color: #665df5;
  background: linear-gradient(135deg, #6c6bf8 0%, #875bff 100%);
}

.ai-global-toggle input:checked::before {
  transform: translateX(32px);
}

.ai-global-toggle input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(102, 93, 245, 0.16);
}

.ai-global-toggle input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-global-section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.ai-global-section-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a2440;
  white-space: nowrap;
}

.ai-global-section-divider-line {
  flex: 1;
  height: 1px;
  background: #dfe5ef;
}

.ai-global-day-chips {
  gap: 12px;
}

.ai-global-day-chips .day-chip {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid #d3d9e4;
  background: linear-gradient(180deg, #f3f5f9 0%, #e9edf4 100%);
  color: #7f879d;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
}

.ai-global-day-chips .day-chip.active {
  border-color: #2f6ef7;
  background: linear-gradient(180deg, #4f96ff 0%, #2d6cf6 100%);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(47, 110, 247, 0.28);
}

.ai-global-time-field {
  min-width: 0;
}

.ai-global-time-input {
  min-height: 58px;
  font-size: 18px;
}

.ai-global-card:has(#ai-global-schedule:not(:checked)) .ai-global-days-field,
.ai-global-card:has(#ai-global-schedule:not(:checked)) .ai-global-time-field {
  opacity: 0.56;
}

.ai-global-actions {
  margin-top: 26px;
  padding-top: 28px;
  gap: 12px;
  border-top: 1px solid #e4e9f1;
}

.ai-global-actions .btn.small {
  min-width: 128px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.ai-global-actions .btn.primary.small {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  border-color: transparent;
}

.ai-global-actions .btn.ghost.small {
  background: #f6f8fc;
  border-color: #d4dceb;
  color: #1d2844;
}

.ai-global-note,
.ai-global-forced {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #72809d;
}

.ai-global-note {
  flex-basis: 100%;
}

@media (min-width: 1700px) {
  .ai-page-shell > .ai-profiles-shell {
    width: min(100% - 32px, 1720px);
  }

  .ai-profiles-shell {
    padding: 30px 34px 38px !important;
  }

  .ai-profiles-board {
    max-width: 1360px;
    padding: 22px 18px 18px;
  }

  .ai-profile-grid {
    grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
    gap: 14px;
  }

  .ai-global-card {
    padding: 44px 50px 36px;
  }

  .ai-global-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(340px, 0.9fr);
    gap: 28px 34px;
  }

  .ai-global-profile-field {
    max-width: 460px;
  }

  .gsheet-card {
    padding: 42px 48px 36px;
  }
}

@media (max-width: 1100px) {
  .ai-global-card {
    padding: 32px 28px 28px;
  }

  .ai-global-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .ai-global-profile-field,
  .ai-global-days-field {
    grid-column: 1 / -1;
    max-width: none;
  }

  .ai-global-sidecard {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  .ai-global-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ai-global-card-title {
    font-size: 34px;
  }

  .ai-global-layout {
    grid-template-columns: 1fr;
  }

  .ai-global-profile-field,
  .ai-global-days-field,
  .ai-global-time-field,
  .ai-global-sidecard {
    grid-column: 1;
  }

  .ai-global-day-chips .day-chip {
    width: 50px;
    height: 50px;
  }

  .ai-global-actions .btn.small {
    width: 100%;
  }
}

/* ========= Google Sheets Card ========= */
.gsheet-card {
  margin-top: 28px;
  padding: 40px 46px 34px;
  border-radius: 34px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
}

.gsheet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.gsheet-card-title {
  font-size: clamp(28px, 2.5vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: #1a2440;
}

.gsheet-card-copy .muted {
  margin-top: 12px;
  font-size: 18px !important;
  line-height: 1.45;
  color: #68738f;
}

.gsheet-status-badge,
#gsheet-badge.status-pill.gsheet-status-badge {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid #d7dee8;
  background: #f4f6fa;
  color: #6f7994;
  box-shadow: none;
}

.gsheet-status-badge.online,
#gsheet-badge.status-pill.gsheet-status-badge.online {
  border-color: #9dd8af;
  background: #d7f0df;
  color: #17855b;
}

.gsheet-divider {
  height: 1px;
  margin: 24px 0 22px;
  background: linear-gradient(90deg, rgba(212, 220, 232, 0.72), rgba(212, 220, 232, 0.28));
}

.gsheet-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gsheet-email {
  font-size: 12px;
  color: #72809d;
}

.gsheet-config-shell {
  margin-top: 22px;
}

.gsheet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.gsheet-subcard {
  min-width: 0;
  padding: 28px 28px 26px;
  border: 1px solid #dfe5ef;
  border-radius: 24px;
  background: linear-gradient(180deg, #fafbfe 0%, #f4f6fb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.gsheet-subcard:first-child {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gsheet-subcard:last-child {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.gsheet-subcard-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a2440;
}

.gsheet-subcard:last-child .gsheet-subcard-title,
.gsheet-readmode-field {
  grid-column: 1 / -1;
}

.gsheet-form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#gsheet-section .ai-global-field {
  gap: 8px;
}

#gsheet-section .ai-global-field > label,
.gsheet-readmode-field .muted {
  font-size: 15px;
  color: #66708b;
}

#gsheet-section .input {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  color: #202a44;
}

#gsheet-sheet-select,
#gsheet-tab-select {
  width: 100%;
}

#gsheet-col-sku,
#gsheet-col-name,
#gsheet-col-stock,
#gsheet-col-price {
  width: 92px !important;
}

#gsheet-range {
  width: 112px !important;
}

#gsheet-reload-btn {
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 14px;
  box-shadow: none;
  font-size: 0;
}

#gsheet-reload-btn::before {
  content: "\21BB";
  font-size: 22px;
  line-height: 1;
}

.gsheet-readmode-field {
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e7f0;
}

.gsheet-readmode-field label {
  font-size: 18px;
  font-weight: 600;
  color: #1d2844;
}

.gsheet-readmode-field input[type="checkbox"] {
  accent-color: #7661de;
  transform: scale(1.2);
}

.gsheet-footer-actions {
  margin-top: 22px;
  padding-top: 18px;
  gap: 14px;
  border-top: 1px solid #e4e9f1;
}

.gsheet-footer-actions .btn.small {
  min-width: 164px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 16px;
  font-size: 15px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.gsheet-footer-actions .btn.primary.small {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  border-color: transparent;
}

.gsheet-footer-actions .btn.ghost.small {
  background: #f6f8fc;
  border-color: #d4dceb;
  color: #1d2844;
}

.gsheet-note {
  flex-basis: 100%;
  margin-top: 8px;
  font-size: 12px;
  color: #72809d;
}

.gsheet-preview {
  margin-top: 18px;
  overflow-x: auto;
}

.gsheet-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .gsheet-card {
    padding: 32px 28px 28px;
  }

  .gsheet-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .gsheet-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .gsheet-subcard:last-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gsheet-footer-actions .btn.small {
    width: 100%;
  }
}

@media (min-width: 1200px) {
  .ai-profiles-shell {
    padding: 24px 26px 28px !important;
  }

  .ai-profiles-header {
    margin-bottom: 14px;
  }

  .ai-profiles-eyebrow {
    font-size: 16px;
  }

  .ai-profiles-title {
    font-size: 18px;
  }

  .ai-profiles-actions .btn.small {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
  }

  .ai-profiles-board {
    margin-top: 14px;
    padding: 14px 12px 12px;
    border-radius: 20px;
  }

  .ai-profile-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
  }

  .ai-profile-card {
    min-height: 228px;
    padding: 18px 22px 16px;
    border-radius: 20px;
    gap: 14px;
  }

  .ai-profile-card-brand {
    font-size: 20px;
  }

  .ai-profile-card-name {
    font-size: 16px;
  }

  .ai-profile-card-logo {
    width: 62px;
    height: 62px;
  }

  .ai-profile-card-label {
    font-size: 13px;
  }

  .ai-profile-card-model {
    font-size: 17px;
  }

  .ai-profile-card-actions .btn.primary.small {
    min-width: 94px;
    min-height: 34px;
    padding: 0 16px;
    font-size: 14px;
  }

  .ai-profile-card-status {
    min-width: 126px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .ai-profile-card-secondary-actions .btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  .ai-global-card {
    margin-top: 20px;
    padding: 34px 38px 28px;
    border-radius: 28px;
  }

  .ai-global-card-title {
    font-size: clamp(30px, 2.6vw, 42px);
  }

  .ai-global-card-copy .muted,
  .ai-global-card-subtitle {
    margin-top: 8px;
    font-size: 15px !important;
  }

  .ai-global-status,
  #ai-global-active.status-pill.ai-global-status {
    min-width: 126px;
    min-height: 40px;
    padding: 8px 16px;
    font-size: 15px;
  }

  .ai-global-divider {
    margin: 20px 0 22px;
  }

  .ai-global-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(300px, 0.82fr);
    gap: 20px 24px;
  }

  .ai-global-profile-field {
    max-width: 400px;
  }

  .ai-global-sidecard {
    padding: 20px 22px 22px;
    border-radius: 22px;
  }

  .ai-global-sidecard-divider {
    margin: 14px 0 16px;
  }

  .ai-global-label {
    font-size: 14px;
  }

  .ai-global-input {
    min-height: 46px;
    border-radius: 14px;
    font-size: 15px;
  }

  .ai-global-toggle {
    gap: 14px;
    padding: 2px 0 14px;
    font-size: 16px;
  }

  .ai-global-toggle + .ai-global-toggle {
    padding-top: 14px;
  }

  .ai-global-toggle input {
    width: 62px;
    min-width: 62px;
    height: 34px;
  }

  .ai-global-toggle input::before {
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
  }

  .ai-global-toggle input:checked::before {
    transform: translateX(28px);
  }

  .ai-global-section-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .ai-global-section-title {
    font-size: 17px;
  }

  .ai-global-day-chips {
    gap: 10px;
  }

  .ai-global-day-chips .day-chip {
    width: 50px;
    height: 50px;
    font-size: 15px;
  }

  .ai-global-time-input {
    min-height: 50px;
    font-size: 16px;
  }

  .ai-global-actions {
    margin-top: 20px;
    padding-top: 20px;
    gap: 10px;
  }

  .ai-global-actions .btn.small {
    min-width: 116px;
    min-height: 40px;
    padding: 0 18px;
    font-size: 14px;
  }

  .ai-global-note,
  .ai-global-forced {
    font-size: 11px;
  }

  .gsheet-card {
    margin-top: 22px;
    padding: 34px 38px 28px;
    border-radius: 28px;
  }

  .gsheet-card-title {
    font-size: clamp(24px, 2vw, 34px);
  }

  .gsheet-card-copy .muted {
    margin-top: 8px;
    font-size: 15px !important;
  }

  .gsheet-status-badge,
  #gsheet-badge.status-pill.gsheet-status-badge {
    padding: 8px 16px;
    font-size: 14px;
  }

  #gsheet-section .input {
    min-height: 44px;
    border-radius: 13px;
    font-size: 14px;
  }

  .gsheet-footer-actions .btn.small {
    min-height: 40px;
    padding: 0 18px;
    font-size: 14px;
  }

  .gsheet-note {
    font-size: 11px;
  }
}

.ai-suggestion-box.loading .ai-suggestion-text {
  color: var(--color-muted);
  font-style: italic;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========= AI Auto-Mode Toggle ========= */
.ai-auto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-alt);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted-strong);
  transition: all 0.15s ease;
}

.ai-auto-toggle.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-auto-toggle.locked input {
  pointer-events: none;
}

.ai-auto-toggle:hover {
  background: var(--color-surface);
  border-color: var(--color-muted);
}

.ai-auto-toggle input {
  display: none;
}

.ai-auto-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-muted);
  transition: all 0.15s ease;
}

.ai-auto-toggle.active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.ai-auto-toggle.active .ai-auto-indicator {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ========= Settings Credentials ========= */
.settings-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

@media (min-width: 1200px) {
  .settings-page {
    zoom: 0.9;
  }
}

.settings-shell {
  width: min(100% - 28px, 1320px);
  margin: 16px auto !important;
  padding: 28px !important;
  border-radius: 34px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-channel-card {
  padding: 22px 24px 20px;
  border: 1px solid #dfe5ef;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
}

.settings-card-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.settings-collapse-btn {
  min-width: 132px;
}

.settings-channel-expandable {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-channel-card.is-collapsed .settings-channel-expandable {
  display: none;
}

.settings-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.settings-channel-head-copy {
  min-width: 0;
  flex: 1;
}

.settings-channel-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.settings-channel-eyebrow {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #7f8aa3;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-channel-eyebrow-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(216, 223, 235, 0.92), rgba(216, 223, 235, 0.18));
}

.settings-channel-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-channel-brand {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 26px 26px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.1);
}

.settings-channel-brand.whatsapp {
  background-color: #63bb74;
  background-image: url('/media/whatsapp.png');
}

.settings-channel-brand.messenger {
  background-color: #5d93ff;
  background-image: url('/media/facebook.png');
}

.settings-channel-brand.instagram {
  background: linear-gradient(135deg, #f472b6 0%, #ec4899 52%, #db2777 100%);
  position: relative;
}

.settings-channel-brand.instagram::before {
  content: "";
  position: absolute;
  inset: 11px;
  background: #ffffff;
  -webkit-mask-image: url('/media/Instagram-logo.svg');
  mask-image: url('/media/Instagram-logo.svg');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.settings-channel-title {
  margin: 0;
  font-size: 23px;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: #19233c;
}

.settings-channel-more {
  min-width: 126px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  border-color: #d8dfeb;
  background: #f8faff;
  color: #1f2a44;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.settings-status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #e5e7eb;
  color: #374151;
  margin-bottom: 6px;
}

.settings-status-card {
  margin-bottom: 14px;
}

.wa-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(249, 251, 255, 0.96), rgba(245, 247, 252, 0.94));
  border: 1px solid #dfe5ef;
  transition: all 0.2s ease;
}

.settings-channel-card-wa .wa-status-card.connected,
.settings-channel-card-ms .wa-status-card.connected {
  border-color: rgba(166, 222, 186, 0.74);
  background: linear-gradient(180deg, rgba(241, 252, 245, 0.96), rgba(246, 251, 248, 0.94));
}

.settings-channel-card-ig .wa-status-card.connected {
  border-color: rgba(244, 114, 182, 0.36);
  background: linear-gradient(180deg, rgba(254, 242, 248, 0.98), rgba(255, 247, 251, 0.94));
}

.settings-channel-card-wa .wa-status-card.disconnected,
.settings-channel-card-wa .wa-status-card.loading {
  border-color: rgba(214, 222, 235, 0.86);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.96), rgba(245, 247, 252, 0.94));
}

.settings-channel-card-ms .wa-status-card.disconnected,
.settings-channel-card-ms .wa-status-card.loading {
  border-color: rgba(191, 219, 254, 0.9);
  background: linear-gradient(180deg, rgba(240, 248, 255, 0.98), rgba(246, 250, 255, 0.94));
}

.settings-channel-card-ig .wa-status-card.disconnected,
.settings-channel-card-ig .wa-status-card.loading {
  border-color: rgba(244, 114, 182, 0.26);
  background: linear-gradient(180deg, rgba(255, 244, 249, 0.98), rgba(255, 249, 252, 0.94));
}

.wa-status-card.error {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(180deg, rgba(255, 243, 243, 0.96), rgba(255, 248, 248, 0.94));
}

.settings-status-icon,
.wa-status-icon {
  min-width: 58px;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: #527374;
}

.settings-channel-card-wa .wa-status-icon {
  color: #4b7d5d;
}

.settings-channel-card-ms .wa-status-icon {
  color: #4c79ce;
}

.settings-channel-card-ig .wa-status-icon {
  color: #c24186;
}

.wa-status-info,
.settings-status-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wa-status-label {
  font-weight: 600;
  font-size: 17px;
  color: #1d2844;
}

.wa-status-phone {
  font-size: 14px;
  line-height: 1.45;
  color: #66708b;
}

.settings-manage-btn {
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(180deg, #4a5572 0%, #37415e 100%);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(55, 65, 94, 0.22);
}

.settings-inline-note {
  margin: 0 0 12px 0;
  padding: 0;
  text-align: left;
  font-size: 13px;
  color: #6f7b96;
}

.settings-info-block {
  margin: 0 0 14px 0;
  padding: 18px 22px;
  text-align: left;
  border: 1px solid #e2e7f0;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(247, 249, 253, 0.96));
  color: #6a7691;
}

.settings-info-block-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.settings-info-title {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #1d2844;
}

.settings-credentials-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.settings-credentials-form .input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.settings-credentials-form .input-group label {
  font-size: 14px;
  font-weight: 600;
  color: #5c6885;
}

.settings-credentials-form .input-group small.muted {
  font-size: 12px;
}

.settings-credentials-form .input-field {
  min-height: 48px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.settings-credentials-form .input-field input,
.settings-credentials-form .input-field select,
.settings-inline-select {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: #202a44;
}

.settings-credentials-form .input-field .icon-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d7deeb;
  background: #ffffff;
}

#wa-credentials-form > .info-note,
#status,
#ms-status-note,
#ig-status-note {
  grid-column: 1 / -1;
}

#ig-page-based-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  grid-column: 1 / -1;
}

#ig-page-based-section > .input-group:last-child {
  grid-column: 1 / -1;
}

#ig-instagram-login-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  grid-column: 1 / -1;
}

#ig-instagram-login-section > .info-note,
#ig-instagram-login-section > .input-group:last-child {
  grid-column: 1 / -1;
}

.settings-status-text {
  min-height: 20px;
  margin-top: 4px;
  font-size: 13px;
  color: #6f7b96;
}

.settings-picker-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.settings-inline-select {
  min-width: 220px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.settings-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}

.settings-action-row .btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
}

.settings-action-row .btn.primary {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  border-color: transparent;
}

.settings-channel-card-ig .settings-action-row .btn.primary {
  background: linear-gradient(135deg, #ef6cb3 0%, #e04496 55%, #c92f7d 100%);
}

.settings-danger-btn {
  border-color: #efb1b1 !important;
  color: #b84242 !important;
  background: #fff5f5 !important;
}

@media (max-width: 980px) {
  .settings-shell {
    width: auto;
    margin: 12px !important;
    padding: 18px !important;
  }

  .settings-channel-card {
    padding: 18px 16px 16px;
  }

  .settings-channel-head,
  .settings-info-block-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-channel-more {
    width: 100%;
  }

  .settings-credentials-form,
  #ig-page-based-section,
  #ig-instagram-login-section {
    grid-template-columns: 1fr;
  }

  .settings-action-row .btn,
  .settings-picker-row > * {
    width: 100%;
  }
}

@media (min-width: 1200px) {
  .settings-shell {
    width: min(100% - 12px, 1460px);
  }
}

/* ========= Save Contact Button ========= */
.save-contact-btn {
  margin-left: auto;
  animation: pulse-badge 2s infinite;
}

.save-contact-btn.hidden {
  display: none;
}

/* ========= Image Lightbox ========= */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.lightbox-overlay.hidden {
  display: none;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  width: auto;
  height: auto;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
}

.lightbox-close:hover {
  background: transparent;
  transform: scale(1.04);
}

.lightbox-download {
  position: absolute;
  bottom: 30px;
  color: white;
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
}

.lightbox-download:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ========= Message Media (WhatsApp Style) ========= */
.message-media {
  width: min(330px, 100%);
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 0;
  background: transparent;
}

.message-file-card {
  width: min(320px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
}

.message.out .message-file-card {
  background: rgba(236, 253, 245, 0.82);
  border-color: rgba(16, 185, 129, 0.34);
}

.message-file-card.has-preview .message-file-main {
  border-top: 1px solid rgba(148, 163, 184, 0.26);
}

.message-file-preview {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.14), rgba(148, 163, 184, 0.08));
}

.message-file-preview.is-live {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1), rgba(148, 163, 184, 0.06));
}

.message-file-sheet {
  min-height: 56px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: #f8fafc;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 4px;
  overflow: hidden;
  position: relative;
}

.message-file-sheet-live {
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
  background: #ffffff;
}

.message-file-sheet-frame {
  width: 100%;
  height: 72px;
  border: 0;
  display: block;
  pointer-events: none;
}

.message-file-sheet small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #475569;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.message-file-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.message-file-icon {
  min-width: 30px;
  height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #94a3b8;
  color: #fff;
}

.message-file-icon.is-pdf {
  background: #e11d48;
}

.message-file-icon.is-image {
  background: #6b7280;
}

.message-file-copy {
  min-width: 0;
  flex: 1;
}

.message-file-link {
  text-decoration: none;
}

.message-file-name {
  display: block;
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-file-meta {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.2;
}

.message-file-download {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  background: rgba(248, 250, 252, 0.88);
}

.message-file-download svg {
  width: 18px;
  height: 18px;
}

.message-file-link.is-disabled {
  pointer-events: none;
  opacity: 0.58;
}

.message-file-link.is-disabled[data-media-ref] {
  pointer-events: auto;
  cursor: pointer;
}

.message-file-card.is-loading-url {
  opacity: 0.92;
}

.message-file-card.has-error {
  border-color: rgba(239, 68, 68, 0.52);
}

.message-file-card.has-error .message-file-meta {
  color: #dc2626;
}

/* WhatsApp-style document attachment card */
.message .bubble:has(.message-file-card) {
  max-width: min(360px, 82vw);
  padding: 4px 6px 5px;
  overflow: visible;
}

.message .message-file-card {
  width: min(332px, calc(82vw - 18px));
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  background: #f3f4f2;
  box-shadow: none;
}

.message.out .message-file-card {
  background: #f3f4f2;
  border-color: transparent;
}

.message-file-card.has-preview .message-file-main {
  border-top: 0;
}

.message-file-main {
  min-height: 66px;
  gap: 12px;
  padding: 13px 14px;
}

.message-file-icon {
  position: relative;
  width: 32px;
  min-width: 32px;
  height: 28px;
  border-radius: 7px;
  overflow: hidden;
  background: #8b9196 !important;
  color: #ffffff;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  padding-top: 0;
}

.message-file-icon.is-png {
  width: 32px;
  min-width: 32px;
  height: 37px;
  border-radius: 0;
  overflow: visible;
  background: transparent !important;
  color: transparent;
  padding-top: 14px;
}

.message-file-icon.is-png::before {
  content: '';
  position: absolute;
  inset: 0;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 26' width='26' preserveAspectRatio='xMidYMid meet' fill='none'%3E%3Cpath fill='%238b9196' d='M1 5.8c0-1.68 0-2.52.33-3.16a3 3 0 0 1 1.3-1.31C3.29 1 4.13 1 5.8 1h5.55c.98 0 1.47 0 1.93.11.4.1.8.26 1.15.48.4.25.75.6 1.44 1.28L17 4l2.13 2.13a8.36 8.36 0 0 1 1.28 1.44 4 4 0 0 1 .48 1.15c.11.46.11.95.11 1.93v9.55c0 1.68 0 2.52-.33 3.16a3 3 0 0 1-1.3 1.31c-.65.33-1.49.33-3.17.33H5.8c-1.68 0-2.52 0-3.16-.33a3 3 0 0 1-1.31-1.3C1 22.71 1 21.87 1 20.2V5.8Z'/%3E%3Cpath stroke='%23fff' stroke-opacity='0.15' stroke-width='0.5' d='m21.13 8.66-.24.06.24-.06a4.25 4.25 0 0 0-.5-1.22c-.27-.43-.64-.8-1.3-1.46l-.03-.03-2.12-2.13-1.13-1.12-.03-.03a8.16 8.16 0 0 0-1.46-1.3 4.25 4.25 0 0 0-1.23-.5c-.48-.12-1-.12-1.94-.12h-5.6c-.83 0-1.47 0-1.98.04-.52.04-.92.13-1.28.31A3.25 3.25 0 0 0 1.1 2.52C.92 2.9.83 3.3.79 3.81.75 4.32.75 4.96.75 5.79v14.42c0 .83 0 1.47.04 1.98.04.52.13.92.31 1.29a3.25 3.25 0 0 0 1.42 1.42c.37.18.77.27 1.29.3.5.05 1.15.05 1.98.05H16.2c.83 0 1.47 0 1.98-.04.52-.04.92-.13 1.29-.31a3.25 3.25 0 0 0 1.42-1.42c.18-.37.27-.77.3-1.29.05-.5.05-1.15.05-1.98v-9.6c0-.94 0-1.45-.12-1.94Z'/%3E%3Cpath fill='%23fff' fill-opacity='0.4' fill-rule='evenodd' d='m20.71 8.1-5.97-.03a1 1 0 0 1-1-1l.03-5.82c.21.09.43.2.63.32.4.24.74.58 1.43 1.26L17 4l2.14 2.13c.7.7 1.06 1.04 1.3 1.45a4 4 0 0 1 .27.51Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  z-index: 0;
}

.message-file-icon.is-png::after {
  content: 'PNG';
  position: absolute;
  left: 5px;
  bottom: 8px;
  z-index: 1;
  width: 18px;
  color: #ffffff;
  font-size: 7px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.message-file-copy {
  display: flex;
  min-height: 39px;
  flex-direction: column;
  justify-content: center;
}

.message-file-name {
  color: #111827;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
}

.message-file-meta {
  margin-top: 3px;
  color: #344054;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.message-file-download {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #9aa3ac;
  background: transparent;
  border: 2px solid #b7c0c8;
}

.message-file-download:hover {
  color: #667085;
  background: rgba(255, 255, 255, 0.58);
  border-color: #9aa3ac;
}

.message-file-download svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
  transform: none;
  transform-origin: center;
}

.message-file-card:has(.message-file-icon.is-pdf) {
  width: min(340px, calc(82vw - 18px));
  background: #ffffff;
  border-radius: 4px;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-preview {
  display: block;
  height: 78px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-preview .message-file-sheet:nth-child(n+2) {
  display: none;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-sheet {
  width: 100%;
  height: 78px;
  min-height: 78px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  overflow: hidden;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-sheet-frame {
  width: calc(100% + 18px);
  height: 90px;
  margin-right: -18px;
  overflow: hidden;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-main {
  min-height: 72px;
  gap: 12px;
  padding: 14px 18px 13px;
}

.message-file-icon.is-pdf {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 4px;
  background: #e91e4d !important;
  color: #ffffff;
  font-size: 8px;
  font-weight: 850;
  padding-top: 0;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-name {
  color: #111827;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.22;
  white-space: normal;
}

.message-file-card:has(.message-file-icon.is-pdf) .message-file-meta {
  margin-top: 4px;
  color: #475467;
  font-size: 12px;
  font-weight: 500;
}

.message.out .bubble:has(.message-file-card) .meta,
.message.in .bubble:has(.message-file-card) .meta,
.meta.meta-file {
  margin-top: 3px;
  padding-right: 2px;
  color: rgba(30, 41, 59, 0.72);
  font-size: 11px;
}

/* ========= Audio Message (WhatsApp Style) ========= */
.audio-message {
  --audio-btn-bg: #16a34a;
  --audio-btn-shadow: rgba(22, 163, 74, 0.25);
  --audio-btn-ring: rgba(22, 163, 74, 0.12);
  --wave-active: #16a34a;
  --wave-muted: rgba(22, 163, 74, 0.25);
  --audio-wave-neutral: #cfd7d2;
  --audio-wave-neutral-active: #bfc9c3;
  --audio-progress: 0%;
  display: grid;
  grid-template-columns: 24px minmax(150px, 1fr) 56px;
  gap: 8px;
  align-items: center;
  width: min(340px, 100%);
  min-width: 280px;
  min-height: 64px;
  padding: 8px 6px 8px 10px;
}

.message[data-channel="ms"] .audio-message,
.message.channel-messenger .audio-message {
  --audio-btn-bg: #2563eb;
  --audio-btn-shadow: rgba(37, 99, 235, 0.25);
  --audio-btn-ring: rgba(37, 99, 235, 0.12);
  --wave-active: #2563eb;
  --wave-muted: rgba(37, 99, 235, 0.25);
}

.message[data-channel="ig"] .audio-message,
.message.channel-instagram .audio-message {
  --audio-btn-bg: #e1306c;
  --audio-btn-shadow: rgba(225, 48, 108, 0.25);
  --audio-btn-ring: rgba(225, 48, 108, 0.12);
  --wave-active: #e1306c;
  --wave-muted: rgba(225, 48, 108, 0.25);
}

html[data-theme="dark"] .audio-message {
  --audio-btn-bg: #22c55e;
  --audio-btn-shadow: rgba(34, 197, 94, 0.35);
  --audio-btn-ring: rgba(34, 197, 94, 0.22);
  --wave-active: #22c55e;
  --wave-muted: rgba(34, 197, 94, 0.35);
}

html[data-theme="dark"] .message[data-channel="ms"] .audio-message,
html[data-theme="dark"] .message.channel-messenger .audio-message {
  --audio-btn-bg: #3b82f6;
  --audio-btn-shadow: rgba(59, 130, 246, 0.35);
  --audio-btn-ring: rgba(59, 130, 246, 0.22);
  --wave-active: #3b82f6;
  --wave-muted: rgba(59, 130, 246, 0.35);
}

html[data-theme="dark"] .message[data-channel="ig"] .audio-message,
html[data-theme="dark"] .message.channel-instagram .audio-message {
  --audio-btn-bg: #fb7185;
  --audio-btn-shadow: rgba(251, 113, 133, 0.35);
  --audio-btn-ring: rgba(251, 113, 133, 0.22);
  --wave-active: #fb7185;
  --wave-muted: rgba(251, 113, 133, 0.35);
}

.audio-play-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: #0f172a;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.12s ease, color 0.12s ease;
}

.audio-play-btn:hover {
  transform: translateY(-1px);
  box-shadow: none;
  color: #020617;
}

.audio-message.is-playing .audio-play-btn {
  transform: translateY(-1px);
  box-shadow: none;
}

.audio-icon {
  width: 18px;
  height: 18px;
}

.audio-icon-pause {
  display: none;
}

.audio-message.is-playing .audio-icon-play {
  display: none;
}

.audio-message.is-playing .audio-icon-pause {
  display: block;
}

.audio-message.is-loading {
  opacity: 0.78;
}

.audio-message.is-loading .audio-play-btn {
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.7;
}

.audio-message.is-loading .audio-waveform {
  pointer-events: none;
}

.audio-message.is-loading .audio-waveform-bars span {
  background: var(--color-skeleton);
}

.audio-track {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.audio-wave-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.audio-progress-dot {
  position: absolute;
  left: var(--audio-progress);
  top: 50%;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #13c86b;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.message:not(.sticker) .bubble.has-image-content:has(.media-caption) {
  padding: 4px 4px 3px;
  max-width: 342px;
  border-radius: 9px;
}

.bubble.has-image-content:has(.media-caption) .message-media {
  width: 100%;
}

.bubble.has-image-content:has(.media-caption) .message-image,
.bubble.has-image-content:has(.media-caption) .attached-img {
  border-radius: 6px;
  max-height: 340px;
  object-fit: contain;
  background: #ffffff;
}

.message:not(.sticker) .bubble.has-image-content:has(.media-caption) .meta {
  position: relative;
  right: auto;
  bottom: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: auto;
  margin: -1px 4px 0 auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(71, 85, 105, 0.9);
  line-height: 1;
  pointer-events: none;
}

.message.out .bubble.has-image-content:has(.media-caption) .meta {
  color: rgba(44, 83, 72, 0.9);
}

.audio-waveform {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex: 1 1 auto;
  min-width: 0;
  padding-inline: 6px;
}

.audio-waveform:focus-visible {
  outline: 2px solid var(--audio-btn-bg);
  outline-offset: 2px;
  border-radius: 8px;
}

.audio-waveform-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding-left: 2px;
}

.audio-waveform-bars span {
  width: 3px;
  height: calc(var(--h) * 100%);
  background: var(--audio-wave-neutral);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.audio-waveform-bars span.is-active {
  background: var(--audio-wave-neutral-active);
}

.audio-time {
  font-size: 11px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1;
  padding-left: 6px;
}

.audio-current,
.audio-divider {
  display: none;
}

.audio-avatar {
  position: relative;
  width: 54px;
  height: 54px;
  align-self: center;
}

.audio-avatar img,
.audio-avatar > span:first-child {
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e5e7eb, #cbd5e1);
  object-fit: cover;
}

.audio-mic-badge {
  position: absolute;
  left: -5px;
  bottom: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #10b981;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.audio-mic-badge svg {
  width: 15px;
  height: 15px;
}

.audio-element {
  display: none;
}

.message.sticker .bubble {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 6px 6px 10px;
}

.message.emoji-only .bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 2px 6px 0;
  max-width: none;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.emoji-only .bubble::after {
  display: none !important;
}

.message.emoji-only .bubble-text {
  margin-right: 25px !important;
  padding: 0;
  line-height: 1;
  white-space: pre-wrap;
  font-family: var(--font-emoji);
  overflow-wrap: normal;
}

.message.emoji-only-single .bubble-text {
  font-size: 38px;
}

.message.emoji-only-double .bubble-text {
  font-size: 38px;
}

.message.emoji-only-multi .bubble-text {
  font-size: 38px;
}

.message.emoji-only .meta {
  position: static !important;
  margin-top: 13px !important;
  line-height: 1;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
}

.message.sticker .bubble-text {
  padding: 0;
  margin-right: 0;
}

.message.sticker .meta {
  display: block;
  text-align: right;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.message.sticker .bubble,
.message.sticker .bubble[data-channel="wa"],
html[data-theme="dark"] .message.sticker .bubble,
html[data-theme="dark"] .message.sticker .bubble[data-channel="wa"],
html[data-theme="light"] .message.sticker .bubble,
html[data-theme="light"] .message.sticker .bubble[data-channel="wa"] {
  width: fit-content;
  max-width: min(220px, 100%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.message.sticker .bubble::after,
.message.sticker .bubble[data-channel="wa"]::after,
html[data-theme="dark"] .message.sticker .bubble::after,
html[data-theme="light"] .message.sticker .bubble::after {
  display: none;
}

.message.sticker .bubble-text {
  margin-right: 0;
}

.message.sticker .message-layout {
  align-items: flex-end;
}

.message-media.sticker {
  position: relative;
  width: min(190px, 100%);
  max-width: 190px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sticker-save-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
}

.message-media.sticker:hover .sticker-save-btn,
.sticker-save-btn:focus-visible {
  opacity: 1;
}

.message.out .sticker-save-btn {
  display: none;
}

.message-image.message-sticker {
  width: 100%;
  max-width: 190px;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  background: transparent;
}

.message.sticker .meta {
  position: static;
  right: auto;
  bottom: auto;
  margin: 6px 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  line-height: 1;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.message.out.sticker .meta,
html[data-theme="light"] .message.out.sticker .meta {
  background: linear-gradient(180deg, rgba(233, 246, 236, 0.98), rgba(226, 242, 231, 0.98));
  border-color: rgba(34, 197, 94, 0.12);
  color: #64748b;
}

html[data-theme="dark"] .message.sticker .meta {
  background: rgba(15, 23, 42, 0.84);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(226, 232, 240, 0.84);
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.24);
}

html[data-theme="dark"] .message.out.sticker .meta {
  background: rgba(17, 68, 42, 0.92);
  border-color: rgba(74, 222, 128, 0.24);
}

.message-media.sticker .media-placeholder {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed var(--color-border);
  background: transparent;
}

.message-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.attached-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.message-image:hover {
  opacity: 0.9;
}

.media-caption {
  padding: 8px 6px 2px;
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.32;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.media-placeholder {
  padding: 40px 20px;
  text-align: center;
  background: var(--color-surface-alt);
  border-radius: 8px;
  color: var(--color-muted);
  font-size: 13px;
}

/* ========= Info Panel Redesign (WhatsApp-like) ========= */

/* Header del panel */
.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.info-header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-primary);
}

/* Tabs tipo pill */
.info-tabs-pill {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px 20px;
  background: var(--color-surface);
}

.tab-pill {
  padding: 8px 24px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-pill:hover {
  background: var(--color-surface-alt);
}

.tab-pill.active {
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
}

/* Info body scrollable */
.info-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

/* Section labels */
.info-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  margin: 20px 0 12px;
  text-transform: capitalize;
}

/* Contact Card - Main card */
.contact-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.contact-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #D9FDD3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.contact-card-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-card-avatar-img[src=""],
.contact-card-avatar-img:not([src]) {
  display: none;
}

.contact-card-avatar-initials {
  font-size: 22px;
  font-weight: 700;
  color: #1F7A3A;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
}

.contact-card-avatar-initials svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: currentColor;
}

.contact-card-details {
  flex: 1;
  min-width: 0;
}

.contact-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.contact-card-phone {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 2px;
}

.contact-card-email {
  font-size: 13px;
  color: var(--color-primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-link--small {
  font-size: 12px;
}

/* Icon buttons row */
.info-icon-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
}

.info-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.info-icon-btn:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.info-icon-btn.active,
.info-icon-btn:has(input:checked) {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.info-icon-btn--primary {
  background: #25D366;
  border-color: #25D366;
  color: white;
}

.info-icon-btn--primary:hover {
  background: #1da855;
  border-color: #1da855;
  color: white;
}

/* Profile section */
.profile-section {
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-label {
  font-size: 12px;
  color: var(--color-muted);
}

.profile-value {
  font-size: 13px;
  font-weight: 500;
  color: #25D366;
}

.profile-info-text {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Status section */
.status-section {
  background: var(--color-surface-alt);
  border-radius: 12px;
  padding: 4px;
}

.input-full {
  width: 100%;
}

/* Assign section */
.assign-section {
  margin-top: 8px;
}

.assign-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.assign-msg {
  margin-top: 6px;
  font-size: 12px;
}

/* Files section */
.files-section {
  margin-top: 8px;
}

.files-count {
  font-size: 12px;
  color: var(--color-muted);
  margin-left: 4px;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.files-grid-item {
  height: 84px;
  border-radius: 12px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
}

.files-grid-item:hover {
  border-color: var(--color-primary);
  transform: scale(1.02);
}

.files-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.files-grid-item svg {
  width: 32px;
  height: 32px;
  color: var(--color-muted);
}

/* Mobile: 2 columns for files grid */
@media (max-width: 768px) {
  .files-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Info note at bottom */
.info-note {
  text-align: center;
  font-size: 11px;
  padding: 16px 0;
  color: var(--color-muted);
}

/* Tab panel visibility */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.media-error {
  padding: 20px;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  color: var(--color-error);
  font-size: 13px;
}

.message-media.unavailable {
  background: var(--color-surface-alt);
}

.media-error.media-error-unavailable {
  display: flex;
  width: 100%;
  min-width: 220px;
  max-width: 340px;
  min-height: 132px;
  padding: 18px 16px 34px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--color-text);
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  text-align: center;
}

.media-error-title {
  font-size: 13px;
  font-weight: 700;
}

.media-error-subtitle {
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-muted);
}

.media-unavailable-link {
  font-size: 12px;
  font-weight: 600;
  word-break: normal;
  overflow-wrap: anywhere;
}

.audio-message.audio-message-unavailable {
  width: min(340px, 100%);
  min-width: 220px;
  max-width: 340px;
}

.message-media.loading .media-placeholder {
  animation: shimmer 1.5s ease-in-out infinite;
  background: linear-gradient(90deg, var(--color-skeleton), var(--color-skeleton-shine), var(--color-skeleton));
  background-size: 200% 100%;
}

/* ========= Image Modal / Lightbox ========= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.invite-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.invite-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.invite-badge.consumed {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.invite-badge.expired {
  background: rgba(234, 179, 8, 0.12);
  color: #b45309;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.invite-badge.revoked {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.modal .close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 32px;
  color: white;
  cursor: pointer;
  z-index: 10001;
  background: transparent;
  width: auto;
  height: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
}

.modal .close:hover {
  background: transparent;
  transform: scale(1.04);
}

.modal-content {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  font-size: 40px;
  padding: 16px 20px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.modal-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-nav.prev {
  left: 20px;
}

.modal-nav.next {
  right: 20px;
}

.modal-sticker-favorite {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  border: 1px solid rgba(52, 211, 153, 0.34);
  background: rgba(12, 18, 26, 0.64);
  color: #34d399;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  z-index: 10000;
}

.modal-sticker-favorite:hover:not(:disabled) {
  background: rgba(16, 30, 42, 0.88);
  border-color: rgba(52, 211, 153, 0.56);
  color: #6ee7b7;
}

.modal-sticker-favorite:disabled {
  cursor: default;
  color: #99a3af;
  border-color: rgba(153, 163, 175, 0.4);
}

/* Chat page compact layout - matches WhatsApp Web */
body.page-chat .main-area main {
  padding: 1px !important;
}

/* WhatsApp-like chat header refinements */
.chat-header .icon-btn {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  transition: color 0.15s, transform 0.1s;
}

.chat-header .icon-btn:hover {
  background: transparent;
  transform: scale(1.05);
}

.chat-header .icon-btn svg {
  width: 21px;
  height: 21px;
}

.chat-header .ai-select {
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--color-surface);
}

.chat-header .btn.small {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 14px;
}

.chat-header .ai-auto-toggle {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
}

/* ========= Topbar Theme Toggle ========= */
.topbar-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--topbar-toggle-border);
  background: var(--topbar-toggle-bg);
  color: var(--topbar-toggle-color);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-right: 12px;
}

.topbar-theme-toggle:hover {
  background: var(--topbar-toggle-hover);
  transform: scale(1.05);
}

/* Show moon in light mode, sun in dark mode */
.topbar-theme-toggle .icon-sun {
  display: none;
}

.topbar-theme-toggle .icon-moon {
  display: block;
}

html[data-theme="dark"] .topbar-theme-toggle .icon-sun {
  display: block;
}

html[data-theme="dark"] .topbar-theme-toggle .icon-moon {
  display: none;
}

/* ========= Dark Theme ========= */
html[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-alt: #334155;
  --color-text: #f1f5f9;
  --color-muted: #94a3b8;
  --color-border: #475569;
  --bg: #0f172a;
  --panel: #1e293b;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #475569;
  --input: #334155;
  --bubble-in: #0b1220;
  --bubble-out: #1f2a44;
  --sidebar-bg: #020617;
  --sidebar-text: #e2e8f0;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --topbar-bg: #0f172a;
  --topbar-border: rgba(255, 255, 255, 0.06);
  --topbar-text: #e2e8f0;
  --topbar-title: rgba(226, 232, 240, 0.7);
  --topbar-pill-bg: #1e293b;
  --topbar-pill-text: #f1f5f9;
  --topbar-pill-border: rgba(255, 255, 255, 0.12);
  --topbar-pill-hover: rgba(255, 255, 255, 0.08);
  --topbar-pill-border-hover: rgba(255, 255, 255, 0.2);
  --topbar-toggle-bg: rgba(255, 255, 255, 0.06);
  --topbar-toggle-border: rgba(255, 255, 255, 0.15);
  --topbar-toggle-color: #e2e8f0;
  --topbar-toggle-hover: rgba(255, 255, 255, 0.12);
}

/* Dark sidebar */
html[data-theme="dark"] .sidebar-nav {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}

html[data-theme="dark"] .nav-submenu {
  border-left-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .nav-group-toggle {
  color: rgba(255, 255, 255, 0.8);
}

html[data-theme="dark"] .nav-item.is-parent-active {
  background: rgba(59, 130, 246, 0.22);
  color: #ffffff;
}

/* Dark topbar adjustments */
html[data-theme="dark"] .topbar {
  background: var(--topbar-bg);
  border-bottom-color: var(--topbar-border);
}

html[data-theme="dark"] .topbar-pill {
  background: var(--topbar-pill-bg);
}

/* Dark main area */
html[data-theme="dark"] .main-area {
  background: var(--bg);
}

html[data-theme="dark"] .main-area main {
  background: var(--bg);
}

/* Dark chat header */
html[data-theme="dark"] .chat-header {
  background: var(--color-surface);
  border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .chat-score-stars {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .chat-score-stars {
  --lead-score-empty: rgba(148, 163, 184, 0.62);
}

/* Dark chat messages area */
html[data-theme="dark"] .chat-messages-container {
  background: var(--color-bg);
}

/* Dark input area */
html[data-theme="dark"] .chat-input-bar {
  background: var(--color-surface);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .chat-input-bar input,
html[data-theme="dark"] .chat-input-bar textarea {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}

html[data-theme="dark"] #attach-btn {
  color: #cbd5e1;
}

html[data-theme="dark"] #attach-btn:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] #emoji-btn {
  color: #cbd5e1;
}

html[data-theme="dark"] #emoji-btn:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .contact-channel-mark.channel-wa {
  --wa-icon-color: #4ade80;
}

html[data-theme="dark"] .channel-badge.channel-wa-icon {
  color: #4ade80;
}

html[data-theme="dark"] .channel-badge.channel-ms-icon {
  background: #38bdf8;
  color: #fff;
}

html[data-theme="dark"] .contact-ai-icon {
  color: #ffffff;
}

html[data-theme="dark"] .assigned-badge.assigned-user {
  background: rgba(59, 130, 246, 0.24);
  color: #dbeafe;
  border-color: rgba(147, 197, 253, 0.45);
}

html[data-theme="dark"] .attach-item[data-action="document"] {
  --attach-icon-color: #b79cff;
}

html[data-theme="dark"] .attach-item[data-action="media"] {
  --attach-icon-color: #67d7ff;
}

html[data-theme="dark"] .attach-item[data-action="camera"] {
  --attach-icon-color: #8ec5ff;
}

html[data-theme="dark"] .attach-item[data-action="audio-file"] {
  --attach-icon-color: #b38aff;
}

html[data-theme="dark"] .attach-item[data-action="contact"] {
  --attach-icon-color: #d39cff;
}

/* Dark contacts list */
html[data-theme="dark"] .contact-list-panel {
  background: var(--color-surface);
  border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .contact-item {
  border-color: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .contact-item:hover {
  background: var(--color-surface-alt);
}

/* Dark buttons and inputs */
html[data-theme="dark"] .input,
html[data-theme="dark"] .select {
  background: var(--color-surface-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}

html[data-theme="dark"] .btn.ghost {
  color: var(--color-text);
}

html[data-theme="dark"] .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Dark mode: Pipeline only */
html[data-theme="dark"] .page-shell[data-page="pipeline"] .panel {
  background:
    radial-gradient(circle at top center, rgba(61, 130, 246, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  border-color: rgba(100, 116, 139, 0.3);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-column {
  background: linear-gradient(180deg, rgba(20, 30, 50, 0.96), rgba(15, 23, 42, 0.92));
  border-color: rgba(100, 116, 139, 0.32);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-title,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-col-title,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card-title {
  color: #f8fafc;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-search,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-summary {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(100, 116, 139, 0.4);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-search input {
  color: #f8fafc;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-search input::placeholder,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-summary-value,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-count,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card-sub,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-more-pill {
  color: #cbd5e1;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-summary-pill {
  color: #a9b8d8;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-summary-pill.is-current {
  color: #f8fafc;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-status {
  background: rgba(20, 83, 45, 0.5);
  border-color: rgba(74, 222, 128, 0.32);
  color: #bbf7d0;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-pro-status.error {
  background: rgba(127, 29, 29, 0.44);
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-col-body.drag-over {
  background: rgba(59, 130, 246, 0.16);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-empty-state,
html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-more-pill {
  border-color: rgba(100, 116, 139, 0.34);
  background: rgba(15, 23, 42, 0.68);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card {
  background: rgba(18, 29, 49, 0.9);
  border-color: rgba(100, 116, 139, 0.32);
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.4);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card.pipeline-channel-wa {
  background: linear-gradient(180deg, rgba(20, 83, 45, 0.34), rgba(15, 23, 42, 0.92));
  border-color: rgba(110, 231, 183, 0.28);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card.pipeline-channel-ms {
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.32), rgba(15, 23, 42, 0.92));
  border-color: rgba(147, 197, 253, 0.26);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-card.pipeline-channel-ig {
  background: linear-gradient(180deg, rgba(157, 23, 77, 0.28), rgba(15, 23, 42, 0.92));
  border-color: rgba(244, 114, 182, 0.2);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-channel-pill {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.28);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-channel-pill-wa {
  background: rgba(20, 83, 45, 0.5);
  border-color: rgba(110, 231, 183, 0.24);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-channel-pill-ms {
  background: rgba(30, 64, 175, 0.46);
  border-color: rgba(96, 165, 250, 0.3);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-channel-pill-ig {
  background: rgba(157, 23, 77, 0.5);
  border-color: rgba(244, 114, 182, 0.22);
}

/* ========= Premium SaaS Visual Refresh ========= */
:root {
  --app-font-sans: "Inter", "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --premium-bg: #09111b;
  --premium-bg-elevated: #0d1724;
  --premium-panel: rgba(15, 23, 36, 0.92);
  --premium-panel-strong: rgba(11, 18, 29, 0.96);
  --premium-border: rgba(148, 163, 184, 0.14);
  --premium-border-strong: rgba(148, 163, 184, 0.22);
  --premium-text: #e7edf5;
  --premium-muted: #91a0b5;
  --premium-muted-soft: #6f8097;
  --premium-hover: rgba(148, 163, 184, 0.08);
  --premium-shadow-sm: 0 8px 24px rgba(2, 6, 23, 0.18);
  --premium-shadow-md: 0 18px 44px rgba(2, 6, 23, 0.22);
  --premium-shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.32);
  --premium-ring: 0 0 0 1px rgba(110, 231, 183, 0.16), 0 0 0 4px rgba(16, 185, 129, 0.08);
}

html,
body,
button,
input,
textarea,
select {
  font-family: var(--app-font-sans);
}

html[data-theme="dark"] {
  --color-bg: #09111b;
  --color-surface: #101a28;
  --color-surface-alt: #162233;
  --color-text: #e7edf5;
  --color-muted: #91a0b5;
  --color-muted-strong: #b7c3d4;
  --color-border: rgba(148, 163, 184, 0.16);
  --color-primary: #3b82f6;
  --color-primary-soft: rgba(59, 130, 246, 0.12);
  --bg: #09111b;
  --panel: #101a28;
  --card: #101a28;
  --text: #e7edf5;
  --muted: #91a0b5;
  --border: rgba(148, 163, 184, 0.16);
  --input: #162233;
  --bubble-in: #111d2c;
  --bubble-out: #103626;
  --sidebar-bg: #0a121e;
  --sidebar-text: #dbe5f1;
  --sidebar-hover: rgba(148, 163, 184, 0.08);
  --topbar-bg: rgba(9, 17, 27, 0.82);
  --topbar-border: rgba(148, 163, 184, 0.12);
  --topbar-text: #e7edf5;
  --topbar-title: #b5c1d2;
  --topbar-pill-bg: rgba(255, 255, 255, 0.04);
  --topbar-pill-text: #e7edf5;
  --topbar-pill-border: rgba(148, 163, 184, 0.14);
  --topbar-pill-hover: rgba(255, 255, 255, 0.06);
  --topbar-pill-border-hover: rgba(148, 163, 184, 0.22);
  --topbar-toggle-bg: rgba(255, 255, 255, 0.04);
  --topbar-toggle-border: rgba(148, 163, 184, 0.16);
  --topbar-toggle-color: #e7edf5;
  --topbar-toggle-hover: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] body.layout-shell {
  background:
    radial-gradient(1100px 620px at 0% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(900px 540px at 100% 100%, rgba(16, 185, 129, 0.05), transparent 48%),
    var(--premium-bg);
  color: var(--premium-text);
}

body.layout-shell .layout,
body.layout-shell .main-area,
body.layout-shell #app-view,
body.layout-shell .app-view-panel {
  min-height: 0;
}

body.layout-shell .app-view-panel {
  height: 100%;
}

html[data-theme="dark"] .main-area {
  background: transparent;
}

html[data-theme="dark"] .main-area main {
  background: transparent;
}

html[data-theme="dark"] .panel {
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.96), rgba(12, 21, 34, 0.96));
  border: 1px solid var(--premium-border);
  box-shadow: var(--premium-shadow-sm);
}

.sidebar-nav,
.nav-item,
.nav-group-toggle,
.theme-toggle-option,
.topbar,
.profile-trigger,
.contact,
.bubble,
.chat-header,
.chat-input,
.input-field,
.icon-btn,
.info-panel,
.tab-pill,
.filter-tag,
.assigned-badge,
.status-badge,
.channel-badge,
.whatsapp-template-banner,
.attach-menu,
.emoji-picker {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    opacity 0.18s ease;
}

.sidebar-nav {
  border-right: 1px solid var(--premium-border);
  padding: 14px 12px 12px;
  gap: 14px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand {
  min-height: 40px;
  justify-content: space-between;
}

.brand-logo {
  height: 30px;
}

.brand-logo--light {
  display: none;
}

.brand-logo--dark {
  display: block;
}

.brand-logo--compact {
  display: none;
}

.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--premium-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--sidebar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  align-self: flex-end;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--premium-border-strong);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.nav-links {
  gap: 4px;
}

.nav-item {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  flex-basis: 20px;
}

.nav-item-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item:hover,
.nav-group-toggle:hover {
  background: var(--premium-hover);
}

.nav-item.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.96), rgba(29, 78, 216, 0.96));
  border-color: rgba(96, 165, 250, 0.38);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(30, 64, 175, 0.28);
}

.nav-item.is-parent-active {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(96, 165, 250, 0.2);
}

.nav-group-toggle {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.nav-submenu {
  margin-left: 16px;
  padding-left: 14px;
  gap: 4px;
  border-left-color: rgba(148, 163, 184, 0.12);
}

.nav-subitem {
  min-height: 34px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--premium-muted);
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-account {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.sidebar-account-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--premium-muted);
  letter-spacing: -0.01em;
}

.sidebar-account-link {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sidebar-account-link:hover {
  background: rgba(148, 163, 184, 0.08);
}

.sidebar-account-link-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-account-link-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-account-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.sidebar-account-profile {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.sidebar-account-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-account-name,
.sidebar-account-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-name {
  font-size: 13px;
  font-weight: 700;
}

.sidebar-account-meta {
  font-size: 11px;
  color: var(--premium-muted);
}

.sidebar-account-logout {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-account-logout:hover {
  background: rgba(148, 163, 184, 0.08);
}

.sidebar-account-logout svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-theme-switch {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: none;
}

.theme-toggle-option {
  min-height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.theme-toggle-option.is-active {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.topbar {
  min-height: 56px;
  padding: 0 18px;
  background: var(--topbar-bg);
  border-bottom-color: var(--topbar-border);
  backdrop-filter: blur(18px) saturate(1.1);
}

.topbar-left {
  gap: 8px;
}

.topbar-left .title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-sidebar-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--topbar-title);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.08);
}

.topbar-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--topbar-text);
}

.topbar-sidebar-toggle svg {
  display: block;
}

body[data-sidebar-collapsed="true"] .topbar-sidebar-toggle svg {
  transform: rotate(180deg);
}

body[data-sidebar-collapsed="true"] .sidebar-account {
  display: none;
}

.hamburger-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.profile-trigger {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 8px 0 0;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(148, 163, 184, 0.2);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.profile-menu {
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid var(--premium-border);
  background: #0f1724;
  box-shadow: var(--premium-shadow-lg);
}

@media (min-width: 1024px) {
  .topbar-sidebar-toggle {
    display: none !important;
  }

  body[data-sidebar-collapsed="true"] .layout {
    grid-template-columns: 84px 1fr;
  }

  body[data-sidebar-collapsed="true"] .sidebar-nav {
    padding-inline: 10px;
  }

  body[data-sidebar-collapsed="true"] .brand {
    justify-content: center;
  }

  body[data-sidebar-collapsed="true"] .brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
  }

  body[data-sidebar-collapsed="true"] .sidebar-collapse-btn {
    position: absolute;
    top: 14px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(11, 18, 29, 0.98);
    box-shadow: var(--premium-shadow-sm);
  }

  body[data-sidebar-collapsed="true"] .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  body[data-sidebar-collapsed="true"] .nav-item {
    justify-content: center;
    padding-inline: 10px;
  }

  body[data-sidebar-collapsed="true"] .nav-item-label,
  body[data-sidebar-collapsed="true"] .theme-toggle-option span,
  body[data-sidebar-collapsed="true"] .nav-group-toggle,
  body[data-sidebar-collapsed="true"] .nav-submenu {
    display: none !important;
  }

  body[data-sidebar-collapsed="true"] .sidebar-theme-switch {
    grid-template-columns: 1fr;
    padding: 3px;
  }

  body[data-sidebar-collapsed="true"] .theme-toggle-option {
    min-height: 34px;
    padding: 0;
  }

}

@media (max-width: 1023px) {
  .sidebar-collapse-btn {
    display: none;
  }

  .topbar-sidebar-toggle {
    display: none !important;
  }
}

body.page-chat #app-view,
body.page-chat .app-view-panel,
body.page-chat .page-shell[data-page="chat"] {
  height: 100%;
}

@media (min-width: 1024px) {
  .page-shell[data-page="chat"] .app-shell {
    padding: 14px;
    gap: 14px;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: stretch;
    background: transparent;
  }
}

.page-shell[data-page="chat"] .panel.sidebar,
.page-shell[data-page="chat"] .chat-area {
  border-radius: 20px;
  overflow: hidden;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .panel.sidebar {
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(11, 18, 29, 0.98));
}

.sidebar-top {
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(13, 21, 33, 0.88));
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

.sidebar-top .btn.full-width {
  min-height: 38px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-search {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-search svg {
  color: var(--premium-muted-soft);
}

.sidebar-search input {
  font-size: 13px;
  color: var(--premium-text);
}

.sidebar-search input::placeholder {
  color: var(--premium-muted-soft);
}

.filter-tags-container {
  margin-top: 8px;
}

.filter-tags {
  gap: 6px;
}

.filter-tag,
.filter-add-btn {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: var(--premium-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.filter-tag.active {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.26);
  color: #dbeafe;
}

.contact-list {
  padding: 0;
}

.contact {
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-left: 0;
  border-bottom: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.contact:hover {
  background: rgba(255, 255, 255, 0.022);
  border-color: transparent;
  box-shadow: none;
}

.contact.active {
  background: linear-gradient(180deg, rgba(18, 31, 48, 0.98), rgba(15, 25, 39, 0.98));
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 24px rgba(2, 6, 23, 0.14);
}

.contact-avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.contact-info {
  gap: 4px;
}

.contact-row {
  gap: 10px;
}

.contact-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.contact-time {
  color: var(--premium-muted);
  font-size: 11px;
  font-weight: 600;
}

.contact-phone {
  font-size: 11px;
  color: var(--premium-muted-soft);
}

.contact-last-msg {
  font-size: 12px;
  color: var(--premium-muted);
  line-height: 1.4;
}

.contact-badges {
  gap: 5px;
}

.status-badge,
.assigned-badge,
.channel-badge {
  min-height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.assigned-badge,
.status-badge {
  border-color: rgba(148, 163, 184, 0.12);
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.2);
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-area {
  background-color: #0d1623;
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: var(--premium-shadow-md);
}

.chat-header {
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.84), rgba(13, 21, 33, 0.7));
  backdrop-filter: blur(18px) saturate(1.08);
  position: relative;
  z-index: 40;
  overflow: visible;
}

.chat-title {
  gap: 10px;
}

.avatar-circle {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.contact-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.contact-subtitle-row,
.contact-assigned-pill {
  color: var(--premium-muted);
}

.chat-actions {
  gap: 6px;
}

.chat-header .icon-btn,
.chat-input .icon-btn,
.info-header .icon-btn,
.info-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: var(--premium-muted-strong);
}

.chat-header .icon-btn:hover,
.chat-input .icon-btn:hover,
.info-header .icon-btn:hover,
.info-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--premium-text);
}

.ai-controls {
  gap: 8px;
  padding: 5px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.chat-header .ai-select {
  min-width: 156px;
  border-radius: 12px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.035);
  color: var(--premium-text);
  font-size: 12px;
  font-weight: 600;
}

.chat-header .ai-auto-toggle {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--premium-muted);
}

.chat-header .ai-auto-toggle:has(input:checked) {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.24);
  color: #bbf7d0;
}

.ai-active-badge {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.chat-body {
  background:
    linear-gradient(180deg, rgba(7, 13, 21, 0.2), rgba(7, 13, 21, 0.12)),
    transparent;
}

.chat-messages {
  padding: 18px 20px 12px;
}

.message-layout {
  gap: 8px;
}

.bubble {
  max-width: min(70%, 720px);
  padding: 8px 11px 18px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.42;
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.12);
}

.bubble-text {
  font-size: 13px;
  line-height: 1.42;
}

.message.out .bubble {
  background: rgba(16, 54, 38, 0.96);
  border-color: rgba(74, 222, 128, 0.18);
}

.message.in .bubble[data-channel="wa"] {
  background: rgba(17, 29, 44, 0.96);
  border-color: rgba(148, 163, 184, 0.16);
}

.message.out .bubble[data-channel="wa"] {
  background: rgba(16, 54, 38, 0.98);
  border-color: rgba(74, 222, 128, 0.16);
}

.meta {
  font-size: 10.5px;
  color: rgba(191, 201, 214, 0.76);
}

.message-action-trigger {
  border-radius: 8px;
}

.message-reaction-trigger.message-reaction-trigger-outside {
  width: 24px;
  height: 24px;
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.24);
}

.page-shell[data-page="chat"] .chat-input {
  margin: 10px 12px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14, 22, 35, 0.92), rgba(12, 20, 31, 0.92));
  box-shadow: var(--premium-shadow-sm);
  backdrop-filter: blur(18px) saturate(1.06);
}

.page-shell[data-page="chat"] .chat-input .input-field {
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 16px;
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.page-shell[data-page="chat"] .chat-input .input-field:focus-within {
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: var(--premium-ring);
}

.page-shell[data-page="chat"] .chat-input #message-input {
  font-size: 13px;
  line-height: 1.42;
}

.page-shell[data-page="chat"] .chat-input #message-input::placeholder {
  color: var(--premium-muted-soft);
}

#send-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.3);
}

#send-btn:active {
  transform: translateY(0);
}

.attach-menu,
.emoji-picker,
.dropdown,
.filter-dropdown {
  border-radius: 16px;
  border: 1px solid var(--premium-border);
  background: linear-gradient(180deg, rgba(15, 23, 36, 0.98), rgba(11, 18, 29, 0.98));
  box-shadow: var(--premium-shadow-lg);
  backdrop-filter: blur(20px);
}

.attach-item,
.dropdown-item,
.filter-dropdown-item {
  font-size: 12.5px;
  font-weight: 600;
}

.attach-item:hover,
.dropdown-item:hover,
.filter-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.whatsapp-template-banner {
  border-radius: 18px;
  border: 1px solid rgba(250, 204, 21, 0.18);
  background: linear-gradient(180deg, rgba(56, 43, 17, 0.42), rgba(36, 29, 12, 0.42));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.whatsapp-template-banner-eyebrow {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loader {
  width: fit-content;
  margin: 14px auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.035);
  position: relative;
  overflow: hidden;
}

.loader::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: premiumLoaderShimmer 1.4s ease-in-out infinite;
}

@keyframes premiumLoaderShimmer {
  to {
    transform: translateX(100%);
  }
}

.info-panel {
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(9, 17, 27, 0.98));
  border-left: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: -24px 0 48px rgba(2, 6, 23, 0.36);
}

.info-header {
  padding: 16px 18px 12px;
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

.info-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.info-tabs-pill {
  padding: 10px 18px 0;
  gap: 8px;
}

.tab-pill {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: var(--premium-muted);
  font-size: 12px;
  font-weight: 700;
}

.tab-pill.active {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(96, 165, 250, 0.26);
  color: #dbeafe;
}

.info-body {
  padding: 18px;
}

.info-section-label {
  margin-bottom: 8px;
  color: var(--premium-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-card,
.profile-section,
.status-section,
.assign-section,
.contact-note-card,
.contact-tags-card {
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.contact-card {
  padding: 14px;
}

.contact-note-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-note-copy {
  margin: 0;
  color: var(--premium-muted);
  font-size: 13px;
  line-height: 1.5;
}

.contact-note-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--premium-muted);
}

.contact-note-textarea {
  width: 100%;
  min-height: 164px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.28);
  color: var(--color-text);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.contact-note-textarea::placeholder {
  color: rgba(148, 163, 184, 0.72);
}

.contact-note-textarea:hover {
  border-color: rgba(96, 165, 250, 0.22);
}

.contact-note-textarea:focus {
  border-color: rgba(96, 165, 250, 0.34);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  background: rgba(15, 23, 42, 0.4);
}

.contact-note-textarea:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.contact-note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contact-note-status {
  font-size: 12px;
  color: var(--premium-muted);
}

#contact-note-save:disabled {
  opacity: 0.6;
}

.contact-card-name {
  font-size: 15px;
  font-weight: 700;
}

.contact-card-phone,
.contact-card-email,
.profile-info-text,
.profile-value {
  color: var(--premium-muted);
}

.info-icon-buttons {
  gap: 10px;
}

.info-icon-btn--primary {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.22);
  color: #bbf7d0;
}

.input,
.input-full,
select.input,
textarea.input {
  border-radius: 14px;
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.input:focus,
.input-full:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  box-shadow: var(--premium-ring);
  border-color: rgba(96, 165, 250, 0.26);
}

@media (max-width: 1279px) {
  .chat-header .ai-select {
    min-width: 132px;
  }

  .ai-controls {
    gap: 6px;
    padding: 4px;
  }
}

@media (max-width: 768px) {
  .topbar {
    min-height: 52px;
    padding: 0 12px;
  }

  .page-shell[data-page="chat"] .panel.sidebar,
  .page-shell[data-page="chat"] .chat-area {
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar-top {
    padding: 12px 12px 8px;
  }

  .contact-list {
    padding: 6px 0 8px;
  }

  .contact {
    margin: 0 6px 4px;
    border-radius: 14px;
    padding: 10px 11px;
  }

  .chat-header {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 0;
  }

  .chat-header .icon-btn,
  .chat-input .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .page-shell[data-page="chat"] .chat-input {
    margin: 0 8px 8px;
    padding: 8px 10px;
    border-radius: 18px;
  }

  .page-shell[data-page="chat"] .chat-input .input-field {
    min-height: 42px;
    border-radius: 14px;
  }

  #send-btn {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .bubble {
    max-width: min(84%, 340px);
    font-size: 12.5px;
  }

  .chat-messages {
    padding: 14px 12px 10px;
  }

  .info-panel {
    box-shadow: none;
  }
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-badge.status-new {
  background: rgba(51, 65, 85, 0.92);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.3);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-badge.status-in_conversation {
  background: rgba(30, 58, 138, 0.84);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.34);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-badge.status-quoted {
  background: rgba(146, 64, 14, 0.82);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.34);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-badge.status-won {
  background: rgba(20, 83, 45, 0.84);
  color: #dcfce7;
  border-color: rgba(74, 222, 128, 0.28);
}

html[data-theme="dark"] .page-shell[data-page="pipeline"] .pipeline-badge.status-lost {
  background: rgba(127, 29, 29, 0.84);
  color: #fee2e2;
  border-color: rgba(248, 113, 113, 0.3);
}

/* ========= Send Button ========= */
#send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  flex-shrink: 0;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-area {
  background-color: #102032;
  background-image: url('/assets/chat-bg-whatsapp-dark-from-light.png');
  background-repeat: repeat;
  background-size: 420px auto;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-body {
  background: transparent;
}

html[data-theme="dark"] .chat-pinned-banner {
  background: rgba(10, 15, 20, 0.92);
  border-color: rgba(100, 116, 139, 0.5);
}

html[data-theme="dark"] .chat-pinned-icon {
  color: #34d399;
}

html[data-theme="dark"] .chat-pinned-label {
  color: #cbd5e1;
}

html[data-theme="dark"] .chat-pinned-text {
  color: #f8fafc;
}

html[data-theme="dark"] .bubble {
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

html[data-theme="dark"] .bubble-text .message-link {
  color: #93c5fd;
}

html[data-theme="dark"] .message.out .bubble {
  background: #223452;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .message.out .bubble[data-channel="wa"] {
  background: #11442a;
  border-color: rgba(16, 185, 129, 0.35);
}

html[data-theme="dark"] .message.in .bubble[data-channel="wa"] {
  background: #1a2531;
  border-color: rgba(148, 163, 184, 0.34);
}

html[data-theme="dark"] .message.out .bubble[data-channel="ms"] {
  background: #1a3a6d;
  border-color: rgba(59, 130, 246, 0.45);
}

html[data-theme="dark"] .message.in .bubble[data-channel="ms"] {
  background: #0c1a33;
  border-color: rgba(59, 130, 246, 0.35);
}

html[data-theme="dark"] .message.out .bubble[data-channel="ig"] {
  background: #2a1a23;
  border-color: rgba(225, 48, 108, 0.55);
  box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.12);
}

html[data-theme="dark"] .message.in .bubble[data-channel="ig"] {
  background: #1d1217;
  border-color: rgba(225, 48, 108, 0.45);
  box-shadow: 0 6px 14px rgba(225, 48, 108, 0.12);
}

html[data-theme="dark"] .message.in .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='13' viewBox='0 0 8 13'%3E%3Cpath opacity='0.13' fill='%23000000' d='M1.533%2C3.568L8%2C13V0H0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3Cpath fill='%231a2531' d='M1.533%2C3.568L8%2C13V0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .message.emoji-only .meta {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.44);
  color: rgba(226, 232, 240, 0.9);
  box-shadow: 0 1px 1px rgba(2, 6, 23, 0.35);
}

html[data-theme="dark"] .contact-context-menu,
html[data-theme="dark"] .message-context-menu {
  background: #111418;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .contact-context-item,
html[data-theme="dark"] .message-context-item {
  color: #f3f6fa;
}

html[data-theme="dark"] .contact-context-item:hover,
html[data-theme="dark"] .message-context-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .contact-context-item.is-active {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

html[data-theme="dark"] .contact-context-item.danger,
html[data-theme="dark"] .message-context-item.danger {
  color: #ffd1d1;
}

html[data-theme="dark"] .contact-context-divider,
html[data-theme="dark"] .message-context-divider {
  background: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .message.out .bubble[data-channel="wa"]:not(:has(.message-media)):not(:has(.attached-img)):not(:has(.message-file-card)):not(.bubble-audio)::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='13' viewBox='0 0 8 13'%3E%3Cpath opacity='0.13' fill='%23000000' d='M1.533%2C3.568L8%2C13V0H0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3Cpath fill='%2311442a' d='M1.533%2C3.568L8%2C13V0L2.812%2C2.042C1.042%2C1.156%2C1.533%2C3.568%2C1.533%2C3.568z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .meta {
  color: rgba(226, 232, 240, 0.75);
}

html[data-theme="dark"] .message-file-card {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.36);
}

html[data-theme="dark"] .message.out .message-file-card {
  background: rgba(6, 78, 59, 0.46);
  border-color: rgba(16, 185, 129, 0.42);
}

html[data-theme="dark"] .message-file-card.has-preview .message-file-main {
  border-top-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .message-file-preview {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.75), rgba(30, 41, 59, 0.58));
}

html[data-theme="dark"] .message-file-preview.is-live {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.5));
}

html[data-theme="dark"] .message-file-sheet {
  background: rgba(15, 23, 42, 0.86);
  border-color: rgba(148, 163, 184, 0.32);
}

html[data-theme="dark"] .message-file-sheet-live {
  background: #f1f5f9;
}

html[data-theme="dark"] .message-file-sheet small {
  color: rgba(203, 213, 225, 0.9);
}

html[data-theme="dark"] .message-file-name {
  color: #f8fafc;
}

html[data-theme="dark"] .message-file-meta {
  color: rgba(203, 213, 225, 0.82);
}

html[data-theme="dark"] .message-file-download {
  border-color: rgba(148, 163, 184, 0.44);
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.52);
}

html[data-theme="dark"] .message-reply-context {
  background: rgba(15, 23, 42, 0.62);
  border-left-color: rgba(16, 185, 129, 0.95);
}

html[data-theme="dark"] .message-reply-context.out {
  background: rgba(6, 78, 59, 0.56);
}

html[data-theme="dark"] .message-reply-context:hover,
html[data-theme="dark"] .message-reply-context:focus-visible {
  background: rgba(30, 41, 59, 0.78);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .message-reply-context.out:hover,
html[data-theme="dark"] .message-reply-context.out:focus-visible {
  background: rgba(6, 78, 59, 0.72);
}

html[data-theme="dark"] .message-reply-author {
  color: rgba(52, 211, 153, 0.98);
}

html[data-theme="dark"] .message-reply-preview {
  color: rgba(226, 232, 240, 0.9);
}

html[data-theme="dark"] .message-reply-thumb {
  background: rgba(15, 23, 42, 0.72);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .day-separator {
  background: #111827;
  color: #cbd5f5;
  border-color: rgba(255, 255, 255, 0.08);
}

/* WhatsApp Send Button */
.send-btn-whatsapp {
  background: #25d366;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.send-btn-whatsapp:hover {
  background: #1ebe5d;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.send-btn-messenger {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.send-btn-messenger:hover {
  background: #1d4ed8;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.send-btn-messenger:active {
  transform: scale(0.95);
}

.send-btn-instagram {
  background: var(--ig);
  box-shadow: 0 2px 8px rgba(225, 48, 108, 0.3);
}

.send-btn-instagram:hover {
  background: #c81e5a;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(225, 48, 108, 0.35);
}

.send-btn-instagram:active {
  transform: scale(0.95);
}

.send-btn-whatsapp:active {
  transform: scale(0.95);
}

.send-btn-whatsapp svg {
  width: 22px;
  height: 22px;
  margin-left: 2px;
  /* Visual centering for arrow */
}

/* Dark mode adjustments */
html[data-theme="dark"] .send-btn-whatsapp {
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
}

html[data-theme="dark"] .send-btn-whatsapp:hover {
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

html[data-theme="dark"] .send-btn-messenger {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

html[data-theme="dark"] .send-btn-messenger:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

html[data-theme="dark"] .send-btn-instagram {
  box-shadow: 0 2px 8px rgba(225, 48, 108, 0.25);
}

html[data-theme="dark"] .send-btn-instagram:hover {
  box-shadow: 0 4px 12px rgba(225, 48, 108, 0.4);
}

/* Floating composer like reference (chat only) */
.page-shell[data-page="chat"] .chat-input {
  margin: 0 12px 12px;
  padding: 8px 0;
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.page-shell[data-page="chat"] .chat-input.has-reply-draft {
  flex-wrap: wrap;
}

.page-shell[data-page="chat"] .chat-input .input-field {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: none;
}

.page-shell[data-page="chat"] .chat-input .input-field #attach-btn,
.page-shell[data-page="chat"] .chat-input .input-field #emoji-btn,
.page-shell[data-page="chat"] .chat-input .input-field #ai-suggest {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.page-shell[data-page="chat"] .chat-input .input-field:focus-within {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.16);
}

.page-shell[data-page="chat"] .chat-input #message-input {
  padding: 0;
  min-height: 24px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  max-height: 140px;
  display: block;
}

.page-shell[data-page="chat"] .chat-input #message-input::placeholder {
  color: rgba(71, 85, 105, 0.9);
}

.page-shell[data-page="chat"] .chat-input .attach-menu,
.page-shell[data-page="chat"] .chat-input .emoji-picker {
  bottom: calc(100% + 8px);
}

.page-shell[data-page="chat"] .chat-input .emoji-picker {
  position: absolute;
  left: 0;
  right: auto;
}

.whatsapp-template-banner {
  order: -1;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 8px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84) 0%, rgba(241, 245, 249, 0.92) 100%);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: whatsappTemplateBannerIn 0.22s ease;
}

.whatsapp-template-banner-copy {
  min-width: 0;
}

.whatsapp-template-banner-copy p {
  margin: 4px 0 0;
  color: rgba(30, 41, 59, 0.92);
  font-size: 13px;
  line-height: 1.45;
}

.whatsapp-template-banner-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.whatsapp-template-banner .btn {
  flex-shrink: 0;
  min-height: 42px;
  padding-inline: 16px;
  border-radius: 14px;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.16);
}

@keyframes whatsappTemplateBannerIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input .input-field {
  background: rgba(2, 6, 23, 0.58);
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 4px 12px rgba(2, 6, 23, 0.35);
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input #message-input::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

html[data-theme="dark"] .whatsapp-template-banner {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.84) 0%, rgba(15, 23, 42, 0.94) 100%);
  border-color: rgba(96, 165, 250, 0.22);
  box-shadow: 0 18px 34px rgba(2, 6, 23, 0.34);
}

html[data-theme="dark"] .whatsapp-template-banner-copy p {
  color: rgba(226, 232, 240, 0.9);
}

html[data-theme="dark"] .whatsapp-template-banner-eyebrow {
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
}

.whatsapp-template-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(circle at top, rgba(15, 118, 110, 0.14), transparent 45%),
    rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.whatsapp-template-picker-modal.hidden {
  display: none;
}

.whatsapp-template-picker-card {
  width: min(720px, 100%);
  max-height: min(86vh, 860px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.94));
  box-shadow: 0 34px 70px rgba(15, 23, 42, 0.24);
  animation: whatsappTemplatePickerIn 0.22s ease;
}

.whatsapp-template-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.whatsapp-template-picker-copy {
  min-width: 0;
}

.whatsapp-template-picker-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.12);
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.whatsapp-template-picker-title {
  margin: 12px 0 0;
  font-size: 24px;
  line-height: 1.1;
  color: #0f172a;
}

.whatsapp-template-picker-status {
  margin: 8px 0 0;
  color: rgba(51, 65, 85, 0.92);
  font-size: 14px;
  line-height: 1.5;
}

.whatsapp-template-picker-close {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #334155;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease;
}

.whatsapp-template-picker-close:hover:not(:disabled) {
  background: transparent;
  transform: scale(1.03);
}

.whatsapp-template-picker-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.whatsapp-template-picker-empty {
  padding: 18px 20px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.86);
  color: #64748b;
  text-align: center;
}

.whatsapp-template-picker-option {
  width: 100%;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.96));
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.whatsapp-template-picker-option:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.12);
}

.whatsapp-template-picker-option.is-selected {
  border-color: rgba(14, 116, 144, 0.48);
  box-shadow: 0 20px 36px rgba(14, 116, 144, 0.16);
  background:
    linear-gradient(180deg, rgba(240, 253, 250, 0.98), rgba(236, 254, 255, 0.96));
}

.whatsapp-template-picker-option-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.whatsapp-template-picker-option-name {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.whatsapp-template-picker-option-meta {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.whatsapp-template-picker-option-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
}

.whatsapp-template-picker-option-body {
  margin: 12px 0 0;
  color: rgba(51, 65, 85, 0.94);
  font-size: 14px;
  line-height: 1.5;
}

.whatsapp-template-picker-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes whatsappTemplatePickerIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-theme="dark"] .whatsapp-template-picker-modal {
  background:
    radial-gradient(circle at top, rgba(13, 148, 136, 0.18), transparent 45%),
    rgba(2, 6, 23, 0.62);
}

html[data-theme="dark"] .whatsapp-template-picker-card {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.92));
  border-color: rgba(51, 65, 85, 0.9);
}

html[data-theme="dark"] .whatsapp-template-picker-title {
  color: #e2e8f0;
}

html[data-theme="dark"] .whatsapp-template-picker-status,
html[data-theme="dark"] .whatsapp-template-picker-option-body {
  color: rgba(226, 232, 240, 0.88);
}

html[data-theme="dark"] .whatsapp-template-picker-close {
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
}

html[data-theme="dark"] .whatsapp-template-picker-empty,
html[data-theme="dark"] .whatsapp-template-picker-option {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(71, 85, 105, 0.9);
}

html[data-theme="dark"] .whatsapp-template-picker-option.is-selected {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.16), rgba(15, 23, 42, 0.92));
  border-color: rgba(45, 212, 191, 0.5);
}

html[data-theme="dark"] .whatsapp-template-picker-option-name {
  color: #f8fafc;
}

html[data-theme="dark"] .whatsapp-template-picker-option-meta,
html[data-theme="dark"] .whatsapp-template-picker-empty {
  color: rgba(148, 163, 184, 0.92);
}

@media (max-width: 768px) {
  .whatsapp-template-picker-modal {
    padding: 0;
    align-items: stretch;
  }

  .whatsapp-template-picker-card {
    width: 100%;
    max-height: none;
    min-height: 100dvh;
    border-radius: 0;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  }

  .whatsapp-template-picker-footer {
    margin-top: auto;
    padding-top: 6px;
  }

  .whatsapp-template-picker-footer .btn {
    flex: 1 1 0;
    min-height: 46px;
  }
}

.campaigns-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.campaigns-builder-panel,
.campaigns-preview-panel,
.campaigns-drafts-panel {
  padding: 20px;
  gap: 16px;
}

.campaigns-side-column {
  display: grid;
  gap: 18px;
}

.campaigns-panel-head,
.campaigns-drafts-head,
.campaigns-contact-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.campaigns-subtitle {
  margin-top: 6px;
}

.campaigns-status,
.campaigns-inline-status {
  font-size: 13px;
}

.campaigns-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.campaigns-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.campaigns-field span,
.campaigns-section-title,
.campaign-live-label {
  color: rgba(15, 23, 42, 0.88);
  font-size: 13px;
  font-weight: 700;
}

.campaign-template-preview,
.campaign-live-card,
.campaign-contact-picker,
.campaigns-selected-block,
.campaign-draft-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.campaign-template-preview {
  padding: 16px 18px;
}

.campaign-template-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.campaign-template-preview-head strong {
  color: #0f172a;
}

.campaign-template-preview-head span {
  color: #64748b;
  font-size: 13px;
}

.campaign-template-preview p,
.campaign-draft-body,
.campaign-live-message p {
  margin: 0;
  color: rgba(51, 65, 85, 0.95);
  line-height: 1.55;
}

.campaigns-contact-picker,
.campaigns-selected-block {
  padding: 16px;
}

.campaigns-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 14px;
}

.campaign-contact-results,
.campaign-selected-list,
.campaign-drafts-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.campaign-contact-card,
.campaign-selected-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.campaign-contact-name,
.campaign-draft-name {
  color: #0f172a;
  font-weight: 700;
}

.campaign-contact-meta,
.campaign-draft-meta,
.campaign-selected-pill span {
  color: #64748b;
  font-size: 13px;
}

.campaign-contact-placeholder {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  color: #64748b;
  text-align: center;
}

.campaign-selected-pill strong {
  display: block;
  color: #0f172a;
}

.campaign-selected-remove {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.92);
  color: #334155;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.campaigns-actions {
  display: flex;
  justify-content: flex-end;
}

.campaign-live-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.campaign-live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.campaign-live-row strong,
.campaign-live-message strong {
  color: #0f172a;
}

.campaign-live-message {
  display: grid;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.campaign-draft-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.campaign-draft-head,
.campaign-draft-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.campaign-draft-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.campaign-draft-footer {
  color: #64748b;
  font-size: 12px;
}

html[data-theme="dark"] .campaigns-field span,
html[data-theme="dark"] .campaigns-section-title,
html[data-theme="dark"] .campaign-live-label,
html[data-theme="dark"] .campaign-contact-name,
html[data-theme="dark"] .campaign-draft-name,
html[data-theme="dark"] .campaign-template-preview-head strong,
html[data-theme="dark"] .campaign-selected-pill strong,
html[data-theme="dark"] .campaign-live-row strong {
  color: #f8fafc;
}

html[data-theme="dark"] .campaign-template-preview,
html[data-theme="dark"] .campaign-live-card,
html[data-theme="dark"] .campaign-contact-picker,
html[data-theme="dark"] .campaigns-selected-block,
html[data-theme="dark"] .campaign-draft-card,
html[data-theme="dark"] .campaign-contact-card,
html[data-theme="dark"] .campaign-selected-pill {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(51, 65, 85, 0.88);
}

html[data-theme="dark"] .campaign-template-preview-head span,
html[data-theme="dark"] .campaign-contact-meta,
html[data-theme="dark"] .campaign-draft-meta,
html[data-theme="dark"] .campaign-selected-pill span,
html[data-theme="dark"] .campaign-contact-placeholder,
html[data-theme="dark"] .campaign-draft-footer,
html[data-theme="dark"] .campaign-template-preview p,
html[data-theme="dark"] .campaign-draft-body,
html[data-theme="dark"] .campaign-live-message p {
  color: rgba(148, 163, 184, 0.94);
}

html[data-theme="dark"] .campaign-selected-remove {
  background: rgba(30, 41, 59, 0.95);
  color: #e2e8f0;
}

html[data-theme="dark"] .campaign-live-message {
  border-top-color: rgba(51, 65, 85, 0.9);
}

@media (max-width: 1100px) {
  .campaigns-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .campaigns-form-grid,
  .campaigns-search-row {
    grid-template-columns: 1fr;
  }

  .campaign-draft-head,
  .campaign-draft-footer,
  .campaign-live-row,
  .campaign-contact-card,
  .campaign-selected-pill,
  .campaigns-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .campaigns-actions .btn {
    width: 100%;
  }
}

.campaigns-history-panel,
.campaigns-detail-panel {
  padding: 20px;
  gap: 16px;
}

.campaign-progress-pill,
.campaign-inline-counter,
.campaign-chip,
.campaign-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.campaign-progress-pill,
.campaign-inline-counter,
.campaign-chip {
  padding: 7px 12px;
  color: #0f172a;
  background: linear-gradient(135deg, rgba(191, 219, 254, 0.62), rgba(191, 250, 241, 0.62));
  border: 1px solid rgba(125, 211, 252, 0.45);
}

.campaign-template-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.campaigns-variables-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.96));
}

.campaign-variables-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.campaign-variable-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.72);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.06);
}

.campaign-variable-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.campaign-variable-head strong {
  color: #0f172a;
}

.campaign-variable-head span {
  color: #64748b;
  font-size: 13px;
}

.campaign-variable-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.campaigns-actions {
  gap: 12px;
}

.campaigns-actions .btn.primary {
  min-width: 180px;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.24);
}

.campaign-history-table-wrap,
.campaign-recipient-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.92);
}

.campaign-history-table,
.campaign-recipient-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.campaign-history-table th,
.campaign-history-table td,
.campaign-recipient-table th,
.campaign-recipient-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.86);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.campaign-history-table th,
.campaign-recipient-table th {
  color: #475569;
  background: rgba(248, 250, 252, 0.92);
  position: sticky;
  top: 0;
  z-index: 1;
}

.campaign-history-row {
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.campaign-history-row:hover,
.campaign-history-row.is-selected {
  background: rgba(219, 234, 254, 0.46);
}

.campaign-history-name {
  color: #0f172a;
  font-weight: 700;
}

.campaign-history-meta {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}

.campaign-status-badge {
  padding: 6px 10px;
}

.campaign-status-badge.is-draft {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
}

.campaign-status-badge.is-running {
  color: #92400e;
  background: rgba(251, 191, 36, 0.18);
}

.campaign-status-badge.is-completed,
.campaign-status-badge.is-delivered {
  color: #166534;
  background: rgba(34, 197, 94, 0.16);
}

.campaign-status-badge.is-read,
.campaign-status-badge.is-replied {
  color: #065f46;
  background: rgba(45, 212, 191, 0.16);
}

.campaign-status-badge.is-failed {
  color: #b91c1c;
  background: rgba(248, 113, 113, 0.18);
}

.campaign-status-badge.is-paused {
  color: #6b21a8;
  background: rgba(196, 181, 253, 0.24);
}

.campaign-detail-content {
  display: grid;
  gap: 16px;
}

.campaign-detail-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.campaign-detail-summary-card,
.campaign-detail-preview {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.94);
}

.campaign-detail-summary-card span,
.campaign-detail-preview .campaigns-section-title {
  color: #64748b;
  font-size: 12px;
  display: block;
  margin-bottom: 6px;
}

.campaign-detail-summary-card strong {
  color: #0f172a;
  font-size: 19px;
}

.campaign-detail-preview p {
  margin: 0;
  color: rgba(51, 65, 85, 0.95);
  line-height: 1.6;
}

.campaign-live-foot {
  color: #64748b;
  font-size: 12px;
}

.campaign-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.campaign-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
}

.campaign-modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  margin: 7vh auto 0;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(191, 219, 254, 0.48);
  background:
    radial-gradient(circle at top left, rgba(191, 219, 254, 0.38), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  animation: campaignModalIn 180ms ease;
}

.campaign-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.campaign-modal-title {
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
}

.campaign-confirm-body {
  display: grid;
  gap: 14px;
}

.campaign-confirm-grid {
  display: grid;
  gap: 12px;
}

.campaign-confirm-row,
.campaign-confirm-preview {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  background: rgba(255, 255, 255, 0.86);
}

.campaign-confirm-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.campaign-confirm-row span,
.campaign-confirm-preview span {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.campaign-confirm-row strong {
  color: #0f172a;
}

.campaign-confirm-preview p {
  margin: 10px 0 0;
  color: rgba(51, 65, 85, 0.95);
  line-height: 1.6;
}

.campaign-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

@keyframes campaignModalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-theme="dark"] .campaigns-history-panel,
html[data-theme="dark"] .campaigns-detail-panel,
html[data-theme="dark"] .campaigns-variables-panel,
html[data-theme="dark"] .campaign-variable-card,
html[data-theme="dark"] .campaign-history-table-wrap,
html[data-theme="dark"] .campaign-recipient-table-wrap,
html[data-theme="dark"] .campaign-detail-summary-card,
html[data-theme="dark"] .campaign-detail-preview,
html[data-theme="dark"] .campaign-confirm-row,
html[data-theme="dark"] .campaign-confirm-preview,
html[data-theme="dark"] .campaign-modal-dialog {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(51, 65, 85, 0.88);
}

html[data-theme="dark"] .campaign-variable-head strong,
html[data-theme="dark"] .campaign-modal-title,
html[data-theme="dark"] .campaign-history-name,
html[data-theme="dark"] .campaign-detail-summary-card strong,
html[data-theme="dark"] .campaign-confirm-row strong {
  color: #f8fafc;
}

html[data-theme="dark"] .campaign-variable-head span,
html[data-theme="dark"] .campaign-history-meta,
html[data-theme="dark"] .campaign-detail-summary-card span,
html[data-theme="dark"] .campaign-detail-preview p,
html[data-theme="dark"] .campaign-live-foot,
html[data-theme="dark"] .campaign-confirm-row span,
html[data-theme="dark"] .campaign-confirm-preview span,
html[data-theme="dark"] .campaign-confirm-preview p {
  color: rgba(148, 163, 184, 0.92);
}

html[data-theme="dark"] .campaign-history-table th,
html[data-theme="dark"] .campaign-recipient-table th {
  background: rgba(30, 41, 59, 0.95);
  color: #cbd5e1;
}

html[data-theme="dark"] .campaign-history-table td,
html[data-theme="dark"] .campaign-recipient-table td,
html[data-theme="dark"] .campaign-history-table th,
html[data-theme="dark"] .campaign-recipient-table th {
  border-bottom-color: rgba(51, 65, 85, 0.8);
}

.campaigns-view {
  padding: 12px;
}

.campaigns-page-card {
  width: 100%;
  min-height: calc(100vh - 34px);
  padding: 20px;
  border: 1px solid rgba(226, 232, 240, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.06);
}

.campaigns-breadcrumb {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 18px;
  color: #2563eb;
  font-size: 14px;
  font-weight: 700;
}

.campaigns-breadcrumb > i {
  color: #71819d;
  font-size: 13px;
}

.campaigns-breadcrumb strong {
  color: #101a33;
  font-weight: 800;
}

.campaigns-breadcrumb .campaign-progress-pill {
  margin-left: auto;
}

.campaigns-back-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: #f4f7ff;
  color: #315cf6;
  font-size: 18px;
  cursor: default;
}

.campaigns-view .campaigns-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.7fr);
  gap: 24px;
}

.campaigns-view .panel {
  border-color: rgba(219, 226, 239, 0.92);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.045);
}

.campaigns-view .campaigns-builder-panel,
.campaigns-view .campaigns-preview-panel,
.campaigns-view .campaigns-history-panel,
.campaigns-view .campaigns-detail-panel {
  padding: 22px;
}

.campaigns-view .campaigns-builder-panel {
  min-height: 820px;
}

.campaigns-title-wrap,
.campaigns-side-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.campaigns-title-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f2f5ff;
  color: #315cf6;
  font-size: 34px;
}

.campaigns-view .campaigns-panel-head .title {
  color: #101a33;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 850;
}

.campaigns-view .campaigns-subtitle,
.campaigns-helper-text,
.campaigns-view .muted {
  color: #66728c;
}

.campaigns-helper-text {
  margin: 6px 0 16px;
  font-size: 14px;
}

.campaigns-view .campaigns-status {
  min-height: 18px;
  margin-bottom: 12px;
}

.campaigns-view .campaigns-form-grid {
  gap: 18px;
  margin-bottom: 20px;
}

.campaigns-view .campaigns-field {
  gap: 9px;
}

.campaigns-view .campaigns-field span,
.campaigns-view .campaigns-section-title,
.campaigns-view .campaign-live-label {
  color: #19243b;
  font-size: 13px;
  font-weight: 800;
}

.campaigns-view .campaigns-field span i {
  margin-left: 4px;
  color: #6b7894;
  font-size: 12px;
}

.campaigns-view .input,
.campaigns-view select.input,
.campaigns-view textarea.input {
  min-height: 44px;
  border-color: rgba(203, 213, 225, 0.92);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.98);
  color: #15223a;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.02);
}

.campaigns-view .input:focus,
.campaigns-view select.input:focus,
.campaigns-view textarea.input:focus {
  border-color: rgba(49, 92, 246, 0.38);
  box-shadow: 0 0 0 3px rgba(49, 92, 246, 0.1);
}

.campaigns-view .campaign-template-preview,
.campaigns-view .campaign-contact-picker,
.campaigns-view .campaigns-selected-block,
.campaigns-view .campaigns-variables-panel,
.campaigns-view .campaign-live-card,
.campaigns-view .campaign-history-table-wrap,
.campaigns-view .campaign-recipient-table-wrap,
.campaigns-view .campaign-detail-summary-card,
.campaigns-view .campaign-detail-preview {
  border-color: rgba(219, 226, 239, 0.95);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
}

.campaigns-view .campaign-template-preview,
.campaigns-view .campaign-contact-picker,
.campaigns-view .campaigns-selected-block,
.campaigns-view .campaigns-variables-panel {
  margin-top: 18px;
  padding: 18px;
}

.campaigns-view .campaigns-search-row {
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 12px;
}

.campaigns-view .campaign-contact-placeholder {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(173, 185, 206, 0.7);
  border-radius: 10px;
  background: #ffffff;
}

.campaigns-view .campaign-contact-placeholder::before {
  content: "+";
  width: 34px;
  height: 34px;
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(99, 132, 255, 0.25);
  border-radius: 999px;
  color: #315cf6;
  font-size: 22px;
  line-height: 1;
  background: #f8fbff;
}

.campaigns-view .campaign-inline-counter {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #10203d;
  background: #d9f3ff;
  border: 0;
  letter-spacing: 0;
  font-size: 14px;
}

.campaigns-view .campaigns-actions {
  margin-top: 24px;
  gap: 16px;
}

.campaigns-view .campaigns-actions .btn {
  min-height: 44px;
  border-radius: 7px;
  padding-inline: 24px;
  font-weight: 800;
}

.campaigns-view .campaigns-actions .btn.primary {
  min-width: 152px;
  background: #315cf6;
  box-shadow: 0 14px 28px rgba(49, 92, 246, 0.22);
}

.campaigns-view .campaigns-actions .btn.ghost {
  min-width: 158px;
  background: #ffffff;
}

.campaigns-view .campaigns-side-column {
  gap: 20px;
}

.campaigns-view .campaigns-side-head > i {
  color: #315cf6;
  font-size: 21px;
  line-height: 1;
}

.campaigns-view .campaign-live-card {
  padding: 14px 16px;
  gap: 0;
}

.campaigns-view .campaign-live-row {
  min-height: 32px;
  padding: 0 2px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.campaigns-view .campaign-live-row strong {
  font-size: 13px;
  color: #14213d;
}

.campaigns-view .campaign-live-message {
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

.campaigns-view .campaign-live-message p {
  min-height: 48px;
  padding: 14px 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 12px;
  color: #34415b;
}

.campaigns-view .campaign-empty-state {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 20px;
  text-align: center;
}

.campaigns-view .campaign-empty-state.hidden {
  display: none;
}

.campaign-empty-icon {
  width: 78px;
  height: 78px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #7c96ff;
  background: #f5f7ff;
  border: 1px solid rgba(156, 180, 255, 0.45);
  font-size: 40px;
}

.campaigns-view .campaign-empty-state strong {
  margin-top: 6px;
  color: #101a33;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 850;
}

.campaigns-view .campaign-empty-state span {
  max-width: 330px;
  color: #6a7690;
  font-size: 14px;
  line-height: 1.35;
}

.campaigns-view .campaign-history-table-wrap,
.campaigns-view .campaign-recipient-table-wrap {
  margin-top: 10px;
  border-radius: 10px;
}

.campaigns-view .campaign-history-table,
.campaigns-view .campaign-recipient-table {
  min-width: 650px;
}

.campaigns-view .campaign-history-table th,
.campaigns-view .campaign-recipient-table th {
  color: #34415b;
  background: #ffffff;
  font-size: 12px;
  font-weight: 850;
}

.campaigns-view .campaign-history-table td,
.campaigns-view .campaign-recipient-table td {
  color: #23304a;
}

.campaigns-view .campaign-history-row:hover,
.campaigns-view .campaign-history-row.is-selected {
  background: #f5f8ff;
}

.campaigns-view .campaign-detail-panel {
  min-height: 260px;
}

html[data-theme="dark"] .campaigns-page-card,
html[data-theme="dark"] .campaigns-view .panel,
html[data-theme="dark"] .campaigns-view .campaign-template-preview,
html[data-theme="dark"] .campaigns-view .campaign-contact-picker,
html[data-theme="dark"] .campaigns-view .campaigns-selected-block,
html[data-theme="dark"] .campaigns-view .campaigns-variables-panel,
html[data-theme="dark"] .campaigns-view .campaign-live-card,
html[data-theme="dark"] .campaigns-view .campaign-history-table-wrap,
html[data-theme="dark"] .campaigns-view .campaign-recipient-table-wrap,
html[data-theme="dark"] .campaigns-view .campaign-detail-summary-card,
html[data-theme="dark"] .campaigns-view .campaign-detail-preview {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(51, 65, 85, 0.88);
}

html[data-theme="dark"] .campaigns-breadcrumb strong,
html[data-theme="dark"] .campaigns-view .campaigns-panel-head .title,
html[data-theme="dark"] .campaigns-view .campaigns-field span,
html[data-theme="dark"] .campaigns-view .campaigns-section-title,
html[data-theme="dark"] .campaigns-view .campaign-live-label,
html[data-theme="dark"] .campaigns-view .campaign-empty-state strong {
  color: #f8fafc;
}

html[data-theme="dark"] .campaigns-view .campaigns-subtitle,
html[data-theme="dark"] .campaigns-helper-text,
html[data-theme="dark"] .campaigns-view .muted,
html[data-theme="dark"] .campaigns-view .campaign-empty-state span {
  color: #94a3b8;
}

@media (max-width: 1280px) {
  .campaigns-view .campaigns-layout {
    grid-template-columns: 1fr;
  }

  .campaigns-view .campaigns-builder-panel {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .campaigns-view {
    padding: 8px;
  }

  .campaigns-page-card {
    padding: 14px;
  }

  .campaigns-breadcrumb {
    flex-wrap: wrap;
    gap: 10px;
  }

  .campaigns-title-wrap {
    align-items: center;
  }

  .campaigns-title-icon {
    width: 48px;
    height: 48px;
    font-size: 27px;
  }

  .campaigns-view .campaigns-builder-panel,
  .campaigns-view .campaigns-preview-panel,
  .campaigns-view .campaigns-history-panel,
  .campaigns-view .campaigns-detail-panel {
    padding: 16px;
  }

  .campaigns-view .campaigns-search-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .campaign-variable-grid,
  .campaign-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .campaign-variable-grid,
  .campaign-detail-summary,
  .campaign-confirm-row,
  .campaign-modal-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .campaign-modal-dialog {
    width: calc(100vw - 18px);
    margin-top: 14px;
    padding: 18px;
  }

  .campaign-history-table,
  .campaign-recipient-table {
    min-width: 620px;
  }
}

.reply-draft-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  order: -1;
  flex: 1 0 100%;
  width: 100%;
  gap: 10px;
  margin: 0 4px 8px;
  padding: 10px 12px;
  border-left: 3px solid rgba(34, 197, 94, 0.92);
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.95);
}

.reply-draft-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reply-draft-author {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  color: rgba(5, 150, 105, 0.98);
}

.reply-draft-text {
  font-size: 14px;
  line-height: 1.35;
  color: rgba(30, 41, 59, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(70vw, 760px);
}

.reply-draft-close {
  border: 0;
  background: transparent;
  color: rgba(71, 85, 105, 0.95);
  width: auto;
  height: auto;
  border-radius: 0;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
  margin-top: -2px;
  flex: 0 0 auto;
}

.reply-draft-close:hover {
  background: transparent;
}

html[data-theme="dark"] .reply-draft-bar {
  background: rgba(10, 15, 20, 0.93);
  border-left-color: rgba(16, 185, 129, 0.9);
}

html[data-theme="dark"] .reply-draft-author {
  color: rgba(52, 211, 153, 0.98);
}

html[data-theme="dark"] .reply-draft-text {
  color: rgba(226, 232, 240, 0.95);
}

html[data-theme="dark"] .reply-draft-close {
  color: rgba(226, 232, 240, 0.9);
}

/* ========= Full Emoji Picker ========= */
.emoji-picker {
  position: fixed;
  bottom: 80px;
  left: auto;
  width: min(560px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emoji-picker-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-alt);
}

.emoji-mode-tab {
  border: 0;
  border-right: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted-strong);
  font-size: 13px;
  font-weight: 600;
  min-height: 34px;
  cursor: pointer;
}

.emoji-mode-tab:last-child {
  border-right: 0;
}

.emoji-mode-tab.active {
  color: var(--color-text);
  background: var(--color-surface);
}

.emoji-picker-header {
  padding: 10px 12px 6px;
  border-bottom: 1px solid var(--color-border);
}

.emoji-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-alt);
  font-size: 13px;
  color: var(--color-text);
  outline: none;
  font-family: var(--font-ui);
}

.emoji-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.emoji-picker-categories {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.emoji-picker-categories::-webkit-scrollbar {
  display: none;
}

.emoji-cat-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .12s;
  flex-shrink: 0;
  line-height: 1;
}

.emoji-cat-btn:hover {
  background: var(--color-surface-alt);
}

.emoji-cat-btn.active {
  background: var(--color-primary-soft);
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.emoji-virtual-spacer {
  grid-column: 1 / -1;
  pointer-events: none;
}

.emoji-panel {
  display: block;
}

.emoji-panel.hidden {
  display: none;
}

.emoji-panel-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 13px;
  padding: 16px;
}

.sticker-panel-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--color-border);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.sticker-tile {
  position: relative;
  border-radius: 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  min-height: 70px;
}

.sticker-item {
  width: 100%;
  height: 100%;
  min-height: 70px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.sticker-item img {
  max-width: 56px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sticker-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.sticker-tile:hover .sticker-remove-btn,
.sticker-remove-btn:focus-visible {
  opacity: 1;
}

.sticker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-muted);
  font-size: 13px;
  padding: 20px 8px;
}

.emoji-picker-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-picker-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 6px;
}

.emoji-item {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  padding: 4px;
  border-radius: 8px;
  transition: background .1s, transform .1s;
  text-align: center;
  line-height: 1.2;
  font-family: var(--font-emoji);
}

.emoji-item:hover {
  background: var(--color-surface-alt);
  transform: scale(1.15);
}

.emoji-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: var(--color-muted);
  font-size: 13px;
}

/* ========= Compact Contact Info Bar ========= */
.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  margin: 0 8px;
  background: var(--color-surface-alt);
  border-radius: 10px;
  font-size: 12px;
  color: var(--color-muted-strong);
  flex-wrap: wrap;
  border: 1px solid var(--color-border);
}

.cci-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.cci-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.cci-tags {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cci-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 500;
}

/* ========= AI Suggest Button (Inline in Input Field) ========= */
.ai-suggest-inline {
  flex-shrink: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  transition: color .12s, transform .12s;
  color: var(--color-primary);
}

.ai-suggest-inline svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.ai-suggest-inline:hover {
  background: transparent;
  transform: translateY(-1px);
}

/* ========= Transfer Button (Contact List) ========= */
.contact-transfer-btn {
  position: absolute;
  right: 10px;
  top: 35px;
  transform: none;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-warning);
  background: transparent;
  color: var(--color-warning);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .12s;
  z-index: 2;
}

.contact:hover .contact-transfer-btn,
.contact-transfer-btn:focus {
  opacity: 1;
}

.contact-transfer-btn:hover {
  background: rgba(217, 119, 6, 0.12);
}

.contact.conv-item {
  position: relative;
}

/* Transfer dropdown */
.transfer-dropdown {
  position: absolute;
  right: 10px;
  top: 50px;
  z-index: 30;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 6px 0;
  max-height: 200px;
  overflow-y: auto;
}

.transfer-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
}

.transfer-dropdown-item:hover {
  background: var(--color-surface-alt);
}

/* Spectator mode banner */
.spectator-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  margin: 0 8px 4px;
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 10px;
  font-size: 12px;
  color: var(--color-warning);
  font-weight: 500;
}

/* ========= Hamburger Button ========= */
.hamburger-btn {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--topbar-text);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background .12s;
  margin-right: 8px;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--color-surface-alt);
}

/* ========= Tablet Breakpoint (768px – 1023px) ========= */
@media (max-width: 1023px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

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

  .hamburger-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-right .user-email {
    display: none;
  }

  .topbar-pill {
    padding: 4px 4px 4px 8px;
  }

  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
    padding: var(--space-2);
    height: calc(100vh - 60px);
  }

  .chat-header .ai-controls {
    flex-wrap: wrap;
  }

  .ai-select {
    min-width: 140px;
  }

  .info-panel {
    width: 300px;
  }
}

/* ========= Mobile Breakpoint (< 768px) ========= */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

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

  .hamburger-btn {
    display: inline-flex;
  }

  .topbar {
    min-height: 50px;
    padding: 0 12px;
  }

  .topbar-right .user-email,
  .topbar-right .build-stamp {
    display: none;
  }

  .topbar-pill {
    padding: 2px 2px 2px 6px;
    gap: 0;
  }

  .topbar-pill .user-role.badge {
    font-size: 10px;
    padding: 3px 8px;
    margin-right: 4px;
  }

  .topbar-pill .btn.ghost {
    padding: 4px 10px;
    font-size: 11px;
  }

  .chat-header {
    margin: 0;
    padding: 8px 10px;
    border-radius: 0;
    gap: 8px;
    min-height: 48px;
  }

  .chat-header .ai-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  .ai-select {
    min-width: 120px;
    font-size: 12px;
  }

  .chat-actions {
    gap: 4px;
  }

  .chat-score-stars {
    gap: 1px;
    padding: 3px 4px;
  }

  .chat-score-star,
  .chat-score-star svg {
    width: 15px;
    height: 15px;
  }

  .chat-title {
    gap: 8px;
  }

  .contact-title {
    font-size: 14px;
  }

  .contact-subtitle {
    font-size: 11px;
  }

  .avatar-circle {
    width: 34px;
    height: 34px;
  }

  .mobile-back-btn {
    display: inline-flex;
  }

  .search-panel input {
    width: 180px;
  }

  /* Modal responsive */
  .modal .panel {
    width: 92vw !important;
    max-width: 420px;
  }

  .info-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 360px;
    z-index: 50;
    border-radius: 0;
  }

  .chat-mobile-tabs {
    display: flex;
  }

  /* AI suggestion box responsive */
  .ai-suggestion-box {
    margin: 0 4px;
    border-radius: 12px;
  }

  /* Emoji picker responsive */
  .emoji-picker {
    width: calc(100vw - 24px);
    max-width: 320px;
  }

  /* Attach menu responsive */
  .attach-menu {
    max-width: calc(100vw - 24px);
  }
}

/* Mobile chat list: WhatsApp-like style (no desktop impact) */
@media (max-width: 768px) {
  .page-shell[data-page="chat"] .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 0;
    padding: 0;
    height: 100%;
    min-height: 100%;
  }

  body.page-chat .main-area main {
    padding: 0 !important;
  }

  body.page-chat .page-shell {
    padding-bottom: 0;
    height: 100%;
  }

  .page-shell[data-page="chat"] .panel.sidebar {
    display: flex;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: var(--color-bg);
    height: 100%;
    min-height: 0;
  }

  .page-shell[data-page="chat"][data-view="chat"] .panel.sidebar {
    display: none;
  }

  .page-shell[data-page="chat"][data-view="chat"] .chat-area {
    display: flex;
  }

  .page-shell[data-page="chat"][data-view="contacts"] .chat-area,
  .page-shell[data-page="chat"][data-view="contacts"] #info-panel {
    display: none;
  }

  .page-shell[data-page="chat"][data-view="profile"] .panel.sidebar,
  .page-shell[data-page="chat"][data-view="profile"] .chat-area {
    display: none;
  }

  .page-shell[data-page="chat"][data-view="profile"] #info-panel {
    display: flex;
  }

  .page-shell[data-page="chat"] .chat-area,
  .page-shell[data-page="chat"] #info-panel {
    height: 100%;
    min-height: 0;
    border-radius: 0;
  }

  .page-shell[data-page="chat"] .chat-body {
    min-height: 0;
  }

  .page-shell[data-page="chat"] .chat-input {
    margin: 0 8px 8px;
    padding: 8px 10px;
    border-radius: 18px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .whatsapp-template-banner {
    margin: 0 0 8px;
    padding: 16px;
    border-radius: 20px;
    flex-direction: column;
    align-items: stretch;
  }

  .whatsapp-template-banner .btn {
    width: 100%;
  }

  .page-shell[data-page="chat"]:not([data-view]) .panel.sidebar {
    display: flex;
  }

  .page-shell[data-page="chat"]:not([data-view]) .chat-area {
    display: none;
  }

  .chat-mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--color-bg);
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
  }

  .chat-mobile-tabs .btn {
    border-radius: 999px;
    font-size: 12px;
    padding: 6px 12px;
  }

  .sidebar-top {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--color-bg);
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--color-border);
  }

  .sidebar-top .btn {
    border-radius: 999px;
    font-size: 13px;
    padding: 8px 12px;
  }

  .sidebar-search {
    background: var(--color-surface-alt);
    border-radius: 999px;
    padding: 8px 12px;
  }

  .sidebar-search input {
    font-size: 13px;
    background: transparent;
  }

  .filter-label {
    display: none;
  }

  .filter-tags-container {
    margin-top: 6px;
  }

  .filter-tags {
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tags::-webkit-scrollbar {
    display: none;
  }

  .filter-tag {
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .contact-list {
    padding: 0;
  }

  .contact.conv-item {
    padding: 10px 12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .contact.conv-item.active {
    background: var(--color-surface-alt);
  }

  .contact-row {
    align-items: flex-start;
  }

  .contact-name {
    font-size: 15px;
  }

  .contact-time {
    font-size: 11px;
  }

  .contact-phone {
    font-size: 11px;
  }

  .contact-last-msg {
    font-size: 13px;
  }

  .contact-avatar {
    width: 44px;
    height: 44px;
  }

.contact-badges {
  gap: 6px;
}
}

@media (min-width: 1280px) and (max-width: 1599px) {
  .page-shell[data-page="chat"] .app-shell {
    width: 100%;
    height: 100%;
    grid-template-columns: 368px minmax(0, 1fr);
    padding: 0;
  }

  .page-shell[data-page="chat"] .chat-area,
  .page-shell[data-page="chat"] .panel.sidebar {
    height: 100%;
    min-height: 0;
  }

  .chat-header {
    padding: 8px 12px;
  }

  .page-shell[data-page="chat"] .chat-input {
    margin: 0 8px 8px;
    padding: 8px 10px;
  }

  .ai-select {
    min-width: 156px;
    max-width: 188px;
  }

  .chat-header-status-select {
    min-width: 154px;
    max-width: 188px;
  }
}

@media (min-width: 769px) and (max-width: 1279px) {
  body.page-chat .main-area main {
    padding: 0 !important;
  }

  .page-shell[data-page="chat"] .app-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: none;
    gap: 0;
    padding: 0;
  }

  .page-shell[data-page="chat"] .panel.sidebar,
  .page-shell[data-page="chat"] .chat-area {
    order: initial;
    height: 100%;
    min-height: 0;
  }

  .chat-header {
    padding: 8px 10px;
    min-height: 52px;
    gap: 8px;
  }

  .chat-title,
  .chat-actions,
  .ai-controls {
    min-width: 0;
  }

  .page-shell[data-page="chat"] .chat-input {
    margin: 0 8px 8px;
    padding: 8px 10px;
    gap: 8px;
  }

  .ai-select {
    min-width: 138px;
    max-width: 168px;
  }

  .chat-header-status-select {
    min-width: 146px;
    max-width: 178px;
  }

  .bubble {
    max-width: 82%;
  }
}

/* ===== File Preview Modal ===== */
.chat-drop-overlay {
  position: absolute;
  inset: 18px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.chat-drop-overlay-card {
  min-width: min(420px, calc(100% - 32px));
  max-width: min(520px, calc(100% - 32px));
  padding: 26px 28px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(241, 245, 249, 0.84)),
    radial-gradient(circle at top, rgba(37, 211, 102, 0.16), transparent 58%);
  box-shadow:
    0 30px 90px rgba(15, 23, 42, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  animation: chatDropOverlayIn 0.18s ease;
}

.chat-drop-overlay-icon {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(37, 211, 102, 0.24), rgba(16, 185, 129, 0.12));
  color: #057a55;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.chat-drop-overlay-icon svg {
  width: 28px;
  height: 28px;
}

.chat-drop-overlay-card strong {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
}

.chat-drop-overlay-card small {
  font-size: 13px;
  line-height: 1.4;
  color: #475569;
}

@keyframes chatDropOverlayIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.file-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(7px);
  animation: filePreviewBackdropIn 0.18s ease;
}

.file-preview-modal.hidden {
  display: none;
}

.file-preview-card {
  width: min(840px, 96vw);
  height: min(88vh, 900px);
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #d5dde8;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: filePreviewCardIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.file-preview-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.file-preview-close {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-preview-close:hover {
  background: transparent;
  color: #0f172a;
}

.file-preview-headline {
  min-width: 0;
}

.file-preview-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.file-preview-subtitle {
  margin-top: 2px;
  font-size: 13px;
  color: #64748b;
}

.file-preview-body {
  flex: 1;
  min-height: 260px;
  background:
    radial-gradient(circle at top, rgba(37, 211, 102, 0.12), transparent 42%),
    linear-gradient(180deg, #edf3f8 0%, #e6edf5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.file-preview-image-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.file-preview-image-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  padding: 14px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.7), rgba(226, 232, 240, 0.28)),
    radial-gradient(circle at top left, rgba(37, 211, 102, 0.15), transparent 42%);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 18px 34px rgba(15, 23, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-preview-pdf,
.file-preview-image,
.file-preview-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  border-radius: 10px;
  background: #ffffff;
}

.file-preview-image {
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.file-preview-remove {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.22);
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.file-preview-remove:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 42, 0.86);
}

.file-preview-remove svg {
  width: 18px;
  height: 18px;
}

.file-preview-remove span {
  font-size: 13px;
  font-weight: 600;
}

.file-preview-counter {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.15);
  backdrop-filter: blur(10px);
}

.file-preview-thumbs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 2px;
  scrollbar-width: thin;
}

.file-preview-thumbs::-webkit-scrollbar {
  height: 8px;
}

.file-preview-thumbs::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.34);
}

.file-preview-thumb-card {
  position: relative;
  flex: 0 0 auto;
  width: 88px;
  animation: filePreviewThumbIn 0.18s ease;
}

.file-preview-thumb {
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 20px;
  background: #ffffff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.file-preview-thumb:hover {
  transform: translateY(-1px);
}

.file-preview-thumb-card.active .file-preview-thumb {
  border-color: #10b981;
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.16),
    0 14px 26px rgba(15, 23, 42, 0.18);
}

.file-preview-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.file-preview-thumb-remove {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.84);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
}

@keyframes filePreviewThumbIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.file-preview-generic {
  width: min(420px, 96%);
  border: 1px solid #d7e0ea;
  border-radius: 14px;
  background: #ffffff;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.file-preview-generic-ext {
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.file-preview-generic-name {
  font-size: 15px;
  color: #0f172a;
  word-break: break-word;
}

.file-preview-generic-meta {
  font-size: 12px;
  color: #64748b;
}

.file-preview-footer {
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-preview-footer input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d0d8e4;
  border-radius: 10px;
  background: #f8fafc;
  color: #0f172a;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

.file-preview-footer input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.file-preview-actions {
  display: inline-flex;
  gap: 8px;
}

@keyframes filePreviewBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes filePreviewCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

html[data-theme="dark"] .file-preview-modal {
  background: rgba(2, 6, 23, 0.52);
}

html[data-theme="dark"] .file-preview-card {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.32);
}

html[data-theme="dark"] .file-preview-header,
html[data-theme="dark"] .file-preview-footer {
  background: #0b1220;
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="dark"] .file-preview-title {
  color: #f8fafc;
}

html[data-theme="dark"] .file-preview-subtitle {
  color: #94a3b8;
}

html[data-theme="dark"] .file-preview-close {
  color: #cbd5e1;
}

html[data-theme="dark"] .file-preview-close:hover {
  background: rgba(71, 85, 105, 0.38);
  color: #f8fafc;
}

html[data-theme="dark"] .file-preview-body {
  background: #111827;
}

html[data-theme="dark"] .chat-drop-overlay-card {
  border-color: rgba(148, 163, 184, 0.28);
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.78)),
    radial-gradient(circle at top, rgba(37, 211, 102, 0.18), transparent 58%);
  color: #f8fafc;
}

html[data-theme="dark"] .chat-drop-overlay-card small {
  color: #cbd5e1;
}

html[data-theme="dark"] .chat-drop-overlay-icon {
  background: linear-gradient(160deg, rgba(37, 211, 102, 0.24), rgba(15, 118, 110, 0.18));
  color: #d1fae5;
}

html[data-theme="dark"] .file-preview-pdf,
html[data-theme="dark"] .file-preview-image,
html[data-theme="dark"] .file-preview-video,
html[data-theme="dark"] .file-preview-generic {
  background: #020617;
  border-color: rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .file-preview-image-stage {
  background:
    linear-gradient(150deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.58)),
    radial-gradient(circle at top left, rgba(37, 211, 102, 0.14), transparent 44%);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(2, 6, 23, 0.36);
}

html[data-theme="dark"] .file-preview-remove {
  background: rgba(2, 6, 23, 0.76);
  color: #f8fafc;
}

html[data-theme="dark"] .file-preview-counter {
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
}

html[data-theme="dark"] .file-preview-thumb {
  background: #020617;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.26);
}

html[data-theme="dark"] .file-preview-thumb-card.active .file-preview-thumb {
  box-shadow:
    0 0 0 4px rgba(16, 185, 129, 0.18),
    0 14px 26px rgba(2, 6, 23, 0.4);
}

html[data-theme="dark"] .file-preview-thumb-remove {
  background: rgba(2, 6, 23, 0.92);
}

html[data-theme="dark"] .file-preview-generic-ext {
  background: #1e293b;
  color: #e2e8f0;
}

html[data-theme="dark"] .file-preview-generic-name {
  color: #e2e8f0;
}

html[data-theme="dark"] .file-preview-generic-meta {
  color: #94a3b8;
}

html[data-theme="dark"] .file-preview-footer input {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}

@media (max-width: 768px) {
  .chat-drop-overlay {
    inset: 12px;
  }

  .chat-drop-overlay-card {
    min-width: auto;
    max-width: none;
    width: 100%;
    padding: 22px 18px;
    border-radius: 24px;
  }

  .chat-drop-overlay-card strong {
    font-size: 19px;
  }

  .file-preview-modal {
    padding: 0;
  }

  .file-preview-card {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }

  .file-preview-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .file-preview-actions {
    width: 100%;
    justify-content: stretch;
  }

  .file-preview-actions .btn {
    flex: 1;
  }

  .file-preview-image-stage {
    border-radius: 18px;
    padding: 10px;
  }

  .file-preview-remove {
    top: 12px;
    right: 12px;
    padding: 9px 12px;
  }

  .file-preview-remove span {
    display: none;
  }

  .file-preview-counter {
    left: 12px;
    bottom: 12px;
  }

  .file-preview-thumb-card,
  .file-preview-thumb {
    width: 72px;
    height: 72px;
  }
}

/* ===== Visual Library IA ===== */
.visual-library-page {
  width: 100%;
  display: flex;
  justify-content: center;
}

.visual-library-shell {
  width: min(100% - 28px, 1680px);
  margin: 14px auto !important;
  padding: 28px 30px 34px !important;
  border-radius: 34px;
  border: 1px solid #dce3ee;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  box-shadow: 0 26px 48px rgba(15, 23, 42, 0.08);
}

@media (min-width: 1200px) {
  .ai-page-shell,
  .visual-library-page {
    zoom: 0.9;
  }

  .ai-page-shell > .ai-profiles-shell,
  .visual-library-shell {
    width: min(100% - 12px, 1860px);
  }
}

.visual-ai-profile-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
}

.visual-library-header,
.visual-library-toolbar,
.visual-library-actions,
.visual-library-upload-row,
.visual-library-two-cols,
.visual-library-channel-grid,
.ai-library-modal-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.visual-library-header {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.visual-library-header .eyebrow {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #111827;
}

.visual-library-header .title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: #5d6886;
}

#visual-library-note {
  margin-top: 4px;
  font-size: 14px;
  color: #6b7896;
}

.visual-library-actions .btn.small {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.visual-library-actions .btn.ghost.small {
  background: #f6f8fc;
  border-color: #d4dceb;
  color: #1d2844;
}

.visual-library-actions .btn.primary.small {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  border-color: transparent;
}

.visual-library-toolbar {
  padding: 16px;
  border: 1px solid #dfe5ef;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfcff 0%, #f7f9fd 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.visual-library-toolbar .input,
.ai-library-modal-toolbar .input {
  flex: 1;
  min-width: 200px;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  color: #202a44;
}

.visual-library-grid,
.ai-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.visual-library-card,
.ai-library-card {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
}

.visual-library-card-media,
.ai-library-card-media {
  height: 220px;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.85), rgba(241, 245, 249, 0.95));
}

.visual-library-card-media img,
.ai-library-card-media img,
.visual-library-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visual-library-card-fallback,
.ai-library-card-fallback,
.visual-library-preview-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 13px;
}

.visual-library-card-body,
.ai-library-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.visual-library-card-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.visual-library-card-top strong {
  color: #18213a;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.visual-library-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.visual-library-card-actions .btn.small {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
}

.visual-library-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.visual-library-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-size: 12px;
}

.visual-library-badge {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.visual-library-badge.is-active {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.visual-library-badge.is-inactive {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.visual-library-card-text,
.ai-library-card-text,
.ai-suggestion-asset-reason {
  color: #475569;
  font-size: 14px;
  line-height: 1.45;
}

.visual-library-card-meta {
  color: #64748b;
  font-size: 13px;
}

.visual-library-modal-panel,
.ai-library-modal-panel {
  width: min(1080px, 92vw);
  padding: 24px;
  border-radius: 28px;
}

.visual-library-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.visual-library-preview-shell {
  height: 260px;
  overflow: hidden;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.9);
}

.visual-library-textarea {
  min-height: 100px;
  padding: 12px;
}

.visual-library-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-suggestion-asset {
  margin-top: 12px;
}

.ai-suggestion-asset-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(248, 250, 252, 0.92);
}

.ai-suggestion-asset-thumb {
  overflow: hidden;
  border-radius: 12px;
  background: rgba(226, 232, 240, 0.9);
  min-height: 82px;
}

.ai-suggestion-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-suggestion-asset-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (min-width: 1700px) {
  .visual-library-shell {
    width: min(100% - 32px, 1720px);
    padding: 30px 34px 38px !important;
  }

  .visual-library-grid,
  .ai-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
  }

  .visual-library-card-media,
  .ai-library-card-media {
    height: 232px;
  }
}

@media (max-width: 768px) {
  .visual-library-shell {
    width: auto;
    margin: 12px auto !important;
    padding: 18px 16px 20px !important;
  }

  .visual-library-toolbar,
  .visual-library-header,
  .visual-library-upload-row,
  .visual-library-two-cols,
  .ai-library-modal-toolbar {
    flex-direction: column;
  }

  .visual-library-grid,
  .ai-library-grid {
    grid-template-columns: 1fr;
  }

  .ai-suggestion-asset-card {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1200px) {
  .visual-library-shell {
    padding: 24px 26px 28px !important;
  }

  .visual-library-header {
    margin-bottom: 14px;
  }

  .visual-library-header .eyebrow {
    font-size: 16px;
  }

  .visual-library-header .title {
    font-size: 18px;
  }

  #visual-library-note {
    font-size: 13px;
  }

  .visual-library-actions .btn.small {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
  }

  .visual-library-toolbar {
    padding: 12px;
    border-radius: 18px;
  }

  .visual-library-toolbar .input,
  .ai-library-modal-toolbar .input {
    min-width: 180px;
    min-height: 42px;
    font-size: 14px;
  }

  .visual-library-grid,
  .ai-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
  }

  .visual-library-card,
  .ai-library-card {
    border-radius: 18px;
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
  }

  .visual-library-card-media,
  .ai-library-card-media {
    height: 192px;
  }

  .visual-library-card-body,
  .ai-library-card-body {
    gap: 8px;
    padding: 14px;
  }

  .visual-library-card-top strong {
    font-size: 15px;
  }

  .visual-library-card-actions .btn.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .visual-library-chip {
    padding: 4px 8px;
    font-size: 11px;
  }

  .visual-library-badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .visual-library-card-text,
  .ai-library-card-text,
  .ai-suggestion-asset-reason {
    font-size: 13px;
  }

  .visual-library-card-meta {
    font-size: 12px;
  }

  .visual-library-modal-panel,
  .ai-library-modal-panel {
    width: min(980px, 92vw);
    padding: 20px;
  }

  .visual-library-form {
    gap: 12px;
    margin-top: 12px;
  }

  .visual-library-preview-shell {
    height: 220px;
  }

  .visual-library-textarea {
    min-height: 88px;
    padding: 10px;
  }
}

/* ========= Web Module ========= */
.web-page {
  width: 100%;
}

.web-shell {
  width: min(100% - 28px, 1380px);
  margin: 16px auto !important;
  padding: 28px !important;
  border-radius: 34px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.1);
  position: relative;
}

.web-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.03));
}

.web-hero-copy {
  max-width: 780px;
}

.web-hero-title {
  margin: 4px 0 10px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.web-hero-subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--color-muted-strong);
  font-size: 15px;
  line-height: 1.55;
}

.web-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 10px;
  max-width: 340px;
}

.web-chip,
.web-mini-pill,
.web-tag,
.web-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.web-chip {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--color-muted-strong);
}

.web-tab-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.web-tab-row .btn.small {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
}

.web-tab-row .btn.active {
  background: linear-gradient(135deg, #4f96ff 0%, #2c6bf6 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.web-panel {
  margin-top: 18px;
}

.web-summary-grid,
.web-two-column-grid,
.web-info-grid,
.web-loading-grid,
.web-form-grid,
.web-switch-grid,
.web-tag-grid,
.web-orders-stats-grid,
.web-orders-filters-grid {
  display: grid;
  gap: 18px;
}

.web-summary-grid,
.web-two-column-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.web-info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

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

.web-orders-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.web-orders-filters-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 14px;
}

.web-switch-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.web-tag-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, max-content));
  margin-top: 12px;
}

.web-summary-card,
.web-section-card,
.web-info-card,
.web-switch-card,
.web-orders-stat-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}

.web-summary-card,
.web-section-card {
  padding: 22px;
}

.web-summary-card-head,
.web-section-head,
.web-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.web-summary-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(14, 165, 233, 0.12));
  color: #1d4ed8;
  font-weight: 800;
  margin-bottom: 16px;
}

.web-summary-icon.alt {
  color: #0f766e;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(45, 212, 191, 0.1));
}

.web-summary-title,
.web-section-title,
.web-card-title-row h3 {
  margin: 0;
}

.web-summary-text {
  margin: 14px 0 0;
  color: var(--color-muted-strong);
  line-height: 1.55;
}

.web-benefits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.web-benefit-item,
.web-microcopy {
  color: var(--color-muted-strong);
  font-size: 13px;
  line-height: 1.5;
}

.web-benefit-item::before {
  content: "•";
  display: inline-block;
  margin-right: 8px;
  color: var(--color-primary);
  font-weight: 700;
}

.web-summary-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.web-summary-meta strong,
.web-info-card strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: var(--color-text);
}

.web-summary-label,
.web-info-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.web-summary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.web-section-head {
  padding-bottom: 2px;
}

.web-info-card {
  padding: 16px 18px;
}

.web-orders-stat-card {
  padding: 16px 18px;
}

.web-orders-stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: var(--color-text);
}

.web-status-pill {
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(148, 163, 184, 0.12);
  color: var(--color-muted-strong);
  white-space: nowrap;
}

.web-status-pill.is-connected {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.18);
  color: #15803d;
}

.web-status-pill.is-pending {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.18);
  color: #b45309;
}

.web-status-pill.is-idle {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--color-muted-strong);
}

.web-mini-pill {
  padding: 7px 11px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-primary);
}

.web-token-box {
  margin-top: 14px;
}

.web-microcopy {
  margin: 12px 0 0;
}

.web-token-input,
.web-textarea,
.web-field .input {
  width: 100%;
}

.web-token-input {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid #d4dceb;
  background: #f9fbff;
  color: #1f2a44;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  font-family: var(--font-mono);
  font-size: 13px;
}

.web-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.web-field > span {
  font-size: 14px;
  font-weight: 600;
  color: #5c6885;
}

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

.web-textarea {
  min-height: 116px;
  resize: vertical;
  padding: 12px;
}

.web-switch-card {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
}

.web-switch-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-primary);
}

.web-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.web-switch-copy strong {
  font-size: 14px;
}

.web-switch-copy small {
  color: var(--color-muted);
  line-height: 1.45;
}

.web-tag {
  padding: 9px 13px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.web-inline-empty {
  min-height: 180px;
  margin-top: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.7);
}

.web-orders-table-wrap,
.web-orders-items-wrap {
  margin-top: 14px;
  max-height: none;
  border: 1px solid #e4e9f1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.web-orders-table thead th,
.web-orders-items-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 250, 252, 0.96);
}

.web-orders-table tbody tr:hover td,
.web-orders-items-table tbody tr:hover td {
  background: rgba(37, 99, 235, 0.03);
}

.web-orders-cell-main {
  font-weight: 600;
  color: var(--color-text);
}

.web-orders-cell-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.web-inline-status {
  min-width: 112px;
}

.web-orders-loading {
  margin-top: 16px;
}

.web-orders-skeleton-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.web-orders-skeleton-row {
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(90deg, var(--color-skeleton) 25%, var(--color-skeleton-shine) 50%, var(--color-skeleton) 75%);
  background-size: 240% 100%;
  animation: shimmer 1.35s infinite;
}

.web-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.web-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(2px);
}

.web-detail-panel {
  position: relative;
  width: min(820px, 96vw);
  height: 100%;
  max-height: 100vh;
  border-radius: 0;
  border-left: 1px solid rgba(148, 163, 184, 0.24);
  overflow: auto;
  padding: 22px 22px 28px;
}

.web-detail-header,
.web-detail-grid {
  display: grid;
  gap: 16px;
}

.web-detail-header {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.web-detail-title {
  margin-top: 4px;
  font-size: 22px;
}

.web-detail-subtitle {
  margin: 8px 0 0;
}

.web-detail-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
}

.web-detail-section {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px;
}

.web-detail-section h3 {
  margin: 0 0 14px;
}

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

.web-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.web-detail-grid strong {
  color: var(--color-text);
}

.web-detail-grid-full {
  grid-column: 1 / -1;
}

.web-technical-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.web-technical-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
}

.web-detail-grid-technical {
  margin-top: 14px;
}

.web-raw-payload-shell {
  margin-top: 16px;
}

.web-raw-payload {
  margin: 8px 0 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.92);
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  max-height: 260px;
}

.web-steps-list {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--color-muted-strong);
  line-height: 1.75;
}

.web-loading-state,
.web-error-state {
  padding: 8px 0;
}

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

.web-loading-card {
  min-height: 180px;
  border-radius: 24px;
  background: linear-gradient(90deg, var(--color-skeleton) 25%, var(--color-skeleton-shine) 50%, var(--color-skeleton) 75%);
  background-size: 240% 100%;
  animation: shimmer 1.35s infinite;
}

.web-loading-card.wide {
  grid-column: 1 / -1;
  min-height: 260px;
}

.web-error-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 0;
}

html[data-theme="dark"] .web-shell {
  background:
    radial-gradient(circle at top right, rgba(91, 140, 255, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(18, 26, 36, 0.98), rgba(12, 18, 28, 0.98));
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .web-hero,
html[data-theme="dark"] .web-summary-card,
html[data-theme="dark"] .web-section-card,
html[data-theme="dark"] .web-info-card,
html[data-theme="dark"] .web-switch-card,
html[data-theme="dark"] .web-orders-stat-card,
html[data-theme="dark"] .web-detail-section {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .web-token-input {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .web-field > span {
  color: #cbd5e1;
}

html[data-theme="dark"] .web-tag {
  background: rgba(91, 140, 255, 0.14);
  color: #bfdbfe;
}

html[data-theme="dark"] .web-chip {
  background: rgba(15, 23, 42, 0.78);
  color: #cbd5e1;
}

html[data-theme="dark"] .web-inline-empty {
  background: rgba(15, 23, 42, 0.72);
}

html[data-theme="dark"] .web-orders-table-wrap,
html[data-theme="dark"] .web-orders-items-wrap,
html[data-theme="dark"] .web-raw-payload {
  background: rgba(10, 15, 28, 0.45);
  border-color: rgba(100, 116, 139, 0.24);
}

html[data-theme="dark"] .web-orders-table thead th,
html[data-theme="dark"] .web-orders-items-table thead th {
  background: rgba(30, 41, 59, 0.72);
}

html[data-theme="dark"] .web-orders-table thead th,
html[data-theme="dark"] .web-orders-table tbody td,
html[data-theme="dark"] .web-orders-items-table thead th,
html[data-theme="dark"] .web-orders-items-table tbody td {
  border-bottom-color: rgba(71, 85, 105, 0.55);
}

html[data-theme="dark"] .web-orders-table tbody tr:hover td,
html[data-theme="dark"] .web-orders-items-table tbody tr:hover td {
  background: rgba(30, 41, 59, 0.46);
}

html[data-theme="dark"] .web-detail-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(12, 18, 28, 0.98));
  border-left-color: rgba(148, 163, 184, 0.18);
}

@media (max-width: 900px) {
  .web-shell {
    width: auto;
    margin: 12px !important;
    padding: 18px !important;
    border-radius: 22px;
  }

  .web-hero,
  .web-summary-grid,
  .web-two-column-grid,
  .web-info-grid,
  .web-loading-grid,
  .web-form-grid,
  .web-switch-grid,
  .web-summary-meta,
  .web-orders-stats-grid,
  .web-orders-filters-grid,
  .web-detail-grid,
  .web-detail-header {
    grid-template-columns: 1fr;
  }

  .web-hero {
    padding: 18px;
    flex-direction: column;
  }

  .web-hero-meta {
    justify-content: flex-start;
    max-width: none;
  }

  .web-summary-card,
  .web-section-card {
    padding: 18px;
    border-radius: 20px;
  }

  .web-tab-row .btn.small,
  .web-summary-actions .btn,
  .web-section-card .settings-action-row .btn {
    width: 100%;
  }

  .web-loading-card.wide {
    grid-column: auto;
  }

  .web-detail-panel {
    width: 100%;
    padding: 18px 16px 22px;
  }

  .web-orders-table-wrap,
  .web-orders-items-wrap {
    overflow-x: auto;
  }
}

/* ========= Premium SaaS Visual Refresh: Final Cascade ========= */
html[data-theme="dark"] {
  --color-bg: #09111b;
  --color-surface: #101a28;
  --color-surface-alt: #162233;
  --color-text: #e7edf5;
  --color-muted: #91a0b5;
  --color-muted-strong: #b7c3d4;
  --color-border: rgba(148, 163, 184, 0.16);
  --bg: #09111b;
  --panel: #101a28;
  --card: #101a28;
  --text: #e7edf5;
  --muted: #91a0b5;
  --border: rgba(148, 163, 184, 0.16);
  --input: #162233;
  --bubble-in: #111d2c;
  --bubble-out: #103626;
  --sidebar-bg: #0a121e;
  --sidebar-text: #dbe5f1;
  --sidebar-hover: rgba(148, 163, 184, 0.08);
  --topbar-bg: rgba(9, 17, 27, 0.82);
  --topbar-border: rgba(148, 163, 184, 0.12);
  --topbar-text: #e7edf5;
  --topbar-title: #b5c1d2;
}

html[data-theme="dark"] body.layout-shell {
  background:
    radial-gradient(1100px 620px at 0% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(900px 540px at 100% 100%, rgba(16, 185, 129, 0.05), transparent 48%),
    #09111b;
}

html[data-theme="dark"] .panel {
  background: linear-gradient(180deg, rgba(16, 26, 40, 0.96), rgba(12, 21, 34, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.22);
}

.sidebar-nav {
  padding: 14px 12px 12px;
  gap: 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  position: relative;
}

.brand {
  min-height: 40px;
  justify-content: space-between;
}

.sidebar-collapse-btn {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: auto;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.16);
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-collapse-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-links {
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
}

 .sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.nav-item {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-item:hover,
.nav-group-toggle:hover {
  background: rgba(148, 163, 184, 0.08);
}

.nav-item.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.96), rgba(29, 78, 216, 0.96));
  border-color: rgba(96, 165, 250, 0.38);
  box-shadow: 0 10px 24px rgba(30, 64, 175, 0.28);
}

.sidebar-theme-switch {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: none;
}

.theme-toggle-option {
  min-height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.topbar {
  min-height: 56px;
  padding: 0 18px;
  backdrop-filter: blur(18px) saturate(1.1);
}

.topbar-left .title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.profile-trigger {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 8px 0 0;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(148, 163, 184, 0.2);
}

@media (min-width: 1024px) {
  body[data-sidebar-collapsed="true"] .layout {
    grid-template-columns: 84px 1fr;
  }

  body[data-sidebar-collapsed="true"] .sidebar-nav {
    padding-inline: 10px;
  }

  body[data-sidebar-collapsed="true"] .brand {
    justify-content: center;
  }

  body[data-sidebar-collapsed="true"] .brand-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
  }

  body[data-sidebar-collapsed="true"] .sidebar-collapse-btn {
    position: static;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    margin-inline: auto;
    background: rgba(255, 255, 255, 0.08);
  }

  body[data-sidebar-collapsed="true"] .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  body[data-sidebar-collapsed="true"] .nav-item {
    justify-content: center;
    padding-inline: 10px;
  }

  body[data-sidebar-collapsed="true"] .nav-item-label,
  body[data-sidebar-collapsed="true"] .theme-toggle-option span,
  body[data-sidebar-collapsed="true"] .nav-group-toggle,
  body[data-sidebar-collapsed="true"] .nav-submenu {
    display: none !important;
  }

  body[data-sidebar-collapsed="true"] .sidebar-theme-switch {
    grid-template-columns: 1fr;
    padding: 3px;
  }

  body[data-sidebar-collapsed="true"] .sidebar-footer {
    justify-content: center;
    border-top-color: transparent;
    padding-top: 14px;
  }
}

@media (max-width: 1023px) {
  .sidebar-collapse-btn {
    display: none;
  }
}

body.page-chat #app-view,
body.page-chat .app-view-panel,
body.page-chat .page-shell[data-page="chat"] {
  height: 100%;
}

@media (min-width: 1024px) {
  .page-shell[data-page="chat"] .app-shell {
    padding: 10px;
    gap: 8px;
    grid-template-columns: 408px minmax(0, 1fr);
    background: transparent;
  }
}

.page-shell[data-page="chat"] .panel.sidebar,
.page-shell[data-page="chat"] .chat-area {
  border-radius: 20px;
  overflow: hidden;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .panel.sidebar {
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(11, 18, 29, 0.98));
}

.sidebar-top {
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(13, 21, 33, 0.88));
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

.sidebar-search {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
}

.filter-tag,
.filter-add-btn {
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #91a0b5;
  font-size: 11.5px;
  font-weight: 700;
}

.filter-tag.active {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.26);
  color: #dbeafe;
}

.contact-list {
  padding: 10px 8px 12px;
}

.contact {
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-left: 0;
  border-bottom: 0;
  border-radius: 16px;
  background: transparent;
}

.contact:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.12);
}

.contact.active {
  background: linear-gradient(180deg, rgba(18, 31, 48, 0.98), rgba(15, 25, 39, 0.98));
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 8px 24px rgba(2, 6, 23, 0.14);
}

.contact-avatar {
  width: 40px;
  height: 40px;
}

.contact-info {
  gap: 4px;
}

.contact-name {
  font-size: 13px;
  font-weight: 700;
}

.contact-time {
  color: #91a0b5;
  font-size: 11px;
  font-weight: 600;
}

.contact-phone {
  font-size: 11px;
  color: #6f8097;
}

.contact-last-msg {
  font-size: 12px;
  color: #91a0b5;
}

.status-badge,
.assigned-badge,
.channel-badge {
  min-height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-area {
  background-color: #0d1623 !important;
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.22);
}

html[data-theme="dark"] .page-shell[data-page="chat"] .chat-area {
  background-color: #0d1623 !important;
}

.chat-header {
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.84), rgba(13, 21, 33, 0.7));
  backdrop-filter: blur(18px) saturate(1.08);
}

.chat-header .icon-btn,
.chat-input .icon-btn,
.info-header .icon-btn,
.info-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #b7c3d4;
}

.chat-header .icon-btn:hover,
.chat-input .icon-btn:hover,
.info-header .icon-btn:hover,
.info-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e7edf5;
}

.ai-controls {
  gap: 8px;
  padding: 5px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.chat-header .ai-select {
  min-width: 156px;
  border-radius: 12px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.035);
  color: #e7edf5;
  font-size: 12px;
  font-weight: 600;
}

.chat-header .ai-auto-toggle {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  font-size: 11.5px;
  font-weight: 700;
}

.ai-active-badge {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-messages {
  padding: 18px 20px 12px;
}

.bubble {
  max-width: min(70%, 720px);
  padding: 8px 11px 18px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.42;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.12);
}

html[data-theme="dark"] .bubble {
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.12);
}

.message.out .bubble[data-channel="wa"],
html[data-theme="dark"] .message.out .bubble[data-channel="wa"] {
  background: rgba(16, 54, 38, 0.98);
  border-color: rgba(74, 222, 128, 0.16);
}

.message.in .bubble[data-channel="wa"],
html[data-theme="dark"] .message.in .bubble[data-channel="wa"] {
  background: rgba(17, 29, 44, 0.96);
  border-color: rgba(148, 163, 184, 0.16);
}

.meta {
  font-size: 10.5px;
}

.page-shell[data-page="chat"] .chat-input {
  margin: 10px 12px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14, 22, 35, 0.92), rgba(12, 20, 31, 0.92));
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.18);
  backdrop-filter: blur(18px) saturate(1.06);
}

.page-shell[data-page="chat"] .chat-input .input-field {
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 16px;
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.page-shell[data-page="chat"] .chat-input .input-field:focus-within {
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.16), 0 0 0 4px rgba(16, 185, 129, 0.08);
}

#send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.info-panel {
  background: linear-gradient(180deg, rgba(13, 21, 33, 0.98), rgba(9, 17, 27, 0.98));
  border-left: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: -24px 0 48px rgba(2, 6, 23, 0.36);
}

.info-header {
  padding: 16px 18px 12px;
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

.tab-pill {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #91a0b5;
  font-size: 12px;
  font-weight: 700;
}

.tab-pill.active {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(96, 165, 250, 0.26);
  color: #dbeafe;
}

@media (max-width: 768px) {
  .topbar {
    min-height: 52px;
    padding: 0 12px;
  }

  body.page-chat .main-area main {
    padding: 6px;
  }

  .page-shell[data-page="chat"] .panel.sidebar,
  .page-shell[data-page="chat"] .chat-area {
    border-radius: 0;
    box-shadow: none;
  }

  .page-shell[data-page="chat"] .app-shell {
    padding: 0;
  }

  .page-shell[data-page="chat"] .sidebar-top {
    padding-left: 10px;
    padding-right: 10px;
  }

  .page-shell[data-page="chat"] .contact-list {
    padding: 0;
  }

  .contact {
    margin: 0 0 2px;
    border-radius: 10px;
  }

  .chat-header {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 0;
  }

  .page-shell[data-page="chat"] .chat-input {
    margin: 0 8px 8px;
    padding: 8px 10px;
    border-radius: 18px;
  }

  .bubble {
    max-width: min(84%, 340px);
    font-size: 12.5px;
  }

  .chat-messages {
    padding: 14px 12px 10px;
  }
}

/* ========= Light Mode Premium Refinement ========= */
html[data-theme="light"] {
  --color-primary: #2563eb;
  --color-primary-strong: #1d4ed8;
  --color-primary-soft: rgba(37, 99, 235, 0.12);
  --color-bg: #edf2f7;
  --color-surface: #fbfcfe;
  --color-surface-alt: #f4f7fb;
  --color-border: #dbe4ef;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-muted-strong: #334155;
  --bg: #edf2f7;
  --panel: #fbfcfe;
  --card: #fbfcfe;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe4ef;
  --input: #f6f8fb;
  --bubble-in: #ffffff;
  --bubble-out: #e8f3ea;
  --sidebar-bg: #f7f9fc;
  --sidebar-text: #1e293b;
  --sidebar-hover: rgba(15, 23, 42, 0.045);
  --topbar-bg: rgba(251, 252, 254, 0.9);
  --topbar-border: rgba(148, 163, 184, 0.18);
  --topbar-text: #0f172a;
  --topbar-title: #475569;
}

html[data-theme="light"] body.layout-shell {
  background:
    linear-gradient(180deg, #f2f5f9 0%, #e9eef5 100%);
  color: #0f172a;
}

html[data-theme="light"] .main-area,
html[data-theme="light"] .main-area main {
  background: transparent;
}

html[data-theme="light"] .panel {
  background: linear-gradient(180deg, rgba(251, 252, 254, 0.98), rgba(246, 249, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow:
    0 14px 34px rgba(15, 23, 42, 0.06),
    0 2px 6px rgba(15, 23, 42, 0.03);
}

html[data-theme="light"] .sidebar-nav {
  background: linear-gradient(180deg, rgba(247, 249, 252, 0.98), rgba(242, 246, 250, 0.98));
  color: #1e293b;
  border-right-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .brand {
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  padding-bottom: 12px;
}

html[data-theme="light"] .brand-logo--dark {
  display: none;
}

html[data-theme="light"] .brand-logo--light {
  display: block;
}

html[data-theme="light"] .brand-logo--compact {
  display: none;
}

html[data-theme="light"] .sidebar-collapse-btn {
  background: #dbeafe;
  color: #2563eb;
  border-color: rgba(147, 197, 253, 0.78);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

html[data-theme="light"] .sidebar-collapse-btn:hover {
  background: #bfdbfe;
  color: #1d4ed8;
}

@media (min-width: 1024px) {
  body[data-sidebar-collapsed="true"] .brand-logo--dark,
  body[data-sidebar-collapsed="true"] .brand-logo--light {
    display: none !important;
  }

  body[data-sidebar-collapsed="true"] .brand-logo--compact {
    display: block !important;
    width: 30px;
    height: 30px;
    object-fit: contain;
  }
}

html[data-theme="light"] .nav-item {
  color: #334155;
}

html[data-theme="light"] .nav-item:hover,
html[data-theme="light"] .nav-group-toggle:hover {
  background: rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .nav-item.active {
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

html[data-theme="light"] .nav-item.active:hover,
html[data-theme="light"] .nav-item.active:focus-visible {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.96), rgba(29, 78, 216, 0.96));
  border-color: rgba(96, 165, 250, 0.38);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

html[data-theme="light"] .nav-item.is-parent-active {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border-color: rgba(96, 165, 250, 0.18);
}

html[data-theme="light"] .sidebar-account-title,
html[data-theme="light"] .sidebar-account-meta {
  color: #64748b;
}

html[data-theme="light"] .sidebar-account-link:hover,
html[data-theme="light"] .sidebar-account-logout:hover {
  background: rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .sidebar-account-user {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .sidebar-account-avatar {
  background: linear-gradient(180deg, #f7e6cf 0%, #efd7b6 100%);
  color: #5b4636;
}

@media (min-width: 921px) {
  .topbar {
    display: none;
  }

  .main-area main {
    padding-top: 0;
  }
}

html[data-theme="light"] .nav-group-toggle {
  color: #64748b;
}

html[data-theme="light"] .nav-subitem {
  color: #64748b;
}

html[data-theme="light"] .sidebar-theme-switch {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .theme-toggle-option {
  color: #64748b;
}

html[data-theme="light"] .theme-toggle-option:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

html[data-theme="light"] .theme-toggle-option.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .topbar {
  background: rgba(251, 252, 254, 0.88);
  border-bottom-color: rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(16px) saturate(1.05);
}

html[data-theme="light"] .profile-trigger {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .profile-trigger:hover,
html[data-theme="light"] .profile-trigger[aria-expanded="true"] {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.24);
}

html[data-theme="light"] .profile-menu {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow:
    0 22px 46px rgba(15, 23, 42, 0.14),
    0 2px 8px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .profile-menu-avatar {
  background: linear-gradient(180deg, #f7e6cf 0%, #efd7b6 100%);
  color: #5b4636;
}

html[data-theme="light"] .profile-menu-account {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .profile-menu-email {
  color: #64748b;
}

html[data-theme="light"] .profile-menu-role-line,
html[data-theme="light"] .profile-menu-section-label {
  color: #64748b;
}

html[data-theme="light"] .profile-menu-action-icon {
  color: #475569;
}

html[data-theme="light"] .profile-menu-divider {
  background: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .profile-menu-action:hover {
  background: #f8fafc;
}

html[data-theme="dark"] .profile-menu-avatar {
  background: linear-gradient(180deg, #2a3445 0%, #1f2937 100%);
  color: #f8e4ca;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 20px rgba(2, 6, 23, 0.22);
}

html[data-theme="dark"] .profile-menu-email {
  color: #94a3b8;
}

html[data-theme="dark"] .profile-menu-account {
  background: rgba(30, 41, 59, 0.72);
  border-color: rgba(71, 85, 105, 0.42);
}

html[data-theme="dark"] .profile-menu-role-line,
html[data-theme="dark"] .profile-menu-section-label,
html[data-theme="dark"] .profile-menu-check {
  color: #cbd5e1;
}

html[data-theme="dark"] .profile-menu-action-icon {
  color: #cbd5e1;
}

html[data-theme="dark"] .profile-menu-divider {
  background: rgba(71, 85, 105, 0.46);
}

html[data-theme="dark"] .profile-menu-action:hover {
  background: rgba(51, 65, 85, 0.5);
}

.profile-trigger {
  width: auto;
  min-width: 228px;
  height: 56px;
  padding: 8px 12px 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.profile-trigger-identity {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
}

.profile-trigger-name,
.profile-trigger-email {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-trigger-name {
  font-size: 15px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--color-text);
}

.profile-trigger-email {
  font-size: 12px;
  line-height: 1.2;
  color: var(--color-muted-strong);
}

.profile-trigger .profile-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 999px;
  font-size: 18px;
}

.profile-trigger .profile-trigger-icon {
  flex: 0 0 auto;
  margin-left: 2px;
}

html[data-theme="light"] .profile-trigger {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .profile-trigger:hover,
html[data-theme="light"] .profile-trigger[aria-expanded="true"] {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.18);
}

html[data-theme="dark"] .profile-trigger {
  background: #111b2a;
  border-color: rgba(71, 85, 105, 0.42);
}

html[data-theme="dark"] .profile-trigger-name {
  color: #f8fafc;
}

html[data-theme="dark"] .profile-trigger-email {
  color: #94a3b8;
}

@media (max-width: 920px) {
  .profile-trigger {
    min-width: 0;
    width: 56px;
    padding-right: 10px;
  }

  .profile-trigger-identity {
    display: none;
  }
}

html[data-theme="light"] .page-shell[data-page="chat"] .panel.sidebar {
  background: linear-gradient(180deg, rgba(248, 250, 253, 0.98), rgba(244, 247, 251, 0.98));
}

html[data-theme="light"] .sidebar-top {
  background: linear-gradient(180deg, rgba(248, 250, 253, 0.98), rgba(248, 250, 253, 0.88));
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="light"] .sidebar-search {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: #64748b;
}

html[data-theme="light"] .sidebar-search svg,
html[data-theme="light"] .sidebar-search input::placeholder {
  color: #7b8ca3;
}

html[data-theme="light"] .filter-tag,
html[data-theme="light"] .filter-add-btn {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
  color: #64748b;
}

html[data-theme="light"] .filter-tag:hover,
html[data-theme="light"] .filter-add-btn:hover {
  background: #ffffff;
  color: #0f172a;
}

html[data-theme="light"] .filter-tag.active {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-color: rgba(96, 165, 250, 0.22);
}

html[data-theme="light"] .contact-list {
  background: transparent;
  padding: 0;
}

html[data-theme="light"] .contact-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
}

html[data-theme="light"] .contact {
  background: rgba(255, 255, 255, 0.34);
  border-color: transparent;
  margin-left: 0;
  margin-right: 0;
  box-shadow: none;
}

html[data-theme="light"] .contact:hover {
  background: rgba(240, 244, 249, 0.82);
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="light"] .contact.active {
  background: rgba(232, 238, 245, 0.96);
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="light"] .contact-name {
  color: #0f172a;
}

html[data-theme="light"] .contact-time {
  color: #64748b;
}

html[data-theme="light"] .contact-phone,
html[data-theme="light"] .contact-last-msg {
  color: #617387;
}

html[data-theme="light"] .status-badge,
html[data-theme="light"] .assigned-badge,
html[data-theme="light"] .channel-badge {
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(244, 247, 251, 0.92);
  color: #334155;
}

html[data-theme="light"] .status-badge.status-new {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

html[data-theme="light"] .status-badge.status-in_conversation {
  background: #cffafe;
  color: #0f766e;
  border-color: #67e8f9;
}

html[data-theme="light"] .status-badge.status-quoted {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

html[data-theme="light"] .status-badge.status-won {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

html[data-theme="light"] .status-badge.status-lost {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

html[data-theme="dark"] .status-badge.status-new {
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.34);
}

html[data-theme="dark"] .status-badge.status-in_conversation {
  background: rgba(8, 145, 178, 0.18);
  color: #a5f3fc;
  border-color: rgba(34, 211, 238, 0.32);
}

html[data-theme="dark"] .status-badge.status-quoted {
  background: rgba(146, 64, 14, 0.2);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.3);
}

html[data-theme="dark"] .status-badge.status-won {
  background: rgba(21, 128, 61, 0.2);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.28);
}

html[data-theme="dark"] .status-badge.status-lost {
  background: rgba(185, 28, 28, 0.2);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.3);
}

html[data-theme="light"] .unread-badge {
  box-shadow: 0 8px 14px rgba(34, 197, 94, 0.16);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-area,
html[data-theme="light"] .chat-area {
  background:
    linear-gradient(180deg, #eef3f8 0%, #e8eef5 100%);
  background-image: none;
}

html[data-theme="light"] .chat-header {
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.92), rgba(247, 250, 252, 0.92));
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .contact-title {
  color: #0f172a;
}

html[data-theme="light"] .contact-subtitle-row,
html[data-theme="light"] .contact-assigned-pill,
html[data-theme="light"] .meta {
  color: #64748b;
}

html[data-theme="light"] .chat-header .icon-btn,
html[data-theme="light"] .chat-input .icon-btn,
html[data-theme="light"] .info-header .icon-btn,
html[data-theme="light"] .info-icon-btn {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.16);
  color: #475569;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #search-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #more-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #wa-call-btn {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 2px !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #search-btn:hover,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #more-btn:hover,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-actions > #wa-call-btn:hover {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-score-stars {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

html[data-theme="light"] .chat-header .icon-btn:hover,
html[data-theme="light"] .chat-input .icon-btn:hover,
html[data-theme="light"] .info-header .icon-btn:hover,
html[data-theme="light"] .info-icon-btn:hover {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.22);
  color: #0f172a;
}

html[data-theme="light"] .ai-controls {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="light"] .chat-header .ai-select,
html[data-theme="light"] .chat-header .ai-auto-toggle {
  background: rgba(255, 255, 255, 0.82);
  color: #334155;
}

html[data-theme="light"] .chat-messages {
  padding: 20px 22px 14px;
}

html[data-theme="light"] .bubble {
  box-shadow:
    0 10px 18px rgba(15, 23, 42, 0.04),
    0 1px 3px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .message.in .bubble[data-channel="wa"] {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .message.out .bubble[data-channel="wa"] {
  background: linear-gradient(180deg, rgba(233, 246, 236, 0.98), rgba(226, 242, 231, 0.98));
  border-color: rgba(34, 197, 94, 0.1);
}

html[data-theme="light"] .message.out .bubble {
  background: linear-gradient(180deg, rgba(233, 246, 236, 0.98), rgba(226, 242, 231, 0.98));
}

html[data-theme="light"] .message-reaction-trigger.message-reaction-trigger-outside {
  background: rgba(255, 255, 255, 0.96);
  color: rgba(51, 65, 85, 0.92);
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .message-reaction-trigger.message-reaction-trigger-outside:hover,
html[data-theme="light"] .message-layout:hover .message-reaction-trigger.message-reaction-trigger-outside,
html[data-theme="light"] .message-layout:focus-within .message-reaction-trigger.message-reaction-trigger-outside,
html[data-theme="light"] .message-reaction-trigger.message-reaction-trigger-outside:focus-visible {
  background: rgba(248, 250, 252, 0.98);
  color: rgba(15, 23, 42, 1);
  border-color: rgba(100, 116, 139, 0.4);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  box-shadow: none;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field:hover {
  border-color: rgba(96, 165, 250, 0.22);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field:focus-within {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.14),
    0 0 0 4px rgba(37, 99, 235, 0.07),
    0 10px 18px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input #message-input {
  color: #0f172a;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input #message-input::placeholder {
  color: #8a98ab;
}

html[data-theme="light"] #send-btn {
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #attach-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #emoji-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #ai-suggest {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #attach-btn:hover,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #emoji-btn:hover,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > #ai-suggest:hover {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input > #send-btn {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  border-radius: 999px !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input > #send-btn.send-btn-whatsapp {
  background: #25d366 !important;
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.24) !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input > #send-btn.send-btn-messenger {
  background: #38bdf8 !important;
  box-shadow: 0 10px 22px rgba(56, 189, 248, 0.24) !important;
}

html[data-theme="light"] .page-shell[data-page="chat"] .chat-input > #send-btn.send-btn-instagram {
  background: #ec4899 !important;
  box-shadow: 0 10px 22px rgba(236, 72, 153, 0.24) !important;
}

html[data-theme="light"] .attach-menu,
html[data-theme="light"] .emoji-picker,
html[data-theme="light"] .dropdown,
html[data-theme="light"] .filter-dropdown {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.98));
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] #more-menu.dropdown {
  background: #f8fbff;
  backdrop-filter: none;
  z-index: 120;
}

html[data-theme="light"] #more-menu .dropdown-item {
  background: transparent;
}

html[data-theme="light"] #more-menu .dropdown-item:hover {
  background: rgba(15, 23, 42, 0.05);
}

html[data-theme="dark"] #more-menu.dropdown {
  background: #111827;
  backdrop-filter: none;
  z-index: 120;
}

html[data-theme="dark"] #more-menu .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .whatsapp-template-banner {
  background: linear-gradient(180deg, rgba(255, 250, 235, 0.98), rgba(254, 245, 219, 0.96));
  border-color: rgba(245, 158, 11, 0.18);
}

html[data-theme="light"] .loader {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .info-panel {
  background: linear-gradient(180deg, rgba(251, 252, 254, 0.98), rgba(245, 248, 252, 0.98));
  border-left-color: rgba(148, 163, 184, 0.16);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .info-header,
html[data-theme="light"] .info-section-label {
  color: #334155;
}

html[data-theme="light"] .tab-pill {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.16);
  color: #64748b;
}

html[data-theme="light"] .tab-pill.active {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

html[data-theme="light"] .contact-card,
html[data-theme="light"] .profile-section,
html[data-theme="light"] .status-section,
html[data-theme="light"] .assign-section,
html[data-theme="light"] .contact-note-card,
html[data-theme="light"] .contact-tags-card {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .contact-note-textarea {
  background: rgba(248, 250, 252, 0.96);
  border-color: rgba(191, 219, 254, 0.9);
  color: #0f172a;
}

html[data-theme="light"] .contact-note-textarea::placeholder,
html[data-theme="light"] .contact-note-status,
html[data-theme="light"] .contact-note-copy {
  color: #64748b;
}

html[data-theme="light"] .contact-note-textarea:focus {
  background: #fff;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

@media (max-width: 768px) {
  html[data-theme="light"] body.layout-shell {
    background: #edf2f7;
  }

  html[data-theme="light"] .chat-messages {
    padding: 16px 12px 10px;
  }

  html[data-theme="light"] .contact {
    background: rgba(255, 255, 255, 0.34);
  }
}

.contact.conv-item .contact-info {
  gap: 8px;
}

/* ===== Chat Sidebar Header Refresh ===== */
.page-shell[data-page="chat"] .sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 14px;
}

.sidebar-top-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-top-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-top-title {
  font-size: 1.35rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-top-subtitle {
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(148, 163, 184, 0.9);
}

.page-shell[data-page="chat"] .sidebar-top #new-contact-btn {
  width: auto;
  min-width: 132px;
  height: 38px;
  margin: 0;
  padding: 0 14px;
  border-radius: 13px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.page-shell[data-page="chat"] .sidebar-search {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 14px 0 13px;
}

.page-shell[data-page="chat"] .sidebar-search input {
  font-size: 0.94rem;
}

.page-shell[data-page="chat"] .filter-tags-container {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.page-shell[data-page="chat"] .filter-label {
  margin: 0;
  font-size: 0.77rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.page-shell[data-page="chat"] .filter-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.page-shell[data-page="chat"] .filter-tags::-webkit-scrollbar {
  display: none;
}

.page-shell[data-page="chat"] .filter-tag {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.page-shell[data-page="chat"] .filter-add-btn {
  width: auto;
  min-width: auto;
  height: auto;
  padding: 0 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.page-shell[data-page="chat"] .filter-dropdown {
  margin-top: 10px;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-top {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(13, 19, 33, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(2, 6, 23, 0.24);
}

html[data-theme="dark"] .sidebar-top-title {
  color: #f8fafc;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-top #new-contact-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(148, 163, 184, 0.16);
  color: #e2e8f0;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-top #new-contact-btn:hover {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.26);
  color: #ffffff;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-search {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .page-shell[data-page="chat"] .filter-label {
  color: rgba(148, 163, 184, 0.84);
}

html[data-theme="dark"] .page-shell[data-page="chat"] .filter-tag,
html[data-theme="dark"] .page-shell[data-page="chat"] .filter-add-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .filter-tag:hover,
html[data-theme="dark"] .page-shell[data-page="chat"] .filter-add-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f8fafc;
}

html[data-theme="dark"] .page-shell[data-page="chat"] .filter-tag.active {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
  box-shadow: inset 0 -1px 0 rgba(34, 197, 94, 0.24);
}

html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-top {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 14px 28px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .sidebar-top-title {
  color: #0f172a;
}

html[data-theme="light"] .sidebar-top-subtitle {
  color: #64748b;
}

html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-top #new-contact-btn {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
  color: #0f172a;
}

html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-top #new-contact-btn:hover {
  background: #ffffff;
  border-color: rgba(96, 165, 250, 0.3);
  color: #0f172a;
}

html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-search {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="light"] .page-shell[data-page="chat"] .filter-label {
  color: #64748b;
}

html[data-theme="light"] .page-shell[data-page="chat"] .filter-tag,
html[data-theme="light"] .page-shell[data-page="chat"] .filter-add-btn {
  background: rgba(248, 250, 252, 0.96);
  border-color: rgba(148, 163, 184, 0.16);
  color: #475569;
}

html[data-theme="light"] .page-shell[data-page="chat"] .filter-tag:hover,
html[data-theme="light"] .page-shell[data-page="chat"] .filter-add-btn:hover {
  background: #ffffff;
  color: #0f172a;
}

html[data-theme="light"] .page-shell[data-page="chat"] .filter-tag.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(96, 165, 250, 0.26);
  color: #1d4ed8;
}

@media (max-width: 768px) {
  .sidebar-top-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-shell[data-page="chat"] .sidebar-top #new-contact-btn {
    width: 100%;
    min-width: 0;
  }

  .sidebar-top-subtitle {
    display: none;
  }
}

/* ===== Final Dark View Polish ===== */
html[data-theme="dark"] .team-panel,
html[data-theme="dark"] .settings-shell,
html[data-theme="dark"] .ai-profiles-shell,
html[data-theme="dark"] .view-shell > .panel,
html[data-theme="dark"] .ai-global-card,
html[data-theme="dark"] .gsheet-card {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(12, 18, 31, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 24px 48px rgba(2, 6, 23, 0.24);
}

html[data-theme="dark"] .team-summary-card,
html[data-theme="dark"] .team-config-card,
html[data-theme="dark"] .team-toggle-row,
html[data-theme="dark"] .integration-card,
html[data-theme="dark"] .whatsapp-templates-panel,
html[data-theme="dark"] .settings-channel-card,
html[data-theme="dark"] .settings-info-block,
html[data-theme="dark"] .wa-status-card,
html[data-theme="dark"] .ai-profiles-board,
html[data-theme="dark"] .ai-profile-card,
html[data-theme="dark"] .ai-global-sidecard,
html[data-theme="dark"] .gsheet-subcard,
html[data-theme="dark"] .visual-ai-profile-box {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    linear-gradient(180deg, rgba(22, 32, 51, 0.96), rgba(17, 24, 39, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 18px 32px rgba(2, 6, 23, 0.18);
}

html[data-theme="dark"] .team-summary-label,
html[data-theme="dark"] .settings-channel-eyebrow,
html[data-theme="dark"] .settings-inline-note,
html[data-theme="dark"] .settings-status-text,
html[data-theme="dark"] .settings-credentials-form .input-group label,
html[data-theme="dark"] .wa-status-phone,
html[data-theme="dark"] .ai-profiles-title,
html[data-theme="dark"] .ai-global-card-copy .muted,
html[data-theme="dark"] .ai-global-card-subtitle,
html[data-theme="dark"] .ai-global-label,
html[data-theme="dark"] .integration-sub,
html[data-theme="dark"] .integration-body,
html[data-theme="dark"] .whatsapp-templates-subtitle,
html[data-theme="dark"] .sidebar-top-subtitle {
  color: #94a3b8;
}

html[data-theme="dark"] .team-name,
html[data-theme="dark"] .settings-channel-title,
html[data-theme="dark"] .wa-status-label,
html[data-theme="dark"] .settings-info-title,
html[data-theme="dark"] .integration-title,
html[data-theme="dark"] .whatsapp-templates-title,
html[data-theme="dark"] .ai-profile-card-brand,
html[data-theme="dark"] .ai-profile-card-name,
html[data-theme="dark"] .ai-global-card-title,
html[data-theme="dark"] .gsheet-card-title,
html[data-theme="dark"] .gsheet-subcard-title,
html[data-theme="dark"] .title,
html[data-theme="dark"] .eyebrow {
  color: #e5edf8;
}

html[data-theme="dark"] .team-avatar,
html[data-theme="dark"] .integration-icon,
html[data-theme="dark"] .settings-channel-brand,
html[data-theme="dark"] .settings-status-icon,
html[data-theme="dark"] .wa-status-icon {
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.22);
}

html[data-theme="dark"] .settings-channel-eyebrow-line,
html[data-theme="dark"] .ai-global-divider,
html[data-theme="dark"] .ai-global-sidecard-divider,
html[data-theme="dark"] .ai-global-toggle + .ai-global-toggle {
  border-color: rgba(148, 163, 184, 0.14);
  background: linear-gradient(90deg, rgba(71, 85, 105, 0.72), rgba(71, 85, 105, 0.12));
}

html[data-theme="dark"] .settings-credentials-form .input-field,
html[data-theme="dark"] .settings-inline-select,
html[data-theme="dark"] .ai-global-input,
html[data-theme="dark"] #ai-modal .input,
html[data-theme="dark"] #ai-modal textarea {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .settings-credentials-form .input-field input,
html[data-theme="dark"] .settings-credentials-form .input-field select,
html[data-theme="dark"] .settings-inline-select,
html[data-theme="dark"] .ai-global-input,
html[data-theme="dark"] #ai-modal .input,
html[data-theme="dark"] #ai-modal textarea {
  color: #e2e8f0;
}

html[data-theme="dark"] .settings-credentials-form .input-field .icon-btn,
html[data-theme="dark"] .settings-channel-more,
html[data-theme="dark"] .settings-manage-btn,
html[data-theme="dark"] .team-gear-btn,
html[data-theme="dark"] .ai-profiles-actions .btn.ghost.small,
html[data-theme="dark"] .integration-actions .btn.ghost.small,
html[data-theme="dark"] .whatsapp-sync-templates-btn,
html[data-theme="dark"] .settings-action-row .btn.ghost,
html[data-theme="dark"] .gsheet-footer-actions .btn.ghost {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.92);
  color: #dbe6f5;
  box-shadow: none;
}

html[data-theme="dark"] .settings-credentials-form .input-field .icon-btn:hover,
html[data-theme="dark"] .settings-channel-more:hover,
html[data-theme="dark"] .settings-manage-btn:hover,
html[data-theme="dark"] .team-gear-btn:hover,
html[data-theme="dark"] .ai-profiles-actions .btn.ghost.small:hover,
html[data-theme="dark"] .integration-actions .btn.ghost.small:hover,
html[data-theme="dark"] .whatsapp-sync-templates-btn:hover,
html[data-theme="dark"] .settings-action-row .btn.ghost:hover,
html[data-theme="dark"] .gsheet-footer-actions .btn.ghost:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(96, 165, 250, 0.24);
  color: #f8fafc;
}

html[data-theme="dark"] .integration-icon.fb,
html[data-theme="dark"] .integration-icon.ig,
html[data-theme="dark"] .integration-icon.wa {
  background: transparent;
}

html[data-theme="dark"] .integration-state[data-status="connected"],
html[data-theme="dark"] .settings-status-badge,
html[data-theme="dark"] .ai-profile-badge,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .whatsapp-templates-template-status {
  box-shadow: none;
}

html[data-theme="dark"] .ai-global-status,
html[data-theme="dark"] #ai-global-active.status-pill.ai-global-status {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.96);
  color: #cbd5e1;
}

html[data-theme="dark"] .ai-global-status.online,
html[data-theme="dark"] #ai-global-active.status-pill.ai-global-status.online {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(20, 83, 45, 0.28);
  color: #86efac;
}

html[data-theme="dark"] .ai-global-toggle {
  color: #dbe6f5;
}

html[data-theme="dark"] .ai-global-toggle input {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(51, 65, 85, 0.92);
}

html[data-theme="dark"] .ai-global-toggle input::before {
  background: #f8fafc;
  box-shadow: 0 3px 8px rgba(2, 6, 23, 0.32);
}

html[data-theme="dark"] .ai-profile-card-logo.is-offline {
  background-color: #64748b;
}

html[data-theme="dark"] .team-status,
html[data-theme="dark"] .team-subtitle,
html[data-theme="dark"] #team-status,
html[data-theme="dark"] #integrations-status,
html[data-theme="dark"] #ai-status,
html[data-theme="dark"] .muted {
  color: #94a3b8;
}

html[data-theme="dark"] .integration-card:hover,
html[data-theme="dark"] .ai-profile-card:hover,
html[data-theme="dark"] .team-config-card:hover {
  box-shadow: none;
}

html[data-theme="dark"] .ai-profile-card-label {
  color: #94a3b8;
}

html[data-theme="dark"] .ai-profile-card-model {
  color: #e5edf8;
}

html[data-theme="dark"] .ai-profile-card-secondary-actions .btn,
html[data-theme="dark"] .ai-profile-card-actions .btn.primary.small,
html[data-theme="dark"] .ai-profile-card-actions .btn.ghost.small {
  color: #e5edf8;
}

html[data-theme="dark"] .ai-profile-card-secondary-actions .btn:disabled,
html[data-theme="dark"] .ai-profile-card-actions .btn:disabled {
  color: #cbd5e1;
  opacity: 0.92;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(51, 65, 85, 0.88);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .integration-details {
  color: #e5edf8;
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-templates-panel {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.08), transparent 46%),
    linear-gradient(180deg, rgba(18, 28, 45, 0.96) 0%, rgba(13, 21, 35, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 16px 30px rgba(2, 6, 23, 0.18);
  backdrop-filter: none;
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-templates-header {
  padding-bottom: 2px;
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-templates-status,
html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-templates-empty,
html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-meta,
html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-extra {
  color: #8ea0b8;
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-item {
  border-color: rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(180deg, rgba(26, 38, 58, 0.98) 0%, rgba(19, 29, 45, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 24px rgba(2, 6, 23, 0.14);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-item:hover {
  border-color: rgba(96, 165, 250, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 32px rgba(2, 6, 23, 0.18);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-name {
  color: #f8fbff;
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-badge.status-approved {
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.34);
  border-color: rgba(74, 222, 128, 0.22);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-badge.status-paused {
  color: #fde68a;
  background: rgba(120, 53, 15, 0.34);
  border-color: rgba(251, 191, 36, 0.18);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-badge.status-rejected {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.34);
  border-color: rgba(248, 113, 113, 0.18);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-badge.status-default {
  color: #dbe6f5;
  background: rgba(51, 65, 85, 0.7);
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-badge.quality {
  color: #bae6fd;
  background: rgba(8, 47, 73, 0.58);
  border-color: rgba(34, 211, 238, 0.2);
}

html[data-theme="dark"] .integration-card[data-provider="whatsapp"] .whatsapp-template-reason {
  color: #fecaca;
  background: rgba(69, 10, 10, 0.54);
  border-color: rgba(248, 113, 113, 0.18);
}

.app-view-panel[data-view="integrations"] .view-shell > .panel,
html[data-theme="dark"] .app-view-panel[data-view="integrations"] .view-shell > .panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .settings-page .settings-channel-card {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    linear-gradient(180deg, rgba(22, 32, 51, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 18px 32px rgba(2, 6, 23, 0.18);
}

html[data-theme="dark"] .settings-page .settings-channel-head {
  margin-bottom: 16px;
}

html[data-theme="dark"] .settings-page .settings-channel-brand {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 24px rgba(2, 6, 23, 0.24);
}

html[data-theme="dark"] .settings-page .settings-channel-more,
html[data-theme="dark"] .settings-page .settings-manage-btn,
html[data-theme="dark"] .settings-page .settings-action-row .btn.ghost {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.94);
  color: #dbe6f5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .settings-page .settings-channel-more:hover,
html[data-theme="dark"] .settings-page .settings-manage-btn:hover,
html[data-theme="dark"] .settings-page .settings-action-row .btn.ghost:hover {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(96, 165, 250, 0.24);
  color: #f8fafc;
}

html[data-theme="dark"] .settings-page .settings-action-row .btn.primary {
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}

html[data-theme="dark"] .settings-page .settings-danger-btn {
  border-color: rgba(248, 113, 113, 0.18) !important;
  color: #fecaca !important;
  background: rgba(127, 29, 29, 0.22) !important;
}

html[data-theme="dark"] .settings-page .settings-danger-btn:hover {
  border-color: rgba(248, 113, 113, 0.28) !important;
  background: rgba(127, 29, 29, 0.32) !important;
  color: #fee2e2 !important;
}

html[data-theme="dark"] .settings-page .wa-status-card {
  border-color: rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(180deg, rgba(20, 31, 49, 0.98) 0%, rgba(16, 24, 39, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 12px 22px rgba(2, 6, 23, 0.14);
}

html[data-theme="dark"] .settings-page .settings-channel-card-wa .wa-status-card.connected,
html[data-theme="dark"] .settings-page .settings-channel-card-ms .wa-status-card.connected,
html[data-theme="dark"] .settings-page .settings-channel-card-ig .wa-status-card.connected {
  border-color: rgba(74, 222, 128, 0.16);
  background:
    radial-gradient(circle at left center, rgba(34, 197, 94, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(17, 39, 31, 0.96) 0%, rgba(14, 27, 24, 0.98) 100%);
}

html[data-theme="dark"] .settings-page .settings-channel-card-wa .wa-status-card.disconnected,
html[data-theme="dark"] .settings-page .settings-channel-card-wa .wa-status-card.loading,
html[data-theme="dark"] .settings-page .settings-channel-card-ms .wa-status-card.disconnected,
html[data-theme="dark"] .settings-page .settings-channel-card-ms .wa-status-card.loading,
html[data-theme="dark"] .settings-page .settings-channel-card-ig .wa-status-card.disconnected,
html[data-theme="dark"] .settings-page .settings-channel-card-ig .wa-status-card.loading {
  border-color: rgba(96, 165, 250, 0.14);
  background:
    radial-gradient(circle at left center, rgba(59, 130, 246, 0.1), transparent 26%),
    linear-gradient(180deg, rgba(19, 30, 49, 0.97) 0%, rgba(15, 24, 39, 0.99) 100%);
}

html[data-theme="dark"] .settings-page .wa-status-card.error {
  border-color: rgba(248, 113, 113, 0.2);
  background:
    radial-gradient(circle at left center, rgba(248, 113, 113, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(54, 24, 29, 0.96) 0%, rgba(35, 18, 22, 0.99) 100%);
}

html[data-theme="dark"] .settings-page .settings-status-icon,
html[data-theme="dark"] .settings-page .wa-status-icon {
  color: #e6eef8;
  text-shadow: 0 4px 12px rgba(2, 6, 23, 0.28);
}

html[data-theme="dark"] .settings-page .settings-channel-card-wa .wa-status-icon {
  color: #86efac;
}

html[data-theme="dark"] .settings-page .settings-channel-card-ms .wa-status-icon {
  color: #93c5fd;
}

html[data-theme="dark"] .settings-page .settings-channel-card-ig .wa-status-icon {
  color: #f9a8d4;
}

html[data-theme="dark"] .settings-page .settings-status-badge {
  border: 1px solid rgba(74, 222, 128, 0.16);
  background: rgba(20, 83, 45, 0.28);
  color: #bbf7d0;
}

html[data-theme="dark"] .settings-page .wa-status-label {
  color: #f8fafc;
}

html[data-theme="dark"] .settings-page .wa-status-phone,
html[data-theme="dark"] .settings-page .settings-inline-note,
html[data-theme="dark"] .settings-page .settings-status-text,
html[data-theme="dark"] .settings-page .settings-credentials-form .input-group label {
  color: #94a3b8;
}

html[data-theme="dark"] .settings-page .settings-info-block {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    linear-gradient(180deg, rgba(18, 28, 45, 0.96) 0%, rgba(14, 21, 34, 0.98) 100%);
  color: #8ea0b8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] .settings-page #wa-diagnostics-card {
  text-align: center;
}

html[data-theme="dark"] .settings-page .settings-info-title {
  color: #e5edf8;
}

html[data-theme="dark"] .settings-page .settings-credentials-form .input-field,
html[data-theme="dark"] .settings-page .settings-inline-select {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    0 8px 18px rgba(2, 6, 23, 0.08);
}

html[data-theme="dark"] .settings-page .settings-credentials-form .input-field .icon-btn {
  border-color: rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.94);
  color: #dbe6f5;
}

#wa-call-btn.is-available {
  color: #10b981;
}

#wa-call-btn {
  margin-right: 10px;
  transform: translateX(-3px);
}

#wa-call-btn svg {
  width: 24px;
  height: 24px;
}

#wa-call-btn.is-disabled {
  color: #94a3b8;
  opacity: 0.72;
}

#wa-call-btn.is-loading {
  cursor: wait;
  opacity: 0.78;
}

#wa-call-btn.is-loading svg {
  animation: waCallPulse 0.9s ease-in-out infinite alternate;
}

@keyframes waCallPulse {
  from { transform: scale(0.94); }
  to { transform: scale(1.06); }
}

.call-unavailable-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.call-unavailable-modal.hidden {
  display: none;
}

.call-unavailable-card {
  position: relative;
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
}

.call-unavailable-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
}

.call-unavailable-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 14px;
  color: #2563eb;
  background: #eff6ff;
}

.call-unavailable-card h3 {
  margin: 0 36px 8px 0;
  font-size: 20px;
  line-height: 1.25;
}

.call-unavailable-card p {
  margin: 0 0 16px;
  color: #475569;
  line-height: 1.5;
}

.call-unavailable-reasons {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.call-unavailable-reasons li {
  padding: 9px 11px;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.call-unavailable-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

html[data-theme="dark"] .call-unavailable-card {
  border-color: rgba(148, 163, 184, 0.18);
  background: #0f172a;
  color: #e2e8f0;
}

html[data-theme="dark"] .call-unavailable-card p {
  color: #94a3b8;
}

html[data-theme="dark"] .call-unavailable-close,
html[data-theme="dark"] .call-unavailable-reasons li {
  background: rgba(30, 41, 59, 0.96);
  color: #cbd5e1;
}

html[data-theme="dark"] .call-unavailable-icon {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.16);
}

.wa-incoming-call-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1250;
  width: min(430px, calc(100vw - 28px));
}

.wa-incoming-call-panel.hidden {
  display: none;
}

.wa-incoming-call-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.22);
  color: #0f172a;
}

.wa-incoming-call-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #dcfce7;
  color: #16a34a;
}

.wa-incoming-call-title {
  font-weight: 800;
  font-size: 15px;
}

.wa-incoming-call-contact {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 800;
  color: #020617;
}

.wa-incoming-call-status {
  margin-top: 3px;
  color: #475569;
  font-size: 13px;
}

.wa-incoming-call-note {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.wa-incoming-call-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.wa-call-action,
.wa-call-open {
  height: 36px;
  border-radius: 12px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 800;
  cursor: pointer;
}

.wa-call-answer {
  background: #16a34a;
  color: #ffffff;
}

.wa-call-reject {
  background: #ef4444;
  color: #ffffff;
}

.wa-call-mute {
  background: #f8fafc;
  color: #1e293b;
  border-color: #cbd5e1;
}

.wa-call-end {
  background: #0f172a;
  color: #ffffff;
}

.wa-call-open {
  background: #f8fafc;
  color: #1e293b;
  border-color: #dbe4f0;
}

.wa-call-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wa-call-action.hidden,
.wa-call-remote-audio {
  display: none;
}

.wa-incoming-call-panel.is-ended .wa-incoming-call-icon {
  background: #f1f5f9;
  color: #64748b;
}

.message.call-event {
  justify-content: center;
  margin: 10px 0;
}

.message.call-event .call-history-card {
  width: min(360px, calc(100vw - 44px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.call-history-card.can-return-call {
  cursor: pointer;
}

.call-history-card.can-return-call:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.14);
}

.call-history-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #dcfce7;
  color: #16a34a;
  flex: 0 0 auto;
}

.call-history-icon.call-history-icon-missed {
  color: #dc2626;
}

.call-history-copy {
  min-width: 0;
}

.call-history-title {
  font-weight: 800;
  font-size: 14px;
}

.call-history-description,
.call-history-meta {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

html[data-theme="dark"] .wa-incoming-call-card {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .wa-incoming-call-contact {
  color: #f8fafc;
}

html[data-theme="dark"] .wa-incoming-call-status,
html[data-theme="dark"] .wa-incoming-call-note {
  color: #94a3b8;
}

html[data-theme="dark"] .wa-call-open {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .wa-call-mute {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .message.call-event .call-history-card {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .call-history-description,
html[data-theme="dark"] .call-history-meta {
  color: #94a3b8;
}

@media (max-width: 640px) {
  .wa-incoming-call-panel {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .wa-incoming-call-card {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 14px;
  }

  .wa-incoming-call-icon {
    width: 42px;
    height: 42px;
  }
}

/* ========= Profile Modal ========= */
.profile-avatar.has-image,
.profile-menu-avatar.has-image,
.profile-modal-avatar.has-image {
  overflow: hidden;
  padding: 0;
  color: transparent;
}

.profile-avatar.has-image img,
.profile-menu-avatar.has-image img,
.profile-modal-avatar.has-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 1320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.profile-modal-card {
  position: relative;
  z-index: 1;
  width: min(780px, calc(100vw - 44px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.26);
}

.profile-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 0;
}

.profile-modal-eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2563eb;
}

.profile-modal-title {
  margin-top: 4px;
  font-size: 23px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.profile-modal-close {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #475569;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-modal-close:hover {
  background: transparent;
  color: #0f172a;
}

.profile-modal-body {
  padding: 14px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-modal-summary,
.profile-modal-metrics {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.profile-modal-preferences {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
  padding: 14px 16px;
}

.profile-modal-summary {
  padding: 16px;
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 16px;
}

.profile-modal-avatar-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.profile-modal-avatar {
  width: 116px;
  height: 116px;
  margin: 0 auto;
  border-radius: 24px;
  background: linear-gradient(180deg, #f7e6cf 0%, #efd7b6 100%);
  color: #5b4636;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 12px 28px rgba(15, 23, 42, 0.08);
}

.profile-avatar-change,
.profile-avatar-remove {
  width: 100%;
  justify-content: center;
}

.profile-modal-summary-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-modal-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.profile-modal-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.profile-modal-field .input,
.profile-modal-field input {
  width: 100%;
}

.profile-modal-grid,
.profile-modal-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-modal-stat-card,
.profile-modal-metric {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-modal-stat-card strong,
.profile-modal-metric strong {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 800;
  color: #0f172a;
  word-break: break-word;
}

.profile-modal-metrics {
  padding: 14px 16px;
}

.profile-modal-section-title {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.profile-modal-preference-toggle {
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  background: #f8fafc;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-modal-preference-toggle:hover {
  background: #f1f5f9;
  border-color: rgba(37, 99, 235, 0.2);
}

.profile-modal-preference-toggle.is-active {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.profile-modal-preference-toggle.is-active .profile-menu-switch {
  background: #2563eb;
}

.profile-modal-preference-toggle.is-active .profile-menu-switch-thumb {
  transform: translateX(16px);
}

.profile-modal-preference-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.profile-modal-preference-copy strong {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  color: #0f172a;
}

.profile-modal-preference-copy span {
  font-size: 12px;
  line-height: 1.35;
  color: #64748b;
}

.profile-modal-metric strong {
  font-size: 24px;
  letter-spacing: -0.03em;
}

.profile-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px 18px;
}

.profile-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.profile-modal-feedback {
  flex: 1 1 auto;
  min-height: 20px;
  font-size: 13px;
  font-weight: 700;
}

.profile-modal-feedback.hidden {
  display: none;
}

.profile-modal-feedback.is-success {
  color: #047857;
}

.profile-modal-feedback.is-error {
  color: #dc2626;
}

.profile-modal-feedback.is-info {
  color: #475569;
}

html[data-theme="dark"] .profile-modal-backdrop {
  background: rgba(2, 6, 23, 0.56);
}

html[data-theme="dark"] .profile-modal-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 16, 28, 0.98));
  border-color: rgba(71, 85, 105, 0.58);
  box-shadow: 0 32px 72px rgba(2, 6, 23, 0.44);
}

html[data-theme="dark"] .profile-modal-title,
html[data-theme="dark"] .profile-modal-section-title,
html[data-theme="dark"] .profile-modal-stat-card strong,
html[data-theme="dark"] .profile-modal-metric strong {
  color: #f8fafc;
}

html[data-theme="dark"] .profile-modal-label,
html[data-theme="dark"] .profile-modal-feedback.is-info {
  color: #94a3b8;
}

html[data-theme="dark"] .profile-modal-close {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(71, 85, 105, 0.48);
  color: #cbd5e1;
}

html[data-theme="dark"] .profile-modal-close:hover {
  background: rgba(30, 41, 59, 0.92);
  color: #f8fafc;
}

html[data-theme="dark"] .profile-modal-summary,
html[data-theme="dark"] .profile-modal-metrics,
html[data-theme="dark"] .profile-modal-preferences {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(71, 85, 105, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .profile-modal-stat-card,
html[data-theme="dark"] .profile-modal-metric {
  background: rgba(22, 34, 51, 0.92);
  border-color: rgba(71, 85, 105, 0.42);
}

html[data-theme="dark"] .profile-modal-preference-toggle {
  background: rgba(22, 34, 51, 0.92);
  border-color: rgba(71, 85, 105, 0.42);
  color: #f8fafc;
}

html[data-theme="dark"] .profile-modal-preference-toggle:hover {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(96, 165, 250, 0.32);
}

html[data-theme="dark"] .profile-modal-preference-copy strong {
  color: #f8fafc;
}

html[data-theme="dark"] .profile-modal-preference-copy span {
  color: #94a3b8;
}

html[data-theme="dark"] .profile-modal-avatar {
  background: linear-gradient(180deg, #2a3445 0%, #1f2937 100%);
  color: #f8e4ca;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 28px rgba(2, 6, 23, 0.28);
}

@media (max-width: 860px) {
  .profile-modal {
    padding: 14px;
  }

  .profile-modal-card {
    width: min(100vw - 20px, 100%);
    max-height: calc(100vh - 20px);
    border-radius: 24px;
  }

  .profile-modal-header,
  .profile-modal-body,
  .profile-modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .profile-modal-summary {
    grid-template-columns: 1fr;
  }

  .profile-modal-avatar-shell {
    align-items: center;
  }

  .profile-modal-grid,
  .profile-modal-metric-grid {
    grid-template-columns: 1fr;
  }

  .profile-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-modal-actions {
    width: 100%;
    margin-left: 0;
  }

  .profile-modal-actions .btn {
    flex: 1 1 0;
  }
}

/* ========= External Provider / UChat ========= */
.uchat-provider-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.82);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.uchat-provider-topline,
.uchat-provider-inline,
.uchat-provider-actions,
.uchat-provider-toggle {
  display: flex;
  align-items: center;
}

.uchat-connection-list {
  display: grid;
  gap: 10px;
}

.uchat-connection-item {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.uchat-connection-item:hover {
  transform: translateY(-1px);
  border-color: rgba(2, 132, 199, 0.32);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.uchat-connection-item.is-active {
  border-color: rgba(2, 132, 199, 0.44);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.1);
}

.uchat-connection-item-head,
.uchat-connection-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.uchat-connection-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.uchat-connection-item-meta {
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
}

.uchat-provider-topline,
.uchat-provider-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.uchat-provider-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.uchat-provider-grid,
.uchat-provider-debug-grid {
  display: grid;
  gap: 12px;
}

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

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

.uchat-provider-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.uchat-provider-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.uchat-provider-static {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.76);
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.uchat-provider-help {
  font-size: 12px;
  color: #64748b;
}

.uchat-provider-inline {
  gap: 10px;
}

.uchat-provider-inline .input-field {
  flex: 1 1 auto;
}

.uchat-provider-toggle {
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.76);
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.uchat-provider-toggle input {
  margin: 0;
}

.uchat-provider-textarea {
  min-height: 96px;
  resize: vertical;
}

.uchat-provider-debug-card {
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.76);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.uchat-provider-pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

html[data-theme="dark"] .uchat-provider-panel {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(15, 23, 42, 0.7);
}

html[data-theme="dark"] .uchat-connection-item {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(22, 34, 51, 0.88);
}

html[data-theme="dark"] .uchat-connection-item-name {
  color: #e5edf8;
}

html[data-theme="dark"] .uchat-connection-item-meta {
  color: #94a3b8;
}

html[data-theme="dark"] .uchat-provider-chip,
html[data-theme="dark"] .uchat-provider-static,
html[data-theme="dark"] .uchat-provider-toggle,
html[data-theme="dark"] .uchat-provider-debug-card {
  border-color: rgba(71, 85, 105, 0.42);
  background: rgba(22, 34, 51, 0.88);
  color: #e5edf8;
}

html[data-theme="dark"] .uchat-provider-label,
html[data-theme="dark"] .uchat-provider-help {
  color: #94a3b8;
}

html[data-theme="dark"] .uchat-provider-pre {
  color: #cbd5e1;
}

@media (max-width: 900px) {
  .uchat-provider-grid,
  .uchat-provider-debug-grid {
    grid-template-columns: 1fr;
  }

  .uchat-provider-inline {
    flex-direction: column;
    align-items: stretch;
  }
}
/* Supervisor */
.supervisor-shell {
  width: 100%;
}

.supervisor-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid #e5eaf3;
  background: #fbfcff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.05);
}

.supervisor-header,
.supervisor-module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.supervisor-header {
  margin-bottom: 18px;
}

.supervisor-header .eyebrow {
  color: #60708d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.supervisor-header .title {
  color: #16233d;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.supervisor-subtitle {
  margin-top: 6px;
  max-width: 720px;
  color: #5f6f8a;
  font-size: 15px;
}

.supervisor-header-actions,
.supervisor-actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.supervisor-header-actions .btn {
  min-height: 42px;
  padding-inline: 16px;
  border-radius: 14px;
  border-color: #cdd8e8;
  background: #f7faff;
  color: #31415e;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.supervisor-status {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  color: #16233d;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.supervisor-status[data-tone="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.supervisor-status[data-tone="error"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.supervisor-metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.supervisor-kpi-card {
  min-height: 128px;
  padding: 18px;
  justify-content: flex-start;
  gap: 10px;
  border-radius: 16px;
  background: #ffffff;
  border-color: #e3e8f2;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.supervisor-kpi-card:hover {
  transform: translateY(-2px);
  border-color: #cdd8e8;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
}

.supervisor-kpi-card .dashboard-pro-card-label {
  color: #50607d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.supervisor-kpi-card .dashboard-pro-card-value {
  color: #06152f;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1;
}

.supervisor-kpi-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.supervisor-kpi-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.supervisor-kpi-icon .bi {
  width: 23px;
  height: 23px;
  font-size: 23px;
  line-height: 1;
}

.supervisor-kpi-icon.violet { background: #eee7ff; color: #6d3df4; }
.supervisor-kpi-icon.green { background: #dcfce7; color: #16a34a; }
.supervisor-kpi-icon.amber { background: #fff2dc; color: #f59e0b; }
.supervisor-kpi-icon.blue { background: #e2eaff; color: #4263eb; }
.supervisor-kpi-icon.purple { background: #eee7ff; color: #6d28d9; }
.supervisor-kpi-icon.emerald { background: #dcfce7; color: #10b981; }

.supervisor-kpi-caption {
  color: #7a8aa6;
  font-size: 12px;
  font-weight: 650;
}

.supervisor-module {
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid #e3e8f2;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.045);
}

.supervisor-module .dashboard-pro-module-title {
  color: #0f1d36;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.supervisor-section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.supervisor-section-title .bi {
  color: #2454ff;
  font-size: 20px;
  line-height: 1;
}

.supervisor-section-title span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2454ff;
  box-shadow: 0 0 0 4px rgba(36, 84, 255, 0.1);
}

.supervisor-module .dashboard-pro-module-subtitle {
  color: #60708d;
  font-size: 14px;
}

.supervisor-module-head .btn.primary {
  min-height: 40px;
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.22);
}

.supervisor-filter-grid,
.supervisor-settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 16px;
}

.supervisor-filter-grid .input,
.supervisor-settings-grid .input,
.supervisor-inline-select {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #dce4f2;
  background: #ffffff;
  color: #16233d;
  font-weight: 650;
  box-shadow: none;
}

.supervisor-filter-grid .input:focus,
.supervisor-settings-grid .input:focus,
.supervisor-inline-select:focus {
  border-color: #7aa7ff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14), 0 16px 30px rgba(15, 23, 42, 0.08);
}

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

.supervisor-settings-grid label,
.supervisor-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.supervisor-toggle-row {
  justify-content: center;
  flex-direction: row;
  align-items: center;
  min-height: 42px;
}

.supervisor-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.supervisor-table th,
.supervisor-table td {
  white-space: nowrap;
}

.supervisor-table thead th {
  top: 0;
  background: #fbfcff;
  color: #50607d;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.supervisor-table tbody td {
  color: #10203d;
  font-size: 13px;
  vertical-align: middle;
}

.supervisor-table tbody tr {
  transition: background-color 0.16s ease;
}

.supervisor-table tbody tr:hover {
  background: #f8fbff;
}

.supervisor-table td:nth-child(4) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supervisor-inline-select {
  min-width: 118px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 12px;
}

.supervisor-contact-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supervisor-contact-cell div {
  display: grid;
  gap: 2px;
}

.supervisor-contact-cell strong {
  color: #16233d;
  font-size: 13px;
}

.supervisor-contact-cell span:not(.supervisor-avatar) {
  color: #70809d;
  font-size: 12px;
}

.supervisor-avatar {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e8e7ff;
  color: #5b4df5;
  font-size: 11px;
  font-weight: 850;
}

.supervisor-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.supervisor-badge.channel {
  background: #e8f8ef;
  color: #15803d;
}

.supervisor-badge.channel.whatsapp {
  width: 30px;
  height: 30px;
  justify-content: center;
  padding: 0;
  color: #128c4a;
}

.supervisor-badge.channel.whatsapp .bi {
  font-size: 15px;
  line-height: 1;
  flex: 0 0 auto;
}

.supervisor-actions-cell .btn,
.supervisor-agent-actions .btn,
[data-supervisor-send-selected] {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.supervisor-actions-cell .btn .bi,
.supervisor-agent-actions .btn .bi,
[data-supervisor-send-selected] .bi {
  font-size: 14px;
  line-height: 1;
}

.supervisor-badge.state {
  background: #eaf8ef;
  color: #15803d;
}

.supervisor-badge.state.overdue,
.supervisor-badge.state.waiting {
  background: #e6f8ef;
  color: #16a34a;
}

.supervisor-badge.state.unassigned {
  background: #fff3df;
  color: #c2410c;
}

.supervisor-wait-cell {
  color: #f97316 !important;
  font-weight: 850;
}

.supervisor-seller-cell {
  display: inline;
}

.supervisor-team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.supervisor-agent-card,
.supervisor-empty-card,
.supervisor-alert-item {
  border: 1px solid #e3e8f2;
  border-radius: 14px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

.supervisor-agent-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}

.supervisor-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.supervisor-agent-head > strong {
  color: #10203d;
  font-size: 15px;
}

.supervisor-agent-status {
  color: #60708d;
  font-size: 13px;
}

.supervisor-agent-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.supervisor-agent-metrics div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 58px;
  padding: 10px;
  border-radius: 12px;
  background: #f8faff;
}

.supervisor-agent-metrics span {
  color: #6b7a96;
  font-size: 11px;
  font-weight: 700;
}

.supervisor-agent-metrics b {
  color: #111d36;
  font-size: 14px;
  line-height: 1.2;
}

.supervisor-alert-list {
  display: grid;
  gap: 8px;
}

.supervisor-alert-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.supervisor-alert-item span {
  color: var(--muted, #64748b);
  font-size: 13px;
}

.supervisor-selection-summary,
.supervisor-manual-note {
  margin: 10px 0 0;
  color: #60708d;
  font-size: 13px;
}

.supervisor-manual-note {
  padding: 14px;
  border: 1px solid #d9e2ef;
  border-radius: 16px;
  background: #f8fbff;
  line-height: 1.55;
}

.supervisor-agent-select,
.supervisor-agent-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.supervisor-agent-actions {
  margin-top: auto;
}

.supervisor-agent-actions .btn {
  min-height: 38px;
  border-radius: 10px;
  font-weight: 800;
}

.supervisor-agent-select {
  margin-left: auto;
  cursor: pointer;
  font-size: 13px;
  color: #60708d;
  white-space: nowrap;
}

.supervisor-agent-select input {
  position: static;
  width: 16px;
  height: 16px;
  opacity: 1;
  pointer-events: auto;
  accent-color: #2563eb;
}

.supervisor-agent-select span {
  color: #2563eb;
  font-weight: 800;
}

.supervisor-agent-select:has(input:checked) span {
  color: #0f766e;
}

.supervisor-agent-hint {
  color: #60708d;
  font-size: 12px;
}

.supervisor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.supervisor-modal.hidden {
  display: none;
}

.supervisor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.supervisor-modal-card {
  position: relative;
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid #dfe5ef;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.24);
}

.supervisor-modal-body {
  display: grid;
  gap: 10px;
}

.supervisor-modal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.supervisor-message-preview {
  padding: 12px;
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  background: #f8fbff;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

.supervisor-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

html[data-theme="dark"] .supervisor-status {
  background: rgba(15, 23, 42, 0.74);
}

html[data-theme="dark"] .supervisor-panel {
  background:
    radial-gradient(circle at top center, rgba(59, 130, 246, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(10, 15, 28, 0.98));
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .supervisor-header .eyebrow,
html[data-theme="dark"] .supervisor-subtitle,
html[data-theme="dark"] .supervisor-module .dashboard-pro-module-subtitle,
html[data-theme="dark"] .supervisor-selection-summary,
html[data-theme="dark"] .supervisor-agent-status,
html[data-theme="dark"] .supervisor-agent-hint,
html[data-theme="dark"] .supervisor-alert-item span {
  color: #94a3b8;
}

html[data-theme="dark"] .supervisor-header .title,
html[data-theme="dark"] .supervisor-module .dashboard-pro-module-title,
html[data-theme="dark"] .supervisor-kpi-card .dashboard-pro-card-value,
html[data-theme="dark"] .supervisor-table tbody td {
  color: #f8fafc;
}

html[data-theme="dark"] .supervisor-kpi-card,
html[data-theme="dark"] .supervisor-module,
html[data-theme="dark"] .supervisor-agent-card,
html[data-theme="dark"] .supervisor-empty-card,
html[data-theme="dark"] .supervisor-alert-item,
html[data-theme="dark"] .supervisor-table-wrap,
html[data-theme="dark"] .supervisor-modal-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.78));
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .supervisor-filter-grid .input,
html[data-theme="dark"] .supervisor-settings-grid .input,
html[data-theme="dark"] .supervisor-inline-select,
html[data-theme="dark"] .supervisor-header-actions .btn,
html[data-theme="dark"] .supervisor-manual-note,
html[data-theme="dark"] .supervisor-message-preview,
html[data-theme="dark"] .supervisor-agent-metrics div {
  background: rgba(30, 41, 59, 0.86);
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html[data-theme="dark"] .supervisor-table thead th {
  background: rgba(30, 41, 59, 0.96);
  color: #cbd5e1;
}

html[data-theme="dark"] .supervisor-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.62);
}

html[data-theme="dark"] .supervisor-contact-cell strong,
html[data-theme="dark"] .supervisor-agent-head > strong,
html[data-theme="dark"] .supervisor-agent-metrics b {
  color: #f8fafc;
}

html[data-theme="dark"] .supervisor-contact-cell span:not(.supervisor-avatar),
html[data-theme="dark"] .supervisor-kpi-caption {
  color: #94a3b8;
}

html[data-theme="dark"] .supervisor-avatar,
html[data-theme="dark"] .supervisor-badge {
  background: rgba(51, 65, 85, 0.9);
  color: #cbd5e1;
}

html[data-theme="dark"] .supervisor-badge.channel,
html[data-theme="dark"] .supervisor-badge.state {
  background: rgba(21, 128, 61, 0.24);
  color: #86efac;
}

html[data-theme="dark"] .supervisor-status[data-tone="success"] {
  background: rgba(20, 83, 45, 0.28);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.42);
}

html[data-theme="dark"] .supervisor-status[data-tone="error"] {
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.42);
}

@media (max-width: 1180px) {
  .supervisor-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .supervisor-filter-grid,
  .supervisor-settings-grid,
  .supervisor-team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .supervisor-panel {
    padding: 14px;
  }

  .supervisor-header,
  .supervisor-module-head {
    flex-direction: column;
  }

  .supervisor-header-actions,
  .supervisor-filter-grid,
  .supervisor-settings-grid,
  .supervisor-team-grid,
  .supervisor-metrics-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .supervisor-header-actions .btn {
    width: 100%;
  }
}

.page-shell[data-page="chat"] .chat-input,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  gap: 10px !important;
  margin: 0 10px 10px !important;
  padding: 8px 0 !important;
}

.page-shell[data-page="chat"] .chat-input .input-field,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input .input-field {
  border-radius: 8px !important;
  box-shadow: none !important;
  min-height: 54px !important;
  padding: 10px 14px !important;
  gap: 10px !important;
}

.page-shell[data-page="chat"] .chat-input .input-field > .icon-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input .input-field > .icon-btn,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input .input-field > .icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
}

.page-shell[data-page="chat"] .chat-input .input-field > .icon-btn svg {
  width: 22px !important;
  height: 22px !important;
}

.page-shell[data-page="chat"] .chat-input #message-input,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input #message-input,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input #message-input {
  min-height: 28px !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
}

.page-shell[data-page="chat"] .chat-input > #send-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-input > #send-btn,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-input > #send-btn {
  width: 50px !important;
  height: 50px !important;
  min-width: 50px !important;
}

.page-shell[data-page="chat"] .chat-input > #send-btn svg {
  width: 26px !important;
  height: 26px !important;
}

.page-shell[data-page="chat"] .input,
.page-shell[data-page="chat"] select.input,
.page-shell[data-page="chat"] .chat-header-status-select,
html[data-theme="light"] .page-shell[data-page="chat"] .input,
html[data-theme="light"] .page-shell[data-page="chat"] select.input,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-header-status-select,
html[data-theme="dark"] .page-shell[data-page="chat"] .input,
html[data-theme="dark"] .page-shell[data-page="chat"] select.input,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-header-status-select {
  box-shadow: none !important;
}

.page-shell[data-page="chat"] .chat-area,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-area,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-area {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.page-shell[data-page="chat"] .chat-header,
html[data-theme="light"] .page-shell[data-page="chat"] .chat-header,
html[data-theme="dark"] .page-shell[data-page="chat"] .chat-header {
  box-shadow: none !important;
}

.page-shell[data-page="chat"] .panel.sidebar,
html[data-theme="light"] .page-shell[data-page="chat"] .panel.sidebar,
html[data-theme="dark"] .page-shell[data-page="chat"] .panel.sidebar {
  border-radius: 0 !important;
  box-shadow: none !important;
}

.page-shell[data-page="chat"] .sidebar-top,
html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-top,
html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-top {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.page-shell[data-page="chat"] .sidebar-search,
.page-shell[data-page="chat"] .filter-tag,
.page-shell[data-page="chat"] .filter-add-btn,
.page-shell[data-page="chat"] .contact,
html[data-theme="light"] .page-shell[data-page="chat"] .sidebar-search,
html[data-theme="light"] .page-shell[data-page="chat"] .filter-tag,
html[data-theme="light"] .page-shell[data-page="chat"] .filter-add-btn,
html[data-theme="light"] .page-shell[data-page="chat"] .contact,
html[data-theme="dark"] .page-shell[data-page="chat"] .sidebar-search,
html[data-theme="dark"] .page-shell[data-page="chat"] .filter-tag,
html[data-theme="dark"] .page-shell[data-page="chat"] .filter-add-btn,
html[data-theme="dark"] .page-shell[data-page="chat"] .contact {
  border-radius: 8px !important;
}

@media (min-width: 1280px) {
  .page-shell[data-page="chat"] .app-shell {
    grid-template-columns: 430px minmax(0, 1fr) !important;
    gap: 0 !important;
    column-gap: 0 !important;
  }
}

@media (min-width: 769px) and (max-width: 1279px) {
  .page-shell[data-page="chat"] .app-shell {
    grid-template-columns: 360px minmax(0, 1fr) !important;
    gap: 0 !important;
    column-gap: 0 !important;
  }
}

.page-shell[data-page="chat"] .bubble.has-image-content,
.page-shell[data-page="chat"] .bubble.has-image,
.page-shell[data-page="chat"] .bubble:has(.message-media):not(.bubble-audio),
.page-shell[data-page="chat"] .bubble:has(.message-image),
.page-shell[data-page="chat"] .bubble:has(.attached-img) {
  padding: 0 !important;
}

.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable),
.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable) .message-image,
.page-shell[data-page="chat"] .bubble.has-image-content > .message-image,
.page-shell[data-page="chat"] .bubble.has-image-content > .attached-img {
  width: 100% !important;
}

.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable) {
  overflow: hidden !important;
}

.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable) .message-image,
.page-shell[data-page="chat"] .bubble.has-image-content > .message-image,
.page-shell[data-page="chat"] .bubble.has-image-content > .attached-img {
  border-radius: 7px 7px 0 0 !important;
  width: 100% !important;
  height: auto !important;
  min-width: 180px !important;
  max-width: min(70vw, 420px) !important;
  max-height: min(70vh, 560px) !important;
  object-fit: cover !important;
  object-position: center center !important;
  background: transparent !important;
}

.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable) .message-image:is([width], [height]),
.page-shell[data-page="chat"] .bubble.has-image-content > .message-image:is([width], [height]),
.page-shell[data-page="chat"] .bubble.has-image-content > .attached-img:is([width], [height]) {
  aspect-ratio: auto !important;
}

.page-shell[data-page="chat"] .message-media:not(.sticker):not(.unavailable) .message-image {
  display: block !important;
}

.page-shell[data-page="chat"] .bubble.has-image-content {
  max-width: min(70vw, 420px) !important;
  width: fit-content !important;
}

.page-shell[data-page="chat"] .bubble.has-image-content:has(.media-caption) {
  width: min(70vw, 320px) !important;
}

.page-shell[data-page="chat"] .bubble.has-image-content:has(.media-caption) .message-media:not(.sticker):not(.unavailable) {
  width: 100% !important;
}

.page-shell[data-page="chat"] .bubble.has-image-content .media-caption {
  padding: 6px 8px 5px !important;
}

.page-shell[data-page="chat"] .message .bubble,
.page-shell[data-page="chat"] .message.in .bubble,
.page-shell[data-page="chat"] .message.out .bubble,
.page-shell[data-page="chat"] .message.is-pinned .bubble,
.page-shell[data-page="chat"] .message.is-starred .bubble,
.page-shell[data-page="chat"] .message.is-reported .bubble,
html[data-theme="light"] .page-shell[data-page="chat"] .message .bubble,
html[data-theme="dark"] .page-shell[data-page="chat"] .message .bubble {
  box-shadow: none !important;
}

.whatsapp-template-picker-eyebrow {
  display: none !important;
}

.whatsapp-template-picker-card,
html[data-theme="dark"] .whatsapp-template-picker-card {
  border-radius: 8px !important;
}

.whatsapp-template-picker-option,
.whatsapp-template-picker-empty,
html[data-theme="dark"] .whatsapp-template-picker-option,
html[data-theme="dark"] .whatsapp-template-picker-empty {
  border-radius: 8px !important;
  box-shadow: none !important;
}

.whatsapp-template-picker-option:hover,
.whatsapp-template-picker-option.is-selected {
  box-shadow: none !important;
}

.whatsapp-template-picker-option-badge,
.whatsapp-template-picker-footer .btn {
  border-radius: 8px !important;
}

.whatsapp-template-picker-title {
  margin-top: 0 !important;
}

.supervisor-panel,
.supervisor-kpi-card,
.supervisor-module,
.supervisor-agent-card,
.supervisor-empty-card,
.supervisor-alert-item,
.supervisor-table-wrap,
.supervisor-status,
.supervisor-manual-note,
.supervisor-message-preview,
.supervisor-modal-card,
.supervisor-agent-metrics div,
html[data-theme="dark"] .supervisor-panel,
html[data-theme="dark"] .supervisor-kpi-card,
html[data-theme="dark"] .supervisor-module,
html[data-theme="dark"] .supervisor-agent-card,
html[data-theme="dark"] .supervisor-empty-card,
html[data-theme="dark"] .supervisor-alert-item,
html[data-theme="dark"] .supervisor-table-wrap,
html[data-theme="dark"] .supervisor-modal-card,
html[data-theme="dark"] .supervisor-agent-metrics div {
  border-radius: 8px !important;
  box-shadow: none !important;
}

.supervisor-header-actions .btn,
.supervisor-module-head .btn,
.supervisor-actions-cell .btn,
.supervisor-agent-actions .btn,
[data-supervisor-send-selected],
.supervisor-filter-grid .input,
.supervisor-settings-grid .input,
.supervisor-inline-select,
.supervisor-badge,
.supervisor-kpi-icon,
html[data-theme="dark"] .supervisor-header-actions .btn,
html[data-theme="dark"] .supervisor-filter-grid .input,
html[data-theme="dark"] .supervisor-settings-grid .input,
html[data-theme="dark"] .supervisor-inline-select,
html[data-theme="dark"] .supervisor-badge {
  border-radius: 8px !important;
  box-shadow: none !important;
}

.supervisor-kpi-card:hover,
.supervisor-module-head .btn.primary,
.supervisor-filter-grid .input:focus,
.supervisor-settings-grid .input:focus,
.supervisor-inline-select:focus {
  box-shadow: none !important;
  transform: none !important;
}

.page-shell[data-page="chat"] #mobile-back,
html[data-theme="light"] .page-shell[data-page="chat"] #mobile-back,
html[data-theme="dark"] .page-shell[data-page="chat"] #mobile-back {
  border-radius: 8px !important;
}

.app-view-panel[data-view="leads"],
.app-view-panel[data-view="leads"] .leads-panel,
html[data-theme="light"] .app-view-panel[data-view="leads"],
html[data-theme="light"] .app-view-panel[data-view="leads"] .leads-panel,
html[data-theme="dark"] .app-view-panel[data-view="leads"],
html[data-theme="dark"] .app-view-panel[data-view="leads"] .leads-panel {
  box-shadow: none !important;
}
