/*
 * Tor — dark theme layered on Pico.css v2 (data-theme="dark").
 * Shared design language with dnt.privatevoid.eu and frigg.privatevoid.eu:
 * GitHub-dark palette (#0d1117 / #161b22 / #30363d) with DNT red (#E2001A) accent.
 */

:root {
    --pico-font-size: 93.75%;
    --pico-background-color: #0d1117;
    /* Cards and borders sit a clear step above the page background so
       surfaces are distinguishable (bumped from GitHub-dark #161b22/#30363d). */
    --pico-card-background-color: #1b2330;
    --pico-card-sectioning-background-color: #232d3d;
    --pico-table-border-color: #414c5e;
    --pico-muted-border-color: #414c5e;
    /* Softer corners: buttons/inputs/pills follow Pico's radius, cards go rounder */
    --pico-border-radius: 0.5rem;
    --radius-card: 0.75rem;

    --accent: #E2001A;
    --accent-hover: #B8001A;
    --accent-ring: rgba(226, 0, 26, 0.2);
    --success: #27ae60;
}

/* --- Base --- */

html { scrollbar-gutter: stable; }

body {
    padding: 1rem;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

[x-cloak] {
    display: none !important;
}

/* --- Page chrome (same as DNT) --- */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* `inherit` (not var(--pico-color)): Pico redefines --pico-color to the primary
   colour on anchors, which would turn the brand link blue */
.page-header h1 a {
    color: inherit;
}

.page-header h1 a:hover {
    text-decoration: none;
    color: inherit;
}

.page-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.page-nav > a {
	padding: 0.4rem 0.85rem; border-radius: var(--pico-border-radius);
	text-decoration: none; white-space: nowrap;
	border: 1px solid var(--pico-form-element-border-color);
	background: var(--pico-form-element-background-color);
	color: var(--pico-form-element-color);
	font-size: 0.9rem; line-height: 1.2;
}
.page-nav > a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-nav > a.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-nav > a.active:hover { color: white; text-decoration: none; }

.page-nav__user {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
    padding: 0.35rem 0.25rem;
}

.page-nav__logout {
    width: auto;
    margin: 0;
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: var(--pico-border-radius);
    background: transparent;
    color: var(--pico-muted-color);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: none;
}

.page-nav__logout:hover {
    color: var(--pico-color);
    background: rgba(255, 255, 255, 0.08);
}

.page-nav__logout:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-ring);
}

/* --- Hero / page intros --- */

.hero {
    padding: 0 0 1.25rem;
}

.home-hero {
    padding: 0 0 1.25rem;
}

.home-hero__title,
.hero__title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.home-hero__lead,
.hero__lead {
    margin: 0;
    max-width: 62ch;
    line-height: 1.55;
    color: var(--pico-muted-color);
    font-size: 0.95rem;
}

.hero__cta {
    margin: 0.75rem 0 0;
}

/* --- Home plan cards (whole card is a link to the plan page) --- */

