/**
 * Custom Tables — Stylesheet v1.2
 * Desktop: full table with up to 3-level headers + canton column
 * Mobile (< 768px): tab switcher + canton cards + legend + row notes
 *
 * Customise the :root variables to match your theme.
 */

/* ── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
    --ct-font:              inherit;
    --ct-radius:            0;
    --ct-radius-sm:         5px;
    --mobile-font-size:     11px;

    /* Table colors */
    --ct-border:            #B4ADA6;
    --ct-border-inner:            #00000026;
    --ct-thead-bg:          #000000;
    --ct-thead-color:       #ffffff;
    --ct-thead-color-2:       #000000;
    --ct-thead-l2-bg:       transparent;
    --ct-thead-l3-bg:       #3d3d60;
    --ct-row-bg:            #ffffff;
    --ct-row-alt-bg:        #f8f9fa;
    --ct-row-hover:         #00000026;
    --ct-cell-color:        #000000;
    --ct-link-color:        #4a6cf7;
    --ct-title-color:       #000000;

    /* Canton column */
    --ct-canton-bg:         #00000026;
    --ct-canton-color:      #000000;
    --ct-canton-min-width:  50px;

    /* Row note (full-width note row after a data row) */
    --ct-row-note-bg:       transparent;
    --ct-row-note-color:    #000000;

    /* Tab colors */
    --ct-tab-nav-bg:        #f0f0f5;
    --ct-tab-btn-color:     #000000;
    --ct-tab-btn-active-bg: #000000;
    --ct-tab-btn-active-color: #ffffff;
    --ct-tab-btn-hover-bg:  #e0e0ee;

    /* Legend (mobile) */
    --ct-legend-color:      #000;

    /* Spacing */
    --ct-cell-pad-x:        10px;
    --ct-cell-pad-y:        10px;
}


/* ── WRAPPER ─────────────────────────────────────────────────────────────── */
.ct-table-wrap {
    margin: 2rem 0;
    font-family: var( --ct-font );
}

.ct-table-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 100%;
    color: var( --ct-title-color );
    margin: 0 0 20px;
    letter-spacing: 0;
}


/* ── DESKTOP TABLE ───────────────────────────────────────────────────────── */
/* .ct-table-scroll {
    width: 100%;
    height: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var( --ct-border );
    border-radius: var( --ct-radius );
} */
.ct-table-scroll .table-responsive {
    height: auto;
}

.ct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: var( --ct-cell-color );
    table-layout: auto;
    letter-spacing: 0;
}

/* thead — level 1 */
.ct-table thead tr:nth-child(1) th {
    background: var( --ct-thead-bg );
    color: var( --ct-thead-color );
}

/* thead — level 2 */
.ct-table thead tr:nth-child(2) th {
    background: var( --ct-thead-l2-bg );
    color: var( --ct-thead-color-2 );
    border-right: 1px dashed #00000026;
}

/* thead — level 3 */
.ct-table thead tr:nth-child(3) th {
    background: var( --ct-thead-l2-bg );
    color: var( --ct-thead-color-2 );
    border-top: 1px solid #00000026;
    border-right: 1px dashed #00000026;
}

.ct-table th {
    padding: var( --ct-cell-pad-y ) var( --ct-cell-pad-x );
    text-align: left;
    font-weight: 600;
    line-height: 1;
    border-right: 1px solid #B4ADA6;
    vertical-align: top;
    letter-spacing: 0.4px;
}

.ct-table th:last-child, .ct-table thead tr:nth-child(2) th:last-child {
    border-right: none;
}

/* ── CANTON HEADER CELL ── */
.ct-table th.ct-col-canton {
    background: var( --ct-canton-bg ) !important;
    color: var( --ct-canton-color ) !important;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    vertical-align: top;
    min-width: var( --ct-canton-min-width );
    border-right: 1px solid var( --ct-border ) !important;
}

