:root {
  --sidebar-width: 280px;
  --topbar-height: 72px;
  --page-bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-muted: #f1f5f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #8b95a5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 14px 38px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.14);
  --radius-sm: 3px;
  --radius-md: 3px;
  --radius-lg: 3px;
  --font-size-ui: 14px;
  --font-size-small: 13px;
  --font-size-label: 12px;
  --font-size-heading-sm: 16px;
  --font-size-heading-md: 18px;
  --font-size-heading-lg: 28px;
  --font-size-stat: 28px;
  --icon-size-ui: 16px;
  --font-app: "Inter", "Segoe UI", system-ui, sans-serif;
}

html[dir="rtl"] {
  --font-app: "Cairo", "Segoe UI", system-ui, sans-serif;
}

[data-bs-theme="dark"] {
  --page-bg: #0f172a;
  --surface: #111827;
  --surface-soft: #172033;
  --surface-muted: #1f2937;
  --border: #243244;
  --border-strong: #334155;
  --text: #f9fafb;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --primary-soft: rgba(37, 99, 235, 0.18);
}

* {
  letter-spacing: 0;
}

html {
  scrollbar-width: thin;
  scrollbar-color: #aab4c3 #eef2f7;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #eef2f7;
}

::-webkit-scrollbar-thumb {
  border: 2px solid #eef2f7;
  border-radius: 999px;
  background: #aab4c3;
}

::-webkit-scrollbar-thumb:hover {
  background: #7c8899;
}

[data-bs-theme="dark"] {
  scrollbar-color: #475569 #111827;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
  background: #111827;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  border-color: #111827;
  background: #475569;
}

body {
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-app);
  font-size: var(--font-size-ui);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

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

.app-sidebar {
  position: fixed;
  inset-block: 0;
  width: var(--sidebar-width);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0b1220;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 22px 0 60px rgba(15, 23, 42, 0.18);
  transition: transform 0.24s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.72) transparent;
}

.app-sidebar::-webkit-scrollbar {
  width: 8px;
}

.app-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
  border: 2px solid #0b1220;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
}

html:not([dir="rtl"]) .app-sidebar {
  left: 0;
}

html[dir="rtl"] .app-sidebar {
  right: 0;
}

.sidebar-brand {
  padding: 1.2rem 1.25rem 1rem;
}

.sidebar-brand a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #fff;
}

.brand-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 211, 102, 0.24);
  flex: 0 0 42px;
}

.brand-icon i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.brand-text,
.brand-sub {
  display: block;
}

.brand-text {
  font-weight: 800;
  line-height: 1.05;
}

.brand-sub {
  margin-top: 0.18rem;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 0.25rem 0.8rem 1.2rem;
}

.nav-section-label {
  padding: 0.75rem 0.75rem;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-sidebar .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.78rem;
  min-height: 40px;
  margin: 0.08rem 0;
  padding: 0.6rem 0.75rem;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 600;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.app-sidebar .nav-link i {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.58);
  font-size: 1rem;
  line-height: 1;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.app-sidebar .nav-link.active {
  box-shadow: inset 3px 0 0 #25d366;
}

html[dir="rtl"] .app-sidebar .nav-link.active {
  box-shadow: inset -3px 0 0 #25d366;
}

.app-sidebar .nav-link.active i {
  color: #25d366;
}

.app-topbar {
  position: fixed;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(18px);
}

html:not([dir="rtl"]) .app-topbar {
  left: var(--sidebar-width);
  right: 0;
}

html[dir="rtl"] .app-topbar {
  right: var(--sidebar-width);
  left: 0;
}

[data-bs-theme="dark"] .app-topbar {
  background: rgba(17, 24, 39, 0.86);
}

.topbar-search {
  min-width: 280px;
  height: 42px;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  background: var(--surface-soft);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-search i,
.icon-btn i,
.profile-btn i,
.btn i,
.dropdown-item i,
.card-header i,
.empty-state i,
.page-link i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-inline-start: auto;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  flex: 0 0 40px;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: var(--border-strong);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--danger);
}

html[dir="rtl"] .notification-dot {
  right: auto;
  left: 10px;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.lang-switcher form {
  margin: 0;
}

.btn-lang {
  min-width: 36px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 800;
}

.btn-lang.active-lang {
  color: #fff;
  background: var(--primary);
}

.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.28rem 0.45rem 0.28rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

html[dir="rtl"] .profile-btn {
  padding: 0.28rem 0.35rem 0.28rem 0.45rem;
}

.profile-btn img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-copy span,
.profile-copy small {
  display: block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
}

.profile-copy span {
  font-size: 0.82rem;
  font-weight: 800;
}

.profile-copy small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.premium-dropdown {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.45rem;
  box-shadow: var(--shadow-lg);
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.45rem;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 700;
}

.sidebar-brand .site-logo {
  height: 34px;
  width: 34px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-badge-sm {
  font-size: 0.65rem;
  padding: 2px 5px;
}

.notif-dropdown-menu {
  min-width: 320px;
  border-radius: 12px;
  overflow: hidden;
}

.notif-list-scroll {
  max-height: 380px;
  overflow-y: auto;
}

.dropdown-item:hover,
.dropdown-item:focus {
  color: var(--primary);
  background: var(--primary-soft);
}

.app-main {
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

html:not([dir="rtl"]) .app-main {
  margin-left: var(--sidebar-width);
}

html[dir="rtl"] .app-main {
  margin-right: var(--sidebar-width);
}

.content-wrap {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 1.6rem;
}

.page-kicker {
  display: block;
  margin-bottom: 1.25rem;
  text-align: start;
}

.page-kicker h1 {
  margin: 0.25rem 0 0;
  color: var(--text);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 800;
}

.breadcrumb {
  --bs-breadcrumb-divider-color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.breadcrumb-item,
.breadcrumb-item.active {
  color: var(--text-muted);
}

.toast-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.premium-alert,
.alert {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.premium-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.card,
.table-card,
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header,
.card-footer {
  border-color: var(--border);
  background: var(--surface);
}

.card-header:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card {
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  flex: 0 0 50px;
}

.stat-card .stat-icon i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.stat-value {
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.stat-card .stat-icon-sm {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.stat-value-sm {
  font-size: 1.25rem;
  line-height: 1;
}

.stat-sub-xs {
  font-size: 0.7rem;
}

.stat-label {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.btn {
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-x: 0.9rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-font-weight: 750;
  --bs-btn-line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  box-shadow: none;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}

.btn-sm {
  --bs-btn-padding-x: 0.72rem;
  --bs-btn-padding-y: 0.38rem;
  --bs-btn-font-size: 0.82rem;
  min-height: 36px;
  gap: 0.38rem;
}

.btn-lg {
  --bs-btn-padding-x: 1.1rem;
  --bs-btn-padding-y: 0.65rem;
  min-height: 46px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active,
.btn.show {
  transform: translateY(0);
}

.btn:focus-visible {
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.16);
}

.btn i {
  width: 1.05em;
  min-width: 1.05em;
  margin: 0 !important;
  vertical-align: middle;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1e40af;
  --bs-btn-active-border-color: #1e40af;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.btn-primary:hover {
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.btn-secondary,
.btn-light,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success {
  --bs-btn-bg: var(--surface);
  --bs-btn-color: var(--text-soft);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface-soft);
  --bs-btn-hover-color: var(--text);
  --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-bg: var(--surface-muted);
  --bs-btn-active-color: var(--text);
  --bs-btn-active-border-color: var(--border-strong);
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-hover-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-soft);
  --bs-btn-hover-border-color: rgba(37, 99, 235, 0.35);
}

.btn-success,
.btn-outline-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--success);
  --bs-btn-border-color: var(--success);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #15803d;
  --bs-btn-hover-border-color: #15803d;
}

.btn-outline-success {
  --bs-btn-color: var(--success);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: rgba(22, 163, 74, 0.26);
  --bs-btn-hover-color: var(--success);
  --bs-btn-hover-bg: #dcfce7;
  --bs-btn-hover-border-color: rgba(22, 163, 74, 0.36);
}

.btn-danger,
.btn-outline-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #b91c1c;
  --bs-btn-hover-border-color: #b91c1c;
}

.btn-outline-danger,
.btn-light.text-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: rgba(220, 38, 38, 0.18);
  --bs-btn-hover-color: var(--danger);
  --bs-btn-hover-bg: #fee2e2;
  --bs-btn-hover-border-color: rgba(220, 38, 38, 0.28);
}

.btn-warning {
  --bs-btn-color: #111827;
  --bs-btn-bg: #fbbf24;
  --bs-btn-border-color: #fbbf24;
  --bs-btn-hover-color: #111827;
  --bs-btn-hover-bg: #f59e0b;
  --bs-btn-hover-border-color: #f59e0b;
}

.btn-info {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--info);
  --bs-btn-border-color: var(--info);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #0e7490;
  --bs-btn-hover-border-color: #0e7490;
}

td .btn,
.table .btn,
.table-card .btn {
  min-height: 36px;
}

td .btn-sm,
.table .btn-sm,
.table-card .btn-sm {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
}

td .btn-sm:not(:has(i)),
.table .btn-sm:not(:has(i)),
.table-card .btn-sm:not(:has(i)) {
  width: auto;
  min-width: 36px;
  padding-inline: 0.72rem;
}

td .btn i,
.table .btn i,
.table-card .btn i {
  margin: 0 !important;
}

td .btn-light,
.table .btn-light,
.table-card .btn-light {
  --bs-btn-color: #fff;
  --bs-btn-bg: #475569;
  --bs-btn-border-color: #475569;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #334155;
  --bs-btn-hover-border-color: #334155;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1f2937;
  --bs-btn-active-border-color: #1f2937;
}

td .btn-light.text-danger,
.table .btn-light.text-danger,
.table-card .btn-light.text-danger,
td .btn-danger,
.table .btn-danger,
.table-card .btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #b91c1c;
  --bs-btn-hover-border-color: #b91c1c;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #991b1b;
  --bs-btn-active-border-color: #991b1b;
  color: #fff !important;
}

td .btn-primary,
.table .btn-primary,
.table-card .btn-primary {
  color: #fff !important;
}

td .btn-outline-secondary,
.table .btn-outline-secondary,
.table-card .btn-outline-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #475569;
  --bs-btn-border-color: #475569;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #334155;
  --bs-btn-hover-border-color: #334155;
}

