/* ==========================================================================
   Bomma WhatsApp – Best-in-Class Modern Romford SaaS Theme (v9.0)
   Bespoke Lucide SVG Icons, Fluid Layout, Micro-Interactions, Command UX
   ========================================================================== */

:root {
  /* Romford Brand Palette */
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --amber-950: #451a03;

  /* Modern Neutral Slate & Warm Gray */
  --bg-app: #f8f9fa;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --card-sub: #f8fafc;
  --border-color: #e5e7eb;
  --border-subtle: #f1f5f9;
  --border-hover: #d1d5db;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  /* Functional Semantic Colors */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  
  --rose-50: #fff1f2;
  --rose-100: #ffe4e6;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;
  
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  /* Layout Dimensions */
  --sidebar-width: 284px;
  --sidebar-collapsed-width: 78px;
  --topbar-height: 64px;

  /* Radius & Elevation */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-2xs: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
  --shadow-xs: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-amber: 0 4px 12px -2px rgba(217, 119, 6, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[hidden] { display: none !important; }

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  margin: 0;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: visible;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================================
   App Shell & Collapsible Sidebar
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.mobile-nav-open .mobile-backdrop {
  opacity: 1;
  pointer-events: auto;
}

aside.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 16px;
  z-index: 40;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease, transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-2xs);
}

body.sidebar-collapsed aside.sidebar {
  width: var(--sidebar-collapsed-width);
  padding: 20px 10px;
}

/* Sidebar Brand Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}

body.sidebar-collapsed .sidebar-logo {
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.025em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--amber-700) 0%, var(--amber-600) 50%, var(--amber-500) 100%);
  color: #fff;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.28);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.brand-link:hover .brand-mark {
  transform: scale(1.04);
}

.brand-badge {
  background: var(--amber-100);
  color: var(--amber-800);
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.collapse-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.collapse-btn:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

/* Sidebar User Profile Card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  margin-bottom: 22px;
  transition: all 0.15s ease;
}

body.sidebar-collapsed .profile-card {
  justify-content: center;
  padding: 8px;
  background: transparent;
  border-color: transparent;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--amber-600), var(--amber-700));
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(217, 119, 6, 0.25);
}

.profile-info {
  min-width: 0;
  flex: 1;
}

body.sidebar-collapsed .profile-info {
  display: none;
}

.profile-name {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.profile-role svg {
  color: var(--amber-600);
  flex-shrink: 0;
}

/* Side Navigation Links */
nav.side-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  padding: 0 10px 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

body.sidebar-collapsed .nav-section-title {
  display: none;
}

.nav-section-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 8px;
  display: none;
}

body.sidebar-collapsed .nav-section-divider {
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.16s ease;
  position: relative;
}

.nav-item:hover {
  background: #f8fafc;
  border-color: var(--border-color);
}

.nav-item.active {
  background: linear-gradient(135deg, #fffbeb 0%, #eff6ff 100%);
  border-color: var(--amber-500);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.12);
}

/* Feature Card Colorful Icon Tiles (from uploaded reference) */
.nav-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1.5px solid currentColor;
  transition: transform 0.15s ease;
}

.nav-item:hover .nav-icon-tile {
  transform: scale(1.04);
}

.tile-green   { background: #ecfdf5; color: #10b981; border-color: #34d399; }
.tile-lime    { background: #f7fee7; color: #65a30d; border-color: #a3e635; }
.tile-purple  { background: #f5f3ff; color: #7c3aed; border-color: #a78bfa; }
.tile-teal    { background: #f0fdfa; color: #0d9488; border-color: #2dd4bf; }
.tile-emerald { background: #ecfdf5; color: #059669; border-color: #10b981; }
.tile-magenta { background: #fdf2f8; color: #db2777; border-color: #f472b6; }
.tile-blue    { background: #eff6ff; color: #2563eb; border-color: #60a5fa; }
.tile-amber   { background: #fffbeb; color: #d97706; border-color: #fbbf24; }

.nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}

.nav-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 8px 0;
}

body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-label {
  display: none;
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  margin-top: 16px;
  margin-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--rose-600);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.logout-btn:hover {
  background: var(--rose-50);
  color: var(--rose-700);
}

body.sidebar-collapsed .logout-btn {
  justify-content: center;
  padding: 10px 0;
}

body.sidebar-collapsed .logout-btn span {
  display: none;
}

/* Floating Tooltips when Sidebar Collapsed */
body.sidebar-collapsed .nav-item:hover::after,
body.sidebar-collapsed .logout-btn:hover::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 12px);
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 100;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

/* ==========================================================================
   Main Content Wrapper & Top Header Bar
   ========================================================================== */

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar */
header.topbar {
  height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 16px;
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  max-width: 520px;
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  white-space: nowrap;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.topbar-search input {
  width: 100%;
  padding: 7px 42px 7px 34px;
  background: #f3f4f6;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.topbar-search input:hover {
  border-color: var(--amber-500);
  background: #fff;
}

.topbar-search input:focus {
  background: #ffffff;
  border-color: var(--amber-600);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.topbar-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.topbar-search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--emerald-50);
  color: var(--emerald-700);
  border: 1px solid var(--emerald-100);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-500);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.store-badge {
  text-align: right;
  line-height: 1.25;
  padding-left: 14px;
  border-left: 1px solid var(--border-color);
}

.store-badge .store-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}

.store-badge .store-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Dry Run Alert Banner */
.banner {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  color: var(--amber-900);
  padding: 10px 28px;
  border-bottom: 1px solid var(--amber-200);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Workspace Content */
main {
  flex: 1;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

body.tab-inbox main {
  max-width: 100%;
  padding: 16px 20px 24px;
}

/* Tab Section Header */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-header h1 {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.section-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Cards, Panels & Queue Status Hero
   ========================================================================== */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 9px;
}

.card h3 svg {
  color: var(--amber-600);
  flex-shrink: 0;
}

.card.sub {
  background: var(--card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 14px 0;
  box-shadow: none;
}

.card.sub h4, .card h4 {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.narrow {
  max-width: 650px;
}

.overview-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
}

.overview-two-col .card {
  margin-bottom: 0;
}

/* Queue Hero Bar */
.queuebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border: 1px solid var(--amber-200);
  border-left: 5px solid var(--amber-600);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-xs);
}

.queuebar .big {
  font-size: 18.5px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.queuebar .muted {
  font-size: 13px;
  margin-top: 4px;
  color: var(--text-secondary);
}

.actions {
  display: flex;
  gap: 10px;
}

/* KPI Stat Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-2xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--amber-400);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat span {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--amber-50);
  color: var(--amber-600);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amber-100);
}

.stat b {
  display: block;
  font-size: 25px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ==========================================================================
   Buttons, Inputs & Controls
   ========================================================================== */

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }

code {
  font-family: var(--font-mono);
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
}

button, .filebtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  padding: 8px 15px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  text-decoration: none;
  box-shadow: var(--shadow-2xs);
  white-space: nowrap;
}

button:hover, .filebtn:hover {
  background: #f8fafc;
  border-color: var(--border-hover);
  color: var(--text-main);
}

button:active, .filebtn:active {
  transform: translateY(1px);
}

button.primary {
  background: linear-gradient(180deg, var(--amber-500) 0%, var(--amber-600) 100%);
  border-color: var(--amber-600);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--shadow-amber);
}

button.primary:hover {
  background: linear-gradient(180deg, var(--amber-600) 0%, var(--amber-700) 100%);
  border-color: var(--amber-700);
  color: #ffffff;
}

button.danger {
  border-color: var(--rose-100);
  background: #ffffff;
  color: var(--rose-600);
}

button.danger:hover {
  background: var(--rose-50);
  border-color: var(--rose-500);
}

button:disabled, .filebtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.filebtn input {
  display: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:hover, select:hover, textarea:hover {
  border-color: #cbd5e1;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--amber-600);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
}

.row > label:not(.check):not(.filebtn):not(.inline) {
  flex: 1;
}

label.filebtn, .filebtn {
  display: inline-flex;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  flex: 0 0 auto;
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  flex: 0 0 auto;
  margin: 4px 0;
}

label.check input[type="checkbox"], label.check input[type="radio"] {
  accent-color: var(--amber-600);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

label.inline {
  flex: 0 1 auto;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

/* ==========================================================================
   Badges, Pills & Status Tags
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--rose-600);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.p-A { background: var(--rose-50); color: var(--rose-700); border-color: var(--rose-100); }
.p-B { background: var(--amber-50); color: var(--amber-800); border-color: var(--amber-200); }
.p-C { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }

.s-sent, .s-replied, .s-open, .s-resolved { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-100); }
.s-ordered { background: var(--emerald-100); color: var(--emerald-700); border-color: rgba(16, 185, 129, 0.3); font-weight: 700; }
.s-opted_out, .s-failed, .s-cancelled, .p-urgent { background: var(--rose-50); color: var(--rose-700); border-color: var(--rose-100); }
.s-queued, .s-in_progress { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }
.s-archived, .s-closed { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.s-waiting_customer, .p-high { background: var(--amber-50); color: var(--amber-800); border-color: var(--amber-200); }
.pill.tag {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
  font-size: 10.5px;
  padding: 1.5px 6.5px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.25;
}
.pill.tag-sales {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}
.pill.tag-product-inquiry {
  background: #fefce8;
  color: #854d0e;
  border-color: #fef08a;
}
.pill.tag-details-received {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}
.pill.tag-order-sent {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
  font-weight: 600;
}
.pill.tag-agent-requested,
.pill.tag-bulk-inquiry {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
.pill.tag-tracking-inquiry {
  background: #faf5ff;
  color: #6b21a8;
  border-color: #e9d5ff;
}
.pill.tag-undeliverable {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}
.pill.tag-more {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
  font-size: 10px;
  padding: 1.5px 5px;
  font-weight: 600;
  cursor: help;
}

/* ==========================================================================
   Data Tables & Action Bars
   ========================================================================== */

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--card-bg);
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  box-shadow: var(--shadow-2xs);
}

.filters input {
  min-width: 240px;
  flex: 1;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-2xs);
}

#topN {
  width: 58px;
  padding: 3px 6px;
  margin-left: 4px;
  text-align: center;
}

.tablewrap {
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  margin: 12px 0 22px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 860px;
}

th, td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 10;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

th.sortable:hover {
  background: #edf2f7;
  color: #0f172a;
}

th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.35;
  transition: transform 0.15s ease, opacity 0.15s ease;
  vertical-align: middle;
}

th.sortable:hover .sort-icon {
  opacity: 0.75;
}

th.sort-asc .sort-icon,
th.sort-desc .sort-icon {
  opacity: 1;
  color: #2563eb;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background-color: #fcfcfd;
}

td small {
  color: var(--text-muted);
  display: block;
  font-size: 11.5px;
  margin-top: 2px;
}

td:last-child {
  white-space: nowrap;
}

/* Date Grouping in Tables */
tr.date-group-header td {
  background: #f1f5f9;
  padding: 8px 14px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
  font-weight: 700;
  color: #1e293b;
}
tr.date-group-header:hover td {
  background: #f1f5f9;
}
.date-group-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.date-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #0f172a;
}
.date-group-stats {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   WhatsApp Live Inbox & Apple-Inspired Split-Pane Messenger
   ========================================================================== */

.inbox {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 290px;
  gap: 12px;
  height: calc(100vh - 108px);
  min-height: 580px;
  transition: grid-template-columns 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
}

@media (min-width: 1261px) {
  .inbox.c360-collapsed {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

.inbox.c360-collapsed .c360-panel {
  display: none;
}

/* Customer 360° Inspector inside Live Inbox */
.c360-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.c360-back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--amber-800, #92400e);
  background: var(--amber-50, #fffbeb);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.c360-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f1f5f9;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.c360-close-btn:hover {
  color: var(--rose-600);
  background: var(--rose-50);
  border-color: rgba(225, 29, 72, 0.2);
}

.c360-header {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  flex-shrink: 0;
}

.c360-header-info {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.c360-header-title-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.c360-cust-name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c360-header-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.c360-badge-indicator {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.3;
}

#c360PhoneBadge {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c360-meta-strip {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.c360-meta-strip label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  gap: 3px;
}

.c360-meta-strip input,
.c360-meta-strip select {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.c360-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  background: #fbfcfd;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.c360-kpi {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.c360-kpi span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.c360-kpi b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-top: 2px;
}

.c360-scroll-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: auto;
  padding-bottom: calc(90px + env(safe-area-inset-bottom, 24px));
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.c360-scroll-wrap::-webkit-scrollbar {
  width: 6px;
}

.c360-scroll-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.c360-scroll-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.c360-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  margin: 0;
  border-radius: 0;
}

.c360-tabs button {
  flex: 1 1 auto;
  min-width: fit-content;
  text-align: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.c360-tabs button.active {
  color: var(--text-main);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.c360-body {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible !important;
  padding: 12px 14px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
}

.c360-item {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 11px 13px;
  background: #ffffff;
  font-size: 12.5px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: border-color 0.15s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.c360-item:hover {
  border-color: var(--amber-400);
}

/* Multiple Drip Flows Switcher & Visual Pipeline */
.flow-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.flow-tab-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-2xs);
}

.flow-tab-card:hover {
  border-color: var(--amber-400);
  background: #fffdf9;
}

.flow-tab-card.active {
  border-color: var(--amber-600);
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: var(--shadow-sm);
}

.flow-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.flow-step-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--amber-500);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.flow-step-card .step-num {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber-700);
}

.flow-step-card h5 {
  margin: 4px 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

/* Left Sidebar: Conversations List */
.inbox aside.inbox-sidebar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ib-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.ib-search-row input#ibSearch {
  flex: 1;
  min-width: 0;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  transition: all 0.15s ease;
}

.ib-search-row input#ibSearch:focus {
  background: #ffffff;
  border-color: var(--amber-500);
}

.ib-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: all 0.15s ease;
}

.ib-filter-btn:hover,
.ib-filter-btn.active {
  background: #e2e8f0;
  color: var(--text-main);
  border-color: rgba(0, 0, 0, 0.08);
}

.ib-filter-btn.has-filter {
  color: var(--amber-900);
  background: var(--amber-50);
  border-color: rgba(245, 158, 11, 0.35);
}

.ib-filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d97706;
  flex-shrink: 0;
}

.ib-search-row button#ibNew {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Collapsible Filter Panel */
.ib-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  margin-top: 6px;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.ib-filter-panel[hidden] {
  display: none !important;
}

.ib-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ib-filter-row.secondary {
  align-items: center;
}

.ib-filter-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ib-filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.03em;
}

.ib-filter-panel select.apple-pill-select,
.ib-filter-panel input#ibTag {
  width: 100%;
  padding: 5px 8px;
  font-size: 11.5px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  color: var(--text-main);
}

.ib-replied-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px !important;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  padding-top: 14px;
}

.ib-filter-reset-btn {
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 14px;
  flex-shrink: 0;
}
.ib-filter-reset-btn:hover {
  background: #fecaca;
}

#ibList {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  padding-right: 2px;
  min-width: 0;
  max-width: 100%;
}

.conv {
  flex-shrink: 0;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.14s ease;
  background: transparent;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.conv:hover {
  background: #f8fafc;
}

.conv.on {
  background: var(--amber-50);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.08);
}

