@font-face {
    font-family: 'Vazirmatn';
    src: url('Vazirmatn-Medium.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
}

body {
    background: #f0f2f5;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: auto;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.flex {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px;
    margin: 5px 0 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

button {
    background: #2d7d46;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

button:hover {
    background: #236535;
}

.btn-red {
    background: #c0392b;
}

.btn-blue {
    background: #2980b9;
}

.btn-orange {
    background: #e67e22;
}

.btn-purple {
    background: #8e44ad;
}

.btn-gold {
    background: #f39c12;
}

.btn-gray {
    background: #95a5a6;
    color: white;
}

.btn-green {
    background: #27ae60;
}

.btn-green:hover {
    background: #219a52;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.customer-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-right: 4px solid #2d7d46;
}

.reminder-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-right: 4px solid #e67e22;
}

.stat-box {
    flex: 1;
    min-width: 120px;
    background: #eef2f7;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.stat-box:hover {
    transform: scale(1.02);
}

.stat-box .num {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-box h4 {
    margin: 0;
    color: #7f8c8d;
}

.stat-box.today {
    background: #e8f5e9;
    border: 2px solid #c8e6c9;
}

.stat-box.tomorrow {
    background: #e3f2fd;
    border: 2px solid #bbdefb;
}

.stat-box.past {
    background: #ffebee;
    border: 2px solid #ffcdd2;
}

.stat-box.total {
    background: #eef2f7;
    border: 2px solid #d5dbe3;
}

.stat-box.conversion {
    border: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-box.conversion.low {
    background: #ffebee;
    border-color: #ef9a9a;
}

.stat-box.conversion.mid {
    background: #fff8e1;
    border-color: #ffcc80;
}

.stat-box.conversion.high {
    background: #e8f5e9;
    border-color: #81c784;
}

.stat-box.conversion .num {
    margin: 5px 0;
}

.stat-box.conversion .num#conversionRate {
    font-size: 2rem !important;
    line-height: 1 !important;
}

#salesReport .stat-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#salesReport .stat-box h4 {
    margin-bottom: 5px;
}

#salesReport .stat-box .num {
    font-size: 1.2rem !important;
    word-break: break-word;
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-undefined {
    background: #e74c3c;
    color: white;
    font-weight: bold;
    animation: blink 1s infinite;
}

.status-blue {
    background: #e3f2fd;
    color: #1565c0;
}

.status-green {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-orange {
    background: #fff3e0;
    color: #e65100;
}

.status-purple {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-teal {
    background: #e0f2f1;
    color: #00695c;
}

.status-red {
    background: #ffebee;
    color: #c62828;
}

.status-yellow {
    background: #fffde7;
    color: #f57f17;
}

.status-pink {
    background: #fce4ec;
    color: #c2185b;
}

.status-indigo {
    background: #e8eaf6;
    color: #283593;
}

.status-lime {
    background: #f9fbe7;
    color: #827717;
}

.status-brown {
    background: #efebe9;
    color: #4e342e;
}

.status-cyan {
    background: #e0f7fa;
    color: #00838f;
}

.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.priority-high {
    background: #ffebee;
    color: #c62828;
}

.priority-medium {
    background: #fff8e1;
    color: #f57f17;
}

.priority-low {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    background: #e0e0e0;
    color: #424242;
    margin: 2px;
}

#login {
    max-width: 400px;
    margin: 50px auto;
}

.tab {
    display: inline-block;
    padding: 8px 16px;
    background: #ddd;
    border-radius: 4px;
    margin: 0 2px;
    cursor: pointer;
}

.tab.active {
    background: #2d7d46;
    color: white;
}

.filter-section {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.badge {
    background: #2d7d46;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ========== Header ========== */
.header {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.app-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.app-version {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.header-logo-custom {
    display: flex;
    align-items: center;
}

.logo-main {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.logo-custom {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: none;
}

.header-logo-custom {
    filter: drop-shadow(3px 5px 3px rgba(0, 0, 0, 0.7));
}

.header-titles {
    flex: 1;
    min-width: 200px;
}

.app-subtitle {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d7d46;
    margin-bottom: 2px;
}

.app-subtitle span {
    font-size: 1.4rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* ========== نمودارها ========== */
.chart-wrapper {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.chart-wrapper h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

#statusChart {
    max-height: 200px;
    max-width: 100%;
    cursor: pointer;
}

.chart-toggle-btn {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid #2d7d46;
    border-radius: 12px;
    color: #2d7d46;
    font-size: 0.8rem;
    cursor: pointer;
    background: white;
}

.chart-toggle-btn:hover {
    background: #2d7d46;
    color: white;
}

.funnel-section {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.funnel-section h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.funnel-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    clip-path: polygon(0% 0%, 100% 0%, 70% 100%, 30% 100%);
    background: #f8f9fa;
    padding: 2px 0;
}

.funnel-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 15px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 0;
    width: 100%;
}

.funnel-stage:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.funnel-stage .stage-name {
    font-size: 0.85rem;
}

.funnel-stage .stage-count {
    margin-left: 5px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.funnel-lead {
    background: #075ca1;
}

.funnel-first {
    background: #42a5f5;
}

.funnel-negotiation {
    background: #2ed6e9;
}

.funnel-catalog {
    background: #450faa;
}

.funnel-price {
    background: #6f35d9;
}

.funnel-invoice {
    background: #9d75e9;
}

.funnel-payment {
    background: #ffee00;
    color: black !important;
}

.funnel-final {
    background: #53ae13;
}

.funnel-rejected {
    background: #b71c1c;
}

.performance-wrapper {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.performance-wrapper h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

#performanceChartContainer,
#provinceChartContainer,
#provinceSalesChartContainer {
    height: 180px;
    position: relative;
}

#performanceChart,
#provinceChart,
#provinceSalesChart {
    max-height: 180px;
    max-width: 100%;
}

#productsChartContainer,
#productsCountChartContainer,
#customersChartContainer,
#acquisitionChartContainer {
    height: 400px;
    max-height: 400px;
    position: relative;
}

#productsChart,
#productsCountChart,
#customersChart,
#acquisitionChart {
    max-height: 330px !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 330px !important;
}

#productsChartContainer canvas,
#productsCountChartContainer canvas,
#customersChartContainer canvas {
    height: 100% !important;
    max-height: 400px !important;
}

.chart-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

.chart-tab {
    padding: 5px 15px;
    background: #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
}

.chart-tab.active {
    background: #2d7d46;
    color: white;
}

.chart-tab:hover {
    background: #bbb;
}

/* ========== صفحه‌بندی ========== */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 5px 12px;
    background: #eef2f7;
    color: #2c3e50;
}

.pagination button.active {
    background: #2d7d46;
    color: white;
}

.pagination button:hover:not(.active) {
    background: #d5dbe3;
}

/* ========== مودال‌ها ========== */
#customerDetailModal,
#reportModal,
#editReminderModal,
#smsModal,
#bulkSmsModal,
#giantTasksModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#editPurchaseModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

#customerDetailModal .modal-content,
#reportModal .modal-content,
#editReminderModal .modal-content,
#smsModal .modal-content,
#bulkSmsModal .modal-content,
#giantTasksModal .modal-content,
#editPurchaseModal .modal-content {
    background: white;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 12px;
}

#customerDetailModal .modal-content {
    max-width: 600px;
}

#reportModal .modal-content {
    max-width: 700px;
}

#editReminderModal .modal-content {
    max-width: 400px;
}