.btn-group > .btn,
.input-group .btn {
  border-radius: var(--radius-sm);
}

.dropdown-toggle::after {
  margin-inline-start: 0.18rem;
  vertical-align: 0.12em;
}

.form-control,
.form-select,
.input-group-text {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: var(--surface);
}

.form-select {
  appearance: none;
  padding-inline-end: 2.55rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2364758b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 14px;
}

html[dir="rtl"] .form-select {
  padding-inline-start: 2.55rem;
  padding-inline-end: 0.75rem;
  background-position: left 0.9rem center;
}

.form-control,
.form-select {
  min-height: 42px;
}

textarea.form-control {
  min-height: auto;
}

.form-label {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 800 !important;
}

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

.form-control:focus,
.form-select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.12);
}

.input-group > .form-control:not(:first-child),
.input-group > .form-select:not(:first-child) {
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.input-group > .input-group-text:not(:last-child) {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}

.badge {
  border-radius: 999px;
  padding: 0.42em 0.68em;
  font-weight: 800;
}

.badge-draft,
.badge.bg-secondary,
.bg-secondary-subtle {
  background: #eef2f7 !important;
  color: #475569 !important;
}

.badge-scheduled,
.badge.bg-info,
.bg-info-subtle {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}

.badge-sending,
.badge.bg-warning,
.bg-warning-subtle {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.badge-completed,
.badge.bg-success,
.bg-success-subtle {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.badge-failed,
.badge.bg-danger,
.bg-danger-subtle {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.badge-paused,
.bg-primary-subtle {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
}

.table {
  color: var(--text);
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--border);
}

.table thead th,
.table-card table.dataTable thead th {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody td,
.table-card table.dataTable tbody td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
}

.table-hover > tbody > tr:hover > * {
  background: var(--surface-soft);
}

.metric-bar,
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress-bar {
  border-radius: 999px;
}

.progress-thick {
  height: 10px;
}

div.dataTables_wrapper div.dataTables_filter,
div.dataTables_wrapper div.dataTables_length {
  padding: 0;
}

div.dataTables_wrapper {
  position: relative;
}

div.dataTables_wrapper div.dataTables_filter {
  float: none !important;
  text-align: end !important;
}

div.dataTables_wrapper div.dataTables_length {
  float: none !important;
  text-align: start !important;
}

div.dataTables_wrapper > .row:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 1rem 1.25rem 0.75rem;
}

div.dataTables_wrapper > .row:first-child > [class*="col-"] {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
  padding: 0;
}

div.dataTables_filter label,
div.dataTables_length label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

div.dataTables_filter label {
  justify-content: flex-end;
}

div.dataTables_filter input,
div.dataTables_length select {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background-color: var(--surface-soft);
}

div.dataTables_length select {
  appearance: none;
  min-width: 88px;
  padding: 0.45rem 2.15rem 0.45rem 0.85rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2364758b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 14px;
}

html[dir="rtl"] div.dataTables_length select {
  padding: 0.45rem 0.85rem 0.45rem 2.15rem;
  background-position: left 0.8rem center;
}

html[dir="rtl"] table.dataTable thead th,
html[dir="rtl"] table.dataTable thead td,
html[dir="rtl"] table.dataTable tfoot th,
html[dir="rtl"] table.dataTable tfoot td {
  text-align: right;
}

div.dataTables_filter input {
  width: min(260px, 68vw);
  min-height: 38px;
  padding: 0.45rem 0.85rem;
}

div.dataTables_filter input:focus,
div.dataTables_length select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
  outline: 0;
}

.premium-choice {
  margin-bottom: 0;
  min-width: 170px;
  color: var(--text);
  font-weight: 700;
}

.premium-choice.choices,
.premium-choice .choices__inner {
  min-height: 42px;
}

.premium-choice .choices__inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.45rem 2.4rem 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.925rem;
  box-shadow: none;
}

html[dir="rtl"] .premium-choice .choices__inner {
  padding: 0.45rem 0.85rem 0.45rem 2.4rem;
}

