/*
 * Responsive fixes (stap 1: geen weergavefouten op kleinere schermen).
 * Wordt als laatste stylesheet geladen, dus overschrijft main.css en de affiliate-css.
 */

img, video, canvas, iframe, select, textarea {
    max-width: 100%;
}

/* main.css verbergt de menutitels (span) onder 1220px, terwijl er voor de hoofditems geen icoon is: menu bleef leeg */
@media screen and (max-width: 1220px) {
    /* De gebruikersinfo (float) zat niet in de header: Klant-keuze overlapte het menu */
    .header {
        display: flow-root;
        height: auto;
        min-height: 34px;
    }

    .menu ul li a span {
        display: inline;
        font-size: 0.7em;
    }
    .menu ul li a {
        padding: 10px 12px 10px 5px;
    }
}

@media screen and (max-width: 480px) {
    .menu ul li a {
        padding: 10px 8px 10px 3px;
    }
}

/* ---------- Tablet en kleiner ---------- */
@media screen and (max-width: 1100px) {
    .wrapper {
        width: 100%;
        max-width: 100%;
    }

    .content {
        padding-left: 10px;
        padding-right: 10px;
        min-height: 0;
    }

    /* Twee kolommen onder elkaar */
    .content_left,
    .content_right {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    .content_full {
        width: 100%;
    }

    .uitzendinggegevens,
    #muteer_form table {
        max-width: 100%;
    }
}

/* ---------- Telefoon en kleine tablet ---------- */
@media screen and (max-width: 760px) {
    /* Header: logo verbergen (zie main.css), gebruikersblok over de volle breedte */
    .header {
        display: block;
        height: auto;
        overflow: hidden;
    }

    .header .header_title {
        float: none;
        margin-left: 10px;
    }

    .gebruiker {
        float: none;
        width: auto;
        max-width: 100%;
        margin: 5px 10px;
        text-align: left;
        box-sizing: border-box;
    }

    .gebruiker select,
    .gebruiker .klients-list {
        max-width: 60%;
    }

    /* Menu: items mogen op meerdere regels */
    .menu {
        height: auto;
        overflow: visible;
        line-height: 1.4;
        box-sizing: border-box;
    }

    .menu::after,
    .menu > ul::after {
        content: "";
        display: block;
        clear: both;
    }

    .menu ul {
        margin-left: 5px;
        margin-right: 5px;
    }

    #headericons {
        margin: 0.4em 10px;
    }

    .filter,
    #div-filter {
        float: none !important;
        max-width: 100%;
    }

    .pagination {
        float: none;
        max-width: 100%;
        overflow-x: auto;
    }

    h1 {
        font-size: 22px;
        line-height: 30px;
        overflow-wrap: anywhere;
    }
}

/* ---------- Dashboard (legenda) ---------- */
@media screen and (max-width: 1100px) {
    .dashboard_wrapper {
        flex-direction: column;
        height: auto;
    }

    .dashboard_left_wrapper,
    .dashboard_right_wrapper {
        width: 100%;
        height: auto;
        margin-left: 0;
        box-sizing: border-box;
    }

    .dashboard_right_wrapper {
        margin-top: 20px;
    }

    .dashboard_right_wrapper .panel_header {
        width: 100%;
    }

    .dashboard_right_wrapper .panel_body {
        height: auto;
        min-height: 400px;
        max-height: 700px;
        overflow-y: auto;
        padding-bottom: 15px;
    }

    .dashboard_left_wrapper {
        padding-bottom: 15px;
    }

    #panel_header_clock {
        margin-top: 10px;
    }
}

