/* This file contains styles for desktop screens (larger than 992px) */

:root {
    --sidebar-width: 280px;
}

body {
    background-color: #f8f9fa;
    overflow-x: hidden;
}
.center-col {
  margin-left: auto;
  margin-right: auto;
  max-width: 900px; /* adjust as needed */
}

.profile-photo-wrapper {
    position: relative;
    display: inline-block;
}
.position-sticky {

    overflow-y: visible;
}

.download-photo-btn {
    position: absolute;
    bottom: 14px;
    right: -8px;
    background-color: #1bba70;
    color: white;
    padding: 8px 13px;
    border-radius: 50%;
    font-size: 18px;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-photo-btn:hover {
    opacity: 1;
    background-color: #ffc107;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1032;
    background-color: var(--ms-sidebar-bg) !important;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
    /* Mobile: hidden off-screen by default */
    transform: translateX(calc(-1 * var(--sidebar-width) - 1px));
}
.sidebar::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* Sidebar visible on desktop always */
@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0) !important;
    }
}

/* Mobile: slide in when active */
.sidebar.active {
    transform: translateX(0);
}

/* RTL: sidebar from right */
html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(calc(var(--sidebar-width) + 1px));
}
html[dir="rtl"] .sidebar.active {
    transform: translateX(0);
}
@media (min-width: 992px) {
    html[dir="rtl"] .sidebar {
        transform: translateX(0) !important;
    }
}

