.report-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-hint {
    font-size: 0.9rem;
    font-weight: normal;
    color: #555;
}

.data-source {
    margin-top: 6px;
    font-size: 0.85em;
    font-style: italic;
    text-align: right;
    opacity: 0.8;
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

.controls {
    margin-bottom: 15px;
}

.controls button {
    padding: 6px 12px;
    cursor: pointer;
}

.controls button.active {
    background-color: #999;
    color: #fff;
}

table {
    border-collapse: collapse;
    width: max-content;
	table-layout: fixed;
}

th, td {
    border: 1px solid #ccc;
    padding: 2px;
    text-align: right;
	width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: center;
    font-weight: bold;
	width: 120px;
	min-width: 120px;
	white-space: nowrap;
}

/* Highlighted row and column */
td, th {
    position: relative;
    transition: background 0.2s;
}

/* HOVER EFFECTS (ONLY ROW + COLUMN HEADERS) */

/* Highlight column header when hovering a cell */
td:hover {
    /* Find corresponding column header */
}
th.hovered {
    background-color: rgba(255, 255, 153, 0.3); /* light pale yellow */
    cursor: default;
}

/* Highlight row header (first cell in row) */
td:first-child.hovered {
    background-color: rgba(255, 255, 153, 0.3); /* light pale yellow */
    cursor: default;
}

/* Remove any diagonal overlay or intersection effect */
td.hovered.intersection::after {
    content: none;
}

thead {
    background: #f2f2f2;
}

tfoot td {
    font-weight: bold;
    background-color: #d0d0d0;
}

.record-high {
    background-color: #fdd; /* pale red */
}

.record-low {
    background-color: #ddf; /* pale blue */
}

.hovered {
    background-color: #ffffcc !important;
    cursor: default;
}

.table-container {
    max-height: 600px; /* adjust as needed */
    overflow: auto;
	overflow-y: auto;
    border: 1px solid #ccc;
	position: relative;
	isolation: isolate;
}

/* Sticky header */
thead th {
    position: sticky;
    top: 0;
    background: #f2f2f2;
    z-index: 2;
}

/* Sticky first column (optional) */
th:first-child,
td:first-child {
    position: sticky;
    left: 0;
    background: #f2f2f2;
    z-index: 1;
}

/* Top-left cell ("Day") fix */
thead th:first-child {
    z-index: 3; /* highest so it stays above both header row & first column */
}

.legend {
    margin-top: 15px;
    font-size: 0.9em;
}

.legend span {
    display: inline-block;
    padding: 3px 8px;
    margin-right: 10px;
    border-radius: 3px;
    color: #000;
    font-weight: bold;
}

/* Matching the table highlight colors */
.legend .record-high {
    background-color: #fdd;
}

.legend .record-low {
    background-color: #ddf;
}

.legend .hovered {
    background-color: #ffff99;
}

.legend .intersection {
    background-color: #ffffcc;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 165, 0, 0.25),
        rgba(255, 165, 0, 0.25) 4px,
        transparent 4px,
        transparent 8px
    );
}

/* =========================
   DAILY STATS TABLE WRAPPING HEADERS
   ========================= */

/* Header short labels wrap */
#dailyStatsTable th .th-label {
    display: inline;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    line-height: 1.2em;
    max-width: 120px;          /* adjust to preference */
}

/* Make table auto-fit content but allow scrolling horizontally */
#dailyStatsTable {
    table-layout: auto;       /* columns adjust based on content */
    width: auto;              /* allow horizontal scroll */
	border-collapse: separate;
	border-spacing: 0;
}

/* Optional: table container for vertical + horizontal scrolling */
#dailyStatsTableContainer {
    max-height: 600px;        /* adjust as needed */
    overflow: auto;
	border-collapse: collapse;
    border: 1px solid #ccc;
}

/* Ensure first column (date) is sticky and wide enough */
#dailyStatsTable th:first-child,
#dailyStatsTable td:first-child {
    min-width: 100px;
}