.home-plans {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.home-plan-card {
    display: block;
    margin: 0;
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 0.85rem 1rem 0.95rem;
    min-width: 0;
    box-shadow: none;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.home-plan-card:hover {
    text-decoration: none;
    color: inherit;
    border-color: color-mix(in srgb, var(--pico-muted-border-color) 70%, white);
    background: color-mix(in srgb, var(--pico-card-background-color) 94%, white);
}

.home-plan-card__title {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    min-width: 0;
    color: var(--pico-color);
}

.home-plan-card__empty {
    margin: 0;
    font-size: 0.9rem;
}

.home-plan-card__places {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.home-plan-card__places li {
    margin: 0;
    padding: 0;
    color: var(--pico-muted-color);
    line-height: 1.35;
    font-size: 0.9rem;
    list-style: none;
}

.home-plan-card__places li::before {
    content: "·";
    margin-right: 0.4rem;
    color: var(--pico-muted-border-color);
    font-weight: 700;
}

/* --- Buttons (DNT recipes) --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto;
    margin: 0;
    padding: 0.5rem 1rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-form-element-border-color);
    background: var(--pico-form-element-background-color);
    color: var(--pico-form-element-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: none;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-ring);
}

/* Pico makes button[type=submit] full width; keep .btn buttons content-sized */
button.btn,
a.btn {
    width: auto;
}

.btn--primary {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

.btn--ghost {
    background: transparent;
}

.btn--danger {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 55%, var(--pico-muted-border-color));
    background: rgba(226, 0, 26, 0.08);
}

.btn--danger:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn--small {
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
}

/* --- Utilities --- */

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em;
}

.muted {
    color: var(--pico-muted-color);
}

.small {
    font-size: 0.9rem;
}

.nowrap {
    white-space: nowrap;
}

.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;
}

/* --- Public plan page --- */

.plan-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Row-major order: item 1,2,… left-to-right, then next row — matches foreach order.
   The Yr table widget only shows all its columns at ≥ 40rem, so a column is only
   created when a card can hold the full-width widget (40rem table + card padding).
   auto-fill counts tracks by the minmax() max, so the widget cap (66.67rem) lives
   on .place-card instead of the track definition. */
.plan-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 42.5rem), 1fr));
}

.plan-header__title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}

.plan-header__meta {
    margin: 0;
    color: var(--pico-muted-color);
}

.place-card {
    margin: 0;
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 1rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    /* Cap at the widget's max content width and centre within a wide track */
    width: 100%;
    max-width: 66.75rem;
    margin-inline: auto;
}

/* On containers narrower than the widget's full table (40rem) the card scrolls
   horizontally instead of letting the iframe silently crop the table columns. */
.place-card .yr-widget {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    border-radius: var(--pico-border-radius);
}

.place-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.place-card__title {
    margin: 0;
    font-size: 1.15rem;
    flex: 1;
    min-width: 0;
}

.place-card__toggle-widget {
    flex-shrink: 0;
}

/* min-width keeps the widget at its full table layout (40rem); the natural
   content height is ~31rem, background matches the widget's dark mode. */
.yr-widget__frame {
    border: 0;
    border-radius: var(--pico-border-radius);
    background: #0a2343;
    display: block;
    width: 100%;
    min-width: 40rem;
    height: 35rem;
}

/* Utlandet (abroad) trip dashboards: day-by-day forecast cards rendered from Open-Meteo. */
.trip-stops {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Trip stops use the full page width (the place-card cap exists for the Yr widget only). */
.trip-stop {
    max-width: none;
}

.trip-stop__flag {
    margin-right: 0.35rem;
}

.trip-stop__meta {
    margin: 0.15rem 0 0;
    width: 100%;
}

.trip-stop__source {
    color: var(--accent);
}

.trip-stop__unavailable {
    margin: 0.5rem 0 0;
}

/* Day cards fill the available width and wrap onto further rows instead of scrolling.
   The minimum card width fits the longest daypart row ("Midt på dagen" + symbol + temp).
   Near days carry a daypart breakdown and are taller, so cards top-align. */
.day-strip {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
    align-items: start;
}

.day-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 0.5rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-background-color);
    text-align: center;
}

.day-card__weekday {
    font-weight: 600;
    text-transform: capitalize;
}

.day-card__date {
    color: var(--pico-muted-color);
    font-size: 0.85rem;
}

.day-card__symbol {
    width: 48px;
    height: 48px;
    margin: 0.25rem 0;
}

.day-card__label {
    text-transform: capitalize;
    min-height: 2.4em;
    display: flex;
    align-items: center;
}

.day-card__temps {
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    font-size: 1.05rem;
}

.day-card__tmax {
    font-weight: 600;
}

.day-card__detail {
    line-height: 1.3;
}

.day-card__placeholder {
    font-size: 1.6rem;
    color: var(--pico-muted-color);
    margin: 0.5rem 0;
}