.sticky-notes-wrapper {
  display: grid;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.sticky-note {
  background: #fff9b1;
  padding: 20px 25px;
  box-shadow:
    5px 5px 10px rgba(0,0,0,0.15),
    inset 0 0 10px rgba(255,255,255,0.7);
  border: 1px solid #f0e68c;
  border-radius: 10px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #5a4d00;
  position: relative;
  transform: rotate(-2deg);
  transition: transform 0.2s ease;
  cursor: default;
  user-select: text;
  box-sizing: border-box;
  min-width: 280px;
  max-width: 320px;
}

.sticky-note:hover {
  transform: rotate(0deg);
  box-shadow:
    7px 7px 15px rgba(0,0,0,0.25),
    inset 0 0 15px rgba(255,255,255,0.8);
}

.sticky-note h6 {
  margin-top: 0;
  font-weight: 700;
  font-size: 1.2rem;
  color: #826b00;
  text-shadow: 1px 1px 0 #fff;
}

.sticky-note hr {
  border: none;
  border-top: 1.5px dashed #c7b85f;
  margin: 10px 0 15px;
}

.sticky-note p {
  margin: 5px 0 0 0;
  line-height: 1.4;
  font-size: 0.95rem;
}



.ltr-force {
  direction: ltr !important;
  text-align: left !important;
}


.main-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Desktop: push content beside the always-visible sidebar */
@media (min-width: 992px) {
    .main-panel {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
    html[dir="rtl"] .main-panel {
        margin-left: 0;
        margin-right: var(--sidebar-width);
    }
}

.top-navbar {
    background-color: #fff;
    border-bottom: 1px solid #e3e6f0;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.content-wrapper {
    flex-grow: 1;
}

/* ── Settings page: per-tab colors ─────────────────────────── */
#settingsTabs .nav-link { transition: color .15s, border-color .15s; font-size: .85rem; }

#settingsTabs .nav-link[href*="tab=license"]                    { color:#a07820 !important; }
#settingsTabs .nav-link[href*="tab=license"].active             { color:#D4AF37 !important; border-bottom-color:#D4AF37 !important; }
#settingsTabs .nav-link[href*="tab=license"]:hover              { color:#D4AF37 !important; }

#settingsTabs .nav-link[href*="tab=company"]                    { color:#3a58a8 !important; }
#settingsTabs .nav-link[href*="tab=company"].active             { color:var(--ms-primary) !important; border-bottom-color:var(--ms-primary) !important; }
#settingsTabs .nav-link[href*="tab=company"]:hover              { color:var(--ms-primary) !important; }

#settingsTabs .nav-link[href*="tab=email"]:not([href*="tab=email_templates"]) { color:#159668 !important; }
#settingsTabs .nav-link[href*="tab=email"]:not([href*="tab=email_templates"]).active { color:#1cc88a !important; border-bottom-color:#1cc88a !important; }
#settingsTabs .nav-link[href*="tab=email"]:not([href*="tab=email_templates"]):hover  { color:#1cc88a !important; }

#settingsTabs .nav-link[href*="tab=paypal"]                     { color:#00205e !important; }
#settingsTabs .nav-link[href*="tab=paypal"].active              { color:#003087 !important; border-bottom-color:#003087 !important; }
#settingsTabs .nav-link[href*="tab=paypal"]:hover               { color:#003087 !important; }

#settingsTabs .nav-link[href*="tab=stripe"]                     { color:#4740cc !important; }
#settingsTabs .nav-link[href*="tab=stripe"].active              { color:#635bff !important; border-bottom-color:#635bff !important; }
#settingsTabs .nav-link[href*="tab=stripe"]:hover               { color:#635bff !important; }

#settingsTabs .nav-link[href*="tab=api"]                        { color:#258a9a !important; }
#settingsTabs .nav-link[href*="tab=api"].active                 { color:#36b9cc !important; border-bottom-color:#36b9cc !important; }
#settingsTabs .nav-link[href*="tab=api"]:hover                  { color:#36b9cc !important; }

#settingsTabs .nav-link[href*="tab=admins"]                     { color:#3d3e4a !important; }
#settingsTabs .nav-link[href*="tab=admins"].active              { color:#5a5c69 !important; border-bottom-color:#5a5c69 !important; }
#settingsTabs .nav-link[href*="tab=admins"]:hover               { color:#5a5c69 !important; }

#settingsTabs .nav-link[href*="tab=auth"]                       { color:#b03328 !important; }
#settingsTabs .nav-link[href*="tab=auth"].active                { color:#e74a3b !important; border-bottom-color:#e74a3b !important; }
#settingsTabs .nav-link[href*="tab=auth"]:hover                 { color:#e74a3b !important; }

#settingsTabs .nav-link[href*="tab=email_templates"]            { color:#c05e0a !important; }
#settingsTabs .nav-link[href*="tab=email_templates"].active     { color:#fd7e14 !important; border-bottom-color:#fd7e14 !important; }
#settingsTabs .nav-link[href*="tab=email_templates"]:hover      { color:#fd7e14 !important; }

#settingsTabs .nav-link[href*="tab=whatsapp"]                   { color:#1a9e4a !important; }
#settingsTabs .nav-link[href*="tab=whatsapp"].active            { color:#25D366 !important; border-bottom-color:#25D366 !important; }
#settingsTabs .nav-link[href*="tab=whatsapp"]:hover             { color:#25D366 !important; }

#settingsTabs .nav-link[href*="tab=maintenance"]                { color:#5f6070 !important; }
#settingsTabs .nav-link[href*="tab=maintenance"].active         { color:#858796 !important; border-bottom-color:#858796 !important; }
#settingsTabs .nav-link[href*="tab=maintenance"]:hover          { color:#858796 !important; }

.main-footer {
    background-color: #f8f9fa;
    padding: 1rem 0;
    border-top: 1px solid #e3e6f0;
    text-align: center;
}

.main-signature {
    margin: 0;
    font-size: 0.78rem;
    color: #adb5bd;
    letter-spacing: 0.03em;
}

.main-signature span {
    color: #e74c3c;
}

.main-signature a {
    color: #D4AF37;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s;
}

.main-signature a:hover {
    color: #b8860b;
    text-decoration: underline;
}

.main-signature .version {
    font-size: .8em;
    color: #adb5bd;
}

/* Styles for the mobile menu overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 1029; /* Sit just below the sidebar */
}

/* This CSS rule automatically shows the overlay when the sidebar is active */
.sidebar.active + .sidebar-overlay {
    display: block;
}


/* --- Sidebar Navigation Styling --- */
.sidebar .nav {
    --bs-nav-link-padding-y: 0.25rem;
}
.sidebar .nav-link {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link .bi {
    margin-right: 0.75rem;
}
html[dir="rtl"] .sidebar .nav-link .bi {
    margin-right: 0;
    margin-left: 0.75rem;
}

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

.sidebar .nav-item-header {
    padding-top: 1rem;
    padding-bottom: .25rem;
    color: #c0e7fae8;
}


/* --- Helper Classes for Cards and Text --- */
.card {
    border: none;
    border-radius: 0.5rem;
}

.border-left-primary { border-left: .25rem solid var(--ms-primary)!important; }
.border-left-success { border-left: .25rem solid #1cc88a!important; }
.border-left-info { border-left: .25rem solid #36b9cc!important; }
.border-left-warning { border-left: .25rem solid #f6c23e!important; }
.border-left-danger { border-left: .25rem solid #e74a3b!important; }

html[dir="rtl"] .border-left-primary { border-left: 0 !important; border-right: .25rem solid var(--ms-primary)!important; }
html[dir="rtl"] .border-left-success { border-left: 0 !important; border-right: .25rem solid #1cc88a!important; }
html[dir="rtl"] .border-left-info { border-left: 0 !important; border-right: .25rem solid #36b9cc!important; }
html[dir="rtl"] .border-left-warning { border-left: 0 !important; border-right: .25rem solid #f6c23e!important; }
html[dir="rtl"] .border-left-danger { border-left: 0 !important; border-right: .25rem solid #e74a3b!important; }


.text-gray-300 { color: #dddfeb !important; }
.text-gray-800 { color: #5a5c69 !important; }
.text-xs { font-size: .7rem; }
.font-weight-bold { font-weight: 700!important; }

/* --- Arabic Font for better readability --- */
html[lang="ar"] body,
html[lang="ar"] .btn,
html[lang="ar"] .form-control,
html[lang="ar"] .form-select,
html[lang="ar"] .nav-link,
html[lang="ar"] .nav-item-header {
    font-family: "Tajawal", sans-serif !important;
}


/* --- Sidebar Icon Colors --- */
.sidebar .nav-link .bi-speedometer2 { color: #ffffff; }
.sidebar .nav-link .bi-people { color: #1cc88a; }
.sidebar .nav-link .bi-people-fill { color: #36b9cc; }
.sidebar .nav-link .bi-tv { color: #f6c23e; }
.sidebar .nav-link .bi-calendar-event { color: #e74a3b; }
.sidebar .nav-link .bi-journal-richtext { color: #fd7e14; }
.sidebar .nav-link .bi-envelope-heart { color: #e83e8c; }
.sidebar .nav-link .bi-receipt-cutoff { color: #6f42c1; }
.sidebar .nav-link .bi-upload.icon-import-customers { color: #20c997; }
.sidebar .nav-link .bi-upload.icon-import-channels { color: #17a2b8; }
.sidebar .nav-link .bi-wordpress { color: #21759b; }
.sidebar .nav-link .bi-shield-check { color: #1cc88a; }
.sidebar .nav-link .bi-clipboard2-data { color: #858796; }
.sidebar .nav-link .bi-sliders { color: #5a5c69; }

/* Reset icon color to white on active nav-link */
.sidebar .nav-pills .nav-link.active i { color: #fff !important; }

/* Sidebar Logo */
.sidebar-logo { height: 75px; object-fit: contain; }

/* Sidebar dual-logo wrap */
.sidebar-logo-wrap {
    position: relative;
    height: 75px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: .5rem;
}
/* Backdrop — makes logo pop against dark sidebar */
.sidebar-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -6px -4px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 14px rgba(0,0,0,0.22);
    pointer-events: none;
    z-index: 0;
}
.sidebar-logo-wrap .sidebar-logo-a,
.sidebar-logo-wrap .sidebar-logo-b {
    position: absolute;
    height: 75px;
    object-fit: contain;
    max-width: 100%;
    z-index: 1;
}
/* Default: show A, hide B */
.sidebar-logo-wrap .sidebar-logo-b { opacity: 0; }

/* ── Effect: crossfade ─────────────────────────────────── */
@keyframes sbl-cf-a {
    0%, 38%  { opacity: 1; transform: scale(1); }
    45%, 55% { opacity: 0; transform: scale(.92); }
    62%, 100%{ opacity: 1; transform: scale(1); }
}
@keyframes sbl-cf-b {
    0%, 38%  { opacity: 0; transform: scale(.92); }
    45%, 55% { opacity: 1; transform: scale(1); }
    62%, 100%{ opacity: 0; transform: scale(.92); }
}
.sidebar-logo-anim-crossfade .sidebar-logo-a { animation: sbl-cf-a 9s ease-in-out infinite; }
.sidebar-logo-anim-crossfade .sidebar-logo-b { animation: sbl-cf-b 9s ease-in-out infinite; }

/* ── Effect: slide ──────────────────────────────────────── */
@keyframes sbl-sl-a {
    0%, 38%  { opacity: 1; transform: translateY(0); }
    44%      { opacity: 0; transform: translateY(-14px); }
    45%, 94% { opacity: 0; transform: translateY(10px); }
    100%     { opacity: 1; transform: translateY(0); }
}
@keyframes sbl-sl-b {
    0%, 40%  { opacity: 0; transform: translateY(10px); }
    46%      { opacity: 1; transform: translateY(0); }
    87%      { opacity: 1; transform: translateY(0); }
    93%      { opacity: 0; transform: translateY(-14px); }
    94%, 100%{ opacity: 0; transform: translateY(10px); }
}
.sidebar-logo-anim-slide .sidebar-logo-a { animation: sbl-sl-a 12s cubic-bezier(.4,0,.2,1) infinite; }
.sidebar-logo-anim-slide .sidebar-logo-b { animation: sbl-sl-b 12s cubic-bezier(.4,0,.2,1) infinite; }

/* ── Effect: zoom ───────────────────────────────────────── */
@keyframes sbl-zm-a {
    0%, 38%  { opacity: 1; transform: scale(1); }
    45%, 55% { opacity: 0; transform: scale(1.18); }
    60%, 90% { opacity: 0; transform: scale(.82); }
    96%, 100%{ opacity: 1; transform: scale(1); }
}
@keyframes sbl-zm-b {
    0%, 44%  { opacity: 0; transform: scale(.82); }
    52%, 88% { opacity: 1; transform: scale(1); }
    95%, 100%{ opacity: 0; transform: scale(1.18); }
}
.sidebar-logo-anim-zoom .sidebar-logo-a { animation: sbl-zm-a 10s ease-in-out infinite; }
.sidebar-logo-anim-zoom .sidebar-logo-b { animation: sbl-zm-b 10s ease-in-out infinite; }

/* ── Effect: glow ───────────────────────────────────────── */
@keyframes sbl-gl-a {
    0%, 38%  { opacity: 1; filter: drop-shadow(0 0 7px rgba(195,147,70,.6)); }
    45%, 55% { opacity: 0; filter: drop-shadow(0 0 0 transparent); }
    62%, 100%{ opacity: 1; filter: drop-shadow(0 0 7px rgba(195,147,70,.6)); }
}
@keyframes sbl-gl-b {
    0%, 38%  { opacity: 0; filter: drop-shadow(0 0 0 transparent); }
    45%, 55% { opacity: 1; filter: drop-shadow(0 0 10px rgba(195,147,70,.8)); }
    62%, 100%{ opacity: 0; filter: drop-shadow(0 0 0 transparent); }
}
.sidebar-logo-anim-glow .sidebar-logo-a { animation: sbl-gl-a 9s ease-in-out infinite; }
.sidebar-logo-anim-glow .sidebar-logo-b { animation: sbl-gl-b 9s ease-in-out infinite; }

/* ── Tasks dropdown: responsive sizing ───────────────────── */
.tasks-dropdown {
    min-width: 280px;
}
@media (max-width: 575.98px) {
    .tasks-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        min-width: unset;
        width: calc(100vw - 32px);
    }
}

/* =============================================================
   Contact Modal — redesigned
   ============================================================= */

/* ── Dialog ──────────────────────────────────────────────── */
#contactModal .modal-dialog {
    max-width: 420px;
    width: calc(100% - 2rem);
}

/* ── Shell ───────────────────────────────────────────────── */
#contactModal .modal-content {
    border: none;
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(15,23,42,.24), 0 4px 20px rgba(15,23,42,.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* ── Header ───────────────────────────────────────────────── */
#contactModal .cm-header {
    background: linear-gradient(145deg, var(--ms-sidebar, #212f63) 0%, #2a3a7a 55%, #1e2d5e 100%);
    padding: 32px 24px 46px;
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
/* decorative circles */
#contactModal .cm-header::before {
    content: '';
    position: absolute;
    top: -30px; inset-inline-end: -30px;
    width: 110px; height: 110px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
    pointer-events: none;
}
/* wave at bottom */
#contactModal .cm-header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 30px;
    background: #fff;
    border-radius: 60% 60% 0 0 / 100% 100% 0 0;
}
#contactModal .cm-close-btn {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.25);
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem;
    cursor: pointer;
    transition: all .22s;
    z-index: 2;
}
#contactModal .cm-close-btn:hover {
    background: rgba(255,255,255,.3);
    transform: rotate(90deg);
}
#contactModal .cm-header-icon {
    width: 60px; height: 60px;
    background: rgba(255,255,255,.18);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem;
    color: #fff;
    margin: 0 auto 12px;
    border: 2px solid rgba(255,255,255,.35);
    position: relative;
    z-index: 1;
    animation: cm-ring 3s ease-in-out infinite;
}
@keyframes cm-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.25); }
    50%       { box-shadow: 0 0 0 10px rgba(255,255,255,.0); }
}
#contactModal .cm-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: .015em;
    position: relative;
    z-index: 1;
}
#contactModal .cm-subtitle {
    color: rgba(255,255,255,.82);
    font-size: .83rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
}

/* ── Body ─────────────────────────────────────────────────── */
#contactModal .modal-body {
    padding: 20px 24px 8px;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    background: #fff;
}

/* ── View mode ────────────────────────────────────────────── */
#contactModal .cm-view-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 8px;
}
#contactModal .cm-avatar-ring {
    width: 82px; height: 82px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    margin-bottom: 14px;
    box-shadow: 0 6px 24px rgba(79,70,229,.32);
}
#contactModal .cm-avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    display: block;
}
#contactModal .cm-avatar-fallback {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #0ea5e9);
    display: flex; align-items: center; justify-content: center;
    border: 3px solid #fff;
    color: #fff;
    font-size: 1.8rem;
}
#contactModal .cm-view-name-block {
    margin-bottom: 10px;
    line-height: 1.5;
}
#contactModal .cm-label-pre {
    display: block;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 3px;
}
#contactModal .cm-agent-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}
#contactModal .cm-view-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: .76rem;
    color: #4338ca;
    font-weight: 600;
    margin-top: 2px;
}
#contactModal .cm-notes-card {
    background: linear-gradient(135deg, #f8faff, #f0f4ff);
    border: 1.5px solid #c7d2fe;
    border-inline-start: 4px solid #4f46e5;
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 16px;
}
#contactModal .cm-notes-header {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 800;
    color: #4f46e5;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}
#contactModal .cm-notes-body {
    font-size: .9rem;
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
}

/* ── Edit mode: previous contact banner ───────────────────── */
#contactModal .cm-prev-banner {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1.5px solid #fde68a;
    border-inline-start: 4px solid #f59e0b;
    border-radius: 13px;
    padding: 12px 14px;
    margin-bottom: 20px;
}
#contactModal .cm-prev-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}
#contactModal .cm-prev-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fbbf24;
    flex-shrink: 0;
}
#contactModal .cm-prev-name {
    font-size: .88rem;
    font-weight: 700;
    color: #92400e;
    line-height: 1.2;
}
#contactModal .cm-prev-time {
    font-size: .73rem;
    color: #b45309;
    margin-top: 1px;
}
#contactModal .cm-prev-badge {
    margin-inline-start: auto;
    background: #fbbf24;
    color: #78350f;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: .7rem;
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: .02em;
}

/* ── Edit mode: question & toggle cards ───────────────────── */
#contactModal .cm-question {
    font-size: .93rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 14px;
    text-align: center;
}
#contactModal .cm-toggle-group {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
}
#contactModal .cm-opt-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 20px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    background: #fafafa;
    cursor: pointer;
    transition: all .22s ease;
}
#contactModal .cm-opt-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,.09);
}
#contactModal .cm-opt-icon {
    width: 50px; height: 50px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform .22s;
}
#contactModal .cm-opt-card:hover .cm-opt-icon { transform: scale(1.1); }
#contactModal .cm-opt-yes { background: linear-gradient(135deg, #bbf7d0, #86efac); color: #15803d; }
#contactModal .cm-opt-no  { background: linear-gradient(135deg, #fecaca, #fca5a5); color: #b91c1c; }
#contactModal .cm-opt-label {
    font-size: .9rem;
    font-weight: 700;
    color: #64748b;
}
#contactModal .cm-opt-card.cm-active-yes {
    border-color: #16a34a;
    background: linear-gradient(160deg, #f0fdf4, #dcfce7);
    box-shadow: 0 0 0 3px rgba(22,163,74,.15), 0 8px 20px rgba(22,163,74,.13);
    transform: translateY(-2px);
}
#contactModal .cm-opt-card.cm-active-yes .cm-opt-label { color: #15803d; }
#contactModal .cm-opt-card.cm-active-no {
    border-color: #dc2626;
    background: linear-gradient(160deg, #fff5f5, #fee2e2);
    box-shadow: 0 0 0 3px rgba(220,38,38,.15), 0 8px 20px rgba(220,38,38,.1);
    transform: translateY(-2px);
}
#contactModal .cm-opt-card.cm-active-no .cm-opt-label { color: #b91c1c; }