/* Other header columns min width */
#dailyStatsTable th:not(:first-child) {
    min-width: 60px;
}

#dailyStatsTable tbody td {
    white-space: nowrap;
}

/* Sticky footer block */
#dailyStatsTable tfoot {
    position: sticky;
    bottom: 0;
    background: #f3f3f3;
    z-index: 20;
	background-clip: padding-box;
}

/* Footer rows */
#dailyStatsTable tfoot tr {
    background: #f3f3f3;
}

/* Footer cells */
#dailyStatsTable tfoot td {
    background: #f3f3f3;
    padding: 2px;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
	white-space: nowrap;
}

/* Footer calculation symbols */
#dailyStatsTable .footer-symbol {
    font-size: 0.6em;
    opacity: 1;
    margin-right: 1px;
    vertical-align: super;
}

/* Seal between footer rows */
	#dailyStatsTable tfoot tr + tr td {
    border-top: 1px solid #ccc;
}

/* Seal bottom edge */
	#dailyStatsTable tfoot tr:last-child td {
    border-bottom: 1px solid #ccc;
}

/* Strong separator above footer */
	#dailyStatsTable tfoot tr:first-child td {
    box-shadow: 0 -2px 0 #ccc;
}

/* =========================
   NUMBERS + UNITS
   ========================= */

/* Ensure numbers and units stay on the same line */
#dailyStatsTable td span {
    display: inline;           /* keep units inline with number */
    vertical-align: text-bottom;
    font-size: 0.7em;          /* optional smaller size for units */
    margin-left: 2px;           /* small gap between number and unit */
    white-space: nowrap;        /* prevent wrapping units to next line */
}

/* =========================
   CENTER HEADINGS
   ========================= */

/* Center the short labels inside th */
#dailyStatsTable th {
    text-align: center;
    vertical-align: middle;
}

/* =========================
   DAILY STATS SEARCH BOX
   ========================= */

/* Base search input */
#dailyStatsTableContainer + .controls input#dailySearch,
#dailySearch {
    width: 350px;        /* adjust as needed */
    max-width: 90%;      /* ensures it doesn’t overflow on smaller screens */
    padding: 5px 28px 5px 8px;
    font-size: 0.95em;
    box-sizing: border-box;
}

/* Wrapper is needed for absolute positioning inside input */
.search-wrapper {
    position: relative;
    display: inline-block;
}

/* Clear button inside input */
.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 1em;
    color: #888;
    display: none;
    user-select: none;
    z-index: 2;
}

/* Show X only when input has text */
.search-wrapper input#dailySearch:not(:placeholder-shown) ~ .clear-search {
    display: inline;
}

/* Hover effect for X */
.search-wrapper .clear-search:hover {
    color: #000;
}

/* Sort indicator arrow */
#dailyStatsTable thead th .sort-indicator {
    font-size: 0.75em;
    opacity: 0.7;
    margin-left: 4px;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* =========================
   YEAR COMPARISON TABLE STICKY FOOTER
   ========================= */

#comparison {
    border-collapse: separate;
    border-spacing: 0;
}

/* Make the entire tfoot sticky as a block */
#comparison tfoot {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #d0d0d0;
    background-clip: padding-box;
}

/* Critical: override border-collapse for footer only */
#comparison tfoot tr {
    background: #d0d0d0;
}

#comparison tfoot td {
    background: #d0d0d0;
    padding: 2px;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

#comparison tfoot tr + tr td {
    border-top: 1px solid #ccc;
}

/* Strong separator above footer */
#comparison tfoot tr:first-child td {
    box-shadow: 0 -2px 0 #999;
}

/* Seal bottom edge */
#comparison tfoot tr:last-child td {
    border-bottom: 1px solid #ccc;
}

/* Ensure comparison table container has max height for scrolling */
#comparisonContainer .table-container {
    max-height: 600px;
    overflow-y: auto;
}