.conv .row {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.conv b {
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.conv small {
  color: var(--text-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  margin-top: 2px;
  min-width: 0;
  max-width: 100%;
}

.convmeta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.convmeta .who {
  font-size: 10.5px;
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Center Pane: Apple iMessage / macOS Messages Thread */
.thread {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  min-width: 0;
}

.thhead {
  position: relative;
  z-index: 60;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  flex-shrink: 0;
}

.th-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 140px;
  flex: 1 1 auto;
  overflow: hidden;
}

.th-back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--amber-800, #92400e);
  background: var(--amber-50, #fffbeb);
  border: 1px solid rgba(245, 158, 11, 0.3);
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 999px;
  min-height: 32px;
  transition: all 0.15s ease;
}

.th-back-btn:hover {
  background: var(--amber-100, #fef3c7);
}

.th-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
  overflow: hidden;
}

.th-avatar.is-instagram {
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%) !important;
  box-shadow: 0 2px 6px rgba(188, 24, 136, 0.3) !important;
}

.th-avatar.is-messenger {
  background: linear-gradient(135deg, #00B2FF 0%, #006AFF 100%) !important;
  box-shadow: 0 2px 6px rgba(0, 106, 255, 0.3) !important;
}

.th-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.pill.ch-instagram {
  background: #fdf2f8 !important;
  color: #c026d3 !important;
  border-color: #f5d0fe !important;
  font-weight: 700 !important;
}

.pill.ch-messenger {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
  font-weight: 700 !important;
}

.pill.ch-whatsapp {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
  font-weight: 700 !important;
}

.th-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.th-name-row {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.th-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.th-name-text {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.th-name .pill {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 999px;
}

.th-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.th-sub a {
  color: var(--amber-700);
  font-weight: 600;
  text-decoration: none;
}

.th-sub a:hover {
  text-decoration: underline;
}

.th-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.th-actions > button.apple-pill-btn {
  padding: 5px 9px;
  font-size: 11.5px;
  min-inline-size: 30px;
  min-block-size: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.th-actions select#thState {
  max-width: 86px;
  font-size: 11.5px;
  padding: 4px 8px;
  height: 30px;
  flex-shrink: 0;
}

.th-more-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.th-more-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  line-height: 1;
}

.th-more-badge[hidden] {
  display: none !important;
}

/* Collapse labels only on direct top-row buttons; always show labels inside the popover */
.th-actions > button .btn-label {
  display: none;
}

.th-extra-tools .btn-label,
.th-extra-tools #thArchiveBtnText {
  display: inline !important;
}

.th-more-btn:hover,
.th-more-btn.active {
  background: #e2e8f0;
  border-color: rgba(0, 0, 0, 0.15);
}

.th-more-btn.has-lead {
  color: var(--emerald-800);
  background: var(--emerald-50);
  border-color: rgba(16, 185, 129, 0.35);
}

.th-extra-tools {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 12px;
  z-index: 200;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.08);
  padding: 12px;
  width: min(310px, calc(100vw - 24px));
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  flex-direction: column;
  gap: 8px;
}

.th-extra-tools.open {
  display: flex !important;
}

.th-extra-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 2px;
}

.th-extra-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.07);
  margin: 2px 0;
}

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

.th-extra-grid button.apple-pill-btn {
  width: 100%;
  height: 32px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.th-mobile-only-state {
  display: none;
  grid-column: 1 / -1;
}

.th-menu-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.th-menu-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.th-extra-tools select.apple-pill-select {
  width: 100% !important;
  max-width: 100% !important;
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--text-main);
}

#btnToggleC360 {
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

@media (max-width: 1360px) {
  #btnToggleC360 .btn-label {
    display: none;
  }
  #btnToggleC360 {
    padding: 5px 8px;
  }
}

.apple-pill-select {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: auto;
  cursor: pointer;
}

.apple-pill-select:hover {
  background: #e2e8f0;
}

.apple-pill-btn {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

.apple-pill-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.apple-pill-btn.active {
  background: var(--amber-100);
  color: var(--amber-900);
}

/* Slim 1-Line 24h Window Status Banner */
#thWindow,
.th-window-bar {
  padding: 5px 16px;
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

#thWindow.win-open {
  background: #f0fdf4;
  color: #15803d;
}

#thWindow.win-closed {
  background: #fffbeb;
  color: #b45309;
}

/* Messages Stream Area (Maximized Vertical Space, Clean Flow) */
#thMsgs {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  margin: 0;
}

.msg {
  max-width: 68%;
  padding: 8px 13px;
  border-radius: 16px;
  white-space: normal;
  word-wrap: break-word;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
}

.msg.in {
  background: #ffffff;
  color: #0f172a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.msg.out {
  background: #dcf8c6;
  color: #0f172a;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.msg small {
  display: block;
  color: rgba(15, 23, 42, 0.48);
  font-size: 10.5px;
  margin-top: 3px;
  text-align: right;
}

.ticks {
  letter-spacing: -2px;
  margin-left: 3px;
  color: #64748b;
}

.ticks.read {
  color: #0284c7;
  font-weight: 700;
}

/* Message Timestamp & Inline Icons (Copy, Translate) */
.msg-meta-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 3px;
  font-size: 10.5px;
  line-height: 1.2;
}

.msg-meta-text {
  font-size: 10.5px;
  color: rgba(15, 23, 42, 0.48);
  white-space: nowrap;
}

.msg.out .msg-meta-text {
  color: rgba(15, 23, 42, 0.55);
}

.msg-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.msg:hover .msg-inline-actions {
  opacity: 1;
}

.msg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.msg.out .msg-icon-btn {
  color: #475569;
}

.msg-icon-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.msg-icon-btn.active {
  color: #d97706;
  background: rgba(245, 158, 11, 0.15);
}

.msg-icon-btn.copied {
  color: #16a34a !important;
  background: rgba(34, 197, 94, 0.18) !important;
}

.msg-icon-btn.is-flagged {
  color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.15) !important;
}

.msg-flag-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  line-height: 1.3;
}
.msg-flag-banner.normal {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.msg-flag-banner.high {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fda4af;
}
.msg-flag-banner.urgent {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.msg-flag-banner.star {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.msg-flag-banner .flag-note {
  font-weight: 500;
  font-style: italic;
  margin-left: 3px;
  color: rgba(15, 23, 42, 0.7);
}
.msg-flag-banner .btn-unflag-pill {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: 11px;
  opacity: 0.6;
  padding: 0 4px;
}
.msg-flag-banner .btn-unflag-pill:hover {
  opacity: 1;
}

.th-flagged-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 8px 14px;
  margin: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #991b1b;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.th-date-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 8px 14px;
  margin: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: #1e40af;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.fwd-contact-row:hover {
  background-color: #f1f5f9 !important;
}

.msg-icon-btn.translating {
  animation: pulse 1s infinite alternate;
  color: #d97706;
}

.msg-inline-translation {
  margin-top: 6px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  color: #78350f;
  animation: fadeIn 0.15s ease;
}

.msg-trans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #92400e;
  margin-bottom: 3px;
}

.msg-trans-body {
  font-size: 12px;
  line-height: 1.35;
  color: #1e293b;
  font-weight: 500;
}

.msg-trans-close {
  background: none;
  border: none;
  color: #92400e;
  font-size: 12px;
  cursor: pointer;
  padding: 0 3px;
  font-weight: bold;
}

.pwa-notif-btn {
  border-radius: 999px;
  transition: all 0.2s ease;
}

.sys {
  align-self: center;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  background: rgba(241, 245, 249, 0.9);
  padding: 3px 11px;
  border-radius: 999px;
  margin: 2px 0;
}

/* Sleek Apple iMessage Composer Bar */
.thread {
  container: thread-pane / inline-size;
}

.composer {
  padding: 8px 12px 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.composer-tpl-select {
  flex: 1 1 155px;
  min-width: 140px;
  max-width: 240px;
  height: 30px;
  font-size: 12px;
  padding: 4px 10px;
}

.composer-toolbar-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.composer-tool-btn {
  height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.composer-ai-btn {
  background: #f0fdf4 !important;
  color: #047857 !important;
  border-color: #bbf7d0 !important;
}

.composer-ai-btn[aria-expanded="true"],
.composer-ai-btn:hover {
  background: #dcfce7 !important;
  border-color: #86efac !important;
}

.composer-status {
  font-size: 11.5px;
  padding: 2px 4px;
  line-height: 1.3;
}

.composer-status:empty {
  display: none;
}

#thOrder.tplsend,
#thTpl.tplsend {
  max-height: 48dvh;
  overflow-y: auto;
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  padding: 5px 6px 5px 8px;
  transition: all 0.15s ease;
  min-width: 0;
}

.composer-media-cluster {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding-bottom: 1px;
}

.composer-media-btn {
  width: 32px;
  height: 32px;
  min-inline-size: 32px;
  min-block-size: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #475569;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.composer-media-btn:hover {
  background: rgba(15, 23, 42, 0.07);
  color: #0f172a;
}

.composer-media-btn.is-gallery {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #e9d5ff;
}

.composer-media-btn.is-gallery:hover {
  background: #ede9fe;
}

@container thread-pane (max-width: 520px) {
  .composer-tpl-select {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .composer-toolbar-pills {
    width: 100%;
  }
  .composer-toolbar-pills > .composer-tool-btn,
  .composer-toolbar-pills > .ai-polish-wrap {
    flex: 1 1 auto;
  }
  .composer-toolbar-pills > .composer-tool-btn,
  .composer-toolbar-pills .composer-ai-btn {
    width: 100%;
    justify-content: center;
  }
}

.composer-input-row:focus-within {
  background: #ffffff;
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.composer-input-row textarea {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 5px 0 !important;
  font-size: 14px;
  line-height: 1.45;
  min-height: 26px;
  max-height: 215px; /* Minimum 8-9 lines visible before scrolling */
  resize: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  font-family: inherit;
}

.send-pill-btn {
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ==========================================================================
   Universal Apple-Style Pagination Bar
   ========================================================================== */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 10px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.pagination-bar.compact {
  padding: 6px 8px;
  margin-top: 4px;
  font-size: 11px;
  border-radius: 10px;
}

.pg-info {
  font-weight: 500;
  color: var(--text-muted);
}

.pg-info b {
  color: var(--text-main);
  font-weight: 700;
}

.pg-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pg-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.pg-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--text-main);
}

.pg-btn.active {
  background: var(--amber-600);
  border-color: var(--amber-600);
  color: #ffffff;
}

.pg-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pg-size {
  padding: 3px 8px;
  font-size: 11.5px;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--text-secondary);
  width: auto;
  margin-left: 6px;
}

/* WhatsApp Mockup & Bubble Previews */
.bubble {
  background: #d9fdd3;
  border-radius: 12px;
  border-top-right-radius: 3px;
  padding: 12px 14px;
  max-width: 420px;
  white-space: normal;
  word-wrap: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin: 10px 0;
  color: #111827;
  font-size: 13px;
}

.bubble.small {
  font-size: 12px;
  max-width: 340px;
  margin: 0;
}

.bubble img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}

.bubble .bhead {
  font-weight: 700;
  margin-bottom: 5px;
  color: #0f172a;
}

.bubble .bfoot {
  color: #64748b;
  font-size: 11.5px;
  margin-top: 6px;
}

.bubble .bbtns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 7px;
}

.bubble .bbtns span {
  color: #0284c7;
  text-align: center;
  font-weight: 600;
  padding: 5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 12.5px;
}

.bubble .mediahead {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 26px 0;
  text-align: center;
  color: #475569;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.phone {
  background: #e5ddd5;
  border-radius: 22px;
  padding: 20px;
  min-height: 240px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 6px solid #1e293b;
  box-shadow: var(--shadow-md);
}

.tplsend {
  border-top: 1px dashed var(--border-color);
  margin-top: 8px;
  padding-top: 10px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

.tplsend-actions {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  padding: 8px 0 2px;
  margin-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

#thTplPreview {
  max-width: 100%;
}

#thTplPreview .mediahead-img-wrap {
  max-height: 140px;
}

#thTplPreview .mediahead-preview-img {
  max-height: 140px;
}

.tplsend label.inline input {
  width: 210px;
}

.wabtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--amber-200);
  color: var(--amber-800);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  background: var(--amber-50);
  font-size: 12.5px;
  font-weight: 600;
}

/* ==========================================================================
   Quick Replies, Drip Segmented Switcher, Settings & Logs
   ========================================================================== */

.apple-seg-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 11px;
}

.apple-seg-control button {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.apple-seg-control button:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}

.apple-seg-control button.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}

.tpl {
  background: #fbfcfd;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.tpl:hover {
  border-color: var(--amber-400);
}

.tpl .qr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tpl .qr-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tpl .qr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tpl .qr-controls select {
  padding: 4px 8px;
  font-size: 11.5px;
  border-radius: 8px;
  background: #ffffff;
  width: auto;
  flex: 1;
  min-width: 110px;
}

.tpl textarea.txt {
  background: #ffffff;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.wtgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 24px;
}

.wtbtn input {
  flex: 1;
  min-width: 120px;
}

.cvar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
}

.cvar b {
  min-width: 120px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.cvar input {
  flex: 1;
  min-width: 140px;
}

#sForm {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
  max-width: 100%;
}

@media (max-width: 768px) {
  #sForm {
    grid-template-columns: 1fr;
  }
}

#sForm .card {
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
}

#sForm label {
  display: block;
  margin-bottom: 10px;
  max-width: 100%;
  min-width: 0;
  word-break: break-word;
}

#sForm select,
#sForm input:not([type="checkbox"]) {
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.webhook-code-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 8px;
  max-width: 100%;
  box-sizing: border-box;
}

.webhook-code-box code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: #1e293b;
  user-select: all;
}

.webhook-code-box button {
  flex-shrink: 0;
}

.model-select-wrap {
  max-width: 100%;
  min-width: 0;
}

.model-select-wrap > div {
  max-width: 100%;
  min-width: 0;
}

.model-dropdown-select {
  min-width: 0;
  max-width: calc(100% - 90px);
}

.secret-field-wrap {
  max-width: 100%;
  min-width: 0;
}

.log {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-2xs);
}

.log .meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.log.in { border-left: 4px solid var(--emerald-500); }
.log.out { border-left: 4px solid var(--amber-500); }
.log.order { border-left: 4px solid var(--blue-600); }

.raw {
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  max-height: 360px;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 12px 0;
}

#qrImg {
  max-width: 240px;
  margin-top: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 8px;
  background: #fff;
}

/* Modal Dialog */
dialog:not([open]) {
  display: none !important;
}

dialog {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 560px;
  width: calc(100% - 32px);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  background: #ffffff;
  margin: auto;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

dialog h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 800;
}

pre {
  white-space: pre-wrap;
  font-family: inherit;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13.5px;
  color: var(--text-main);
  margin: 10px 0;
}

/* ==========================================================================
   Toast Notification Container
   ========================================================================== */

#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUpFade 0.2s ease-out;
  pointer-events: auto;
  border-left: 4px solid var(--amber-500);
}

.toast.bad {
  border-left-color: var(--rose-500);
  background: #881337;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Login Screen (Romford Executive Portal Style)
   ========================================================================== */

.loginpage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top right, #fef3c7 0%, #f8f9fa 45%, #f1f5f9 100%);
}

.login {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login button {
  padding: 11px 16px;
  font-size: 14px;
  margin-top: 6px;
}

/* ==========================================================================
   Multi-Drip Flow Builder & Per-Stage Controls (Apple Design System)
   ========================================================================== */

.df-split-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  min-height: calc(100vh - 240px);
  overflow: hidden;
  align-items: stretch;
  max-width: 100%;
  box-sizing: border-box;
}

.df-split-layout[hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  .df-split-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
  }
}

.df-sidebar {
  background: #f8fafc;
  border-right: 1px solid rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.df-sidebar-head {
  padding: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.df-flows-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 260px);
}

.df-flow-item {
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.07);
  border-radius: 13px;
  padding: 11px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.df-flow-item:hover {
  border-color: var(--amber-300);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.df-flow-item.active {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
  border-color: var(--amber-500);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}

.df-flow-item.is-paused {
  border-left: 3.5px solid #f59e0b;
}

.df-flow-item.is-inactive {
  opacity: 0.75;
  background: #f8fafc;
}

.df-flow-item-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.df-flow-item-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.3;
  word-break: break-word;
}

.df-flow-item-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.df-flow-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(15, 23, 42, 0.06);
}

.df-detail-pane {
  padding: 20px 22px;
  background: #ffffff;
  overflow-y: auto;
  max-height: calc(100vh - 175px);
  min-width: 0;
}

.df-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.df-title-group {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.df-name-input {
  font-size: 16px !important;
  font-weight: 800 !important;
  color: var(--text-main) !important;
  padding: 6px 10px !important;
  border: 1px solid transparent !important;
  background: #f8fafc !important;
  border-radius: 10px !important;
}

.df-name-input:focus {
  background: #ffffff !important;
  border-color: var(--amber-400) !important;
}

.df-desc-input {
  font-size: 12.5px !important;
  color: var(--text-secondary) !important;
  padding: 5px 10px !important;
  border: 1px solid transparent !important;
  background: #f8fafc !important;
  border-radius: 8px !important;
}

.df-desc-input:focus {
  background: #ffffff !important;
  border-color: var(--amber-400) !important;
}

/* 3-State Segmented Status Control (Active / Paused / Deactivated) */
.df-status-seg,
.stg-status-seg {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  gap: 2px;
}

.df-status-seg button,
.stg-status-seg button {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.df-status-seg button.active.st-active,
.stg-status-seg button.active.st-active {
  background: #dcfce7 !important;
  color: #15803d !important;
  box-shadow: 0 1px 2px rgba(21, 128, 61, 0.15) !important;
}

.df-status-seg button.active.st-paused,
.stg-status-seg button.active.st-paused {
  background: #fef3c7 !important;
  color: #b45309 !important;
  box-shadow: 0 1px 2px rgba(180, 83, 9, 0.15) !important;
}

.df-status-seg button.active.st-inactive,
.stg-status-seg button.active.st-inactive {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.12) !important;
}

.df-meta-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 12px;
  flex-wrap: wrap;
}

