:root {
    /* Nattläge */
    --bg: #05080f;
    --panel: rgba(10,16,28,0.22);
    --panel-2: rgba(10,16,28,0.60);
    --text: #f8fafc;
    --muted: #94a3b8;
    --muted-2: #64748b;
    --track: rgba(79,142,247,0.20);
    --track-strong: rgba(79,142,247,0.28);
    --blue: #5a97f8;
    --orange: #f59e0b;
    --red: #ef4444;
    --green: #22c55e;
    --card-radius: 22px;
    --border: transparent;

    /* Viktiga justeringspunkter */
    --ring-size: min(78vh, 78vw, 620px); /* Battericirkel + vänster/höger kolumnhöjd */
    --side-stack-gap: 0px;               /* Mellanrum mellan vänster övre/nedre graf */
    --market-strip-h: 110px;             /* Höjd på spot/kostnadsrad */
}

html { color-scheme: dark; }
* { box-sizing: border-box; }

html, body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Titillium Web", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    overflow: hidden;
    user-select: none;
}

body {
    background:
        radial-gradient(1200px 600px at 50% 20%, rgba(79,142,247,0.08), transparent 60%),
        radial-gradient(900px 550px at 18% 78%, rgba(16,185,129,0.035), transparent 60%),
        #05080f;
}

#app {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
    padding:
        max(10px, env(safe-area-inset-top))
        max(10px, env(safe-area-inset-right))
        max(10px, env(safe-area-inset-bottom))
        max(10px, env(safe-area-inset-left));
}

/* TOPBAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 16px;
    background: rgba(10,16,28,0.14);
    backdrop-filter: blur(12px);
    box-shadow: none;
    border: none !important;
    position: relative;
    z-index: 3000;
    overflow: visible;
    isolation: isolate;
}
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* MENU */
.menu-wrap { position: relative; z-index: 3100; }

.menu-trigger {
    border: none !important;
    background: rgba(10,16,28,0.52);
    color: #fff;
    border-radius: 14px;
    width: 44px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: transform .14s ease, background .2s ease;
}
.menu-trigger:hover { transform: translateY(-1px); }
.menu-trigger.open { background: rgba(79,142,247,0.16); }

.menu-trigger-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}
.menu-trigger-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 250px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(10,16,28,0.88);
    backdrop-filter: blur(16px);
    box-shadow: 0 16px 44px rgba(0,0,0,.28);
    border: none !important;
    z-index: 3200;
    display: grid;
    gap: 6px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.985);
    transform-origin: top left;
    transition:
        opacity .18s ease,
        transform .20s cubic-bezier(.2,.8,.2,1),
        visibility 0s linear .20s;
}
.menu-panel.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity .18s ease,
        transform .20s cubic-bezier(.2,.8,.2,1),
        visibility 0s linear 0s;
}

.menu-item {
    width: 100%;
    border: none !important;
    background: transparent;
    color: var(--text);
    border-radius: 12px;
    min-height: 44px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    font-size: 15px;
    transition: background .15s ease, transform .12s ease;
}
.menu-item:hover {
    background: rgba(79,142,247,0.10);
    transform: translateX(1px);
}
.menu-item.active { background: rgba(79,142,247,0.14); }