/* ── DATA ROWS — alternating via class (not nth-child, to survive note rows) ── */
tr.ct-data-row:first-child > td {
    border-top: 1px solid #000000;
}
tr.ct-data-row:last-child {
    border-bottom: 1px solid #000000;
}
/* .ct-table tbody tr.ct-row-odd {
    background: var( --ct-row-bg );
} */

/* .ct-table tbody tr.ct-row-even {
    background: var( --ct-row-alt-bg );
} */

.ct-table tbody tr.ct-data-row:hover {
    background: var( --ct-row-hover );
    transition: background 0.15s ease;
}

/* ── CANTON DATA CELL ── */
.ct-table td.ct-row-id {
    white-space: nowrap;
    border-right: 1px solid var( --ct-border-inner );
}

.ct-row-id--has-note {
    vertical-align: top;
}

.ct-row-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 2px;
}

.ct-row-name {
    vertical-align: middle;
    /* font-family: 'CeraPRO-Black', Arial, Helvetica, sans-serif; */
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── REGULAR DATA CELLS ── */
.ct-table td {
    padding: var( --ct-cell-pad-y ) var( --ct-cell-pad-x );
    border-top: 1px solid var( --ct-border-inner );
    border-right: 1px dashed var( --ct-border-inner );
    vertical-align: middle;
    font-size: 15px;
    line-height: 1;
}

.ct-table td.ct-cell-level-3 {
    width: 10%;
    border-right: 1px dashed var( --ct-border-inner );
}

.ct-table td[colspan] {
    text-align: center;
}

.ct-table td .cell_link {
    position: relative;
    display: inline-block;
    color: var(--ct-canton-color);
    text-decoration: none !important;
}
.ct-table td .cell_link::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -0;
    width: 100%;
    border-bottom: 1px solid var(--ct-canton-color);
}

.ct-table td:last-child {
    border-right: none;
}

.ct-table a {
    color: var( --ct-link-color );
    text-decoration: none;
    font-weight: 400;
}

.ct-table a:hover {
    text-decoration: underline;
}

/* ── ROW NOTE ── */
.ct-row-note-row {
    background: var( --ct-row-note-bg ) !important;
}

.ct-row-note-cell {
    padding: 0.5rem var( --ct-cell-pad-x );
    color: var( --ct-row-note-color );
    font-size: 15px;
    text-align: center;
    border-top: 1px solid var( --ct-border );
    /* border-right: none !important; */
}

.ct-row-note-row:hover {
    background: var( --ct-row-note-bg ) !important;
}