@media screen and (max-width: 760px) {
    .dashboard_left_wrapper .panel_header,
    .dashboard_left_wrapper .panel_body {
        flex-direction: column;
    }

    .dashboard_left_wrapper .panel_header .panel_left,
    .dashboard_left_wrapper .panel_header .panel_right,
    .dashboard_left_wrapper .panel_body .panel_left,
    .dashboard_left_wrapper .panel_body .panel_right {
        width: auto;
        margin-left: 15px;
        margin-right: 15px;
    }

    .dashboard_left_wrapper .panel_header .panel_left,
    .dashboard_left_wrapper .panel_header .panel_left.text_size_1 {
        font-size: 28px;
        margin-top: 15px;
        overflow-wrap: anywhere;
    }

    .dashboard_left_wrapper .panel_header .panel_right img {
        max-width: 150px;
        margin-bottom: 10px;
    }

    .panel_left .dashboard_block {
        margin-right: 0;
    }

    .dashboard_block_header {
        font-size: 18px;
    }

    .dashboard_block_table_row {
        height: auto;
        min-height: 32px;
        flex-wrap: wrap;
    }

    .dashboard_block_table_row .dashboard_block_table_label,
    .dashboard_block_table_row .dashboard_block_table_value,
    .dashboard_block_table_row .dashboard_block_table_label_secondary,
    .dashboard_block_table_row .dashboard_block_table_value_secondary {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .dashboard_block_table_row .dashboard_block_table_label {
        width: 45%;
        font-size: 14px;
        overflow-wrap: normal;
    }

    .dashboard_block_table_row .dashboard_block_table_value {
        width: 55%;
    }

    .dashboard_block.weather_panels_wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dashboard_weather_item {
        width: calc(50% - 4px);
        min-height: 150px;
    }

    /* Titel links, zoekicoon rechts op dezelfde regel (niet allebei op 100%, anders valt het icoon onder de titel) */
    .dashboard_block_header {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .dashboard_block_header_title {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
    }

    .dashboard_block_header_search {
        flex: 0 0 auto;
        width: auto;
        text-align: right;
        white-space: nowrap;
    }

    /* Paginatitels: 42px (main.css) is te groot voor een telefoon */
    .content > h1,
    .content > div[class*="_details"] > h1,
    .content > div[class*="_details"] > form > h1,
    .content > form > h1 {
        font-size: 28px;
        line-height: 34px;
    }

    #headerTable {
        font-size: 18px;
    }

    .text_input,
    #input-filter {
        min-width: 0;
        max-width: calc(100% - 45px);
    }
}