.premium-choice.is-focused .choices__inner,
.premium-choice.is-open .choices__inner {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.premium-choice::after {
  width: 8px;
  height: 8px;
  margin-top: -5px;
  border-width: 0 2px 2px 0;
  border-color: var(--text-muted);
  transform: rotate(45deg);
  right: 1rem;
}

html[dir="rtl"] .premium-choice::after {
  right: auto;
  left: 1rem;
}

.premium-choice.is-open::after {
  margin-top: -1px;
  transform: rotate(225deg);
}

.premium-choice .choices__list--single {
  padding: 0;
}

.premium-choice .choices__placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.premium-choice .choices__list--dropdown,
.premium-choice .choices__list[aria-expanded] {
  z-index: 1060;
  margin-top: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.premium-choice .choices__list--dropdown .choices__item,
.premium-choice .choices__list[aria-expanded] .choices__item {
  padding: 0.65rem 0.8rem;
  color: var(--text-soft);
  font-weight: 700;
}

.premium-choice
  .choices__list--dropdown
  .choices__item--selectable.is-highlighted,
.premium-choice
  .choices__list[aria-expanded]
  .choices__item--selectable.is-highlighted {
  color: var(--primary);
  background: var(--primary-soft);
}

.premium-choice-sm,
.premium-choice-sm.choices,
.premium-choice-length,
.premium-choice-length.choices {
  min-width: 100px;
}

.premium-choice-sm .choices__inner,
.premium-choice-length .choices__inner {
  min-height: 38px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.88rem;
}

.table-filter-select + .premium-choice {
  min-width: 170px;
}

div.dataTables_wrapper div.dataTables_info,
div.dataTables_wrapper div.dataTables_paginate {
  padding: 0.85rem 1.25rem 1.1rem;
}

div.dataTables_info {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

div.dataTables_paginate .pagination {
  gap: 0.25rem;
  margin: 0;
}

div.dataTables_paginate .page-link,
.pagination .page-link {
  min-width: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) !important;
  color: var(--text-soft);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

div.dataTables_paginate .page-item.active .page-link,
.pagination .page-item.active .page-link {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

div.dataTables_processing {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  z-index: 20 !important;
  width: auto !important;
  min-width: 78px;
  height: auto !important;
  margin: 0 !important;
  padding: 0.75rem 0.95rem !important;
  transform: translate(-50%, -50%) !important;
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  text-align: center;
  backdrop-filter: blur(10px);
}

div.dataTables_processing > div {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  margin: 0 !important;
  color: var(--text-soft) !important;
  font-size: 0 !important;
  font-weight: 750;
  white-space: nowrap;
}

div.dataTables_processing .spinner-border,
div.dataTables_processing .spinner-border-sm {
  display: none !important;
}

div.dataTables_processing
  > div
  > div:not(.spinner-border):not(.spinner-border-sm) {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  min-height: 8px !important;
  border: 0 !important;
  border-radius: var(--radius-sm) !important;
  background: var(--primary) !important;
  opacity: 0.85;
  animation: datatable-loading-dot 0.9s infinite ease-in-out;
}

div.dataTables_processing
  > div
  > div:not(.spinner-border):not(.spinner-border-sm):nth-child(2) {
  animation-delay: 0.12s;
}

div.dataTables_processing
  > div
  > div:not(.spinner-border):not(.spinner-border-sm):nth-child(3) {
  animation-delay: 0.24s;
}

div.dataTables_processing
  > div
  > div:not(.spinner-border):not(.spinner-border-sm):nth-child(n + 5) {
  display: none !important;
}

@keyframes datatable-loading-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

[data-bs-theme="dark"] div.dataTables_processing {
  background: rgba(17, 24, 39, 0.96);
}

table.dataTable.no-footer {
  border-bottom: 0 !important;
}

.filter-rule {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 0.7rem;
  min-height: 220px;
  padding: 2.5rem 1rem;
  text-align: center;
}

.empty-state i {
  display: inline-flex;
  width: 56px;
  height: 56px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.55rem;
}

.empty-state h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.empty-state p {
  max-width: 460px;
  margin: 0;
  color: var(--text-muted);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.table-filter-select {
  width: auto;
  min-width: 170px;
  border-radius: 999px;
  background-color: var(--surface-soft);
  font-weight: 700;
}

.form-select-sm.table-filter-select {
  min-height: 38px;
  padding-block: 0.38rem;
}

.status-filter-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.status-filter-group .btn {
  border-radius: var(--radius-sm);
  padding-inline: 0.9rem;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1035;
  display: none;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(2px);
}

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

@media (max-width: 991.98px) {
  html:not([dir="rtl"]) .app-sidebar {
    transform: translateX(-100%);
  }

  html[dir="rtl"] .app-sidebar {
    transform: translateX(100%);
  }

  .app-sidebar.show {
    transform: translateX(0) !important;
  }

  html:not([dir="rtl"]) .app-topbar,
  html[dir="rtl"] .app-topbar {
    left: 0;
    right: 0;
  }

  html:not([dir="rtl"]) .app-main,
  html[dir="rtl"] .app-main {
    margin-left: 0;
    margin-right: 0;
  }

  .content-wrap {
    padding: 1rem;
  }

  .page-kicker {
    display: block;
  }

  div.dataTables_wrapper div.dataTables_filter,
  div.dataTables_wrapper div.dataTables_length {
    float: none !important;
    text-align: start !important;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-filter-select {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  :root {
    --topbar-height: 64px;
  }

  .app-topbar {
    padding: 0 0.85rem;
  }

  .topbar-actions {
    gap: 0.45rem;
  }

  .lang-switcher,
  .icon-btn[aria-label="Notifications"] {
    display: none;
  }

  .page-kicker h1 {
    font-size: 1.28rem;
  }

  .card-body {
    padding: 1rem;
  }
}

/* Global radius cap: keep the entire admin UI at 5px maximum. */
.rounded,
.rounded-0,
.rounded-1,
.rounded-2,
.rounded-3,
.rounded-4,
.rounded-5,
.rounded-circle,
.rounded-pill,
.btn,
.btn-group > .btn,
.input-group .btn,
.icon-btn,
.profile-btn,
.profile-btn img,
.brand-icon,
.topbar-search,
.lang-switcher,
.btn-lang,
.card,
.table-card,
.stat-card,
.stat-card .stat-icon,
.card-header,
.card-footer,
.modal-content,
.modal-header,
.modal-footer,
.dropdown-menu,
.dropdown-item,
.form-control,
.form-select,
.input-group-text,
.choices,
.premium-choice .choices__inner,
.premium-choice .choices__list--dropdown,
.premium-choice .choices__list[aria-expanded],
.badge,
.progress,
.progress-bar,
.page-link,
.pagination .page-link,
.filter-rule,
.empty-state i,
.table-filter-select,
div.dataTables_filter input,
div.dataTables_length select,
div.dataTables_processing,
::-webkit-scrollbar-thumb {
  border-radius: var(--radius-sm) !important;
}

/* Global typography normalization for consistent UI text and icon sizing. */
body,
.app-sidebar .nav-link,
.topbar-search,
.dropdown-menu,
.dropdown-item,
.form-control,
.form-select,
.input-group-text,
.btn,
.modal,
.card,
.table,
.table-card table,
.dataTables_wrapper,
.choices,
.premium-choice .choices__inner,
.premium-choice .choices__list--dropdown .choices__item,
.premium-choice .choices__list[aria-expanded] .choices__item,
.pagination,
.alert {
  font-size: var(--font-size-ui) !important;
}

.small,
small,
.form-text,
.breadcrumb,
.profile-copy span,
.badge,
div.dataTables_info,
.table thead th,
.table-card table.dataTable thead th {
  font-size: var(--font-size-small) !important;
}

.nav-section-label,
.brand-sub,
.profile-copy small,
.stat-label {
  font-size: var(--font-size-label) !important;
}

.btn i,
.icon-btn i,
.profile-btn i,
.dropdown-item i,
.app-sidebar .nav-link i,
.topbar-search i,
.card-header i,
.modal-title i,
.input-group-text i,
.table .btn i,
.table-card .btn i,
.empty-state i {
  width: var(--icon-size-ui) !important;
  min-width: var(--icon-size-ui) !important;
  height: var(--icon-size-ui) !important;
  font-size: var(--icon-size-ui) !important;
  line-height: 1 !important;
}

.btn,
.dropdown-item,
.input-group-text,
.badge,
.page-link,
.choices__inner {
  line-height: 1.15 !important;
}

/* Strict final type scale: keep every screen visually consistent. */
.content-wrap,
.page-header,
.card-body,
.card-footer,
.modal-body,
.modal-footer,
.table tbody,
.table tbody td,
.table-card table.dataTable tbody td,
.list-group,
.list-group-item,
.dropdown-header,
.dropdown-item,
.form-check-label,
.form-label,
.form-text,
.text-muted,
.text-primary,
.text-success,
.text-danger,
.text-warning,
.text-info,
.fw-medium,
.fw-semibold,
.fw-bold,
code,
label,
input,
select,
textarea,
button,
a,
p,
span,
td,
dd,
dt {
  font-size: var(--font-size-ui) !important;
}

.page-kicker h1 {
  font-size: var(--font-size-heading-lg) !important;
  line-height: 1.15 !important;
}

x-page-header,
.content-wrap > .d-flex h5,
.content-wrap h5.fw-bold,
.modal-title {
  font-size: var(--font-size-heading-md) !important;
  line-height: 1.25 !important;
}

.card-header h6,
.card-header .fw-semibold,
.content-wrap h6,
.empty-state h3 {
  font-size: var(--font-size-heading-sm) !important;
  line-height: 1.25 !important;
}

.stat-value {
  font-size: var(--font-size-stat) !important;
}

.small,
small,
.form-text,
.breadcrumb,
.breadcrumb a,
.breadcrumb-item,
.profile-copy span,
.profile-copy small,
.brand-sub,
.nav-section-label,
.stat-label,
.badge,
div.dataTables_info,
div.dataTables_filter label,
div.dataTables_length label,
.table thead th,
.table-card table.dataTable thead th {
  font-size: var(--font-size-small) !important;
}

.display-1,
.display-2,
.display-3,
.display-4,
.display-5,
.display-6,
.dataTables_empty i,
.empty-state i {
  font-size: 1.75rem !important;
}

.fs-1,
.fs-2,
.fs-3,
.fs-4,
.fs-5,
.fs-6 {
  font-size: var(--font-size-ui) !important;
}

.btn,
.btn-sm,
.btn-lg,
.form-control,
.form-select,
.choices__inner,
.choices__item,
.dropdown-menu,
.dropdown-item,
.page-link,
.alert,
.badge {
  font-size: var(--font-size-ui) !important;
}

.table thead th,
.table-card table.dataTable thead th {
  font-size: var(--font-size-label) !important;
}

.bi,
[class^="bi-"],
[class*=" bi-"] {
  font-size: var(--icon-size-ui) !important;
  line-height: 1 !important;
}

.stat-icon .bi,
.empty-state .bi,
.dataTables_empty .bi {
  font-size: 1rem !important;
}

/* Final simplified scale: normal UI text should look the same everywhere. */
body,
.app-main,
.content-wrap,
.card,
.card-body,
.table,
.table tbody td,
.table-card table.dataTable tbody td,
.form-control,
.form-select,
.choices,
.choices__inner,
.choices__item,
.btn,
.dropdown-menu,
.dropdown-item,
.modal,
.alert,
.pagination,
.page-link,
.list-group-item,
p,
label,
input,
select,
textarea,
button,
a,
td,
dd,
dt {
  font-size: var(--font-size-ui) !important;
}

.small,
small,
.text-muted.small,
.form-text,
.breadcrumb,
.breadcrumb *,
.table thead th,
.table-card table.dataTable thead th,
.dataTables_info,
.dataTables_filter label,
.dataTables_length label,
.badge,
.profile-copy span {
  font-size: var(--font-size-small) !important;
}

.nav-section-label,
.brand-sub,
.profile-copy small,
.stat-label {
  font-size: var(--font-size-label) !important;
}

.card-header h6,
.card-header .fw-semibold,
.modal-title,
.empty-state h3 {
  font-size: var(--font-size-heading-sm) !important;
}

.content-wrap h5,
.content-wrap h5 *,
.page-header h5,
.page-header h5 * {
  font-size: var(--font-size-heading-md) !important;
}

.page-kicker h1 {
  font-size: var(--font-size-heading-lg) !important;
}

.stat-value {
  font-size: var(--font-size-stat) !important;
}

.bi,
.btn i,
.icon-btn i,
.profile-btn i,
.dropdown-item i,
.app-sidebar .nav-link i,
.topbar-search i,
.card-header i,
.input-group-text i,
.table .btn i,
.table-card .btn i {
  font-size: var(--icon-size-ui) !important;
  line-height: 1 !important;
}

/* Keep text in its natural casing everywhere. */
*,
.text-uppercase,
.nav-section-label,
.brand-sub,
.stat-label,
.table thead th,
.table-card table.dataTable thead th,
.badge,
.btn,
.dropdown-item {
  text-transform: none !important;
}

/* Compact table action buttons. */
td .btn-sm,
.table .btn-sm,
.table-card .btn-sm,
td .btn.btn-sm,
.table .btn.btn-sm,
.table-card .btn.btn-sm {
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  gap: 0 !important;
}

td .btn-sm:not(:has(i)),
.table .btn-sm:not(:has(i)),
.table-card .btn-sm:not(:has(i)) {
  width: auto !important;
  min-width: 30px !important;
  padding-inline: 0.55rem !important;
}

td .btn-sm i,
.table .btn-sm i,
.table-card .btn-sm i {
  width: 0.9rem !important;
  min-width: 0.9rem !important;
  height: 0.9rem !important;
  font-size: 0.9rem !important;
}

/* Compact checkbox/select columns in tables. */
.table th:first-child:has(.form-check-input),
.table td:first-child:has(.form-check-input),
.table-card table.dataTable th:first-child:has(.form-check-input),
.table-card table.dataTable td:first-child:has(.form-check-input),
.table-card table.dataTable th.sorting_disabled:first-child {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  padding-inline: 0.65rem !important;
  text-align: center !important;
}

.table th:first-child .form-check-input,
.table td:first-child .form-check-input,
.table-card table.dataTable th:first-child .form-check-input,
.table-card table.dataTable td:first-child .form-check-input {
  display: inline-block;
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  vertical-align: middle;
}

/* Keep table toolbar/header buttons readable; compact sizing is only for row actions. */
.table-toolbar .btn,
.table-toolbar .btn-sm,
.status-filter-group .btn,
.status-filter-group .btn-sm,
.card-header .btn,
.card-header .btn-sm,
.table-card > .card-header .btn,
.table-card > .card-header .btn-sm {
  width: auto !important;
  min-width: auto !important;
  height: 36px !important;
  min-height: 36px !important;
  padding-inline: 0.75rem !important;
  padding-block: 0.38rem !important;
  gap: 0.4rem !important;
  white-space: nowrap !important;
}

.status-filter-group {
  gap: 0.5rem !important;
}

.status-filter-group .btn {
  display: inline-flex !important;
  flex: 0 0 auto !important;
}

.card-header .btn i,
.table-toolbar .btn i,
.status-filter-group .btn i {
  width: var(--icon-size-ui) !important;
  min-width: var(--icon-size-ui) !important;
  height: var(--icon-size-ui) !important;
  font-size: var(--icon-size-ui) !important;
}

/* Stronger override: table filter/header buttons are not row action buttons. */
.table-card .table-toolbar .status-filter-group .btn,
.table-card .table-toolbar .status-filter-group .btn-sm,
.table-card .table-toolbar .status-filter-group .btn.btn-sm,
.table-card .table-toolbar .btn,
.table-card .table-toolbar .btn-sm,
.table-card .table-toolbar .btn.btn-sm {
  width: auto !important;
  min-width: max-content !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0.38rem 0.75rem !important;
  gap: 0.4rem !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

/* Collapsible sidebar: desktop icon-only mode. */
:root {
  --sidebar-collapsed-width: 74px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  position: relative;
  min-height: 70px;
  padding-inline-end: 1.25rem;
}

.sidebar-brand a {
  min-width: 0;
}

.sidebar-collapse-btn {
  flex: 0 0 40px;
}

.sidebar-collapse-btn:hover {
  color: var(--primary);
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

.sidebar-collapse-btn i {
  font-size: var(--icon-size-ui) !important;
  line-height: 1;
}

@media (min-width: 992px) {
  .app-sidebar,
  .app-topbar,
  .app-main {
    transition:
      width 0.18s ease,
      margin 0.18s ease,
      left 0.18s ease,
      right 0.18s ease;
  }

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

  body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-inline: 0.8rem;
    min-height: 70px;
  }

  body.sidebar-collapsed .sidebar-brand a {
    justify-content: center;
  }

  body.sidebar-collapsed .brand-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  body.sidebar-collapsed .brand-name-wrap {
    display: none !important;
  }

  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .brand-sub,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .app-sidebar .nav-link span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
  }

  body.sidebar-collapsed .sidebar-brand a img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  body.sidebar-collapsed .sidebar-collapse-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding-inline: 0.55rem;
    padding-top: 1.1rem;
  }

  body.sidebar-collapsed .nav-section-label {
    margin: 0;
    padding: 0.35rem 0;
  }

  body.sidebar-collapsed .app-sidebar .nav-link {
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 0;
    gap: 0;
  }

  body.sidebar-collapsed .app-sidebar .nav-link i {
    width: 22px !important;
    min-width: 22px !important;
    height: 22px !important;
  }

  html:not([dir="rtl"]) body.sidebar-collapsed .app-topbar {
    left: var(--sidebar-collapsed-width);
  }

  html[dir="rtl"] body.sidebar-collapsed .app-topbar {
    right: var(--sidebar-collapsed-width);
  }

  html:not([dir="rtl"]) body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
  }

  html[dir="rtl"] body.sidebar-collapsed .app-main {
    margin-right: var(--sidebar-collapsed-width);
  }
}

@media (max-width: 991.98px) {
  .topbar-left .sidebar-collapse-btn {
    display: none;
  }
}

/* ========================================================
   CREATE PAGE HELPERS
   ======================================================== */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--bs-body-color);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s;
}
.back-btn:hover {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

/* Toolbar search component — search input with magnifier icon on the right */
.toolbar-search {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.toolbar-search .form-control {
  padding-inline-end: 2.1rem !important;
  min-width: 300px;
  height: 36px !important;
  min-height: 36px !important;
}

html[dir="rtl"] .toolbar-search .form-control {
  padding-inline-end: 0.75rem !important;
  padding-inline-start: 2.1rem !important;
}

.toolbar-search .bi-search {
  position: absolute;
  inset-inline-end: 0.7rem;
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.8rem !important;
  line-height: 1 !important;
}

/* DataTables custom footer row (info + pagination) */
.dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem 0.9rem;
  border-top: 1px solid var(--border);
}

.dt-footer div.dataTables_info {
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dt-footer div.dataTables_info::before {
  font-family: "bootstrap-icons";
  content: "\f3ee";
  color: var(--text-muted);
  font-size: 0.85rem !important;
  line-height: 1 !important;
  vertical-align: middle;
}

.dt-footer div.dataTables_paginate {
  padding: 0 !important;
}

/* Toolbar responsive: stack on mobile */
@media (max-width: 767.98px) {
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .table-toolbar > div {
    flex-wrap: wrap;
  }

  .toolbar-search,
  .toolbar-search .form-control {
    width: 100%;
    min-width: 0;
  }
}

/* ── Contact Picker (custom search + list inside segment rules) ── */
.contact-picker-wrap {
  flex: 1;
  min-width: 0;
}
.cp-dropdown {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: calc(100% + 3px);
  z-index: 1060;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
}
.cp-dropdown-item {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
}
.cp-dropdown-item:last-child {
  border-bottom: none;
}
.cp-dropdown-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.cp-dropdown-empty {
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}
.cp-selected-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 5px;
}
.cp-selected-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text);
}
.cp-selected-item .cp-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transition:
    background 0.15s,
    color 0.15s;
}
.cp-remove:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* ── WhatsApp reply notification badge ── */
.wa-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ── Notification dropdown items ── */
.wa-notif-item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  transition: background 0.15s;
}

