/* E-SMM sayfaları — rapor, gönder, oluştur (mobil / tablet) */
html body .emm-shell .kmt-esmm-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .card,
html body .emm-shell .kmt-esmm-page .card-body {
    max-width: 100%;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .esmm-create-form {
    max-width: 100%;
    box-sizing: border-box;
}

/* Düzenlenmeyen kaynak seçimi */
html body .emm-shell .kmt-esmm-page .esmm-duzenlenmeyen-kaynak {
    width: auto;
    min-width: min(22rem, 100%);
    max-width: 100%;
    border-color: #ffc107;
    background-color: #ffc107;
    color: #212529;
    font-weight: 500;
}

/* Araç çubuğu — arama / sayfa boyutu */
html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-toolbar {
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .kmt-esmm-belge-durum-filter,
html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-search {
    width: min(16rem, 100%);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page #datatable-container,
html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_wrapper,
html body .emm-shell .kmt-esmm-page #datatable-container .dt-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
}

html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* ESMM oluştur — Düzenlenenler: sütunlar sığmazsa tablo altında yatay scroll (tüm ekranlar) */
html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host > table.esmm-create-table,
html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host #fixed-columns-datatable.esmm-create-table {
    width: max-content !important;
    min-width: 100%;
    max-width: none !important;
    table-layout: auto !important;
    margin: 0 !important;
}

@media (min-width: 992px) {
    html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host.kmt-dt-table-scroll {
        overflow-x: auto !important;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host > table.esmm-create-table,
    html body .emm-shell .kmt-esmm-page #datatable-container.esmm-create-table-host #fixed-columns-datatable.esmm-create-table {
        min-width: 1280px;
    }
}

html body .emm-shell .kmt-esmm-page .esmm-create-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-action-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.55rem 0.7rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .esmm-action-group__label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.2;
}

html body .emm-shell .kmt-esmm-page .esmm-action-group__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-action-group__row > .btn {
    flex: 0 1 auto;
    white-space: nowrap;
}

html body .emm-shell .kmt-esmm-page .esmm-action-group--liste .esmm-duzenlenmeyen-kaynak {
    flex: 0 1 auto;
    width: auto;
    min-width: min(20rem, 100%);
    max-width: min(26rem, 100%);
}