/* ---------- Formulieren (bewerkpagina's) ---------- */
@media screen and (max-width: 760px) {
    /* Label boven het veld in plaats van ernaast */
    #muteer_form,
    form.uitzendinggegevens,
    .content form {
        max-width: 100%;
    }

    table.uitzendinggegevens,
    table.uitzendinggegevens > tbody,
    table.uitzendinggegevens > tbody > tr,
    table.uitzendinggegevens > tbody > tr > td,
    table.uitzendinggegevens > tbody > tr > th {
        display: block;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    table.uitzendinggegevens > tbody > tr {
        margin-bottom: 8px;
    }

    table.uitzendinggegevens input[type=text],
    table.uitzendinggegevens input[type=password],
    table.uitzendinggegevens input[type=email],
    table.uitzendinggegevens input[type=search],
    table.uitzendinggegevens input[type=number],
    table.uitzendinggegevens input[type=date],
    table.uitzendinggegevens select,
    table.uitzendinggegevens textarea,
    table.uitzendinggegevens .text_input,
    table.uitzendinggegevens .text_input_short,
    table.uitzendinggegevens .text_input_medium {
        max-width: 100%;
        box-sizing: border-box;
    }

    table.uitzendinggegevens .select2-container {
        max-width: 100%;
    }
}

/* ---------- Tooltips en vangnet tegen horizontaal scrollen ---------- */
.tooltip .tooltiptext {
    width: max-content;
    max-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
}

@media screen and (max-width: 1100px) {
    .wrapper {
        overflow-x: clip;
    }

    table.uitzendinggegevens .select2-container {
        width: 100% !important;
    }
}

@media screen and (max-width: 760px) {
    /* Tabellen zonder eigen klasse in een bewerkformulier (gebruikers, uitzendingen) */
    #muteer_form > table,
    #muteer_form > table > tbody,
    #muteer_form > table > tbody > tr,
    #muteer_form > table > tbody > tr > td,
    #muteer_form > table > tbody > tr > th {
        display: block;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    #muteer_form input[type=text],
    #muteer_form input[type=password],
    #muteer_form input[type=email],
    #muteer_form select,
    #muteer_form textarea,
    #muteer_form .text_input,
    #muteer_form .tox,
    .tox.tox-tinymce {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Multiselect (jquery.multiselect) mag niet breder worden dan het scherm */
@media screen and (max-width: 760px) {
    .ms-options-wrap,
    .ms-options-wrap > .ms-options,
    .extraclant .ms-options-wrap {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Vaste breedtes in de views (inline style / width-attribuut) mogen het paneel niet uitrekken */
@media screen and (max-width: 760px) {
    .content div[style*="width"],
    .content td[style*="width"],
    .content span[style*="width"],
    .content hr,
    .content input[type=file],
    .content input.button,
    .content .tox,
    .content .tox-tinymce {
        max-width: 100%;
        box-sizing: border-box;
    }

    .content img[width] {
        max-width: 100%;
        height: auto;
    }

    .content .tox .tox-toolbar,
    .content .tox .tox-toolbar__primary {
        flex-wrap: wrap;
    }
}

/* ---------- Systeem > player: schakelschema (scherm aan/uit) ---------- */
@media screen and (max-width: 1100px) {
    ul.tabmenu {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    li.tab {
        width: auto;
        min-width: 30%;
        height: auto;
        min-height: 1.5em;
        box-sizing: border-box;
        margin-right: 8px;
    }

    #tijdschema {
        max-width: 100%;
    }

    #tijdschema .tijdinput,
    #tijdschema input.timepick,
    #tijdschema .text_input {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .agendavolgen td {
        padding-left: 0;
    }

    .handmatig div.mh,
    .schemavolgen div.mh,
    .agendavolgen div.mh {
        min-height: 0;
        max-width: 100%;
    }

    .agendavolgen select {
        max-width: 100%;
    }
}

@media screen and (max-width: 760px) {
    li.tab {
        display: block;
        margin-bottom: 4px;
    }

    #tijdschema td {
        padding-right: 4px;
    }
}

@media screen and (max-width: 760px) {
    #tijdschema {
        table-layout: fixed;
        width: 100%;
    }

    #tijdschema tr td:first-child {
        width: 28%;
        overflow-wrap: anywhere;
    }
}

@media screen and (max-width: 760px) {
    /* Agenda-instellingen (scherm aan/uit volgens agenda): label boven het veld */
    .mh > table:not(#tijdschema),
    .mh > table:not(#tijdschema) > tbody,
    .mh > table:not(#tijdschema) > tbody > tr,
    .mh > table:not(#tijdschema) > tbody > tr > td {
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .mh select {
        max-width: 100%;
    }
}

/* ---------- Inlogschermen (gebruikers/inloggen, gebruikers/tancode) ---------- */
@media screen and (max-width: 520px) {
    .login {
        width: auto;
        max-width: 100%;
        padding: 0 15px 30px 15px;
        box-sizing: border-box;
    }

    .login table {
        width: 100%;
        margin-top: 40px !important;
    }

    .login img {
        float: none !important;
        width: auto !important;
        max-width: 100%;
        top: 0 !important;
    }

    .login td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left;
    }

    .login input[type=text],
    .login input[type=password],
    .login input[type=email] {
        width: 100%;
        box-sizing: border-box;
    }

    .login input[type=submit] {
        box-sizing: border-box;
        max-width: 100%;
    }

    .login form {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Scrollcontainer rond lijsten (wordt door een script in default.php aangemaakt) */
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Filter + zoekknop van de agenda en andere lijsten: mogen op een smal scherm afbreken */
@media screen and (max-width: 760px) {
    #div-filter {
        clear: both;
        width: 100%;
        max-width: 100%;
    }

    #div-filter > .d-flex {
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 4px;
    }

    #div-filter #locatie,
    #div-filter .ms-options-wrap {
        width: 100% !important;
        max-width: 100%;
    }

    #div-filter #input-filter {
        flex: 1 1 120px;
        min-width: 0;
        max-width: calc(100% - 40px);
    }
}

@media screen and (max-width: 760px) {
    .content input[type=text],
    .content input[type=search],
    .content input[type=email],
    .content input[type=password],
    .content input[type=number],
    .content select,
    .content textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    .ms-options-wrap > button,
    .ms-options-wrap > .ms-options {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ---------- Lijsten ---------- */
/* Naast zwevende filters/paginatie mag de scrollcontainer niet tot 0 breedte krimpen */
.table-scroll {
    clear: both;
}

/* Tussenformaat: tweede- en derderangs kolommen verbergen zodat de lijst past zonder te scrollen */
@media screen and (min-width: 1051px) and (max-width: 1500px) {
    .systeem_index #grid_table th:nth-child(4),
    .systeem_index #grid_table td:nth-child(4),
    .slides_index #grid_table_new th:nth-child(4),
    .slides_index #grid_table_new td:nth-child(4),
    .uitzendingen_index #grid_table th:nth-child(4),
    .uitzendingen_index #grid_table td:nth-child(4) {
        display: none;
    }
}

@media screen and (min-width: 1051px) and (max-width: 1250px) {
    .systeem_index #grid_table th:nth-child(6),
    .systeem_index #grid_table td:nth-child(6),
    .slides_index #grid_table_new th:nth-child(5),
    .slides_index #grid_table_new td:nth-child(5),
    .uitzendingen_index #grid_table th:nth-child(5),
    .uitzendingen_index #grid_table td:nth-child(5) {
        display: none;
    }
}

/* Smal scherm: elke rij wordt een kaartje, geen horizontaal scrollen */
@media screen and (max-width: 1050px) {
    .table-scroll {
        overflow-x: visible;
    }

    .table-scroll > table,
    .table-scroll > table > thead,
    .table-scroll > table > tbody,
    .table-scroll > table > tbody > tr,
    .table-scroll > table > tbody > tr > td {
        display: block;
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    .table-scroll > table > thead {
        display: none;
    }

    .table-scroll > table > tbody > tr {
        padding: 6px 4px;
    }

    /* Verborgen kolommen van het tussenformaat weer tonen in het kaartje */
    .table-scroll > table > tbody > tr > td:nth-child(n) {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        min-width: 0 !important;
        padding: 3px 0;
        text-align: left !important;
        overflow-wrap: anywhere;
    }

    .table-scroll > table > tbody > tr > td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        flex: 0 0 38%;
        max-width: 38%;
        color: #ff9000;
        font-size: 12px;
        font-weight: bold;
        text-transform: uppercase;
    }

    /* Lege cellen (alleen witruimte) niet tonen */
    .table-scroll > table > tbody > tr > td:empty {
        display: none;
    }

    .table-scroll img {
        max-width: 100%;
        height: auto;
    }
}

/* Systeem: veel kolommen, dus ook op brede schermen de aanpas-datum en op smallere ook het serienummer verbergen */
@media screen and (min-width: 1501px) and (max-width: 1999px) {
    .systeem_index #grid_table th:nth-child(4),
    .systeem_index #grid_table td:nth-child(4) {
        display: none;
    }
}

@media screen and (min-width: 1051px) and (max-width: 1250px) {
    .systeem_index #grid_table th:nth-child(2),
    .systeem_index #grid_table td:nth-child(2) {
        display: none;
    }
}

