/* ================================================================
           HERO + TAB-NAVIGASJON
        ================================================================ */
        .stat-hero {
            background: linear-gradient(135deg, #0b1628 0%, #0f2444 55%, #0b1628 100%);
            margin: 0 -24px 0;
            padding: 40px 24px 0;
            position: relative;
            overflow: hidden;
        }
        /* Subtile lyspunkter i bakgrunnen */
        .stat-hero::before {
            content: '';
            position: absolute;
            inset: 0;
            background:
                radial-gradient(circle at 20% 50%, rgba(37,99,235,0.12) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139,92,246,0.08) 0%, transparent 40%);
            pointer-events: none;
        }
        .stat-hero-inner {
            max-width: 1100px;
            margin: 0 auto;
            position: relative;
        }
        .stat-breadcrumb {
            font-size: 0.85rem;
            color: rgba(255,255,255,0.5);
            margin-bottom: 20px;
        }
        .stat-breadcrumb a { color: rgba(255,255,255,0.6); text-decoration: none; }
        .stat-breadcrumb a:hover { color: rgba(255,255,255,0.9); }

        .stat-hero h1 {
            font-size: clamp(1.6rem, 3.5vw, 2.2rem);
            font-weight: 700;
            color: white;
            margin: 0 0 10px;
            letter-spacing: -0.03em;
        }
        .stat-hero-desc {
            font-size: 1rem;
            color: rgba(255,255,255,0.65);
            margin: 0 0 32px;
            max-width: 540px;
            line-height: 1.55;
            min-height: 2.4em;
            transition: opacity 0.2s;
        }
        .stat-hero-desc.byttes { opacity: 0; }

        /* Tab-rad – sitter i bunnen av heroen og er "koblet" til innholdet */
        .tab-row {
            display: flex;
            gap: 3px;
            overflow-x: auto;
            scrollbar-width: none;
            padding-bottom: 0;
            margin: 0 -4px;
            padding: 0 4px;
        }
        .tab-row::-webkit-scrollbar { display: none; }

        .tab-btn {
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 11px 18px 14px;
            border: none;
            border-radius: 10px 10px 0 0;
            cursor: pointer;
            font-family: inherit;
            font-size: 0.88rem;
            font-weight: 600;
            color: rgba(255,255,255,0.55);
            background: rgba(255,255,255,0.04);
            transition: color 0.15s, background 0.15s;
            white-space: nowrap;
            position: relative;
        }
        .tab-btn:hover {
            color: rgba(255,255,255,0.9);
            background: rgba(255,255,255,0.1);
        }
        .tab-btn.aktiv {
            background: #f8fafc;
            color: #0f172a;
            font-weight: 700;
        }
        /* Fargede prikker i toppen av aktiv tab */
        .tab-btn.aktiv::before {
            content: '';
            position: absolute;
            top: 6px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 3px;
            border-radius: 99px;
            background: var(--tab-farge, #2563eb);
        }
        .tab-btn .tab-ikon {
            font-size: 1.05rem;
            line-height: 1;
        }
        .tab-btn .tab-label { line-height: 1; }

        /* ================================================================
           INNHOLDS-WRAPPER
        ================================================================ */
        .stat-innhold {
            max-width: 1100px;
            margin: 0 auto;
            padding: 28px 0 56px;
        }

        /* Periode-filter */
        .periode-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }
        .periode-bar label {
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-muted);
            white-space: nowrap;
        }
        .periode-bar select {
            padding: 7px 12px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--surface);
            font-family: inherit;
            font-size: 0.88rem;
            cursor: pointer;
            color: var(--primary);
            max-width: 100%;
        }
        .periode-bar select:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
        }

        /* Sesjon-valg (én eller flere stortingssesjoner oktober–september) */
        .sesjon-bar {
            margin-bottom: 20px;
            padding: 14px 16px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
        }
        .sesjon-bar-label {
            display: block;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-muted);
            margin-bottom: 10px;
        }
        .sesjon-checkbox-gruppe {
            display: flex;
            flex-wrap: wrap;
            gap: 10px 18px;
            align-items: center;
            margin-bottom: 10px;
        }
        .sesjon-checkbox {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            font-size: 0.88rem;
            cursor: pointer;
            color: var(--primary);
            user-select: none;
        }
        .sesjon-checkbox input {
            accent-color: var(--accent);
            width: 16px;
            height: 16px;
            cursor: pointer;
        }
        .sesjon-handlinger {
            display: flex;
            gap: 14px;
            flex-wrap: wrap;
            margin-bottom: 8px;
        }
        .sesjon-lenke {
            background: none;
            border: none;
            padding: 0;
            font-family: inherit;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--accent);
            cursor: pointer;
            text-decoration: underline;
        }
        .sesjon-lenke:hover { color: var(--primary); }
        .sesjon-hint {
            font-size: 0.78rem;
            color: var(--text-muted);
            margin: 0;
            line-height: 1.45;
        }

        /* ================================================================
           TAB PANELS
        ================================================================ */
        .tab-panel { display: none; }
        .tab-panel.aktiv { display: block; animation: panelInn 0.22s ease; }
        @keyframes panelInn {
            from { opacity: 0; transform: translateY(10px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        /* Panel-kort */
        .panel-kort {
            background: var(--surface);
            border-radius: var(--radius);
            border: 1px solid var(--border);
            padding: 28px 32px;
            box-shadow: var(--shadow-sm);
        }

        /* Panel-header */
        .panel-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }
        .panel-header-venstre {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .panel-ikon-boks {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
            flex-shrink: 0;
        }
        .panel-tittel-gruppe h2 {
            margin: 0 0 3px;
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--primary);
        }
        .panel-tittel-gruppe .panel-undertittel {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin: 0;
        }
        .panel-header-hoyre {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        /* Info-knapp */
        .info-btn {
            background: none;
            border: 1px solid var(--border);
            border-radius: 50%;
            width: 26px; height: 26px;
            font-size: 0.8rem;
            cursor: pointer;
            color: var(--text-muted);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: border-color 0.15s, color 0.15s;
        }
        .info-btn:hover { border-color: var(--accent); color: var(--accent); }
        .formel-popup {
            display: none;
            margin: -12px 0 20px;
            padding: 14px 18px;
            background: var(--accent-soft);
            border-left: 3px solid var(--accent);
            border-radius: var(--radius-sm);
            font-size: 0.87rem;
            color: var(--primary);
            line-height: 1.65;
        }
        .formel-popup.open { display: block; }
        .formel-popup code {
            background: rgba(37,99,235,0.1);
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 0.84em;
        }

        /* Divider under header */
        .panel-divider {
            height: 1px;
            background: var(--border);
            margin: 0 0 24px;
        }

        /* ================================================================
           SKELETON / LOADING
        ================================================================ */
        .skeleton {
            background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
            border-radius: var(--radius-sm);
        }
        @keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
        .skeleton-bar  { height: 16px; margin: 10px 0; }
        .skeleton-linje { height: 52px; margin: 8px 0; border-radius: var(--radius-sm); }
        .loading-wrap { padding: 8px 0 4px; }

        .feil-melding {
            color: #b91c1c;
            font-size: 0.9rem;
            padding: 14px 16px;
            background: #fef2f2;
            border-radius: var(--radius-sm);
            border: 1px solid #fecaca;
        }

        /* ================================================================
           1. REBELL
        ================================================================ */
        .rebell-liste { display: flex; flex-direction: column; gap: 4px; }
        .rebell-rad {
            display: grid;
            grid-template-columns: 24px 1fr auto;
            align-items: center;
            gap: 12px;
            padding: 9px 10px;
            border-radius: 8px;
            transition: background 0.12s;
            cursor: default;
        }
        .rebell-rad:hover { background: #f8fafc; }
        .rebell-nr { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; text-align: right; }
        .rebell-info { min-width: 0; }
        .rebell-navn { font-size: 0.93rem; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; display: inline-block; max-width: 100%; }
        .rebell-navn:hover { text-decoration: underline; color: var(--accent); }
        .rebell-parti { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
        .rebell-mot-info { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
        .rebell-maaler {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 170px;
        }
        .rebell-bar-ute { flex: 1; height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
        .rebell-bar-inne { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
        .rebell-pct { font-size: 0.87rem; font-weight: 700; min-width: 38px; text-align: right; color: var(--primary); }
        .rebell-detalj { padding: 0 10px 8px 34px; }
        .rebell-detalj.skjult { display: none; }
        .rebell-detalj-innhold {
            border-left: 2px solid var(--border);
            margin-left: 2px;
            padding-left: 12px;
        }
        .rebell-sak-liste { display: flex; flex-direction: column; gap: 8px; }
        .rebell-sak-rad {
            background: #f8fafc;
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px 10px;
        }
        .rebell-sak-tittel a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
            font-size: 0.88rem;
        }
        .rebell-sak-tittel a:hover { text-decoration: underline; color: var(--accent); }
        .rebell-sak-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
        .rebell-detalj-laster,
        .rebell-detalj-tom,
        .rebell-detalj-feil { color: var(--text-muted); font-size: 0.85rem; padding: 8px 0; }

        /* ================================================================
           3. SNUOPERASJON
        ================================================================ */
        .snu-parti-chip {
            display: inline-block;
            padding: 3px 9px;
            border-radius: 99px;
            font-size: 0.78rem;
            font-weight: 700;
        }
        .snu-pct { font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
        .snu-pil { color: var(--text-muted); font-size: 1rem; text-align: center; }
        .snu-endring { font-weight: 700; font-size: 0.92rem; white-space: nowrap; }
        .snu-endring.opp { color: #15803d; }
        .snu-endring.ned { color: #b91c1c; }
        .snu-tom { text-align: center; color: var(--text-muted); padding: 40px; font-size: 0.9rem; }

        /* List-layout (erstatter tabell) */
        .snu-list { display: flex; flex-direction: column; }
        .snu-list-header,
        .snu-list-rad {
            display: grid;
            grid-template-columns: minmax(0,2fr) 76px minmax(0,2fr) 58px 20px 58px 70px 26px;
            align-items: center;
            gap: 8px;
            padding: 10px 12px;
        }
        .snu-list-header {
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            border-bottom: 2px solid var(--border);
        }
        .snu-list-rad {
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: background 0.12s;
        }
        .snu-list-rad:hover { background: #f8fafc; }
        .snu-list-rad.aapen { background: #eff6ff; border-bottom: none; }

        /* Chevron */
        .snu-chevron {
            font-size: 0.75rem;
            color: var(--text-muted);
            transition: transform 0.2s;
            justify-self: center;
        }
        .snu-list-rad.aapen .snu-chevron { transform: rotate(90deg); }

        /* Inline accordion */
        .snu-list-detalj {
            border-top: 2px solid var(--accent);
            border-bottom: 1px solid var(--border);
        }
        .snu-list-detalj.skjult { display: none; }

        /* Skjul mindre viktige kolonner på mobil */
        @media (max-width: 620px) {
            .snu-list-header,
            .snu-list-rad {
                grid-template-columns: minmax(0,1fr) minmax(0,1fr) 68px 22px;
            }
            .snu-col-parti,
            .snu-col-pct-gammel,
            .snu-col-pil,
            .snu-col-pct-ny { display: none; }
        }
        .snu-detalj-innhold {
            padding: 16px 20px 20px;
            background: #f8fafc;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        @media (max-width: 640px) { .snu-detalj-innhold { grid-template-columns: 1fr; } }
        .snu-detalj-kolonne h4 {
            font-size: 0.78rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin: 0 0 10px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .snu-detalj-kolonne.periode-gammel h4,
        .snu-detalj-kolonne.periode-ny h4 { color: #111827; }
        .snu-detalj-oppsummering {
            font-size: 0.82rem;
            font-weight: 600;
            padding: 6px 10px;
            border-radius: var(--radius-sm);
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .snu-detalj-kolonne.periode-gammel .snu-detalj-oppsummering,
        .snu-detalj-kolonne.periode-ny .snu-detalj-oppsummering { background: #f3f4f6; color: #111827; }
        .snu-detalj-votering-liste { display: flex; flex-direction: column; gap: 4px; }
        .snu-detalj-votering {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            padding: 7px 10px;
            border-radius: 6px;
            background: var(--surface);
            border: 1px solid var(--border);
            font-size: 0.83rem;
        }
        .snu-stemme-badge {
            flex-shrink: 0;
            padding: 2px 7px;
            border-radius: 99px;
            font-size: 0.74rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }
        .snu-stemme-badge.for { background: #dcfce7; color: #15803d; }
        .snu-stemme-badge.mot { background: #fee2e2; color: #b91c1c; }
        .snu-votering-tekst { flex: 1; min-width: 0; }
        .snu-votering-tittel {
            font-weight: 600;
            color: var(--primary);
            word-break: break-word;
        }
        .snu-votering-dato { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }
        .snu-detalj-laster { padding: 14px 0; text-align: center; color: var(--text-muted); font-size: 0.88rem; }
        .snu-detalj-feil { color: #b91c1c; font-size: 0.85rem; padding: 8px 0; }

        /* ================================================================
           FELLES HJELPEKLASSER
        ================================================================ */
        .parti-prikk {
            display: inline-block;
            width: 8px; height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .parti-ikon {
            width: 16px;
            height: 16px;
            border-radius: 3px;
            object-fit: contain;
            flex-shrink: 0;
            display: inline-block;
            vertical-align: middle;
        }
        .tom-tilstand {
            text-align: center;
            color: var(--text-muted);
            padding: 32px;
            font-size: 0.92rem;
        }

        @media (max-width: 768px) {
            .panel-kort { padding: 20px 16px; }
            .rebell-maaler { min-width: 120px; }
            .rebell-bar-ute { display: none; }
        }
        @media (max-width: 480px) {
            .tab-btn .tab-label { display: none; }
            .tab-btn { padding: 10px 16px 13px; gap: 0; }
            .tab-btn .tab-ikon { font-size: 1.2rem; }
        }

        /* ================================================================
           PANEL-NAVIGASJON (forrige / neste mellom verktøy)
        ================================================================ */
        .panel-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 36px;
            padding-top: 20px;
            border-top: 1px solid var(--border);
            gap: 12px;
        }
        .panel-nav-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 18px;
            border: 1.5px solid var(--border);
            border-radius: var(--radius-sm);
            background: none;
            color: var(--primary);
            font-family: inherit;
            font-size: 0.84rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
            white-space: nowrap;
            min-width: 130px;
        }
        .panel-nav-btn.forrige { justify-content: flex-start; }
        .panel-nav-btn.neste   { justify-content: flex-end; }
        .panel-nav-btn:hover {
            background: var(--accent);
            border-color: var(--accent);
            color: #fff;
            box-shadow: 0 2px 8px rgba(37,99,235,0.22);
        }
        .panel-nav-btn.skjult {
            opacity: 0;
            pointer-events: none;
        }
        .pnav-dots {
            display: flex;
            align-items: center;
            gap: 7px;
            flex-shrink: 0;
        }
        .pnav-dot {
            height: 7px;
            width: 7px;
            border-radius: 99px;
            background: #cbd5e1;
            cursor: pointer;
            transition: width 0.22s, background 0.18s;
            flex-shrink: 0;
        }
        .pnav-dot.aktiv {
            background: var(--accent);
            width: 22px;
        }
        .pnav-dot:hover:not(.aktiv) { background: #94a3b8; }
        @media (max-width: 480px) {
            .panel-nav-btn { min-width: 90px; font-size: 0.78rem; padding: 8px 12px; }
        }

        /* ================================================================
           4. TAPSGRAF
        ================================================================ */
        .tap-kontrollpanel {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
            align-items: flex-end;
            padding: 20px 0 20px;
        }
        .tap-kontroll-gruppe {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .tap-kontroll-gruppe > label {
            font-size: 0.76rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
        }
        .tap-kontroll-gruppe select,
        .tap-kontroll-gruppe input[type="text"] {
            height: 36px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 0 10px;
            font-size: 0.87rem;
            background: var(--bg-card, #fff);
            color: var(--primary);
            cursor: pointer;
            min-width: 160px;
        }
        .tap-kontroll-gruppe select:focus,
        .tap-kontroll-gruppe input[type="text"]:focus {
            outline: 2px solid var(--accent);
            outline-offset: 1px;
        }
        .tap-periode-rad {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .tap-dato-wrapper {
            position: relative;
            display: inline-block;
            min-width: 130px;
        }
        .tap-dato-wrapper input[type="text"] {
            width: 100%;
            cursor: pointer;
        }
        .tap-dato-wrapper input[type="date"] {
            position: absolute;
            inset: 0;
            opacity: 0;
            width: 100%;
            pointer-events: none;
        }
        .tap-periode-strek { color: var(--text-muted); }
        .tap-y-rad {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .tap-y-rad input[type="range"] {
            width: 130px;
            accent-color: #ef4444;
            cursor: pointer;
        }
        .tap-vis-btn {
            height: 36px;
            padding: 0 20px;
            background: var(--accent);
            color: #fff;
            border: none;
            border-radius: var(--radius-sm);
            font-size: 0.87rem;
            font-weight: 600;
            cursor: pointer;
            transition: opacity 0.15s;
            align-self: flex-end;
            white-space: nowrap;
        }
        .tap-vis-btn:hover:not(:disabled) { opacity: 0.82; }
        .tap-vis-btn:disabled { opacity: 0.45; cursor: default; }
        .tap-graf-wrapper {
            position: relative;
            height: 340px;
            margin-top: 4px;
            margin-bottom: 8px;
        }
        .tap-tom-melding {
            text-align: center;
            color: var(--text-muted);
            padding: 56px 0 40px;
            font-size: 0.9rem;
        }
        @media (max-width: 640px) {
            .tap-kontrollpanel { flex-direction: column; align-items: stretch; gap: 14px; }
            .tap-kontroll-gruppe select,
            .tap-kontroll-gruppe input[type="text"] { width: 100%; }
            .tap-dato-wrapper { width: 100%; }
            .tap-vis-btn { width: 100%; }
            .tap-graf-wrapper { height: 260px; }
        }