.menu-item-icon {
    width: 18px;
    height: 18px;
    color: #fff;
    display: inline-block;
}
.menu-item-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Clock */
.clock {
    font-size: clamp(22px, 2.4vw, 22px);
    line-height: 1;
    color: #fff;
    padding: 0 10px;
    min-width: 320px;
    text-align: right;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Views */
.view {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.view.active { display: block; }

/* Dashboard layout */
#view-dashboard {
    display: grid;
    grid-template-columns: 1.08fr 1.55fr 1.08fr;
    gap: 10px;
    min-height: 0;
    align-items: center;
}

.col {
    display: grid;
    min-height: 0;
}

/* Vänster kolumn = exakt battericirkelns höjd */
.left-col {
    height: var(--ring-size);
    gap: var(--side-stack-gap);
    grid-template-rows:
        calc((var(--ring-size) - var(--side-stack-gap)) / 2)
        calc((var(--ring-size) - var(--side-stack-gap)) / 2);
    align-content: start;
    align-self: center;
    transform: translateY(calc(var(--market-strip-h) * -0.5));
}

/* Mittenkolumn = battericirkel + market-strip */
.center-col {
    gap: 8px;
    grid-template-rows: var(--ring-size) var(--market-strip-h);
    align-content: start;
    align-self: center;
}

/* Höger kolumn = exakt battericirkelns höjd */
.right-col {
    height: var(--ring-size);
    gap: 0;
    grid-template-rows: var(--ring-size);
    align-content: start;
    align-self: center;
    transform: translateY(calc(var(--market-strip-h) * -0.5));
}

/* Lean panels */
.panel {
    position: relative;
    background: transparent;
    border-radius: var(--card-radius);
    backdrop-filter: blur(6px);
    box-shadow: none;
    border: none !important;
    overflow: hidden;
}

/* Side panels */
.side-panel { min-height: 0; }

.side-panel-inner {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 152px 1fr;
    align-items: center;
    padding: 8px 14px 14px 10px; /* extra bottom padding så grafer inte kapas */
    gap: 8px;
    overflow: visible !important;
}

.side-panel-right .side-panel-inner {
    grid-template-columns: 1fr 152px;
    padding: 8px 10px 14px 14px; /* extra bottom padding */
}


.side-gauge-wrap,
.side-panel-right .side-gauge-wrap {
    position: relative;
    width: 152px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible !important;
}


.side-svg {
    width: 146px;
    height: 100%;
    overflow: visible !important;
}
.side-svg-half { width: 146px; max-height: none; }
.side-svg-tall { width: 146px; max-height: none; }

/* Curves / gauges */
.phase-track,
.phase-fill,
.single-track,
.single-fill {
    fill: none;
    stroke-linecap: round;
}

/* Samma transparens på alla spår/fills */
.phase-track {
    stroke: rgba(79,142,247,0.35);
    opacity: 1;
}
.phase-fill {
    stroke: var(--blue);
    opacity: 1;
}
.phase-track.track1,
.phase-track.track2,
.phase-track.track3,
.phase-fill.phase1,
.phase-fill.phase2,
.phase-fill.phase3 {
    stroke-width: 9px;
}

/* Sol */
.single-track.solar-track {
    stroke: rgba(79,142,247,0.35);
    stroke-width: 9px;
    opacity: 1;
}
.single-fill.solar-fill {
    stroke: var(--blue);
    stroke-width: 9px;
    opacity: 1;
}

/* Nät-faser: fallback (JS sätter även inline stroke direkt för garanterat färgbyte) */
#gridGaugeSvg .phase-fill.is-import { stroke: #ef4444 !important; }
#gridGaugeSvg .phase-fill.is-export { stroke: #22c55e !important; }
#gridGaugeSvg .phase-fill.is-neutral { stroke: #5a97f8 !important; }

.phase-index {
    font-size: 13px;
    fill: #fff;
    opacity: 1;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* Side text */
.side-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.side-panel-right .side-text {
    text-align: right;
    align-items: flex-end;
    gap: 8px; /* tighter så detaljlistan ryms bättre */
}

.big-power-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.side-panel-right .big-power-row { justify-content: flex-end; }

.dir-arrow {
    font-size: 18px;
    color: var(--blue);
    line-height: 1;
    margin-right: 2px;
    transition: transform .15s ease, color .15s ease;
}
.dir-arrow.export {
    transform: rotate(180deg);
    color: var(--green);
}
.dir-arrow.import { color: var(--red); }
.dir-arrow.neutral { color: var(--blue); }

.big-power {
    font-weight: 300;
    font-size: clamp(40px, 5vw, 70px);
    line-height: .95;
    letter-spacing: -0.03em;
}
.big-power .unit {
    font-size: .75em;
    color: var(--muted);
    opacity: 1;
    margin-left: 0.14em;   /* mellanrum mellan värde och W/kW */
    display: inline-block;
}

/* Nät = lite mindre */
#panel-grid .big-power {
    font-size: clamp(34px, 4.4vw, 58px);
}

.inline-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
    color: #fff;
    flex: 0 0 auto;
}
.inline-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.clickable {
    cursor: pointer;
    transition: opacity .15s ease, transform .12s ease;
}
.clickable:hover {
    opacity: .95;
    transform: translateY(-1px);
}

/* Battery panel */

.battery-icon-vertical {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-90deg);
    transform-origin: center center;
}
.battery-icon-vertical svg {
    display: block;
}

