/* =============================================
   REGNSKAPSSIDEN - Main Stylesheet
   ============================================= */

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

/* Screen-reader only (SEO H1 etc.) */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    top: -9999px;
    left: 1rem;
    z-index: 9999;
    background: var(--primary);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--radius) var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}
.skip-link:focus { top: 0; }

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    /* 2026-08-02 (WCAG 1.4.3): egne TEKST-varianter. Variablene under brukes
       ogsaa til rammer, ikoner og bakgrunner, der kravet er lavere - derfor
       endres ikke de, bare color:-deklarasjonene peker om hit.
       Malt kontrast mot hvit / #f8fafc:
         --text-muted   5,43 / 5,19   (var --gray-400: 2,56 / 2,45)
         --success-text 5,02 / 4,79   (var --success:  3,30 / 3,15)
         --warning-text 5,02 / 4,80   (var --warning:  3,19 / 3,04)
         --info-text    5,36 / 5,12   (var --info:     3,68 / 3,52)  */
    --text-muted: #5f6b7a;
    --success-text: #15803d;
    --warning-text: #b45309;
    --info-text: #0e7490;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

html { scroll-behavior: smooth; overflow-x: hidden; }

/* WCAG 2.3.3: respekter brukere som ber om redusert bevegelse */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* Focus states for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =============================================
   HEADER
   ============================================= */

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--gray-900);
    white-space: nowrap;
    flex-shrink: 0;
}

.logo:hover { color: var(--gray-900); }

.logo-icon {
    color: var(--primary);
    font-size: 1.4rem;
}

.logo-text strong { color: var(--primary); }

.main-nav {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.main-nav a {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.main-nav a:hover { color: var(--primary); background: var(--primary-light); }

.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}
.nav-dropdown-toggle i { font-size: 0.7rem; transition: transform 0.2s; }
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
    color: var(--primary);
    background: var(--primary-light);
}
.nav-dropdown.open .nav-dropdown-toggle i { transform: rotate(180deg); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.4rem;
    z-index: 200;
    flex-direction: column;
    gap: 0;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
    padding: 0.55rem 0.75rem !important;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    border-radius: 6px !important;
}
.nav-dropdown-menu a i { width: 16px; text-align: center; color: var(--text-muted); }
.nav-dropdown-menu a:hover i { color: var(--primary); }

.header-search {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 380px;
    margin-left: auto;
    display: flex;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
    background: var(--gray-50);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
    background: #fff;
}

.header-search button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

.header-search button:hover { color: var(--primary); }

/* =============================================
   AUTOCOMPLETE
   ============================================= */

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}

.autocomplete-dropdown.visible { display: block; }

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: background 0.1s;
}

.autocomplete-item:hover { background: var(--primary-light); }

.autocomplete-item-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.autocomplete-item-info { flex: 1; min-width: 0; }
.autocomplete-item-name { font-weight: 500; font-size: 0.9rem; color: #0f172a; color: var(--gray-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-item-sub { font-size: 0.78rem; color: var(--text-muted); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 36px;
    padding: 0.5rem 1.25rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
    text-decoration: none;
    user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Størrelser */
.btn-sm { min-height: 32px; padding: 0.35rem 0.9rem; font-size: 0.82rem; }
.btn-lg { min-height: 44px; padding: 0.75rem 1.6rem; font-size: 1rem; }
.btn-xl { min-height: 52px; padding: 0.9rem 2rem; font-size: 1.05rem; }

/* Varianter */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(29, 78, 216, .15);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 2px 6px rgba(29, 78, 216, .25);
}

.btn-secondary {
    background: #fff;
    border-color: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--gray-400);
    color: var(--gray-900);
    background: var(--gray-50);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-success {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.btn-success:hover:not(:disabled) {
    background: #15803d;
    border-color: #15803d;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Mini-knapp brukt i kalkulator-toolbars (Eksport, Nullstill, Kopier osv).
   Settes globalt for konsistens, men kalkulator-templates kan override hvis
   de trenger spesielt fargeskjema. */
.btn-mini {
    display: inline-flex; align-items: center; gap: .35rem;
    min-height: 32px;
    padding: .35rem .85rem;
    background: var(--gray-50);
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background .13s, border-color .13s, color .13s, transform .08s;
}
.btn-mini:hover:not(:disabled) { background: #fff; border-color: var(--gray-400); color: var(--gray-900); }
.btn-mini:active:not(:disabled) { transform: translateY(1px); }
.btn-mini:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-mini:disabled { opacity: .55; cursor: not-allowed; }

/* Sterk-kontrast versjon for kritiske CTA-er (Lagre, Auto-avstem, Beregn) */
.btn-cta {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 2px 8px rgba(29, 78, 216, .28);
}
.btn-cta:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(29, 78, 216, .35);
    transform: translateY(-1px);
}

/* =============================================
   HERO SECTION
   ============================================= */

.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
    color: #fff;
    padding: 4rem 0 3.5rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.45rem, 4vw, 2.75rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.18;
}

.hero-sub {
    font-size: clamp(.92rem, 1.5vw, 1.1rem);
    opacity: 0.88;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}

.hero-search {
    max-width: 680px;
    margin: 0 auto 1.5rem;
}

.hero-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    overflow: visible;
}
.hero-search-box:focus-within { box-shadow: 0 4px 24px rgba(0,0,0,0.25), 0 0 0 3px rgba(29,78,216,0.35); }

.hero-search-box .search-icon {
    position: absolute;
    left: 1.25rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.hero-search-box input {
    flex: 1;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    font-size: 1rem;
    color: var(--gray-800);
    outline: none;
    background: transparent;
}

.hero-search-box .btn {
    padding: 0.75rem 1.75rem;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-size: 1rem;
    white-space: nowrap;
}

.hero-search-box .autocomplete-dropdown {
    top: calc(100% + 6px);
    border-radius: var(--radius-lg);
}

.hero-examples {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    opacity: 0.85;
}

.hero-examples a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.85;
}

.hero-examples a:hover { opacity: 1; }

/* =============================================
   STATS BAR
   ============================================= */

.stats-bar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-item i {
    font-size: 1.75rem;
    color: var(--primary);
    opacity: 0.8;
}

.stat-item strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-item span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================
   COMPANY CARDS (Featured)
   ============================================= */

.featured-section {
    padding: 3rem 0;
}

/* ── Siste aktivitet (forside) ─────────────────────────────── */
.siste-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.siste-tabs {
    display: flex;
    gap: .5rem;
}
.siste-tab {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem 1rem;
    font-size: .85rem; font-weight: 600;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    background: #fff; color: var(--text-muted);
    cursor: pointer; transition: all .15s;
}
.siste-tab.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.siste-tab:not(.active):hover { border-color: var(--primary); color: var(--primary); }
.siste-header-link {
    font-size: .83rem; color: var(--text-muted); text-decoration: none;
    display: flex; align-items: center; gap: .3rem;
}
.siste-header-link:hover { color: var(--primary); }

.siste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: .6rem;
}
.siste-kort {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: border-color .12s, background .12s;
    overflow: hidden;
    max-width: 100%;
}
.siste-kort:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.siste-kort-avatar {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--gray-200); color: var(--gray-600);
    font-size: .78rem; font-weight: 700; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.siste-kort-body { flex: 1; min-width: 0; overflow: hidden; }