#smsModal .modal-content {
    max-width: 550px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 25px;
}

#bulkSmsModal .modal-content {
    max-width: 700px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 25px;
}

#giantTasksModal .modal-content {
    max-width: 600px;
}

#editPurchaseModal .modal-content {
    max-width: 600px;
    max-height: 85vh;
    padding: 25px;
}

#editReminderModal input,
#editReminderModal textarea {
    margin: 5px 0;
}

#customerDetailModal .tab {
    display: inline-block;
    padding: 8px 14px;
    background: #d5dbe3;
    color: #2c3e50;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    border: 1px solid #bbb;
}

#customerDetailModal .tab.active {
    background: #2d7d46;
    color: white;
    border-color: #2d7d46;
}

.detail-section {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.detail-section h5 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.report-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

/* ========== تعاملات ========== */
.interaction-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-right: 4px solid #3498db;
}

.interaction-item .date {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.interaction-item .text {
    font-weight: bold;
}

.interaction-item .type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.type-call {
    background: #e3f2fd;
    color: #1565c0;
}

.type-meeting {
    background: #e8f5e9;
    color: #2e7d32;
}

.type-email {
    background: #fff3e0;
    color: #e65100;
}

.type-message {
    background: #f3e5f5;
    color: #6a1b9a;
}

.type-other {
    background: #eef2f7;
    color: #7f8c8d;
}

/* ========== خرید ========== */
.add-purchase-section {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.add-purchase-section input {
    margin: 3px 0;
}

.purchase-actions {
    display: flex;
    gap: 3px;
}

.purchase-actions button {
    padding: 2px 6px;
    font-size: 0.7rem;
}

.advanced-filters {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

.advanced-filters select,
.advanced-filters input {
    margin: 3px 0;
}

.filter-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    display: block;
    margin-bottom: 2px;
}

/* ========== وظایف ========== */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.task-item.done {
    opacity: 0.6;
    text-decoration: line-through;
}

.task-item input[type="checkbox"] {
    margin-left: 10px;
    width: auto;
}

.tasks-section {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.tasks-section h5 {
    margin: 0 0 8px 0;
    color: #2c3e50;
}

.add-task-row {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.add-task-row input {
    flex: 1;
    min-width: 100px;
    padding: 6px;
    margin: 0;
}

.add-task-row button {
    padding: 6px 12px;
}

.default-tasks-manager {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.default-tasks-manager .status-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.default-tasks-manager .status-selector button {
    padding: 5px 12px;
    font-size: 0.85rem;
}

.default-tasks-manager .status-selector button.active {
    background: #2d7d46;
}

.default-tasks-manager .task-list {
    margin: 8px 0;
}

.default-tasks-manager .task-list .task-item {
    background: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.default-tasks-manager .task-list .task-item .task-title {
    cursor: pointer;
    flex: 1;
}

.default-tasks-manager .task-list .task-item .task-title:hover {
    background: #f0f0f0;
    border-radius: 3px;
    padding: 0 5px;
}

.default-tasks-manager .add-task-row {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.default-tasks-manager .add-task-row input {
    flex: 1;
    min-width: 100px;
    padding: 6px;
    margin: 0;
}

.default-tasks-manager .add-task-row button {
    padding: 6px 12px;
}

.default-tasks-manager .note {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 8px;
}

#defaultTaskStatusSelector button {
    background: #e8f5e9;
    color: #2d7d46;
    border: 1px solid #2d7d46;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

#defaultTaskStatusSelector button.active {
    background: #2d7d46;
    color: white;
}

/* ========== ویرایش سریع ========== */
#quickEditSection {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

#quickEditSection label {
    display: block;
    margin-bottom: 2px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

#quickEditSection select,
#quickEditSection input,
#quickEditSection textarea {
    margin: 3px 0 8px;
    padding: 6px;
}

/* ========== متفرقه ========== */
.uniform-height {
    align-items: center;
}

.uniform-height input,
.uniform-height button,
.uniform-height select {
    height: 38px;
    padding: 6px 12px;
    box-sizing: border-box;
    font-size: 0.9rem;
    border-radius: 6px;
    margin: 0;
    vertical-align: middle;
}

.password-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 200px;
}

.password-wrapper input {
    width: 100%;
    padding-left: 10px;
    padding-right: 35px;
}

.password-toggle {
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1.2rem;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.province-select {
    width: 100%;
    padding: 10px;
    margin: 5px 0 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.import-export-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.import-export-buttons button {
    margin: 0;
}

#dashboardCustomerCount {
    background: rgba(45, 125, 70, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

/* ========== پیامک ========== */
#smsCustomerInfo {
    background: #f0f7ff;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    border-right: 4px solid #3498db;
}

#smsHistory {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

#smsHistory h5 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 0.95rem;
}

#smsHistoryList {
    max-height: 200px;
    overflow-y: auto;
}

#smsPatternFields input {
    margin-bottom: 8px;
}

#smsModal textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
}

#smsModal select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 10px;
}

#smsModal label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

#smsModal .tab,
#bulkSmsModal .tab {
    display: inline-block;
    padding: 10px 16px;
    background: #e0e0e0;
    color: #333;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    transition: all 0.2s;
    text-align: center;
}