.battery-panel {
    display: grid;
    place-items: center;
    min-height: 0;
    height: var(--ring-size);
    align-self: start;
    padding: 0;
}
.battery-wrap {
    position: relative;
    width: var(--ring-size);
    height: var(--ring-size);
    display: grid;
    place-items: center;
    max-width: 100%;
    max-height: 100%;
}
.battery-ring-svg {
    width: var(--ring-size);
    height: var(--ring-size);
    max-width: 100%;
    max-height: 100%;
}
.battery-ring-track {
    fill: none;
    stroke: var(--track-strong);
    stroke-width: 16;
}
.battery-ring-fill {
    fill: none;
    stroke: var(--blue);
    stroke-width: 16;
    stroke-linecap: round;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
    transition: stroke .2s ease;
}
.battery-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}
.battery-center-inner {
    text-align: center;
    pointer-events: auto;
    width: 72%;
}
.battery-title {
    color: #fff;
    font-size: clamp(18px, 1.9vw, 30px);
    font-weight: 400;
    opacity: .95;
    margin-bottom: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding-right:20px;
}
.battery-value {
    font-size: clamp(70px, 10vw, 132px);
    line-height: .85;
    letter-spacing: -0.05em;
    font-weight: 300;
    margin: 4px 0 12px;
    white-space: nowrap;
}
#batteryValueText {
    max-width: 100%;
    white-space: nowrap;
    display: inline-block;
}
.battery-value .pct-sign {
	color: var(--muted);
	padding-left:6px;
}
.battery-secondary {
    font-size: clamp(18px, 2.1vw, 34px);
    color: var(--muted);
    margin-top: 0;
    line-height: 1.05;
    letter-spacing: -0.01em;
}
.battery-secondary .unit-dim { color: var(--muted-2); }
.battery-eta {
    font-size: clamp(14px, 1.5vw, 24px);
    color: var(--muted);
    margin-top: 8px;
}

/* Market strip */
.market-panel {
    margin-top: 0;
    height: var(--market-strip-h);
    min-height: 0;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
    background: transparent;
    box-shadow: none;
}

.metric-card {
    background: rgba(10,16,28,0.22);
    border-radius: 16px;
    padding: 10px 12px;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    box-shadow: none;
    border: none !important;
}
.metric-label {
    font-size: 12px;
    color: var(--muted);
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.market-label-text {
    color: #fff;
    text-transform: lowercase;
    letter-spacing: .02em;
}
.market-icon-label { color: #fff; }
.market-icon-shell {
    width: 14px;
    height: 14px;
    display: inline-block;
}
.market-icon-shell svg {
    width: 100%;
    height: 100%;
    display: block;
}
#gridRateIconLabel.export svg { transform: scaleX(-1); }
#gridRateIconLabel.import svg { transform: none; }

.metric-value {
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.metric-value.small { font-size: 20px; }
.metric-value .unit {
    margin-left: 0.14em;
    display: inline-block;
}

#solarMaxText { display: none; }

/* House breakdown (alltid synlig nu) */
.house-breakdown {
    display: block;
    width: 100%;
    max-width: 430px;
    margin-left: auto;
    margin-top: 4px;
}

.rows {
    display: grid;
    gap: 10px;
}

.row {
    display: grid;
    grid-template-columns: 82px 1fr auto;
    gap: 10px;
    align-items: start;
}

.row .name {
    font-size: 16px;
    color: var(--text);
    line-height: 1.15;
    padding-top: 2px;
}

.row-mid {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(79,142,247,0.18);
    overflow: hidden;
}

.bar > span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--blue);
    border-radius: 999px;
    transition: width .25s ease;
}

.row-sub {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .95;
}

.row .val {
    min-width: 116px;
    text-align: right;
    color: var(--muted);
    display: grid;
    gap: 2px;
    align-items: start;
    line-height: 1.05;
}

.row .val .w {
    color: var(--text);
    font-size: 14px;
}

.row .val .a {
    color: var(--muted);
    font-size: 12px;
}

/* Placeholder views */
.placeholder-view {
    height: 100%;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: blur(6px);
    padding: 18px;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    border: none !important;
}
.placeholder-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.placeholder-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, 1fr);
    align-content: start;
}
.placeholder-card {
    min-height: 120px;
    border-radius: 16px;
    background: rgba(10,16,28,0.16);
    padding: 12px;
    color: var(--muted);
    box-shadow: none;
    border: none !important;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 18px;
}
.modal {
    width: min(980px, 95vw);
    max-height: 90vh;
    overflow: auto;
    background: rgba(10,16,28,0.76);
    border-radius: 22px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.35);
    backdrop-filter: blur(16px);
    padding: 14px;
    border: none !important;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.modal-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.close-btn {
    border: none !important;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
}

.price-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.price-summary .metric-card { min-height: 64px; }

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.price-table th,
.price-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    text-align: left;
    vertical-align: middle;
}
.price-table th {
    position: sticky;
    top: 0;
    background: rgba(10,16,28,0.86);
    z-index: 1;
}
.price-bar {
    height: 8px;
    background: rgba(79,142,247,0.18);
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
}
.price-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--blue);
    border-radius: 999px;
}