.wa-notif-item:hover {
  background: var(--bs-tertiary-bg);
  color: inherit;
}

.wa-notif-item:last-child {
  border-bottom: none;
}

/* ── Toast container ── */
#wa-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 11000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

/* ── Individual toast ── */
.wa-toast {
  pointer-events: all;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  width: 320px;
  overflow: hidden;
  animation: waToastIn 0.25s ease;
}

@keyframes waToastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wa-toast-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.wa-toast-body {
  padding: 0 12px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

.wa-toast-close {
  margin-left: auto;
  background: none;
  border: none;
  line-height: 1;
  padding: 0;
  color: var(--bs-secondary-color);
  cursor: pointer;
  font-size: 1.1rem;
}

.dt-page-size-select {
  width: 70px;
}

.wa-toast-icon {
  color: #25d366;
  font-size: 1rem;
}

.wa-toast-time {
  font-size: 0.75rem;
}

.wa-toast-preview-clamp {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wa-notif-item-time {
  font-size: 0.72rem;
  white-space: nowrap;
  margin-left: 8px;
}

.wa-notif-item-campaign {
  font-size: 0.72rem;
}

.wa-notif-item-preview {
  max-width: 280px;
}

/* ════════════════════════════════════════════════
   Auth layout (login screen)
   ════════════════════════════════════════════════ */

.auth-shell-body {
  min-height: 100vh;
  background: var(--page-bg);
  font-family: var(--font-app);
  font-size: var(--font-size-ui);
}

.auth-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Left branding panel ── */
.auth-panel {
  width: 400px;
  flex-shrink: 0;
  background: #0b1220;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}

html[dir="rtl"] .auth-panel {
  order: 1;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 20% 35%,
      rgba(37, 99, 235, 0.2) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at 80% 75%,
      rgba(37, 211, 102, 0.12) 0%,
      transparent 50%
    );
  pointer-events: none;
}

.auth-panel-brand {
  position: relative;
  z-index: 1;
}

.auth-panel-brand-logo {
  height: 44px;
  max-width: 160px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.auth-panel-brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 211, 102, 0.28);
  margin-bottom: 1rem;
}

.auth-panel-brand-name {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
}

.auth-panel-brand-sub {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.auth-panel-features {
  position: relative;
  z-index: 1;
}

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.auth-feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

.auth-feature-title {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.auth-feature-desc {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.auth-panel-footer {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.72rem;
}

/* ── Right form panel ── */
.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}

.auth-form-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.auth-lang-switcher {
  display: flex;
  gap: 0.35rem;
}

.auth-lang-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.auth-form-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
}

.auth-form-box {
  width: 100%;
  max-width: 400px;
}

.auth-form-box .form-label {
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
}

.auth-form-box .form-control {
  font-size: var(--font-size-ui);
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  height: 40px;
}

.auth-form-box .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: var(--surface);
}

.auth-form-box .input-group-text {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-muted);
  height: 40px;
}