/* ── Notes textarea ───────────────────────────────────────── */
#contactModal .cm-notes-input-wrap { margin-top: 18px; }
#contactModal .cm-notes-input-label {
    display: block;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 8px;
}
#contactModal .cm-notes-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: .9rem;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    font-family: inherit;
    background: #fafafa;
    line-height: 1.65;
}
#contactModal .cm-notes-input:focus {
    border-color: var(--ms-primary, #c39346);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(195,147,70,.15);
}

/* ── Quick Phrases ────────────────────────────────────────── */
#contactModal .cm-quick-phrases {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
#contactModal .cm-quick-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight: 800;
    color: #94a3b8;
    margin-inline-end: 2px;
}
#contactModal .cm-phrase-btn {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    font-size: .77rem;
    padding: 4px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .18s;
    font-weight: 600;
    outline: none;
}
#contactModal .cm-phrase-btn:hover {
    background: linear-gradient(135deg, #fdf6e8, #faecd0);
    border-color: rgba(195,147,70,.5);
    color: var(--ms-primary, #c39346);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(195,147,70,.2);
}
#contactModal .cm-phrase-btn:active { transform: translateY(0); }

/* ── Footer ───────────────────────────────────────────────── */
#contactModal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 22px;
    background: #fff;
    border-top: none;
    flex-shrink: 0;
}
#contactModal .cm-btn-cancel {
    border: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 700;
    border-radius: 12px;
    padding: 8px 20px;
    font-size: .88rem;
    transition: all .2s;
    background: #fff;
}
#contactModal .cm-btn-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #374151;
}
#contactModal .cm-btn-save {
    background: linear-gradient(135deg, var(--ms-gradient-start, #d0a25a), var(--ms-gradient-end, #eec88c));
    color: #fff;
    border: none;
    font-weight: 800;
    border-radius: 12px;
    padding: 8px 26px;
    font-size: .88rem;
    transition: all .22s;
    box-shadow: 0 4px 14px rgba(195,147,70,.38);
    letter-spacing: .01em;
}
#contactModal .cm-btn-save:hover {
    background: linear-gradient(135deg, var(--ms-primary, #c39346), var(--ms-gradient-start, #d0a25a));
    box-shadow: 0 6px 22px rgba(195,147,70,.48);
    transform: translateY(-2px);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    #contactModal .modal-dialog {
        width: calc(100% - 1rem);
        max-width: 100%;
    }
    #contactModal .modal-content      { max-height: 88vh; }
    #contactModal .cm-header          { padding: 24px 18px 40px; }
    #contactModal .cm-header-icon     { width: 48px; height: 48px; font-size: 1.2rem; margin-bottom: 8px; }
    #contactModal .cm-title           { font-size: .92rem; }
    #contactModal .cm-subtitle        { font-size: .78rem; }
    #contactModal .modal-body         { padding: 16px 16px 6px; }
    #contactModal .cm-avatar-ring     { width: 68px; height: 68px; margin-bottom: 10px; }
    #contactModal .cm-agent-name      { font-size: .95rem; }
    #contactModal .cm-view-time       { font-size: .72rem; }
    #contactModal .cm-toggle-group    { gap: 8px; }
    #contactModal .cm-opt-card        { padding: 14px 8px; border-radius: 14px; }
    #contactModal .cm-opt-icon        { width: 42px; height: 42px; font-size: 1rem; }
    #contactModal .cm-opt-label       { font-size: .84rem; }
    #contactModal .cm-prev-banner     { padding: 10px 12px; }
    #contactModal .cm-prev-name       { font-size: .83rem; }
    #contactModal .cm-prev-time       { font-size: .71rem; }
    #contactModal .modal-footer       { padding: 10px 16px 18px; }
    #contactModal .cm-btn-cancel,
    #contactModal .cm-btn-save        { flex: 1; text-align: center; padding: 10px; }
}

/* ══════════════════════════════════════════════════════════
   Contact Log — timeline inside modal
   ══════════════════════════════════════════════════════════ */
#contactModal .cm-log-section {
    margin-top: 20px;
    border-top: 1.5px solid #e2e8f0;
    padding-top: 14px;
}
#contactModal .cm-log-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
#contactModal .cm-log-hdr-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 800;
    color: #64748b;
}
#contactModal .cm-log-add-btn {
    background: linear-gradient(135deg, #fdf6e8, #faecd0);
    border: 1.5px solid rgba(195,147,70,.4);
    color: var(--ms-primary, #c39346);
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .18s;
    display: flex; align-items: center; gap: 4px;
    outline: none;
}
#contactModal .cm-log-add-btn:hover {
    background: linear-gradient(135deg, #faecd0, #f5dfa8);
    box-shadow: 0 2px 8px rgba(195,147,70,.25);
    transform: translateY(-1px);
}
/* Add form */
#contactModal .cm-log-add-form {
    margin-bottom: 12px;
    background: #fffdf7;
    border: 1.5px solid rgba(195,147,70,.35);
    border-radius: 14px;
    padding: 12px;
}
#contactModal .cm-log-note-input {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: .88rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    line-height: 1.6;
}
#contactModal .cm-log-note-input:focus {
    border-color: var(--ms-primary, #c39346);
    box-shadow: 0 0 0 3px rgba(195,147,70,.15);
}
#contactModal .cm-log-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
}
#contactModal .cm-log-cancel-btn {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    font-size: .8rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .16s;
    outline: none;
}
#contactModal .cm-log-cancel-btn:hover { background: #e2e8f0; }
#contactModal .cm-log-save-btn {
    background: linear-gradient(135deg, var(--ms-gradient-start, #d0a25a), var(--ms-gradient-end, #eec88c));
    border: none;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    padding: 5px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all .18s;
    display: flex; align-items: center; gap: 4px;
    outline: none;
    box-shadow: 0 2px 8px rgba(195,147,70,.3);
}
#contactModal .cm-log-save-btn:hover {
    background: linear-gradient(135deg, var(--ms-primary, #c39346), var(--ms-gradient-start, #d0a25a));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(195,147,70,.4);
}
/* Log list */
#contactModal .cm-log-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding-inline-end: 4px;
}
#contactModal .cm-log-list::-webkit-scrollbar { width: 4px; }
#contactModal .cm-log-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
#contactModal .cm-log-list::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }
/* Log entry */
#contactModal .cm-log-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fafafa;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    transition: border-color .18s;
}
#contactModal .cm-log-entry:hover { border-color: #c7d2fe; }
#contactModal .cm-log-av {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--ms-primary, #c39346), var(--ms-gradient-end, #eec88c));
    display: flex; align-items: center; justify-content: center;
}
#contactModal .cm-log-av-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e0e7ff;
}
/* ── Contact-trigger log count badge ──────────────────────────────── */
.contact-trigger { position: relative; }
.ct-log-badge {
    position: absolute;
    top: -7px;
    right: 10px;
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    border-radius: 50rem;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 3px;
    border: 1.5px solid #fff;
    pointer-events: none;
    z-index: 2;
}
#contactModal .cm-log-av-init {
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    line-height: 1;
}
#contactModal .cm-log-body {
    flex: 1;
    min-width: 0;
}
#contactModal .cm-log-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
#contactModal .cm-log-name {
    font-size: .8rem;
    font-weight: 700;
    color: #1e293b;
}
#contactModal .cm-log-time {
    font-size: .71rem;
    color: #94a3b8;
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 3px;
}
#contactModal .cm-log-text {
    font-size: .85rem;
    color: #374151;
    line-height: 1.6;
    word-break: break-word;
}
/* Loading / empty states */
#contactModal .cm-log-loading {
    text-align: center;
    padding: 12px 0;
    color: #94a3b8;
    font-size: .82rem;
}
#contactModal .cm-log-empty {
    text-align: center;
    padding: 12px 0;
    color: #94a3b8;
    font-size: .82rem;
    font-style: italic;
}
#contactModal .cm-log-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    opacity: 0;
    transition: opacity .15s;
}
#contactModal .cm-log-entry:hover .cm-log-actions { opacity: 1; }
#contactModal .cm-log-action-btn {
    background: none;
    border: none;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: .78rem;
    cursor: pointer;
    line-height: 1;
    color: #94a3b8;
    transition: color .15s, background .15s;
}
#contactModal .cm-log-action-btn:hover { background: #f1f5f9; color: #64748b; }
#contactModal .cm-log-action-btn.delete:hover { background: #fee2e2; color: #ef4444; }
#contactModal .cm-log-edit-form {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
#contactModal .cm-log-edit-input {
    width: 100%;
    border: 1px solid rgba(195,147,70,.35);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: .85rem;
    resize: none;
    outline: none;
}
#contactModal .cm-log-edit-input:focus { border-color: var(--ms-primary, #c39346); box-shadow: 0 0 0 3px rgba(195,147,70,.15); }
#contactModal .cm-log-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
#contactModal .cm-log-edit-save {
    background: linear-gradient(135deg, var(--ms-gradient-start, #d0a25a), var(--ms-gradient-end, #eec88c));
    color: #fff; border: none; border-radius: 6px;
    padding: 4px 12px; font-size: .8rem; cursor: pointer;
    box-shadow: 0 2px 6px rgba(195,147,70,.3);
}
#contactModal .cm-log-edit-cancel {
    background: #f1f5f9; color: #64748b; border: none;
    border-radius: 6px; padding: 4px 12px; font-size: .8rem; cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   FORM FIELDS — Simple unified style
   ══════════════════════════════════════════════════════════ */
:root {
    --f-r: 8px;
    --f-b: #ced4da;
    --f-focus: var(--ms-primary);
    --f-ring: rgba(78,115,223,.2);
}

/* inputs & textareas */
.form-control {
    border-radius: var(--f-r) !important;
    border-color: var(--f-b) !important;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}
.form-control:focus {
    border-color: var(--f-focus) !important;
    box-shadow: 0 0 0 3px var(--f-ring) !important;
}

/* native <select> */
.form-select {
    border-radius: var(--f-r) !important;
    border-color: var(--f-b) !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}
.form-select:focus {
    border-color: var(--f-focus) !important;
    box-shadow: 0 0 0 3px var(--f-ring) !important;
}

/* label-type select inside input-group: shrink to content width */
.form-select.select-fit    { width: auto !important; flex: 0 0 auto !important; min-width: 0; }

/* input-group: match border color on the addon, keep its own icon colors */
.input-group               { flex-wrap: nowrap !important; }
.input-group .form-control,
.input-group .form-select  { border-color: var(--f-b) !important; }
.input-group-text          { border-color: var(--f-b) !important; background-color: #f8f9fa; flex-shrink: 0; }

/* outer radius for the group edges — LTR */
.input-group > :first-child,
.input-group > .iti:first-child .form-control {
    border-top-left-radius: var(--f-r) !important;
    border-bottom-left-radius: var(--f-r) !important;
}
.input-group > :last-child,
.input-group > .iti:last-child .form-control {
    border-top-right-radius: var(--f-r) !important;
    border-bottom-right-radius: var(--f-r) !important;
}
/* outer radius — RTL */
[dir="rtl"] .input-group > :first-child,
[dir="rtl"] .input-group > .iti:first-child .form-control {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: var(--f-r) !important;
    border-bottom-right-radius: var(--f-r) !important;
}
[dir="rtl"] .input-group > :last-child,
[dir="rtl"] .input-group > .iti:last-child .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: var(--f-r) !important;
    border-bottom-left-radius: var(--f-r) !important;
}
/* the .iti wrapper itself must not clip or add extra border */
.input-group > .iti { border-radius: 0 !important; border: none !important; padding: 0 !important; }

/* Select2: contain inside its column, no overflow */
.select2-container                    { width: 100% !important; max-width: 100% !important; }
.select2-container--open  .select2-selection--single,
.select2-container--focus .select2-selection--single {
    border-color: var(--f-focus) !important;
    box-shadow: 0 0 0 3px var(--f-ring) !important;
    outline: none !important;
}
.select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 36px !important;
    padding-left: 12px !important;
    padding-right: 28px !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[dir="rtl"] .select2-container .select2-selection--single .select2-selection__rendered {
    padding-left: 28px !important;
    padding-right: 12px !important;
}
.select2-container .select2-selection__arrow {
    height: 36px !important; top: 0 !important; right: 4px !important; left: auto !important;
}
[dir="rtl"] .select2-container .select2-selection__arrow { right: auto !important; left: 4px !important; }

/* dropdown: stays in viewport */
.select2-dropdown {
    border-color: var(--f-focus) !important;
    border-radius: 0 0 var(--f-r) var(--f-r) !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
}
.select2-dropdown .select2-results__options { max-height: 220px; overflow-y: auto; overflow-x: hidden; }
.select2-results__option { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* hover: blue, no purple */
.select2-results__option--highlighted { background-color: var(--ms-primary) !important; color: #fff !important; }
.select2-results__option[aria-selected="true"] { background-color: #dce6fb !important; color: #2e59d9 !important; font-weight: 600; }

/* responsive: clamp dropdown on small screens */
@media (max-width: 576px) {
    .select2-dropdown  { max-width: calc(100vw - 1rem) !important; }
    .iti__country-list { max-width: calc(100vw - 1rem) !important; }
}

/* ITI country list: show ~6 rows then scroll */
.iti__country-list { max-height: 210px !important; overflow-y: auto !important; }

/* Global phone input: keep digits LTR regardless of page direction */
.phone-input { direction: ltr !important; text-align: left !important; }
/* ITI wrapper fills its Bootstrap column like every other form-control */
.iti { width: 100%; }
/* Inside Bootstrap input-group the wrapper must flex-grow instead of being 100% wide */
.input-group > .iti { flex: 1 1 auto; width: 1% !important; min-width: 0; }

/* Syria custom flag — global */
.iti__flag.iti__sy { background-image: url("/assets/flags/sy.svg") !important; background-position: center !important; background-size: contain !important; background-repeat: no-repeat !important; }

/* ── Global input-group RTL border-radius fix ───────────────────────────────
   Bootstrap RTL reverses the physical border-radius properties, which makes
   icons/buttons appear disconnected from the input field.
   Using logical CSS properties fixes it for both LTR and RTL automatically. */
.input-group > * {
    border-radius: 0 !important;
}
.input-group > :first-child {
    border-start-start-radius: var(--bs-border-radius) !important;
    border-end-start-radius:   var(--bs-border-radius) !important;
}
.input-group > :last-child {
    border-start-end-radius: var(--bs-border-radius) !important;
    border-end-end-radius:   var(--bs-border-radius) !important;
}
/* sm / lg variants */
.input-group-sm > :first-child {
    border-start-start-radius: var(--bs-border-radius-sm) !important;
    border-end-start-radius:   var(--bs-border-radius-sm) !important;
}
.input-group-sm > :last-child {
    border-start-end-radius: var(--bs-border-radius-sm) !important;
    border-end-end-radius:   var(--bs-border-radius-sm) !important;
}
.input-group-lg > :first-child {
    border-start-start-radius: var(--bs-border-radius-lg) !important;
    border-end-start-radius:   var(--bs-border-radius-lg) !important;
}
.input-group-lg > :last-child {
    border-start-end-radius: var(--bs-border-radius-lg) !important;
    border-end-end-radius:   var(--bs-border-radius-lg) !important;
}

/* ── Customer show page – info row label column ─────────────────────────────
   Fixed 160px on md+, shrinks to 110px on small screens so the value
   side has enough room for phone + badge + WhatsApp button.              */
.info-row-label { width: 160px; min-width: 160px; }
@media (max-width: 575.98px) {
    .info-row-label { width: 110px; min-width: 110px; }
}