.mono {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-family: "Titillium Web", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* FIX: kapa inte båg-grafernas nederkant */
.side-panel,
.side-panel-right,
.side-panel-inner,
.side-gauge-wrap,
.side-svg {
    overflow: visible !important;
}

/* Responsive fallback */
@media (max-width: 1200px) {
    :root {
        --market-strip-h: 104px;
        --side-stack-gap: 4px;
    }

    #view-dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        overflow: auto;
        align-items: start;
    }

    .left-col,
    .right-col,
    .center-col {
        transform: none !important;
        height: auto;
    }

    .left-col { grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr); }
    .center-col { grid-template-rows: auto auto; }
    .right-col { grid-template-rows: minmax(360px, 1fr); }

    .side-panel-inner,
    .side-panel-right .side-panel-inner {
        grid-template-columns: 144px 1fr;
        padding: 10px 10px 14px 10px;
    }

    .side-panel-right .side-text {
        text-align: left;
        align-items: flex-start;
    }

    .side-gauge-wrap,
    .side-panel-right .side-gauge-wrap { width: 144px; }

    .side-svg,
    .side-svg-half,
    .side-svg-tall {
        width: 136px;
        max-height: none;
    }

    .battery-panel {
        height: auto;
        min-height: 320px;
        padding: 8px 0;
    }
    .battery-wrap {
        width: min(88vw, 520px);
        height: min(88vw, 520px);
    }
    .battery-ring-svg {
        width: min(88vw, 520px);
        height: min(88vw, 520px);
    }

    .clock {
        min-width: 0;
        font-size: clamp(18px, 4vw, 26px);
    }
}

/* =========================================================
   WEATHER STRIP + MODAL (lägg längst ner i hub.css)
   ========================================================= */

:root {
    --wx-bg: rgba(12, 18, 28, 0.44);
    --wx-bg-2: rgba(255,255,255,0.04);
    --wx-border: rgba(255,255,255,0.08);
    --wx-text: #ffffff;
    --wx-muted: rgba(255,255,255,0.62);
    --wx-muted-2: rgba(255,255,255,0.42);
    --wx-shadow: 0 12px 36px rgba(0,0,0,0.35);
}

/* === Kompakt väderrad i topbar === */
.top-weather {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: min(58vw, 820px);
    padding: 6px 10px 6px 10px;
    border-radius: 14px;
    background: var(--wx-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 50;
    transition: transform .18s ease, background-color .18s ease;
}
.top-weather:hover {
    transform: translateY(-1px);
    background: rgba(12, 18, 28, 0.52);
}
.top-weather:focus-visible {
    outline: 2px solid rgba(255,255,255,0.2);
    outline-offset: 2px;
}

.wx-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
    padding-right: 8px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.wx-icon {
    width: 18px;
    height: 18px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.wx-icon svg { width: 100%; height: 100%; display: block; }

.wx-temp {
    color: #fff;
    font-size: 18px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.wx-text {
    color: var(--wx-muted);
    font-size: 14px;
    line-height: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.wx-days {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.wx-day {
    min-width: 78px;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    display: grid;
    grid-template-columns: 14px 1fr;
    grid-template-rows: auto auto;
    column-gap: 5px;
    row-gap: 1px;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.02);
}

.wx-day .d-icon {
    grid-row: 1 / span 2;
    width: 20px;
    height: 20px;
    color: #fff;
}
.wx-day .d-icon svg { width: 100%; height: 100%; display: block; }

.wx-day .d-name {
    font-size: 13px;
    color: var(--wx-muted);
    line-height: 1;
    text-transform: lowercase;
}

.wx-day .d-temp {
    font-size: 13px;
    color: #fff;
    line-height: 1.15;
    white-space: nowrap;
}

/* "boll med två punkter" */
.wx-more-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    cursor: pointer;
    transition: transform .16s ease, background-color .16s ease;
}
.wx-more-btn:hover {
    transform: scale(1.04);
    background: rgba(255,255,255,0.08);
}
.wx-more-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.2);
    outline-offset: 2px;
}
.wx-more-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 999px;
    opacity: 0.95;
}
.wx-more-dot.dot1 { transform: translate(-4px, 0); }
.wx-more-dot.dot2 { transform: translate(4px, 0); }

/* === Vädermodal === */
.weather-modal {
    position: fixed;
    inset: 0;
    z-index: 5000; /* över dropdown + kort */
    display: block;
}
.weather-modal[hidden] {
    display: none !important;
}

.weather-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: wxFadeIn .18s ease;
}