.auth-form-box .btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
  height: 40px;
}

.auth-form-box .btn-outline-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text);
}

html[dir="rtl"] .auth-form-box .form-control {
  text-align: right;
}

/* Mobile: hide left panel, show inline brand */
@media (max-width: 767.98px) {
  .auth-panel {
    display: none;
  }

  .auth-form-topbar {
    padding: 1rem 1.25rem;
  }

  .auth-form-body {
    padding: 2rem 1.25rem;
    align-items: flex-start;
    padding-top: 2.5rem;
  }
}

/* ════════════════════════════════════════════════
   Public layout (terms / privacy pages)
   ════════════════════════════════════════════════ */

.public-body {
  font-family: var(--font-app);
  background: #f8f9fa;
}

.public-nav {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 0.75rem 0;
}

.public-nav-logo-fallback {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.page-content {
  max-width: 800px;
  margin: 2.5rem auto;
  padding: 0 1rem 4rem;
}

.page-content h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.page-body {
  white-space: pre-wrap;
  line-height: 1.8;
  color: #333;
}

.public-lang-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
}

.public-footer {
  background: #fff;
  border-top: 1px solid #e9ecef;
  padding: 1rem 0;
  font-size: 0.8rem;
  color: #6c757d;
}

/* ════════════════════════════════════════════════
   Campaign / Template builder forms + phone preview
   (shared by campaigns/create, campaigns/edit, templates/create, templates/edit)
   ════════════════════════════════════════════════ */

