* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #0176fe;
    --color-text: #1a1a1a;
    --color-border: #e0e0e0;
    --color-bg: #f5f7fa;
    --color-bg-hover: #e8eef5;
    --color-dst-active: #2e7d32;
    --color-countdown: #0078d4;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.08);
    --radius: 6px;
    --transition: 0.18s ease;
    --color-bg-muted: #f0f0f0;
    --color-border-muted: #e5e5e5;
    --color-btn-border: #b0b0b0;
    --color-btn-text: #707070;
    --color-text-inverse: #fff;

    /* status / meter colours (shared) */
    --color-status-green: #2e7d32;
    --color-status-amber: #FFB300;
    --color-status-red: #c62828;

    --radius-sm: 4px;
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.1);
    --space-sm: 8px;
    --info-btn-size: 20px;
}

html {
    font-size: 18px;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.4;
    min-height: 100vh;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    padding: 8px;
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100vh;
}

.column-heading img {
    height: 42px;
    width: auto;
}

#hq-clock {
    width: 19vmin;
    height: 19vmin;
}

.hq-date {
    font-weight: bold;
    font-size: inherit;
    letter-spacing: normal;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.column {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 0;
    align-items: center;
    text-align: center;
}

.column-heading {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 7px 0;
    margin: 0 0 4px;
    min-height: 53px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.column>fieldset {
    width: 100%;
    text-align: center;
    background-color: var(--color-bg-muted);
    border: 1px solid var(--color-border-muted);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
}

.column>fieldset:hover {
    background: var(--color-bg-hover);
    box-shadow: var(--shadow-md);
}

.column>fieldset>legend {
    width: 100%;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.column>fieldset>time {
    display: inline;
}

.column>fieldset.dst-active>legend {
    color: var(--color-dst-active);
}

time {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.column-heading button,
.column>fieldset>legend button,
.holiday-nav button {
    border-radius: 50%;
    border: 1.5px solid var(--color-btn-border);
    background: transparent;
    color: var(--color-btn-text);
    font-weight: 700;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.column-heading button,
.column>fieldset>legend button {
    width: var(--info-btn-size);
    height: var(--info-btn-size);
    min-width: var(--info-btn-size);
    min-height: var(--info-btn-size);
    flex-shrink: 0;
    font-size: 0.75rem;
    margin-left: 0.35em;
    vertical-align: middle;
}

.holiday-nav button {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.column-heading button:hover,
.column-heading button:focus-visible,
.column>fieldset>legend button:hover,
.column>fieldset>legend button:focus-visible,
.holiday-nav button:hover:not(:disabled),
.holiday-nav button:focus-visible:not(:disabled) {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.info-dialog {
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    margin: 0;
}

.info-dialog::backdrop {
    background: transparent;
}

.column>fieldset details {
    width: 100%;
}

.column>fieldset details summary time {
    display: inline;
}

.day-offset {
    margin-left: 0.35em;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.column>fieldset details[open]> :not(summary) {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    line-height: 1.45;
}

.au1Countdown,
.au2Countdown,
.ukCountdown,
.nzCountdown {
    display: block;
    color: var(--color-countdown);
    font-weight: 500;
    margin-top: 2px;
}

.column meter {
    vertical-align: middle;
    width: 6em;
    height: 0.7em;
}

.column meter::-webkit-meter-bar {
    background: var(--color-bg-muted);
    border: none;
    border-radius: var(--radius-sm);
}

.column meter::-moz-meter-bar {
    background: var(--color-bg-muted);
    border-radius: var(--radius-sm);
}

.column meter.meter-ok {
    --meter-color: var(--color-status-green);
}

.column meter.meter-warn {
    --meter-color: var(--color-status-amber);
}

.column meter.meter-critical {
    --meter-color: var(--color-status-red);
}

.column meter.meter-ok::-webkit-meter-optimum-value,
.column meter.meter-ok::-webkit-meter-suboptimum-value,
.column meter.meter-ok::-webkit-meter-even-less-good-value,
.column meter.meter-warn::-webkit-meter-optimum-value,
.column meter.meter-warn::-webkit-meter-suboptimum-value,
.column meter.meter-warn::-webkit-meter-even-less-good-value,
.column meter.meter-critical::-webkit-meter-optimum-value,
.column meter.meter-critical::-webkit-meter-suboptimum-value,
.column meter.meter-critical::-webkit-meter-even-less-good-value {
    background: var(--meter-color);
    border-radius: var(--radius-sm);
}

.column meter.meter-ok::-moz-meter-bar,
.column meter.meter-warn::-moz-meter-bar,
.column meter.meter-critical::-moz-meter-bar {
    background: var(--meter-color);
}

.holiday {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-align: left;
    width: fit-content;
    min-width: 21vmin;
}

.holiday-region-group {
    margin-bottom: 10px;
}

.holiday-items {
    list-style: none;
}

.holiday-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 6px;
}

.holiday-nav button:disabled {
    opacity: 0.35;
    cursor: default;
}

#holidayMonth {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--color-primary);
    white-space: nowrap;
}

.holiday-empty {
    font-style: italic;
    color: var(--color-btn-text);
}

.holiday-region-group:last-child {
    margin-bottom: 0;
}

.holiday-region-name {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.holiday-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25em 0.5em;
    align-items: baseline;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 3px 0;
    color: var(--color-text);
}

.holiday-item mark {
    font-variant: small-caps;
    color: rgba(255, 127, 127, 0.9);
    background-color: rgba(127, 127, 31, 0.1);
}

/* 3rd-party vendor boxes: the background carries the status and the text
   follows for contrast. These outrank .column>fieldset:hover, so hover keeps
   the shadow lift without washing out the colour. */
.column>fieldset.vendor-status {
    font-weight: 700;
}

.column>fieldset.vendor-status.status-green {
    background-color: var(--color-status-green);
    color: var(--color-text-inverse);
}

.column>fieldset.vendor-status.status-amber {
    background-color: var(--color-status-amber);
    color: var(--color-text);
}

.column>fieldset.vendor-status.status-red {
    background-color: var(--color-status-red);
    color: var(--color-text-inverse);
}

/* a failed fetch has no status to show, so the box keeps the card look */
.column>fieldset.vendor-status.status-unknown {
    color: var(--color-btn-text);
}

/* Chrome paints <legend> above the fieldset background, so the legend
   borrows the box colour to keep the product name readable */
.column>fieldset.vendor-status>legend {
    background-color: inherit;
    color: inherit;
    padding: 6px 0;
}

.column>fieldset.vendor-status>legend a {
    color: inherit;
    text-underline-offset: 0.15em;
}

#currencyRates caption {
    text-align: center;
    padding-bottom: 0.35em;
}

#currencyRates caption img {
    display: inline-block;
    height: 1.5em;
    width: auto;
    margin-right: 0.45em;
    vertical-align: middle;
}

#latestVersion table,
#currencyRates table {
    border-collapse: collapse;
    margin: 0 auto;
    width: fit-content;
    font-size: 0.85rem;
}

#latestVersion th,
#latestVersion td,
#currencyRates th,
#currencyRates td {
    border: 1px solid var(--color-border);
    padding: 4px 6px;
    text-align: left;
}

#latestVersion thead th,
#currencyRates thead th {
    background-color: var(--color-bg-muted);
    font-weight: 600;
}

#currencyRates th[scope="row"] {
    background-color: var(--color-bg-muted);
    font-weight: 600;
    text-align: left;
}