/* Kaartjesweergave: koprijen die als <th> in de tbody staan (lijsten zonder thead) ook verbergen */
@media screen and (max-width: 1050px) {
    .table-scroll > table th {
        display: none;
    }

    .table-scroll > table tr:not(:has(td)) {
        display: none;
    }
}

/* ---------- Pop-ups (help, monitor, e-mail/wachtwoord wijzigen, nieuws zoeken, verwijderen) ---------- */
@media screen and (max-width: 1100px) {
    .help_popup,
    .monitor_popup {
        flex-direction: column;
        height: auto;
        padding: 20px 15px;
        margin-left: 0;
        width: 100%;
        max-height: none;
    }

    .monitor_popup {
        height: auto;
    }

    .help_popup_left,
    .help_popup_right {
        width: 100%;
    }

    .help_faq_column,
    .help_faq_column_right {
        width: 100%;
    }

    .help_popup_left {
        flex-wrap: wrap;
    }

    .change_email_popup,
    .search_news_popup,
    .change_password_popup {
        left: 5%;
        top: 120px;
        width: 90%;
        height: auto;
        min-height: 200px;
        margin-left: 0;
        z-index: 10000;
    }

    .new_email_button,
    .search_news_popup_button,
    .new_password_popup_button {
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 760px) {
    .popup_content {
        width: 92%;
        max-width: 550px;
        box-sizing: border-box;
    }

    .popup_content button {
        width: calc(100% - 20px);
        max-width: 400px;
    }

    #group_delete_popup {
        overflow-y: auto;
    }

    .faq_question_item {
        font-size: 16px;
    }

    .popup_contact_form input[type="text"],
    .popup_contact_form input[type="email"],
    .popup_contact_form input[type="tel"] {
        height: 44px;
        font-size: 16px;
    }

    .popup_contact_form table,
    .popup_contact_form tbody,
    .popup_contact_form tr,
    .popup_contact_form td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .popup_contact_form textarea {
        font-size: 16px;
    }
}

/* De pop-ups starten binnen de padding van .content: iets smaller zodat ze niet over de rand steken */
@media screen and (max-width: 1100px) {
    .help_popup,
    .monitor_popup {
        width: calc(100% - 20px);
        box-sizing: border-box;
    }
}