/* ── MOBILE: hide table, show tabs ──────────────────────────────────────── */
@media ( max-width: 1199px ) {

    .ct-table-scroll {
        display: none;
    }

    /* ── TAB NAV ── */
    .ct-tabs__nav {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        background: transparent;
        padding: 0;
        gap: 2px;
        margin-bottom: 15px;
    }

    .ct-tabs__nav::-webkit-scrollbar {
        display: none;
    }

    /* ── TAB BUTTON ── */
    .ct-tabs__btn {
        flex: 0 0 50%;
        flex-grow: 1;
        padding: 10px 15px;
        border: none;
        border-radius: var( --ct-radius-sm );
        background: rgba(0, 0, 0, 0.15);
        outline: none !important;
        outline-offset: 0 !important;
        box-shadow: none !important;
        color: var( --ct-tab-btn-color );
        white-space: nowrap;
        cursor: pointer;
        transition: background 0.15s ease, color 0.15s ease;
        -webkit-appearance: none;
        font-family: inherit;
        font-weight: 600;
    }

    .ct-tabs__btn:hover:not( .is-active ) {
        background: var( --ct-tab-btn-hover-bg );
    }

    .ct-tabs__btn.is-active {
        background: var( --ct-tab-btn-active-bg );
        color: var( --ct-tab-btn-active-color );
    }

    .ct-tabs__btn:focus-visible {
        outline: 2px solid var( --ct-link-color );
        outline-offset: 2px;
    }

    /* ── LEGEND ── */
    .ct-tab-legend {
        color: var( --ct-legend-color );
        font-size: var(--mobile-font-size);
        margin: 0 0 20px;
        line-height: 1.4;
    }

    /* ── TAB PANEL ── */
    .ct-tabs__panel[hidden] {
        display: none;
    }

    /* ── MOBILE TABLE ── */
    .ct-mobile-table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        font-size: var(--mobile-font-size);
        color: var( --ct-cell-color );
    }

    .ct-mobile-table thead {
        border-top: 1px solid #000000;
    }

    .ct-mobile-table thead th {
        padding: var( --ct-cell-pad-y ) var( --ct-cell-pad-x );
        text-align: left;
        vertical-align: top;
        font-size: var(--mobile-font-size);
        line-height: 1;
        color: var(--ct-thead-color-2);
        overflow-wrap: break-word;
        word-break: break-word;
        /* border-bottom: 1px solid var( --ct-border ); */
    }

    .ct-mobile-th-canton {
        width: 33%;
    }

    /* Bottom border of the whole thead (last tr covers single- and two-row heads) */
    .ct-mobile-table thead tr:last-child th {
        border-right: 1px dashed var( --ct-border-inner );
    }
    .ct-mobile-table thead tr:last-child th:last-child {
        border-right: none;
    }

    /* Two-row head: separator between parent sub-group label and its leaf labels */
    .ct-mobile-table--two-row-head thead tr:first-child th[colspan] {
        border-bottom: 1px solid var( --ct-border-inner );
    }

    .ct-mobile-table tbody tr.ct-mobile-row:first-child td {
        border-top: 1px solid var( --ct-border-inner );
    }

    .ct-mobile-table tbody tr:last-child td {
        border-bottom: 1px solid #000000;
    }

    .ct-mobile-canton {
        padding-left: 0 !important;
        vertical-align: middle;
        background: transparent;
        border-right: 1px solid var( --ct-border-inner );
    }

    .ct-mobile-canton .flex {
        display: flex;
        align-items: center;
    }

    .ct-mobile-canton__img {
        width: 20px;
        height: 20px;
        object-fit: contain;
        vertical-align: middle;
        margin-right: 8px;
        border-radius: 2px;
    }

    .ct-mobile-canton__name {
        /* font-family: 'CeraPRO-Black', Arial, Helvetica, sans-serif; */
        font-weight: 600;
        font-size: var(--mobile-font-size);
        text-transform: uppercase;
        vertical-align: middle;
        color: var( --ct-canton-color );
        white-space: break-spaces;
    }

    .ct-mobile-table tbody td {
        padding: var( --ct-cell-pad-y ) var( --ct-cell-pad-x );
        border-top: 1px solid var( --ct-border-inner );
        border-right: 1px solid var( --ct-border-inner );
        vertical-align: middle;
        font-size: var(--mobile-font-size);
        line-height: 1.1;
        color: var( --ct-cell-color);
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .ct-mobile-table tbody td[colspan] {
        text-align: center;
    }

    .ct-mobile-table td .cell_link {
        position: relative;
        display: inline-block;
        color: var(--ct-canton-color);
        text-decoration: none !important;
    }
    .ct-mobile-table td .cell_link::before {
        content: '';
        position: absolute;
        bottom: -1px;
        left: -0;
        width: 100%;
        border-bottom: 1px solid var(--ct-canton-color);
    }

    .ct-mobile-table tbody td:last-child {
        border-right: none;
    }

    .ct-mobile-canton--has-note {
        vertical-align: top;
    }

    .ct-mobile-row-note td {
        padding: 0.5rem var( --ct-cell-pad-x );
        color: var( --ct-row-note-color );
        font-size: var( --mobile-font-size );
        line-height: 1.4;
        text-align: center;
        border-top: 1px solid var( --ct-border-inner );
    }
}

@media ( min-width: 768px ) {
    .ct-tabs__btn {
        padding: 13.5px 15px;
    }
}

/* ── DESKTOP: hide tabs ──────────────────────────────────────────────────── */
@media ( min-width: 1200px ) {
    .ct-tabs {
        display: none;
    }
    .ct-table-title {
        margin-bottom: 40px;
        font-size: 18px;
    }
}