#smsModal .tab.active,
#bulkSmsModal .tab.active {
    background: #8e44ad;
    color: white;
    border-color: #8e44ad;
}

#smsModal .tab:hover:not(.active) {
    background: #d5dbe3;
}

#bulkSmsModal .tab:hover:not(.active) {
    background: #bbb;
}

/* ========== Accordion ========== */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.accordion-item {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.accordion-header {
    padding: 14px 18px;
    background: #f8f9fa;
    font-weight: bold;
    font-size: 1rem;
    color: #2c3e50;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #eef2f7;
}

.accordion-header::after {
    content: '▼';
    margin-right: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: #7f8c8d;
}

.accordion-header.active::after {
    transform: rotate(-180deg);
}

.accordion-body {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-body.open {
    max-height: 2000px;
    padding: 15px 18px;
}

.accordion-body label {
    display: block;
    margin: 5px 0 2px;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.accordion-body input,
.accordion-body select,
.accordion-body textarea {
    margin: 3px 0 10px;
}

/* ========== Captcha ========== */
.captcha-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.captcha-text {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 6px;
    color: #2d7d46;
    user-select: none;
    min-width: 110px;
    border: 2px solid #ddd;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#captchaInput {
    flex: 0.6 !important;
    margin: 0 !important;
    padding: 8px 10px;
    text-align: center;
    font-size: 1rem;
    letter-spacing: 3px;
    width: auto !important;
}

/* ========== مانیتور پیامک ========== */
.sms-stat-card {
    flex: 1;
    min-width: 80px;
    padding: 15px 12px;
    text-align: center;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sms-stat-card.today {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
}

.sms-stat-card.week {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
}

.sms-stat-card.month {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: white;
}

.sms-stat-card.total {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}

.sms-stat-num {
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
}

.sms-stat-label {
    font-size: 0.75rem;
    margin-top: 4px;
}

#smsEventCards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.sms-event-mini-card {
    flex: 1;
    min-width: 130px;
    max-width: 160px;
    padding: 14px 10px;
    text-align: center;
    border-radius: 14px;
    background: white;
    border: 2px solid #e8e8e8;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}

.sms-event-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sms-event-mini-card .event-icon {
    font-size: 2rem;
}

.sms-event-mini-card .event-count {
    font-size: 1.6rem;
    font-weight: 900;
    color: #2c3e50;
    margin: 5px 0;
}

.sms-event-mini-card .event-label {
    font-size: 0.75rem;
    color: #555;
    font-weight: bold;
}

.sms-event-mini-card .event-bar {
    height: 5px;
    border-radius: 3px;
    margin-top: 8px;
    background: #e0e0e0;
    overflow: hidden;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

.sms-event-mini-card .event-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: #27ae60;
}

#smsMonitorTab .flex {
    direction: rtl;
}

#smsMonitorTab input,
#smsMonitorTab select {
    direction: rtl;
    text-align: right;
}

#smsStatusChart {
    width: 100% !important;
    height: 80px !important;
    max-width: 100%;
    margin-bottom: 0;
    display: block;
}

#smsChartMsg {
    margin-top: 5px;
    margin-bottom: 10px;
}

#smsMonitorList {
    max-width: 90%;
    margin: 0 auto;
}

/* ========== Animations ========== */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.stat-box.total h4::before {
    content: '🚨';
    animation: blink 1s infinite;
    margin-left: 5px;
}

/* ========== رسپانسیو ========== */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .header-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .header-right span {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }

    .header-right button {
        flex: 0 0 30%;
        min-width: 100px;
        text-align: center;
    }

    .logo-main,
    .logo-custom {
        width: 40px;
        height: 40px;
    }

    .app-subtitle {
        font-size: 1rem;
    }

    .app-title {
        font-size: 0.85rem;
    }

    img.logo {
        width: 55px !important;
        height: 55px !important;
    }

    #performanceChartContainer,
    #provinceChartContainer,
    #provinceSalesChartContainer {
        height: 250px !important;
    }

    #performanceChart,
    #provinceChart,
    #provinceSalesChart {
        max-height: 250px !important;
    }

    #productsChartContainer,
    #customersChartContainer {
        height: 350px !important;
        max-height: 350px !important;
    }

    #productsChartContainer canvas,
    #customersChartContainer canvas {
        max-height: 350px !important;
    }

    #statusChart {
        max-height: 280px !important;
    }

    .chart-wrapper {
        padding: 8px !important;
    }
}

@media (max-width: 480px) {
    .captcha-text {
        font-size: 1.1rem;
        min-width: 80px;
        letter-spacing: 4px;
        padding: 8px 12px;
    }

    #captchaInput {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
}

.btn-wa-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    background-image: url('icons/whatsapp.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    padding: 10px 12px;
    border-radius: 6px;
    background-color: #25D366;
    cursor: pointer;
}

.btn-tg-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    background-image: url('icons/telegram.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    padding: 10px 12px;
    border-radius: 6px;
    background-color: #0088cc;
    cursor: pointer;
}

.stat-box.quotes {
    background: #f3e5f5;
    border: 2px solid #ce93d8;
    cursor: pointer;
}

#customerDetailModal .modal-content {
    min-height: 563px;
}

@media (max-width: 768px) {
    #customerDetailModal .modal-content {
        min-height: 350px;
    }
}

#quotesModal .modal-content,
#quotesModal>div {
    min-height: 560px;
}

@media (max-width: 768px) {

    #quotesModal .modal-content,
    #quotesModal>div {
        min-height: 300px;
    }
}

.birthday-fields {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 15px;
}

.birthday-fields label {
    white-space: nowrap;
    margin-left: 8px;
}