.df-guards {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 6px;
  flex-wrap: wrap;
}

.df-webhook-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(240, 249, 255, 0.9), rgba(248, 250, 252, 0.9));
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 11px;
  flex-wrap: wrap;
}

.df-stages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.df-stage-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  transition: all 0.15s ease;
}

.df-stage-card:hover {
  border-color: rgba(245, 158, 11, 0.45);
}

.df-stage-card.is-paused {
  border-color: #fcd34d;
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.22) 0%, #ffffff 60%);
}

.df-stage-card.is-inactive {
  opacity: 0.68;
  background: #f8fafc;
  border-style: dashed;
}

.df-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  flex-wrap: wrap;
}

.df-stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-100);
  color: var(--amber-800);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.df-stage-name {
  font-weight: 700 !important;
  font-size: 13.5px !important;
  padding: 4px 9px !important;
  min-width: 210px;
  border-radius: 8px !important;
}

.df-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: start;
  max-width: 100%;
  box-sizing: border-box;
}

.df-stage-grid > .df-msg-config {
  grid-column: 1 / -1;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .df-stage-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.df-delay-row {
  display: flex;
  gap: 6px;
}

.df-delay-row input {
  width: 76px !important;
}

.df-delay-row select {
  flex: 1;
}

.df-msg-config {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.df-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
  flex-wrap: wrap;
}

.stg-drawer-btn {
  font-size: 11.5px !important;
  padding: 4px 11px !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
}

.stg-drawer-btn.has-active {
  background: var(--amber-50) !important;
  border-color: var(--amber-300) !important;
  color: var(--amber-800) !important;
}

.stg-drawer {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 11px;
}

.stg-drawer h5 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.flow-tab-card.is-paused {
  border-color: #fcd34d;
}

.flow-tab-card.is-inactive {
  opacity: 0.72;
}

/* ==========================================================================
   Visual Journey Canvas & Flow Library Modal (anti-ui-slop + frontend-design)
   ========================================================================== */

/* View Switcher: Canvas vs List */
.df-view-toggle {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  gap: 2px;
}

.df-vt-btn {
  border: none !important;
  background: transparent !important;
  padding: 4px 12px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: none !important;
}

.df-vt-btn.active {
  background: #ffffff !important;
  color: var(--text-main) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1) !important;
}

/* Visual Canvas Layout */
.df-canvas-wrap {
  width: 100%;
  margin-top: 14px;
  position: relative;
}

.df-canvas-workspace {
  display: flex;
  position: relative;
  width: 100%;
  min-height: 540px;
  height: calc(100vh - 280px);
  max-height: 720px;
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.df-canvas-board {
  flex: 1;
  position: relative;
  overflow: auto;
  background-color: #f8fafc;
  background-image: radial-gradient(circle, #cbd5e1 1.3px, transparent 1.3px);
  background-size: 24px 24px;
  padding: 36px 40px;
  cursor: grab;
  user-select: none;
}

.df-canvas-board:active {
  cursor: grabbing;
}

.df-canvas-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.df-canvas-nodes {
  display: flex;
  align-items: center;
  gap: 56px;
  min-width: max-content;
  position: relative;
  z-index: 2;
  padding: 20px 10px;
}

/* Individual Visual Node Cards */
.df-node {
  background: #ffffff;
  border: 1.5px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  padding: 15px 16px;
  width: 270px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
}

.df-node:hover {
  border-color: var(--amber-400);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
  transform: translateY(-2px);
}

.df-node.active-node {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15), 0 8px 24px rgba(15, 23, 42, 0.08);
}

.df-node-trigger {
  border-top: 4px solid #059669;
}

.df-node-stage {
  border-top: 4px solid #2563eb;
}

.df-node-stage.is-paused {
  border-top-color: #f59e0b;
}

.df-node-stage.is-inactive {
  border-top-color: #94a3b8;
  opacity: 0.8;
}

.df-node-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.df-node-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 999px;
}