/* Per-daypart breakdown (morning/midday/afternoon/evening) for the coming days.
   One shared grid for all rows (each .daypart is display:contents), so the symbol and
   temperature columns line up vertically: the temperature column is as wide as the widest
   value, and every symbol sits directly to its left. */
.dayparts {
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--pico-muted-border-color);
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0.3rem;
    text-align: left;
}

.daypart {
    display: contents;
}

.daypart__name {
    white-space: nowrap;
}

.daypart__symbol {
    width: 24px;
    height: 24px;
}

.daypart__temp {
    font-weight: 600;
    justify-self: end;
    font-variant-numeric: tabular-nums;
}

.daypart__precip {
    grid-column: 1 / -1;
    justify-self: end;
    margin-top: -0.2rem;
}

.attribution {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--pico-muted-border-color);
    color: var(--pico-muted-color);
    line-height: 1.55;
}

.error-title {
    margin-top: 0;
}

.error-dev h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.5rem;
}

.backoffice .muted {
    max-width: 80ch;
    line-height: 1.55;
}

/* Backoffice -------------------------------------------------------------- */

.backoffice-shell {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.backoffice-flash {
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--success);
    background: rgba(39, 174, 96, 0.15);
    border-radius: var(--radius-card);
    color: var(--success);
}

.alpine-flash {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.alpine-flash__text {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding-top: 0.25rem;
    line-height: 1.45;
}

.alpine-flash__close {
    flex-shrink: 0;
}

.backoffice-heading__title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}

.backoffice-heading__lead,
.backoffice-heading__meta {
    margin: 0;
    line-height: 1.55;
}

.backoffice-breadcrumbs {
    margin: 0;
}

.backoffice-card {
    margin: 0;
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 1.1rem 1.1rem 1.15rem;
    box-shadow: none;
}

.backoffice-card--danger {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--pico-muted-border-color));
}

.backoffice-card__title {
    margin: 0 0 0.85rem;
    font-size: 1.1rem;
}

.backoffice-stack {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.backoffice-section-title {
    margin: 0;
    font-size: 1.1rem;
}

/* --- Forms --- */

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.form-field label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin: 0;
}

.form-control {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0.45rem 0.65rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-form-element-border-color);
    background: var(--pico-form-element-background-color);
    color: var(--pico-form-element-color);
    font-size: 0.95rem;
    box-shadow: none;
}

.form-control:focus,
.form-control:focus-visible {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-ring);
}

.field-hint {
    margin: 0;
}

.field-error {
    color: var(--accent);
    font-size: 0.92rem;
}

.validation-summary {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.validation-summary ul {
    margin: 0.25rem 0 0 1.25rem;
    padding: 0;
}

/* --- Yr place search dropdown --- */

.yr-search {
    position: relative;
    width: 100%;
}

.yr-search__anchor {
    position: relative;
    width: 100%;
}

.yr-search__dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 30;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--radius-card);
    background: var(--pico-card-background-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    max-height: 20rem;
    overflow-y: auto;
}

.yr-search__status {
    margin: 0;
    padding: 0.65rem 0.85rem;
}

.yr-search__list {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
}

.yr-search__list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.yr-search__option {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--pico-color);
    text-align: left;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: none;
}

.yr-search__option--active,
.yr-search__option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.yr-search__option-name {
    font-weight: 650;
}

.backoffice-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

/* --- Tables --- */

.table-wrap {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--radius-card);
    overflow: auto;
    background: var(--pico-card-background-color);
}

.backoffice-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    min-width: 760px;
}

.backoffice-table th,
.backoffice-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    vertical-align: middle;
    background: transparent;
}

.backoffice-table thead th {
    font-size: 0.92rem;
    color: var(--pico-color);
    background: var(--pico-card-sectioning-background-color);
    border-bottom: 2px solid var(--pico-muted-border-color);
}

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

.backoffice-table .num {
    text-align: right;
    white-space: nowrap;
}