.birthday-fields input {
    text-align: center;
}

.birthday-fields #c_birthDay,
.birthday-fields #c_birthMonth {
    width: 80px;
}

.birthday-fields #c_birthYear {
    width: 70px;
}


.card.header {
    background: linear-gradient(135deg, #004d40 0%, #00897b 50%, #26c6da 100%) !important;
    color: white !important;
}

.card.header .app-title {
    color: white !important;
}

.card.header .app-subtitle {
    color: rgba(255, 255, 255, 0.9) !important;
}

.card.header .app-version {
    color: rgba(255, 255, 255, 0.7) !important;
}

@media (max-width: 768px) {
    #dashboardCustomerCount {
        display: block !important;
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
}

@media (max-width: 768px) {
    .card:has(.tab) {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .card .tab {
        flex: 1 1 calc(50% - 6px) !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 12px 8px !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 768px) {
    .import-export-buttons {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    .import-export-buttons button {
        flex: 1 1 calc(50% - 6px) !important;
        text-align: center !important;
        margin: 0 !important;
        font-size: 0.8rem !important;
        padding: 10px 6px !important;
    }

    .import-export-buttons button:last-child {
        flex: 1 1 100% !important;
    }
}

@media (max-width: 768px) {
    .advanced-filters .flex {
        flex-wrap: wrap !important;
    }

    .advanced-filters .flex>div {
        flex: 1 1 calc(50% - 6px) !important;
    }

    .advanced-filters .flex>div:has(#filterProvince) {
        flex: 1 1 100% !important;
    }

    .advanced-filters .flex>div:has(button) {
        flex: 1 1 100% !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 6px !important;
    }

    .advanced-filters .flex>div:has(button) button {
        flex: 1 !important;
        text-align: center !important;
        margin: 0 !important;
    }
}

@media (max-width: 768px) {
    #remindersTab .flex.uniform-height {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(3) {
        order: 1 !important;
        flex: 1 1 100% !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(1) {
        order: 2 !important;
        flex: 1 1 100% !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(5) {
        order: 3 !important;
        flex: 1 1 100% !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(4) {
        order: 4 !important;
        flex: 1 1 calc(50% - 6px) !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(6) {
        order: 4 !important;
        flex: 1 1 calc(50% - 6px) !important;
    }

    #remindersTab .flex.uniform-height>*:nth-child(2) {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #customerDetailModal .modal-content>div:first-of-type {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }

    #customerDetailModal .modal-content>div:first-of-type .tab {
        flex: 1 1 calc(50% - 6px) !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 10px 6px !important;
        font-size: 0.8rem !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 768px) {
    .customer-item>div:last-child {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .customer-item>div:last-child button {
        flex: 1 1 calc(25% - 4px) !important;
        text-align: center !important;
        font-size: 0.7rem !important;
        padding: 6px 2px !important;
        margin: 0 !important;
        white-space: nowrap !important;
    }

    .customer-item>div:last-child button:nth-child(n+5) {
        flex: 1 1 calc(33.33% - 4px) !important;
    }
}

#login {
    background: linear-gradient(135deg, #004d40 0%, #00897b 50%, #26c6da 100%) !important;
    border-radius: 12px !important;
    padding: 30px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
}

#login>div:first-of-type {
    filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.5));
}

.login-crm {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.login-subtitle {
    font-size: 1rem;
    margin-top: 2px;
    color: #ffffff;
}

.login-brand {
    font-size: 2rem;
    font-weight: 900;
    margin-top: 2px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#login>div:first-of-type img {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

#captchaText {
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0) !important;
    padding-left: 10px !important;
    border-radius: 6px !important;
    font-size: 1.4rem !important;
    font-weight: bold !important;
    letter-spacing: 6px !important;
    color: #2d7d46 !important;
    user-select: none !important;
    min-width: 110px !important;
    border: 2px solid #ddd !important;
    text-align: center !important;
    line-height: 45px !important;
    height: 45px !important;
    display: block !important;
    flex: 1 !important;
}

@media (max-width: 768px) {
    .captcha-box {
        gap: 6px !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 5px 0 15px !important;
    }

    #captchaText {
        height: 50px !important;
        line-height: 50px !important;
        flex: 1 !important;
        margin: 0 !important;
        border-radius: 6px !important;
        text-align: right !important;
        padding-right: 3px !important;
    }

    #captchaInput {
        height: 50px !important;
        flex: 0.35 !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 6px !important;
    }
}

@media (min-width: 769px) {
    #appTitleDisplay {
        text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    }
}

.card.header {
    position: relative !important;
}


/* ========== Dark Mode ========== */
body.dark-mode {
    background: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .card {
    background: #16213e;
    color: #e0e0e0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: #0f3460;
    color: #e0e0e0;
    border-color: #1a1a4e;
}

body.dark-mode .customer-item,
body.dark-mode .reminder-item,
body.dark-mode .filter-section,
body.dark-mode .advanced-filters,
body.dark-mode .interaction-item {
    background: #1a1a3e;
}

body.dark-mode .tab {
    background: #333;
    color: #ccc;
}

body.dark-mode .tab.active {
    background: #00897b;
    color: white;
}

body.dark-mode button {
    opacity: 0.9;
}

body.dark-mode #login {
    background: linear-gradient(135deg, #00251a 0%, #004d40 50%, #00897b 100%) !important;
}

body.dark-mode .accordion-header {
    background: #1a1a3e;
    color: #e0e0e0;
}

body.dark-mode .accordion-body {
    background: #16213e;
}

body.dark-mode #customerDetailModal .modal-content,
body.dark-mode #reportModal .modal-content,
body.dark-mode #smsModal .modal-content,
body.dark-mode #bulkSmsModal .modal-content,
body.dark-mode #giantTasksModal .modal-content,
body.dark-mode #editPurchaseModal .modal-content {
    background: #16213e;
    color: #e0e0e0;
}

body.dark-mode .login-subtitle {
    color: #ffffff !important;
}

body.dark-mode .app-subtitle {
    color: rgba(255, 255, 255, 0.9) !important;
}

body.dark-mode .app-title {
    color: white !important;
}

body.dark-mode .app-version {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.dark-mode .stat-box .num {
    color: #e0e0e0 !important;
}

body.dark-mode .stat-box h4 {
    color: #aaa !important;
}

/* === کارت‌های ردیف اول === */
body.dark-mode .stat-box.today {
    background: rgba(46, 125, 50, 0.25) !important;
    border: 1px solid rgba(76, 175, 80, 0.5) !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.2) !important;
}

body.dark-mode .stat-box.tomorrow {
    background: rgba(21, 101, 192, 0.25) !important;
    border: 1px solid rgba(66, 165, 245, 0.5) !important;
    box-shadow: 0 0 15px rgba(66, 165, 245, 0.2) !important;
}

body.dark-mode .stat-box.past {
    background: rgba(198, 40, 40, 0.25) !important;
    border: 1px solid rgba(239, 83, 80, 0.5) !important;
    box-shadow: 0 0 15px rgba(239, 83, 80, 0.2) !important;
}

body.dark-mode .stat-box.total {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .stat-box.quotes {
    background: rgba(123, 31, 162, 0.25) !important;
    border: 1px solid rgba(171, 71, 188, 0.5) !important;
    box-shadow: 0 0 15px rgba(171, 71, 188, 0.2) !important;
}

/* === کارت نرخ تبدیل === */

body.dark-mode .stat-box.conversion.low {
    background: #c62828 !important;
    border-color: #ef5350 !important;
}

body.dark-mode .stat-box.conversion.mid {
    background: #e65100 !important;
    border-color: #ff9800 !important;
}

body.dark-mode .stat-box.conversion.high {
    background: #2e7d32 !important;
    border-color: #4caf50 !important;
}

/* === کارت‌های گزارش فروش === */
body.dark-mode #salesReport .stat-box {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .stat-box.conversion.low {
    background-color: #c62828 !important;
}

body.dark-mode .stat-box.conversion.mid {
    background-color: #e65100 !important;
}

body.dark-mode .stat-box.conversion.high {
    background-color: #2e7d32 !important;
}

body.dark-mode .stat-box.conversion.low .num,
body.dark-mode .stat-box.conversion.low h4 {
    background-color: transparent !important;
}

body.dark-mode .stat-box.conversion.mid .num,
body.dark-mode .stat-box.conversion.mid h4 {
    background-color: transparent !important;
}

body.dark-mode .stat-box.conversion.high .num,
body.dark-mode .stat-box.conversion.high h4 {
    background-color: transparent !important;
}

body.dark-mode .chart-wrapper {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .chart-wrapper h4 {
    color: #e0e0e0 !important;
}

body.dark-mode .performance-wrapper {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .performance-wrapper h4 {
    color: #e0e0e0 !important;
}

body.dark-mode .funnel-section {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .funnel-container {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .funnel-section h4 {
    color: #e0e0e0 !important;
}

body.dark-mode #performanceChartSelect {
    background: #16213e !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode .chart-tab {
    background: #333 !important;
    color: #ccc !important;
}

body.dark-mode .chart-tab.active {
    background: #00897b !important;
    color: white !important;
}

body.dark-mode .chart-toggle-btn {
    background: #16213e !important;
    color: #e0e0e0 !important;
    border-color: #00897b !important;
}

body.dark-mode select#performanceChartSelect {
    background-color: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode select#performanceChartSelect option {
    background-color: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsMonitorList>div {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #smsMonitorList>div div[style*="background:#f8f9fa"] {
    background: #0f3460 !important;
}

body.dark-mode #smsMonitorList>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #smsMonitorList>div b {
    color: #e0e0e0 !important;
}

body.dark-mode #smsMonitorList>div div {
    color: #ccc !important;
}

body.dark-mode #smsMonitorList>div div[style*="font-size:0.7rem"] {
    color: #e0e0e0 !important;
    background: #0f3460 !important;
}

body.dark-mode #smsMonitorList>div b {
    color: #b0c4de !important;
}

body.dark-mode #r_customerName {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #customerModal>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #customerModal input {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #modalCustomerList>div {
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #detailTabContent {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #detailTabContent .detail-section {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #detailTabContent .purchase-card {
    background: #1a1a3e !important;
}