/* ---------- Fancybox (voorvertoning, mediatheek) ---------- */
@media screen and (max-width: 760px) {
    #fancybox-wrap {
        max-width: 100vw;
        left: 0 !important;
        box-sizing: border-box;
    }

    #fancybox-outer,
    #fancybox-content {
        max-width: 100%;
        box-sizing: border-box;
    }

    #fancybox-content {
        width: auto !important;
    }

    #fancybox-content iframe {
        width: 100% !important;
        max-width: 100%;
    }
}

/* ---------- Kleurkiezers in de slide-editor ---------- */
@media screen and (max-width: 1100px) {
    /* Het icoon naast de kleurkiezer is met inline left/bottom verschoven en rekt het veld op */
    .content td div[style*="left: 30px"] {
        left: 0 !important;
        bottom: 0 !important;
        max-width: 100%;
    }

    /* De jquery.colorPicker plaatst het palet absoluut op basis van de desktopbreedte */
    td.input > div[style*="position: absolute"]:has(> .colorPicker-picker) {
        position: static !important;
        display: inline-block;
    }
}

/* Kaartje: de uitzending-keuzelijst (custom-dropdown) staat naast het label, niet eronder */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr > td:has(> .custom-dropdown) {
        flex-wrap: nowrap;
    }

    .table-scroll .custom-dropdown {
        flex: 1 1 0;
        width: auto !important;
        min-width: 0;
    }

    .table-scroll .custom-dropdown select {
        min-width: 0;
        max-width: 100%;
    }
}

/* Kaartje: tekst, select of enkel icoon naast het label laten staan (alleen rijen met meerdere iconen mogen afbreken) */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr > td[data-label]:not([data-label=""]):not(:has(> :nth-child(2))) {
        flex-wrap: nowrap;
    }
}

@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr > td:has(> a.list_link) {
        flex-wrap: nowrap;
    }

    .table-scroll > table > tbody > tr > td > a.list_link {
        min-width: 0;
        flex: 1 1 0;
    }
}

/* ---------- Uitzending bewerken: kolommen "Beschikbare slides" / "Slides in deze uitzending" ---------- */
/* Onder elkaar, maar elke kolom met haar eigen kop en zoekveld erboven (de kop staat in een aparte tabelrij) */
@media screen and (max-width: 760px) {
    #muteer_form > table:has(#kolomlinks) > tbody {
        display: flex;
        flex-direction: column;
    }

    #muteer_form > table:has(#kolomlinks) > tbody > tr {
        display: contents;
    }

    #muteer_form > table:has(#kolomlinks) > tbody > tr > td,
    #muteer_form > table:has(#kolomlinks) > tbody > tr > th {
        order: 0;
        text-align: left !important;
    }

    #muteer_form > table:has(#kolomlinks) > tbody > tr > th:first-child { order: 1; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td:has(#input-filter-left) { order: 2; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td#kolomlinks { order: 3; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > th:last-child { order: 4; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td:has(#input-filter-right) { order: 5; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td#kolomrechts { order: 6; }
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td:has(.saveButton) { order: 7; }
}

/* Zoekvelden boven de slidekolommen: over de volle breedte, met de wis-knop ernaast */
@media screen and (max-width: 760px) {
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td:has(#input-filter-left),
    #muteer_form > table:has(#kolomlinks) > tbody > tr > td:has(#input-filter-right) {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    #muteer_form #input-filter-left,
    #muteer_form #input-filter-right {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: none;
    }

    #muteer_form .input-filter-left-clear,
    #muteer_form .input-filter-right-clear {
        flex: 0 0 28px;
        margin: 0;
    }
}