.weather-modal__panel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(1100px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    transform: translate(-50%, -50%);
    border-radius: 22px;
    background: rgba(10, 14, 22, 0.92);
    border: 1px solid var(--wx-border);
    box-shadow: var(--wx-shadow);
    overflow: auto;
    padding: 16px;
    animation: wxPopIn .2s ease;
}

.weather-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.weather-modal__titlewrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.weather-modal__icon {
    width: 22px;
    height: 22px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.weather-modal__icon svg { width: 100%; height: 100%; display: block; }

.weather-modal__title {
    color: #fff;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 600;
}
.weather-modal__subtitle {
    color: var(--wx-muted);
    font-size: 12px;
    margin-top: 2px;
}

.weather-modal__close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.weather-modal__close:hover {
    background: rgba(255,255,255,0.09);
}

.weather-modal__current {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
}
.weather-modal__current-temp {
    grid-row: 1 / span 2;
    font-size: 36px;
    color: #fff;
    letter-spacing: -0.02em;
}
.weather-modal__current-text {
    color: #fff;
    font-size: 15px;
    line-height: 1.15;
}
.weather-modal__current-meta {
    color: var(--wx-muted);
    font-size: 12px;
    line-height: 1.2;
}

.weather-modal__grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.wx-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 12px;
}
.wx-card__title {
    color: #fff;
    font-size: 13px;
    margin-bottom: 8px;
    opacity: 0.95;
}