.badge-trigger {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-stage {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.df-node-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.df-node-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.df-node-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.df-node-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(15, 23, 42, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.df-node-pill.pill-delay {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.df-node-pill.pill-meta {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.df-node-preview {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
  max-height: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.df-node-preview::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(to bottom, transparent, #f8fafc);
}

.df-node-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(15, 23, 42, 0.07);
}

.df-node-action-btn {
  font-size: 11px !important;
  padding: 3px 9px !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: var(--text-secondary) !important;
  font-weight: 700 !important;
  cursor: pointer;
}

.df-node-action-btn:hover {
  background: #ffffff !important;
  border-color: var(--amber-400) !important;
  color: var(--text-main) !important;
}

/* Add Node Card (+) */
.df-node-add {
  border: 2px dashed rgba(15, 23, 42, 0.16);
  border-radius: 16px;
  width: 190px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.df-node-add:hover {
  border-color: #059669;
  background: #f0fdf4;
  color: #047857;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.08);
}

.df-node-add-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.12);
}

/* Blocks Palette Sidebar (Docked on Canvas Right) */
.df-blocks-palette {
  width: 215px;
  background: #ffffff;
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease;
  overflow: hidden;
}

.df-blocks-palette.collapsed {
  width: 0 !important;
  border-left: none !important;
}

.df-palette-head {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.df-palette-collapse-btn {
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.df-palette-collapse-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.df-palette-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.df-palette-sec-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  margin-bottom: 7px;
}

.df-palette-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.df-palette-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.df-palette-card:hover {
  border-color: #059669;
  background: #f0fdf4;
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.08);
}

.df-palette-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.p-icon-amber { background: #fef3c7; }
.p-icon-emerald { background: #ecfdf5; }
.p-icon-blue { background: #eff6ff; }
.p-icon-violet { background: #f5f3ff; }
.p-icon-rose { background: #fff1f2; }
.p-icon-purple { background: #faf5ff; }
.p-icon-cyan { background: #ecfeff; }
.p-icon-indigo { background: #e0e7ff; }

.df-palette-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

/* Canvas Floating Controls (Zoom & Minimap) */
.df-canvas-controls {
  position: absolute;
  bottom: 16px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  z-index: 5;
}

.df-ctrl-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.df-ctrl-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.df-minimap {
  width: 50px;
  height: 24px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 4px;
  margin-left: 4px;
  position: relative;
  overflow: hidden;
}

.df-minimap-track {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 20px;
  height: 14px;
  background: rgba(5, 150, 105, 0.4);
  border: 1px solid #059669;
  border-radius: 2px;
}

/* ==========================================================================
   Flow Library Modal Styles (Matches Screenshot 2)
   ========================================================================== */

.df-lib-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.df-lib-modal-backdrop[hidden] {
  display: none !important;
}

.df-lib-modal {
  width: 95vw;
  max-width: 1040px;
  height: 84vh;
  max-height: 700px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.df-lib-head {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.df-lib-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.df-lib-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.df-lib-body {
  flex: 1;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 330px;
  overflow: hidden;
  min-height: 0;
}

@media (max-width: 960px) {
  .df-lib-body {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .df-lib-filters {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .df-lib-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .df-lib-phone-preview {
    display: none !important;
  }
}

/* Col 1: Filters */
.df-lib-filters {
  background: #f8fafc;
  border-right: 1px solid rgba(15, 23, 42, 0.07);
  padding: 18px 16px;
  overflow-y: auto;
}

.df-lib-filter-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.df-lib-select {
  width: 100%;
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
}

.df-lib-goals-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.df-lib-goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.12s ease;
}

.df-lib-goal-item:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.df-lib-goal-item.active {
  background: #ffffff;
  color: #059669;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.df-lib-goal-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.df-lib-goal-item.active .df-lib-goal-radio {
  border-color: #059669;
  background: #059669;
  box-shadow: inset 0 0 0 2.5px #ffffff;
}

/* Col 2: Catalog */
.df-lib-catalog {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #ffffff;
}

.df-tpl-card {
  border: 1.5px solid rgba(15, 23, 42, 0.08);
  border-radius: 13px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
}

.df-tpl-card:hover {
  border-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.08);
}

.df-tpl-card.active {
  border-color: #059669;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2), 0 6px 18px rgba(5, 150, 105, 0.1);
}

.df-tpl-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.df-tpl-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.df-tpl-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #047857;
  background: #ecfdf5;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
}

.df-tpl-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.df-tpl-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Col 3: Phone Simulator */
.df-lib-phone-preview {
  background: #f8fafc;
  border-left: 1px solid rgba(15, 23, 42, 0.07);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  gap: 12px;
}

.df-phone-header-label {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.df-phone-device {
  width: 260px;
  height: 440px;
  background: #efeae2;
  border: 7px solid #1e293b;
  border-radius: 34px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.df-phone-notch {
  width: 80px;
  height: 14px;
  background: #1e293b;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.df-wa-header {
  background: #075e54;
  color: #ffffff;
  padding: 18px 10px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.df-wa-back {
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.df-wa-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}

.df-wa-title-wrap {
  flex: 1;
  min-width: 0;
}

.df-wa-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.df-wa-verified {
  width: 12px;
  height: 12px;
  background: #25d366;
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 900;
}

.df-wa-status {
  font-size: 8.5px;
  color: rgba(255, 255, 255, 0.75);
}

.df-wa-chat-area {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #efeae2;
  background-image: radial-gradient(#d1d5db 0.8px, transparent 0.8px);
  background-size: 16px 16px;
}

.df-wa-date-pill {
  align-self: center;
  background: rgba(255, 255, 255, 0.8);
  color: #64748b;
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.df-wa-bubble {
  background: #ffffff;
  border-radius: 10px;
  padding: 9px 10px;
  max-width: 92%;
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.df-wa-bubble-text {
  font-size: 11px;
  line-height: 1.35;
  color: #1e293b;
}

.df-wa-bubble-time {
  align-self: flex-end;
  font-size: 9px;
  color: #94a3b8;
  margin-top: 2px;
}

.df-wa-buttons-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
  padding-top: 5px;
}

.df-wa-btn {
  background: #f8fafc;
  color: #0284c7;
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 6px;
  text-align: center;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.1s ease;
}

.df-wa-btn:hover {
  background: #e0f2fe;
}

.df-phone-impact-box {
  width: 100%;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  text-align: center;
}

.df-lib-foot {
  padding: 14px 22px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #ffffff;
}

/* ==========================================================================
   Mobile Bottom Bar & Responsive Breakpoints
   ========================================================================== */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  z-index: 32;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.mobile-bottom-nav button {
  border: none;
  background: transparent;
  box-shadow: none;
  flex-direction: column;
  gap: 3px;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.mobile-bottom-nav button.active {
  color: var(--amber-700);
  font-weight: 700;
}

/* WhatsApp Business Profile (Apple Design) */
.prof-card-apple {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.prof-header-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.prof-avatar-box {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 20px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.prof-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  background: #fff;
  display: block;
}

.prof-avatar-edit-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.prof-avatar-edit-badge:hover {
  background: var(--amber-50);
  color: var(--amber-700);
  border-color: var(--amber-300);
}

.prof-identity-info {
  flex: 1;
  min-width: 0;
}

.prof-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prof-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.prof-phone-num {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prof-phone-num::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.prof-waba-sub {
  margin-top: 3px;
  font-size: 11.5px;
}

.prof-avatar-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
}

.prof-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 18px 0 16px;
}

.prof-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  font-size: 12.5px;
}

.prof-stat-tile {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prof-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prof-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-all;
}

/* WhatsApp Authentic Message Card & Template Styles */
.msg-inner-card {
  display: flex;
  flex-direction: column;
  white-space: normal;
}

.msg-body-content {
  white-space: pre-wrap;
  word-break: break-word;
}

/* WhatsApp Catalog Order Message Card */
.msg-catalog-card {
  width: 260px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  margin: -4px -6px;
  white-space: normal;
}

.catalog-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.catalog-card-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.catalog-placeholder-icon {
  color: var(--amber-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.catalog-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.catalog-items-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
}

.catalog-items-price {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.catalog-price-sub {
  font-size: 11px;
  font-weight: normal;
  color: #64748b;
}

.catalog-product-name {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #64748b;
  margin-top: 1px;
}

.catalog-cust-note {
  font-size: 11.5px;
  font-style: italic;
  color: #475569;
  margin-top: 2px;
}

.catalog-card-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.6);
  padding: 8px 12px;
  text-align: center;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.catalog-card-footer:hover {
  background: rgba(16, 185, 129, 0.12);
}

.catalog-card-footer:active {
  transform: scale(0.99);
}

.catalog-btn-text {
  font-size: 13px;
  font-weight: 600;
  color: #059669;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Sent Cart Modal Breakdown */
.cart-modal-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.cart-modal-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: #ffffff;
  align-items: center;
}

.cart-modal-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

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

.cart-modal-details {
  flex: 1;
  min-width: 0;
}

.cart-modal-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.cart-modal-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cart-modal-note-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 12.5px;
  color: #92400e;
}

.cart-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* WhatsApp Native Order / Payment Request Card */
.msg-payment-card {
  width: 280px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  margin: -4px -6px;
  white-space: normal;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.msg-payment-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
}

.pay-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.06));
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.pay-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #047857;
}

.pay-header-icon {
  color: #059669;
  flex-shrink: 0;
}

.pay-ref-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #ffffff;
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.25);
  letter-spacing: 0.3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pay-items-list {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
}

.pay-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.pay-item-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: #059669;
}

.pay-item-info {
  flex: 1;
  min-width: 0;
}

.pay-item-title {
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  font-size: 12.5px;
}

.pay-item-note {
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
  line-height: 1.3;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid #e2e8f0;
}

.pay-item-qty {
  font-weight: 500;
  color: #64748b;
  font-size: 11.5px;
  margin-top: 3px;
}

.pay-summary-box {
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
  padding: 8px 12px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.pay-total-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #64748b;
}

.pay-total-val {
  font-size: 15px;
  font-weight: 800;
  color: #047857;
}

.pay-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.pay-status-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.pay-status-paid {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.pay-status-cancelled {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.pay-status-failed {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.pay-card-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
  padding: 9px 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #059669;
  transition: background 0.15s ease;
  user-select: none;
}

.pay-card-footer:hover {
  background: #ecfdf5;
}

.pay-card-footer:active {
  transform: scale(0.99);
}

.pay-card-secured {
  font-size: 10.5px;
  color: #94a3b8;
  text-align: center;
  padding: 5px 8px 6px;
  background: #f8fafc;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Order Wizard & Responsive Dialog Container */
dialog.ow-dialog {
  max-width: 680px;
  width: 95%;
  border-radius: 20px;
  border: 1px solid var(--border-color, #e2e8f0);
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background: #ffffff;
  box-sizing: border-box;
}

dialog.ow-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog#waOrderModal.ow-dialog,
dialog#cartModal.ow-dialog,
dialog#remindModal.ow-dialog {
  max-width: 560px;
}

.ow-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  flex-shrink: 0;
}

.ow-modal-body {
  max-height: 65vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px;
  background: #fafafa;
  flex: 1 1 auto;
  min-height: 0;
}

.ow-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  flex-shrink: 0;
}

.ow-addr-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.ow-addr-state {
  grid-column: 1 / -1;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (min-width: 520px) {
  .ow-addr-grid {
    grid-template-columns: 1fr 1fr 110px;
  }
  .ow-addr-state {
    grid-column: auto;
  }
}

/* Order Creation Popup Wizard */
.ow-stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.ow-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.ow-step-item.active {
  color: #0f172a;
}

.ow-step-item.completed {
  color: #059669;
}

.ow-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.ow-step-item.active .ow-step-num {
  background: #059669;
  color: #ffffff;
}

.ow-step-item.completed .ow-step-num {
  background: #d1fae5;
  color: #047857;
}

.ow-step-divider {
  flex: 1;
  height: 1px;
  background: #e2e8f0;
  margin: 0 12px;
}

.ow-items-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ow-catalog-drawer {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.ow-items-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ow-accordion-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ow-accordion-item.open {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ow-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.15s ease;
}

.ow-accordion-header:hover {
  background: #f8fafc;
}

.ow-accordion-chevron {
  font-size: 10px;
  color: #64748b;
  width: 14px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.ow-item-title {
  font-weight: 700;
  font-size: 13.5px;
  color: #0f172a;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
  max-width: 100%;
  min-width: 0;
}

.ow-item-collapsed-summary {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ow-item-price {
  font-size: 13.5px;
  font-weight: 700;
  color: #047857;
}

.ow-accordion-body {
  padding: 12px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafafa;
}

.ow-accordion-item:not(.open) .ow-accordion-body {
  display: none;
}

.ow-accordion-item.open .ow-accordion-chevron {
  transform: rotate(90deg);
}

.ow-accordion-item.open .ow-item-collapsed-summary {
  display: none;
}

.ow-pricing-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
}

.ow-pricing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.ow-pricing-row:last-child {
  border-bottom: none;
}

.ow-pricing-row.total {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: none;
  padding-top: 10px;
  margin-top: 4px;
}

.ow-pricing-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ow-pricing-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.ow-pricing-label.total {
  font-size: 14px;
  color: #0f172a;
  font-weight: 700;
}

.ow-pricing-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 3px 8px;
  transition: border-color 0.15s ease;
}

.ow-pricing-input-wrap:focus-within {
  border-color: #059669;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12);
}

.ow-pricing-input-wrap input {
  width: 50px;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-align: right !important;
  color: #0f172a !important;
  outline: none !important;
  box-shadow: none !important;
}

.ow-pricing-unit {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
}

.ow-pricing-val {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
  min-width: 75px;
}

.ow-pricing-val.disc {
  color: #059669;
}

.ow-pricing-val.total {
  font-size: 18px;
  color: #047857;
}

@media (max-width: 480px) {
  .ow-pricing-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ow-pricing-left {
    flex: 1;
    justify-content: space-between;
  }
}

.ow-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
}

.ow-payment-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ow-pay-opt {
  cursor: pointer;
  display: block;
}

.ow-pay-opt input {
  display: none;
}

.ow-pay-opt-box {
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: #ffffff;
  transition: all 0.15s ease;
}

.ow-pay-opt input:checked + .ow-pay-opt-box {
  border-color: #059669;
  background: #f0fdf4;
}

.msg-media-banner {
  margin: -8px -13px 8px -13px;
  max-height: 180px;
  overflow: hidden;
  background: #ffffff;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.msg.in .msg-media-banner,
.msg.out .msg-media-banner {
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.msg-card-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  background: #fff;
  display: block;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.msg-card-img:hover {
  transform: scale(1.01);
}

.msg-media-doc {
  margin: -8px -13px 8px -13px;
  padding: 10px 12px;
  background: rgba(248, 250, 252, 0.9);
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.msg-doc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  color: inherit;
  text-decoration: none;
}

.msg-doc-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-doc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.msg-doc-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.msg-doc-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Media: Video Player */
.msg-media-video-wrap {
  margin: -8px -13px 8px -13px;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-card-video {
  width: 100%;
  max-width: 340px;
  max-height: 260px;
  display: block;
}

/* Media: Audio & Voice Notes */
.msg-media-audio-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  min-width: 240px;
  max-width: 320px;
}

.msg-audio-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--emerald-100);
  color: var(--emerald-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg.out .msg-audio-icon {
  background: rgba(0, 0, 0, 0.08);
  color: #1e293b;
}

.msg-card-audio {
  flex: 1;
  height: 36px;
  outline: none;
}

/* Composer Attachment Preview Bar */
.composer-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 4px;
}

.attach-preview-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.attach-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attach-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.attach-filename {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.attach-remove-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 50%;
}

.attach-remove-btn:hover {
  color: var(--rose-600);
  background: rgba(225, 29, 72, 0.1);
}

/* Voice Note Recording Bar */
.composer-voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #fef2f2;
  border-radius: 12px;
  border: 1px solid #fecaca;
  margin-bottom: 6px;
  animation: fadeInVoice 0.2s ease-out;
}

@keyframes fadeInVoice {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.voice-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: voicePulse 1.2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes voicePulse {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-status-label {
  font-size: 12px;
  font-weight: 600;
  color: #991b1b;
}

.voice-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: #dc2626;
  background: #fee2e2;
  padding: 2px 7px;
  border-radius: 6px;
}

#thVoiceBtn.recording {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}

/* Customer 360 Pincode & Delivery Checker Styles */
.c360-delivery-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.c360-delivery-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.c360-pin-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.c360-pin-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  box-sizing: border-box;
  letter-spacing: 0.5px;
}

.c360-pin-input:focus {
  background: #fff;
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.c360-pin-search-row button {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  background: #f59e0b;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.c360-pin-search-row button:hover {
  opacity: 0.9;
}

.c360-pin-search-row button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.c360-pin-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.c360-pin-select {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  box-sizing: border-box;
}

.c360-delivery-result {
  width: 100%;
  box-sizing: border-box;
}

.c360-delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
}
.c360-delivery-badge.serviceable {
  background: #dcfce7;
  color: #15803d;
}
.c360-delivery-badge.unserviceable {
  background: #fee2e2;
  color: #b91c1c;
}

.msg-body-content {
  line-height: 1.48;
  word-break: break-word;
}

.msg-body-content b {
  font-weight: 700;
  color: #0f172a;
}

.msg-tpl-footer {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(15, 23, 42, 0.52);
  font-weight: 500;
}

.msg-action-btns {
  margin: 8px -14px -9px -14px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.55);
  border-bottom-left-radius: 17px;
  border-bottom-right-radius: 17px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.msg-action-btn {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #059669;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.msg-action-btn:hover {
  background: rgba(255, 255, 255, 0.85);
}

.mediahead-img-wrap {
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: #fff;
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mediahead-preview-img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
}

.bbtns-preview {
  margin-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bbtn-pill {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #059669;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   Comprehensive Responsive System (Desktop, Laptops, Tablets, Mobile)
   ========================================================================== */

/* 1. Large Laptops & Standard Desktops (<= 1400px) */
@media (max-width: 1400px) {
  .inbox {
    grid-template-columns: 260px minmax(0, 1fr) 280px;
    gap: 10px;
  }
  .th-actions .btn-label {
    display: none;
  }
  .th-actions button.apple-pill-btn {
    padding: 5px 8px;
  }
  .th-actions select.apple-pill-select {
    max-width: 95px;
    padding: 4px 7px;
    font-size: 11.5px;
  }
}

/* 2. Compact Desktops & Laptops (901px to 1260px) */
@media (max-width: 1260px) and (min-width: 901px) {
  .inbox,
  .inbox.c360-collapsed {
    grid-template-columns: 260px minmax(0, 1fr) !important;
    position: relative;
    overflow: hidden;
  }

  .c360-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    z-index: 45;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.16);
    border-radius: 16px 0 0 16px;
    transform: translateX(105%);
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    background: #ffffff;
  }

  .inbox.c360-open .c360-panel {
    transform: translateX(0);
    display: flex !important;
  }

  .inbox.c360-collapsed .c360-panel {
    transform: translateX(105%);
  }

  .c360-close-btn {
    display: inline-flex !important;
  }

  .store-badge {
    display: none;
  }

  .topbar-search {
    max-width: 240px;
  }
}

/* 3. Small Laptops & Tablets Landscape (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 230px;
  }

  main {
    padding: 16px 18px 48px;
  }

  .overview-two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .prof-meta-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  #sForm {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 4. Tablets & Mobile (< 900px) */
@media (max-width: 900px) {
  .inbox,
  .inbox.c360-collapsed,
  .inbox.c360-open,
  .inbox.thread-active {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 100% !important;
    height: calc(100vh - 120px);
    min-height: 480px;
    position: relative;
    width: 100% !important;
    overflow: hidden;
  }

  /* Default on mobile: Show conversation list full-width, hide chat thread */
  .inbox aside.inbox-sidebar {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  .inbox .thread {
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* When a chat thread is selected: Show chat thread full-width, hide conversation list */
  .inbox.thread-active aside.inbox-sidebar {
    display: none !important;
  }

  .inbox.thread-active .thread {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  .thhead {
    position: relative;
    padding: 8px 10px;
    gap: 6px;
    min-height: 50px;
  }

  .th-identity {
    flex: 1 1 auto;
    min-width: 0;
    gap: 7px;
    overflow: hidden;
  }

  .th-back-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
  }

  .th-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .th-name {
    font-size: 13px;
  }

  .th-sub {
    font-size: 11px;
  }

  .th-extra-tools {
    right: 8px;
    left: auto;
    width: min(310px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .th-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: auto;
  }

  .th-actions select#thState {
    max-width: 82px;
    font-size: 11.5px;
    padding: 4px 6px;
  }

  #btnToggleC360 {
    padding: 5px 8px;
    font-size: 12px;
  }

  #btnToggleC360 .btn-label {
    display: none;
  }

  .c360-panel {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    z-index: 100 !important;
    transform: translateX(105%);
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .inbox.c360-open .c360-panel {
    transform: translateX(0) !important;
  }

  .inbox.c360-collapsed .c360-panel {
    transform: translateX(105%) !important;
  }

  .c360-header {
    padding: 12px 14px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    flex-shrink: 0 !important;
  }

  .c360-back-btn {
    display: inline-flex !important;
  }

  .c360-close-btn {
    display: inline-flex !important;
  }

  .topbar-search {
    display: none;
  }
}

/* 5. Mobile (< 860px) */
@media (max-width: 860px) {
  aside.sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    padding: 20px 16px !important;
    padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
  }
  .mobile-backdrop {
    z-index: 999 !important;
  }
  .mobile-signout-btn {
    display: inline-flex !important;
  }
  body.mobile-nav-open aside.sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-wrapper {
    margin-left: 0 !important;
    padding-bottom: 68px;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
    touch-action: manipulation;
  }
  .mobile-bottom-nav {
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(62px + env(safe-area-inset-bottom, 0px));
  }
  header.topbar {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
  }
  main {
    padding: 14px 12px 36px;
  }
  .store-badge {
    display: none;
  }
}

/* 6. Compact Mobile (< 640px) */
@media (max-width: 640px) {
  .th-back-btn .th-back-label {
    display: none;
  }
  .th-back-btn {
    padding: 6px !important;
    min-width: 30px;
    min-height: 30px;
  }
  .th-actions > select#thState {
    display: none;
  }
  .th-mobile-only-state {
    display: flex;
  }
  .th-extra-tools {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
}

/* 7. Ultra-Compact Mobile (< 480px) */
@media (max-width: 480px) {
  .thhead {
    padding: 6px 10px;
    gap: 6px;
  }
  .th-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .th-name {
    font-size: 13px;
  }
  .th-sub {
    font-size: 11px;
  }
  .composer {
    padding: 8px 10px 10px;
  }
  .composer-input-row {
    padding: 4px 6px 4px 10px;
  }
}
/* Create order panel */
.order-panel input{min-width:0}
.ord-results{display:flex;flex-wrap:wrap;gap:6px;max-height:190px;overflow:auto;margin:4px 0}
.ord-pick{display:flex;align-items:center;gap:8px;padding:6px 10px;text-align:left;max-width:100%}
.ord-pick img{width:34px;height:34px;object-fit:cover;border-radius:6px}
.ord-pick b{margin-left:6px;white-space:nowrap}
.ord-line{gap:6px;margin:4px 0;padding:6px 8px;border:1px solid var(--line,#e5e5ea);border-radius:10px}

/* ---------- Sales CRM ---------- */
.ld-stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ld-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-main); text-align: left; cursor: pointer; font: inherit; }
.ld-chip b { font-size: 20px; line-height: 1.1; }
.ld-chip span { font-size: 12px; font-weight: 600; }
.ld-chip small { font-size: 11px; color: var(--text-muted); }
.ld-chip.ld-kpi { cursor: default; background: transparent; border-style: dashed; }
.ld-chip.ld-won b { color: var(--emerald-600); }
.ld-chip.ld-lost b { color: var(--text-muted); }
.ld-chip.ld-payment_pending b { color: var(--amber-600); }
.ld-bulk { align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; }
.ld-auto { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.ld-check { display: inline-flex; align-items: center; gap: 6px; }
#ldTable input.ld-num { width: 90px; }
#ldTable input.ld-prod { width: 150px; }
#ldTable .ld-note { max-width: 260px; }
#ldTable input.ld-overdue { border-color: var(--amber-500); background: var(--amber-50); color: var(--amber-900); }
#thLead.is-lead { border-color: var(--emerald-500); color: var(--emerald-700); font-weight: 600; }
/* Sleek Collapsible Lead Strip */
.th-lead-bar {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  background: var(--card-bg, #ffffff);
  flex-shrink: 0;
}

.th-lead-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.03));
}

.th-lead-summary-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.lead-badge-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.lead-badge-stage {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.lead-badge-meta {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.th-lead-summary-actions {
  flex-shrink: 0;
}

.th-lead-toggle-btn {
  font-size: 11px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

.th-lead-toggle-btn:hover,
.th-lead-toggle-btn.active {
  background: #f1f5f9;
}

.th-lead-fields-wrap {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.th-lead-fields-wrap.open {
  display: flex;
}

.th-lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.th-field-label {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px;
  margin: 0 !important;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.th-field-label.full {
  grid-column: 1 / -1;
}

.th-field-label input {
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

.th-input-unit {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 8px;
  background: #ffffff;
}

.th-input-unit span {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.th-input-unit input {
  border: none !important;
  padding: 5px 0 !important;
  width: 100%;
}

.th-lead-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
#thLead { max-width: 150px; }
#ldTable .ld-note small { display: inline-block; min-width: 160px; }
.filters label.ld-check { flex: 0 0 auto; width: auto; } label.ld-check input[type=checkbox] { width: 16px !important; height: 16px; flex: 0 0 16px; }

/* ---------- Order in chat: product cards, bundle picker ---------- */
.ord-results.ord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 4px 0 8px;
  width: 100%;
  box-sizing: border-box;
}
.ord-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  font: inherit;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  white-space: normal !important;
  overflow: hidden;
}
.ord-card:hover { border-color: var(--border-hover, var(--emerald-500)); }
.ord-card.active { border-color: var(--emerald-500); box-shadow: 0 0 0 2px var(--emerald-100); }
.ord-thumb { width: 100%; height: 76px; border-radius: 8px; overflow: hidden; background: var(--bg-app, #f4f4f5); display: grid; place-items: center; font-size: 28px; flex-shrink: 0; }
.ord-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ord-card-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 31px;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal !important;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.ord-card-price { font-size: 12px; color: var(--text-secondary, var(--text-muted)); white-space: nowrap; }
.ord-card-tag { font-size: 10px; font-weight: 600; color: var(--emerald-700); background: var(--emerald-50); border-radius: 6px; padding: 1px 6px; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.ord-pick-panel {
  border: 1px solid var(--emerald-500);
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 8px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.ord-pick-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}
.ord-pick-head b {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}
.ord-opt { display: flex; flex-direction: column; gap: 4px; }
.ord-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ord-chip { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-main); font: inherit; font-size: 12px; cursor: pointer; }
.ord-chip small { color: var(--text-muted); margin-left: 2px; }
.ord-chip.on { border-color: var(--emerald-600); background: var(--emerald-50); color: var(--emerald-700); font-weight: 600; }
.ord-chip.off { opacity: .45; text-decoration: line-through; }
.ord-pick-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ord-save { font-size: 11px; font-weight: 700; color: var(--emerald-700); background: var(--emerald-100); border-radius: 6px; padding: 2px 6px; margin-left: 4px; }
.ord-line { display: flex; flex-direction: column; gap: 6px; }
.ord-line-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ord-line-title { flex: 1 1 180px; font-weight: 600; font-size: 13px; min-width: 0; }
.ord-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.ord-names input { font-size: 12px; padding: 5px 8px; }
#thOrderOpen.has-draft { border-color: var(--emerald-500); color: var(--emerald-700); }
.ord-slots { display: flex; flex-direction: column; gap: 6px; }
.ord-slot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ord-slot > span.muted { width: 22px; flex: 0 0 auto; }
.ord-slot .ol-name { flex: 1 1 160px; min-width: 0; font-size: 12.5px; padding: 6px 9px; }
.ord-slot .ol-colour { flex: 0 1 120px; font-size: 12.5px; padding: 6px 8px; }
.ord-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--border-color); flex: 0 0 auto; }
.ol-dup { font-size: 11.5px; padding: 3px 9px; }
.ord-slot .ol-name { flex: 2 1 120px; }
.ord-slot .ol-name.ol-opt { flex: 1.4 1 100px; }
.ord-col { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.ord-col .ol-colour { width: 96px; }

/* Active Reminder Banner in Chat Thread */
.th-reminder-banner {
  margin: 6px 14px 4px 14px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.th-rem-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
}

.th-rem-bar.upcoming {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.th-rem-bar.due {
  background: #fffbeb;
  border-color: #fde68a;
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.12);
}

.th-rem-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.th-rem-icon {
  font-size: 19px;
  flex-shrink: 0;
}

.th-rem-info {
  min-width: 0;
  flex: 1;
}

.th-rem-title {
  font-size: 12.5px;
  color: #334155;
  margin-bottom: 2px;
}

.th-rem-msg {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.th-rem-activity-tag {
  display: inline-block;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  margin: 2px 0;
}

.th-rem-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Product & Order Inquiry Card in Chat Bubble */
.msg-inquiry-card {
  margin-top: 8px;
  background: var(--card-bg, #ffffff);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.inquiry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.05));
  border-bottom: 1px solid rgba(16, 185, 129, 0.18);
}

.inquiry-head-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #047857;
}

.inquiry-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inquiry-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inquiry-prod-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.inquiry-prod-icon {
  font-size: 20px;
  line-height: 1;
}

.inquiry-prod-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.inquiry-prod-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  line-height: 1.3;
}

.inquiry-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: #059669;
  text-decoration: none;
}

.inquiry-link-btn:hover {
  text-decoration: underline;
  color: #047857;
}

.inquiry-detail-row {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary, #475569);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.inquiry-label {
  font-weight: 600;
  color: var(--text-muted, #64748b);
  font-size: 11.5px;
}

.inquiry-val {
  color: var(--text-main, #1e293b);
}

.inquiry-val.font-semibold {
  font-weight: 700;
  color: #047857;
}

.inquiry-resume-link {
  font-size: 11.5px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.inquiry-resume-link:hover {
  text-decoration: underline;
}

.inquiry-card-footer {
  padding: 8px 12px;
  background: var(--bg-hover, #f8fafc);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: flex-end;
}

.inquiry-make-order {
  font-size: 12px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.th-prod-link {
  color: #059669;
  text-decoration: none;
  font-weight: 600;
}

.th-prod-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   WhatsApp Customer Shared Location Card
   ========================================================================== */
.msg-location-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg, #ffffff);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-top: 6px;
  min-width: 260px;
  max-width: 340px;
}

.loc-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.05));
  border-bottom: 1px solid rgba(16, 185, 129, 0.18);
}

.loc-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loc-pin-icon {
  font-size: 15px;
  line-height: 1;
}

.loc-head-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #047857;
}

.loc-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 7px;
  border-radius: 999px;
}

.loc-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #ffffff;
}

.loc-place-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.loc-place-address {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  word-break: break-word;
}

.loc-coords-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  padding: 3px 8px;
  border-radius: 6px;
  align-self: flex-start;
  margin-top: 2px;
}

.loc-missing-hint {
  font-size: 11.5px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

.loc-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.loc-open-btn {
  flex: 1;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  border-radius: 8px !important;
}

.loc-copy-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  font-size: 11.5px !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

.loc-copy-btn:hover {
  background: #f1f5f9 !important;
}

.loc-ask-btn {
  width: 100%;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px !important;
  padding: 7px 12px !important;
  border-radius: 8px !important;
}

/* ==========================================================================
   WhatsApp Review Screenshot Generator & Clean Mobile Screenshot Mode
   ========================================================================== */

/* The Captured Phone Mockup Frame */
.wa-phone-mockup {
  width: 375px;
  max-width: 100%;
  border-radius: 28px;
  border: 4px solid #1e293b;
  background: #efeae2;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  box-sizing: border-box;
}

/* Mobile Status Bar */
.wa-mock-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.wa-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

/* WhatsApp Mobile Header */
.wa-mock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px 10px;
}
.wa-mock-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.wa-mock-back-arrow {
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  padding-right: 2px;
}
.wa-mock-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.wa-mock-contact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wa-mock-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-mock-status {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-mock-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  padding-left: 8px;
}

/* Android WhatsApp Green Theme */
.wa-phone-mockup.wa-theme-android .wa-mock-status-bar {
  background: #008069;
  color: #ffffff;
}
.wa-phone-mockup.wa-theme-android .wa-mock-header {
  background: #008069;
  color: #ffffff;
}
.wa-phone-mockup.wa-theme-android .wa-mock-avatar {
  background: #ffffff;
  color: #008069;
}
.wa-phone-mockup.wa-theme-android .wa-mock-status {
  color: rgba(255, 255, 255, 0.85);
}

/* iOS WhatsApp Theme */
.wa-phone-mockup.wa-theme-ios .wa-mock-status-bar {
  background: #f6f6f6;
  color: #0f172a;
}
.wa-phone-mockup.wa-theme-ios .wa-mock-header {
  background: #f6f6f6;
  color: #0f172a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.wa-phone-mockup.wa-theme-ios .wa-mock-avatar {
  background: #e2e8f0;
  color: #475569;
}
.wa-phone-mockup.wa-theme-ios .wa-mock-back-arrow {
  color: #007aff;
}
.wa-phone-mockup.wa-theme-ios .wa-mock-status {
  color: #64748b;
}
.wa-phone-mockup.wa-theme-ios .wa-mock-header-right {
  color: #007aff;
}

/* Verified Review Badge */
.wa-mock-verified-pill {
  background: #f0fdf4;
  color: #15803d;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-bottom: 1px solid #bbf7d0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  letter-spacing: 0.2px;
}

/* Chat Stream Area */
.wa-mock-chat-area {
  background-color: #efeae2;
  background-image: radial-gradient(#d1d7db 0.85px, transparent 0.85px);
  background-size: 18px 18px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 280px;
  flex: 1;
}
.wa-mock-date-pill {
  align-self: center;
  background: #ffffff;
  color: #54656f;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* Authentic WhatsApp Bubbles */
.wa-mock-bubble {
  max-width: 85%;
  padding: 6px 9px 4px;
  font-size: 13.5px;
  line-height: 1.38;
  position: relative;
  word-break: break-word;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
  display: flex;
  flex-direction: column;
}
.wa-mock-bubble.in {
  align-self: flex-start;
  background: #ffffff;
  color: #111b21;
  border-radius: 8px 8px 8px 2px;
}
.wa-mock-bubble.out {
  align-self: flex-end;
  background: #d9fdd3;
  color: #111b21;
  border-radius: 8px 8px 2px 8px;
}
.wa-mock-bubble-img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 4px;
  display: block;
  max-height: 240px;
  object-fit: cover;
}
.wa-mock-bubble-meta {
  font-size: 10.5px;
  color: #667781;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  margin-left: 8px;
}
.wa-mock-ticks {
  color: #53bdeb;
  font-weight: 700;
  font-size: 11px;
}

/* WhatsApp Mobile Input Bar */
.wa-mock-input-bar {
  background: #efeae2;
  padding: 6px 10px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-mock-input-field {
  flex: 1;
  background: #ffffff;
  border-radius: 20px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}
.wa-mock-input-placeholder {
  flex: 1;
  font-size: 13.5px;
  color: #8696a0;
}
.wa-mock-input-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8696a0;
}
.wa-mock-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #008069;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.wa-phone-mockup.wa-theme-ios .wa-mock-mic-btn {
  background: #007aff;
}

/* Review Message Checkbox Picker */
.wa-review-msg-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s ease;
}
.wa-review-msg-opt:hover {
  background: #f1f5f9;
}
.wa-review-msg-opt input {
  margin-top: 2px;
  cursor: pointer;
}
.wa-review-msg-opt.is-in {
  border-left: 3px solid #3b82f6;
}
.wa-review-msg-opt.is-out {
  border-left: 3px solid #10b981;
}

/* ==========================================================================
   Clean Mobile WhatsApp View (Direct Screen Capture Mode)
   ========================================================================== */
body.clean-wa-mode #header,
body.clean-wa-mode #sidebar,
body.clean-wa-mode #inboxList,
body.clean-wa-mode #c360,
body.clean-wa-mode #thWindow,
body.clean-wa-mode #thLeadBar,
body.clean-wa-mode #thReminderBanner,
body.clean-wa-mode #aiCopilotStrip,
body.clean-wa-mode #composer,
body.clean-wa-mode .mobile-bottom-tabs,
body.clean-wa-mode #thMoreMenu,
body.clean-wa-mode .th-actions,
body.clean-wa-mode .th-lead-bar,
body.clean-wa-mode .msg-inline-actions,
body.clean-wa-mode .msg-flag-banner,
body.clean-wa-mode .btn-unflag-pill {
  display: none !important;
}

body.clean-wa-mode #thMsgs {
  background-color: #efeae2 !important;
  background-image: radial-gradient(#d1d7db 0.85px, transparent 0.85px) !important;
  background-size: 18px 18px !important;
  padding: 12px !important;
}

body.clean-wa-mode .msg.in {
  background: #ffffff !important;
  border-radius: 8px 8px 8px 2px !important;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13) !important;
  color: #111b21 !important;
}
body.clean-wa-mode .msg.out {
  background: #d9fdd3 !important;
  border-radius: 8px 8px 2px 8px !important;
  box-shadow: 0 1px 0.5px rgba(11,20,26,0.13) !important;
  color: #111b21 !important;
}
body.clean-wa-mode .msg-meta-text {
  color: #667781 !important;
}

/* Floating Exit Bar in Clean Screenshot Mode */
.wa-clean-exit-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.wa-clean-exit-btn {
  background: #ffffff;
  color: #0f172a;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.wa-clean-exit-btn.primary {
  background: #10b981;
  color: #ffffff;
}

.ai-copilot-strip[hidden],
.ai-copilot-strip.is-hidden {
  display: none !important;
}

.ai-copilot-strip {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 8px 10px;
  margin: 6px 12px 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.ai-copilot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.ai-copilot-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #047857;
  flex-shrink: 0;
}

.ai-suggestion-bubble {
  width: 100%;
  box-sizing: border-box;
  font-size: 12.5px;
  color: #0f172a;
  line-height: 1.4;
  cursor: pointer;
  background: #ffffff;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #d1fae5;
  max-height: 78px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-suggestion-bubble:hover {
  background: #f8fafc;
}

.ai-copilot-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
}

.ai-copilot-actions button {
  font-size: 11.5px !important;
  padding: 4px 9px !important;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-copilot-actions .ai-send-btn {
  background: #059669 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
}

/* Polish / Translate Dropdown */
.ai-polish-wrap {
  position: relative;
  display: inline-flex;
}

.ai-polish-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  left: auto;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18), 0 3px 10px rgba(15, 23, 42, 0.08);
  padding: 8px 6px;
  z-index: 200;
  width: min(245px, calc(100vw - 24px));
  max-height: 60dvh;
  overflow-y: auto;
}

.ai-menu-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px 3px;
}

.ai-menu-divider {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 5px 6px;
}

.ai-menu-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.ai-menu-action-btn:hover {
  background: #f0fdf4;
  color: #047857;
}

.ai-menu-item {
  padding: 7px 10px;
  font-size: 12px;
  color: #1e293b;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-menu-item:hover {
  background: #f1f5f9;
  color: #047857;
}

/* Customer 360 AI Insights Card */
.c360-ai-card {
  background: linear-gradient(135deg, #f0fdf4, #f8fafc);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}

.c360-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-bottom: 6px;
}

.c360-ai-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #047857;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c360-temp-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

.c360-temp-badge.hot {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.c360-temp-badge.cold {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #bae6fd;
}

.c360-ai-summary {
  font-size: 12px;
  color: #334155;
  line-height: 1.45;
  margin: 0;
}

.c360-ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.c360-ai-action {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
}

/* Voice Note Transcription Card */
.msg-audio-transcript {
  margin-top: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11.5px;
}

.transcript-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #059669;
  font-size: 11px;
  margin-bottom: 2px;
}

.transcript-body {
  color: #334155;
  font-style: italic;
  line-height: 1.35;
}

.msg-transcribe-btn {
  margin-top: 6px;
  font-size: 11px !important;
  padding: 3px 8px !important;
  background: #f0fdf4 !important;
  color: #047857 !important;
  border: 1px solid #bbf7d0 !important;
}

/* ==========================================================================
   Mobile Bottom-Sheet Modals & Responsive Dialogs (< 680px)
   ========================================================================== */
@media (max-width: 680px) {
  dialog.ow-dialog[open],
  dialog.apple-modal[open],
  dialog#ordWizardModal[open],
  dialog#waOrderModal[open],
  dialog#cartModal[open],
  dialog#remindModal[open],
  dialog#wtPreviewModal[open],
  dialog#preview[open],
  dialog#ticketModal[open],
  dialog#newChatModal[open] {
    width: 100% !important;
    max-width: 100% !important;
    height: 94dvh !important;
    height: 94vh !important;
    max-height: 94dvh !important;
    max-height: 94vh !important;
    margin: auto auto 0 auto !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25) !important;
  }

  .ow-modal-header {
    padding: 12px 14px !important;
    flex-shrink: 0 !important;
  }

  .ow-stepper-bar {
    padding: 8px 10px !important;
    flex-shrink: 0 !important;
  }

  .ow-step-item {
    font-size: 11px !important;
    gap: 4px !important;
  }

  .ow-step-num {
    width: 20px !important;
    height: 20px !important;
    font-size: 10.5px !important;
  }

  .ow-step-divider {
    margin: 0 3px !important;
  }

  .ow-modal-body {
    max-height: none !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 14px 12px 24px !important;
  }

  .ow-modal-footer {
    padding: 10px 14px !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08) !important;
    background: #ffffff !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .ow-modal-footer button {
    min-height: 38px !important;
  }

  #ticketModal[open],
  #newChatModal[open] {
    padding: 16px 14px !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Responsive filters across all screens */
  .filters {
    flex-wrap: wrap !important;
    padding: 10px 12px !important;
  }
  .filters input {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .filters select {
    flex: 1 1 auto !important;
    min-width: 120px !important;
  }

  /* Clean wrapping composer toolbar on mobile (no horizontal clipping) */
  .composer-toolbar {
    flex-wrap: wrap !important;
    gap: 6px !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
  }
  .composer-tpl-select {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .composer-toolbar-pills {
    width: 100%;
    gap: 5px;
  }
}

/* =========================================================================
   EXECUTIVE ANALYTICS & END-OF-DAY (EOD) COMMAND CENTER
   ========================================================================= */

.side-nav .nav-section + .nav-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.eod-command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1180px) {
  .eod-command-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.eod-pillar-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-top: 3px solid #cbd5e1;
}

.eod-pillar-card.eod-happened {
  border-top-color: #10b981;
}

.eod-pillar-card.eod-pending {
  border-top-color: #f59e0b;
}

.eod-pillar-card.eod-scheduled {
  border-top-color: #3b82f6;
}

.eod-pillar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 12px;
}

.eod-pillar-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eod-pillar-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.eod-pillar-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.happened-icon { background: #ecfdf5; }
.pending-icon { background: #fffbeb; }
.scheduled-icon { background: #eff6ff; }

.eod-pillar-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 2px;
}

.eod-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  font-size: 12.5px;
}

.eod-metric-row .m-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #334155;
  font-weight: 600;
}

.eod-metric-row .m-val {
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

.eod-metric-row .m-sub {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: #64748b;
}

.eod-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
}

.eod-subtab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.eod-subtab span {
  background: rgba(15, 23, 42, 0.08);
  padding: 1px 5px;
  border-radius: 99px;
  font-size: 10px;
}

.eod-subtab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.eod-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #ffffff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.eod-list-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.eod-item-main {
  min-width: 0;
  flex: 1;
}

.eod-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.eod-item-sub {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.eod-day-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.eod-day-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.eod-day-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.eod-day-chip.active,
.eod-day-chip.active.is-tomorrow {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1.5px #3b82f6;
}

.eod-day-chip.is-overdue {
  background: #fff5f5;
  border-color: #fca5a5;
}

.eod-day-chip.is-overdue:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.eod-day-chip.is-overdue.active {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1.5px #ef4444 !important;
}

.eod-day-chip.is-overdue .d-name {
  color: #b91c1c !important;
}

.eod-day-chip.is-overdue .d-cnt {
  color: #dc2626 !important;
}

.eod-day-chip.is-tomorrow {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.eod-day-chip .d-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  display: block;
}

.eod-day-chip.is-tomorrow .d-name,
.eod-day-chip.active .d-name {
  color: #1d4ed8;
}

.eod-day-chip .d-cnt {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

/* P&L & Marketing Hero KPI Cards (Structured 3-tier layout) */
.pnl-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 1440px) {
  .pnl-hero-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1439px) and (min-width: 960px) {
  .pnl-hero-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.pnl-hero-card {
  padding: 13px 15px !important;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-height: 110px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pnl-hero-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.06);
}

.pnl-hero-card .pnl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-height: 22px;
}

.pnl-hero-card .pnl-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pnl-hero-card .pnl-card-value {
  font-size: 20px;
  font-weight: 800;
  margin: 4px 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.3px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pnl-hero-card .pnl-card-footer {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid rgba(0,0,0,0.05);
  padding-top: 5px;
  margin-top: auto;
}

/* Daily Performance & Marketing Acquisition Efficiency Grid */
.pnl-efficiency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

@media (min-width: 1440px) {
  .pnl-efficiency-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1439px) and (min-width: 960px) {
  .pnl-efficiency-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

.pnl-eff-card {
  padding: 11px 13px !important;
  border-radius: 8px;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-height: 86px !important;
  box-sizing: border-box;
}

/* Reconciliation KPI Cards Grid */
.rec-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 1280px) {
  .rec-kpis-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

/* Marketing Studio Summary Score Strip */
.mkt-studio-score-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 1280px) {
  .mkt-studio-score-strip {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }
}

/* 14-Day Interactive Bar Chart */
.an-trend-chart {
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 20px 6px 4px 6px;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.an-bar-col {
  flex: 1;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.an-bar-val {
  font-size: 9.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
  white-space: nowrap;
}

.an-bar-pair {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 100%;
  justify-content: center;
  height: 155px;
}

.an-bar {
  width: 12px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  transition: height 0.25s ease;
  min-height: 3px;
}

.an-bar.secondary {
  background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%);
}

.an-bar.amber {
  background: linear-gradient(180deg, #fcd34d 0%, #d97706 100%);
}

.an-bar-lbl {
  font-size: 10px;
  color: #64748b;
  margin-top: 6px;
  white-space: nowrap;
}

/* Conversion Funnel Bars */
.an-funnel-stage {
  margin-bottom: 10px;
}

.an-funnel-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.an-funnel-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.an-funnel-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.an-range-btn.active,
.an-chart-mode.active,
.an-prod-mode.active {
  background: #4A2511 !important;
  color: #ffffff !important;
  border-color: #4A2511 !important;
}

/* ==========================================================================
   BOMMA BRAND IDENTITY & 10/10 EXECUTIVE UI/UX DESIGN SYSTEM (v11.0)
   ========================================================================== */

:root {
  --bomma-espresso: #4A2511;
  --bomma-espresso-dark: #36190A;
  --bomma-espresso-light: #6B381D;
  --bomma-coral: #E84A5F;
  --bomma-coral-soft: #FFF0F2;
  --bomma-sage: #3D8B6E;
  --bomma-sage-soft: #ECFDF5;
  --bomma-cream: #FDF8F5;
  --bomma-sand: #F7EFEA;
  --bg-app: #FAF7F5;
}

/* 1. Bomma Brand Logo Marks (Sidebar & Topbar) */
.bomma-logo-mark {
  width: 44px !important;
  height: 44px !important;
  background: #FDF8F5 !important;
  border: 1.5px solid rgba(74, 37, 17, 0.16) !important;
  border-radius: 12px !important;
  padding: 2px !important;
  box-shadow: 0 4px 12px rgba(74, 37, 17, 0.12) !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bomma-sidebar-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 9px;
}

.brand-name {
  color: var(--bomma-espresso-dark);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-badge {
  background: var(--bomma-coral-soft) !important;
  color: var(--bomma-coral) !important;
  border-color: rgba(232, 74, 95, 0.25) !important;
  font-weight: 800 !important;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bomma-cream) !important;
  border: 1px solid rgba(74, 37, 17, 0.14) !important;
  color: var(--bomma-espresso) !important;
  font-weight: 700 !important;
  padding: 5px 12px 5px 8px !important;
  border-radius: 999px !important;
  box-shadow: 0 1px 3px rgba(74, 37, 17, 0.06);
}

.store-badge-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(74, 37, 17, 0.12);
}

/* 2. Sidebar Profile Card & Active Navigation Polish */
.profile-card {
  background: linear-gradient(135deg, #FDF8F5 0%, #F8FAFC 100%) !important;
  border: 1px solid rgba(74, 37, 17, 0.13) !important;
  box-shadow: 0 2px 6px rgba(74, 37, 17, 0.04);
}

.profile-avatar {
  background: linear-gradient(135deg, var(--bomma-espresso) 0%, var(--bomma-coral) 100%) !important;
  box-shadow: 0 3px 8px rgba(74, 37, 17, 0.25) !important;
}

.nav-item {
  border-radius: 13px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item:hover {
  background: var(--bomma-cream);
  border-color: rgba(74, 37, 17, 0.12);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, #FDF8F5 0%, #FFFBEB 100%) !important;
  border-color: rgba(74, 37, 17, 0.28) !important;
  box-shadow: 0 4px 12px rgba(74, 37, 17, 0.08) !important;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 22%;
  height: 56%;
  width: 4px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--bomma-espresso) 0%, var(--bomma-coral) 100%);
}

.nav-item.active .nav-title {
  color: var(--bomma-espresso-dark) !important;
  font-weight: 800 !important;
}

/* 3. Topbar & Primary Action Buttons */
header.topbar {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(74, 37, 17, 0.09) !important;
}

button.primary,
.btn.primary,
.primary-btn {
  background: linear-gradient(135deg, var(--bomma-espresso) 0%, var(--bomma-espresso-light) 100%) !important;
  border-color: var(--bomma-espresso-dark) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(74, 37, 17, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
}

button.primary:hover,
.btn.primary:hover,
.primary-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(74, 37, 17, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

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

/* 4. 10/10 Executive Typography, Tabular Figures & Surface Hierarchy */
.stat-value,
.an-kpi-val,
.eod-kpi-val,
.badge,
.nav-badge,
td,
.chat-time {
  font-variant-numeric: tabular-nums;
}

.card,
.stat-card,
.an-kpi-card {
  border-radius: 16px !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 6px 16px -4px rgba(74, 37, 17, 0.04) !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.stat-card:hover,
.an-kpi-card:hover {
  border-color: rgba(74, 37, 17, 0.18) !important;
  box-shadow: 0 10px 24px -6px rgba(74, 37, 17, 0.09) !important;
  transform: translateY(-1px);
}

/* Crisp Tactile Inputs & Focus States */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: var(--bomma-espresso) !important;
  box-shadow: 0 0 0 3.5px rgba(74, 37, 17, 0.11) !important;
}

/* Polished Table Headers & Hover States */
table thead th {
  background: #FAF7F5 !important;
  color: #4A2511 !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em;
  border-bottom: 1.5px solid #EBE3DD !important;
}

table tbody tr {
  transition: background-color 0.12s ease;
}

table tbody tr:hover {
  background-color: #FDF9F6 !important;
}

/* ==========================================================================
   POWER BI & ZOHO ANALYTICS STUDIO COMPONENTS
   ========================================================================== */

.bi-slicer-select {
  width: auto !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 9px !important;
  background: #FAF7F5 !important;
  border: 1px solid rgba(74, 37, 17, 0.16) !important;
  color: #1e293b !important;
  cursor: pointer;
}

.bi-scorecards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 14px;
}

.bi-scorecard {
  padding: 14px 16px !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #FDFBF9 100%) !important;
}

.bi-scorecard:hover {
  transform: translateY(-2px);
  border-color: rgba(74, 37, 17, 0.22) !important;
  box-shadow: 0 12px 24px -6px rgba(74, 37, 17, 0.1) !important;
}

.bi-sc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bi-sc-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.bi-sc-mid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.bi-sc-val {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.bi-sc-sub {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 3px;
}

.bi-sc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.bi-delta-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bi-delta-up {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.bi-delta-down {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.bi-delta-flat {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.bi-rfm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.bi-rfm-card {
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.bi-rfm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(74, 37, 17, 0.12);
}

.bi-hm-mode.active {
  background: #4A2511 !important;
  color: #ffffff !important;
  border-color: #4A2511 !important;
}

/* ==========================================================================
   MOBILE-FIRST RESPONSIVE SYSTEM across ALL 19 SCREENS (v53.0)
   Fixes card right-edge clipping, Live Chat header/composer fit,
   message timestamp wrapping, and form/filter/grid responsiveness on phones.
   ========================================================================== */

/* Prevent any child element (long URLs, code tags, tables, flex rows) from expanding
   CSS Grid `1fr` tracks beyond the mobile viewport width */
.main-wrapper,
main,
section.tab,
.card,
.stat-card,
.bi-scorecard,
.bi-rfm-card,
.eod-pillar-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

code {
  word-break: break-all;
  overflow-wrap: anywhere;
}

#hookInfo p,
#hookInfo li,
#hookInfo div {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.eod-pillar-header {
  flex-wrap: wrap;
}

.eod-pillar-title {
  min-width: 0;
  flex: 1 1 180px;
}

.eod-metric-row {
  gap: 8px;
}

.eod-metric-row .m-label {
  min-width: 0;
  flex: 1 1 auto;
}

.eod-metric-row .m-val {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  /* Lock Live Chat (#inbox) to exact dynamic viewport height on mobile phones
     so the chat header (.thhead) is NEVER scrolled under the topbar */
  body.tab-inbox .main-wrapper {
    padding-bottom: 0 !important;
  }

  body.tab-inbox main {
    padding: 6px 8px calc(66px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .inbox,
  .inbox.c360-collapsed,
  .inbox.c360-open,
  .inbox.thread-active {
    height: calc(100dvh - 56px - 62px - 14px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    min-height: 360px !important;
    max-height: calc(100dvh - 56px - 62px - 14px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 14px !important;
  }

  .inbox .thread {
    overflow: hidden !important;
  }

  .thhead {
    flex-shrink: 0 !important;
    z-index: 60 !important;
    background: #ffffff !important;
    padding: 8px 10px !important;
  }

  .messages {
    padding: 12px 10px !important;
    overflow-x: hidden !important;
  }

  /* Message bubbles & metadata wrapping on mobile phones */
  .msg {
    max-width: 88% !important;
    padding: 8px 11px !important;
    word-break: break-word;
  }

  .msg-meta-line {
    flex-wrap: wrap !important;
    gap: 4px 6px !important;
    max-width: 100% !important;
  }

  .msg.out .msg-meta-line {
    justify-content: flex-end !important;
  }

  .msg-meta-text {
    white-space: normal !important;
    word-break: break-word !important;
    text-align: right;
    line-height: 1.25 !important;
    font-size: 10px !important;
  }

  .msg.in .msg-meta-text {
    text-align: left;
  }

  /* Rich message cards inside chat bubbles on mobile */
  .msg-inquiry-card,
  .msg-location-card,
  .msg-payment-card,
  .msg-catalog-card,
  .msg-order-card {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* AI Suggestion strip & Composer on mobile */
  .ai-copilot-strip[hidden],
  .ai-copilot-strip.is-hidden {
    display: none !important;
  }
  .ai-copilot-strip:not([hidden]) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 7px 10px !important;
    gap: 6px !important;
    margin: 4px 6px !important;
  }

  .ai-copilot-head {
    gap: 6px !important;
  }

  .ai-copilot-label {
    display: flex !important;
    align-items: center !important;
    font-size: 11px !important;
    color: #047857 !important;
    flex-shrink: 0 !important;
  }

  .ai-suggestion-bubble {
    font-size: 12px !important;
    line-height: 1.38 !important;
    max-height: 82px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    display: block !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    border: 1px solid #a7f3d0 !important;
  }

  .ai-copilot-actions {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    width: auto !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }

  .ai-copilot-actions button {
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .ai-copilot-chips {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .ai-copilot-chips .ai-chip {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .composer {
    padding: 6px 8px 8px !important;
    flex-shrink: 0 !important;
  }

  .composer-toolbar {
    gap: 5px !important;
    padding-bottom: 0 !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
  }

  .composer-tool-btn {
    flex-shrink: 0;
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    height: 30px !important;
  }

  .composer-input-row {
    padding: 4px 6px 4px 6px !important;
    gap: 4px !important;
  }

  .composer-media-btn {
    width: 34px !important;
    height: 34px !important;
    min-inline-size: 34px !important;
    min-block-size: 34px !important;
  }

  .composer-input-row textarea#thText {
    font-size: 14px !important;
    min-height: 28px !important;
    max-height: 125px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .send-pill-btn {
    padding: 6px 12px !important;
    font-size: 12.5px !important;
    flex-shrink: 0;
  }
}

@media (max-width: 400px) {
  .send-pill-btn .send-btn-label {
    display: none;
  }
  .send-pill-btn {
    padding: 7px 10px !important;
  }
  .composer-media-btn {
    width: 30px !important;
    height: 30px !important;
    min-inline-size: 30px !important;
    min-block-size: 30px !important;
  }
}

@media (max-width: 860px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .app-shell,
  .main-wrapper {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  main {
    padding: 12px 10px 32px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }

  /* Topbar mobile spacing & button sizing */
  header.topbar {
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    gap: 8px !important;
  }

  .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    gap: 8px !important;
  }

  .page-breadcrumb {
    font-size: 15px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    gap: 6px !important;
    flex-shrink: 0;
  }

  /* All multi-column grids collapse cleanly to minmax(0, 1fr) on mobile */
  .overview-two-col,
  .eod-command-grid,
  .bi-scorecards-grid,
  .bi-rfm-grid,
  .qr-grid,
  .wtgrid,
  .prof-meta-grid,
  #sForm,
  .df-split-layout,
  .df-stage-grid,
  .grid2,
  .grid3 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* KPI Stat cards: 2 per row on phone so numbers have plenty of room */
  .grid#stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .stat-card {
    padding: 12px !important;
  }

  .stat-value {
    font-size: 20px !important;
  }

  /* Section headers & filter bars wrap cleanly on mobile */
  .section-header,
  .an-filter-bar,
  .card > .row.between {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .section-header > .row,
  .an-filter-bar > .row {
    width: 100%;
    flex-wrap: wrap !important;
  }

  /* Slicers & Filter controls on mobile */
  .bi-slicer-select {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 120px !important;
  }

  .an-date-range-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }

  .an-date-range-pills .an-range-btn {
    flex-shrink: 0;
  }

  /* Drip Flow Builder (#templates) mobile layout */
  .df-sidebar {
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    max-height: 240px !important;
    overflow-y: auto !important;
  }

  .df-detail-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .df-detail-actions {
    width: 100%;
    flex-wrap: wrap !important;
  }

  /* Meta Templates (#watemplates) handset preview on mobile */
  .wtpreview {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Profile banner (#profile) on mobile */
  .prof-banner-inner {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .prof-banner-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Modals & Dialogs on mobile */
  dialog {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: 92dvh !important;
    margin: auto !important;
    border-radius: 16px !important;
  }

  .ow-stepper-bar {
    padding: 8px 10px !important;
    gap: 4px !important;
    overflow-x: auto;
  }

  .ow-step-label {
    font-size: 11px !important;
  }
}

@media (max-width: 480px) {
  /* Compact notification button on narrow phones */
  .pwa-notif-btn .notif-label {
    display: none;
  }

  .card {
    padding: 13px 12px !important;
  }

  .eod-day-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ld-stages {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #biDrillToolbar {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  #biDrillSearch {
    max-width: 100% !important;
    width: 100% !important;
  }

  #biDrillSubtabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  #biDrillSubtabs .eod-subtab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

.eod-metric-row[data-scorecard-drill]:hover {
  border-color: rgba(74, 37, 17, 0.25);
  background: #FAF7F5;
}

/* Meta Ads Campaign Insights Table */
#pnlCampaignsTable {
  border-collapse: collapse;
  width: 100%;
}
#pnlCampaignsTable th,
#pnlCampaignsTable td {
  white-space: nowrap;
}
#pnlCampaignsTable td:not(:first-child),
#pnlCampaignsTable th:not(:first-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
#pnlCampaignsTable tfoot tr {
  border-top: 2px solid #cbd5e1;
  background: #f8fafc;
}

/* Dual-Month Date Range Picker (Meta Ads / Shopify Style) */
.date-range-picker-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.drp-day-cell {
  position: relative;
  height: 33px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: #0f172a;
  cursor: pointer;
  user-select: none;
  transition: all 0.1s ease;
  z-index: 1;
}

.drp-day-cell:hover:not(.drp-empty):not(.drp-selected-start):not(.drp-selected-end) {
  background-color: #f0f9ff;
  border-radius: 6px;
}

.drp-day-cell.drp-empty {
  cursor: default;
  pointer-events: none;
}

.drp-day-cell.drp-in-range {
  background-color: #bae6fd !important;
  color: #0369a1 !important;
  font-weight: 600;
}

.drp-day-cell.drp-selected-start {
  background-color: #0070e0 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
}

.drp-day-cell.drp-selected-end {
  background-color: #0070e0 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

.drp-day-cell.drp-selected-start.drp-selected-end {
  border-radius: 8px !important;
}

.drp-nav-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.drp-nav-btn:hover {
  background-color: #f1f5f9;
}

.drp-month-select,
.drp-year-select {
  border: 1px solid transparent !important;
  border-radius: 6px;
  padding: 3px 6px !important;
  transition: all 0.15s ease;
}

.drp-month-select:hover,
.drp-year-select:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1 !important;
}

@media (max-width: 640px) {
  #drpCalendars {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}





/* ---------- Plan locks (features not in this account's package) ---------- */
.nav-item.nav-locked .nav-text,
.nav-item.nav-locked .nav-icon-tile { opacity: 0.5; }
.nav-item.nav-locked:hover { background: transparent; border-color: var(--border-color); }
.nav-item.nav-locked:hover .nav-icon-tile { transform: none; }
.nav-lock { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; line-height: 1; pointer-events: none; }
.side-nav .nav-item.nav-locked { padding-right: 28px; }
body.sidebar-collapsed .nav-lock { right: 2px; top: 6px; transform: none; }
.plan-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 8px 16px;
  background: var(--amber-100);
  color: var(--amber-900);
  border-bottom: 1px solid var(--amber-200);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.upgrade-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 22px;
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.upgrade-dialog::backdrop { background: rgba(15, 23, 42, 0.35); }
.upgrade-dialog h3 { margin: 0 0 8px; font-size: 16px; }
.upgrade-dialog p { margin: 0; color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }
.upgrade-go { text-decoration: none; display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 10px; }
.upgrade-go[hidden] { display: none; }

/* Quoted message inside chat bubble */
.msg-quote-preview {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 6px;
  cursor: pointer;
  border-left: 3.5px solid #16a34a;
  transition: background 0.15s ease;
}
.msg.in .msg-quote-preview {
  background: #f1f5f9;
  border-left-color: #2563eb;
}
.msg.out .msg-quote-preview {
  background: rgba(0, 0, 0, 0.06);
  border-left-color: #15803d;
}
.msg-quote-preview:hover {
  background: rgba(0, 0, 0, 0.09);
}
.msg-quote-body {
  padding: 5px 8px;
  font-size: 11.5px;
  line-height: 1.35;
  min-width: 0;
  flex: 1;
}
.msg-quote-author {
  display: block;
  font-weight: 700;
  font-size: 11px;
  color: #15803d;
  margin-bottom: 2px;
}
.msg.in .msg-quote-author {
  color: #2563eb;
}
.msg-quote-snippet {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #334155;
  font-size: 11.5px;
  word-break: break-word;
}

/* Active reply banner in composer */
.composer-reply-preview {
  display: flex;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3.5px solid #16a34a;
  border-radius: 10px;
  padding: 6px 10px;
  margin: 6px 0 8px;
  animation: slideDown 0.15s ease-out;
}
.reply-preview-body {
  flex: 1;
  min-width: 0;
}
.reply-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reply-preview-label {
  font-size: 11px;
  color: #16a34a;
}
.reply-preview-label b {
  font-weight: 700;
}
.reply-cancel-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.reply-cancel-btn:hover {
  color: #0f172a;
}
.reply-preview-text {
  font-size: 12px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.msg-card-highlight {
  animation: quoteHighlight 1.5s ease;
}
@keyframes quoteHighlight {
  0% { transform: scale(1); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.6); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.3); }
  100% { transform: scale(1); box-shadow: none; }
}

/* Global Inbox Keyword & In-Chat Search Highlighting */
.msg-search-highlight-pulse {
  animation: msgSearchPulse 2.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  position: relative;
  z-index: 5;
  border-radius: 12px;
}
@keyframes msgSearchPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.85);
    background-color: rgba(254, 240, 138, 0.55);
  }
  25% {
    transform: scale(1.02);
    box-shadow: 0 0 0 8px rgba(234, 179, 8, 0.45);
    background-color: rgba(254, 240, 138, 0.45);
  }
  50% {
    transform: scale(1.01);
    box-shadow: 0 0 0 12px rgba(234, 179, 8, 0.25);
    background-color: rgba(254, 240, 138, 0.3);
  }
  75% {
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(234, 179, 8, 0.1);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
    background-color: transparent;
  }
}

mark.search-term-mark {
  background-color: #fef08a;
  color: #854d0e;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
}

mark.inchat-search-mark {
  background-color: #fef08a;
  color: #854d0e;
  padding: 1px 2px;
  border-radius: 3px;
  transition: all 0.15s ease;
}

mark.inchat-search-mark.current {
  background-color: #ea580c;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.4);
}

.conv.conv-search-result {
  cursor: pointer;
  transition: all 0.18s ease;
  border-left: 3px solid #3b82f6;
  padding-bottom: 8px;
}

.conv.conv-search-result:hover {
  background: rgba(248, 250, 252, 0.98);
}

.search-match-item:hover {
  background: rgba(224, 242, 254, 0.95) !important;
  border-color: #93c5fd !important;
}

.pill-in {
  background: #dbeafe !important;
  color: #1e40af !important;
}

.pill-out {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.ib-search-clear-btn:hover {
  color: #0f172a !important;
}

/* A/B Testing & Impact Analysis Responsive */
@media (max-width: 900px) {
  #expWorkspaceLayout {
    grid-template-columns: 1fr !important;
  }
  #expAiFeedbackGrid {
    grid-template-columns: 1fr !important;
  }
}

.exp-metric-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.exp-metric-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

/* Custom Modal Backdrop & Box Overlays */
.modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  padding: 16px !important;
  animation: modalOverlayFadeIn 0.18s ease-out;
}

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

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

@keyframes modalBoxPopIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-box {
  background: #ffffff !important;
  border-radius: 20px !important;
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  max-width: 680px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  color: #0f172a !important;
  animation: modalBoxPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 18px 24px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  background: #fafafa !important;
  border-top-left-radius: 20px !important;
  border-top-right-radius: 20px !important;
}

.modal-header h3 {
  margin: 0 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}

.apple-btn-emerald {
  background: #059669 !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
  border-radius: 980px !important;
  font-weight: 600 !important;
  padding: 9px 24px !important;
  font-size: 13.5px !important;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.apple-btn-emerald:hover {
  background: #047857 !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4) !important;
  transform: translateY(-1px) !important;
}


/* ===== Compact composer: keep the message window large ===== */
.composer-toolbar { flex-wrap: nowrap; gap: 5px; }
.composer-tpl-select { flex: 1 1 120px; min-width: 100px; max-width: 220px; }
.composer-toolbar-pills { flex: 0 0 auto; flex-wrap: nowrap; gap: 4px; width: auto; }
.ai-suggestion-bubble { max-height: 40px; font-size: 12px; line-height: 1.35; }
#thMsgs { flex: 1 1 auto; min-height: 200px; }
.composer { max-height: 42dvh; }
@container thread-pane (max-width: 520px) {
  .composer-tpl-select { flex: 1 1 90px; max-width: none; }
  .composer-toolbar-pills { width: auto; }
  .composer-toolbar-pills > .composer-tool-btn,
  .composer-toolbar-pills .composer-ai-btn { width: auto; flex: 0 0 auto; padding: 4px 9px; }
  .composer-btn-label { display: none; }
}
@media (max-width: 900px) {
  .composer-toolbar { flex-wrap: nowrap !important; }
  .composer-tpl-select { flex: 1 1 90px !important; min-width: 80px !important; max-width: none !important; }
  .composer-toolbar-pills { width: auto !important; }
  .composer-btn-label { display: none; }
  .ai-suggestion-bubble { max-height: 36px !important; }
  .inbox .thread { min-height: 0; }
}

/* ===== Campaign Replies Inspector & Clickable Pill ===== */
.camp-reply-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.camp-reply-pill:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.crm-modal-box {
  max-width: 880px;
  width: 95%;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.crm-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.crm-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}
.crm-tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.crm-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(109, 40, 217, 0.14);
  color: #6d28d9;
}
.crm-tab-btn.active .crm-tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.crm-tab-badge.is-err {
  background: rgba(220, 38, 38, 0.14);
  color: #be123c;
}
.crm-tab-btn.active .crm-tab-badge.is-err {
  background: rgba(254, 202, 202, 0.25);
  color: #ffffff;
}

.crm-replies-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.crm-replies-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
}
.crm-reply-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.crm-rfilter {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.crm-rfilter.active {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

.crm-replies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46dvh;
  overflow-y: auto;
  padding-right: 2px;
}

.crm-reply-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-reply-card.is-pending {
  border-left: 3px solid #ef4444;
  background: #fffdfb;
}

.crm-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.crm-reply-who {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
}
.crm-reply-meta {
  font-size: 11.5px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}
.crm-reply-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.crm-reply-msgs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.crm-reply-msg {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.crm-reply-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}
.crm-reply-media-img {
  max-width: 180px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  object-fit: cover;
  display: block;
}
.crm-reply-transcript {
  font-size: 11.5px;
  color: #047857;
  font-style: italic;
}
.crm-reply-time {
  font-size: 10.5px;
  color: #64748b;
  align-self: flex-end;
}

.crm-agent-last {
  font-size: 11.5px;
  color: #334155;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 5px 9px;
}

.crm-quick-reply-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.crm-quick-input {
  flex: 1;
  min-width: 0;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 12.5px;
  background: #ffffff;
}

@media (max-width: 640px) {
  .crm-modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 94dvh;
  }
  .crm-replies-list {
    max-height: 52dvh;
  }
}

/* ===== Media Gallery & Product Image Library (Responsive Desktop + Mobile) ===== */
.mg-modal-box {
  max-width: 860px;
  width: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  container: mg-modal / inline-size;
}

.mg-header {
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.mg-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 210px;
}
.mg-header-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.mg-header-text {
  min-width: 0;
}
.mg-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.mg-header-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.35;
}
.mg-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mg-upload-trigger {
  padding: 6px 13px;
  font-size: 12px;
  white-space: nowrap;
}

.mg-upload-form {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  max-height: 48dvh;
  overflow-y: auto;
  flex-shrink: 0;
}
.mg-upload-form[hidden] {
  display: none !important;
}
.mg-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mg-form-head b {
  font-size: 13px;
  color: #0f172a;
}
.mg-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.mg-field {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.mg-field input,
.mg-field select {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}
.mg-field-wide {
  grid-column: 1 / -1;
}
.mg-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.mg-auto-check {
  margin: 0;
  font-size: 12px;
  color: #047857;
  font-weight: 600;
}
.mg-save-btn {
  padding: 7px 18px;
  font-size: 12.5px;
}

.mg-filter-bar {
  padding: 10px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mg-category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.mg-category-tabs .apple-pill-btn {
  font-size: 12px;
  padding: 5px 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mg-category-tabs .apple-pill-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.mg-filter-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 250px;
  justify-content: flex-end;
  min-width: 0;
}
.mg-filter-inputs select,
.mg-filter-inputs input[type="search"] {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 0;
  box-sizing: border-box;
}
.mg-filter-inputs select {
  flex: 0 1 160px;
}
.mg-filter-inputs input[type="search"] {
  flex: 1 1 150px;
  max-width: 210px;
}

.mg-grid {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(175px, 100%), 1fr));
  gap: 12px;
  background: #f8fafc;
  align-content: start;
}

.mg-card {
  margin: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.mg-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0f172a;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mg-card-media img,
.mg-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mg-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  color: #ffffff;
  font-size: 26px;
}
.mg-cat-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}
.mg-auto-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #059669;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}
.mg-card-body {
  padding: 9px 10px 7px;
}
.mg-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-card-prod {
  font-size: 10.5px;
  color: #6d28d9;
  font-weight: 600;
  margin-top: 2px;
}
.mg-card-cap {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.mg-card-cap.is-empty {
  color: #94a3b8;
  font-style: italic;
}

.mg-card-footer {
  padding: 7px 8px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
}
.mg-card-primary-acts,
.mg-card-edit-acts {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mg-attach-btn {
  font-size: 11px;
  padding: 4px 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 600;
}
.mg-send-btn {
  font-size: 11px;
  padding: 4px 8px;
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
  font-weight: 600;
}
.mg-icon-act {
  font-size: 11px;
  padding: 4px 6px;
}
.mg-icon-act.is-del {
  color: #ef4444;
}

@container mg-modal (max-width: 560px) {
  .mg-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .mg-filter-inputs {
    flex: 1 1 100%;
    justify-content: stretch;
  }
  .mg-filter-inputs select,
  .mg-filter-inputs input[type="search"] {
    flex: 1 1 50%;
    max-width: none;
  }
  .mg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }
}

@media (max-width: 680px) {
  .modal-backdrop.mg-backdrop {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .mg-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94dvh !important;
    border-radius: 18px 18px 0 0 !important;
  }
  .mg-header {
    padding: 12px 14px;
  }
  .mg-header-text p {
    display: none;
  }
  .mg-upload-form {
    padding: 12px 14px;
    max-height: 50dvh;
  }
  .mg-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .mg-filter-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  .mg-category-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mg-category-tabs::-webkit-scrollbar {
    display: none;
  }
  .mg-filter-inputs {
    width: 100%;
    flex: 1 1 100%;
  }
  .mg-filter-inputs select,
  .mg-filter-inputs input[type="search"] {
    flex: 1 1 50%;
    max-width: none;
  }
  .mg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
  }
  .mg-card-footer {
    padding: 6px;
  }
  .mg-attach-btn {
    padding: 4px 7px;
  }
}

@media (max-width: 340px) {
  .mg-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ===== Order Wizard Qty + Fixed Price Controls ===== */
.ow-qty-price-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 10px;
}
.ow-qty-price-grid {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}
.ow-qp-field {
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ow-qp-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.ow-qty-price-grid input {
  width: 100%;
  box-sizing: border-box;
  font-size: 12.5px;
  padding: 6px 8px;
  margin: 0;
}

.ow-accordion-body .ord-slots {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 3px;
}

.ow-slots-bulkbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 5px 8px;
  background: #f1f5f9;
  border-radius: 8px;
}

/* ===== Quick Reply & Meta Template Popup Modals ===== */
dialog:modal {
  overscroll-behavior: contain;
}
dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

dialog.tp-modal[open] {
  width: min(680px, calc(100vw - 24px));
  max-width: 680px;
  max-height: 88dvh;
  padding: 0;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
}
dialog.tp-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.tp-modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.tp-modal-head h3 {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}
.tp-modal-head p {
  margin: 2px 0 0;
  font-size: 12px;
}

.tp-modal-searchbar {
  padding: 10px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.tp-modal-searchbar input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.tp-modal-body {
  padding: 14px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.tp-modal-foot {
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tp-tpl-select-wrap {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(0, 1.4fr);
  gap: 8px;
}
.tp-tpl-select-wrap input,
.tp-tpl-select-wrap select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
}

.qr-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.qr-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.qr-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qr-card-text {
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 9px 11px;
}

button.composer-tpl-select {
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

@media (max-width: 680px) {
  dialog.tp-modal[open] {
    width: 100% !important;
    max-width: 100% !important;
    height: 92dvh !important;
    max-height: 92dvh !important;
    margin: auto auto 0 auto !important;
    border-radius: 18px 18px 0 0 !important;
  }
  .tp-tpl-select-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .tp-modal-head,
  .tp-modal-searchbar,
  .tp-modal-body,
  .tp-modal-foot {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Staff visits and platform announcements at the top of a brand's workspace (T-145): the plan banner's
   colours (they work in both themes); critical ones are bold, info ones lighter. */
.ann-banner.ann-info { font-weight: 500; }
.ann-banner.ann-critical, .staff-banner { font-weight: 700; }
.ann-banner .ann-close, .staff-banner .btn-sm { margin-left: 8px; }
/* ==========================================================================
   DRIP MESSAGES & QUICK REPLIES — ELEVATED EXECUTIVE THEME & RESPONSIVE UX
   Bespoke, high-craft layout adhering to anti-ui-slop & frontend-design
   ========================================================================== */

#templates {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* 1. Executive Health Ribbon (4 balanced, auto-fit cards) */
.drip-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

.drip-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.drip-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  border-color: var(--amber-400);
}

.drip-kpi-card.drip-kpi-alert {
  border-color: #fca5a5;
  background: #fffafa;
}

.drip-kpi-card.drip-kpi-upside {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.drip-kpi-icon-tile {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drip-kpi-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.drip-kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.drip-kpi-top .drip-kpi-pill {
  flex-shrink: 0;
  white-space: nowrap;
}

.drip-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
  /* Up to three lines beside the pill: "Cart revenue blocked" no longer ends as "CART REV…" at laptop widths. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-width: 0;
}

.drip-kpi-value {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  letter-spacing: -0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drip-kpi-denom {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.drip-kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drip-kpi-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}

.drip-kpi-pill-red {
  background: #fee2e2;
  color: #b91c1c;
}

/* 2. Strategic Blueprint Callout */
.drip-draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: #fffcf7;
  border: 1px solid #fed7aa;
  border-left: 4px solid #d97706;
  border-radius: 14px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.05);
  flex-wrap: wrap;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.drip-draft-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 360px;
}

.drip-draft-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.drip-draft-badge {
  font-size: 10.5px;
  font-weight: 800;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.04em;
}

.drip-draft-subtag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.drip-draft-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.drip-draft-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.drip-draft-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.drip-draft-expand {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  background: #4A2511;
  border: 1px solid #381b0c;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(74, 37, 17, 0.25);
  white-space: nowrap;
}

.drip-draft-expand:hover {
  background: #613117;
  transform: translateY(-1px);
}

.drip-draft-dismiss {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drip-draft-dismiss:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* 3. Strategic Blueprint Detail (Expandable) */
.drip-draft-detail {
  margin-bottom: 24px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  animation: draftSlideIn 0.22s ease;
}

.drip-draft-flows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.drip-plan-flow {
  background: #fafbfc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drip-plan-flow-urgent {
  border-color: #fca5a5;
  background: #fffbfb;
}

.drip-plan-flow-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.drip-plan-flow-urgent .drip-plan-flow-head {
  background: #fee2e2;
  border-bottom-color: #fca5a5;
}

.drip-plan-flow-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4A2511;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.drip-plan-flow-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.drip-plan-flow-trigger {
  font-size: 11px;
  color: var(--text-muted);
}

.drip-plan-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.drip-plan-badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.drip-plan-badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.drip-plan-badge-green {
  background: #d1fae5;
  color: #065f46;
}

.drip-plan-stages {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.drip-plan-stage {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.drip-plan-stage:last-child {
  border-bottom: none;
}

.drip-plan-stage-disabled {
  opacity: 0.65;
}

.drip-plan-stage-num {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--border-subtle);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 5px;
  flex-shrink: 0;
  margin-top: 1px;
}

.drip-plan-stage-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.drip-plan-stage-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.drip-plan-delay {
  font-size: 10px;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 1px 6px;
}

.drip-plan-disabled-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 999px;
  padding: 1px 6px;
}

.drip-plan-stage-tpl {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.drip-plan-tpl-pill {
  font-size: 9.5px;
  font-weight: 700;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 1px 5px;
}

.drip-plan-tpl-new {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #c4b5fd;
}

.drip-plan-tpl-approved {
  color: #059669;
  font-weight: 600;
  font-size: 10px;
}

.drip-plan-stage-qr {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.drip-plan-qr-pill {
  font-size: 9px;
  font-weight: 800;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  border-radius: 4px;
  padding: 1px 4px;
  flex-shrink: 0;
}

.drip-plan-qr-new {
  font-weight: 600;
  color: #7c3aed;
}

.drip-plan-flow-impact {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  border-top: 1px solid #a7f3d0;
  margin-top: auto;
}

.drip-plan-flow-urgent .drip-plan-flow-impact {
  background: #fff7ed;
  color: #c2410c;
  border-top-color: #fed7aa;
}

/* 4. New Templates Proposal Card */
.drip-plan-templates-card {
  grid-column: 1 / -1;
  background: #faf5ff;
  border: 1px solid #c4b5fd;
  border-radius: 12px;
  padding: 14px 16px;
  box-sizing: border-box;
}

.drip-plan-templates-head {
  font-size: 12.5px;
  font-weight: 800;
  color: #6d28d9;
  margin-bottom: 10px;
}

.drip-plan-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.drip-plan-tpl-card {
  background: #ffffff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(109, 40, 217, 0.04);
}

.drip-plan-tpl-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #5b21b6;
  margin-bottom: 2px;
}

.drip-plan-tpl-cat {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.drip-plan-tpl-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.drip-plan-tpl-link {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #7c3aed;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.drip-plan-tpl-link:hover {
  color: #5b21b6;
}

/* Responsive Overrides for Drip Workspace */
@media (max-width: 900px) {
  .drip-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .drip-draft-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
  }
  .drip-draft-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 600px) {
  .drip-kpi-strip {
    grid-template-columns: minmax(0, 1fr);
  }
  .drip-kpi-card {
    padding: 12px 14px;
  }
  .drip-draft-flows-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .drip-plan-stage {
    flex-direction: column;
    gap: 5px;
  }
}

/* ==========================================================================
   Full-Page Journey Canvas, Catalog Dashboard & Meta WhatsApp Flows Studio
   (Anti-UI Slop + Frontend Design)
   ========================================================================== */

/* Level 1: Flows Catalog Grid */
.df-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.df-catalog-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
}

.df-catalog-card:hover {
  border-color: #0f766e;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.df-catalog-card.is-active {
  border-left: 4px solid #059669;
}

.df-catalog-card.is-paused {
  border-left: 4px solid #d97706;
}

.df-catalog-card.is-inactive {
  border-left: 4px solid #94a3b8;
  opacity: 0.85;
}

.df-catalog-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.df-catalog-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.df-catalog-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.df-catalog-pipeline {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
}

.df-pipe-step {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.df-pipe-step.is-flow {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.df-pipe-arrow {
  color: #94a3b8;
  font-size: 10px;
}

.df-catalog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.df-btn-open-canvas {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.df-btn-open-canvas:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

/* Level 2: Dedicated Full-Screen Canvas */
#dfFullscreenCanvasView {
  position: relative;
  width: 100%;
  margin-top: 12px;
}

/* Immersive Fullscreen Mode */
#dfFullscreenCanvasView.is-immersive-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: #f8fafc !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 0 !important;
}

body.df-canvas-open-fullscreen {
  overflow: hidden !important;
}

#dfFullscreenCanvasView.is-immersive-fullscreen .df-canvas-topbar {
  margin-bottom: 0 !important;
  border-radius: 0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  padding: 10px 20px !important;
  background: #ffffff !important;
  z-index: 20 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06) !important;
}

#dfFullscreenCanvasView.is-immersive-fullscreen .df-fullscreen-canvas-wrap {
  flex: 1 !important;
  height: calc(100vh - 58px) !important;
}

#dfFullscreenCanvasView.is-immersive-fullscreen .df-canvas-workspace {
  height: 100% !important;
  min-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
}

.df-canvas-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 12px;
}

.df-canvas-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
}

.df-canvas-name-input {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 6px;
  background: transparent;
  transition: all 0.15s ease;
}

.df-canvas-name-input:hover,
.df-canvas-name-input:focus {
  border-color: #cbd5e1;
  background: #fff;
}

.df-canvas-desc-input {
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 6px;
  background: transparent;
}

.df-canvas-desc-input:hover,
.df-canvas-desc-input:focus {
  border-color: #cbd5e1;
  background: #fff;
}

.df-fullscreen-canvas-wrap {
  width: 100%;
  position: relative;
}

.df-fullscreen-canvas-wrap .df-canvas-workspace {
  min-height: calc(100vh - 200px);
  height: calc(100vh - 200px);
  max-height: none;
  border-radius: 16px;
  position: relative;
}

/* Slide-out Settings Drawer */
.df-settings-drawer {
  position: absolute;
  top: 70px;
  right: 16px;
  width: 360px;
  max-width: 90vw;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 18px 20px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  animation: slideInDrawer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInDrawer {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.df-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Slide-out Stage Inspector Drawer */
.df-stage-inspector-drawer {
  position: absolute;
  top: 70px;
  right: 16px;
  width: 440px;
  max-width: 92vw;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  z-index: 102;
  padding: 20px 22px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  animation: slideInDrawer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.df-stage-inspector-drawer .df-drawer-body label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.df-stage-inspector-drawer input,
.df-stage-inspector-drawer select,
.df-stage-inspector-drawer textarea {
  font-size: 13px;
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: #fff;
}

.df-stage-inspector-drawer input:focus,
.df-stage-inspector-drawer select:focus,
.df-stage-inspector-drawer textarea:focus {
  border-color: #0d9488;
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.btn-insp-tag {
  font-size: 10.5px !important;
  padding: 2px 7px !important;
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  cursor: pointer;
}

.btn-insp-tag:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
}

/* Node Selected on Canvas */
.df-node-stage.is-selected {
  border-color: #0d9488 !important;
  box-shadow: 0 0 0 3.5px rgba(13, 148, 136, 0.28), 0 12px 32px rgba(15, 23, 42, 0.12) !important;
  transform: translateY(-3px);
}

/* Meta WhatsApp Flows Studio */
.wf-studio-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(340px, 0.8fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 950px) {
  .wf-studio-grid {
    grid-template-columns: 1fr;
  }
}

.wf-flows-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wf-flow-card {
  background: #fff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
}

.wf-flow-card.active {
  border-color: #0f766e;
  background: #fdfefe;
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.08);
}

.wf-flow-card:hover {
  border-color: #0d9488;
}

.wf-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wf-flow-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.wf-flow-type {
  font-size: 12px;
  color: var(--text-secondary);
}

.wf-flow-desc {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 10px;
}

.wf-flow-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.wf-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
}

.wf-flow-foot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.wf-phone-device {
  width: 320px;
  margin: 0 auto;
  background: #1e293b;
  border-radius: 36px;
  padding: 10px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
  border: 3px solid #334155;
  position: relative;
}

.wf-phone-notch {
  width: 90px;
  height: 16px;
  background: #0f172a;
  border-radius: 0 0 10px 10px;
  margin: 0 auto 8px;
}

.wf-phone-header {
  background: #075e54;
  color: #fff;
  padding: 8px 12px;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wf-phone-avatar {
  width: 30px;
  height: 30px;
  background: #059669;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wf-phone-title {
  font-weight: 700;
  font-size: 13px;
}

.wf-phone-status {
  font-size: 10px;
  opacity: 0.8;
}

.wf-phone-chat {
  background: #efeae2;
  min-height: 480px;
  border-radius: 0 0 20px 20px;
  padding: 12px 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wf-bubble-flow {
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: auto;
}

.wf-bubble-header {
  font-size: 11px;
  font-weight: 800;
  color: #0f766e;
  margin-bottom: 4px;
}

.wf-bubble-body {
  font-size: 12.5px;
  color: #1e293b;
  line-height: 1.4;
  margin-bottom: 6px;
}

.wf-bubble-footer {
  font-size: 10px;
  color: #64748b;
  margin-bottom: 8px;
}

.wf-flow-cta-btn {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #00a884;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.wf-flow-cta-btn:hover {
  background: #e6f7f2;
  border-color: #00a884;
}

.wf-phone-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.18);
  padding: 12px 14px 18px;
  animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90%;
  overflow-y: auto;
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.wf-sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.wf-sheet-close {
  font-size: 14px;
  cursor: pointer;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
}

.wf-sheet-close:hover {
  background: #f1f5f9;
}

/* ==========================================================================
   META WHATSAPP TEMPLATES (Full-Page Catalog, Tags & Master-Detail Studio)
   ========================================================================== */

.wt-tags-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 4px;
}

.wt-tag-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wt-tag-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.wt-tag-pill.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

.wt-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.wt-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
}

.wt-card:hover {
  border-color: #0f766e;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.wt-card.is-approved {
  border-left: 4.5px solid #059669;
}

.wt-card.is-pending {
  border-left: 4.5px solid #d97706;
}

.wt-card.is-rejected {
  border-left: 4.5px solid #ef4444;
}

.wt-ref-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: #f1f5f9;
  color: #0f766e;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}

.wt-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
}

.wt-card-code {
  font-family: monospace;
  font-size: 11.5px;
  color: #475569;
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.wt-tag-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.wt-card-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 8px 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.wt-btn-open-detail {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wt-btn-open-detail:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

/* Level 2: Dedicated Full-Page Details View */
.wt-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 16px;
}

.wt-breadcrumb-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wt-detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(320px, 0.75fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 960px) {
  .wt-detail-grid {
    grid-template-columns: 1fr;
  }
}

.wt-spec-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wt-spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px;
}

.wt-spec-row:last-child {
  border-bottom: none;
}

.wt-spec-key {
  font-weight: 600;
  color: var(--text-secondary);
}

.wt-spec-val {
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wt-vars-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wt-var-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.wt-var-chip {
  font-family: monospace;
  font-weight: 800;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  white-space: nowrap;
}

.wt-connected-journeys {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wt-journey-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #166534;
}

/* WhatsApp Smartphone Studio Mockup Frame */
.wt-phone-device {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  background: #1e293b;
  border-radius: 36px;
  padding: 10px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
  border: 3px solid #334155;
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
}

.wt-phone-notch {
  width: 90px;
  height: 14px;
  background: #0f172a;
  border-radius: 0 0 10px 10px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wt-phone-notch-pill {
  width: 44px;
  height: 4px;
  background: #334155;
  border-radius: 999px;
}

.wt-phone-header {
  background: #075e54;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 18px 18px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  flex-shrink: 0;
}

.wt-phone-chat {
  background: #efeae2;
  background-image: radial-gradient(#d5cdc4 1.2px, transparent 1.2px);
  background-size: 16px 16px;
  min-height: 460px;
  max-height: 560px;
  border-radius: 0 0 18px 18px;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;
}

.wt-phone-bubble {
  background: #ffffff;
  border-radius: 0 12px 12px 12px;
  padding: 10px 12px;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.12);
  max-width: 94%;
  font-size: 13px;
  line-height: 1.45;
  color: #111827;
  word-break: break-word;
  position: relative;
  box-sizing: border-box;
  align-self: flex-start;
  margin: 0;
}

.wt-phone-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -7px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 7px solid #ffffff;
}

.wt-phone-bubble .mediahead-img-wrap {
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.wt-phone-bubble .mediahead-preview-img {
  max-height: 180px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.wt-phone-bubble .mediahead {
  padding: 14px 10px;
  text-align: center;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  color: #475569;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.wt-phone-bubble .bhead {
  font-weight: 800;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: #0f172a;
}

.wt-phone-bubble .bfoot {
  color: #64748b;
  font-size: 11px;
  margin-top: 6px;
}

.wt-phone-bubble .bbtns-preview {
  margin-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wt-phone-bubble .bbtn-pill {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  color: #059669;
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 8px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Drip Flow Unit Economics & ROAS KPI Ribbon */
.df-econ-ribbon {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.df-econ-tile {
  display: flex;
  flex-direction: column;
  padding: 5px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-width: 95px;
}

.df-econ-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.df-econ-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.df-econ-advice {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
}

/* Stage Node Economics Pill */
.df-node-econ-pill {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--text-secondary);
}

.df-node-econ-pill.is-profitable {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.df-node-econ-pill.is-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.df-node-roas-badge {
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.06);
}

/* Stage Inspector A/B Testing Box */
.df-ab-box {
  background: #faf5ff;
  border: 1.5px solid #d8b4fe;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

/* ==========================================================================
   Elevated Orders Dashboard & Operations Hub (Anti-Slop & UI A11y)
   ========================================================================== */

/* 1. Fulfillment & Logistics Hub */
.ord-hub-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease;
}

.ord-hub-header {
  border-bottom: 1px solid var(--border-subtle);
}

/* 2. De-slopped Pipeline Filter Buttons */
.ship-pipe-btn,
.mk8-pipe-btn {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: var(--text-secondary) !important;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.ship-pipe-btn:hover,
.mk8-pipe-btn:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: var(--text-main) !important;
}

.ship-pipe-btn:focus-visible,
.mk8-pipe-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #0f172a;
}

.ship-pipe-btn.active,
.mk8-pipe-btn.active {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

.ship-pipe-btn.active span,
.mk8-pipe-btn.active span {
  color: #ffffff !important;
}

/* Urgent Action Pill highlight */
.ship-pipe-btn.ord-filter-urgent:not(.active) {
  border-color: #fca5a5 !important;
  background: #fff8f8 !important;
}

/* 3. Dedicated Always-Visible Search & Filter Toolbar */
.ord-toolbar-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.ord-search-box input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  background: #ffffff;
}

.ord-search-box input:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

#ordClearSearch:hover {
  background: #cbd5e1 !important;
  color: #0f172a !important;
}

#ordClearSearch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #0f172a;
}

/* 4. Order Pipeline Weekly Table & Telemetry Strip */
.ord-pipe-kpi-item {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ord-pipe-kpi-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.ord-pipe-drill:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 5. Mobile & Tablet Responsiveness */
@media (max-width: 900px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .ord-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  #shippingPipelineBar,
  #mk8PipelineBar {
    display: flex;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  #shippingPipelineBar::-webkit-scrollbar,
  #mk8PipelineBar::-webkit-scrollbar {
    display: none;
  }
  .ord-search-box {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .ord-toolbar-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .ord-pipe-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

/* 6. Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