.actions {
    white-space: nowrap;
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--pico-muted-border-color);
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge--muted {
    border-color: var(--pico-muted-border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--pico-muted-color);
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.pager__links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --- List reordering (drag and drop) --- */

.reorder-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--pico-border-radius);
    background: transparent;
    color: var(--pico-muted-color);
    cursor: grab;
    touch-action: none;
    box-shadow: none;
}

.reorder-handle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--pico-color);
}

.reorder-handle:active {
    cursor: grabbing;
}

.reorder-cell {
    width: 2.5rem;
}

.reorder-row--ghost {
    opacity: 0.4;
}

.reorder-row--ghost td {
    box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

/* Login pages (Views/Shared/_LoginLayout.cshtml) deliberately do not load this file: they mirror
   Heimdall's plain-Pico login box, styled inline in that layout. */

/* Alpine interactions ----------------------------------------------------- */

.alpine-inline-confirm {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.alpine-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.alpine-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.72);
    backdrop-filter: blur(2px);
}

.alpine-modal__panel {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    width: 100%;
    padding: 1.25rem 1.35rem;
    border-radius: var(--radius-card);
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.alpine-modal__text {
    margin: 0 0 1rem;
    line-height: 1.45;
}

.alpine-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.alpine-slug-preview {
    margin-top: 0.35rem !important;
}

/* --- Klima (historical climate) backoffice -------------------------------
 * Data colours are tokens so the shared design can re-theme them in one place.
 * Good-share ramp: one hue (blue), dark → light = worse → better on the dark
 * surface, validated as an ordinal ramp against #1b2330 (light end ≥ 2:1).
 * Every heat cell also prints its number, so colour never carries meaning alone.
 * Series: blue / orange categorical pair (CVD-separated); status colours only
 * appear next to an icon + label. */

:root {
    --climate-heat-0: #1c5cab;
    --climate-heat-1: #2a78d6;
    --climate-heat-2: #5598e7;
    --climate-heat-3: #86b6ef;
    --climate-heat-4: #b7d3f6;
    --climate-heat-ink-dark: #0d1117;
    --climate-heat-none: #2a3342;
    --climate-series-1: #3987e5;
    --climate-series-2: #d95926;
    --climate-status-good: #0ca30c;
    --climate-status-bad: #d03b3b;

    /* Content widths: sections stop where their content ends instead of
       stretching across wide windows. Wide = tables/charts, form = input cards. */
    --climate-width-wide: 64rem;
    --climate-width-form: 52rem;

    /* Analysis widgets sit side by side once two of this width fit; the grid itself
       may grow wider than the rest of the page on large screens. */
    --climate-widget-min: 40rem;
    --climate-width-dashboard: 150rem;

    /* Day grid verdicts: the light/dark ends of the good-share ramp ("lighter is better"). */
    --climate-day-good: var(--climate-heat-4);
    --climate-day-bad: var(--climate-heat-0);
}

.climate-page > * {
    width: 100%;
    max-width: var(--climate-width-wide);
}

.climate-page > .climate-width-form {
    max-width: var(--climate-width-form);
}

.climate-page > .climate-widgets {
    max-width: var(--climate-width-dashboard);
}

.climate-widgets {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--climate-widget-min)), 1fr));
    align-items: start;
}

.climate-widget {
    min-width: 0; /* let wide tables scroll inside the widget instead of widening the column */
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 1rem;
}

.climate-widget--wide {
    grid-column: 1 / -1;
}

/* Charts are cards of their own elsewhere; inside a widget the widget is the card. */
.climate-widget .climate-chart {
    border: 0;
    background: none;
    padding: 0;
}

/* Segmented switch (shared pill-button pattern of the backoffice nav). */
.climate-segmented {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.climate-segmented__label {
    margin-right: 0.25rem;
}

.climate-segmented > a {
    padding: 0.3rem 0.7rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-form-element-border-color);
    background: var(--pico-form-element-background-color);
    color: var(--pico-form-element-color);
    font-size: 0.85rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.climate-segmented > a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.climate-segmented > a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: white; }