/* =========================
   MONTH COMPARISON TABLE STICKY FOOTER
   ========================= */

#compareMonthTable {
    border-collapse: separate;
    border-spacing: 0;
}

/* Make the entire tfoot sticky as a block */
#compareMonthTable tfoot {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #d0d0d0;
    background-clip: padding-box;
}

/* Critical: override border-collapse for footer only */
#compareMonthTable tfoot tr {
    background: #d0d0d0;
}

#compareMonthTable tfoot td {
    background: #d0d0d0;
    padding: 2px;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

#compareMonthTable tfoot tr + tr td {
    border-top: 1px solid #ccc;
}

/* Strong separator above footer */
#compareMonthTable tfoot tr:first-child td {
    box-shadow: 0 -2px 0 #999;
}

/* Seal bottom edge */
#compareMonthTable tfoot tr:last-child td {
    border-bottom: 1px solid #ccc;
}

/* Ensure compareMonthTable table container has max height for scrolling */
#compareMonthContainer .table-container {
    max-height: 600px;
    overflow-y: auto;
}

/* =========================
   INVALID CALENDAR DAYS ONLY
   ========================= */

#compareMonthTable td.invalid-day {
    background-color: #e6e6e6 !important;
    color: #999 !important;
}

/* =========================
   MONTH COMPARISON TABLE LAYOUT
   ========================= */
#compareMonthTable {
    table-layout: auto;
    width: 100%;
}

/* =========================
   MONTH COLUMNS (12)
   ========================= */
#compareMonthTable th:not(:first-child),
#compareMonthTable td:not(:first-child) {
    width: calc((100% - 120px) / 12); /* remaining space after Day column */
    min-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================
   STICKY HEADER ROW
   ========================= */
#compareMonthTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f2f2f2;
}

/* =========================
   STICKY FIRST COLUMN
   ========================= */

/* Body cells in first column */
#compareMonthTable tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;              /* behind top-left header */
    background: #f2f2f2;
    width: 120px;             /* SINGLE SOURCE OF TRUTH */
    min-width: 120px;
    white-space: nowrap;
}

/* Top-left cell ("Day") */
#compareMonthTable thead th:first-child {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 5;              /* above all sticky elements */
    background: #f2f2f2;
    width: 120px;            /* match body first column */
    min-width: 120px;
    white-space: nowrap;
}

/* =========================
   NORMAL BODY CELLS
   ========================= */
#compareMonthTable tbody td {
    position: relative;
    z-index: 1;
}

/* =========================
   MONTH COMPARISON TABLE FOOTER SEPARATOR + COLOURING
   ========================= */

#compareMonthTable tfoot tr:first-child td {
    border-top: 5px solid #999;
    box-shadow: none;
}

#compareMonthTable tfoot td {
    background-clip: padding-box;
}

/* =========================
   SUMMARY STYLES
   ========================= */

.summary-section-row td {
    text-align: left;
    font-weight: bold;
    text-decoration: underline;
    background: transparent;
}

.summary-year {
    text-align: left;
}

tr.spacer-row td {
    border: none;
    background: transparent;
    height: 10px;
}

.summary-section-cell {
    font-weight: bold;
    text-align: left;
    text-decoration: underline;
}

.summary-totals td {
    font-weight: bold;
    border-top: 2px solid #999;
}

/* Only Summary mode gets the separator */
#compareMonthTable.mode-summary th:nth-child(13),
#compareMonthTable.mode-summary td:nth-child(13) {
    border-right: 3px solid #000;
}

/* Only apply to seasonal report */
#compareMonthTable.seasonal-report thead th {
    position: sticky;
    z-index: 3;
    background: #f2f2f2;
    text-align: center;
}

/* Top row (Seasons) */
#compareMonthTable.seasonal-report thead tr:first-child th {
    top: 0;
    z-index: 4; /* above months row */
}