/* Timprognos */
.wx-hourly {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
}
.wx-hour {
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 8px;
    text-align: center;
}
.wx-hour__time {
    color: var(--wx-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.wx-hour__icon {
    width: 16px;
    height: 16px;
    color: #fff;
    margin: 0 auto 4px;
}
.wx-hour__icon svg { width: 100%; height: 100%; display: block; }
.wx-hour__temp {
    color: #fff;
    font-size: 13px;
    line-height: 1.1;
}
.wx-hour__wind {
    color: var(--wx-muted-2);
    font-size: 10px;
    margin-top: 3px;
    line-height: 1.1;
}

/* Daglista */
.wx-daily-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wx-daily-row {
    display: grid;
    grid-template-columns: 52px 18px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}
.wx-daily-row__day {
    color: var(--wx-muted);
    font-size: 12px;
    text-transform: lowercase;
}
.wx-daily-row__icon {
    width: 16px;
    height: 16px;
    color: #fff;
}
.wx-daily-row__icon svg { width: 100%; height: 100%; display: block; }
.wx-daily-row__text {
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wx-daily-row__precip {
    color: var(--wx-muted);
    font-size: 11px;
    white-space: nowrap;
}
.wx-daily-row__temps {
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
}

/* Varningar */
.wx-card--warnings .wx-card__title {
    margin-bottom: 10px;
}
.wx-warnings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wx-warning {
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
}
.wx-warning--none {
    color: var(--wx-muted);
    font-size: 12px;
    text-align: center;
    padding: 14px;
}
.wx-warning__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.wx-warning__badge {
    display: inline-flex;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
}
.wx-warning__badge--yellow { background: #d4b000; }
.wx-warning__badge--orange { background: #d97a00; }
.wx-warning__badge--red    { background: #d9485a; }
.wx-warning__badge--info   { background: rgba(255,255,255,0.7); }

.wx-warning__title {
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
}
.wx-warning__meta {
    color: var(--wx-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.wx-warning__desc {
    color: rgba(255,255,255,0.82);
    font-size: 12px;
    line-height: 1.25;
}
.wx-warning__link {
    display: inline-block;
    margin-top: 5px;
    color: rgba(255,255,255,0.82);
    font-size: 11px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.wx-warning__link:hover {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.28);
}


/* =========================================================
   WEATHER STRIP + MODAL + RADAR TAB (lägg längst ner)
   ========================================================= */

:root {
    --wx-bg: rgba(12, 18, 28, 0.44);
    --wx-bg-2: rgba(255,255,255,0.04);
    --wx-border: rgba(255,255,255,0.08);
    --wx-text: #ffffff;
    --wx-muted: rgba(255,255,255,0.62);
    --wx-muted-2: rgba(255,255,255,0.42);
    --wx-shadow: 0 12px 36px rgba(0,0,0,0.35);
}

/* ===== Enhetssuffix (W/kW) spacing ===== */
.unit {
    margin-left: 0.18em;
    color: #7f8793;
}

/* ===== Batteriikon upprätt ===== */
.battery-icon-vertical {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-90deg);
    transform-origin: center center;
}
.battery-icon-vertical svg {
    display: block;
}

/* === Kompakt väderrad i topbar === */
.top-weather {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: min(58vw, 820px);
    padding: 6px 10px 6px 10px;
    border-radius: 14px;
    background: var(--wx-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 50;
    transition: transform .18s ease, background-color .18s ease;
}
.top-weather:hover {
    transform: translateY(-1px);
    background: rgba(12, 18, 28, 0.52);
}
.top-weather:focus-visible {
    outline: 2px solid rgba(255,255,255,0.2);
    outline-offset: 2px;
}

.wx-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
    padding-right: 8px;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.wx-icon {
    width: 18px;
    height: 18px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    position: relative;
}
.wx-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: center;
}

/* Subtila ikonanimationer (topbar) */
.wx-icon.is-rain::before,
.wx-icon.is-rain::after,
.wx-icon.is-snow::before,
.wx-icon.is-snow::after {
    content: "";
    position: absolute;
    width: 2.2px;
    height: 2.2px;
    background: rgba(255,255,255,0.95);
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
}

/* regn */
.wx-icon.is-rain::before {
    left: 5px;
    top: 12px;
    animation: wxRainDrop 1.2s linear infinite;
}
.wx-icon.is-rain::after {
    left: 11px;
    top: 12px;
    animation: wxRainDrop 1.2s linear infinite .45s;
}

/* snö */
.wx-icon.is-snow::before {
    left: 6px;
    top: 12px;
    animation: wxSnowDrop 1.8s ease-in-out infinite;
}
.wx-icon.is-snow::after {
    left: 11px;
    top: 12px;
    animation: wxSnowDrop 1.8s ease-in-out infinite .7s;
}

/* extra liv för storm */
.wx-icon.is-storm svg {
    animation: wxPulse 1.8s ease-in-out infinite;
}

@keyframes wxRainDrop {
    0%   { transform: translate(0,0); opacity: 0; }
    15%  { opacity: .95; }
    80%  { opacity: .8; }
    100% { transform: translate(-1px, 7px); opacity: 0; }
}
@keyframes wxSnowDrop {
    0%   { transform: translate(0,0); opacity: 0; }
    10%  { opacity: .9; }
    50%  { transform: translate(1.6px, 3px); opacity: .85; }
    100% { transform: translate(-1.2px, 7px); opacity: 0; }
}
@keyframes wxPulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: .92; }
}

.wx-temp {
    color: #fff;
    font-size: 18px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.wx-text {
    color: var(--wx-muted);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.wx-days {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.wx-day {
    min-width: 78px;
    padding: 4px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    display: grid;
    grid-template-columns: 14px 1fr;
    grid-template-rows: auto auto;
    column-gap: 5px;
    row-gap: 1px;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.02);
}

.wx-day .d-icon {
    grid-row: 1 / span 2;
    width: 14px;
    height: 14px;
    color: #fff;
}
.wx-day .d-icon svg { width: 100%; height: 100%; display: block; }

.wx-day .d-name {
    font-size: 11px;
    color: var(--wx-muted);
    line-height: 1;
    text-transform: lowercase;
}

.wx-day .d-temp {
    font-size: 11px;
    color: #fff;
    line-height: 1.15;
    white-space: nowrap;
}

/* "boll med två punkter" */
.wx-more-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    cursor: pointer;
    transition: transform .16s ease, background-color .16s ease;
}
.wx-more-btn:hover {
    transform: scale(1.04);
    background: rgba(255,255,255,0.08);
}
.wx-more-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.2);
    outline-offset: 2px;
}
.wx-more-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 999px;
    opacity: 0.95;
}
.wx-more-dot.dot1 { transform: translate(-4px, 0); }
.wx-more-dot.dot2 { transform: translate(4px, 0); }

/* === Vädermodal === */
.weather-modal {
    position: fixed;
    inset: 0;
    z-index: 5000; /* över dropdown + kort */
    display: block;
}
.weather-modal[hidden] {
    display: none !important;
}

.weather-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: wxFadeIn .18s ease;
}

.weather-modal__panel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(1100px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    transform: translate(-50%, -50%);
    border-radius: 22px;
    background: rgba(10, 14, 22, 0.92);
    border: 1px solid var(--wx-border);
    box-shadow: var(--wx-shadow);
    overflow: auto;
    padding: 16px;
    animation: wxPopIn .2s ease;
}

.weather-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.weather-modal__titlewrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.weather-modal__icon {
    width: 22px;
    height: 22px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.weather-modal__icon svg { width: 100%; height: 100%; display: block; }

.weather-modal__title {
    color: #fff;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 600;
}
.weather-modal__subtitle {
    color: var(--wx-muted);
    font-size: 12px;
    margin-top: 2px;
}

.weather-modal__close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.weather-modal__close:hover {
    background: rgba(255,255,255,0.09);
}

.weather-modal__current {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
}
.weather-modal__current-temp {
    grid-row: 1 / span 2;
    font-size: 36px;
    color: #fff;
    letter-spacing: -0.02em;
}
.weather-modal__current-text {
    color: #fff;
    font-size: 15px;
    line-height: 1.15;
}
.weather-modal__current-meta {
    color: var(--wx-muted);
    font-size: 12px;
    line-height: 1.2;
}

/* === Tabs === */
.wx-tabs {
    display: inline-flex;
    gap: 6px;
    margin-bottom: 12px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
}
.wx-tab {
    border: none;
    background: transparent;
    color: var(--wx-muted);
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color .14s ease, color .14s ease, transform .14s ease;
}
.wx-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.wx-tab.is-active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.wx-tabpanel {
    display: none;
}
.wx-tabpanel.is-active {
    display: block;
}

.weather-modal__grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.wx-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 12px;
}
.wx-card__title {
    color: #fff;
    font-size: 13px;
    margin-bottom: 8px;
    opacity: 0.95;
}

/* Timprognos */
.wx-hourly {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
}
.wx-hour {
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    padding: 8px;
    text-align: center;
}
.wx-hour__time {
    color: var(--wx-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.wx-hour__icon {
    width: 16px;
    height: 16px;
    color: #fff;
    margin: 0 auto 4px;
}
.wx-hour__icon svg { width: 100%; height: 100%; display: block; }
.wx-hour__temp {
    color: #fff;
    font-size: 13px;
    line-height: 1.1;
}
.wx-hour__wind {
    color: var(--wx-muted-2);
    font-size: 10px;
    margin-top: 3px;
    line-height: 1.1;
}

/* Daglista */
.wx-daily-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wx-daily-row {
    display: grid;
    grid-template-columns: 52px 18px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}
.wx-daily-row__day {
    color: var(--wx-muted);
    font-size: 12px;
    text-transform: lowercase;
}
.wx-daily-row__icon {
    width: 16px;
    height: 16px;
    color: #fff;
}
.wx-daily-row__icon svg { width: 100%; height: 100%; display: block; }
.wx-daily-row__text {
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wx-daily-row__precip {
    color: var(--wx-muted);
    font-size: 11px;
    white-space: nowrap;
}
.wx-daily-row__temps {
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
}

/* Varningar – tydligare färger */
.wx-card--warnings .wx-card__title {
    margin-bottom: 10px;
}
.wx-warnings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wx-warning {
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
    border-left-width: 4px;
}
.wx-warning--none {
    color: var(--wx-muted);
    font-size: 12px;
    text-align: center;
    padding: 14px;
    border-left-width: 1px;
}
.wx-warning__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.wx-warning__badge {
    display: inline-flex;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.03);
}
.wx-warning__title {
    color: #fff;
    font-size: 13px;
    line-height: 1.2;
}
.wx-warning__meta {
    color: var(--wx-muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.wx-warning__desc {
    color: rgba(255,255,255,0.84);
    font-size: 12px;
    line-height: 1.25;
}
.wx-warning__link {
    display: inline-block;
    margin-top: 5px;
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.14);
}
.wx-warning__link:hover {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.3);
}

/* nivåfärger */
.wx-warning--yellow {
    border-left-color: #d8b400;
    background: linear-gradient(90deg, rgba(216,180,0,.12) 0%, rgba(255,255,255,.02) 26%);
}
.wx-warning--yellow .wx-warning__badge { background: #e5c200; }

.wx-warning--orange {
    border-left-color: #df7e00;
    background: linear-gradient(90deg, rgba(223,126,0,.13) 0%, rgba(255,255,255,.02) 26%);
}
.wx-warning--orange .wx-warning__badge { background: #f08a00; }

.wx-warning--red {
    border-left-color: #df405c;
    background: linear-gradient(90deg, rgba(223,64,92,.13) 0%, rgba(255,255,255,.02) 26%);
}
.wx-warning--red .wx-warning__badge { background: #ef4b6a; }

.wx-warning--info {
    border-left-color: rgba(255,255,255,0.35);
}
.wx-warning--info .wx-warning__badge {
    background: rgba(255,255,255,0.75);
}

/* === Radar tab === */
.wx-radar-card {
    padding-bottom: 10px;
}
.wx-radar-wrap {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.05);
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
}
.wx-radar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #0b1019;
}
.wx-radar-meta {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.wx-radar-btn {
    border: none;
    background: rgba(255,255,255,0.06);
    color: #fff;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
}
.wx-radar-btn:hover {
    background: rgba(255,255,255,0.1);
}
.wx-radar-link {
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.16);
}
.wx-radar-link:hover {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.28);
}
.wx-radar-note {
    margin-top: 8px;
    color: var(--wx-muted);
    font-size: 11px;
    line-height: 1.25;
}


/* Batteri: ikon + "Batteri" ska ligga OVANFÖR procenttalet */
.battery-center-inner{
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
}

/* Titelrad (ikon + text) */
.battery-title{
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;

    position: static !important;     /* viktigt: stoppar absolute */
    inset: auto !important;
    transform: none !important;

    margin: 0 0 2px 0 !important;
    line-height: 1 !important;
    order: 1 !important;
}

/* Procenttalet under titeln */
#batteryValueText,
.battery-value{
    order: 2 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* V/A-raden */
#batteryVoltAmpText,
.battery-secondary{
    order: 3 !important;
    margin: 0 !important;
}

/* ETA-raden */
#batteryEtaText,
.battery-eta{
    order: 4 !important;
    margin: 0 !important;
}

@keyframes wxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes wxPopIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.985); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1200px) {
    .top-weather {
        max-width: 100%;
        gap: 8px;
    }
    .wx-text { display: none; } /* sparar plats */
    .wx-day { min-width: 70px; }
    .weather-modal__grid {
        grid-template-columns: 1fr;
    }
    .wx-hourly {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
}

@media (max-width: 900px) {
    .wx-days .wx-day:nth-child(n+3) { display: none; }
    .wx-hourly {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}



@keyframes wxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes wxPopIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.985); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 1200px) {
    .top-weather {
        max-width: 100%;
        gap: 8px;
    }
    .wx-text { display: none; } /* sparar plats */
    .wx-day { min-width: 70px; }
    .weather-modal__grid {
        grid-template-columns: 1fr;
    }
    .wx-hourly {
        grid-template-columns: repeat(3, minmax(0,1fr));
    }
}

@media (max-width: 900px) {
    .wx-days .wx-day:nth-child(n+3) { display: none; }
    .wx-hourly {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}


@media (prefers-reduced-motion: reduce) {
    .menu-panel,
    .menu-trigger,
    .menu-item,
    .clickable,
    .bar > span {
        transition: none !important;
    }
}

/* ===== Market panel: kostnad/intäkt per fas ===== */

.metric-card-cost {
    min-width: 0;
}

#costNowText.is-expense {
    color: #ef4444; /* röd */
}

#costNowText.is-income {
    color: #22c55e; /* grön */
}

#costNowText.is-neutral {
    color: inherit;
}

.market-phase-breakdown {
    margin-top: 6px;
    display: grid;
    gap: 3px;
    font-size: 0.86rem;
    line-height: 1.15;
    opacity: 0.98;
}

.market-phase-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    white-space: nowrap;
}