.section-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.section-header {
  background: var(--bs-tertiary-bg);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 10px 10px 0 0;
}

.section-body {
  padding: 1rem;
}

.badge-step-num {
  font-size: 0.65rem;
  padding: 2px 6px;
}

.badge-sm-muted {
  font-size: 0.65rem;
}

.preview-sticky {
  top: 76px;
}

.preview-disclaimer {
  font-size: 0.7rem;
}

.preview-empty-icon {
  font-size: 1.6rem;
  opacity: 0.25;
}

.cost-placeholder-icon {
  font-size: 1.4rem;
  opacity: 0.35;
}

.pricing-note {
  font-size: 0.72rem;
}

.field-hint-icon {
  font-size: 0.8rem;
}

.field-hint-text {
  font-size: 0.72rem;
}

.header-input-joined {
  border-radius: 6px 6px 0 0;
  border-bottom: none;
}

.header-input-joined--resizable {
  resize: vertical;
}

.wa-header-media-icon {
  font-size: 1.5rem;
}

.hidden-init {
  display: none;
}

/* ── Phone mockup ── */
.phone-frame {
  background: #fff;
  border-radius: 36px;
  border: 8px solid #222;
  padding: 1.5rem 0.75rem;
  min-height: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  position: relative;
  max-width: 280px;
  margin: 0 auto;
}

.phone-frame-lg {
  min-height: 560px;
}

.phone-frame::before {
  content: "";
  display: block;
  width: 60px;
  height: 6px;
  background: #222;
  border-radius: 3px;
  margin: 0 auto 0.75rem;
}

.phone-statusbar {
  display: flex;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #555;
  padding: 0 0.25rem 0.5rem;
}

.wa-chat-header {
  background: #075e54;
  color: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wa-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.wa-chat-header-name {
  font-weight: 600;
  font-size: 0.8rem;
}

.wa-chat-header-sub {
  font-size: 0.6rem;
  opacity: 0.8;
}

.wa-chat-bg {
  background: #e5ddd5
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9c4be' fill-opacity='0.2'%3E%3Cpath d='M50 50c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10zM10 10c0-5.523 4.477-10 10-10s10 4.477 10 10-4.477 10-10 10c0 5.523-4.477 10-10 10S0 25.523 0 20s4.477-10 10-10zm10 8c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm40 40c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  border-radius: 12px;
  padding: 0.75rem 0.5rem;
  min-height: 240px;
}

.wa-chat-bg-lg {
  min-height: 380px;
}

.wa-bubble {
  background: #fff;
  border-radius: 0 8px 8px 8px;
  padding: 0.6rem 0.75rem;
  max-width: 95%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  font-size: 0.78rem;
  line-height: 1.45;
}

.wa-header-media {
  background: #d1d5db;
  border-radius: 6px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.7rem;
  margin-bottom: 0.4rem;
}

.wa-header-text {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

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

.wa-footer {
  color: #8a8a8a;
  font-size: 0.7rem;
  margin-top: 0.3rem;
}

.wa-time {
  text-align: right;
  font-size: 0.6rem;
  color: #8a8a8a;
  margin-top: 0.25rem;
}

.wa-buttons {
  border-top: 1px solid #e9ecef;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.wa-btn {
  display: block;
  text-align: center;
  color: #009de2;
  font-size: 0.75rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.wa-btn:last-child {
  border-bottom: none;
}

.preview-empty {
  text-align: center;
  color: var(--bs-secondary-color);
  padding: 1.5rem 1rem;
  font-size: 0.82rem;
}

/* ── Template builder controls ── */
.btn-type-tab {
  cursor: pointer;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1.5px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  transition: all 0.15s;
}

.btn-type-tab.active {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

.char-count {
  font-size: 0.75rem;
  color: #6c757d;
}

.fmt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border: 1px solid var(--bs-border-color);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--bs-tertiary-bg);
}

.fmt-btn {
  background: none;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--bs-body-color);
  line-height: 1.4;
  transition: background 0.12s;
}

.fmt-btn:hover {
  background: var(--bs-border-color);
}

.fmt-btn.strike {
  text-decoration: line-through;
}

.fmt-btn.mono {
  font-family: monospace;
  font-size: 0.8rem;
}

.add-btn-row {
  border: 1.5px dashed var(--bs-border-color);
  border-radius: 8px;
  padding: 0.6rem;
  text-align: center;
  cursor: pointer;
  color: #6c757d;
  font-size: 0.85rem;
  transition: all 0.15s;
}

.add-btn-row:hover {
  border-color: #0d6efd;
  color: #0d6efd;
  background: rgba(13, 110, 253, 0.04);
}

.btn-row {
  background: var(--bs-tertiary-bg);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--bs-border-color);
}