body.dark-mode #detailTabContent .interaction-item {
    background: #1a1a3e !important;
}

body.dark-mode #detailTabContent .task-item {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode .add-purchase-section {
    background: #1a1a3e !important;
}

body.dark-mode .tasks-section {
    background: #1a1a3e !important;
}

body.dark-mode #detailTabContent h5 {
    color: #e0e0e0 !important;
}

body.dark-mode #detailTabContent p {
    color: #ccc !important;
}

body.dark-mode .purchaseProductDropdown {
    background: #16213e !important;
    border-color: #333 !important;
}

body.dark-mode .purchaseProductDropdown>div {
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode .purchaseProductDropdown>div:hover {
    background: #00897b !important;
}

body.dark-mode #detailTabContent>div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #detailTabContent>div[style*="background:#f8f9fa"] b,
body.dark-mode #detailTabContent>div[style*="background:#f8f9fa"] div {
    color: #e0e0e0 !important;
}

body.dark-mode #detailTabContent .purchase-card div[style*="font-size:0.8rem"] {
    color: #b0c4de !important;
}

body.dark-mode #detailTabContent .purchase-card div[style*="color:#e67e22"] {
    color: #ffab40 !important;
}

body.dark-mode #detailTabContent>div[style*="font-size:0.8rem"] {
    color: #b0c4de !important;
}

body.dark-mode #detailTabContent>div[style*="color:#e67e22"] {
    color: #ffab40 !important;
}

body.dark-mode #detailTabContent>div[style*="background:#f8f9fa"]>div[style*="font-size:0.8rem"] {
    color: #b0c4de !important;
}

body.dark-mode #detailTabContent>div[style*="background:#f8f9fa"]>div[style*="color:#e67e22"] {
    color: #ffab40 !important;
}

body.dark-mode #smsCustomerInfo {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode .accordion-body {
    background: #16213e !important;
}