.market-phase-row .phase-name {
    opacity: 0.9;
}

.market-phase-row .phase-val {
    font-variant-numeric: tabular-nums;
}

.market-phase-row.is-buy .phase-val {
    color: #ef4444; /* kostnad */
}

.market-phase-row.is-sell .phase-val {
    color: #22c55e; /* inkomst */
}

.market-phase-row.is-zero .phase-val {
    opacity: 0.8;
}

.price-group-row td {
    padding-top: 10px;
    padding-bottom: 6px;
    opacity: 0.95;
    border-top: 1px solid rgba(255,255,255,0.08);
}


/* Market panel - fasuppdelning */
.market-phase-breakdown {
    margin-top: 6px;
    display: grid;
    gap: 3px;
    font-size: .82rem;
    line-height: 1.15;
    opacity: .98;
}

.market-phase-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.market-phase-row .phase-name {
    opacity: .85;
}

.market-phase-row .phase-val {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}

.market-phase-row.is-buy .phase-val {
    color: #ef4444; /* kostnad */
}

.market-phase-row.is-sell .phase-val {
    color: #22c55e; /* inkomst */
}

.market-phase-row.is-zero .phase-val {
    color: rgba(255,255,255,.65);
}

#costNowText.is-expense { color: #ef4444; }
#costNowText.is-income  { color: #22c55e; }
#costNowText.is-neutral { color: inherit; }

/* Valfritt: grupp-rader i pris-tabellens modal */
.price-table .group-row td {
    background: rgba(255,255,255,.04);
    color: rgba(255,255,255,.9);
    font-weight: 600;
    border-top: 1px solid rgba(255,255,255,.12);
    border-bottom: 1px solid rgba(255,255,255,.08);
}