/* ---------- Header en menu op de telefoon: logo + gebruiker op één rij, menu + iconen op één rij ---------- */
@media screen and (max-width: 760px) {
    .wrapper {
        padding-top: 0;
    }

    .header {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 4px 10px;
        padding: 8px 10px;
        height: auto;
        box-sizing: border-box;
    }

    .header > a {
        flex: 0 0 auto;
    }

    .header .header_title {
        float: none;
        margin: 0;
        line-height: 0;
    }

    .header .header_title img {
        display: block !important;
        position: static !important;
        float: none !important;
        width: 120px !important;
        max-width: 100%;
        height: auto;
    }

    .gebruiker {
        flex: 1 1 140px;
        margin: 0;
        text-align: right;
        font-size: 12px;
        line-height: 16px;
        min-width: 0;
    }

    .gebruiker p {
        margin: 0;
    }

    /* Klantkeuze over de volle breedte onder de gebruikersinfo */
    .gebruiker .select2,
    .gebruiker .select2-container {
        display: block;
        width: 100% !important;
        max-width: 100%;
        margin-top: 4px;
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        height: auto;
        min-height: 0;
        padding: 0 5px;
        border-top-width: 5px;
        border-bottom-width: 5px;
        margin-bottom: 8px;
    }

    .menu > ul {
        display: flex;
        flex-wrap: wrap;
        flex: 1 1 auto;
        margin: 0;
        padding: 0;
    }

    .menu ul li {
        float: none;
    }

    .menu ul li a {
        line-height: 24px;
        padding: 10px 12px 10px 5px;
    }

    #headericons {
        float: none;
        flex: 0 0 auto;
        margin: 0;
        padding: 0;
        white-space: nowrap;
    }

    #headericons .headericon {
        padding: 4px;
    }

    #headericons .fa-lg {
        font-size: 1.4em;
    }

    .headericon.red {
        margin-right: 6px;
    }

    .headericon.help {
        display: inline-flex;
    }
}

@media screen and (max-width: 760px) {
    .gebruiker .select2,
    .gebruiker .select2-container {
        display: inline-block;
        width: calc(100% - 42px) !important;
        vertical-align: middle;
    }

    .menu ul li a {
        padding: 6px 10px 6px 4px;
    }

    .menu ul li a span {
        font-size: 11px;
        line-height: 20px;
    }

    #headericons {
        margin-left: auto;
    }
}

@media screen and (max-width: 760px) {
    .header {
        padding-bottom: 12px;
    }
}

/* ---------- Header op mobiel, herzien: raster met logo | gebruiker, daarna klantkeuze, daarna menu + iconen ---------- */
@media screen and (max-width: 760px) {
    .header {
        display: grid !important;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "logo info"
            "klant klant";
        align-items: center;
        gap: 6px 12px;
        padding: 10px 12px 12px;
    }

    .header > a {
        grid-area: logo;
    }

    /* .gebruiker zelf wordt niet getoond als blok: de twee onderdelen krijgen een eigen plek in het raster */
    .header .gebruiker {
        display: contents;
    }

    .header .gebruiker-info {
        grid-area: info;
        text-align: right;
        font-size: 13px;
        line-height: 18px;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .header .gebruiker-info p {
        margin: 0;
    }

    .header .klant-keuze {
        grid-area: klant;
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        font-size: 14px;
    }

    .header .klant-keuze label {
        flex: 0 0 auto;
    }

    .header .klant-keuze select,
    .header .klant-keuze .select2-container {
        flex: 1 1 auto;
        width: auto !important;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        display: block;
    }

    /* Menu: grotere, goed aanraakbare items; iconen rechts */
    .menu {
        padding: 0 8px;
        gap: 0 8px;
    }

    .menu > ul {
        gap: 0;
    }

    .menu ul li a {
        padding: 12px 14px 12px 6px;
        line-height: 24px;
    }

    .menu ul li a span {
        font-size: 15px;
        line-height: 24px;
        font-weight: 500;
    }

    #headericons .headericon {
        padding: 8px 6px;
    }

    #headericons .fa-lg {
        font-size: 1.6em;
    }
}

@media screen and (max-width: 400px) {
    .menu ul li a {
        padding: 10px 10px 10px 4px;
    }

    .menu ul li a span {
        font-size: 14px;
    }
}

@media screen and (max-width: 340px) {
    .menu ul li a {
        padding: 10px 7px 10px 2px;
    }

    .menu ul li a span {
        font-size: 13px;
    }
}

/* Kaartje: ongelabelde cellen (alleen iconen, bijv. wijzigen / kopiëren / verwijderen) naast elkaar op één regel */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    .table-scroll > table > tbody > tr > td {
        flex: 0 0 100%;
    }

    .table-scroll > table > tbody > tr > td[data-label=""] {
        flex: 0 0 auto;
        width: auto !important;
        padding-right: 18px;
    }
}

/* Kaartje: de stand-icoon (inline width:100% + center) links uitlijnen, en lege spans (bijv. .system-id) geen gap laten veroorzaken */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr > td > i.fa {
        flex: 0 0 auto;
        width: auto !important;
        text-align: left !important;
    }

    .table-scroll > table > tbody > tr > td > span:empty {
        display: none;
    }
}

@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr > td.cel-leeg {
        display: none;
    }
}

