/* ============================================
   DASHBOARD.CSS - استایل‌های اختصاصی داشبورد
   ============================================ */

/* ===== دکمه‌های عملیات (عمومی) ===== */
.btn-edit,
.btn-delete,
.btn-save,
.btn-cancel {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 6px;
    margin: 0 2px;
    border-radius: 4px;
    transition: 0.2s;
}
.btn-edit:hover { background: #3b82f6; color: #fff; }
.btn-delete:hover { background: #ef4444; color: #fff; }
.btn-save:hover { background: #10b981; color: #fff; }
.btn-cancel:hover { background: #6b7280; color: #fff; }

.btn-add-row {
    background: #3b82f6;
    color: #fff;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.2s;
}
.btn-add-row:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* ===== فرم کاربر عادی ===== */
.form-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.excel-table th {
    background: var(--panel-bg);
    color: var(--text-sec);
    padding: 8px 10px;
    border: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}
.excel-table td {
    padding: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
}
.excel-table .form-control {
    width: 100%;
    padding: 4px 6px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.9rem;
    min-width: 60px;
}
.excel-table .form-control:focus {
    outline: none;
    background: var(--card-hover);
}

/* ===== جدول فعالیت‌های امروز ===== */
.today-activities {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.activity-table th {
    background: var(--panel-bg);
    color: var(--text-sec);
    padding: 8px 10px;
    text-align: center;
    border-bottom: 2px solid var(--border);
}
.activity-table td {
    padding: 6px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}
.activity-table tfoot td {
    border-top: 2px solid var(--border);
    font-weight: bold;
}
.activity-table tr:hover {
    background: var(--card-hover);
}

/* ===== کارت‌های KPI ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.kpi-card {
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    border-left: 4px solid #3b82f6;
    box-shadow: var(--shadow);
    transition: all var(--transition);
}
.kpi-card:hover {
    background: var(--card-hover);
    transform: translateY(-3px);
}
.kpi-card p {
    margin: 0;
    color: var(--text-sec);
    font-size: 0.85rem;
}
.kpi-card h2 {
    margin: 6px 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}
.kpi-card .subtext {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ===== نمودارها ===== */
.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.charts-header h3 {
    color: var(--text-sec);
    font-weight: normal;
}
.reset-btn {
    background: #3b82f6;
    border: none;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: 0.2s;
}
.reset-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
}
.chart-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    height: 300px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.chart-card h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--text-sec);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.chart-card h4 span {
    font-size: 0.75rem;
    color: #f59e0b;
}
.chart-card:nth-child(3) {
    height: 340px;
}
.chart-wrapper {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}
.chart-wrapper > div {
    width: 100% !important;
    height: 100% !important;
}

/* ===== پنل فعالیت‌ها ===== */
#activity-panel {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}
#activity-panel h4 {
    color: #f59e0b;
    margin-bottom: 12px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
#activity-panel ul.main-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
#activity-panel ul.main-list li {
    background: var(--panel-bg);
    padding: 12px;
    border-radius: 8px;
    border-right: 3px solid #3b82f6;
    color: var(--text-main);
    font-size: 0.9rem;
}
#activity-panel ul.main-list li strong {
    color: #f59e0b;
    display: block;
    margin-bottom: 4px;
}
#activity-panel ul.sub-list {
    list-style: disc;
    padding-right: 20px;
    margin-top: 4px;
    margin-bottom: 0;
}
#activity-panel ul.sub-list li {
    background: transparent !important;
    border-right: none !important;
    padding: 2px 0;
    border: none;
    box-shadow: none;
}

/* ===== نقشه حرارتی ===== */
.heatmap-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* هدر نقشه حرارتی - با ساختار یکسان */
.heatmap-header {
    padding: 0 4px;
    margin-bottom: 6px;
}

.heatmap-header .header-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
}

.heatmap-header .header-col {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-sec);
    font-size: 1rem;
    min-height: 35px;
    background: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid var(--border);
    padding: 4px 0;
}

/* بدنه نقشه حرارتی */
.building-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 1000px;
    margin: 0 auto;
}