html body .emm-shell .kmt-esmm-page .esmm-seri-sync-row {
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-seri-select {
    flex: 1 1 8rem;
    min-width: min(10rem, 100%);
    max-width: 12rem;
}

html body .emm-shell .kmt-esmm-page .esmm-integrator-sync-btn {
    flex: 0 1 auto;
    white-space: nowrap;
}

html body .emm-shell .kmt-esmm-page .esmm-liste-export-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.65rem;
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-liste-export-row .esmm-action-group--liste {
    flex: 1 1 auto;
    min-width: min(100%, 18rem);
}

html body .emm-shell .kmt-esmm-page .esmm-excel-export-panel {
    flex: 0 1 auto;
    border: 1px solid #c5d3e8;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    min-width: min(280px, 100%);
    max-width: 100%;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .esmm-excel-export-panel-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

html body .emm-shell .kmt-esmm-page .esmm-excel-export-entegrator {
    flex: 1 1 10rem;
    min-width: min(10rem, 100%);
}

html body .emm-shell .kmt-esmm-page .esmm-excel-export-entegrator .form-label {
    font-size: 0.82rem;
    color: #475569;
}

html body .emm-shell .kmt-esmm-page .esmm-excel-export-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    align-self: flex-end;
}

html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-controls-grid {
    display: grid;
    grid-template-columns: max-content minmax(16rem, max-content);
    grid-template-rows: auto auto;
    column-gap: 0.65rem;
    row-gap: 0.5rem;
    justify-content: start;
    align-items: stretch;
    width: max-content;
    max-width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-toolbar-primary {
    grid-column: 1;
    grid-row: 1;
    width: max-content;
    max-width: 100%;
    margin-bottom: 0 !important;
}

html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-makbuz-note-groupbox {
    grid-column: 1;
    grid-row: 2;
    /* Sütun genişliğini üst satır (butonlar + E-Posta) belirlesin */
    width: 0;
    min-width: 100%;
    max-width: 100%;
    overflow: hidden;
    align-self: stretch;
    height: 100%;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-excel-export-panel {
    grid-column: 2;
    grid-row: 2;
    align-self: stretch;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: min(16rem, 100%);
    max-width: 100%;
    box-sizing: border-box;
}

html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary .esmm-mail-groupbox {
    flex: 0 1 auto;
    align-self: center;
    max-width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-grid-subtitle {
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-grid-subtitle .alert {
    max-width: min(100%, 52rem);
}

html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.65rem;
    flex: 1 1 auto;
    min-width: min(100%, 18rem);
    width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row .esmm-makbuz-note-groupbox {
    flex: 1 1 14rem;
    min-width: min(14rem, 100%);
    max-width: 100%;
}

html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row .esmm-excel-export-panel {
    flex: 0 0 auto;
    align-self: stretch;
}

html body .emm-shell .kmt-esmm-page .esmm-create-actions .btn {
    white-space: nowrap;
    text-align: center;
}

@media (max-width: 991.98px) {
    html body .emm-shell .kmt-esmm-page .card-body {
        padding: 0.75rem !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-create-form {
        padding: 0.65rem;
    }

    html body .emm-shell .kmt-esmm-page .esmm-create-form [class*="col-md-"],
    html body .emm-shell .kmt-esmm-page .emm-filter-panel [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .emm-filter-panel .custom-btn,
    html body .emm-shell .kmt-esmm-page .emm-filter-panel .btn {
        width: 100%;
        justify-content: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions,
    html body .emm-shell .kmt-esmm-page .esmm-create-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .esmm-action-group__row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-action-group__row > .btn,
    html body .emm-shell .kmt-esmm-page .esmm-action-group__row > .esmm-duzenlenmeyen-kaynak,
    html body .emm-shell .kmt-esmm-page .esmm-action-group__row > select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        white-space: normal;
        justify-content: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-controls-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-toolbar-primary,
    html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-makbuz-note-groupbox,
    html body .emm-shell .kmt-esmm-page .esmm-controls-grid > .esmm-excel-export-panel {
        grid-column: auto !important;
        grid-row: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary .esmm-mail-groupbox {
        width: 100% !important;
        max-width: 100% !important;
        align-self: stretch !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-grid-subtitle .alert {
        display: block !important;
        width: 100%;
        max-width: 100%;
        text-align: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row {
        flex-direction: column;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row .esmm-makbuz-note-groupbox,
    html body .emm-shell .kmt-esmm-page .esmm-makbuz-export-row .esmm-excel-export-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        align-self: stretch !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions > .btn,
    html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary > .btn,
    html body .emm-shell .kmt-esmm-page .esmm-create-actions > .btn {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 2.25rem;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        white-space: normal;
        text-align: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions > fieldset,
    html body .emm-shell .kmt-esmm-page .esmm-toolbar-primary > fieldset,
    html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions > .esmm-makbuz-export-row,
    html body .emm-shell .kmt-esmm-page .esmm-create-actions > .esmm-duzenlenmeyen-kaynak,
    html body .emm-shell .kmt-esmm-page .esmm-create-actions > select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-mail-groupbox,
    html body .emm-shell .kmt-esmm-page .esmm-makbuz-note-groupbox {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-mail-groupbox-body {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .esmm-mail-groupbox-body .btn {
        width: 100% !important;
        justify-content: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-mail-switch {
        width: 100%;
        justify-content: flex-start;
    }

    html body .emm-shell .kmt-esmm-page .esmm-makbuz-note-checks {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    html body .emm-shell .kmt-esmm-page .esmm-makbuz-note-checks .form-check-label {
        white-space: normal;
    }

    html body .emm-shell .kmt-esmm-page .esmm-liste-export-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-liste-export-row .esmm-action-group--liste,
    html body .emm-shell .kmt-esmm-page .esmm-liste-export-row .esmm-excel-export-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-excel-export-panel-fields {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .esmm-excel-export-entegrator {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1 1 100%;
    }

    html body .emm-shell .kmt-esmm-page .esmm-excel-export-btn {
        width: 100% !important;
        align-self: stretch !important;
        justify-content: center;
    }

    html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-seri-sync-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-seri-select,
    html body .emm-shell .kmt-esmm-page .esmm-integrator-sync-btn {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center;
    }

    html body .emm-shell .kmt-esmm-page .esmm-kaynak-badge-slot {
        width: 100%;
        justify-content: flex-start !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page .esmm-kaynak-badge {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        justify-content: center;
        text-align: center;
    }

    html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-toolbar > .d-flex.flex-wrap {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        margin-left: 0 !important;
        gap: 0.5rem;
    }

    html body .emm-shell .kmt-esmm-page .kmt-page-size-panel {
        width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .kmt-esmm-belge-durum-filter,
    html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-search {
        width: 100% !important;
        min-width: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page .kmt-esmm-grid-toolbar .d-flex.flex-column {
        align-items: stretch !important;
        width: 100%;
    }

    html body .emm-shell .kmt-esmm-page .card-body > .btn:not(.btn-close):not(.page-link):not(.sort-header-btn),
    html body .emm-shell .kmt-esmm-page .esmm-create-form .btn:not(.btn-close),
    html body .emm-shell .kmt-esmm-page .emm-filter-panel .btn {
        min-width: 0 !important;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-lf-row,
    html body .emm-shell .kmt-esmm-page #datatable-container .dt-container > .d-flex.justify-content-between,
    html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_wrapper > .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container .dt-length,
    html body .emm-shell .kmt-esmm-page #datatable-container .dt-search,
    html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_length,
    html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_filter {
        width: 100% !important;
        margin-right: 0 !important;
        float: none !important;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_filter label,
    html body .emm-shell .kmt-esmm-page #datatable-container .dt-search label {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container .dataTables_filter input,
    html body .emm-shell .kmt-esmm-page #datatable-container .dt-search input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        box-sizing: border-box;
    }

    html body .emm-shell .kmt-esmm-page .esmm-row-actions .btn {
        min-width: 0 !important;
        width: auto !important;
    }
}

@media (max-width: 575.98px) {
    html body .emm-shell .kmt-esmm-page .card-body {
        padding: 0.65rem !important;
    }

    html body .emm-shell .kmt-esmm-page h5 {
        font-size: 1rem;
    }

    html body .emm-shell .kmt-esmm-page .esmm-create-actions .btn,
    html body .emm-shell .kmt-esmm-page .esmm-toolbar-actions > .btn {
        font-size: 0.8125rem;
        padding: 0.45rem 0.65rem;
    }

    html body .emm-shell .kmt-esmm-page #datatable-container table.esmm-create-table thead th,
    html body .emm-shell .kmt-esmm-page #datatable-container table.esmm-create-table tbody td {
        font-size: 11px !important;
        padding: 0.35rem 0.4rem !important;
    }
}

/* emm-overrides 960px — rapor tablosu yatay scroll */
@media (max-width: 991.98px) {
    html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-table-scroll table.esmm-create-table,
    html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-table-scroll table.kmt-esmm-report-dt,
    html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-table-scroll #fixed-columns-datatable.esmm-create-table,
    html body .emm-shell .kmt-esmm-page #datatable-container .kmt-dt-table-scroll #fixed-columns-datatable.kmt-esmm-report-dt {
        min-width: 720px;
        width: max-content !important;
    }
}