/* Lege lijst: geen losse rand/koprij als er geen kaartjes zijn */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody:not(:has(td)) {
        display: none;
    }

    .table-scroll > table:not(:has(td)) {
        border: 0;
    }
}

/* Datumvelden in formulieren: main.css beperkt #begindatum/#einddatum tot 70px (bedoeld voor de slidelijst) */
@media screen and (max-width: 1400px) {
    table.uitzendinggegevens #begindatum,
    table.uitzendinggegevens #einddatum {
        max-width: 100% !important;
        width: 100%;
        box-sizing: border-box;
    }
}

/* ---------- Menu bewerken: koppen boven elke kolom ---------- */
.kolomkop {
    display: none;
}

@media screen and (max-width: 760px) {
    /* De kopregel met beide titels vervalt; elke lijst krijgt zijn eigen kop */
    table:has(#nestable_all) > tbody > tr:has(> th) {
        display: none;
    }

    .kolomkop {
        display: block;
        margin: 14px 0 4px;
    }
}

/* De pop-ups van de header (help, monitor) moeten boven de TinyMCE-werkbalk (tox, z-index/sticky) liggen */
.help_popup,
.monitor_popup,
.change_email_popup,
.search_news_popup,
.change_password_popup {
    z-index: 10000;
}

/* ---------- Vastgezet menu (scrollToFixed) ---------- */
/* main.css geeft .menu margin-top:-20px; vastgezet op top:0 viel daardoor 20px boven het scherm (iconen afgesneden) */
.menu.scroll-to-fixed-fixed {
    margin-top: 0 !important;
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

@media screen and (max-width: 760px) {
    .menu.scroll-to-fixed-fixed {
        padding-top: 6px;
        padding-bottom: 6px;
    }
}

@media screen and (max-width: 400px) {
    #headericons .headericon {
        padding: 8px 3px;
    }

    .menu {
        gap: 0 4px;
        padding: 0 6px;
    }
}

/* ---------- Slides: filterbalk (twee keuzelijsten + zoekveld + knop) ---------- */
.slides_index #div-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

/* De keuzelijsten hebben inline min-width:200px; mogen krimpen zodat de balk netjes afbreekt */
.slides_index #div-filter select {
    flex: 0 1 200px;
    min-width: 0 !important;
    max-width: 100%;
    height: 28px;
    box-sizing: border-box;
}

/* Zoekveld en knop blijven altijd samen op één regel */
.slides_index #div-filter .filter-zoek {
    display: flex;
    flex: 1 1 220px;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.slides_index #div-filter .filter-zoek #input-filter {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    margin: 0;
}

.slides_index #div-filter .filter-zoek #button-filter {
    flex: 0 0 28px;
    margin: 0;
}

@media screen and (max-width: 760px) {
    .slides_index #div-filter {
        float: none;
        clear: both;
        width: 100%;
        margin-top: 8px;
    }

    .slides_index #div-filter select,
    .slides_index #div-filter .filter-zoek {
        flex: 1 1 100%;
    }
}

/* Brede schermen: compacte balk rechts, het zoekveld rekt niet uit over de hele regel */
@media screen and (min-width: 761px) {
    .slides_index #div-filter .filter-zoek {
        flex: 0 1 300px;
        width: 300px;
    }

    .slides_index #div-filter .filter-zoek #input-filter {
        width: 100%;
    }
}

/* ---------- Lange teksten in lijsten ---------- */
/* Titels zonder spaties (bestandsnamen, hashes) rekten de tabel op: laat ze overal afbreken */
.table-scroll > table td,
.table-scroll > table td a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.table-scroll > table td a.title,
.table-scroll > table td a.list_link {
    white-space: normal;
    min-width: 0;
}

/* ---------- Inlogvelden: inline height:20px is te laag voor aanraken ---------- */
@media screen and (max-width: 760px) {
    .login input[type=text],
    .login input[type=password],
    .login input[type=email] {
        height: 44px !important;
        line-height: 24px;
        padding: 8px 10px;
        font-size: 16px;
        width: 100%;
        box-sizing: border-box;
    }

    .login input[type=submit] {
        min-height: 44px;
        font-size: 16px;
    }

    .login td {
        padding-top: 4px;
        padding-bottom: 4px;
    }
}