/* Day × year grid: small squares with a 2px gap, like the compare page's year strip. */
.climate-days {
    width: auto;
    margin: 0;
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.climate-days th,
.climate-days td {
    padding: 0;
    border: 0;
    text-align: center;
    vertical-align: middle;
}

.climate-days th,
.climate-days td:not(.climate-day) {
    background: none;
}

.climate-day {
    min-width: 1.35rem;
    height: 1.35rem;
    border-radius: 4px;
    font-weight: 700;
    line-height: 1;
}

.climate-days--values .climate-day {
    min-width: 1.75rem;
}

.climate-day--good { background: var(--climate-day-good); color: var(--climate-heat-ink-dark); }
.climate-day--bad { background: var(--climate-day-bad); color: #fff; }
.climate-day--none { background: var(--climate-heat-none); color: var(--pico-muted-color); }
.climate-day--void { background: none; }

.climate-day--share { color: #fff; font-weight: 400; }
.climate-day--share.climate-heat--3,
.climate-day--share.climate-heat--4 { color: var(--climate-heat-ink-dark); }
.climate-day--share.climate-heat--none { color: var(--pico-muted-color); }

.climate-days .climate-days__year {
    padding-right: 0.5rem;
    text-align: left;
    font-size: 0.85rem;
}

.climate-days tfoot .climate-days__year {
    font-weight: 400;
    color: var(--pico-muted-color);
}

.climate-days .climate-days__month {
    text-align: left;
    font-weight: 600;
    color: var(--pico-muted-color);
}

.climate-days .climate-days__day {
    font-weight: 400;
    color: var(--pico-muted-color);
}

.climate-days .climate-days__count {
    padding-left: 0.5rem;
    text-align: right;
    white-space: nowrap;
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}

/* Pico's own input rule (height, padding, 15px bottom margin) outranks .form-control, which
   made inputs taller than selects and stretched the day/month pairs unevenly. */
.climate-page input.form-control {
    height: auto;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0;
}

/* .backoffice-form aligns children to flex-start; these rows must span the card. */
.climate-controls__row,
.climate-controls__criteria {
    align-self: stretch;
}

.climate-create > .form-field,
.climate-create > .climate-create__fields {
    align-self: stretch;
}

/* All six destination fields share one dense row on wide screens. */
.climate-create__fields {
    display: grid;
    gap: 0.85rem 1rem;
    grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
    align-items: end; /* inputs line up even when some labels wrap to two lines */
}

/* Below the full six-across row, the name takes two cells (two columns fit from ~360px). */
@media (min-width: 360px) and (max-width: 959px) {
    .climate-create__wide {
        grid-column: span 2;
    }
}

.climate-controls__row {
    display: grid;
    gap: 0.85rem 1rem;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    align-items: end;
}

.climate-controls__criteria {
    margin: 0;
    padding: 0;
    border: 0;
}

.climate-controls__criteria > legend,
.climate-date > legend {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin: 0 0 0.35rem;
    padding: 0;
}

/* A fieldset is not a dependable flex container (its legend is special), so the
   day + month pair sits in an inner flex row. */
.climate-date {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

/* Day + month need two grid cells once the row has room for several columns. */
@media (min-width: 640px) {
    .climate-date {
        grid-column: span 2;
    }
}

.climate-date__inputs {
    display: flex;
    gap: 0.35rem;
}

.climate-date__inputs .form-control {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
}

.climate-date__inputs .climate-date__day {
    flex: 0 0 4.2rem;
}

.climate-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

.climate-choice {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.92rem;
}

.climate-choice input {
    margin: 0;
}

.climate-check-cell {
    width: 2.25rem;
    text-align: center !important;
}

.climate-check-cell input {
    margin: 0;
}

.climate-compare-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.climate-sync {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.climate-sync progress {
    width: 5rem;
    height: 0.4rem;
    margin: 0;
}

/* Headline: the "x of n years" hero number plus supporting stat tiles. */
.climate-headline {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.climate-tile {
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 0.85rem 1rem;
}

.climate-tile p {
    margin: 0;
}

.climate-tile--hero {
    grid-column: 1 / -1;
}

@media (min-width: 900px) {
    .climate-tile--hero {
        grid-column: span 2;
    }
}

.climate-tile__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.climate-tile--hero .climate-tile__value {
    font-size: 2.1rem;
}

.climate-tile__label {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}

.climate-tile__note {
    margin-top: 0.35rem !important;
}

/* Heat cells: year grid, month heatmap, compare strip. 2px surface gap between fills. */
.climate-grid,
.climate-heatmap {
    font-variant-numeric: tabular-nums;
}

.climate-heatmap {
    min-width: 640px;
}

.climate-grid__threshold {
    display: block;
    font-weight: 400;
    font-size: 0.78rem;
}

.climate-grid__missing th,
.climate-grid__missing td {
    color: var(--pico-muted-color);
}

.backoffice-table td.climate-cell {
    border: 2px solid var(--pico-card-background-color);
    border-radius: 6px;
    color: #fff;
}

.climate-heatmap td.climate-cell {
    padding: 0.4rem 0.45rem;
    text-align: center;
}

.climate-heat--0 { background: var(--climate-heat-0) !important; }
.climate-heat--1 { background: var(--climate-heat-1) !important; }
.climate-heat--2 { background: var(--climate-heat-2) !important; }
.climate-heat--3 { background: var(--climate-heat-3) !important; }
.climate-heat--4 { background: var(--climate-heat-4) !important; }
.climate-heat--none { background: var(--climate-heat-none) !important; }

.backoffice-table td.climate-heat--3,
.backoffice-table td.climate-heat--4,
.climate-strip__year.climate-heat--3,
.climate-strip__year.climate-heat--4 {
    color: var(--climate-heat-ink-dark);
}

.backoffice-table td.climate-heat--none {
    color: var(--pico-muted-color);
}

.climate-heat-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.85rem;
}

.climate-heat-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.climate-heat-legend__swatch {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 4px;
}

.climate-verdict {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.climate-verdict--good .climate-verdict__icon { color: var(--climate-status-good); font-weight: 700; }
.climate-verdict--bad .climate-verdict__icon { color: var(--climate-status-bad); font-weight: 700; }
.climate-verdict--missing { color: var(--pico-muted-color); }

.climate-strip {
    display: flex;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.climate-strip__year {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin: 0;
    border-radius: 4px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    list-style: none;
}

/* Inline SVG charts (server-rendered, no library). */
.climate-chart {
    margin: 0;
    border: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    border-radius: var(--radius-card);
    padding: 0.85rem 1rem 0.5rem;
}

.climate-chart__title {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.climate-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.climate-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    list-style: none;
}

.climate-legend__swatch {
    display: inline-block;
    width: 1rem;
    height: 0.65rem;
    border-radius: 3px;
}

.climate-legend__swatch--band-outer { background: color-mix(in srgb, var(--climate-series-1) 28%, transparent); }
.climate-legend__swatch--band-inner { background: color-mix(in srgb, var(--climate-series-1) 55%, transparent); }
.climate-legend__swatch--line,
.climate-legend__swatch--good { height: 3px; background: var(--climate-series-1); }
.climate-legend__swatch--wet { height: 3px; background: var(--climate-series-2); }

/* On phones the chart keeps a legible size and scrolls sideways, like the tables. */
.climate-chart__scroll {
    overflow-x: auto;
}

.climate-svg {
    display: block;
    width: 100%;
    min-width: 560px;
    height: auto;
    overflow: visible;
}

.climate-svg__grid {
    stroke: var(--pico-muted-border-color);
    stroke-width: 1;
    opacity: 0.6;
}

.climate-svg__axis,
.climate-svg__threshold-label,
.climate-svg__end-label {
    fill: var(--pico-muted-color);
    font-size: 11px;
}

.climate-svg__end-label {
    fill: var(--pico-color);
}

.climate-svg__band-outer { fill: var(--climate-series-1); opacity: 0.28; }
.climate-svg__band-inner { fill: var(--climate-series-1); opacity: 0.55; }

.climate-svg__line {
    fill: none;
    stroke: var(--climate-series-1);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.climate-svg__line--wet {
    stroke: var(--climate-series-2);
}

.climate-svg__threshold {
    stroke: var(--pico-color);
    stroke-width: 1;
    opacity: 0.55;
}

.climate-svg__hit rect {
    fill: transparent;
}

.climate-svg__guide {
    stroke: var(--pico-color);
    stroke-width: 1;
    opacity: 0;
}

.climate-svg__hit:hover .climate-svg__guide {
    opacity: 0.45;
}

.climate-table-view summary {
    cursor: pointer;
    font-size: 0.92rem;
}

.climate-table-view .table-wrap {
    margin-top: 0.5rem;
}

.climate-pending {
    margin: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--radius-card);
    background: var(--pico-card-background-color);
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}

/* An error-free validation summary would otherwise leave an empty gap atop Klima forms. */
.climate-page .validation-summary-valid {
    display: none;
}

.climate-controls__criteria .field-hint {
    margin-top: 0.5rem;
}

/* --- Nordlys (aurora) backoffice -------------------------------------------
 * Reuses the Klima widget grid and inline-SVG chart classes. Data colours are
 * the validated Klima series pair (blue / orange); verdict chips always carry a
 * text label, so the status colours never carry meaning alone. */

:root {
    --aurora-night: color-mix(in srgb, var(--pico-color) 7%, transparent);
    --aurora-south: color-mix(in srgb, var(--climate-series-1) 12%, transparent);
}

.aurora-place__row {
    display: flex;
    gap: 0.5rem;
}

.aurora-place__row .yr-search__anchor {
    flex: 1;
}

.aurora-place .yr-search {
    text-align: left;
}

.aurora-temporary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.aurora-temporary .inline-form {
    margin: 0;
}

/* Verdict chips: pill + text label; tone only adds colour. */
.aurora-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--pico-muted-border-color);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--pico-color);
}

.aurora-chip--bad { color: var(--pico-muted-color); }
.aurora-chip--good { border-color: var(--climate-status-good); color: var(--climate-status-good); }
.aurora-chip--strong { border-color: var(--climate-status-good); background: var(--climate-status-good); color: var(--climate-heat-ink-dark); }
.aurora-chip--large { font-size: 1.05rem; padding: 0.25rem 0.85rem; }

.aurora-verdict {
    margin: 0.75rem 0;
}

.aurora-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.6rem 1rem;
    margin: 0 0 0.75rem;
}

.aurora-facts dt {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    margin: 0;
}

.aurora-facts dd {
    margin: 0;
    font-weight: 600;
}

.aurora-quote {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--pico-muted-border-color);
}

.aurora-quote footer {
    margin-top: 0.35rem;
    font-size: 0.8rem;
}

.aurora-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.6rem;
    margin: 0.5rem 0;
}

.aurora-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-sectioning-background-color);
}