.btn-type-sel {
  min-width: 160px;
}

.meta-hint {
  background: rgba(13, 110, 253, 0.06);
  border: 1px solid rgba(13, 110, 253, 0.18);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  color: var(--bs-body-color);
}

.template-body-preview {
  font-size: 0.8rem;
  line-height: 1.5;
  min-height: 60px;
}

.template-show-preview-bg {
  background: #e5ddd5;
  border-radius: 14px;
  padding: 1.5rem;
}

.template-show-preview-bubble {
  background: #dcf8c6;
  border-radius: 10px 0 10px 10px;
  padding: 1rem;
  max-width: 90%;
  margin-left: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.template-show-preview-text {
  white-space: pre-wrap;
  line-height: 1.5;
}

.template-show-preview-time {
  font-size: 0.65rem;
}

/* ════════════════════════════════════════════════
   Inbox
   ════════════════════════════════════════════════ */

.icon-wa-green {
  color: #25d366;
}

.icon-xs {
  font-size: 0.65rem;
}

.dropdown-menu-scroll {
  max-height: 280px;
  overflow-y: auto;
}

.unread-count-badge {
  background: #25d366;
  font-size: 0.75rem;
}

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  text-transform: uppercase;
}
.conv-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.conv-name-cell .cn-body .cn-name {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.25;
  color: var(--bs-body-color);
}
.conv-name-cell .cn-body .cn-phone {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  margin-top: 2px;
}

.msg-preview-cell {
  font-size: 0.82rem;
  max-width: 260px;
}
.msg-preview-cell .preview-text {
  color: var(--bs-body-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.msg-preview-cell .preview-dir {
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
}

.campaign-pill-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(37, 211, 102, 0.1);
  color: #128c7e;
  border: 1px solid rgba(37, 211, 102, 0.22);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-bs-theme="dark"] .campaign-pill-sm {
  color: #25d366;
}

.unread-badge-tbl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: #25d366;
  color: #fff;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 0 5px;
}

.tpl-tag-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.69rem;
  color: #128c7e;
  background: rgba(37, 211, 102, 0.07);
  border: 1px solid rgba(37, 211, 102, 0.18);
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 500;
}
[data-bs-theme="dark"] .tpl-tag-sm {
  color: #25d366;
}

.icon-primary-xs {
  color: var(--bs-primary);
  font-size: 0.65rem;
}

.fs-77 {
  font-size: 0.77rem;
}
.fs-78 {
  font-size: 0.78rem;
}
.fs-82 {
  font-size: 0.82rem;
}

.btn-wa-green {
  background: #25d366;
  border-color: #25d366;
}

.btn-wa-green-solid {
  background: #25d366;
  border-color: #25d366;
  color: #fff;
  font-size: 0.78rem;
}

.chat-empty-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-empty-icon {
  font-size: 1.8rem;
  color: #25d366;
}

/* ═══════════════════════════════════════
   INBOX LAYOUT
═══════════════════════════════════════ */
.inbox-wrap {
  display: flex;
  height: calc(100vh - 132px);
  min-height: 520px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--bs-border-color);
}

/* ═══════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════ */
.inbox-sidebar {
  width: 310px;
  flex-shrink: 0;
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  background: var(--bs-body-bg);
}

.sidebar-top {
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-secondary-color);
  margin-bottom: 0.55rem;
}

.sidebar-search-box {
  position: relative;
}

.sidebar-search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  pointer-events: none;
}

.sidebar-search-box input {
  padding-left: 2rem;
  border-radius: 20px;
  font-size: 0.82rem;
  background: var(--bs-tertiary-bg);
  border-color: transparent;
}

.sidebar-search-box input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
  background: var(--bs-body-bg);
}

.conv-list {
  flex: 1;
  overflow-y: auto;
}

.conv-list::-webkit-scrollbar {
  width: 4px;
}

.conv-list::-webkit-scrollbar-track {
  background: transparent;
}

.conv-list::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 2px;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  position: relative;
}

.conv-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #25d366;
  border-radius: 0 3px 3px 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.conv-item:hover {
  background: var(--bs-tertiary-bg);
  color: inherit;
}

.conv-item.active {
  background: rgba(37, 211, 102, 0.07);
}

.conv-item.active::before {
  opacity: 1;
}

.ci-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

.ci-body {
  flex: 1;
  min-width: 0;
}

.ci-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ci-preview {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1px;
}

.ci-meta {
  text-align: right;
  flex-shrink: 0;
}

.ci-time {
  font-size: 0.68rem;
  color: var(--bs-secondary-color);
}

.unread-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: #25d366;
  color: #fff;
  border-radius: 9px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0 4px;
  margin-top: 4px;
}

.sidebar-footer {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--bs-border-color);
}

/* ═══════════════════════════════════════
   CHAT PANEL
═══════════════════════════════════════ */
.inbox-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bs-body-bg);
}

/* Header */
.chat-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bs-body-bg);
  flex-shrink: 0;
}

.hdr-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

.hdr-name {
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.2;
}

.hdr-phone {
  font-size: 0.77rem;
  color: var(--bs-secondary-color);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1px;
}

.hdr-right {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.campaign-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(37, 211, 102, 0.12);
  color: #128c7e;
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-bs-theme="dark"] .campaign-pill {
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border-color: rgba(37, 211, 102, 0.3);
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background-color: var(--bs-tertiary-bg);
  background-image: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.035) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
}

[data-bs-theme="dark"] .chat-messages {
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 3px;
}

/* Date separator */
.msg-date-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.6rem 0;
  color: var(--bs-secondary-color);
  font-size: 0.72rem;
}

.msg-date-sep::before,
.msg-date-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bs-border-color);
}

.msg-date-sep span {
  background: var(--bs-body-bg);
  padding: 2px 12px;
  border-radius: 10px;
  border: 1px solid var(--bs-border-color);
  font-weight: 500;
  white-space: nowrap;
}

/* Message rows */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  max-width: 100%;
}

.msg-row.outbound {
  flex-direction: row-reverse;
}

/* Bubble tail using pseudo-element */
.msg-bubble {
  max-width: 65%;
  padding: 0.6rem 0.85rem 0.45rem;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  position: relative;
  word-break: break-word;
  transition: box-shadow 0.15s;
}

.msg-bubble.inbound {
  background: var(--bs-body-bg);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.msg-bubble.inbound::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 0;
  border: 6px solid transparent;
  border-right-color: var(--bs-body-bg);
  border-bottom-color: var(--bs-body-bg);
}

.msg-bubble.outbound {
  background: #d9fdd3;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: #1a1a1a;
}