body.dark-mode .accordion-body>div[style*="background:white"],
body.dark-mode .accordion-body>div[style*="background: rgb(248, 249, 250)"] {
    background: #1a1a3e !important;
}

body.dark-mode #productsList>div,
body.dark-mode #smsTemplatesList>div,
body.dark-mode #smsPatternsList>div,
body.dark-mode #smsEventsList>div,
body.dark-mode #interactionTypesList>div,
body.dark-mode #autoTagsList>div,
body.dark-mode #giantTasksManagerList>div,
body.dark-mode #holidaysList>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .default-tasks-manager {
    background: #1a1a3e !important;
}

body.dark-mode .default-tasks-manager .task-list .task-item {
    background: #16213e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #newPatternVariables {
    background: #1a1a3e !important;
}

body.dark-mode #smsEventsList+div[style*="background:#f0f7ff"],
body.dark-mode #smsPatternsList+div[style*="background:#f0f7ff"] {
    background: #1a1a3e !important;
}

body.dark-mode .accordion-body span.task-title {
    color: #e0e0e0 !important;
}

body.dark-mode .accordion-body span[style*="color:#7f8c8d"] {
    color: #aaa !important;
}

@media (max-width: 768px) {
    #darkModeBtn {
        font-size: 1.2rem !important;
        padding: 4px 6px !important;
        position: absolute !important;
        bottom: auto !important;
        top: 8px !important;
        left: -10px !important;
        right: auto !important;
    }
}

@media (max-width: 768px) {
    .header-right button {
        font-size: 0.7rem !important;
        padding: 6px 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }
}

body.dark-mode #giantTasksList>div {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #giantTasksList>div small {
    color: #aaa !important;
}

body.dark-mode #giantTasksList .task-item.done {
    opacity: 0.6 !important;
}

body.dark-mode #quotesModal>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #quotesModal>div>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #quotesModal>div>div b {
    color: #e0e0e0 !important;
}

body.dark-mode #quotesModal>div>div div {
    color: #ccc !important;
}

body.dark-mode #quotesModal>div>div div[style*="color:#e67e22"] {
    color: #ffab40 !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#smsEventCards {
    max-width: 100%;
}

.sms-event-mini-card {
    flex: 1 1 calc(20% - 10px) !important;
    max-width: calc(20% - 10px) !important;
    min-width: 130px !important;
}

@media (max-width: 768px) {
    .sms-event-mini-card {
        flex: 1 1 calc(33.33% - 8px) !important;
        max-width: calc(33.33% - 8px) !important;
        min-width: 100px !important;
    }
}

body.dark-mode #convertStatusSelect {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #convertStatusSelect {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #confirmConvert+div,
body.dark-mode [style*="background:white"][style*="padding:20px"][style*="border-radius:12px"] {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #reportModal .modal-content {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #monthlyReportData>div:first-child {
    background: #1a3a2e !important;
}

body.dark-mode #monthlyReportData>div:last-child {
    background: #1a1a3e !important;
}

body.dark-mode #monthlyReportData h5 {
    color: #e0e0e0 !important;
}

body.dark-mode #monthlyReportData .report-item {
    color: #ccc !important;
    border-color: #333 !important;
}

body.dark-mode #monthlyReportData .report-item strong {
    color: #b0c4de !important;
}

body.dark-mode #monthlyReportData .report-item[style*="background:#fff3cd"] {
    background: #3e3520 !important;
    color: #ffd54f !important;
}

body.dark-mode #monthlyReportData .report-item[style*="background:#e8f5e9"] {
    background: #1a3a2e !important;
}

body.dark-mode #reportContent div[style*="background:#e8f5e9"] {
    background: #1a3a2e !important;
}

body.dark-mode #reportContent div[style*="background:#f3f4f6"] {
    background: #1a1a3e !important;
}

body.dark-mode .reminder-item b {
    color: #90caf9 !important;
}

body.dark-mode #smsMonitorList>div div[style*="font-size:0.7rem"] {
    color: #ffab40 !important;
}

body.dark-mode #quickEditSection {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #quickEditSection label {
    color: #aaa !important;
}

body.dark-mode #quickEditSection input,
body.dark-mode #quickEditSection textarea,
body.dark-mode #quickEditSection select {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #bulkSmsModal div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
}

body.dark-mode #bulkSmsModal div[style*="background:#f8f9fa"] h5 {
    color: #e0e0e0 !important;
}

body.dark-mode #bulkSmsModal div[style*="background:#f8f9fa"] label {
    color: #ccc !important;
}

body.dark-mode #smsPatternFields>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #smsPatternFields label {
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields span {
    color: #aaa !important;
}

body.dark-mode #smsPatternFields input {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #smsPatternFields>div[style*="background:#f0f7ff"] {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields>div[style*="background:#f0f7ff"] strong {
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields>div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields>div[style*="background:#f8f9fa"] span {
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields label[style*="font-weight:bold"] {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternFields label[style*="font-weight:bold"] span {
    color: #e0e0e0 !important;
}

body.dark-mode #smsHistory h5 {
    color: #64b5f6 !important;
}

body.dark-mode #aiResultModal>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #aiResultModal h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #aiResultModal div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #aiLoading>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #aiLoading h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #aiLoading p {
    color: #aaa !important;
}

body.dark-mode #aiLoading>div,
body.dark-mode [id^="aiResultModal"]>div,
body.dark-mode [id^="aiResultModal"]>div>div:first-child,
body.dark-mode #aiLoading>div>h3,
body.dark-mode [id^="aiResultModal"] h3 {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #aiLoading>div>p {
    color: #aaa !important;
}

body.dark-mode [id^="aiResultModal"] div[style*="background:#f8f9fa"],
body.dark-mode [id^="aiResultModal"] div[style*="line-height:1.8"] {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode [id^="aiResultModal"] button {
    opacity: 0.9 !important;
}

body.dark-mode #wooLoading>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #wooLoading h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #bulkPatternPreview {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #bulkPatternPreview strong {
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternPreview {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsPatternPreview strong {
    color: #e0e0e0 !important;
}

body.dark-mode #smsLoading>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #smsLoading h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #smsHistoryList>div {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #smsHistoryList>div>div:first-child {
    color: #aaa !important;
}

body.dark-mode #smsHistoryList>div>div:last-child {
    color: #e0e0e0 !important;
}