/* Second row (Months) */
#compareMonthTable.seasonal-report thead tr:nth-child(2) th {
    top: 1.65em; /* adjust to your first row height */
    z-index: 3;
}

/* ===============================
   SEASONAL HEADER – FULL BOXES
   (Season name + 3 months)
================================ */

/* TOP of season boxes (season name row) */
#compareMonthTable.seasonal-report thead tr:first-child th:not(:first-child) {
    border-top: 3px solid #000;
    border-right: 3px solid #000;
}

/* LEFT edge of the FIRST season box (season name row) */
#compareMonthTable.seasonal-report thead tr:first-child th:nth-child(2) {
    border-left: 3px solid #000;
}

/* BOTTOM of season boxes (month row) */
#compareMonthTable.seasonal-report thead tr:nth-child(2) th {
    border-bottom: 3px solid #000;
}

/* LEFT edges of season boxes in month row */
#compareMonthTable.seasonal-report thead tr:nth-child(2) th:nth-child(2) {
    border-left: 3px solid #000;
}

/* RIGHT edges of season boxes in month row */
#compareMonthTable.seasonal-report thead tr:nth-child(2) th:nth-child(4),
#compareMonthTable.seasonal-report thead tr:nth-child(2) th:nth-child(7),
#compareMonthTable.seasonal-report thead tr:nth-child(2) th:nth-child(10),
#compareMonthTable.seasonal-report thead tr:nth-child(2) th:nth-child(13) {
    border-right: 3px solid #000;
}

/* Border below months */
.seasonal-report thead tr:last-child th {
    border-bottom: 3px solid #000;
}

/* Vertical line between column 1 and 2,
   starting below the Year header row */
.seasonal-report tbody tr:not(:first-child) td:nth-child(2) {
    border-left: 3px solid #000;
}

/* Right-hand vertical line on all rows except the Year header row */
.seasonal-report tbody tr td:last-child {
    border-right: 3px solid #000; /* default for all */
}

/* Remove right border from year header row (colspan=13) */
.seasonal-report tbody tr td[colspan="13"] {
    border-right: none;
}

/* Horizontal line under first data row after each year header */
.seasonal-report tbody tr td:first-child div[style*="font-weight: bold"] 
    + td, 
.seasonal-report tbody tr td:first-child div[style*="font-weight: bold"] 
    ~ td {
    border-top: 3px solid #000;
}

/* Better approach using just tr structure: */
.seasonal-report tbody tr:has(td:first-child div[style*="font-weight: bold"]) 
    + tr td:nth-child(n+2) {
    border-top: 3px solid #000;
}

/* Bottom border for the entire table */
.seasonal-report tbody tr:last-child td {
    border-bottom: 3px solid #000;
}

/* Vertical seasonal borders (after columns 4, 7, 10) */
/* Applies to all rows except Year header and Yearly total rows */
.seasonal-report tbody tr:not(.year-header):not(.yearly-row) td {
    position: relative; /* Needed to allow pseudo-element borders */
}

/* For cells that are part of a seasonal block or monthly row */
.seasonal-report tbody tr:not(.year-header):not(.yearly-row) td:nth-child(4),
.seasonal-report tbody tr:not(.year-header):not(.yearly-row) td:nth-child(7),
.seasonal-report tbody tr:not(.year-header):not(.yearly-row) td:nth-child(10) {
    border-right: 3px solid #000;
}

/* ------------------------
   Seasonal report: wider first column
   ------------------------ */
#compareMonthTable.seasonal-report tbody td:first-child,
#compareMonthTable.seasonal-report thead th:first-child {
    width: 180px !important;   /* new width for seasonal report */
    min-width: 180px !important;
}

/* Adjust the 12 month columns to share remaining width */
#compareMonthTable.seasonal-report th:not(:first-child),
#compareMonthTable.seasonal-report td:not(:first-child) {
    width: calc((100% - 180px) / 12) !important;  /* remaining space divided by 12 */
    min-width: 50px; /* optional minimum */
}