.floor-row {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
    padding: 0 4px;
}

.tower-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.tower-cell {
    width: 100%;
    min-height: 50px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    transition: all 0.2s;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    position: relative;
}
.tower-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--cell-color);
    opacity: 0.65;
    border-radius: 4px;
    pointer-events: none;
    transition: all var(--transition);
}
.tower-cell.inactive {
    filter: brightness(0.2) contrast(0.8);
}
.tower-cell.inactive::before {
    opacity: 0.85;
    background-color: #000;
}
.tower-cell span {
    position: relative;
    z-index: 2;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    font-size: 0.9rem;
}
.tower-cell:hover {
    transform: translateY(-2px) scale(1.03);
    border: 1px solid #fff;
    z-index: 5;
}

.floor-label-center {
    flex: 0 0 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: var(--text-sec);
    font-size: 0.85rem;
}

.details-row {
    display: none;
    background: var(--panel-bg);
    border-radius: 4px;
    margin-top: 2px;
    padding: 8px 12px;
    border: 1px dashed var(--border);
    width: 100%;
}
.details-row strong {
    color: #f59e0b;
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
}
.details-row ul {
    margin: 4px 0 4px 16px;
    padding: 0;
    color: var(--text-main);
    font-size: 0.8rem;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-sec);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 768px) {
    .heatmap-header .header-col {
        font-size: 0.8rem;
        min-height: 28px;
    }
    .floor-label-center {
        flex: 0 0 40px;
        font-size: 0.7rem;
    }
    .tower-cell {
        min-height: 36px;
    }
    .tower-cell span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .heatmap-header .header-col {
        font-size: 0.65rem;
        min-height: 22px;
    }
    .floor-label-center {
        flex: 0 0 30px;
        font-size: 0.55rem;
    }
    .tower-cell {
        min-height: 24px;
    }
    .tower-cell span {
        font-size: 0.5rem;
    }
    .details-row {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    .details-row strong {
        font-size: 0.75rem;
    }
    .details-row ul {
        font-size: 0.7rem;
    }
}

/* ===== فیلتر تاریخ ادمین ===== */
.filter-container {
    background: var(--card);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border-right: 4px solid #3b82f6;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}
.filter-item {
    flex: 1 1 140px;
    min-width: 100px;
}
.filter-item label {
    color: var(--text-sec);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
}
.filter-item .form-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 1 auto;
}
.filter-info {
    flex: 1 1 auto;
    text-align: left;
    color: var(--text-sec);
    font-size: 0.8rem;
    min-width: 80px;
}

.btn-filter {
    background: #3b82f6;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-filter:hover {
    background: #2563eb;
    transform: translateY(-2px);
}
.btn-reset-filter {
    background: #6b7280;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-reset-filter:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

/* ===== فیلتر تاریخ کاربر عادی ===== */
.user-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}
.user-date-item {
    flex: 0 1 180px;
    min-width: 120px;
}
.user-date-item label {
    color: var(--text-sec);
    font-size: 0.8rem;
    display: block;
    margin-bottom: 2px;
}
.user-date-item .form-control {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.9rem;
}
.user-date-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.user-date-info {
    flex: 1;
    text-align: left;
    color: var(--text-sec);
    font-size: 0.85rem;
    min-width: 80px;
}
.btn-load-date {
    background: #3b82f6;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-load-date:hover {
    background: #2563eb;
    transform: translateY(-2px);
}
.btn-today {
    background: #10b981;
    color: #fff;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-today:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* ===== استایل‌های datepicker شمسی ===== */
.persian-datepicker .datepicker-plot-area {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
    border-radius: 8px !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-time-view .time-segment {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-header .datepicker-header-title {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-header .next-btn,
.persian-datepicker .datepicker-plot-area .datepicker-header .prev-btn {
    color: var(--text-sec) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td {
    color: var(--text-main) !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td.today {
    background-color: #3b82f6 !important;
    color: #fff !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td.selected {
    background-color: #10b981 !important;
    color: #fff !important;
}
.persian-datepicker .datepicker-plot-area .datepicker-day-view .table-condensed td:hover {
    background-color: var(--card-hover) !important;
}

/* ===== استایل Select2 (یکپارچه) ===== */
.select2-container--default .select2-selection--single {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
    border-radius: 6px !important;
    height: 34px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-main) !important;
    line-height: 34px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-sec) transparent transparent transparent !important;
}
.select2-dropdown {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    z-index: 9999 !important;
}
.select2-container--default .select2-results__option {
    color: var(--text-main) !important;
}
.select2-container--default .select2-results__option--highlighted {
    background-color: var(--card-hover) !important;
    color: var(--text-main) !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--text-main) !important;
    padding: 6px 10px !important;
    font-family: 'Vazirmatn', sans-serif !important;
}
.select2-container--default .select2-selection--single .select2-selection__clear,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-sec) !important;
}

/* ===== رفع مشکل Select2 در موبایل ===== */
@media (max-width: 768px) {
    .select2-container {
        width: 100% !important;
        max-width: 100% !important;
    }
    .select2-container--default .select2-selection--single {
        height: 30px !important;
        font-size: 0.75rem !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 30px !important;
        font-size: 0.75rem !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 28px !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow b {
        margin-top: -2px !important;
    }
    .select2-dropdown.select2-mobile-dropdown {
        max-width: calc(100vw - 20px) !important;
        min-width: 200px !important;
        width: auto !important;
        left: 10px !important;
        right: 10px !important;
        margin: 0 auto !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
        position: fixed !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    .select2-dropdown.select2-mobile-dropdown .select2-results {
        max-height: 180px !important;
    }
    .select2-dropdown.select2-mobile-dropdown .select2-search__field {
        font-size: 0.8rem !important;
        padding: 6px 10px !important;
    }
    .select2-dropdown.select2-mobile-dropdown .select2-results__option {
        font-size: 0.8rem !important;
        padding: 6px 10px !important;
    }
}

@media (max-width: 480px) {
    .select2-container--default .select2-selection--single {
        height: 26px !important;
        font-size: 0.65rem !important;
        min-height: 26px !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 26px !important;
        font-size: 0.65rem !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 24px !important;
    }
    .select2-dropdown.select2-mobile-dropdown {
        min-width: 150px !important;
        max-width: calc(100vw - 16px) !important;
        left: 8px !important;
        right: 8px !important;
    }
    .select2-dropdown.select2-mobile-dropdown .select2-results__option {
        font-size: 0.7rem !important;
        padding: 4px 8px !important;
    }
    .select2-dropdown.select2-mobile-dropdown .select2-search__field {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
    }
}

/* =============================================
   ریسپانسیو (Media Queries)
   ============================================= */

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
    .charts-grid .chart-card:last-child {
        grid-column: span 2;
        height: 340px;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .charts-grid .chart-card:last-child {
        grid-column: span 1;
        height: 300px;
    }
    .chart-card {
        height: 260px !important;
    }
    .chart-card:nth-child(3) {
        height: 300px !important;
    }
    .floor-label-center {
        flex: 0 0 40px;
        font-size: 0.7rem;
    }
    .heatmap-header .header-col {
        font-size: 0.8rem;
        min-height: 28px;
    }
    .tower-cell {
        min-height: 36px;
    }
    .tower-cell span {
        font-size: 0.7rem;
    }
    .form-container {
        padding: 12px;
    }
    .excel-table,
    .activity-table {
        font-size: 0.8rem;
    }
    .excel-table th,
    .excel-table td,
    .activity-table th,
    .activity-table td {
        padding: 4px 6px;
        white-space: nowrap;
    }
    .excel-table .form-control {
        font-size: 0.8rem;
        min-width: 40px;
    }
    .btn-add-row {
        font-size: 0.85rem;
        padding: 6px 14px;
    }
    .filter-item {
        flex: 1 1 calc(50% - 6px);
        min-width: 80px;
    }
    .filter-item label {
        font-size: 0.65rem !important;
    }
    .filter-item .form-control {
        font-size: 0.7rem !important;
        padding: 4px 6px !important;
        min-height: 28px;
    }
    .btn-filter,
    .btn-reset-filter {
        font-size: 0.65rem !important;
        padding: 4px 10px !important;
        min-height: 28px;
    }
    .filter-info {
        font-size: 0.6rem !important;
        min-width: 60px;
    }
    #activity-panel ul.main-list {
        grid-template-columns: 1fr;
    }
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -8px;
        padding: 0 8px;
    }
    .excel-table,
    .activity-table,
    .reports-table {
        min-width: 600px;
    }
}

/* ===== موبایل (حداکثر 480px) ===== */
@media (max-width: 480px) {
    /* ---- کارت‌های KPI در یک ردیف ---- */
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }
    .kpi-card {
        padding: 8px 4px !important;
        border-left-width: 2px !important;
        border-radius: 8px !important;
    }
    .kpi-card p {
        font-size: 0.5rem !important;
        margin-bottom: 2px !important;
    }
    .kpi-card h2 {
        font-size: 0.9rem !important;
        margin: 2px 0 !important;
    }
    .kpi-card .subtext {
        font-size: 0.45rem !important;
    }

    /* ---- نمودارها ---- */
    .charts-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .reset-btn {
        width: 100%;
    }
    .chart-card {
        height: 200px !important;
        padding: 8px 10px;
    }
    .chart-card:nth-child(3) {
        height: 220px !important;
    }
    .chart-card h4 {
        font-size: 0.8rem;
    }

    /* ---- نقشه حرارتی ---- */
    .heatmap-header .header-col {
        font-size: 0.65rem;
        min-height: 22px;
    }
    .floor-label-center {
        flex: 0 0 30px;
        font-size: 0.55rem;
    }
    .tower-cell {
        min-height: 24px;
    }
    .tower-cell span {
        font-size: 0.5rem;
    }
    .details-row {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    .details-row strong {
        font-size: 0.75rem;
    }
    .details-row ul {
        font-size: 0.7rem;
    }

    /* ---- اصلاح جدول کاربر عادی در موبایل ---- */
    .excel-table {
        width: 100% !important;
        table-layout: auto !important;
        font-size: 0.7rem !important;
        min-width: 0 !important;
    }
    .excel-table th,
    .excel-table td {
        padding: 4px 5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: center !important;
    }
    
    .excel-table th:nth-child(1),
    .excel-table td:nth-child(1) {
        width: 8% !important;
        min-width: 25px !important;
        max-width: 35px !important;
    }
    .excel-table th:nth-child(2),
    .excel-table td:nth-child(2) {
        width: 12% !important;
        min-width: 35px !important;
        max-width: 50px !important;
    }
    .excel-table th:nth-child(3),
    .excel-table td:nth-child(3) {
        width: 18% !important;
        min-width: 45px !important;
        max-width: 65px !important;
    }
    .excel-table th:nth-child(4),
    .excel-table td:nth-child(4) {
        width: 25% !important;
        min-width: 65px !important;
        max-width: 100px !important;
    }
    .excel-table th:nth-child(5),
    .excel-table td:nth-child(5) {
        width: 12% !important;
        min-width: 35px !important;
        max-width: 50px !important;
    }
    .excel-table th:nth-child(6),
    .excel-table td:nth-child(6) {
        width: 10% !important;
        min-width: 28px !important;
        max-width: 40px !important;
    }
    .excel-table th:nth-child(7),
    .excel-table td:nth-child(7) {
        width: 15% !important;
        min-width: 45px !important;
        max-width: 60px !important;
    }

    .excel-table .form-control {
        font-size: 0.65rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .excel-table select.form-control {
        font-size: 0.6rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
    }
    .excel-table input.form-control {
        font-size: 0.6rem !important;
        padding: 2px 4px !important;
        min-width: 20px !important;
        width: 100% !important;
    }

    .btn-edit,
    .btn-delete,
    .btn-save,
    .btn-cancel {
        font-size: 0.75rem !important;
        padding: 2px 4px !important;
        margin: 0 1px !important;
    }

    .activity-table {
        font-size: 0.7rem;
    }
    .activity-table th,
    .activity-table td {
        padding: 2px 4px;
    }
    .quick-actions {
        flex-direction: column;
    }
    .quick-actions .btn-download-excel,
    .quick-actions .btn-view-reports {
        width: 100%;
        text-align: center;
        padding: 8px;
    }
    .filter-item {
        flex: 1 1 100%;
        min-width: 60px;
    }
    .filter-actions {
        flex: 1 1 100%;
        justify-content: center;
        margin-top: 4px;
    }
    .filter-info {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 4px;
    }
    .user-date-item {
        flex: 1 1 100%;
    }
    .user-date-actions {
        flex: 1 1 100%;
        justify-content: center;
    }
    .user-date-info {
        flex: 1 1 100%;
        text-align: center;
        margin-top: 4px;
    }
}

/* ===== موبایل‌های بسیار کوچک (حداکثر 400px) ===== */
@media (max-width: 400px) {
    .excel-table {
        font-size: 0.6rem !important;
    }
    .excel-table th,
    .excel-table td {
        padding: 3px 4px !important;
    }
    
    .excel-table th:nth-child(1),
    .excel-table td:nth-child(1) {
        width: 7% !important;
        min-width: 20px !important;
        max-width: 28px !important;
    }
    .excel-table th:nth-child(2),
    .excel-table td:nth-child(2) {
        width: 12% !important;
        min-width: 30px !important;
        max-width: 42px !important;
    }
    .excel-table th:nth-child(3),
    .excel-table td:nth-child(3) {
        width: 18% !important;
        min-width: 38px !important;
        max-width: 55px !important;
    }
    .excel-table th:nth-child(4),
    .excel-table td:nth-child(4) {
        width: 24% !important;
        min-width: 55px !important;
        max-width: 80px !important;
    }
    .excel-table th:nth-child(5),
    .excel-table td:nth-child(5) {
        width: 11% !important;
        min-width: 30px !important;
        max-width: 40px !important;
    }
    .excel-table th:nth-child(6),
    .excel-table td:nth-child(6) {
        width: 9% !important;
        min-width: 22px !important;
        max-width: 32px !important;
    }
    .excel-table th:nth-child(7),
    .excel-table td:nth-child(7) {
        width: 15% !important;
        min-width: 40px !important;
        max-width: 55px !important;
    }
    
    .excel-table .form-control {
        font-size: 0.55rem !important;
        padding: 1px 3px !important;
        min-width: 15px !important;
    }
    .excel-table select.form-control {
        font-size: 0.5rem !important;
    }
    .excel-table input.form-control {
        font-size: 0.5rem !important;
    }
    
    .btn-edit,
    .btn-delete,
    .btn-save,
    .btn-cancel {
        font-size: 0.65rem !important;
        padding: 1px 3px !important;
    }
}

/* ===== جلوگیری از اسکرول افقی در موبایل ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .excel-table {
        min-width: 100% !important;
    }
    .select2-container {
        max-width: 100% !important;
    }
}

/* ===== دکمه ذخیره همه ===== */
.btn-save-all {
    background: #10b981;
    color: #fff;
    padding: 8px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-save-all:hover {
    background: #059669;
    transform: translateY(-2px);
}
.btn-save-all:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== هایلایت خطای ردیف ===== */
.activity-row.error-row {
    border: 2px solid #ef4444 !important;
    border-radius: 4px;
    background-color: rgba(239, 68, 68, 0.05);
}

/* ===== استایل پیام‌های چت با مارک‌داون ===== */
#chatMessages div strong {
    color: #f59e0b;
    font-weight: 700;
}
#chatMessages div em {
    color: #60a5fa;
    font-style: italic;
}
#chatMessages div br {
    display: block;
    content: "";
    margin: 4px 0;
}
#chatMessages div ul,
#chatMessages div ol {
    margin: 4px 0 4px 20px;
    padding: 0;
}
#chatMessages div li {
    margin: 2px 0;
    list-style-type: disc;
}