body.dark-mode #bulkSmsModal .modal-content {
    background: #16213e !important;
}

body.dark-mode #bulkSmsModal h5,
body.dark-mode #bulkSmsModal label {
    color: #e0e0e0 !important;
}

body.dark-mode #bulkSmsModal div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
}

body.dark-mode #bulkRecipientCount {
    color: #e0e0e0 !important;
}

body.dark-mode #newPatternVariables input[readonly] {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #newPatternVariables input:not([readonly]) {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #newPatternVariables span {
    color: #e0e0e0 !important;
}

body.dark-mode #detectResult span {
    color: #e0e0e0 !important;
}

body.dark-mode #smsLoading>div {
    background-color: #16213e !important;
}

body.dark-mode #smsLoading>div h3 {
    color: #ffffff !important;
}

body.dark-mode #smsLoading>div p {
    color: #cccccc !important;
}

body.dark-mode #monthlyInvoicesModal>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #monthlyInvoicesModal h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #monthlyInvoicesModal .purchase-filters {
    background: #1a1a3e !important;
}

body.dark-mode #monthlyInvoicesModal .purchase-filters input {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode #monthlyInvoicesListContainer>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
}

body.dark-mode #monthlyInvoicesListContainer>div b {
    color: #64b5f6 !important;
}

body.dark-mode #monthlyInvoicesListContainer>div>div[style*="font-size:0.85rem"],
body.dark-mode #monthlyInvoicesListContainer>div>div[style*="font-size:0.8rem"] {
    color: #ccc !important;
}

body.dark-mode #monthlyInvoicesListContainer>div>div[style*="color:#e67e22"] {
    color: #ffab40 !important;
}

body.dark-mode #showAllProductsCountBtn {
    background: #1e88e5 !important;
    color: white !important;
}

/* ========== Dark Mode - مودال مشاهده همه نمودارها ========== */

/* مودال محصولات - تومان */
body.dark-mode #showAllProductsBtn+div,
body.dark-mode [onclick*="showAllProductsPopup"]~div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

/* مودال محصولات - تعداد */
body.dark-mode [onclick*="showAllProductsCountPopup"]~div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

/* مودال مشتریان */
body.dark-mode [onclick*="showAllCustomersPopup"]~div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

/* جداول داخل مودال‌ها */
body.dark-mode [style*="max-width:500px"] table tr:nth-child(even) {
    background: #1a1a3e !important;
}

body.dark-mode [style*="max-width:500px"] table tr:nth-child(odd) {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode [style*="max-width:500px"] table td {
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

/* هدر جدول - محصولات تومان (بنفش) */
body.dark-mode [style*="max-width:500px"] table tr[style*="background:#8e44ad"] {
    background: #6a1b9a !important;
}

/* هدر جدول - محصولات تعداد (آبی) */
body.dark-mode [style*="max-width:500px"] table tr[style*="background:#42a5f5"] {
    background: #1565c0 !important;
}

/* هدر جدول - مشتریان (نارنجی) */
body.dark-mode [style*="max-width:500px"] table tr[style*="background:#e67e22"] {
    background: #bf360c !important;
}

/* دکمه بستن داخل مودال */
body.dark-mode [style*="max-width:500px"] button {
    opacity: 0.9 !important;
}

body.dark-mode #backupLoading>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #backupLoading h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #backupLoading p {
    color: #aaa !important;
}

body.dark-mode .default-tasks-manager .task-list .task-item .task-title:hover {
    background: #0f3460 !important;
}

/* ========== مدیریت کاربران و نقش‌ها - Dark Mode ========== */
body.dark-mode #rolesList>div,
body.dark-mode #usersList>div {
    background-color: #1a1a2e !important;
    color: #e0e0e0 !important;
    border: 1px solid #333 !important;
}

body.dark-mode #rolesList>div b,
body.dark-mode #usersList>div b {
    color: #ffffff !important;
}

body.dark-mode #rolesList>div small,
body.dark-mode #usersList>div small {
    color: #aaa !important;
}

body.dark-mode #userManagementContent input,
body.dark-mode #userManagementContent select {
    background-color: #0f3460 !important;
    color: #f0f0f0 !important;
    border: 1px solid #444 !important;
}

body.dark-mode #userManagementContent button {
    background-color: #2a2a4a !important;
    color: #f0f0f0 !important;
    border: 1px solid #555 !important;
}

body.dark-mode #userManagementContent h4,
body.dark-mode #userManagementContent label {
    color: #ffffff !important;
}

#provinceChart {
    cursor: pointer;
}

/* انیمیشن ساده برای کارت‌های در حال بارگذاری */
#salesReport .stat-box .num.loading {
    animation: simpleBlink 1.2s infinite;
}

@keyframes simpleBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

#newGiantTaskDeadline {
    height: 45px;
    padding: 6px 12px;
    box-sizing: border-box;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin: 0;
}

/* جلوگیری از بیرون زدن تقویم از سمت چپ */
.pdp-default {
    left: auto !important;
    right: 0 !important;
}

.dashboard-loading .stat-box {
    opacity: 0.4;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.header-menu-container {
    position: relative;
    display: inline-block;
}

.header-menu-btn {
    background: rgba(0, 0, 0, 0.35) !important;
    color: white !important;
    border: none !important;
    font-size: 1.3rem !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    line-height: 1 !important;
}

.header-menu-btn:hover {
    background: rgba(0, 0, 0, 0.5) !important;
}

.header-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 180px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    margin-top: 5px;
    overflow: hidden;
}

.header-menu-dropdown.show {
    display: block;
}

.header-menu-dropdown button {
    display: block !important;
    width: 100% !important;
    text-align: right !important;
    padding: 10px 15px !important;
    border: none !important;
    background: white !important;
    color: #2c3e50 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f0f0f0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.header-menu-dropdown button[style*="opacity: 0.6"] {
    opacity: 0.25 !important;
}