.msg-bubble.outbound::before {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 0;
  border: 6px solid transparent;
  border-left-color: #d9fdd3;
  border-bottom-color: #d9fdd3;
}

[data-bs-theme="dark"] .msg-bubble.outbound {
  background: #025144;
  color: #e8f5e9;
}

[data-bs-theme="dark"] .msg-bubble.outbound::before {
  border-left-color: #025144;
  border-bottom-color: #025144;
}

/* Template tag inside bubble */
.msg-tpl-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.69rem;
  color: #128c7e;
  background: rgba(37, 211, 102, 0.1);
  border: 1px solid rgba(37, 211, 102, 0.2);
  border-radius: 6px;
  padding: 1px 7px 1px 5px;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

[data-bs-theme="dark"] .msg-tpl-tag {
  color: #25d366;
  background: rgba(37, 211, 102, 0.12);
}

.msg-campaign-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.69rem;
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.08);
  border-radius: 6px;
  padding: 1px 7px 1px 5px;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

/* Message text */
.msg-text {
  line-height: 1.5;
}

/* Meta row */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
  justify-content: flex-end;
}

.msg-time {
  font-size: 0.64rem;
  color: rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .msg-time {
  color: rgba(255, 255, 255, 0.4);
}

.msg-status {
  font-size: 0.75rem;
  line-height: 1;
}

.msg-status.s-read {
  color: var(--wa-tick-read);
}

.msg-status.s-delivered {
  color: var(--wa-tick-delivered);
}

.msg-status.s-sent {
  color: var(--wa-tick-sent);
}

[data-bs-theme="dark"] .msg-status.s-sent {
  color: rgba(255, 255, 255, 0.4);
}

.msg-status.s-failed {
  color: #dc3545;
}

.msg-status.s-queued {
  color: rgba(0, 0, 0, 0.35);
}

/* ════════════════════════════════════════════════
   WhatsApp-style status ticks — shared convention used
   wherever a message/recipient status is shown: single
   gray check = sent, double gray check = delivered,
   double green check = read.
   ════════════════════════════════════════════════ */
:root {
  --wa-tick-sent: rgba(0, 0, 0, 0.4);
  --wa-tick-delivered: #8696a0;
  --wa-tick-read: #25d366;
}

.wa-tick-sent {
  color: var(--wa-tick-sent) !important;
}

.wa-tick-delivered {
  color: var(--wa-tick-delivered) !important;
}

.wa-tick-read {
  color: var(--wa-tick-read) !important;
}

/* Inbound icon (tiny) */
.msg-inbound-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  margin-bottom: 2px;
}

/* Template-only message (no body text) */
.tpl-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(37, 211, 102, 0.06);
  border: 1px solid rgba(37, 211, 102, 0.2);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.1rem;
}

.tpl-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(37, 211, 102, 0.15);
  color: #128c7e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.tpl-card-body .tpl-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #128c7e;
}

[data-bs-theme="dark"] .tpl-card-body .tpl-name {
  color: #25d366;
}

.tpl-card-body .tpl-label {
  font-size: 0.68rem;
  color: var(--bs-secondary-color);
}

/* Chat footer */
.chat-footer {
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.reply-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  width: 100%;
}

.reply-form textarea {
  resize: none;
  max-height: 6rem;
}

.chat-footer-secondary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-footer-info {
  flex: 1;
  font-size: 0.76rem;
  color: var(--bs-secondary-color);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Load more */
.load-more-wrap {
  text-align: center;
  margin-bottom: 0.5rem;
}

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary-color);
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .inbox-sidebar {
    display: none;
  }

  .inbox-wrap {
    height: calc(100vh - 100px);
  }

  .msg-bubble {
    max-width: 85%;
  }
}

/* ════════════════════════════════════════════════
   Inbox campaign reply analytics
   ════════════════════════════════════════════════ */

.rate-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bs-secondary-bg);
  overflow: hidden;
  min-width: 80px;
}
.rate-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #25d366, #128c7e);
  transition: width 0.4s;
}

.col-w-160 {
  width: 160px;
}
.fs-90 {
  font-size: 0.9rem;
}
.min-w-34 {
  min-width: 34px;
}

/* ════════════════════════════════════════════════
   Login page
   ════════════════════════════════════════════════ */

.login-mobile-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
}

.login-mobile-brand-name {
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.1;
  color: var(--text);
}

.login-mobile-brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.login-title {
  color: var(--text);
}

.login-subtitle {
  color: var(--text-muted);
  font-size: var(--font-size-small);
}

.login-alert-text {
  font-size: var(--font-size-small);
}

.login-input-icon {
  font-size: var(--icon-size-ui);
}

.login-remember-label {
  font-size: var(--font-size-small);
  color: var(--text-soft);
}

.login-submit-btn {
  height: 42px;
}

/* ════════════════════════════════════════════════
   Dashboard stat icon color variants
   ════════════════════════════════════════════════ */

.stat-badge-indigo {
  background: #eef2ff;
}
.stat-badge-indigo i {
  color: #4f46e5;
}

.stat-badge-green {
  background: #f0fdf4;
}
.stat-badge-green i {
  color: #22c55e;
}

.stat-badge-amber {
  background: #fef3c7;
}
.stat-badge-amber i {
  color: #f59e0b;
}

.stat-badge-blue {
  background: #eff6ff;
}
.stat-badge-blue i {
  color: #3b82f6;
}

.stat-badge-emerald {
  background: #ecfdf5;
}
.stat-badge-emerald i {
  color: #10b981;
}

.stat-badge-red {
  background: #fef2f2;
}
.stat-badge-red i {
  color: #ef4444;
}

.stat-badge-purple {
  background: #faf5ff;
}
.stat-badge-purple i {
  color: #8b5cf6;
}

.stat-badge-grey {
  background: #f3f4f6;
}
.stat-badge-grey i {
  color: #6b7280;
}

.dash-section-title {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.funnel-strip-item {
  padding: 0.25rem 0.5rem;
  border-inline-end: 1px solid var(--border);
}
.funnel-strip-item:last-child {
  border-inline-end: 0;
}

.funnel-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.8rem;
}
.funnel-legend-item i {
  font-size: 0.95rem !important;
}

.text-emerald {
  color: #10b981;
}

.min-w-160 {
  min-width: 160px;
}
.cursor-pointer {
  cursor: pointer;
}

/* ════════════════════════════════════════════════
   Errors / 403 page
   ════════════════════════════════════════════════ */

.error-page-wrap {
  min-height: 55vh;
}

.error-page-icon {
  font-size: 5rem;
  line-height: 1;
  opacity: 0.15;
}

.fs-65 {
  font-size: 0.65rem;
}
.fs-72 {
  font-size: 0.72rem;
}
.max-w-160 {
  max-width: 160px;
}
.border-w-2 {
  border-width: 2px !important;
}
.module-label-tag {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}
.min-w-120 {
  min-width: 120px;
}

.settings-preview-box {
  background: var(--surface-muted);
}

.settings-logo-preview {
  max-height: 40px;
  max-width: 140px;
  object-fit: contain;
}

.settings-favicon-preview {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.fs-55 {
  font-size: 0.55rem;
}

.btn-type-col {
  width: 160px;
  flex: 0 0 160px;
}