.siste-kort-navn {
    font-size: .875rem; font-weight: 600; color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.siste-kort-meta {
    display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
    font-size: .75rem; color: var(--text-muted); margin-top: .2rem;
    overflow: hidden;
}
.siste-kort-bransje { color: var(--text-muted); }
.siste-kort-dato {
    flex-shrink: 0; font-size: .72rem; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: flex-end; gap: .2rem;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .siste-grid { grid-template-columns: 1fr; }
    .siste-kort { padding: .65rem .75rem; gap: .5rem; }
    .siste-kort-avatar { width: 30px; height: 30px; font-size: .7rem; }
    .siste-kort-bransje { display: none; }
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.company-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.company-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: inherit;
}

.company-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.company-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.company-card-info { flex: 1; min-width: 0; }
.company-card-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-meta i { color: var(--text-muted); width: 14px; text-align: center; }

.company-card-footer {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

.kpi-mini { flex: 1; }
.kpi-label { display: block; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { display: block; font-size: 0.9rem; font-weight: 600; color: var(--gray-800); }

/* =============================================
   INFO SECTION
   ============================================= */

.info-section {
    background: var(--gray-100);
    padding: 3rem 0;
    border-top: 1px solid var(--gray-200);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.info-card {
    text-align: center;
    padding: 1.5rem;
}

.info-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    display: block;
}

.info-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.info-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* =============================================
   SEARCH PAGE
   ============================================= */

.search-page { padding: 2rem 0; }

.search-header { margin-bottom: 1.5rem; }

.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    max-width: 680px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-bar-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,0.15); }

.search-bar-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-bar-wrapper input {
    flex: 1;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    border: none;
    font-size: 1rem;
    outline: none;
    background: transparent;
    color: var(--gray-800);
}

.search-bar-wrapper .btn {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 0.85rem 1.5rem;
}

.search-meta {
    color: var(--gray-600);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.search-meta strong { color: var(--gray-900); }

/* =============================================
   SEARCH RESULTS
   ============================================= */

.results-list { display: flex; flex-direction: column; gap: 0.5rem; }

.result-item {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.15s;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.result-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.result-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.result-main { flex: 1; min-width: 0; }

.result-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.result-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    color: var(--gray-900);
    margin: 0;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.result-meta i { color: var(--text-muted); margin-right: 0.25rem; }

.result-numbers {
    display: flex;
    gap: 1.5rem;
    text-align: right;
    flex-shrink: 0;
}

.result-kpi .kpi-label { font-size: 0.75rem; }
.result-kpi .kpi-value { font-size: 0.92rem; }

.result-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.result-item:hover .result-arrow { color: var(--primary); }

/* =============================================
   BADGES
   ============================================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }

.org-form-badge {
    display: inline-flex;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    text-transform: uppercase;
}

.org-form-badge.large { font-size: 0.82rem; padding: 0.3em 0.8em; }

/* =============================================
   PAGINATION
   ============================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.88rem;
    color: var(--gray-600);
    background: #fff;
    transition: all 0.15s;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =============================================
   NO RESULTS
   ============================================= */

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-results i { font-size: 3rem; margin-bottom: 1rem; color: var(--text-muted); }
.no-results h3 { font-size: 1.25rem; color: var(--gray-700); margin-bottom: 0.5rem; }
.no-results ul { list-style: none; margin-top: 1rem; }
.no-results ul li::before { content: '→ '; color: var(--primary); }

/* =============================================
   COMPANY PAGE
   ============================================= */

.company-page { padding: 2rem 0 4rem; }

.company-hero {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    box-shadow: var(--shadow-sm);
}

.company-hero-left {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.company-big-avatar {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.company-hero h1 {
    font-size: clamp(1.2rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.company-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    row-gap: 0.5rem;
}

.org-nr-display {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.company-hero-kpis {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    min-width: 340px;
}

.hero-kpi {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.hero-kpi-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
}

.hero-kpi-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.company-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
.company-content > .company-main,
.company-content > .company-sidebar { min-width: 0; }

/* Bedrifter på samme adresse: skjul etter 5 som standard (desktop + mobil) */
#naboer-liste .nabo-skjult { display: none !important; }
#naboer-liste.vist .nabo-skjult { display: flex !important; }
#naboer-vis-mer.skjul-modus i { transform: rotate(180deg); }

/* Skjul rader utover 5 i eier/datterselskap-/aksjonær-lister med "Vis mer"-knapp.
   Klassennavnet "mobil-skjult-rad" er historisk - reglene gjelder begge skjermer
   for å holde sidebar/kort kompakte. */
.mobil-skjult-rad { display: none !important; }
.mobil-vist .mobil-skjult-rad { display: table-row !important; }
.konsern-tree.mobil-vist .mobil-skjult-rad { display: flex !important; }
.vis-mer-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.45rem;
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.9rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.vis-mer-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.vis-mer-btn.skjul-nu { color: var(--gray-600); }
.vis-mer-btn.skjul-nu i { transform: rotate(180deg); }

/* Mobile-only PDF-rapport CTA (skjult på desktop) */
.mobile-rapport-cta { display: none; }
@media (max-width: 860px) {
    .mobile-rapport-cta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin: 0.75rem 0 0.5rem;
        padding: 0.7rem 0.9rem;
        background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
        color: #fff;
        border-radius: 10px;
        text-decoration: none;
        box-shadow: 0 2px 8px rgba(29, 78, 216, 0.18);
    }
    .mobile-rapport-cta-left {
        display: flex; align-items: center; gap: 0.65rem; min-width: 0;
    }
    .mobile-rapport-cta-left > i {
        font-size: 1.2rem;
        flex-shrink: 0;
        opacity: 0.9;
    }
    .mobile-rapport-cta-left > span {
        display: flex; flex-direction: column; min-width: 0;
        line-height: 1.3;
    }
    .mobile-rapport-cta-left strong {
        font-size: 0.92rem;
        font-weight: 700;
    }
    .mobile-rapport-cta-sub {
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.78);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-rapport-cta-right {
        display: flex; align-items: center; gap: 0.5rem;
        flex-shrink: 0;
    }
    .mobile-rapport-cta-pris {
        background: rgba(255, 255, 255, 0.2);
        padding: 0.3rem 0.65rem;
        border-radius: 999px;
        font-weight: 700;
        font-size: 0.82rem;
    }
}

/* =============================================
   CARDS
   ============================================= */

.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card:last-child { margin-bottom: 0; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.card-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 i, .card-header h3 i { color: var(--primary); }

.card-body { padding: 1.25rem; }

/* =============================================
   CHART TOGGLE
   ============================================= */

.chart-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--gray-200);
    border-radius: var(--radius);
    padding: 3px;
}

.chart-btn {
    padding: 0.2rem 0.55rem;
    border: none;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s;
    font-family: inherit;
}

.chart-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* =============================================
   REGNSKAP TABLE
   ============================================= */

.table-wrapper { overflow-x: auto; padding: 0; }

.regnskap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.regnskap-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: var(--gray-50);
}

.regnskap-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
}

.regnskap-table tbody tr:hover { background: var(--gray-50); }
.regnskap-table .row-highlight td { background: var(--primary-light); }
.regnskap-table .row-highlight:hover td { background: #dbeafe; }
.regnskap-table .clickable-row { cursor: pointer; }
.regnskap-table .clickable-row:hover td { background: #e0edff; }
.regnskap-table .year-link { color: var(--primary); text-decoration: none; font-weight: 700; }
.regnskap-table .year-link:hover { text-decoration: underline; }

/* Regnskap mobile card layout - hidden on desktop, shown on mobile */
.regnskap-cards { display: none; }

.regnskap-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background .15s;
}
.regnskap-card:hover { background: var(--gray-50); }
.regnskap-card-first { background: var(--primary-light); }
.regnskap-card-first:hover { background: #dbeafe; }

.regnskap-card-year {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: .5rem;
}

.regnskap-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem .75rem;
}
@media (max-width: 480px) {
    .regnskap-card-grid { grid-template-columns: 1fr; gap: 0.4rem; }
}

.regnskap-card-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.regnskap-card-label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.regnskap-card-value {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* =============================================
   NØKKELTALL
   ============================================= */

.nokkel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.nokkel-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    min-width: 0;
}

.nokkel-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    line-height: 1.25;
    hyphens: auto;
    -webkit-hyphens: auto;
    overflow-wrap: break-word;
}

.nokkel-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.15;
}

/* =============================================
   SIDEBAR
   ============================================= */

.company-sidebar { position: sticky; top: 80px; }

.info-list { display: grid; gap: 0; }

.info-list dt {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.75rem;
    font-weight: 600;
}

.info-list dd {
    font-size: 0.9rem;
    color: var(--gray-800);
    margin-top: 0.15rem;
}

.info-list dt:first-child { margin-top: 0; }

/* Reklame-slot - forhindrer layout shift (CLS).
   Tilpasser seg Tradedoubler-formatene 2026-05-11:
     desktop forside/person: 728x90, mobil: 300x250
     desktop selskap-sidebar: 300x600, mobil selskap-inline: 300x250 */
.ad-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: .85rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}
.ad-slot-inner {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.ad-slot-top {
    border-top: 1px solid var(--gray-100);
    min-height: 110px;  /* 728x90 + padding på desktop */
}
@media (max-width: 767px) {
    .ad-slot-top { min-height: 270px; }  /* 300x250 + padding på mobil */
}
.ad-slot-inline {
    min-height: 110px;
    padding: 0;
    background: transparent;
    border: 0;
}
@media (max-width: 767px) {
    .ad-slot-inline { min-height: 270px; }
}
.ad-slot-sidebar {
    min-height: 620px;
    padding: 0;
    background: transparent;
    border: 0;
}
@media (max-width: 767px) {
    .ad-slot-sidebar { min-height: 270px; }  /* mobil bytter til 300x250 */
}

/* Viewability-fix: ad-en INNI sidebaren er nå sticky selv. Det betyr at når
   sidebar slipper (etter at den er scrollet forbi sin parent-høyde),
   forblir ad-en synlig på top:80px gjennom hele resten av siden. Forbedrer
   viewability fra ~48% til 70%+ på desktop. Kun anvendelig på desktop. */
@media (min-width: 768px) {
    .ad-slot-sidebar-sticky {
        position: sticky;
        top: 80px;
        z-index: 1;
    }
    /* Container må ha plass — sidebar-en selv trenger ikke sticky lenger
       siden ad-en er sticky inne i den. Vi fjerner sidebar-sticky for å
       unngå konflikt. */
    .company-sidebar { position: static !important; }
}

/* In-content ad mellom hovedseksjoner. Plasseres etter "Nøkkeltall" på selskap-side. */
.ad-slot-content {
    margin: 1.5rem 0;
    padding: 0;
    background: transparent;
    border: 0;
    min-height: 110px;
    display: flex;
    justify-content: center;
}
@media (max-width: 767px) {
    .ad-slot-content { min-height: 270px; }
}
.ad-creative img { max-width: 100%; height: auto; }

/* 2-kolonne layout for info-list naar den brukes i main-content (bredere plass).
   Bruker CSS columns for at dt+dd holdes sammen vertikalt. */
.info-list-cols {
    display: block;
    column-count: 2;
    column-gap: 2rem;
}
.info-list-cols dt { break-inside: avoid-column; }
.info-list-cols dd { break-after: auto; margin-bottom: .15rem; }
@media (max-width: 720px) {
    .info-list-cols { column-count: 1; }
}

.link-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.link-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--primary);
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.link-list a:last-child { border-bottom: none; }
.link-list a:hover { color: var(--primary-hover); }
.link-list i { width: 16px; text-align: center; }

/* =============================================
   COLORS
   ============================================= */

.positive { color: var(--success-text) !important; }
.negative { color: var(--danger) !important; }

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.empty-state p { font-size: 0.9rem; }

/* =============================================
   NÆRINGER PAGE
   ============================================= */

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.page-sub {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.naeringer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.naering-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.naering-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.naering-kode { font-size: 0.72rem; font-weight: 700; color: var(--primary); letter-spacing: 0.04em; }
.naering-name { font-size: 0.88rem; font-weight: 500; color: var(--gray-800); flex: 1; margin: 0 0.75rem; min-width: 0; overflow-wrap: break-word; }
.naering-count { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.naering-card { flex-direction: row; gap: 0; }

.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; }
.back-link { font-size: 0.82rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.back-link:hover { color: var(--primary); }

/* =============================================
   FOOTER
   ============================================= */

.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding-top: 3rem;
    margin-top: auto;
}

.footer-inner {
    display: grid;
    /* Eksplisitt: brand (bredere) + opptil 5 lenke-kolonner på ÉN rad, topp-justert.
       align-items:start hindrer at en høy brand-celle (med betalingskort) dytter
       lenke-kolonnene nedover. Subdomene-footerne (færre kolonner) lar bare de siste stå tomme. */
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr 1fr;
    align-items: start;
    gap: 2rem 1.5rem;
    padding-bottom: 3rem;
}

.footer-brand .logo-text { font-size: 1.1rem; color: #fff; }
.footer-brand .logo-icon { color: var(--primary); }
.footer-brand p { margin-top: 0.5rem; font-size: 0.85rem; line-height: 1.6; }

/* 22.08.2026: footerkolonnene var h4 rett etter en h2, et hopp over to nivaaer.
   Taggen er h2 naa; utseendet er uendret fordi velgeren folger med. */
.footer-links h2 {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.footer-links a {
    display: block;
    color: #cbd5e1;
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
    transition: color 0.15s;
    text-decoration: none;
}

.footer-links a:hover { color: #fff; }

.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding: 1.25rem 0;
}

.footer-bottom p {
    font-size: 0.82rem;
    color: var(--text-muted); /* WCAG: gray-600 (#475569) ga 2.36:1 mot mørk footer; gray-400 (#94a3b8) gir ~6.9:1 */
    text-align: center;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .company-content { grid-template-columns: 1fr; }
    .company-sidebar { position: static; }
    .company-hero { flex-direction: column; }
    .company-hero-kpis { min-width: auto; width: 100%; }
    .info-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
    /* Nettbrett: 6 kolonner blir for trangt → 3 kolonner (wrapper til flere rader). */
    .footer-inner { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .header-inner { gap: 1rem; }
    .main-nav { display: none; }
    .header-search { max-width: none; }
    .hero { padding: 2.5rem 0; }
    .company-grid { grid-template-columns: 1fr; }
    .nokkel-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
    .result-numbers { display: none; }
    .info-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .company-hero-kpis { grid-template-columns: repeat(2, 1fr); }

    /* Tabs: sticky wrapper + horisontalt scroll på mobil
       iOS krever at sticky og overflow-x er på separate elementer */
    .company-tabs-wrap {
        position: sticky;
        top: 64px;
        z-index: 50;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,.07);
        margin-left: -1rem;
        margin-right: -1rem;
    }
    .company-tabs-wrap .company-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        padding: 0 1rem;
        margin-bottom: 0;
    }
    .company-tabs-wrap .company-tabs::-webkit-scrollbar { display: none; }
    .tab-link { white-space: nowrap; flex-shrink: 0; }

    /* Tabellscrolling */
    .regnskap-table, .detalj-table, .roller-table {
        min-width: 480px;
    }

    /* Skjul mindre viktige kolonner i regnskapsoversikten */
    .regnskap-table th:nth-child(3),
    .regnskap-table td:nth-child(3),
    .regnskap-table th:nth-child(5),
    .regnskap-table td:nth-child(5),
    .regnskap-table th:nth-child(7),
    .regnskap-table td:nth-child(7) { display: none; }

    /* Skjul Født-kolonnen i roller-tabellen */
    .roller-table th:nth-child(3),
    .roller-table td:nth-child(3) { display: none; }
}

/* =============================================
   COMPANY TABS
   ============================================= */

.company-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0;
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    text-decoration: none;
}

.tab-link:hover { color: var(--primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-link i { font-size: 0.85rem; }

.company-hero.compact { padding: 1.25rem; }

/* =============================================
   REGNSKAP DETALJSIDE
   ============================================= */

.year-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.year-btn {
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 100px;
    background: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.15s;
}

.year-btn:hover { border-color: var(--primary); color: var(--primary); }
.year-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.regnskap-detalj-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.detalj-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.detalj-table td {
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.detalj-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.detalj-table tr.section-header td {
    background: var(--gray-50);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.detalj-table tr.subtotal td {
    background: var(--gray-50);
    border-top: 2px solid var(--gray-200);
}

.detalj-table tr.total-row td {
    background: var(--primary-light);
    border-top: 2px solid var(--primary);
    border-bottom: none;
}

.detalj-table tbody tr:hover td { background: var(--gray-50); }
.detalj-table tr.section-header:hover td,
.detalj-table tr.total-row:hover td { background: unset; }
.detalj-table tr.total-row:hover td { background: var(--primary-light); }

.detalj-table td.indent { padding-left: 2.25rem; }
.detalj-table td.indent2 { padding-left: 3.25rem; font-size: 0.8rem; color: var(--text-muted); }

.detalj-table tr.group-header td {
    padding-top: 0.75rem;
    padding-bottom: 0.4rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
    background: transparent;
}

/* Kompakte chart-kort */
.charts-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    margin-bottom: 0;
}
@media (max-width: 700px) { .charts-row { grid-template-columns: 1fr; } }

.chart-mini-card { overflow: hidden; }
.chart-historisk-card { min-width: 0; }

.card-header-sm {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    gap: 0.5rem;
}
.card-header-sm i { color: var(--primary); }

.kapital-mini-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
}
.kapital-mini-body canvas { flex-shrink: 0; width: 90px !important; height: 90px !important; }

.kapital-mini-legend { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-width: 0; }
.kml-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; min-width: 0; }
.kml-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.kml-label { color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.kml-val { color: var(--gray-700); font-weight: 500; font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kml-val em { font-style: normal; color: var(--text-muted); font-size: 0.72rem; }

.chart-toggle-sm { display: flex; gap: 2px; }

/* =============================================
   ROLLER & EIERE
   ============================================= */

.roller-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

.roller-main { min-width: 0; }

.roller-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.roller-table th {
    text-align: left;
    padding: 0.65rem 1.25rem;
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--gray-50);
    white-space: nowrap;
}

.roller-table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.roller-table tbody tr:hover td { background: var(--gray-50); }
.roller-table tr.fratraadt td { opacity: 0.5; }

.person-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.person-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.role-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

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

.andel-bar {
    height: 6px;
    background: var(--primary);
    border-radius: 3px;
    min-width: 4px;
    max-width: 120px;
}

@media (max-width: 1024px) {
    .roller-layout { grid-template-columns: 1fr; }
    .regnskap-detalj-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.5rem; }
    /* Behold 2-kolonne for nøkkeltall - viser mer info pa en skjerm */
    .stats-grid { grid-template-columns: 1fr; }
    .hero-search-box { flex-direction: column; border-radius: var(--radius-lg); }
    .hero-search-box input { border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-left: 1.25rem; }
    .hero-search-box .btn { border-radius: 0 0 var(--radius-lg) var(--radius-lg); width: 100%; justify-content: center; }
    .hero-search-box .search-icon { display: none; }
}

/* =============================================
   REGNSKAP DETALJSIDE - EKSTRA
   ============================================= */

.year-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.year-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.regnskap-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.regnskap-kpi-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-sm);
}

.rk-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.rk-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.detalj-table tr.grand-total td {
    font-size: 1rem;
    background: var(--primary-light);
    border-top: 2px solid var(--primary);
}

@media (max-width: 768px) {
    .regnskap-detalj-grid { grid-template-columns: 1fr; }
    .regnskap-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .year-hint { display: none; }
}

/* =============================================
   KREDITTSCORE
   ============================================= */

.score-card { }
.score-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 0.5rem; }
.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 4px solid;
    flex-shrink: 0;
}
.score-lav { border-color: #16a34a; color: #16a34a; background: #f0fdf4; }
.score-moderat { border-color: #d97706; color: #d97706; background: #fffbeb; }
.score-forhoeyet { border-color: #ea580c; color: #ea580c; background: #fff7ed; }
.score-hoy { border-color: #dc2626; color: #dc2626; background: #fef2f2; }
.score-num { font-size: 1.5rem; line-height: 1; }
.score-maks { font-size: 0.7rem; color: var(--text-muted); }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 1rem; }
.score-table td { padding: 0.5rem 0; border-bottom: 1px solid var(--gray-100); }
.score-bar-cell { width: 120px; }
.score-bar-bg { height: 6px; background: var(--gray-100); border-radius: 3px; }
.score-bar-fill { height: 6px; border-radius: 3px; transition: width 0.5s; }
.status-god .score-bar-fill { background: #16a34a; }
.status-ok .score-bar-fill { background: #d97706; }
.status-svak .score-bar-fill, .status-negativ .score-bar-fill { background: #dc2626; }

/* =============================================
   BRANSJESAMMENLIGNING
   ============================================= */

.bransje-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.bransje-item { background: var(--gray-50); border-radius: var(--radius); padding: 0.75rem; min-width: 0; }
.bransje-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.bransje-compare { display: flex; gap: 0.75rem; }
.bransje-val { text-align: center; flex: 1; min-width: 0; }
.bransje-val .val { font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.bransje-val .lbl { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Statistikk-sider ─────────────────────── */
.stat-hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 55%, #1e3a8a 100%);
    color: #fff;
    padding: 3.5rem 0 4.5rem;
    position: relative;
    overflow: hidden;
}
.stat-hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 20% 10%, rgba(59,130,246,0.25) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 90%, rgba(16,185,129,0.18) 0%, transparent 50%);
    pointer-events: none;
}
.stat-hero .container { position: relative; text-align: center; }
.stat-hero h1 { font-size: clamp(1.5rem, 4.5vw, 2.6rem); font-weight: 800; margin: 0 0 0.6rem; letter-spacing: -0.02em; color: #fff; line-height: 1.15; word-break: break-word; }
.stat-hero p { color: rgba(255,255,255,0.75); font-size: clamp(0.92rem, 2.5vw, 1.05rem); max-width: 660px; margin: 0 auto; line-height: 1.5; }
@media (max-width: 640px) {
    .stat-hero { padding: 2.25rem 0 3rem; }
}
.stat-hero-eyebrow { display: inline-flex; align-items: center; gap: 0.45rem; background: rgba(255,255,255,0.12); color: #93c5fd; border: 1px solid rgba(255,255,255,0.15); border-radius: 999px; padding: 0.35rem 1rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1.15rem; backdrop-filter: blur(8px); }

.stat-subnav { background: #fff; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.stat-subnav::before, .stat-subnav::after { content: ''; position: absolute; top: 0; bottom: 1px; width: 20px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.stat-subnav::before { left: 0; background: linear-gradient(to right, #fff, transparent); }
.stat-subnav::after { right: 0; background: linear-gradient(to left, #fff, transparent); }
.stat-subnav.scroll-left::before, .stat-subnav.scroll-right::after { opacity: 1; }
.stat-subnav-inner { max-width: 1100px; margin: 0 auto; display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; padding: 0 1rem; position: relative; }
.stat-subnav-inner::-webkit-scrollbar { display: none; }
.stat-subnav .container { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; padding: 0 0.5rem; max-width: none; }
.stat-subnav .container::-webkit-scrollbar { display: none; }
.stat-subnav-link { display: inline-flex; align-items: center; gap: 0.45rem; padding: 1rem 1.1rem; color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 0.88rem; white-space: nowrap; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.stat-subnav-link:hover { color: var(--gray-800); background: var(--gray-50); }
.stat-subnav-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: #eff6ff; }
.stat-subnav-link i { font-size: 0.85rem; }

.stat-container { max-width: 1100px; padding: 2.25rem 1.25rem 5rem; margin-left: auto; margin-right: auto; }
@media (max-width: 640px) {
    .stat-container { padding: 1.5rem 1rem 4rem; }
}

.stat-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.85rem; margin: 0 0 2.5rem; }
.stat-kpi {
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: 14px; padding: 1.35rem 1rem; text-align: left;
    position: relative; overflow: hidden; transition: transform 0.15s, box-shadow 0.15s;
}
.stat-kpi::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--gray-300); }
.stat-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.05); }
.stat-kpi .kpi-num { font-size: clamp(1.35rem, 3vw, 1.95rem); font-weight: 800; color: var(--gray-900); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-kpi .kpi-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.45rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-kpi.red::before { background: #dc2626; }
.stat-kpi.red .kpi-num { color: #dc2626; }
.stat-kpi.orange::before { background: #d97706; }
.stat-kpi.orange .kpi-num { color: #d97706; }
.stat-kpi.green::before { background: #059669; }
.stat-kpi.green .kpi-num { color: #059669; }

.stat-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; margin-bottom: 3rem; }
.stat-highlight-card { display: flex; align-items: center; gap: 0.9rem; background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 1rem 1.1rem; transition: border-color 0.15s, transform 0.15s; }
.stat-highlight-card:hover { border-color: var(--gray-300); transform: translateY(-1px); }
.stat-highlight-card .hl-ikon { width: 2.9rem; height: 2.9rem; border-radius: 10px; background: #eff6ff; color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }
.stat-highlight-card .hl-ikon.hl-rod { background: #fef2f2; color: #dc2626; }
.stat-highlight-card .hl-ikon.hl-lilla { background: #faf5ff; color: #7c3aed; }
.stat-highlight-card .hl-ikon.hl-gron { background: #f0fdf4; color: #059669; }
.stat-highlight-card .hl-body { min-width: 0; flex: 1; }
.stat-highlight-card .hl-tall { font-size: 1.4rem; font-weight: 800; color: var(--gray-900); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-highlight-card .hl-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.15rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-highlight-card .hl-link { display: block; font-size: 0.84rem; color: var(--primary); text-decoration: none; margin-top: 0.3rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.stat-highlight-card .hl-link:hover { text-decoration: underline; }

.stat-section { margin-bottom: 3rem; }
.stat-section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.1rem; }
.stat-section h2 { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin: 0 0 1.1rem; display: flex; align-items: center; gap: 0.6rem; letter-spacing: -0.01em; }
.stat-section-sub { font-size: 0.82rem; color: var(--text-muted); font-weight: 400; }
.chart-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 1.5rem; position: relative; }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap-tall { position: relative; height: 380px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.stat-nav-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.stat-nav-card { display: block; background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 1.35rem 1.25rem; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; position: relative; }
.stat-nav-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 10px 24px rgba(37,99,235,0.08); }
.stat-nav-card .snc-ikon { width: 3rem; height: 3rem; border-radius: 12px; background: linear-gradient(135deg, #eff6ff, #dbeafe); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; margin-bottom: 0.9rem; }
.stat-nav-card .snc-ikon.snc-rod { background: linear-gradient(135deg, #fef2f2, #fee2e2); color: #dc2626; }
.stat-nav-card .snc-ikon.snc-lilla { background: linear-gradient(135deg, #faf5ff, #f3e8ff); color: #7c3aed; }
.stat-nav-card .snc-ikon.snc-gra { background: linear-gradient(135deg, #f9fafb, #f3f4f6); color: var(--gray-600); }
.stat-nav-card .snc-ikon.snc-gron { background: linear-gradient(135deg, #f0fdf4, #dcfce7); color: #059669; }
.stat-nav-card h3 { font-size: 1rem; font-weight: 700; color: var(--gray-900); margin: 0 0 0.4rem; letter-spacing: -0.01em; }
.stat-nav-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; line-height: 1.5; }
.stat-nav-card .snc-arrow { position: absolute; top: 1.35rem; right: 1.25rem; color: var(--text-muted); transition: color 0.15s, transform 0.15s; }
.stat-nav-card:hover .snc-arrow { color: var(--primary); transform: translateX(3px); }

.stat-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.stat-table th { text-align: left; padding: 0.75rem 1rem; background: var(--gray-50); color: var(--gray-600); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--gray-200); }
.stat-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--gray-100); }
.stat-table tbody tr:last-child td { border-bottom: none; }
.stat-table tbody tr:hover { background: var(--gray-50); }

.stat-rangliste { list-style: none; padding: 0; margin: 0; counter-reset: stat; }
.stat-rangliste li { counter-increment: stat; display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.stat-rangliste li:nth-child(odd) { background: var(--gray-50); }
.stat-rangliste li:last-child { border-bottom: none; }
.stat-rangliste li:hover { background: #eff6ff; }
.stat-rangliste li::before { content: counter(stat); background: #fff; color: var(--text-muted); border: 1px solid var(--gray-200); width: 1.75rem; height: 1.75rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.stat-rangliste li:nth-child(-n+3)::before { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; border-color: #fbbf24; }
.stat-rangliste .sr-navn { flex: 1; min-width: 0; color: inherit; text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-rangliste .sr-navn:hover { color: var(--primary); }
.stat-rangliste .sr-tall { font-weight: 700; color: var(--gray-800); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.92rem; }

@media (max-width: 720px) {
    .stat-kpi-row { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
    .two-col { grid-template-columns: 1fr; }
    .stat-hero { padding: 2rem 0 1.5rem; }
    .chart-wrap { height: 260px; }
    .chart-wrap-tall { height: 320px; }
    .stat-subnav-link { padding: 0.75rem 0.75rem; font-size: 0.85rem; }
}

.flagg-strip { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.flagg { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.flagg-rod { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flagg-gul { background: #fef3c7; color: #854d0e; border: 1px solid #fcd34d; }
.flagg i { font-size: 0.85em; }

.nokkeltall-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.nokkeltall-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius);
    padding: 0.85rem 0.95rem;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.nokkeltall-item .nk-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.25; }
.nokkeltall-item .nk-row { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.35rem; }
.nokkeltall-item .nk-val { font-size: 1.3rem; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gray-900); }
.nokkeltall-item .nk-spark {
    width: 100%;
    height: 28px;
    color: #1d4ed8;
    opacity: 0.75;
    margin-top: 0.1rem;
}

@media (max-width: 640px) {
    .bransje-grid, .nokkeltall-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .bransje-item, .nokkeltall-item { padding: 0.6rem; }
    .bransje-compare { gap: 0.35rem; }
    .bransje-val .val { font-size: 0.95rem; }
    .nokkeltall-item .nk-val { font-size: 1.05rem; }
    .nokkeltall-item .nk-spark { width: 54px; height: 24px; }
    .nokkeltall-item .nk-row { min-height: 36px; gap: 0.4rem; }
}

/* =============================================
   TOPP-LISTE
   ============================================= */

.topp-page { padding: 2rem 0 4rem; }
.topp-filter { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

.topp-table { width: 100%; border-collapse: collapse; }
.topp-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
    white-space: nowrap;
}
.topp-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); }
.topp-table tbody tr:hover { background: var(--gray-50); }

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}
.rank-1 { background: #fbbf24; color: #78350f; }
.rank-2 { background: #94a3b8; color: #fff; }
.rank-3 { background: #b45309; color: #fff; }
.rank-other { background: var(--gray-100); color: var(--text-muted); }

/* =============================================
   SAMMENLIGN
   ============================================= */

.sammenlign-page { padding: 2rem 0 4rem; }
.compare-search-row { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; align-items: center; }
.compare-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 100px;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.85rem;
    background: var(--gray-50);
}
.compare-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; text-align: center; }
.compare-table td.metric-name { font-weight: 500; color: var(--gray-600); background: var(--gray-50); text-align: left; }
.compare-best { background: #f0fdf4 !important; font-weight: 600; color: var(--success-text); }
.compare-table tbody tr:hover td { background: var(--gray-50); }
.compare-table tbody tr:hover td.compare-best { background: #dcfce7 !important; }

/* =============================================
   UTILITY BUTTONS
   ============================================= */

.share-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.9rem;
    min-height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: 100px;
    background: #fff;
    font-size: 0.8rem;
    color: var(--gray-600);
    font-family: inherit;
    transition: all 0.15s;
}
.share-btn:hover { border-color: var(--primary); color: var(--primary); }

.fav-btn {
    cursor: pointer;
    width: 40px;
    height: 40px;
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.15s;
    flex-shrink: 0;
}
.fav-btn.active, .fav-btn:hover { color: #fbbf24; border-color: #fbbf24; }

.kart-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--primary);
    margin-top: 0.5rem;
}
.kart-link:hover { color: var(--primary-hover); }

/* =============================================
   HENDELSER TIMELINE
   ============================================= */

.hendelser-timeline { padding: 1.25rem 1.5rem; }

.hendelse-row {
    display: grid;
    grid-template-columns: 100px 32px 1fr;
    gap: 0 0.75rem;
    margin-bottom: 0;
}

.hendelse-dato-col {
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
}

.hendelse-dato {
    font-size: .78rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.hendelse-dot-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hendelse-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.hendelse-dot.badge-success { background: var(--success); }
.hendelse-dot.badge-danger  { background: var(--danger); }
.hendelse-dot.badge-warning { background: var(--warning); }
.hendelse-dot.badge-info    { background: #6366f1; }
.hendelse-dot.badge-primary { background: var(--primary); }
.hendelse-dot.badge-neutral { background: var(--gray-400); }

.hendelse-line {
    width: 2px;
    flex: 1;
    background: var(--gray-100);
    min-height: 24px;
    margin-top: 4px;
}

.hendelse-innhold-col {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding-bottom: 1.25rem;
}

.hendelse-tittel {
    font-size: .875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.hendelse-kilde {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ── Moderne tidslinje ─────────────────────────────── */
.tidslinje-card .card-body { background: var(--gray-50, #f9fafb); }
.tl {
    list-style: none;
    padding: 0.5rem 0 1.5rem;
    margin: 0;
    position: relative;
}
.tl::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent 0, var(--gray-200, #e5e7eb) 2rem, var(--gray-200, #e5e7eb) calc(100% - 2rem), transparent 100%);
}

/* Ars-chip sentrert pa linjen */
.tl-year {
    position: relative;
    margin: 1.25rem 0 0.75rem;
    padding: 0 1.5rem 0 1.25rem;
    display: flex;
    justify-content: flex-start;
    z-index: 2;
}
.tl-year span {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 3.5rem;
    height: 2rem;
    padding: 0 0.85rem;
    margin-left: 1rem;
    background: var(--gray-900, #111827);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 0 0 4px var(--gray-50, #f9fafb);
    font-variant-numeric: tabular-nums;
}
.tl-year:first-child { margin-top: 0.5rem; }

/* Selve hendelses-raden */
.tl-item {
    position: relative;
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 0.5rem;
    padding: 0.25rem 1.5rem 0.25rem 0;
    min-height: 3rem;
    align-items: flex-start;
}

/* Dot med ikon */
.tl-marker {
    grid-column: 1;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: 1.25rem;
    margin-top: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    background: var(--gray-400, #9ca3af);
    box-shadow: 0 0 0 4px var(--gray-50, #f9fafb), 0 2px 4px rgba(0,0,0,0.06);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.tl-item:hover .tl-marker { transform: scale(1.08); }

.tl-primary .tl-marker { background: #2563eb; }
.tl-success .tl-marker { background: #059669; }
.tl-danger .tl-marker  { background: #dc2626; }
.tl-warning .tl-marker { background: #d97706; }
.tl-info .tl-marker    { background: #6366f1; }
.tl-neutral .tl-marker { background: #6b7280; }

/* Kort med hendelses-innhold */
.tl-card {
    grid-column: 2;
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    padding: 0.7rem 0.95rem;
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tl-item:hover .tl-card {
    border-color: var(--gray-300, #d1d5db);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.tl-primary .tl-card { border-left: 3px solid #2563eb; }
.tl-success .tl-card { border-left: 3px solid #059669; }
.tl-danger .tl-card  { border-left: 3px solid #dc2626; background: #fef2f2; }
.tl-warning .tl-card { border-left: 3px solid #d97706; background: #fffbeb; }
.tl-info .tl-card    { border-left: 3px solid #6366f1; }
.tl-neutral .tl-card { border-left: 3px solid #9ca3af; }

.tl-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.tl-date {
    font-size: 0.72rem;
    color: var(--gray-500, #6b7280);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tl-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900, #111827);
    margin: 0;
    line-height: 1.35;
}
.tl-detail {
    font-size: 0.82rem;
    color: var(--gray-600, #4b5563);
    margin: 0.25rem 0 0;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .tl::before { left: 1.65rem; }
    .tl-item { grid-template-columns: 3.5rem 1fr; padding-right: 1rem; }
    .tl-marker { width: 2rem; height: 2rem; margin-left: 0.65rem; font-size: 0.7rem; }
    .tl-year { padding-left: 0.5rem; }
    .tl-year span { margin-left: 0.35rem; }
    .tl-card { padding: 0.6rem 0.75rem; border-radius: 8px; }
    .tl-title { font-size: 0.88rem; }
    .tl-detail { font-size: 0.78rem; }
}

/* =============================================
   HISTORIKK DROPDOWN
   ============================================= */

.historikk-btn {
    cursor: pointer;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.4rem 0.65rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.15s;
}
.historikk-btn:hover { border-color: var(--primary); color: var(--primary); }

.historikk-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 260px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 0.5rem 0;
    display: none;
}
.historikk-dropdown.open { display: block; }
.historikk-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--gray-700);
    transition: background 0.1s;
    text-decoration: none;
}
.historikk-item:hover { background: var(--gray-50); color: var(--gray-900); }
.historikk-item strong { display: block; font-size: 0.88rem; }
.historikk-item small { color: var(--text-muted); }

@media (max-width: 768px) {
    .historikk-btn-label { display: none; }
}

/* =============================================
   FILTER PANEL (search page)
   ============================================= */

.filter-panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.filter-panel label {
    font-size: 0.85rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.filter-panel select {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: #fff;
    color: var(--gray-700);
    font-family: inherit;
    margin-left: 0.3rem;
}

/* =============================================
   FORMÅL
   ============================================= */

.formaal-text {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}
.formaal-text:last-child { margin-bottom: 0; }

/* =============================================
   RESPONSIVE - NEW
   ============================================= */

@media (max-width: 768px) {
    .compare-search-row { flex-direction: column; align-items: stretch; }
    .topp-filter { flex-direction: column; align-items: flex-start; }
}

/* =============================================
   MOBILE HAMBURGER MENU
   ============================================= */

.nav-hamburger {
    display: none;
    align-items: center;
    gap: 0.45rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 0.95rem 0.55rem 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(37,99,235,0.18);
    transition: background 0.15s, box-shadow 0.15s;
}
.nav-hamburger:hover, .nav-hamburger:focus-visible {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37,99,235,0.28);
    outline: none;
}
.nav-hamburger-icon {
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    width: 18px;
    height: 14px;
    flex-shrink: 0;
}
.nav-hamburger-icon span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.25s;
    transform-origin: center;
}
.nav-hamburger-label { letter-spacing: 0.01em; }
.nav-hamburger.open .nav-hamburger-icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open .nav-hamburger-icon span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open .nav-hamburger-icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 1060px) {
    .historikk-btn-label { display: none; }
    .header-inner { gap: 0.75rem; }
}

@media (max-width: 860px) {
    .nav-hamburger { display: inline-flex; min-height: 44px; }

    .main-nav {
        display: none;
        position: fixed;
        top: 0;
        right: -100%;
        bottom: 0;
        left: auto;
        width: min(86vw, 380px);
        max-width: 380px;
        height: 100vh;
        height: 100dvh;
        background: #fff;
        border-left: 1px solid var(--gray-200);
        box-shadow: -8px 0 32px rgba(0,0,0,0.18);
        flex-direction: column;
        padding: 4.5rem 0 1.5rem;
        z-index: 1001;
        gap: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        touch-action: pan-y;
        transition: right 0.22s ease;
    }
    .main-nav.open {
        display: flex;
        right: 0;
    }

    .header-search { max-width: 200px; }

    /* Dropdown-strukturen: vis header som seksjonstittel (ikke klikkbar i mobil) */
    .nav-dropdown {
        display: flex;
        flex-direction: column;
        margin: 0;
    }
    .nav-dropdown-toggle {
        display: flex !important;
        align-items: center;
        padding: 1rem 1.25rem 0.4rem !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        cursor: default !important;
        pointer-events: none;
        font-size: 0.72rem !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
    .nav-dropdown-toggle i.fa-chevron-down {
        display: none !important;
    }
    .nav-dropdown-menu {
        display: flex !important;
        flex-direction: column !important;
        position: static !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        min-width: 0 !important;
    }

    /* Alle lenker som menyrader - felles styling */
    #main-nav > a,
    .nav-dropdown-menu a {
        display: flex !important;
        align-items: center;
        gap: 0.75rem;
        padding: 0.85rem 1.25rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        border-radius: 0 !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        color: var(--gray-800) !important;
        text-decoration: none !important;
        transition: background 0.12s, color 0.12s;
    }

    /* Ikoner: vis dem med konsistent størrelse */
    #main-nav > a i,
    .nav-dropdown-menu a i {
        display: inline-flex !important;
        width: 1.25rem;
        flex-shrink: 0;
        text-align: center;
        font-size: 0.95rem;
        color: var(--text-muted);
    }

    /* Hover/active */
    #main-nav > a:hover, #main-nav > a:active,
    .nav-dropdown-menu a:hover, .nav-dropdown-menu a:active {
        background: #eff6ff !important;
        color: var(--primary) !important;
    }
    #main-nav > a:hover i, #main-nav > a:active i,
    .nav-dropdown-menu a:hover i, .nav-dropdown-menu a:active i {
        color: var(--primary) !important;
    }

    /* Topp-nivå-lenker (Hjem, Statistikk, Varsler, Verktøy) får ikoner via :before */
    #main-nav > a {
        font-weight: 600 !important;
    }

    /* Liten ekstra topp-margin for hver dropdown-seksjon for visuell separasjon */
    .nav-dropdown + .nav-dropdown,
    #main-nav > a + .nav-dropdown,
    .nav-dropdown + a {
        border-top: 8px solid var(--gray-50);
    }

    /* Lukk-knapp i drawer (vises kun når menyen er åpen) */
    .main-nav::after {
        content: '✕';
        position: absolute;
        top: 1rem;
        right: 1.25rem;
        font-size: 1.4rem;
        color: var(--text-muted);
        cursor: pointer;
        line-height: 1;
        font-weight: 300;
    }
}

/* =============================================
   MOBILE - COMPREHENSIVE IMPROVEMENTS
   ============================================= */

@media (max-width: 640px) {

    /* --- Spacing --- */
    .container { padding: 0 1rem; }

    /* --- Header: search wraps to second row --- */
    .header-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 0.5rem 0;
        gap: 0.5rem;
        row-gap: 0;
    }
    .logo { flex: 1; min-width: 0; font-size: 1.1rem; }
    .logo-icon { font-size: 1.25rem; }
    .header-search {
        order: 3;
        flex: 0 0 100%;
        max-width: none;
        margin-left: 0;
        padding-bottom: 0.5rem;
    }
    .historikk-btn { display: none; }
    /* Mobil-meny er full-høyde side-drawer styrt av regelen i 860px-breakpointet.
       Ingen overstyring av top her - bevar fixed top:0 fra side-drawer. */
    /* Skjul ".no"-suffix på smale skjermer slik at logo + Meny + Logg inn får plass */
    .logo-text strong { display: none; }
    .logo-text::after { content: 'basen'; font-weight: 700; }

    /* --- Company page --- */
    .company-page { padding: 1rem 0 2.5rem; }
    .company-hero { padding: 1rem; gap: 1rem; margin-bottom: 1rem; }
    .company-hero-left { gap: 0.75rem; }
    .company-big-avatar { width: 48px; height: 48px; font-size: 1rem; border-radius: var(--radius); }
    .company-hero h1 { font-size: 1.15rem; margin-bottom: 0.35rem; }
    .company-hero-kpis { min-width: 0; width: 100%; gap: 0.5rem; }
    .hero-kpi { padding: 0.6rem 0.75rem; }
    .hero-kpi-value { font-size: 1rem !important; }

    /* --- Tabs --- */
    .company-tabs { gap: 0; }
    .tab-link { padding: 0.6rem 0.75rem; font-size: 0.8rem; gap: 0.3rem; }
    .tab-link i { font-size: 0.8rem; }

    /* --- Cards --- */
    .card-header { padding: 0.75rem 1rem; }
    .card-body { padding: 0.875rem 1rem; }
    .card-header h2 { font-size: 0.95rem; }
    .card-header h3 { font-size: 0.9rem; }

    /* --- Regnskapsoversikt: vis kort i stedet for tabell --- */
    .regnskap-desktop { display: none !important; }
    .regnskap-cards { display: block !important; }

    /* --- Regnskap detaljside --- */
    .detalj-table { font-size: 0.8rem; }
    .detalj-table td { padding: 0.45rem 0.85rem; }
    .detalj-table td.indent { padding-left: 1.5rem; }
    .detalj-table td.indent2 { padding-left: 2rem; font-size: 0.74rem; }
    .regnskap-detalj-grid { gap: 0.875rem; }
    .regnskap-kpi-row { gap: 0.5rem; margin-bottom: 0.875rem; }
    .regnskap-kpi-card { padding: 0.6rem 0.75rem; }
    .rk-value { font-size: 0.9rem; }

    /* --- Nøkkeltall-grid --- */
    .nokkel-value { font-size: 1.05rem; }
    .nokkel-item { padding: 0.7rem 0.875rem; }

    /* --- Kredittscore --- */
    .score-bar-cell { display: none; }
    .score-table td { padding: 0.4rem 0; font-size: 0.82rem; }

    /* --- Topp-liste tabell --- */
    .topp-page { padding: 1rem 0 2.5rem; }
    .topp-table { font-size: 0.82rem; }
    .topp-table th,
    .topp-table td { padding: 0.55rem 0.65rem; }

    /* --- Roller-tabell --- */
    .roller-table { font-size: 0.82rem; }
    .roller-table th,
    .roller-table td { padding: 0.55rem 0.85rem; }

    /* --- Page titles --- */
    .page-title { font-size: 1.3rem; }
    .page-sub { font-size: 0.9rem; }

    /* --- Footer --- */
    .site-footer { padding: 1.5rem 0 1rem; }

    /* --- Sammenlign / Topp filter --- */
    .compare-search-row { flex-direction: column; align-items: stretch; }
    .topp-filter { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .topp-filter > div { flex-wrap: wrap; }

    /* --- Underenheter / search results --- */
    .company-grid { grid-template-columns: 1fr; }
}

/* Skjul "Sted"-kolonnen i topp-listen på mobil */
@media (max-width: 640px) {
    .topp-table th:nth-child(3),
    .topp-table td:nth-child(3) { display: none; }
}

/* Touch targets: minste 44px for klikkelbare elementer */
@media (max-width: 640px) {
    .btn, button, .tab-link, .main-nav a { min-height: 44px; }
    .header-search input { height: 40px; font-size: 16px; /* hindrer zoom på iOS */ }
    .search-input { font-size: 16px; }
    /* Søkeresultater dropdown */
    .search-dropdown-item { padding: .75rem 1rem; }
    /* Favoritter/knapper på selskapssider */
    .company-action-btn { min-height: 40px; padding: .5rem .85rem; }
}

/* Skjul enda flere kolonner i regnskapsoversikten på svært smal skjerm */
@media (max-width: 480px) {
    .regnskap-table th:nth-child(6),
    .regnskap-table td:nth-child(6),
    .regnskap-table th:nth-child(8),
    .regnskap-table td:nth-child(8) { display: none; }
    .regnskap-table { min-width: 300px; }

    /* Tabs: stables ikonene vertikalt */
    .tab-link { flex-direction: column; gap: 0.05rem; padding: 0.55rem 0.6rem; font-size: 0.72rem; }
    .tab-link i { font-size: 0.95rem; }

    /* KPI-rad i regnskap detaljside */
    .regnskap-kpi-row { grid-template-columns: 1fr 1fr; }

    /* Kompakt hero */
    .company-hero.compact { padding: 0.75rem; }
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

/* Layout */
.table-wrapper      { padding: 0; overflow-x: auto; }
.overflow-x-auto    { overflow-x: auto; }
.cursor-pointer     { cursor: pointer; }
.no-margin          { margin: 0; }

/* Flex helpers */
.flex-center        { display: flex; align-items: center; }
.flex-center-gap    { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.flex-gap-wrap      { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.flex-gap-4         { display: flex; gap: 1rem; }
.flex-col-gap-3     { display: flex; flex-direction: column; gap: 0.75rem; }
.flex-center-gap-wrap { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.relative           { position: relative; }

/* Spacing */
.mt-1  { margin-top: 0.4rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-5  { margin-bottom: 1.25rem; }
.mb-6  { margin-bottom: 1.5rem; }
.py-8  { padding: 2rem 0; }
.p-8   { padding: 2rem; }
.p-12  { padding: 3rem; }

/* Typography */
.text-primary       { color: var(--primary); }
.text-secondary     { color: var(--text-muted); }
.text-muted         { color: var(--text-muted); font-size: 0.875rem; }
.text-muted-xs      { font-size: 0.8rem; color: var(--text-muted); }
.text-sm-secondary  { font-size: 0.85rem; color: var(--text-muted); }
.text-sm-muted      { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.5rem; }
.text-right-sm-muted { text-align: right; font-size: 0.8rem; color: var(--text-muted); }
.font-600           { font-weight: 600; }
.heading-compact    { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }

/* Icon helpers */
.icon-primary   { color: var(--primary); }
.icon-amber     { color: #f59e0b; }
.icon-gold      { color: #fbbf24; }
.icon-muted     { color: var(--text-muted); margin-right: 0.25rem; }
.icon-xl-muted  { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Table helpers */
.th-right    { text-align: right; }
.td-right    { text-align: right; }
.td-centered { text-align: center; }
.td-right-bold { text-align: right; font-weight: 700; }
.card-body--flush { padding: 0; overflow-x: auto; }

/* Error pages */
.error-page-container { padding: 5rem 0; text-align: center; }
.error-code { font-size: 5rem; font-weight: 800; color: var(--gray-200); line-height: 1; }

/* Chip helpers */
.chip-close { color: inherit; font-weight: 700; text-decoration: none; margin-left: 0.2rem; }

/* Form helpers */
.form-select { padding: 0.45rem 0.75rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 0.88rem; background: #fff; color: var(--gray-700); font-family: inherit; }

/* Search components */
.search-box-container { position: relative; flex: 1; max-width: 480px; }
.search-icon-abs { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: 0.9rem; outline: none; font-family: inherit; background: #fff; color: var(--gray-800); transition: border-color 0.15s; }
.search-input:focus { border-color: var(--primary); }

/* =============================================
   BREADCRUMBS
   ============================================= */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); font-size: 0.7rem; }
.breadcrumb-current { color: var(--gray-600); font-weight: 500; }

/* =============================================
   PRINT STYLES
   ============================================= */

@media print {
    /* Hide non-essential elements */
    .site-header,
    .site-footer,
    .company-tabs,
    .skip-link,
    .share-btn,
    .fav-btn,
    .kart-link,
    .btn,
    .chart-tabs,
    nav,
    .no-print { display: none !important; }

    /* Reset backgrounds and shadows */
    body { background: #fff; font-size: 12pt; color: #000; }
    .company-hero { background: #fff !important; color: #000 !important; border-bottom: 2pt solid #000; padding: 0.5rem 0; }
    .company-hero * { color: #000 !important; }
    .tab-panel { display: block !important; }
    .tab-panel + .tab-panel { page-break-before: always; }

    /* Cards without shadows */
    .card, .info-card, .data-card { box-shadow: none !important; border: 1pt solid #ccc !important; }

    /* Tables */
    .table-wrapper { overflow: visible; }
    table { width: 100%; border-collapse: collapse; font-size: 10pt; }
    th, td { border: 0.5pt solid #ccc; padding: 4pt 6pt; }
    thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    .regnskap-table th { background: #f0f0f0 !important; }
    .regnskap-row-sum td { border-top: 1pt solid #000; font-weight: bold; }

    /* Show full URLs on links */
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }

    /* Progress bars → text only */
    .progress-bar { display: none; }

    /* Ensure charts don't block content */
    .chart-container { max-height: 200px; }

    /* Page title */
    .company-name::before {
        content: "Regnskapsbasen.no - ";
        font-weight: normal;
        font-size: 10pt;
    }
}

/* =============================================
   SØKETYPE-TABS (selskaper / person)
   ============================================= */

.search-type-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.search-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    background: #fff;
    transition: all 0.15s;
}

.search-type-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.search-type-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* =============================================
   KONSERNKART
   ============================================= */

.konsern-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 1rem 0;
}

.konsern-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.konsern-node {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-200);
    background: #fff;
    min-width: 260px;
    max-width: 400px;
}

.konsern-node i { font-size: 1.4rem; flex-shrink: 0; }

.konsern-node-parent { border-color: var(--gray-300); }
.konsern-node-parent i { color: var(--text-muted); }

.konsern-node-current { border-color: var(--primary); background: var(--primary-light); }
.konsern-node-current i { color: var(--primary); }

.konsern-node-child { border-color: var(--gray-200); font-size: 0.9rem; min-width: 180px; }
.konsern-node-child i { color: var(--text-muted); font-size: 1rem; }

.konsern-node-more {
    border-style: dashed;
    color: var(--text-muted);
    font-size: 0.85rem;
    justify-content: center;
    min-width: 120px;
}

.konsern-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.1rem; }
.konsern-name { font-weight: 600; color: #0f172a; color: var(--gray-900); display: block; }
a.konsern-name:hover { color: var(--primary); }
.konsern-orgnr { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

.konsern-line-down {
    width: 2px;
    height: 32px;
    background: var(--gray-300);
    margin: 0 auto;
}

.konsern-children-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 0 1rem;
}

.soesken-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-100);
}

.soesken-section h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

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

.soesken-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--gray-700);
    background: var(--gray-50);
    transition: all 0.15s;
}

.soesken-item:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.soesken-avatar {
    width: 22px; height: 22px;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Konsernstruktur-tre ─────────────────────────────────────────────────── */
.konsern-tree {
    font-size: 0.9rem;
    line-height: 1.8;
    padding: 0.25rem 0;
}

.konsern-node {
    display: flex;
    align-items: center;
    padding: 0.2rem 0;
}

.konsern-connector {
    color: var(--text-muted);
    font-family: monospace;
    min-width: 1.4rem;
    font-size: 1rem;
}

.konsern-this strong {
    color: var(--primary);
}

.konsern-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.konsern-badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

@media (max-width: 480px) {
    .konsern-node { font-size: 0.85rem; }
}

/* ── Mobile-responsive tabeller ─────────────────────────────────────────── */

/* Regnskap-oversikt: skjul mindre viktige kolonner */
@media (max-width: 640px) {
  .regnskap-table th:nth-child(3),
  .regnskap-table td:nth-child(3) { display: none; } /* Driftsresultat */
  .regnskap-table th:nth-child(5),
  .regnskap-table td:nth-child(5) { display: none; } /* Sum eiendeler */
  .regnskap-table th:nth-child(7),
  .regnskap-table td:nth-child(7) { display: none; } /* Sum gjeld */
  .regnskap-table th:nth-child(8),
  .regnskap-table td:nth-child(8) { display: none; } /* Ansatte */

  .regnskap-table th, .regnskap-table td { font-size: .8rem; padding: .5rem .6rem; }

  /* Score-tabell: skjul poeng-bar på liten skjerm, vis brøk */
  .score-bar-cell { display: none; }
  .score-table td:last-child { font-size: 0.75rem; color: var(--text-muted); }
}

/* Roller-tabeller: kortlayout på mobil */
@media (max-width: 600px) {
  .roller-table thead { display: none; }
  .roller-table,
  .roller-table tbody,
  .roller-table tr { display: block; }
  .roller-table tr {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    position: relative;
  }
  .roller-table tr:last-child { border-bottom: none; }
  .roller-table td {
    display: block;
    padding: .1rem 0;
    border: none;
    font-size: .875rem;
  }
  /* Første celle = korttittel (navn/selskap) */
  .roller-table td:first-child { margin-bottom: .25rem; }
  /* Sekundære celler: vis data-label som prefiks */
  .roller-table td[data-label]:not(:first-child)::before {
    content: attr(data-label) ': ';
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  /* Status-badge: absolutt posisjonert øverst til høyre */
  .roller-table td[data-label="Status"] {
    position: absolute;
    top: .65rem;
    right: 1rem;
    padding: 0;
  }
  .roller-table td[data-label="Status"]::before { display: none; }
  /* Andel-bar: vis bare tekst, skjul bar */
  .andel-bar-wrap { display: inline; }
  .andel-bar { display: none; }
  /* Aksjonær: skjul org.nr og antall aksjer */
  .roller-table td[data-label="Org.nr"],
  .roller-table td[data-label="Antall aksjer"] { display: none; }
  /* Rettighetshavere: skjul stemmeandel og grunnlag */
  .roller-table td[data-label="Stemmeandel"],
  .roller-table td[data-label="Grunnlag"] { display: none; }
  /* Person-søk: skjul sted */
  .roller-table td[data-label="Sted"] { display: none; }
  /* Historiske roller: ingen absolutt posisjonering (ingen status-col) */
  .fratraadt td[data-label="Status"] { display: none; }
}


/* =============================================
   UX FIXES - MOBILE / TOUCH (april 2026)
   ============================================= */

/* #2: Hindre iOS auto-zoom på søkefelt (641-860px) */
@media (max-width: 860px) {
    .header-search input { font-size: 16px; }
}

/* #3: Hamburger touch target (merged into main rule above) */

/* #4: Søkefiltre stacker på mobil */
@media (max-width: 640px) {
    .filter-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .filter-panel label {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .filter-panel select {
        width: 100%;
        margin-left: 0;
        min-height: 44px;
        font-size: 16px;
    }
    .filter-panel .btn,
    .filter-panel button {
        width: 100%;
        min-height: 44px;
    }
}

/* #5: Konkursfeed-tabell - skjul kolonner på mobil */
@media (max-width: 768px) {
    .konkursfeed-table th:nth-child(6),
    .konkursfeed-table td:nth-child(6) { display: none; } /* Ansatte */
}
@media (max-width: 640px) {
    .konkursfeed-table th:nth-child(5),
    .konkursfeed-table td:nth-child(5),
    .konkursfeed-table th:nth-child(6),
    .konkursfeed-table td:nth-child(6) { display: none; } /* Kommune + Ansatte */
    .konkursfeed-table { min-width: 400px; }
}
@media (max-width: 480px) {
    .konkursfeed-table th:nth-child(4),
    .konkursfeed-table td:nth-child(4) { display: none; } /* Type */
    .konkursfeed-table { min-width: 300px; }
}

/* #8: Konkursfeed datovelger + statusfiltre touch targets */
@media (max-width: 640px) {
    .kf-filter input[type="date"],
    .kf-filter input[type="text"],
    .kf-filter select,
    .kf-filter button {
        min-height: 44px;
        font-size: 16px;
    }
    .kf-status-tabs a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* #9: Søk type-tabs touch targets */
@media (max-width: 640px) {
    .search-type-tab {
        padding: 0.6rem 1rem;
        min-height: 44px;
    }
}

/* #10: Konsern-tre responsivt */
@media (max-width: 640px) {
    .konsern-node { min-width: 0; max-width: 100%; }
    .konsern-node-child { min-width: 0; }
    .konsern-node-more { min-width: 0; }
}

/* #11: Touch :active states for alle interaktive elementer */
@media (hover: none) {
    .btn:active, button:active, .tab-link:active, .page-btn:active,
    .search-type-tab:active, .ktab:active, a.result-card:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}


/* =============================================
   Truncate-pattern: tabeller med "Vis alle"-knapp
   Bruk på <tbody class="truncate-10">, .truncate-rows-10 osv.
   ============================================= */
.truncate-10 > tr:nth-child(n+11),
.truncate-rows-10 > *:nth-child(n+11) {
    display: none;
}
.truncate-10.expanded > tr,
.truncate-rows-10.expanded > * {
    display: revert;
}
.vis-mer-knapp {
    display: block;
    width: 100%;
    background: #f8fafc;
    border: none;
    border-top: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
    text-align: center;
    color: #1d4ed8;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s;
}
.vis-mer-knapp:hover { background: #eff6ff; }
.vis-mer-knapp:focus-visible { outline: 2px solid #1d4ed8; outline-offset: -2px; }
.vis-mer-knapp i { transition: transform 0.2s; margin-right: 0.4rem; }
.vis-mer-knapp.expanded i { transform: rotate(180deg); }


/* ANNONSEFLATER AV 12.08.2026.
   AdSense og Tradedoubler er fjernet (ad_slot() returnerer tom Markup i
   app.py). Beholderne staar fortsatt i malene, og reglene over gir dem
   min-height: 270px. MAALT etter fjerningen: 270 px tomrom paa forside,
   selskapsside, personside og bransjeside.
   Vi kollapser dem her i stedet for aa redigere aatte maler. Skrus annonsene
   paa igjen, fjernes denne blokka. */
.ad-slot,
.ad-slot-top,
.ad-slot-inline,
.ad-slot-sidebar,
.ad-slot-sidebar-sticky,
.ad-slot-mobil-inline,
.ad-slot-inner {
    display: none !important;
}