body.dark-mode .header-menu-dropdown button[style*="opacity: 0.6"] {
    opacity: 0.35 !important;
}
#btnGenerateDailyMenu[style*="opacity: 0.5"] {
    opacity: 0.25 !important;
}

body.dark-mode #btnGenerateDailyMenu[style*="opacity: 0.5"] {
    opacity: 0.35 !important;
}


.header-menu-dropdown button:hover {
    background: #f0f7ff !important;
}

body.dark-mode .header-menu-dropdown {
    background: #16213e;
}

body.dark-mode .header-menu-dropdown button {
    background: #16213e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode .header-menu-dropdown button:hover {
    background: #0f3460 !important;
}

.header-menu-dropdown button[onclick*="askAI"] {
    background: #f3e5f5 !important;
    color: #7b1fa2 !important;
    border-right: 3px solid #8e44ad !important;
}

.header-menu-dropdown button[onclick*="askAI"]:hover {
    background: #e1bee7 !important;
}

body.dark-mode .header-menu-dropdown button[onclick*="askAI"] {
    background: rgba(142, 68, 173, 0.2) !important;
    color: #ce93d8 !important;
    border-right-color: #8e44ad !important;
}

body.dark-mode .header-menu-dropdown button[onclick*="askAI"]:hover {
    background: rgba(142, 68, 173, 0.35) !important;
}

.stat-box.total {
    position: relative;
    overflow: visible;
}

.task-notification-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e74c3c;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 12px;
    padding: 0 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
    display: none;
}

/* دکمه‌های ارسال پیام/واتساپ/تلگرام در مودال پیامک */
#smsModal .flex button img {
    filter: brightness(0) invert(1);
    vertical-align: middle;
}


/*لانه زنبوری*/ 
.card.header {
    position: relative;
}

.card.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='50' height='50' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='sq1' width='50' height='50' patternUnits='userSpaceOnUse'%3E%3Crect x='5' y='5' width='40' height='40' fill='none' stroke='rgba(255,215,0,0.35)' stroke-width='1'/%3E%3Crect x='15' y='15' width='20' height='20' fill='none' stroke='rgba(255,215,0,0.45)' stroke-width='1'/%3E%3Crect x='22' y='22' width='6' height='6' fill='rgba(255,215,0,0.3)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23sq1)'/%3E%3C/svg%3E");
    background-size: 50px 50px;
    animation: hexBreath 6s ease-in-out infinite;
}

@keyframes hexBreath {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.75;
    }
}

#login {
    position: relative;
    background: linear-gradient(135deg, #004d40 0%, #00897b 50%, #26c6da 100%) !important;
    border-radius: 12px !important;
    padding: 30px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3) !important;
}

#login::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='50' height='50' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='sq2' width='50' height='50' patternUnits='userSpaceOnUse'%3E%3Crect x='5' y='5' width='40' height='40' fill='none' stroke='rgba(255,215,0,0.3)' stroke-width='1'/%3E%3Crect x='15' y='15' width='20' height='20' fill='none' stroke='rgba(255,215,0,0.4)' stroke-width='1'/%3E%3Crect x='22' y='22' width='6' height='6' fill='rgba(255,215,0,0.25)'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23sq2)'/%3E%3C/svg%3E");
    background-size: 50px 50px;
    animation: hexBreath 6s ease-in-out infinite;
}

@keyframes hexBreath {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.75;
    }
}

#login>* {
    position: relative;
    z-index: 1;
}
body.dark-mode #dailyTaskLoading>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #dailyTaskLoading h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #dailyTaskLoading p {
    color: #aaa !important;
}
body.dark-mode #giantTasksManagerList~div[style*="background:#f8f9fa"],
body.dark-mode #settingsTab div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
    border-color: #333 !important;
}
body.dark-mode #autoRulesList>div {
    background: #1a1a3e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #autoRulesList+div[style*="background:#f0f7ff"] {
    background: #1a1a3e !important;
    border-color: #333 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #autoRulesList+div[style*="background:#f0f7ff"] label {
    color: #e0e0e0 !important;
}

body.dark-mode #autoRulesList+div[style*="background:#f0f7ff"] input,
body.dark-mode #autoRulesList+div[style*="background:#f0f7ff"] select {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}



.card.header .header-right button {
    position: relative;
    z-index: 1;
}
body.dark-mode #customerCategoriesList > div {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}
body.dark-mode div[style*="background:#fff3cd"] {
    background: #3e3520 !important;
    border-right-color: #f39c12 !important;
}

body.dark-mode div[style*="background:#fff3cd"] b,
body.dark-mode div[style*="background:#fff3cd"] code {
    color: #ffd54f !important;
}

body.dark-mode div[style*="background:#fff3cd"] .var-guide {
    color: #e0e0e0 !important;
}

body.dark-mode div[style*="background:#fff3cd"] .var-guide code {
    background: #0f3460 !important;
    color: #ffd700 !important;
}
body.dark-mode #profile_username {
    background: #0f3460 !important;
    color: #aaa !important;
    border-color: #1a1a4e !important;
}
body.dark-mode #taskCountdownModal>div {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode #taskCountdownModal h3 {
    color: #e0e0e0 !important;
}

body.dark-mode #taskCountdownModal p {
    color: #aaa !important;
}

body.dark-mode #taskCountdownModal div[style*="background:"] {
    background: #1a1a3e !important;
}
body.dark-mode .task-report-modal,
body.dark-mode .report-view-modal {
    background: #16213e !important;
    color: #e0e0e0 !important;
}

body.dark-mode .task-report-modal textarea {
    background: #0f3460 !important;
    color: #e0e0e0 !important;
    border-color: #1a1a4e !important;
}

body.dark-mode .report-view-modal div[style*="background:#f8f9fa"] {
    background: #1a1a3e !important;
}
/* ========== کانال‌های جذب - Dark Mode ========== */
body.dark-mode #acquaintanceMethodsList > div {
    background: #1a1a3e !important;
    color: #e0e0e0 !important;
    border-color: #333 !important;
}

body.dark-mode #acquaintanceMethodsList > div span {
    color: #e0e0e0 !important;
}