.aurora-tile__label {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

.aurora-tile__value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

.aurora-tile__value small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--pico-muted-color);
}

.aurora-tile__hint {
    font-size: 0.75rem;
    line-height: 1.3;
}

.aurora-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 32rem), 1fr));
    gap: 0.75rem;
}

.aurora-charts .climate-chart,
.climate-widget .aurora-kp {
    border: 0;
    background: none;
    padding: 0;
}

/* Kp bars: observed solid, provisional lighter, predicted hatched (texture, not just tint). */
.aurora-svg__bar--observed,
.aurora-svg__bar--outlook { fill: var(--climate-series-1); }
.aurora-svg__bar--estimated { fill: color-mix(in srgb, var(--climate-series-1) 55%, transparent); }
.aurora-svg__bar--predicted { fill: url(#aurora-hatch); stroke: var(--climate-series-1); stroke-width: 1; }
.aurora-svg__bar--storm { fill: var(--climate-series-2); }
.aurora-svg__hatch-bg { fill: color-mix(in srgb, var(--climate-series-1) 18%, transparent); }
.aurora-svg__hatch-line { stroke: var(--climate-series-1); stroke-width: 2; }

.aurora-svg__hit { fill: transparent; }
.aurora-svg__bar-group:hover .aurora-svg__bar { filter: brightness(1.25); }

.aurora-svg__night { fill: var(--aurora-night); }
.aurora-svg__south { fill: var(--aurora-south); }
.aurora-svg__day { stroke: var(--pico-muted-border-color); stroke-width: 1; }
.aurora-svg__zero { opacity: 1; stroke: var(--pico-muted-color); }
.aurora-svg__value { font-size: 9px; }

.aurora-svg__now {
    stroke: var(--pico-color);
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
}

.aurora-svg__ref {
    stroke: var(--pico-color);
    stroke-width: 1;
    stroke-dasharray: 4 3;
    opacity: 0.7;
}

.aurora-svg__ref--alert {
    stroke: var(--accent);
    stroke-dasharray: none;
    opacity: 0.9;
}

.aurora-svg__line--bz,
.aurora-svg__line--speed,
.aurora-svg__line--density,
.aurora-svg__line--hpi { stroke: var(--climate-series-1); }
.aurora-svg__line--bt { stroke: var(--climate-series-2); stroke-width: 1.5; }

.aurora-swatch--observed,
.aurora-swatch--bz { background: var(--climate-series-1); }
.aurora-swatch--bz,
.aurora-swatch--bt { height: 3px; }
.aurora-swatch--bt { background: var(--climate-series-2); }
.aurora-swatch--estimated { background: color-mix(in srgb, var(--climate-series-1) 55%, transparent); }
.aurora-swatch--predicted {
    background: repeating-linear-gradient(45deg, var(--climate-series-1) 0 2px, color-mix(in srgb, var(--climate-series-1) 18%, transparent) 2px 5px);
    outline: 1px solid var(--climate-series-1);
}
.aurora-swatch--night { background: var(--aurora-night); outline: 1px solid var(--pico-muted-border-color); }
.aurora-swatch--storm { background: var(--climate-series-2); }

.aurora-hours td,
.aurora-hours th {
    vertical-align: middle;
}

.aurora-hours__night th {
    background: var(--pico-card-sectioning-background-color);
    font-size: 0.85rem;
}

.aurora-hours__alert td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
    font-weight: 700;
}

.aurora-subheading {
    margin: 1rem 0 0.4rem;
    font-size: 1rem;
}

.aurora-alerts {
    margin: 0;
    padding: 0;
}

.aurora-alerts li {
    list-style: none;
    margin: 0 0 0.35rem;
}

.aurora-alerts summary {
    cursor: pointer;
    font-size: 0.9rem;
}

.aurora-alerts__message {
    margin: 0.4rem 0 0;
    padding: 0.6rem;
    font-size: 0.78rem;
    white-space: pre-wrap;
    background: var(--pico-card-sectioning-background-color);
    border-radius: var(--pico-border-radius);
}

.aurora-magnetometer {
    display: block;
    width: 100%;
    max-width: 860px;
    height: auto;
    border-radius: var(--pico-border-radius);
    background: #fff; /* the observatory's GIF is drawn on white */
}

.aurora-explain details {
    margin: 0 0 0.5rem;
}

.aurora-explain summary {
    cursor: pointer;
    font-weight: 600;
}

.aurora-explain p {
    margin: 0.4rem 0 0.6rem;
    line-height: 1.55;
}

.aurora-settings__fields {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    align-items: start;
}

.aurora-settings__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.6rem;
}

.aurora-settings__test {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}