#currencyRates td[data-field="middle"] {
    text-align: right;
}

#latestVersion tbody tr:nth-child(even),
#currencyRates tbody tr:nth-child(even) {
    background-color: var(--color-bg-hover);
}

.release-details,
.currency-details {
    width: 100%;
}

#latestVersion,
#currencyRates {
    max-width: 100%;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.release-details summary,
.currency-details summary {
    display: flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.release-details summary::-webkit-details-marker,
.currency-details summary::-webkit-details-marker {
    display: none;
}

.release-details summary::before,
.currency-details summary::before {
    content: "▸";
    margin-right: 0.35em;
    transition: transform var(--transition);
}

.release-details[open] summary::before,
.currency-details[open] summary::before {
    transform: rotate(90deg);
}

.release-details[open] summary .column-heading,
.currency-details[open] summary .column-heading {
    color: var(--color-primary);
}

.release-details summary:hover .column-heading,
.release-details summary:focus-visible .column-heading,
.currency-details summary:hover .column-heading,
.currency-details summary:focus-visible .column-heading {
    color: var(--color-primary);
}

#latestVersion th button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
}

#latestVersion th button:hover,
#latestVersion th button:focus-visible {
    color: var(--color-primary);
}

#latestVersion th[aria-sort="ascending"] button::after {
    content: " ▲";
}

#latestVersion th[aria-sort="descending"] button::after {
    content: " ▼";
}

.last-updated {
    margin-top: var(--space-sm);
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-btn-text);
}

@media (max-width: 640px) {
    .grid-container {
        grid-template-columns: 1fr;
        padding: 8px;
    }

    time {
        font-size: 1.15rem;
    }
}