@layer legado{
    .tribunais-disponiveis-section {
        margin: 2em 0;
    }

    .tribunais-disponiveis-section h2,
    .tribunais-disponiveis-section .tribunais-disponiveis-title {
        font-size: 1.35em;
        color: #37352f;
        font-weight: 700;
        margin-top: 0;
        margin-bottom: 0.8em;
        padding-bottom: 0.5em;
        border-bottom: 2px solid var(--primary-color);
    }
    body.dark-mode .tribunais-disponiveis-section h2,
    body.dark-mode .tribunais-disponiveis-section .tribunais-disponiveis-title {
        color: #e6e4dc;
    }

    .tribunais-seo-intro {
        font-size: 0.95em;
        line-height: 1.75;
        color: var(--text-color);
        margin-bottom: 1.2em;
        max-width: 85ch;
    }

    .tribunais-nota {
        background-color: var(--light-bg);
        border: 1px solid var(--border-color, #e5e7eb);
        padding: 12px 16px;
        border-radius: 6px;
        font-size: 0.93em;
        line-height: 1.65;
        margin-bottom: 1.5em;
    }

    body.dark-mode .tribunais-nota {
        background-color: #2c2c2e;
        border-color: #334155;
    }

    .tribunais-disponiveis-section h3 {
        font-size: 1.1em;
        color: var(--text-color);
        margin-top: 2em;
        margin-bottom: 0.7em;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .tribunais-disponiveis-section h3:first-of-type {
        margin-top: 0.5em;
    }

    .tribunais-counter {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-color: var(--primary-color);
        color: #fff;
        font-size: 0.75em;
        font-weight: 700;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 11px;
    }

    .tribunais-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
        background-color: var(--content-bg);
    }

    body.dark-mode .tribunais-table-wrapper {
        border-color: #3a3a3c;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    }

    .tribunais-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9em;
        line-height: 1.5;
    }

    .tribunais-table caption {
        caption-side: bottom;
        padding: 10px 16px;
        font-size: 0.82em;
        color: var(--secondary-color);
        text-align: left;
        font-style: italic;
        border-top: 1px solid var(--border-color);
    }

    .tribunais-table th,
    .tribunais-table td {
        padding: 10px 16px;
        text-align: left;
        vertical-align: middle;
    }

    .tribunais-table th {
        background-color: var(--light-bg);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.82em;
        letter-spacing: 0.5px;
        white-space: nowrap;
        border-bottom: 2px solid var(--border-color);
    }

    body.dark-mode .tribunais-table th {
        background-color: #2c2c2e;
        border-bottom-color: #4a4a4e;
    }

    .tribunais-table td {
        border-bottom: 1px solid var(--border-color);
    }

    body.dark-mode .tribunais-table td {
        border-bottom-color: #3a3a3c;
    }

    .tribunais-table tbody tr:last-child td {
        border-bottom: none;
    }

    .tribunais-table tbody tr:nth-child(even) {
        background-color: var(--zebra-stripe-color, rgba(0, 0, 0, 0.018));
    }

    body.dark-mode .tribunais-table tbody tr:nth-child(even) {
        background-color: rgba(255, 255, 255, 0.03);
    }

    .tribunais-table tbody tr:hover {
        background-color: rgba(0, 113, 227, 0.05);
    }

    body.dark-mode .tribunais-table tbody tr:hover {
        background-color: rgba(10, 132, 255, 0.1);
    }

    .tribunais-table .trib-sigla {
        font-weight: 700;
        color: var(--primary-color);
        letter-spacing: 0.3px;
        min-width: 4.5em;
        width: 1%;
        white-space: nowrap;
    }

    @media (max-width: 520px) {
        .tribunais-table .trib-sigla {
            white-space: normal;
            width: auto;
            min-width: 0;
        }
    }

    .tribunais-table .trib-sigla a {
        color: inherit;
        text-decoration: none;
        border-bottom: 1px dashed var(--primary-color);
        transition: border-color 0.2s, opacity 0.2s;
    }

    .tribunais-table .trib-sigla a:hover {
        opacity: 0.8;
        border-bottom-style: solid;
    }

    .tribunais-table .trib-nome {
        color: var(--text-color);
        white-space: nowrap;
    }

    @media (max-width: 960px) {
        .tribunais-table .trib-nome {
            white-space: normal;
        }
    }

    .tribunais-table .trib-uf {
        color: var(--secondary-color);
        font-size: 0.92em;
    }

    .tribunais-table .trib-cal {
        color: var(--secondary-color);
        font-size: 0.92em;
    }

    .tribunais-table .trib-cal .trib-ato-nome {
        display: block;
        font-weight: 500;
        color: var(--text-color);
        font-size: 0.96em;
    }

    .tribunais-table .trib-cal .trib-ato-tipo {
        display: block;
        font-style: italic;
        font-size: 0.88em;
        color: var(--secondary-color);
        margin-top: 2px;
    }

    @media (max-width: 768px) {
        .tribunais-table-wrapper {
            border: none;
            box-shadow: none;
            border-radius: 0;
            overflow-x: visible;
        }

        .tribunais-table caption {
            padding: 8px 4px;
        }

        .tribunais-table thead {
            display: none;
        }

        .tribunais-table,
        .tribunais-table tbody {
            display: block;
        }

        .tribunais-table tbody tr {
            display: block;
            padding: 14px 16px;
            margin-bottom: 8px;
            border: 1px solid var(--border-color);
            border-radius: 10px;
            background-color: var(--content-bg);
            box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
        }

        body.dark-mode .tribunais-table tbody tr {
            border-color: #3a3a3c;
            background-color: #1c1c1e;
        }

        .tribunais-table tbody tr:nth-child(even) {
            background-color: var(--content-bg);
        }

        body.dark-mode .tribunais-table tbody tr:nth-child(even) {
            background-color: #1c1c1e;
        }

        .tribunais-table tbody tr:last-child {
            margin-bottom: 0;
        }

        .tribunais-table td {
            display: block;
            border-bottom: none;
            padding: 3px 0;
        }

        .tribunais-table td.trib-sigla {
            font-size: 1em;
            font-weight: 700;
            color: var(--primary-color);
            padding-bottom: 6px;
            margin-bottom: 6px;
            border-bottom: 1px solid var(--border-color);
        }

        body.dark-mode .tribunais-table td.trib-sigla {
            border-bottom-color: #3a3a3c;
        }

        .tribunais-table td.trib-nome::before,
        .tribunais-table td.trib-uf::before,
        .tribunais-table td.trib-cal::before {
            font-weight: 600;
            font-size: 0.82em;
            color: var(--secondary-color);
            text-transform: uppercase;
            letter-spacing: 0.3px;
            margin-right: 6px;
        }

        .tribunais-table td.trib-nome::before { content: "Tribunal: "; }
        .tribunais-table td.trib-uf::before   { content: "Jurisdição: "; }
        .tribunais-table td.trib-cal::before   { content: "Calendário: "; }

        .tribunais-table td.trib-nome,
        .tribunais-table td.trib-uf,
        .tribunais-table td.trib-cal {
            font-size: 0.9em;
            font-style: normal;
        }
    }
        .tribunais-table th{color:var(--hover-color)}
    body.dark-mode .tribunais-table th{color:var(--res-highlight-text)}
}
