/* ETWhatsApp V2 Component Primitives Styles */

/* Button */
.et-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--et-space-2);
  font-family: var(--et-font-family);
  font-weight: 500;
  border-radius: var(--et-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--et-duration-fast) var(--et-ease-standard);
  text-decoration: none;
  box-sizing: border-box;
}

.et-btn:focus-visible {
  outline: none;
  box-shadow: var(--et-focus-ring);
}

.et-btn:disabled, .et-btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.et-btn-sm {
  padding: var(--et-space-1) var(--et-space-2);
  font-size: var(--et-text-xs);
}

.et-btn-md {
  padding: var(--et-space-2) var(--et-space-4);
  font-size: var(--et-text-sm);
}

.et-btn-lg {
  padding: var(--et-space-3) var(--et-space-6);
  font-size: var(--et-text-base);
}

.et-btn-primary {
  background-color: var(--et-color-primary-600);
  color: #ffffff;
}
.et-btn-primary:hover:not(:disabled) {
  background-color: var(--et-color-primary-700);
}

.et-btn-secondary {
  background-color: var(--et-color-neutral-200);
  color: var(--et-color-neutral-800);
}
.et-btn-secondary:hover:not(:disabled) {
  background-color: var(--et-color-neutral-300);
}

.et-btn-outline {
  background-color: transparent;
  border-color: var(--et-color-neutral-300);
  color: var(--et-color-neutral-700);
}
.et-btn-outline:hover:not(:disabled) {
  background-color: var(--et-color-neutral-100);
}

.et-btn-danger {
  background-color: var(--et-color-danger-text);
  color: #ffffff;
}
.et-btn-danger:hover:not(:disabled) {
  background-color: #991b1b;
}

.et-btn-ghost {
  background-color: transparent;
  color: var(--et-color-neutral-600);
}
.et-btn-ghost:hover:not(:disabled) {
  background-color: var(--et-color-neutral-100);
}

/* Spinner */
.et-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--et-radius-full);
  animation: et-spin 0.75s linear infinite;
}

@keyframes et-spin {
  to { transform: rotate(360deg); }
}

/* Badge */
.et-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-1);
  font-family: var(--et-font-family);
  font-weight: 600;
  border-radius: var(--et-radius-full);
  padding: 0.125rem var(--et-space-2);
}

.et-badge-sm { font-size: var(--et-text-xs); }
.et-badge-md { font-size: var(--et-text-sm); }

.et-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--et-radius-full);
  background-color: currentColor;
}

.et-badge-success { background-color: var(--et-color-success-bg); color: var(--et-color-success-text); }
.et-badge-warning { background-color: var(--et-color-warning-bg); color: var(--et-color-warning-text); }
.et-badge-danger { background-color: var(--et-color-danger-bg); color: var(--et-color-danger-text); }
.et-badge-info { background-color: var(--et-color-info-bg); color: var(--et-color-info-text); }
.et-badge-neutral { background-color: var(--et-color-neutral-200); color: var(--et-color-neutral-700); }

/* Alert */
.et-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--et-space-3);
  padding: var(--et-space-3) var(--et-space-4);
  border-radius: var(--et-radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--et-space-4);
}

.et-alert-info { background-color: var(--et-color-info-bg); color: var(--et-color-info-text); border-color: var(--et-color-info-border); }
.et-alert-success { background-color: var(--et-color-success-bg); color: var(--et-color-success-text); border-color: var(--et-color-success-border); }
.et-alert-warning { background-color: var(--et-color-warning-bg); color: var(--et-color-warning-text); border-color: var(--et-color-warning-border); }
.et-alert-error { background-color: var(--et-color-danger-bg); color: var(--et-color-danger-text); border-color: var(--et-color-danger-border); }

.et-alert-content { flex: 1; }
.et-alert-title { margin: 0 0 var(--et-space-1) 0; font-size: var(--et-text-sm); font-weight: 600; }
.et-alert-message { font-size: var(--et-text-sm); }
.et-alert-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  line-height: 1;
}

