table {
    width: 100%;
    margin-bottom: 0.8em;
    border-collapse: collapse;
    background-color: white;
}

.table-container {
    margin-bottom: 20px;
    overflow: hidden;
    background-color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    word-break: break-word;
}

.table-container table {
    width: 100%;
}

.table-container table:not(:last-child) {
    position: relative;
    z-index: 2;
}

.table-container table:last-child {
    margin-bottom: 0;
}

th, td {
    padding: 0.6em 0.8em;
    text-align: center;
}

th {
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-top: 1px solid var(--secondary);
    border-bottom: 2px solid var(--primary);
}

td.flex-td {
    display: flex;
    align-items: center;
    text-align: left;
    font-size: 0.9em;
}

td a {
    display: block;
    width: 100%;
    height: 100%;
    padding: inherit;
    margin: -0.6em -0.8em;
}

.map-table {
    margin: 0;
}

.map-table td:nth-of-type(1), .map-table td:nth-of-type(1) * {
    font-weight: bold;
}

.map-table td:nth-of-type(2), .map-table td:nth-of-type(2) * {
    font-weight: normal;
}

.pollutant-table {
    table-layout: fixed;
    font-weight: bold;
}

.pollutant-table th {
    background: #fafafa;
}

.pollutant-table th,
.pollutant-table td {
    padding: 8px 12px;
    text-align: center;
}

.pollutant-table th:first-child,
.pollutant-table td:first-child {
    text-align: left;
    width: 20%;
}

.pollutant-table th:not(:first-child),
.pollutant-table td:not(:first-child) {
    width: 20%;
}

.pollutant-table th:first-of-type, .pollutant-table td:first-of-type {
    text-align: left;
}

.pollutant-table tr {
    height: 3em;
}

.pollutant-table .loading-wheel img {
    width: 1em;
}

/* Fills the <td> the same way the generic `td a` rule does (full cell, cancels
   out the td's own padding via negative margin) - the inner <a> and the LoQ
   span are laid out in a column so a detection can show its value plus a
   small LoQ line beneath, per Robert (Slack, 7/10). */
.pollutant-table .status-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: inherit;
    margin: -0.6em -0.8em;
}

.pollutant-table .status-cell a {
    display: inline;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
}

.status-loq {
    font-size: 0.7em;
    font-weight: normal;
    color: #666;
}

.status-loq:empty {
    display: none;
}

.pollutant-table tr:hover td {
    filter: brightness(0.85);
}

.pollutant-table tr:hover {
    filter: none;
}

.pollutant-table td {
    font-size: 12pt;
}

.pollutant-table td:first-of-type {
    font-weight: bold;
}

.pollutant-table td a {
    font-size: 12pt;
}

.colour-info-table tbody {
    font-size: 0.9em;
    text-align: center;
}

.colour-info-table td {
    width: 50%;
}

.colour-info-table th {
    border-bottom: 1px solid black;
    background-color: #f2f2f2;
    border-top: none;
}

.documents-table, .documents-table tr {
    width: auto;
    border: 1px solid;
}

.documents-table td:nth-child(1) {
    min-width: 30em;
    text-align: left;
}

.documents-table td:nth-child(2) {
    min-width: 6em;
    text-align: right;
}

.documents-table td:nth-child(3) {
    text-align: center;
}

.documents-table td:nth-child(3):hover {
    background: var(--lighter-primary);
}

.documents-section-separator {
    margin: 3.5em 0 2em;
    border: none;
    border-top: 2px solid #000;
}

.documents-year-header {
    margin: 0.6em 0 1em 0.2em;
    font-size: inherit;
    font-weight: bold;
    letter-spacing: 2px;
}

.pollutant-table tr[style*="border-bottom"] {
    border-bottom: 2px solid black;
}

.pollutant-table tr[style*="border-bottom"] td {
    border-bottom: 2px solid black;
}

/* Ensure table header borders are never covered by hover effects */
.pollutant-table tr:hover th {
    filter: none;
}

.pollutant-table tr:hover + tr td {
    border-top: inherit;
}

/* Make sure the hover effect doesn't override border visibility */
.pollutant-table tr:last-child:hover td {
    border-bottom: inherit;
}

@media (max-width: 500px) {
    .table-container, .pollutant-table, .pollutant-table td, .pollutant-table td a {
        font-size: 9pt;
    }
}

/* Names a group of monitor tables. Both groups use it: the fenceline
   instruments and the ground level monitors. */
.monitor-group-header {
    margin: 0.4em 0 0.6em;
    font-size: 0.9em;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--dark-grey);
}

.glm-table-note {
    margin: 0 0 0.8em;
    font-size: 0.85em;
    font-style: italic;
    color: var(--dark-grey);
}