/* Dashboard-nieuws: de balk "Stuur mij een e-mail bij nieuw nieuws" (absoluut gepositioneerd) wordt een gewoon blok onderaan het paneel */
@media screen and (max-width: 1100px) {
    .dashboard_right_wrapper .panel_body {
        padding-bottom: 0;
        overflow-x: hidden;
    }

    .notify_on_news_wrapper {
        position: static;
        width: auto;
        height: auto;
        margin: 8px -15px 0;
        padding: 9px 15px;
        font-size: 16px;
        line-height: 22px;
    }

    .notify_on_news_wrapper span {
        padding-left: 0;
        padding-right: 10px;
    }
}

/* ---------- Mobiel: iconen van de header op een eigen rij onder het menu (rechts), niet meer over de menu-items ---------- */
@media screen and (max-width: 560px) {
    .menu > ul {
        flex: 1 1 100%;
    }

    #headericons {
        flex: 1 1 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
        margin-left: 0;
        padding: 0 0 6px;
    }

    #headericons .headericon,
    #headericons .headericon.blue {
        top: 0 !important;
        margin: 0;
    }
}

/* ---------- Kaartjesweergave van lijsten: compacter, iconen rechts uitgelijnd ---------- */
@media screen and (max-width: 1050px) {
    .table-scroll > table > tbody > tr {
        padding: 6px 8px;
    }

    .table-scroll > table > tbody > tr > td:nth-child(n) {
        padding: 1px 0;
        gap: 4px;
        line-height: 1.25;
    }

    .table-scroll > table > tbody > tr > td,
    .table-scroll > table > tbody > tr > td a,
    .table-scroll > table > tbody > tr > td a.title {
        font-size: 15px !important;
    }

    .table-scroll > table > tbody > tr > td[data-label]:not([data-label=""])::before {
        flex-basis: 34%;
        max-width: 34%;
        font-size: 11px;
    }

    /* Iconen: samen op één regel, rechts uitgelijnd, met een dun streepje erboven */
    .table-scroll > table > tbody > tr > td[data-label=""] {
        padding: 6px 0 2px;
        padding-right: 0;
    }

    .table-scroll > table > tbody > tr > td[data-label=""] + td[data-label=""] {
        margin-left: 14px;
    }

    .table-scroll > table > tbody > tr > td[data-label]:not([data-label=""]) + td[data-label=""],
    .table-scroll > table > tbody > tr > td[data-label=""]:first-child {
        margin-left: auto;
    }

    /* Meerdere iconen in één cel (bijv. uitzendingen): ook rechts, met ruimte ertussen */
    .table-scroll > table > tbody > tr > td[data-label]:not([data-label=""]) + td[data-label=""]:last-child {
        justify-content: flex-end;
        gap: 18px;
        flex: 1 1 100%;
    }
}

/* ---------- Mobiel: iconen in de header even groot en op één lijn; menu-items passen ook op 320-400px ---------- */
@media screen and (max-width: 560px) {
    #headericons {
        padding: 4px 0 8px;
    }

    #headericons .headericon,
    #headericons .headericon.red,
    #headericons .headericon.blue {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        width: 40px;
        height: 40px;
        padding: 0;
        margin: 0;
        line-height: 1;
        vertical-align: middle;
    }

    /* de rode help-knop is een witte cirkel: kleiner, maar in hetzelfde 40px-vlak gecentreerd */
    #headericons .headericon.red {
        background: transparent;
    }

    #headericons .headericon.red .fa {
        background: #fff;
        border-radius: 50%;
        width: 22px;
        height: 22px;
        font-size: 28px !important;
        line-height: 22px;
        overflow: hidden;
        text-align: center;
    }
}

@media screen and (max-width: 420px) {
    .menu > ul {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .menu ul li a {
        padding: 10px 4px;
    }

    .menu ul li a span {
        font-size: 12.5px;
    }
}

/* ---------- Mobiel: iconen staan in de header (rechts, onder de gebruikersnaam, naast de klantkeuze); menu direct boven de blauwe lijn ---------- */
@media screen and (max-width: 760px) {
    .header {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo info"
            "klant icons";
    }

    .header .gebruiker-info {
        justify-self: end;
    }

    .header #headericons {
        grid-area: icons;
        justify-self: end;
        align-self: center;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 2px;
        flex: none;
        margin: 0;
        padding: 0;
    }

    .menu > ul {
        flex: 1 1 100%;
        margin: 0;
    }

    .menu {
        margin-top: 0 !important;
    }
}

@media screen and (max-width: 400px) {
    .header #headericons .headericon,
    .header #headericons .headericon.red,
    .header #headericons .headericon.blue {
        width: 34px;
        height: 34px;
    }
}