/* Tabs */
.et-tabs { display: flex; flex-direction: column; width: 100%; }
.et-tab-list {
  display: flex;
  border-bottom: 2px solid var(--rg-border, #E2E8F0);
  gap: 4px;
}
.et-tab-header {
  background: var(--rg-surface-muted, #F1F5F9);
  border: 1px solid var(--rg-border, #E2E8F0);
  border-bottom: 3px solid transparent !important;
  border-radius: 6px 6px 0 0;
  padding: 8px 16px;
  font-family: var(--et-font-family, inherit);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rg-text-muted, #334155);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.et-tab-header:hover {
  background: color-mix(in srgb, var(--rg-surface, #ffffff) 60%, var(--rg-surface-muted, #F1F5F9));
  color: var(--rg-text, #0F172A);
}
.et-tab-header.et-tab-active {
  background: var(--rg-surface, #ffffff) !important;
  color: var(--rg-primary, #087A4F) !important;
  border-color: var(--rg-border, #E2E8F0) var(--rg-border, #E2E8F0) transparent var(--rg-border, #E2E8F0);
  border-bottom: 3px solid var(--rg-primary, #087A4F) !important;
  font-weight: 700;
}
.et-tab-body { padding: 16px 0; }

html.dark .et-tab-header, [data-theme="dark"] .et-tab-header {
  background: var(--rg-surface-muted, #162344) !important;
  color: var(--rg-text-muted, #CBD5E1) !important;
  border-color: var(--rg-border, #23355A) !important;
  border-bottom: 3px solid transparent !important;
}
html.dark .et-tab-header.et-tab-active, [data-theme="dark"] .et-tab-header.et-tab-active {
  background: var(--rg-surface, #111C35) !important;
  color: var(--rg-primary, #10B981) !important;
  border-bottom: 3px solid var(--rg-primary, #10B981) !important;
}

/* Progress */
.et-progress-bar { width: 100%; }
.et-progress-track {
  height: 8px;
  background-color: var(--et-color-neutral-200);
  border-radius: var(--et-radius-full);
  overflow: hidden;
}
.et-progress-fill {
  height: 100%;
  background-color: var(--et-color-primary-600);
  transition: width var(--et-duration-normal) var(--et-ease-standard);
}
.et-progress-indeterminate {
  width: 40% !important;
  animation: et-indeterminate 1.5s infinite ease-in-out;
}
@keyframes et-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Skeleton */
.et-skeleton {
  background-color: var(--et-color-neutral-200);
}
.et-skeleton-text { height: 1rem; border-radius: var(--et-radius-sm); margin-bottom: var(--et-space-2); width: 100%; }
.et-skeleton-circle { border-radius: var(--et-radius-full); width: 40px; height: 40px; }
.et-skeleton-rectangle { border-radius: var(--et-radius-md); width: 100%; height: 120px; }
.et-skeleton-pulse {
  animation: et-pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes et-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Offline & Error States */
.et-offline-state, .et-error-state {
  text-align: center;
  padding: var(--et-space-8) var(--et-space-4);
  background: #ffffff;
  border: 1px dashed var(--et-color-neutral-300);
  border-radius: var(--et-radius-lg);
}
.et-offline-icon, .et-error-icon { font-size: 2.5rem; margin-bottom: var(--et-space-2); }
.et-offline-title, .et-error-title { margin: 0 0 var(--et-space-2) 0; font-size: var(--et-text-lg); }
.et-offline-message, .et-error-message { color: var(--et-color-neutral-500); font-size: var(--et-text-sm); margin: 0 0 var(--et-space-4) 0; }

/* Shell Primitives Styles */

/* Skip Link */
.et-skip-link {
  position: absolute;
  top: -9999px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--et-color-neutral-900);
  color: #ffffff;
  padding: var(--et-space-2) var(--et-space-4);
  z-index: 9999;
  border-radius: var(--et-radius-md);
  text-decoration: none;
  font-weight: bold;
}
.et-skip-link:focus {
  top: var(--et-space-4);
}

/* Breadcrumbs */
.et-breadcrumbs {
  font-family: var(--et-font-family);
  font-size: var(--et-text-sm);
  margin-bottom: var(--et-space-3);
}
.et-breadcrumb-list {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--et-space-2);
}
.et-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: var(--et-space-2);
  color: var(--et-color-neutral-500);
}
.et-breadcrumb-item a {
  color: var(--et-color-primary-600);
  text-decoration: none;
}
.et-breadcrumb-item a:hover { text-decoration: underline; }
.et-breadcrumb-current { color: var(--et-color-neutral-800); font-weight: 500; }
.et-breadcrumb-separator { color: var(--et-color-neutral-400); }

/* Support Context Banner */
.et-support-banner {
  background: #fffbeb;
  border-bottom: 2px solid #f59e0b;
  color: #92400e;
  padding: var(--et-space-2) var(--et-space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.et-support-badge {
  background: #f59e0b;
  color: #ffffff;
  padding: 0.125rem var(--et-space-2);
  border-radius: var(--et-radius-sm);
  font-size: var(--et-text-xs);
  font-weight: bold;
  margin-inline-end: var(--et-space-2);
}

/* Session Expiry Modal */
.et-session-expiry-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.et-modal-card {
  background: #ffffff;
  border-radius: var(--et-radius-lg);
  padding: var(--et-space-6);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--et-shadow-lg);
}
.et-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--et-space-3);
  margin-top: var(--et-space-6);
}

/* Drawer */
.et-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 900;
  display: flex;
}
.et-drawer {
  background: #ffffff;
  height: 100%;
  width: 360px;
  max-width: 85vw;
  box-shadow: var(--et-shadow-lg);
  display: flex;
  flex-direction: column;
}
.et-drawer-end { margin-left: auto; }
.et-drawer-header {
  padding: var(--et-space-4);
  border-bottom: 1px solid var(--et-color-neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.et-drawer-body { padding: var(--et-space-4); flex: 1; overflow-y: auto; }
.et-drawer-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* Lookup Select (AFB-013 / Reusable Multi-Column Lookup) */
/* Lookup Select (Professional List Component with Pill Input & Card List) */
.et-lookup-container {
  position: relative;
  width: 100%;
  font-family: inherit !important;
}
.et-lookup-container.et-lookup-is-open {
  position: relative !important;
  z-index: 100220 !important;
}

/* Ensure containers do not clip lookup dropdown list when open */
:is(.modal, .modal-dialog, .modal-content, .modal-card, .modal-body, .card, .panel-card, .edit-panel-card, .form-group, .filter-group, .compact-filter-bar, .filter-bar-controls):has(.et-lookup-is-open) {
  overflow: visible !important;
  z-index: 100220 !important;
}
.et-lookup-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rg-heading, #0B192C);
  margin-bottom: 4px;
  display: block;
}

/* Pill Input Trigger */
.et-lookup-pill-box {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  height: 38px;
  border-radius: 6px;
  background: var(--rg-surface, #ffffff);
  border: 1.5px solid var(--rg-border-strong, #CBD5E1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
  cursor: text;
}
.et-lookup-pill-box:hover:not(.et-lookup-disabled):not(.et-lookup-readonly) {
  border-color: var(--rg-primary-hover, #059669);
}
.et-lookup-pill-box.et-lookup-open,
.et-lookup-pill-box:focus-within {
  border-color: var(--rg-primary, #10B981) !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}
.et-lookup-pill-box.is-invalid,
.et-lookup-pill-box.et-lookup-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
.et-lookup-pill-box.et-lookup-disabled {
  background: #f8fafc;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.75;
}
.et-lookup-pill-box.et-lookup-readonly {
  background: #f8fafc;
  cursor: default;
}

/* Search Icon */
.et-lookup-search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rg-text-muted, #64748B);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  left: 14px;
}
:is(.et-lookup-rtl, [dir="rtl"], .rtl) .et-lookup-search-icon,
.et-lookup-container[dir="rtl"] .et-lookup-search-icon {
  left: auto;
  right: 14px;
}
.et-lookup-open .et-lookup-search-icon,
.et-lookup-pill-box:focus-within .et-lookup-search-icon {
  color: var(--rg-primary, #10B981);
}

/* Pill Input Element */
.et-lookup-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--rg-heading, #0B192C);
  box-sizing: border-box;
  padding-left: 38px;
  padding-right: 38px;
  font-family: inherit !important;
}
:is(.et-lookup-rtl, [dir="rtl"], .rtl) .et-lookup-input,
.et-lookup-container[dir="rtl"] .et-lookup-input {
  padding-left: 38px;
  padding-right: 38px;
  text-align: right;
  direction: rtl;
}
.et-lookup-input::placeholder {
  color: var(--et-placeholder, #9AA5B5);
  font-weight: normal;
  font-family: inherit !important;
}

/* Delete / Clear Action Button (x) on opposite side */
.et-lookup-delete-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--rg-text-muted, #64748B);
  transition: all 0.15s ease;
  z-index: 3;
  right: 10px;
}
:is(.et-lookup-rtl, [dir="rtl"], .rtl) .et-lookup-delete-btn,
.et-lookup-container[dir="rtl"] .et-lookup-delete-btn {
  right: auto;
  left: 10px;
}
.et-lookup-delete-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* Error & Hint Messages */
.et-lookup-error-message {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  color: #ef4444;
}
.et-lookup-hint-message {
  font-size: 0.75rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  color: var(--rg-text-muted, #64748B);
}

/* Dropdown Menu Backdrop */
.et-lookup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100200 !important;
  background: transparent;
}

/* Dropdown Menu (Popup) */
.et-lookup-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(var(--et-lookup-width, 540px), calc(100vw - 32px));
  min-width: min(100%, calc(100vw - 32px));
  max-width: min(var(--et-lookup-width, 540px), calc(100vw - 32px));
  max-height: var(--et-lookup-max-height, min(560px, calc(100dvh - 120px)));
  z-index: 100250 !important;
  background: var(--rg-surface-raised, var(--rg-surface, #ffffff)) !important;
  border: 1px solid var(--rg-border-strong, #CBD5E1) !important;
  border-radius: 6px;
  box-shadow: 0 12px 28px -8px rgba(11, 25, 44, 0.28), 0 4px 10px -4px rgba(11, 25, 44, 0.16) !important;
  padding: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
:is([dir="rtl"], .rtl, html[dir="rtl"], html[lang="ar"], .et-lookup-rtl) .et-lookup-dropdown-menu,
.et-lookup-container[dir="rtl"] .et-lookup-dropdown-menu,
.et-lookup-dropdown-menu[dir="rtl"],
.et-lookup-dropdown-rtl {
  inset-inline-start: 0 !important;
  inset-inline-end: auto !important;
  left: auto !important;
  right: 0 !important;
  text-align: right !important;
  direction: rtl !important;
}

:is([dir="rtl"], .rtl, html[dir="rtl"], html[lang="ar"], .et-lookup-rtl) :is(.et-lookup-grid-header, .et-lookup-list-card) {
  direction: rtl !important;
  text-align: right !important;
}

:is([dir="rtl"], .rtl, html[dir="rtl"], html[lang="ar"], .et-lookup-rtl) :is(.et-lookup-card-title, .et-lookup-card-subtitle, .et-lookup-grid-header span) {
  text-align: right !important;
}

/* List Items Container */
.et-lookup-list-items {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--rg-border-strong, #94a3b8) var(--rg-surface-muted, #f8fafc);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
}

.et-lookup-grid-header {
  display: grid;
  grid-template-columns: 30px minmax(150px, 1fr) minmax(170px, 1.25fr) minmax(86px, auto) 18px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--rg-border, #e2e8f0);
  background: var(--rg-surface-muted, #f8fafc);
  color: var(--rg-text-muted, #64748b);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.et-lookup-list-items::-webkit-scrollbar {
  width: 9px;
}
.et-lookup-list-items::-webkit-scrollbar-track {
  background: var(--rg-surface-muted, #f8fafc);
}
.et-lookup-list-items::-webkit-scrollbar-thumb {
  background: var(--rg-border-strong, #94a3b8);
  border: 2px solid var(--rg-surface-muted, #f8fafc);
  border-radius: 6px;
}

/* Item Card (List Behaviour) */
.et-lookup-list-card {
  display: grid;
  grid-template-columns: 32px minmax(150px, 1fr) minmax(170px, 1.25fr) minmax(86px, auto) 18px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  user-select: none;
}
.et-lookup-list-card:hover {
  background: #f8fafc;
}
.et-lookup-list-card.et-card-focused {
  outline: 2px solid var(--rg-primary, #10B981);
  background: #f8fafc;
}
.et-lookup-list-card.et-card-selected {
  background: var(--rg-primary-soft, #ECFDF5) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Card Icon (Outlined or Soft Badge) */
.et-lookup-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.08);
  color: var(--rg-primary, #10B981);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.et-card-selected .et-lookup-card-icon {
  background: var(--rg-primary, #10B981);
  color: #ffffff;
}

/* Card Content: Title & Subtitle */
.et-lookup-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.et-lookup-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.et-lookup-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rg-heading, #0B192C);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.et-lookup-card-badge-cell {
  min-width: 0;
  text-align: end;
}

.et-lookup-custom-row {
  grid-column: 1 / -1;
  min-width: 0;
}
.et-card-selected .et-lookup-card-title {
  color: var(--rg-primary-active, #047857);
}
.et-lookup-card-subtitle {
  font-size: 0.75rem;
  color: var(--rg-text-muted, #64748B);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.et-card-selected .et-lookup-card-subtitle {
  color: var(--rg-primary-hover, #059669);
}
.et-lookup-card-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.1);
  color: #0891B2;
  flex-shrink: 0;
}

/* Card Selected Checkmark */
.et-lookup-card-check {
  display: flex;
  align-items: center;
  color: var(--rg-primary, #10B981);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .et-lookup-grid-header {
    display: none;
  }

  .et-lookup-list-card {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .et-lookup-list-card .et-lookup-card-title,
  .et-lookup-list-card .et-lookup-card-subtitle {
    grid-column: 2;
  }

  .et-lookup-list-card .et-lookup-card-badge-cell,
  .et-lookup-list-card .et-lookup-card-check {
    grid-column: 3;
  }
}

/* State Messages */
.et-lookup-state-msg {
  text-align: center;
  padding: 24px 16px;
  color: var(--rg-text-muted, #64748B);
  font-size: 0.85rem;
}

/* Pagination Footer */
.et-lookup-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 6px 8px 2px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
  color: var(--rg-text-muted, #64748B);
  margin-top: 2px;
}
.et-lookup-page-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}
.et-lookup-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.et-lookup-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Backwards-compatibility table rules */
.et-lookup-table {
  font-size: 0.82rem;
  margin: 0;
  width: 100%;
}
.et-lookup-table th {
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
}
.et-lookup-table td {
  padding: 6px 10px;
  vertical-align: middle;
}
.et-lookup-table tr:hover td { background: #f8fafc; }
.et-lookup-table tr.et-row-selected td {
  background: var(--rg-primary-soft, #ECFDF5) !important;
  color: var(--rg-primary-active, #047857);
}

/* Audit Timeline */
.et-audit-timeline { font-family: var(--et-font-family); }
.et-timeline-list { list-style: none; padding: 0; margin: 0; position: relative; }
.et-timeline-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--et-color-neutral-200);
}
.et-timeline-item {
  position: relative;
  padding-left: var(--et-space-6);
  margin-bottom: var(--et-space-4);
}
.et-timeline-marker {
  position: absolute;
  left: 0;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: var(--et-radius-full);
  background: var(--et-color-primary-600);
  border: 2px solid #ffffff;
}
.et-timeline-header {
  display: flex;
  align-items: center;
  gap: var(--et-space-2);
  font-size: var(--et-text-sm);
}
.et-timeline-actor { font-weight: 600; }
.et-timeline-action { color: var(--et-color-neutral-600); }
.et-timeline-time { color: var(--et-color-neutral-400); font-size: var(--et-text-xs); margin-left: auto; }
.et-timeline-details { margin: var(--et-space-1) 0 0 0; font-size: var(--et-text-sm); color: var(--et-color-neutral-700); }

/* Bulk Action Bar */
.et-bulk-bar {
  position: fixed;
  bottom: var(--et-space-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--et-color-neutral-900);
  color: #ffffff;
  padding: var(--et-space-3) var(--et-space-6);
  border-radius: var(--et-radius-lg);
  box-shadow: var(--et-shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--et-space-6);
  z-index: 800;
}
.et-bulk-info { display: flex; align-items: center; gap: var(--et-space-2); font-size: var(--et-text-sm); }
.et-bulk-badge {
  background: var(--et-color-primary-600);
  padding: 0.125rem var(--et-space-2);
  border-radius: var(--et-radius-full);
  font-weight: bold;
}
.et-bulk-actions { display: flex; align-items: center; gap: var(--et-space-2); }

/* Modal */
.et-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.et-modal {
  background: #ffffff;
  border-radius: var(--et-radius-lg);
  box-shadow: var(--et-shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.et-modal-sm { width: 360px; }
.et-modal-md { width: 500px; }
.et-modal-lg { width: 720px; }
.et-modal-xl { width: 960px; }
.et-modal-header {
  padding: var(--et-space-4);
  border-bottom: 1px solid var(--et-color-neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.et-modal-title { margin: 0; font-size: var(--et-text-lg); }
.et-modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.et-modal-body { padding: var(--et-space-4); overflow-y: auto; flex: 1; }
.et-modal-footer {
  padding: var(--et-space-3) var(--et-space-4);
  border-top: 1px solid var(--et-color-neutral-200);
  display: flex;
  justify-content: flex-end;
  gap: var(--et-space-2);
  background: var(--et-color-neutral-50);
}

/* Universal Fallback for Standard Modal Dialogs Across Apps */
.modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100050 !important;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
  background-color: rgba(7, 12, 23, 0.65) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 1rem;
  box-sizing: border-box;
}

.modal.show,
.modal.d-block {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: auto;
  pointer-events: auto;
  z-index: 100051 !important;
  box-sizing: border-box;
}

.modal-dialog.modal-sm { max-width: 420px; }
.modal-dialog.modal-lg { max-width: 820px; }
.modal-dialog.modal-xl { max-width: 1140px; }

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(90vh, 920px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
  overflow: hidden;
  outline: 0;
}

.modal-dialog-scrollable .modal-content {
  max-height: min(90vh, 920px);
  overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  flex-shrink: 0;
}



/* ==========================================================================
   EtLookupSelect Dark Mode Theme Parity
   ========================================================================== */
html.dark .et-lookup-pill-box,
[data-theme="dark"] .et-lookup-pill-box {
  background: var(--rg-surface, #111C35) !important;
  border-color: var(--rg-border-strong, #334B7D) !important;
  color: var(--rg-text, #F1F5F9) !important;
}

html.dark .et-lookup-input,
[data-theme="dark"] .et-lookup-input {
  background: transparent !important;
  color: var(--rg-text, #F1F5F9) !important;
}

html.dark .et-lookup-input::placeholder,
[data-theme="dark"] .et-lookup-input::placeholder {
  color: var(--et-placeholder, #5F6E84) !important;
}

html.dark .et-lookup-search-icon,
[data-theme="dark"] .et-lookup-search-icon,
html.dark .et-lookup-delete-btn,
[data-theme="dark"] .et-lookup-delete-btn {
  color: var(--rg-text-muted, #CBD5E1) !important;
}

html.dark .et-lookup-dropdown-menu,
[data-theme="dark"] .et-lookup-dropdown-menu {
  background: var(--rg-surface-raised, #1C2B4E) !important;
  border-color: var(--rg-border-strong, #334B7D) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
}

html.dark .et-lookup-grid-header,
[data-theme="dark"] .et-lookup-grid-header {
  background: var(--rg-surface-muted, #162344) !important;
  color: var(--rg-text-muted, #CBD5E1) !important;
  border-color: var(--rg-border, #23355A) !important;
}

html.dark .et-lookup-list-card,
[data-theme="dark"] .et-lookup-list-card {
  color: var(--rg-text, #F1F5F9) !important;
}

html.dark .et-lookup-list-card:hover,
[data-theme="dark"] .et-lookup-list-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

html.dark .et-lookup-list-card.et-card-focused,
[data-theme="dark"] .et-lookup-list-card.et-card-focused {
  background: rgba(255, 255, 255, 0.08) !important;
  outline-color: var(--rg-primary, #10B981) !important;
}

html.dark .et-lookup-list-card.et-card-selected,
[data-theme="dark"] .et-lookup-list-card.et-card-selected {
  background: rgba(8, 122, 79, 0.25) !important;
  border-color: var(--rg-primary, #10B981) !important;
}

html.dark .et-lookup-card-title,
[data-theme="dark"] .et-lookup-card-title {
  color: #FFFFFF !important;
}

html.dark .et-lookup-card-subtitle,
[data-theme="dark"] .et-lookup-card-subtitle {
  color: var(--rg-text-muted, #CBD5E1) !important;
}

html.dark .et-lookup-card-badge,
[data-theme="dark"] .et-lookup-card-badge {
  background: rgba(6, 182, 212, 0.2) !important;
  color: #38BDF8 !important;
}

html.dark .et-lookup-state-msg,
[data-theme="dark"] .et-lookup-state-msg,
html.dark .et-lookup-empty-msg,
[data-theme="dark"] .et-lookup-empty-msg {
  color: var(--rg-text-muted, #CBD5E1) !important;
}

/* ---------------------------------------------------------------------------
   Lookup input containment.
   Host apps style every input inside .modal-body/.drawer-body/.field with
   padding/border/background (specificity up to 0,3,1), which pushed lookup text
   under the search icon and drew a second border inside the pill. The lookup
   input is an internal part of a composite control, so its box is locked here.
   Logical properties mirror automatically for RTL.
   --------------------------------------------------------------------------- */
.et-lookup-pill-box > input.et-lookup-input {
  padding-block: 0 !important;
  padding-inline-start: 40px !important;
  padding-inline-end: 40px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  width: 100% !important;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.et-lookup-pill-box .et-lookup-search-icon {
  inset-inline-start: 14px;
  inset-inline-end: auto;
}
:is(.et-lookup-rtl, [dir="rtl"], .rtl) .et-lookup-pill-box .et-lookup-search-icon,
.et-lookup-container[dir="rtl"] .et-lookup-pill-box .et-lookup-search-icon {
  left: auto;
  right: 14px;
}

/* ===== WhatsApp template preview, status chip, detail panel (WASELONE-NODE-001 P07) ===== */
.et-wa-preview { background: #e5ddd5; border-radius: 10px; padding: 14px; max-width: 360px; font-family: inherit; }
.et-wa-bubble { background: #fff; border-radius: 8px; border-start-start-radius: 0; padding: 8px 10px 4px; box-shadow: 0 1px 0.5px rgba(0, 0, 0, .13); white-space: pre-wrap; overflow-wrap: anywhere; }
.et-wa-header { font-weight: 700; margin-bottom: 4px; }
.et-wa-body { font-size: .92rem; line-height: 1.45; color: #111b21; }
.et-wa-footer { font-size: .78rem; color: #667781; margin-top: 4px; }
.et-wa-meta { font-size: .68rem; color: #667781; text-align: end; margin-top: 2px; }
.et-wa-buttons { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.et-wa-button { background: #fff; border-radius: 8px; text-align: center; padding: 8px; color: #027eb5; font-size: .88rem; font-weight: 600; box-shadow: 0 1px 0.5px rgba(0, 0, 0, .13); }
.et-tpl-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: #eef2f6; color: #334155; }
.et-tpl-ok { background: #d1fae5; color: #065f46; }
.et-tpl-wait { background: #fef3c7; color: #92400e; }
.et-tpl-bad { background: #fee2e2; color: #991b1b; }
.et-tpl-quality { margin-inline-start: 6px; font-size: .72rem; font-weight: 600; color: #475569; }
.et-tpl-quality-green { color: #047857; }
.et-tpl-quality-yellow { color: #b45309; }
.et-tpl-quality-red { color: #b91c1c; }
.et-tpl-lock { margin-inline-start: 6px; font-size: .8rem; }
.et-tpl-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 1.25rem; align-items: start; }
.et-tpl-detail-rows { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: 0; font-size: .88rem; }
.et-tpl-detail-rows dt { color: var(--et-text-muted, #64748b); font-weight: 600; }
.et-tpl-detail-rows dd { margin: 0; }
@media (max-width: 760px) { .et-tpl-detail { grid-template-columns: 1fr; } }
